@ikalogic/at1000 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/at1000-BGZGhgco.mjs +3 -0
- package/build/at1000-BGZGhgco.mjs.map +1 -0
- package/build/at1000-D9r6GCs0.cjs +3 -0
- package/build/at1000-D9r6GCs0.cjs.map +1 -0
- package/build/browser.cjs +1 -1
- package/build/browser.cjs.map +1 -1
- package/build/browser.d.cts +1 -1
- package/build/browser.d.mts +1 -1
- package/build/browser.mjs +1 -1
- package/build/browser.mjs.map +1 -1
- package/build/{com-B2R6yhB4.d.cts → com-XQjoTBdU.d.cts} +39 -39
- package/build/{com-B2R6yhB4.d.cts.map → com-XQjoTBdU.d.cts.map} +1 -1
- package/build/{com-B2R6yhB4.d.mts → com-XQjoTBdU.d.mts} +39 -39
- package/build/{com-B2R6yhB4.d.mts.map → com-XQjoTBdU.d.mts.map} +1 -1
- package/build/com.d.cts +1 -1
- package/build/com.d.mts +1 -1
- package/build/{events-zRq39ozC.d.cts → events-Cf7iAMZP.d.cts} +4 -3
- package/build/events-Cf7iAMZP.d.cts.map +1 -0
- package/build/{events-zRq39ozC.d.mts → events-Cf7iAMZP.d.mts} +4 -3
- package/build/events-Cf7iAMZP.d.mts.map +1 -0
- package/build/events.cjs +1 -1
- package/build/events.d.cts +1 -1
- package/build/events.d.mts +1 -1
- package/build/events.mjs +1 -1
- package/build/{gpio-xjqg-50L.d.cts → gpio-Bk1VEKYF.d.cts} +17 -7
- package/build/gpio-Bk1VEKYF.d.cts.map +1 -0
- package/build/{gpio-DThbC_mm.d.mts → gpio-bFe112uI.d.mts} +17 -7
- package/build/gpio-bFe112uI.d.mts.map +1 -0
- package/build/gpio.cjs.map +1 -1
- package/build/gpio.d.cts +1 -1
- package/build/gpio.d.mts +1 -1
- package/build/gpio.mjs.map +1 -1
- package/build/{hmi-6SM_R-VX.d.cts → hmi-B-potLdl.d.cts} +3 -3
- package/build/{hmi-6SM_R-VX.d.cts.map → hmi-B-potLdl.d.cts.map} +1 -1
- package/build/{hmi-6SM_R-VX.d.mts → hmi-B-potLdl.d.mts} +3 -3
- package/build/{hmi-6SM_R-VX.d.mts.map → hmi-B-potLdl.d.mts.map} +1 -1
- package/build/hmi.d.cts +1 -1
- package/build/hmi.d.mts +1 -1
- package/build/{at1000-Bk6QeH1q.d.cts → host-BCOEcUog.d.cts} +18 -16
- package/build/host-BCOEcUog.d.cts.map +1 -0
- package/build/{at1000-BG_IKvW8.d.mts → host-DJ8SAGMC.d.mts} +18 -16
- package/build/host-DJ8SAGMC.d.mts.map +1 -0
- package/build/management-BGrPAG5k.cjs +7 -0
- package/build/management-BGrPAG5k.cjs.map +1 -0
- package/build/management-CuI4cenF.mjs +7 -0
- package/build/management-CuI4cenF.mjs.map +1 -0
- package/build/management.cjs +1 -1
- package/build/management.d.cts +41 -25
- package/build/management.d.cts.map +1 -1
- package/build/management.d.mts +41 -25
- package/build/management.d.mts.map +1 -1
- package/build/management.mjs +1 -1
- package/build/node.cjs +1 -1
- package/build/node.cjs.map +1 -1
- package/build/node.d.cts +1 -1
- package/build/node.d.mts +1 -1
- package/build/node.mjs +1 -1
- package/build/node.mjs.map +1 -1
- package/build/package-CXtuh0C5.mjs +2 -0
- package/build/package-CXtuh0C5.mjs.map +1 -0
- package/build/{package-ByQuarMd.cjs → package-DDLRsahz.cjs} +2 -2
- package/build/package-DDLRsahz.cjs.map +1 -0
- package/build/{power-CUrqOTyE.d.cts → power-B8QFbKdP.d.cts} +9 -9
- package/build/{power-CUrqOTyE.d.cts.map → power-B8QFbKdP.d.cts.map} +1 -1
- package/build/{power-SmiM6n5O.d.mts → power-BZmXOJyK.d.mts} +9 -9
- package/build/{power-SmiM6n5O.d.mts.map → power-BZmXOJyK.d.mts.map} +1 -1
- package/build/power.cjs.map +1 -1
- package/build/power.d.cts +1 -1
- package/build/power.d.mts +1 -1
- package/build/power.mjs.map +1 -1
- package/build/session.cjs +1 -1
- package/build/session.mjs +1 -1
- package/package.json +5 -1
- package/build/at1000-BG_IKvW8.d.mts.map +0 -1
- package/build/at1000-BaJD2vC5.mjs +0 -8
- package/build/at1000-BaJD2vC5.mjs.map +0 -1
- package/build/at1000-Bk6QeH1q.d.cts.map +0 -1
- package/build/at1000-DuULyDOw.cjs +0 -8
- package/build/at1000-DuULyDOw.cjs.map +0 -1
- package/build/events-zRq39ozC.d.cts.map +0 -1
- package/build/events-zRq39ozC.d.mts.map +0 -1
- package/build/gpio-DThbC_mm.d.mts.map +0 -1
- package/build/gpio-xjqg-50L.d.cts.map +0 -1
- package/build/package-ByQuarMd.cjs.map +0 -1
- package/build/package-gaVXFnhN.mjs +0 -2
- package/build/package-gaVXFnhN.mjs.map +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{t as e}from"./common-Ce3FeF-Q.mjs";import"up-fetch";import*as t from"valibot";function n(e,t){let n=t||8080;if(e.startsWith(`[`))return e.includes(`]:`)?e:`${e}:${n}`;let r=e.indexOf(`:`);return r===-1?`${e}:${n}`:r===e.lastIndexOf(`:`)?e:`[${e}]:${n}`}function r(e){if(e.startsWith(`[`)){let t=e.indexOf(`]`);return t===-1?e:e.slice(1,t)}let t=e.indexOf(`:`);return t!==-1&&t===e.lastIndexOf(`:`)?e.slice(0,t):e}let i=function(e){return e.Can=`can`,e.Rs232=`rs232`,e.Rs485=`rs485`,e.I2c=`i2c`,e.Spi=`spi`,e.Uart=`uart`,e}({});const a=t.enum(i),o=t.object({min:t.pipe(t.number(),t.minValue(-24),t.maxValue(24)),max:t.pipe(t.number(),t.minValue(-24),t.maxValue(24))}),s=t.object({min:e,max:e}),c=t.object({max:t.number()}),l=t.object({count:t.pipe(t.number(),t.minValue(1)),input_voltage:s,output_voltage:o}),u=t.object({count:t.pipe(t.number(),t.minValue(0)),max_current:t.number(),max_voltage:t.number(),on_resistance:t.pipe(t.number(),t.minValue(0))}),d=t.object({type:t.picklist([`3.0`,`2.0`]),count:t.pipe(t.number(),t.minValue(1))}),f=t.object({type:t.picklist([`1000BASE-T`,`100BASE-T`,`10BASE-T`]),count:t.pipe(t.number(),t.minValue(1))}),p=t.object({type:a,count:t.pipe(t.number(),t.minValue(1))}),m=t.object({count:t.pipe(t.number(),t.minValue(1)),output_voltage:o,current:c}),h=t.object({type:t.picklist([`low_precision`,`high_precision`]),source:t.string(),resolution:t.pipe(t.number(),t.minValue(0))}),g=t.object({width:t.pipe(t.number(),t.minValue(1)),height:t.pipe(t.number(),t.minValue(1))}),_=t.object({type:t.string(),size:g}),v=t.object({count:t.pipe(t.number(),t.minValue(0)),type:t.string()}),y=t.object({count:t.pipe(t.number(),t.minValue(0)),type:t.string()}),b=t.object({display:_,input:v,speaker:y}),x=t.object({io:l,relays:u,usb_ports:t.array(d),ethernet:t.array(f),communication:t.array(p),power_supply:m,current_measurement:t.array(h),hmi:b}),S=t.object({model:t.string(),hostname:t.string(),serial_number:t.string(),firmware_version:t.string(),firmware_commit:t.string(),hardware_version:t.optional(t.number()),disk_used:t.number(),disk_total:t.number(),docker_used:t.number(),ram_used:t.optional(t.number()),ram_total:t.optional(t.number()),cpu_temperature:t.optional(t.number()),capabilities:x}),C=t.picklist([`idle`,`running`,`error`]),w=t.picklist([`created`,`started`,`stopped`,`removed`,`error`]),T=t.picklist([`tcp`,`udp`]),E=t.pipe(t.number(),t.integer(),t.minValue(1),t.maxValue(65535)),D=t.object({host:E,container:E,proto:T}),O=t.pipe(t.string(),t.trim(),t.regex(/^(ssh-|ecdsa-sha2-|sk-ssh-|sk-ecdsa-)/,`Not a recognized SSH public key`)),k=t.picklist([`normal`,`development`]),A=t.object({stream:t.picklist([`stdout`,`stderr`]),line:t.string()}),j=t.object({name:t.string(),path:t.string(),id:t.string(),image:t.string(),is_default:t.boolean(),ports:t.optional(t.array(D),[]),command:t.optional(t.string(),``),state:C,mode:t.optional(k),password_set:t.optional(t.boolean())}),M=t.variant(`change`,[t.object({change:t.literal(`state_changed`),id:t.string(),state:w}),t.object({change:t.literal(`renamed`),id:t.string(),name:t.string()}),t.object({change:t.literal(`default_changed`),id:t.string(),is_default:t.boolean()})]),N=t.partial(t.pick(j,[`name`,`is_default`,`command`])),P=t.picklist([`nodejs`,`python`]);t.object({name:t.string(),template:P,command:t.optional(t.string())});const F=t.object({bundle:t.string(),version:t.string(),compatible:t.string(),description:t.string()}),I=t.object({message:t.string(),bundle:t.string()}),L=t.object({state:t.picklist([`idle`,`installing`,`failed`]),progress:t.number(),message:t.string(),error:t.string(),boot:t.optional(t.picklist([`confirmed`,`pending`,`unknown`]))}),R=t.object({message:t.string()}),z=t.pipe(t.number(),t.finite()),B=t.pipe(t.number(),t.finite(),t.minValue(Number.MIN_VALUE)),V=t.pipe(t.number(),t.integer(),t.minValue(0),t.maxValue(31)),H=t.pipe(t.number(),t.integer(),t.minValue(0),t.maxValue(7)),U=t.pipe(t.number(),t.integer(),t.minValue(0),t.maxValue(1)),W=t.picklist([`pass`,`fail`]),G=t.object({set:z,measured:z,reading:t.optional(z)}),K=t.object({channel:V,points:t.array(G),max_error:z,avg_error:z}),q=t.object({voltage:t.object({points:t.array(G),max_error:z,avg_error:z}),current:t.object({load_ohms:B,points:t.array(G),max_error:z,avg_error:z})}),J=t.object({load_ohms:B,voltage_applied:z,measured_current:z,expected_current:z,error_percent:z}),Y=t.object({relay:H,status:W,test_voltage:z,closed_current:z,open_current:z,calibration:t.optional(K)}),X=t.object({port:U,status:W,voltage:z,current_tests:t.optional(t.array(J))}),Z=t.object({schema_version:t.literal(1),tool_version:t.string(),device_id:t.string(),timestamp:t.string(),firmware_version:t.string(),dac:t.array(K),adc_positive:t.array(K),adc_negative:t.optional(t.array(K)),dut_psu:q,relays:t.array(Y),usb:t.array(X)}),Q=t.object({enabled:t.boolean(),loaded:t.boolean(),last_error:t.optional(t.nullable(t.string())),calibrated_at:t.optional(t.nullable(t.string()))}),$=t.object({enabled:t.boolean()});var ee=class{fetch;host;constructor(e,t){this.fetch=e,this.host=t}info(){return this.fetch(`/management/info`,{schema:S})}get_calibration(){return this.fetch(`/management/calibration`,{schema:Z})}set_calibration(e){return this.fetch(`/management/calibration`,{method:`PUT`,body:t.parse(Z,e),schema:Z})}get_calibration_state(){return this.fetch(`/management/calibration/state`,{schema:Q})}set_calibration_enabled(e){return this.fetch(`/management/calibration/state`,{method:`PATCH`,body:t.parse($,{enabled:e}),schema:Q})}enable_calibration(){return this.set_calibration_enabled(!0)}disable_calibration(){return this.set_calibration_enabled(!1)}async datetime(){let e=await this.fetch(`/management/datetime`,{schema:t.object({epoch_seconds:t.number()})});return new Date(e.epoch_seconds*1e3)}setDatetime(e){return this.fetch(`/management/datetime`,{method:`POST`,body:{epoch_seconds:Math.floor(e.getTime()/1e3)},parseResponse:()=>{}})}getProjects(){return this.fetch(`/management/projects`,{schema:t.array(j)})}listImages(){return this.fetch(`/management/images`,{schema:t.array(t.string())})}getProject(e){return this.fetch(`/management/projects/${e}`,{schema:j})}createProject(e){return this.fetch(`/management/projects`,{method:`POST`,body:e,timeout:3e4,schema:j})}importProject(e,t){return this.fetch(`/management/projects/import`,{method:`POST`,body:e,headers:{"Content-Type":`application/x-tar`,"X-Project-Name":encodeURIComponent(t)},serializeBody:e=>e,timeout:6e5,schema:j})}updateProject(e,n){return this.fetch(`/management/projects/${e}`,{method:`PATCH`,body:t.parse(N,n),schema:j})}runProject(e,t=`normal`){return this.fetch(`/management/projects/${e}/run`,{method:`POST`,body:{mode:t},timeout:3e4})}stopProject(e){return this.fetch(`/management/projects/${e}/stop`,{method:`POST`,timeout:3e4})}getProjectPorts(e){return this.fetch(`/management/projects/${e}/ports`,{schema:t.array(D)})}setProjectPorts(e,n){return this.fetch(`/management/projects/${e}/ports`,{method:`PUT`,body:t.parse(t.array(D),n),timeout:3e4,schema:t.array(D)})}addProjectPort(e,n){return this.fetch(`/management/projects/${e}/ports`,{method:`POST`,body:t.parse(D,n),timeout:3e4,schema:t.array(D)})}deleteProjectPort(e,t){return this.fetch(`/management/projects/${e}/ports/${t}`,{method:`DELETE`,parseResponse:()=>{},timeout:3e4})}setProjectPassword(e,n){return this.fetch(`/management/projects/${e}/password`,{method:`POST`,body:t.parse(t.object({password:t.pipe(t.string(),t.minLength(1))}),{password:n}),parseResponse:()=>{},timeout:3e4})}getProjectAuthorizedKeys(e){return this.fetch(`/management/projects/${e}/authorized_keys`,{schema:t.array(t.string())})}setProjectAuthorizedKeys(e,n){return this.fetch(`/management/projects/${e}/authorized_keys`,{method:`PUT`,body:t.parse(t.array(O),n),timeout:3e4,schema:t.array(t.string())})}deleteProject(e){return this.fetch(`/management/projects/${e}`,{method:`DELETE`,timeout:3e4})}upload_bundle(e,t=`bundle.raucb`){return this.fetch(`/management/update/upload`,{method:`POST`,body:e,headers:{"Content-Type":`application/octet-stream`,"X-Bundle-Filename":t},serializeBody:e=>e,timeout:6e5,schema:F})}bundle_info(){return this.fetch(`/management/update/bundle-info`,{schema:F})}install_update(){return this.fetch(`/management/update/install`,{method:`POST`,schema:I})}update_status(){return this.fetch(`/management/update/status`,{schema:L})}reboot(){return this.fetch(`/management/reboot`,{method:`POST`,schema:R})}getProjectLogs(e,n){let r=n?.tail??1e3;return this.fetch(`/management/projects/${e}/logs?tail=${r}`,{schema:t.array(A)})}streamProjectLogs(e,r,i){let a=i?.tail??1e3,o=new AbortController,s=`http://${n(this.host)}/v0/management/projects/${e}/logs/stream?tail=${a}`;return(async()=>{try{let e=await fetch(s,{signal:o.signal});if(!e.ok||e.body===null)throw Error(`Log stream failed: HTTP ${e.status}`);let n=e.body.getReader(),i=new TextDecoder,a=``,c=e=>{let n=`message`,i=``;for(let t of e.split(`
|
|
2
|
+
`))t.startsWith(`event:`)?n=t.slice(6).trim():t.startsWith(`data:`)&&(i+=t.slice(5).trim());if(n===`end`)return r.onEnd?.(),!0;if(n===`log`&&i.length>0){let e=t.safeParse(A,JSON.parse(i));e.success&&r.onLine(e.output)}return!1};for(;;){let{done:e,value:t}=await n.read();if(e)break;a+=i.decode(t,{stream:!0});let r=a.indexOf(`
|
|
3
|
+
|
|
4
|
+
`);for(;r!==-1;){let e=a.slice(0,r);if(a=a.slice(r+2),c(e)){o.abort();return}r=a.indexOf(`
|
|
5
|
+
|
|
6
|
+
`)}}}catch(e){if(o.signal.aborted)return;r.onError?.(e)}})(),{close:()=>o.abort()}}};export{D as a,k as c,r as d,Q as i,L as l,ee as n,j as o,Z as r,M as s,i as t,n as u};
|
|
7
|
+
//# sourceMappingURL=management-CuI4cenF.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"management-CuI4cenF.mjs","names":[],"sources":["../src/host.ts","../src/api/management.ts"],"sourcesContent":["const DEFAULT_PORT = 8080;\n\n/**\n * Formats a host into a URL authority. Returns `host` unchanged when it already\n * carries an explicit port; otherwise appends `fallbackPort` (the device's\n * mDNS-advertised port when known, else the default 8080). Bare IPv6 literals\n * are bracketed. Idempotent: re-formatting an authority is a no-op.\n */\nexport function format_host_for_url(host: string, fallbackPort?: number): string {\n const port = fallbackPort || DEFAULT_PORT;\n if (host.startsWith('[')) {\n return host.includes(']:') ? host : `${host}:${port}`;\n }\n const firstColon = host.indexOf(':');\n if (firstColon === -1) {\n return `${host}:${port}`;\n }\n if (firstColon === host.lastIndexOf(':')) {\n return host; // exactly one colon: host:port already specified\n }\n return `[${host}]:${port}`; // bare IPv6 literal, no port\n}\n\n/** Returns the bare host (IP or hostname) from a URL authority, dropping any port. */\nexport function host_without_port(host: string): string {\n if (host.startsWith('[')) {\n const end = host.indexOf(']');\n return end === -1 ? host : host.slice(1, end); // [ipv6] / [ipv6]:port -> ipv6\n }\n const firstColon = host.indexOf(':');\n if (firstColon !== -1 && firstColon === host.lastIndexOf(':')) {\n return host.slice(0, firstColon); // host:port -> host\n }\n return host; // bare hostname/IPv4 or bare IPv6 literal\n}\n","import { type UpFetch } from 'up-fetch';\nimport * as v from 'valibot';\n\nimport { format_host_for_url } from '../host';\nimport { analogLevel } from './common';\n\nexport enum CommunicationInterfaceType {\n Can = 'can',\n Rs232 = 'rs232',\n Rs485 = 'rs485',\n I2c = 'i2c',\n Spi = 'spi',\n Uart = 'uart',\n}\nconst communicationInterface = v.enum(CommunicationInterfaceType);\n\nconst voltageRange = v.object({\n min: v.pipe(v.number(), v.minValue(-24), v.maxValue(24)),\n max: v.pipe(v.number(), v.minValue(-24), v.maxValue(24)),\n});\n\nconst inputVoltageRange = v.object({ min: analogLevel, max: analogLevel });\n\nconst currentRange = v.object({ max: v.number() });\n\nconst ioCapabilities = v.object({\n count: v.pipe(v.number(), v.minValue(1)),\n input_voltage: inputVoltageRange,\n output_voltage: voltageRange,\n});\n\nconst relaysCapabilities = v.object({\n count: v.pipe(v.number(), v.minValue(0)),\n max_current: v.number(),\n max_voltage: v.number(),\n on_resistance: v.pipe(v.number(), v.minValue(0)),\n});\n\nconst usbCapability = v.object({\n type: v.picklist(['3.0', '2.0']),\n count: v.pipe(v.number(), v.minValue(1)),\n});\n\nconst ethernetCapability = v.object({\n type: v.picklist(['1000BASE-T', '100BASE-T', '10BASE-T']),\n count: v.pipe(v.number(), v.minValue(1)),\n});\n\nconst communicationCapability = v.object({\n type: communicationInterface,\n count: v.pipe(v.number(), v.minValue(1)),\n});\n\nconst powerSupplyCapabilities = v.object({\n count: v.pipe(v.number(), v.minValue(1)),\n output_voltage: voltageRange,\n current: currentRange,\n});\n\nconst currentMeasurementCapabilities = v.object({\n type: v.picklist(['low_precision', 'high_precision']),\n source: v.string(),\n resolution: v.pipe(v.number(), v.minValue(0)),\n});\n\nconst screenSize = v.object({\n width: v.pipe(v.number(), v.minValue(1)),\n height: v.pipe(v.number(), v.minValue(1)),\n});\n\nconst displayCapabilities = v.object({ type: v.string(), size: screenSize });\n\nconst inputCapabilities = v.object({ count: v.pipe(v.number(), v.minValue(0)), type: v.string() });\n\nconst audioCapabilities = v.object({ count: v.pipe(v.number(), v.minValue(0)), type: v.string() });\n\nconst hmiCapabilities = v.object({\n display: displayCapabilities,\n input: inputCapabilities,\n speaker: audioCapabilities,\n});\n\nconst capabilities = v.object({\n io: ioCapabilities,\n relays: relaysCapabilities,\n usb_ports: v.array(usbCapability),\n ethernet: v.array(ethernetCapability),\n communication: v.array(communicationCapability),\n power_supply: powerSupplyCapabilities,\n current_measurement: v.array(currentMeasurementCapabilities),\n hmi: hmiCapabilities,\n});\n\nconst info = v.object({\n model: v.string(),\n hostname: v.string(),\n serial_number: v.string(),\n firmware_version: v.string(),\n firmware_commit: v.string(),\n hardware_version: v.optional(v.number()),\n disk_used: v.number(),\n disk_total: v.number(),\n docker_used: v.number(),\n // Added to the server after firmware 0.3.3 — optional so older devices stay discoverable.\n ram_used: v.optional(v.number()),\n ram_total: v.optional(v.number()),\n cpu_temperature: v.optional(v.number()),\n capabilities: capabilities,\n});\nexport type Information = v.InferOutput<typeof info>;\n\nconst projectStatus = v.picklist(['idle', 'running', 'error']);\nconst projectEventState = v.picklist(['created', 'started', 'stopped', 'removed', 'error']);\nconst portProtocol = v.picklist(['tcp', 'udp']);\nconst port = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(65535));\nexport const portMapping = v.object({ host: port, container: port, proto: portProtocol });\nexport type PortMapping = v.InferOutput<typeof portMapping>;\nconst authorizedKey = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^(ssh-|ecdsa-sha2-|sk-ssh-|sk-ecdsa-)/, 'Not a recognized SSH public key'),\n);\nexport const runMode = v.picklist(['normal', 'development']);\nexport type RunMode = v.InferOutput<typeof runMode>;\n\nconst logLine = v.object({ stream: v.picklist(['stdout', 'stderr']), line: v.string() });\nexport type LogLine = v.InferOutput<typeof logLine>;\n\nexport const project = v.object({\n name: v.string(),\n path: v.string(),\n id: v.string(),\n image: v.string(),\n is_default: v.boolean(),\n ports: v.optional(v.array(portMapping), []),\n command: v.optional(v.string(), ''),\n state: projectStatus,\n mode: v.optional(runMode),\n password_set: v.optional(v.boolean()),\n});\nexport type Project = v.InferOutput<typeof project>;\n\n// Merged management.project realtime event, discriminated on `change`.\nexport const projectEvent = v.variant('change', [\n v.object({ change: v.literal('state_changed'), id: v.string(), state: projectEventState }),\n v.object({ change: v.literal('renamed'), id: v.string(), name: v.string() }),\n v.object({ change: v.literal('default_changed'), id: v.string(), is_default: v.boolean() }),\n]);\nexport type ProjectEvent = v.InferOutput<typeof projectEvent>;\n\nconst projectPatch = v.partial(v.pick(project, ['name', 'is_default', 'command']));\nexport type ProjectPatch = v.InferOutput<typeof projectPatch>;\n\nconst projectTemplate = v.picklist(['nodejs', 'python']);\nexport type ProjectTemplate = v.InferOutput<typeof projectTemplate>;\n\nconst createProject = v.object({\n name: v.string(),\n template: projectTemplate,\n command: v.optional(v.string()),\n});\nexport type CreateProject = v.InferOutput<typeof createProject>;\n\nconst bundleInfo = v.object({\n bundle: v.string(),\n version: v.string(),\n compatible: v.string(),\n description: v.string(),\n});\nexport type BundleInfo = v.InferOutput<typeof bundleInfo>;\n\nconst installResponse = v.object({ message: v.string(), bundle: v.string() });\nexport type InstallResponse = v.InferOutput<typeof installResponse>;\n\nexport const updateStatus = v.object({\n state: v.picklist(['idle', 'installing', 'failed']),\n progress: v.number(),\n message: v.string(),\n error: v.string(),\n boot: v.optional(v.picklist(['confirmed', 'pending', 'unknown'])),\n});\nexport type UpdateStatus = v.InferOutput<typeof updateStatus>;\n\nconst rebootResponse = v.object({ message: v.string() });\nexport type RebootResponse = v.InferOutput<typeof rebootResponse>;\n\nconst finiteNumber = v.pipe(v.number(), v.finite());\nconst positiveFiniteNumber = v.pipe(v.number(), v.finite(), v.minValue(Number.MIN_VALUE));\nconst channelId = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(31));\nconst relayId = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(7));\nconst usbPortId = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1));\nconst calibrationStatus = v.picklist(['pass', 'fail']);\n\nconst calibrationPoint = v.object({\n set: finiteNumber,\n measured: finiteNumber,\n reading: v.optional(finiteNumber),\n});\nexport type CalibrationPoint = v.InferOutput<typeof calibrationPoint>;\n\nconst channelCalibration = v.object({\n channel: channelId,\n points: v.array(calibrationPoint),\n max_error: finiteNumber,\n avg_error: finiteNumber,\n});\nexport type ChannelCalibration = v.InferOutput<typeof channelCalibration>;\n\nconst dutPsuCalibration = v.object({\n voltage: v.object({\n points: v.array(calibrationPoint),\n max_error: finiteNumber,\n avg_error: finiteNumber,\n }),\n current: v.object({\n load_ohms: positiveFiniteNumber,\n points: v.array(calibrationPoint),\n max_error: finiteNumber,\n avg_error: finiteNumber,\n }),\n});\nexport type DutPsuCalibration = v.InferOutput<typeof dutPsuCalibration>;\n\nconst currentTestResult = v.object({\n load_ohms: positiveFiniteNumber,\n voltage_applied: finiteNumber,\n measured_current: finiteNumber,\n expected_current: finiteNumber,\n error_percent: finiteNumber,\n});\n/** @deprecated See {@link currentTestResult}. */\nexport type CurrentTestResult = v.InferOutput<typeof currentTestResult>;\n\nconst relayTestResult = v.object({\n relay: relayId,\n status: calibrationStatus,\n test_voltage: finiteNumber,\n closed_current: finiteNumber,\n open_current: finiteNumber,\n calibration: v.optional(channelCalibration),\n});\nexport type RelayTestResult = v.InferOutput<typeof relayTestResult>;\n\nconst usbTestResult = v.object({\n port: usbPortId,\n status: calibrationStatus,\n voltage: finiteNumber,\n /** @deprecated Legacy field; only present on calibrations from older devices. */\n current_tests: v.optional(v.array(currentTestResult)),\n});\nexport type UsbTestResult = v.InferOutput<typeof usbTestResult>;\n\nexport const calibrationData = v.object({\n schema_version: v.literal(1),\n tool_version: v.string(),\n device_id: v.string(),\n timestamp: v.string(),\n firmware_version: v.string(),\n dac: v.array(channelCalibration),\n adc_positive: v.array(channelCalibration),\n adc_negative: v.optional(v.array(channelCalibration)),\n dut_psu: dutPsuCalibration,\n relays: v.array(relayTestResult),\n usb: v.array(usbTestResult),\n});\nexport type CalibrationData = v.InferOutput<typeof calibrationData>;\n\nexport const calibrationState = v.object({\n enabled: v.boolean(),\n loaded: v.boolean(),\n last_error: v.optional(v.nullable(v.string())),\n calibrated_at: v.optional(v.nullable(v.string())),\n});\nexport type CalibrationState = v.InferOutput<typeof calibrationState>;\n\nconst calibrationStatePatch = v.object({ enabled: v.boolean() });\n\n/** @hideconstructor */\nexport class ManagementApi {\n constructor(private readonly fetch: UpFetch, private readonly host: string) {}\n\n /**\n * Gets device information and capabilities.\n * @returns The device information.\n */\n info() {\n return this.fetch('/management/info', { schema: info });\n }\n\n /**\n * Gets the loaded calibration data.\n * @returns The canonical calibration data stored on the device.\n */\n get_calibration(): Promise<CalibrationData> {\n return this.fetch('/management/calibration', { schema: calibrationData });\n }\n\n /**\n * Uploads and activates calibration data.\n * @param data The full calibration report to store on the device.\n */\n set_calibration(data: CalibrationData): Promise<CalibrationData> {\n return this.fetch('/management/calibration', {\n method: 'PUT',\n body: v.parse(calibrationData, data),\n schema: calibrationData,\n });\n }\n\n /**\n * Gets runtime calibration enable/load state.\n */\n get_calibration_state(): Promise<CalibrationState> {\n return this.fetch('/management/calibration/state', { schema: calibrationState });\n }\n\n /**\n * Enables or disables runtime calibration correction.\n * @param enabled Whether calibration correction should be applied.\n */\n set_calibration_enabled(enabled: boolean): Promise<CalibrationState> {\n return this.fetch('/management/calibration/state', {\n method: 'PATCH',\n body: v.parse(calibrationStatePatch, { enabled }),\n schema: calibrationState,\n });\n }\n\n /** Enables runtime calibration correction. */\n enable_calibration(): Promise<CalibrationState> {\n return this.set_calibration_enabled(true);\n }\n\n /** Disables runtime calibration correction. */\n disable_calibration(): Promise<CalibrationState> {\n return this.set_calibration_enabled(false);\n }\n\n /**\n * Gets the current date and time of the device.\n * @returns The current date and time.\n */\n async datetime(): Promise<Date> {\n const time = await this.fetch('/management/datetime', {\n schema: v.object({ epoch_seconds: v.number() }),\n });\n return new Date(time.epoch_seconds * 1000);\n }\n\n /**\n * Sets the date and time of the device.\n *\n * This will only work if the device is not connected to the internet.\n *\n * @param datetime The date and time to set.\n */\n setDatetime(datetime: Date): Promise<void> {\n return this.fetch('/management/datetime', {\n method: 'POST',\n body: { epoch_seconds: Math.floor(datetime.getTime() / 1000) },\n parseResponse: () => {},\n });\n }\n\n /**\n * Gets a list of all projects.\n * @returns An array of projects.\n */\n getProjects() {\n return this.fetch('/management/projects', { schema: v.array(project) });\n }\n\n /**\n * Lists the AT1000 base images present on the device.\n * @returns Repo tags of on-device base images (e.g. \"localhost/at1000-base:latest\").\n */\n listImages() {\n return this.fetch('/management/images', { schema: v.array(v.string()) });\n }\n\n /**\n * Gets a single project by id.\n * @param projectId The project slug id.\n * @returns The project info.\n */\n getProject(projectId: string) {\n return this.fetch(`/management/projects/${projectId}`, { schema: project });\n }\n\n /**\n * Creates a new project from a preinstalled template.\n * @param newProject The project creation data.\n */\n createProject(newProject: CreateProject) {\n return this.fetch('/management/projects', {\n method: 'POST',\n body: newProject,\n timeout: 30_000,\n schema: project,\n });\n }\n\n /**\n * Imports a project from a container image archive (.tar / .tar.gz). The archive streams\n * straight to the device, so pass a lazily file-backed Blob (`await fs.openAsBlob(path)` on\n * Node, a `File` from an input element in the browser): `new Blob([await readFile(path)])`\n * buffers the whole archive in the caller's heap.\n * @param file The image archive to import.\n * @param name The project name (sent percent-encoded; the server decodes it).\n * @returns The created project.\n */\n importProject(file: Blob, name: string) {\n return this.fetch('/management/projects/import', {\n method: 'POST',\n body: file,\n headers: { 'Content-Type': 'application/x-tar', 'X-Project-Name': encodeURIComponent(name) },\n serializeBody: (b) => b as any,\n timeout: 600_000,\n schema: project,\n });\n }\n\n /**\n * Patches an existing project (`name`, `is_default`, `command`). An empty `command` clears it (entrypoint autodetect).\n * @param projectId The project slug id.\n * @param data The data to patch the project with.\n */\n updateProject(projectId: string, data: ProjectPatch) {\n return this.fetch(`/management/projects/${projectId}`, {\n method: 'PATCH',\n body: v.parse(projectPatch, data),\n schema: project,\n });\n }\n\n /**\n * Runs a project.\n * @param projectId The project slug id.\n * @param mode The run mode: 'normal' (default) or 'development' (starts sshd).\n */\n runProject(projectId: string, mode: RunMode = 'normal') {\n return this.fetch(`/management/projects/${projectId}/run`, {\n method: 'POST',\n body: { mode },\n timeout: 30_000,\n });\n }\n\n /**\n * Stops a running project.\n * @param projectId The project slug id.\n */\n stopProject(projectId: string) {\n return this.fetch(`/management/projects/${projectId}/stop`, {\n method: 'POST',\n timeout: 30_000,\n });\n }\n\n /**\n * Gets the port mappings for a project.\n * @param projectId The project slug id.\n * @returns The project's port mappings.\n */\n getProjectPorts(projectId: string) {\n return this.fetch(`/management/projects/${projectId}/ports`, { schema: v.array(portMapping) });\n }\n\n /**\n * Replaces the full set of port mappings for a project.\n * @param projectId The project slug id.\n * @param ports The complete list of port mappings.\n * @returns The updated port mappings.\n */\n setProjectPorts(projectId: string, ports: PortMapping[]) {\n return this.fetch(`/management/projects/${projectId}/ports`, {\n method: 'PUT',\n body: v.parse(v.array(portMapping), ports),\n timeout: 30_000,\n schema: v.array(portMapping),\n });\n }\n\n /**\n * Adds a single port mapping to a project.\n * @param projectId The project slug id.\n * @param mapping The port mapping to add.\n * @returns The updated port mappings.\n */\n addProjectPort(projectId: string, mapping: PortMapping) {\n return this.fetch(`/management/projects/${projectId}/ports`, {\n method: 'POST',\n body: v.parse(portMapping, mapping),\n timeout: 30_000,\n schema: v.array(portMapping),\n });\n }\n\n /**\n * Removes the port mapping for a host port from a project.\n * @param projectId The project slug id.\n * @param hostPort The host port to unmap.\n */\n deleteProjectPort(projectId: string, hostPort: number) {\n return this.fetch(`/management/projects/${projectId}/ports/${hostPort}`, {\n method: 'DELETE',\n parseResponse: () => {},\n timeout: 30_000,\n });\n }\n\n /**\n * Sets the password of the project's dev user (used for SSH password login in\n * development mode).\n * @param projectId The project slug id.\n * @param password The new password.\n */\n setProjectPassword(projectId: string, password: string) {\n return this.fetch(`/management/projects/${projectId}/password`, {\n method: 'POST',\n body: v.parse(v.object({ password: v.pipe(v.string(), v.minLength(1)) }), { password }),\n parseResponse: () => {},\n timeout: 30_000,\n });\n }\n\n /**\n * Gets the SSH authorized_keys for the project's dev user.\n * @param projectId The project slug id.\n * @returns The list of authorized public keys.\n */\n getProjectAuthorizedKeys(projectId: string) {\n return this.fetch(`/management/projects/${projectId}/authorized_keys`, {\n schema: v.array(v.string()),\n });\n }\n\n /**\n * Replaces the SSH authorized_keys for the project's dev user.\n * @param projectId The project slug id.\n * @param keys The complete list of authorized public keys.\n * @returns The updated list of authorized public keys.\n */\n setProjectAuthorizedKeys(projectId: string, keys: string[]) {\n return this.fetch(`/management/projects/${projectId}/authorized_keys`, {\n method: 'PUT',\n body: v.parse(v.array(authorizedKey), keys),\n timeout: 30_000,\n schema: v.array(v.string()),\n });\n }\n\n /**\n * Deletes a project.\n * @param projectId The project slug id.\n */\n deleteProject(projectId: string) {\n return this.fetch(`/management/projects/${projectId}`, { method: 'DELETE', timeout: 30_000 });\n }\n\n /**\n * Uploads a firmware bundle to the device and inspects it.\n * The bundle is staged for installation but not installed yet. The body streams straight to\n * the device, so pass a lazily file-backed Blob (`await fs.openAsBlob(path)` on Node, a `File`\n * from an input element in the browser): `new Blob([await readFile(path)])` buffers the whole\n * bundle in the caller's heap.\n * @param file The firmware bundle file (.raucb).\n * @param filename Optional filename for the bundle. Defaults to 'bundle.raucb'.\n * @returns Bundle metadata including version information.\n */\n upload_bundle(file: Blob, filename = 'bundle.raucb') {\n return this.fetch('/management/update/upload', {\n method: 'POST',\n body: file,\n headers: { 'Content-Type': 'application/octet-stream', 'X-Bundle-Filename': filename },\n serializeBody: (b) => b as any,\n timeout: 600_000,\n schema: bundleInfo,\n });\n }\n\n /**\n * Gets metadata for the currently staged firmware bundle.\n * @returns Bundle metadata including version information.\n */\n bundle_info() {\n return this.fetch('/management/update/bundle-info', { schema: bundleInfo });\n }\n\n /**\n * Installs a previously uploaded firmware bundle.\n * @returns The install response with message and bundle name.\n */\n install_update() {\n return this.fetch('/management/update/install', { method: 'POST', schema: installResponse });\n }\n\n /**\n * Gets the current firmware update status.\n * @returns The update status including state, progress, message and error.\n */\n update_status() {\n return this.fetch('/management/update/status', { schema: updateStatus });\n }\n\n /**\n * Reboots the device.\n * @returns The reboot response message.\n */\n reboot() {\n return this.fetch('/management/reboot', { method: 'POST', schema: rebootResponse });\n }\n\n /**\n * Gets the current run's container logs for a project (one-shot).\n *\n * Lines are scoped server-side to the container's most recent start: a running\n * project returns the live run so far, an idle/stopped project the last run.\n * stdout and stderr are merged into one chronological array; each entry's\n * `stream` field says which it came from.\n *\n * @param projectId The project slug id.\n * @param options.tail Max number of trailing lines (default 1000, clamped 1..10000).\n * @returns The current run's log lines, in order.\n */\n getProjectLogs(projectId: string, options?: { tail?: number }) {\n const tail = options?.tail ?? 1000;\n return this.fetch(`/management/projects/${projectId}/logs?tail=${tail}`, {\n schema: v.array(logLine),\n });\n }\n\n /**\n * Streams the current run's container logs for a project over SSE.\n *\n * Replays the current run's recent lines (bounded by `tail`) then follows live\n * with zero gap. `onLine` fires once per line (stdout and stderr merged in\n * order); `onEnd` fires when the follow ends (the container stopped, or an\n * idle project's last-run replay completed). No auto-reconnect.\n *\n * @param projectId The project slug id.\n * @param handlers Line/end/error callbacks.\n * @param options.tail Max number of trailing lines (default 1000, clamped 1..10000).\n * @returns A handle whose `close()` aborts the stream.\n */\n streamProjectLogs(\n projectId: string,\n handlers: {\n onLine: (line: LogLine) => void;\n onEnd?: () => void;\n onError?: (err: unknown) => void;\n },\n options?: { tail?: number },\n ): { close: () => void } {\n const tail = options?.tail ?? 1000;\n const controller = new AbortController();\n const url = `http://${format_host_for_url(this.host)}`\n + `/v0/management/projects/${projectId}/logs/stream?tail=${tail}`;\n\n void (async () => {\n try {\n const response = await fetch(url, { signal: controller.signal });\n if (!response.ok || response.body === null) {\n throw new Error(`Log stream failed: HTTP ${response.status}`);\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let buffer = '';\n\n const dispatch = (record: string): boolean => {\n let event = 'message';\n let data = '';\n for (const rawLine of record.split('\\n')) {\n if (rawLine.startsWith('event:')) {\n event = rawLine.slice('event:'.length).trim();\n } else if (rawLine.startsWith('data:')) {\n data += rawLine.slice('data:'.length).trim();\n }\n }\n if (event === 'end') {\n handlers.onEnd?.();\n return true; // terminal\n }\n if (event === 'log' && data.length > 0) {\n const parsed = v.safeParse(logLine, JSON.parse(data));\n if (parsed.success) {\n handlers.onLine(parsed.output);\n }\n }\n return false;\n };\n\n for (;;) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n buffer += decoder.decode(value, { stream: true });\n let separator = buffer.indexOf('\\n\\n');\n while (separator !== -1) {\n const record = buffer.slice(0, separator);\n buffer = buffer.slice(separator + 2);\n if (dispatch(record)) {\n controller.abort();\n return;\n }\n separator = buffer.indexOf('\\n\\n');\n }\n }\n } catch (err) {\n if (controller.signal.aborted) {\n return; // caller closed, or terminal end handled above\n }\n handlers.onError?.(err);\n }\n })();\n\n return { close: () => controller.abort() };\n }\n}\n"],"mappings":"qFAQA,SAAgB,EAAoB,EAAc,EAA+B,CAC/E,IAAM,EAAO,GAAgB,KAC7B,GAAI,EAAK,WAAW,GAAG,EACrB,OAAO,EAAK,SAAS,IAAI,EAAI,EAAO,GAAG,EAAK,GAAG,IAEjD,IAAM,EAAa,EAAK,QAAQ,GAAG,EAOnC,OANI,IAAe,GACV,GAAG,EAAK,GAAG,IAEhB,IAAe,EAAK,YAAY,GAAG,EAC9B,EAEF,IAAI,EAAK,IAAI,GACtB,CAGA,SAAgB,EAAkB,EAAsB,CACtD,GAAI,EAAK,WAAW,GAAG,EAAG,CACxB,IAAM,EAAM,EAAK,QAAQ,GAAG,EAC5B,OAAO,IAAQ,GAAK,EAAO,EAAK,MAAM,EAAG,CAAG,CAC9C,CACA,IAAM,EAAa,EAAK,QAAQ,GAAG,EAInC,OAHI,IAAe,IAAM,IAAe,EAAK,YAAY,GAAG,EACnD,EAAK,MAAM,EAAG,CAAU,EAE1B,CACT,CC5BA,IAAY,EAAL,SAAA,EAAA,OACL,GAAA,IAAA,MACA,EAAA,MAAA,QACA,EAAA,MAAA,QACA,EAAA,IAAA,MACA,EAAA,IAAA,MACA,EAAA,KAAA,QACF,E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`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./management-BGrPAG5k.cjs");exports.CommunicationInterfaceType=e.t,exports.ManagementApi=e.n,exports.calibrationData=e.r,exports.calibrationState=e.i,exports.portMapping=e.a,exports.project=e.o,exports.projectEvent=e.s,exports.runMode=e.c,exports.updateStatus=e.l;
|
package/build/management.d.cts
CHANGED
|
@@ -26,8 +26,8 @@ declare const info: v.ObjectSchema<{
|
|
|
26
26
|
readonly io: v.ObjectSchema<{
|
|
27
27
|
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
28
28
|
readonly input_voltage: v.ObjectSchema<{
|
|
29
|
-
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -
|
|
30
|
-
readonly max: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -
|
|
29
|
+
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
30
|
+
readonly max: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
31
31
|
}, undefined>;
|
|
32
32
|
readonly output_voltage: v.ObjectSchema<{
|
|
33
33
|
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -24, undefined>, v.MaxValueAction<number, 24, undefined>]>;
|
|
@@ -114,6 +114,7 @@ declare const project: v.ObjectSchema<{
|
|
|
114
114
|
readonly command: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
115
115
|
readonly state: v.PicklistSchema<["idle", "running", "error"], undefined>;
|
|
116
116
|
readonly mode: v.OptionalSchema<v.PicklistSchema<["normal", "development"], undefined>, undefined>;
|
|
117
|
+
readonly password_set: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
117
118
|
}, undefined>;
|
|
118
119
|
type Project = v.InferOutput<typeof project>;
|
|
119
120
|
declare const projectEvent: v.VariantSchema<"change", [v.ObjectSchema<{
|
|
@@ -144,6 +145,7 @@ declare const projectPatch: Omit<Omit<v.ObjectSchema<{
|
|
|
144
145
|
readonly command: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
145
146
|
readonly state: v.PicklistSchema<["idle", "running", "error"], undefined>;
|
|
146
147
|
readonly mode: v.OptionalSchema<v.PicklistSchema<["normal", "development"], undefined>, undefined>;
|
|
148
|
+
readonly password_set: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
147
149
|
}, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
|
|
148
150
|
readonly entries: Pick<{
|
|
149
151
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -159,66 +161,67 @@ declare const projectPatch: Omit<Omit<v.ObjectSchema<{
|
|
|
159
161
|
readonly command: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
160
162
|
readonly state: v.PicklistSchema<["idle", "running", "error"], undefined>;
|
|
161
163
|
readonly mode: v.OptionalSchema<v.PicklistSchema<["normal", "development"], undefined>, undefined>;
|
|
162
|
-
|
|
164
|
+
readonly password_set: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
165
|
+
}, "command" | "name" | "is_default">;
|
|
163
166
|
readonly "~standard": v.StandardProps<{
|
|
167
|
+
command?: string | undefined;
|
|
164
168
|
name: string;
|
|
165
169
|
is_default: boolean;
|
|
166
|
-
command?: string | undefined;
|
|
167
170
|
}, {
|
|
171
|
+
command: string;
|
|
168
172
|
name: string;
|
|
169
173
|
is_default: boolean;
|
|
170
|
-
command: string;
|
|
171
174
|
}>;
|
|
172
175
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
176
|
+
command: string;
|
|
173
177
|
name: string;
|
|
174
178
|
is_default: boolean;
|
|
175
|
-
|
|
176
|
-
}, v.BooleanIssue | v.ObjectIssue | v.StringIssue>;
|
|
179
|
+
}, v.BooleanIssue | v.StringIssue | v.ObjectIssue>;
|
|
177
180
|
readonly "~types"?: {
|
|
178
181
|
readonly input: {
|
|
182
|
+
command?: string | undefined;
|
|
179
183
|
name: string;
|
|
180
184
|
is_default: boolean;
|
|
181
|
-
command?: string | undefined;
|
|
182
185
|
};
|
|
183
186
|
readonly output: {
|
|
187
|
+
command: string;
|
|
184
188
|
name: string;
|
|
185
189
|
is_default: boolean;
|
|
186
|
-
command: string;
|
|
187
190
|
};
|
|
188
|
-
readonly issue: v.BooleanIssue | v.
|
|
191
|
+
readonly issue: v.BooleanIssue | v.StringIssue | v.ObjectIssue;
|
|
189
192
|
} | undefined;
|
|
190
193
|
}, "~types" | "~run" | "~standard" | "entries"> & {
|
|
191
194
|
readonly entries: {
|
|
195
|
+
readonly command: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, "">, undefined>;
|
|
192
196
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
193
197
|
readonly is_default: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
194
|
-
readonly command: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, "">, undefined>;
|
|
195
198
|
};
|
|
196
199
|
readonly "~standard": v.StandardProps<{
|
|
200
|
+
command?: string | undefined;
|
|
197
201
|
name?: string | undefined;
|
|
198
202
|
is_default?: boolean | undefined;
|
|
199
|
-
command?: string | undefined;
|
|
200
203
|
}, {
|
|
204
|
+
command?: string | undefined;
|
|
201
205
|
name?: string | undefined;
|
|
202
206
|
is_default?: boolean | undefined;
|
|
203
|
-
command?: string | undefined;
|
|
204
207
|
}>;
|
|
205
208
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
209
|
+
command?: string | undefined;
|
|
206
210
|
name?: string | undefined;
|
|
207
211
|
is_default?: boolean | undefined;
|
|
208
|
-
|
|
209
|
-
}, v.BooleanIssue | v.ObjectIssue | v.StringIssue>;
|
|
212
|
+
}, v.BooleanIssue | v.StringIssue | v.ObjectIssue>;
|
|
210
213
|
readonly "~types"?: {
|
|
211
214
|
readonly input: {
|
|
215
|
+
command?: string | undefined;
|
|
212
216
|
name?: string | undefined;
|
|
213
217
|
is_default?: boolean | undefined;
|
|
214
|
-
command?: string | undefined;
|
|
215
218
|
};
|
|
216
219
|
readonly output: {
|
|
220
|
+
command?: string | undefined;
|
|
217
221
|
name?: string | undefined;
|
|
218
222
|
is_default?: boolean | undefined;
|
|
219
|
-
command?: string | undefined;
|
|
220
223
|
};
|
|
221
|
-
readonly issue: v.BooleanIssue | v.
|
|
224
|
+
readonly issue: v.BooleanIssue | v.StringIssue | v.ObjectIssue;
|
|
222
225
|
} | undefined;
|
|
223
226
|
};
|
|
224
227
|
type ProjectPatch = v.InferOutput<typeof projectPatch>;
|
|
@@ -247,6 +250,7 @@ declare const updateStatus: v.ObjectSchema<{
|
|
|
247
250
|
readonly progress: v.NumberSchema<undefined>;
|
|
248
251
|
readonly message: v.StringSchema<undefined>;
|
|
249
252
|
readonly error: v.StringSchema<undefined>;
|
|
253
|
+
readonly boot: v.OptionalSchema<v.PicklistSchema<["confirmed", "pending", "unknown"], undefined>, undefined>;
|
|
250
254
|
}, undefined>;
|
|
251
255
|
type UpdateStatus = v.InferOutput<typeof updateStatus>;
|
|
252
256
|
declare const rebootResponse: v.ObjectSchema<{
|
|
@@ -567,8 +571,9 @@ declare class ManagementApi {
|
|
|
567
571
|
proto: "tcp" | "udp";
|
|
568
572
|
}[];
|
|
569
573
|
command: string;
|
|
570
|
-
state: "
|
|
574
|
+
state: "idle" | "running" | "error";
|
|
571
575
|
mode?: "normal" | "development" | undefined;
|
|
576
|
+
password_set?: boolean | undefined;
|
|
572
577
|
}[]>;
|
|
573
578
|
/**
|
|
574
579
|
* Lists the AT1000 base images present on the device.
|
|
@@ -592,8 +597,9 @@ declare class ManagementApi {
|
|
|
592
597
|
proto: "tcp" | "udp";
|
|
593
598
|
}[];
|
|
594
599
|
command: string;
|
|
595
|
-
state: "
|
|
600
|
+
state: "idle" | "running" | "error";
|
|
596
601
|
mode?: "normal" | "development" | undefined;
|
|
602
|
+
password_set?: boolean | undefined;
|
|
597
603
|
}>;
|
|
598
604
|
/**
|
|
599
605
|
* Creates a new project from a preinstalled template.
|
|
@@ -611,11 +617,15 @@ declare class ManagementApi {
|
|
|
611
617
|
proto: "tcp" | "udp";
|
|
612
618
|
}[];
|
|
613
619
|
command: string;
|
|
614
|
-
state: "
|
|
620
|
+
state: "idle" | "running" | "error";
|
|
615
621
|
mode?: "normal" | "development" | undefined;
|
|
622
|
+
password_set?: boolean | undefined;
|
|
616
623
|
}>;
|
|
617
624
|
/**
|
|
618
|
-
* Imports a project from a container image archive (.tar / .tar.gz).
|
|
625
|
+
* Imports a project from a container image archive (.tar / .tar.gz). The archive streams
|
|
626
|
+
* straight to the device, so pass a lazily file-backed Blob (`await fs.openAsBlob(path)` on
|
|
627
|
+
* Node, a `File` from an input element in the browser): `new Blob([await readFile(path)])`
|
|
628
|
+
* buffers the whole archive in the caller's heap.
|
|
619
629
|
* @param file The image archive to import.
|
|
620
630
|
* @param name The project name (sent percent-encoded; the server decodes it).
|
|
621
631
|
* @returns The created project.
|
|
@@ -632,8 +642,9 @@ declare class ManagementApi {
|
|
|
632
642
|
proto: "tcp" | "udp";
|
|
633
643
|
}[];
|
|
634
644
|
command: string;
|
|
635
|
-
state: "
|
|
645
|
+
state: "idle" | "running" | "error";
|
|
636
646
|
mode?: "normal" | "development" | undefined;
|
|
647
|
+
password_set?: boolean | undefined;
|
|
637
648
|
}>;
|
|
638
649
|
/**
|
|
639
650
|
* Patches an existing project (`name`, `is_default`, `command`). An empty `command` clears it (entrypoint autodetect).
|
|
@@ -652,8 +663,9 @@ declare class ManagementApi {
|
|
|
652
663
|
proto: "tcp" | "udp";
|
|
653
664
|
}[];
|
|
654
665
|
command: string;
|
|
655
|
-
state: "
|
|
666
|
+
state: "idle" | "running" | "error";
|
|
656
667
|
mode?: "normal" | "development" | undefined;
|
|
668
|
+
password_set?: boolean | undefined;
|
|
657
669
|
}>;
|
|
658
670
|
/**
|
|
659
671
|
* Runs a project.
|
|
@@ -731,7 +743,10 @@ declare class ManagementApi {
|
|
|
731
743
|
deleteProject(projectId: string): Promise<any>;
|
|
732
744
|
/**
|
|
733
745
|
* Uploads a firmware bundle to the device and inspects it.
|
|
734
|
-
* The bundle is staged for installation but not installed yet.
|
|
746
|
+
* The bundle is staged for installation but not installed yet. The body streams straight to
|
|
747
|
+
* the device, so pass a lazily file-backed Blob (`await fs.openAsBlob(path)` on Node, a `File`
|
|
748
|
+
* from an input element in the browser): `new Blob([await readFile(path)])` buffers the whole
|
|
749
|
+
* bundle in the caller's heap.
|
|
735
750
|
* @param file The firmware bundle file (.raucb).
|
|
736
751
|
* @param filename Optional filename for the bundle. Defaults to 'bundle.raucb'.
|
|
737
752
|
* @returns Bundle metadata including version information.
|
|
@@ -769,6 +784,7 @@ declare class ManagementApi {
|
|
|
769
784
|
progress: number;
|
|
770
785
|
message: string;
|
|
771
786
|
error: string;
|
|
787
|
+
boot?: "confirmed" | "pending" | "unknown" | undefined;
|
|
772
788
|
}>;
|
|
773
789
|
/**
|
|
774
790
|
* Reboots the device.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"management.d.cts","names":[],"sources":["../src/api/management.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"management.d.cts","names":[],"sources":["../src/api/management.ts"],"mappings":";;;aAMY;EACV;EACA;EACA;EACA;EACA;EACA;;cAiFI,MAAI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgBE,cAAc,EAAE,mBAAmB;cAMlC,aAAW,EAAA;;;;;KACZ,cAAc,EAAE,mBAAmB;cAMlC,SAAO,EAAA;KACR,UAAU,EAAE,mBAA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Ae,mBAAmB;IAAY;MAAe;;;;;;;;;;;;;;;;;EAoB7D,kBACE,mBACA;IACE,SAAS,MAAM;IACf;IACA,WAAW;KAEb;IAAY;;IACT"}
|
package/build/management.d.mts
CHANGED
|
@@ -26,8 +26,8 @@ declare const info: v.ObjectSchema<{
|
|
|
26
26
|
readonly io: v.ObjectSchema<{
|
|
27
27
|
readonly count: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, 1, undefined>]>;
|
|
28
28
|
readonly input_voltage: v.ObjectSchema<{
|
|
29
|
-
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -
|
|
30
|
-
readonly max: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -
|
|
29
|
+
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
30
|
+
readonly max: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -25, undefined>, v.MaxValueAction<number, 25, undefined>]>;
|
|
31
31
|
}, undefined>;
|
|
32
32
|
readonly output_voltage: v.ObjectSchema<{
|
|
33
33
|
readonly min: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MinValueAction<number, -24, undefined>, v.MaxValueAction<number, 24, undefined>]>;
|
|
@@ -114,6 +114,7 @@ declare const project: v.ObjectSchema<{
|
|
|
114
114
|
readonly command: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
115
115
|
readonly state: v.PicklistSchema<["idle", "running", "error"], undefined>;
|
|
116
116
|
readonly mode: v.OptionalSchema<v.PicklistSchema<["normal", "development"], undefined>, undefined>;
|
|
117
|
+
readonly password_set: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
117
118
|
}, undefined>;
|
|
118
119
|
type Project = v.InferOutput<typeof project>;
|
|
119
120
|
declare const projectEvent: v.VariantSchema<"change", [v.ObjectSchema<{
|
|
@@ -144,6 +145,7 @@ declare const projectPatch: Omit<Omit<v.ObjectSchema<{
|
|
|
144
145
|
readonly command: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
145
146
|
readonly state: v.PicklistSchema<["idle", "running", "error"], undefined>;
|
|
146
147
|
readonly mode: v.OptionalSchema<v.PicklistSchema<["normal", "development"], undefined>, undefined>;
|
|
148
|
+
readonly password_set: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
147
149
|
}, undefined>, "~types" | "~run" | "~standard" | "entries"> & {
|
|
148
150
|
readonly entries: Pick<{
|
|
149
151
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -159,66 +161,67 @@ declare const projectPatch: Omit<Omit<v.ObjectSchema<{
|
|
|
159
161
|
readonly command: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
160
162
|
readonly state: v.PicklistSchema<["idle", "running", "error"], undefined>;
|
|
161
163
|
readonly mode: v.OptionalSchema<v.PicklistSchema<["normal", "development"], undefined>, undefined>;
|
|
162
|
-
|
|
164
|
+
readonly password_set: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
165
|
+
}, "command" | "name" | "is_default">;
|
|
163
166
|
readonly "~standard": v.StandardProps<{
|
|
167
|
+
command?: string | undefined;
|
|
164
168
|
name: string;
|
|
165
169
|
is_default: boolean;
|
|
166
|
-
command?: string | undefined;
|
|
167
170
|
}, {
|
|
171
|
+
command: string;
|
|
168
172
|
name: string;
|
|
169
173
|
is_default: boolean;
|
|
170
|
-
command: string;
|
|
171
174
|
}>;
|
|
172
175
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
176
|
+
command: string;
|
|
173
177
|
name: string;
|
|
174
178
|
is_default: boolean;
|
|
175
|
-
|
|
176
|
-
}, v.BooleanIssue | v.ObjectIssue | v.StringIssue>;
|
|
179
|
+
}, v.BooleanIssue | v.StringIssue | v.ObjectIssue>;
|
|
177
180
|
readonly "~types"?: {
|
|
178
181
|
readonly input: {
|
|
182
|
+
command?: string | undefined;
|
|
179
183
|
name: string;
|
|
180
184
|
is_default: boolean;
|
|
181
|
-
command?: string | undefined;
|
|
182
185
|
};
|
|
183
186
|
readonly output: {
|
|
187
|
+
command: string;
|
|
184
188
|
name: string;
|
|
185
189
|
is_default: boolean;
|
|
186
|
-
command: string;
|
|
187
190
|
};
|
|
188
|
-
readonly issue: v.BooleanIssue | v.
|
|
191
|
+
readonly issue: v.BooleanIssue | v.StringIssue | v.ObjectIssue;
|
|
189
192
|
} | undefined;
|
|
190
193
|
}, "~types" | "~run" | "~standard" | "entries"> & {
|
|
191
194
|
readonly entries: {
|
|
195
|
+
readonly command: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, "">, undefined>;
|
|
192
196
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
193
197
|
readonly is_default: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
194
|
-
readonly command: v.OptionalSchema<v.OptionalSchema<v.StringSchema<undefined>, "">, undefined>;
|
|
195
198
|
};
|
|
196
199
|
readonly "~standard": v.StandardProps<{
|
|
200
|
+
command?: string | undefined;
|
|
197
201
|
name?: string | undefined;
|
|
198
202
|
is_default?: boolean | undefined;
|
|
199
|
-
command?: string | undefined;
|
|
200
203
|
}, {
|
|
204
|
+
command?: string | undefined;
|
|
201
205
|
name?: string | undefined;
|
|
202
206
|
is_default?: boolean | undefined;
|
|
203
|
-
command?: string | undefined;
|
|
204
207
|
}>;
|
|
205
208
|
readonly "~run": (dataset: v.UnknownDataset, config: v.Config<v.BaseIssue<unknown>>) => v.OutputDataset<{
|
|
209
|
+
command?: string | undefined;
|
|
206
210
|
name?: string | undefined;
|
|
207
211
|
is_default?: boolean | undefined;
|
|
208
|
-
|
|
209
|
-
}, v.BooleanIssue | v.ObjectIssue | v.StringIssue>;
|
|
212
|
+
}, v.BooleanIssue | v.StringIssue | v.ObjectIssue>;
|
|
210
213
|
readonly "~types"?: {
|
|
211
214
|
readonly input: {
|
|
215
|
+
command?: string | undefined;
|
|
212
216
|
name?: string | undefined;
|
|
213
217
|
is_default?: boolean | undefined;
|
|
214
|
-
command?: string | undefined;
|
|
215
218
|
};
|
|
216
219
|
readonly output: {
|
|
220
|
+
command?: string | undefined;
|
|
217
221
|
name?: string | undefined;
|
|
218
222
|
is_default?: boolean | undefined;
|
|
219
|
-
command?: string | undefined;
|
|
220
223
|
};
|
|
221
|
-
readonly issue: v.BooleanIssue | v.
|
|
224
|
+
readonly issue: v.BooleanIssue | v.StringIssue | v.ObjectIssue;
|
|
222
225
|
} | undefined;
|
|
223
226
|
};
|
|
224
227
|
type ProjectPatch = v.InferOutput<typeof projectPatch>;
|
|
@@ -247,6 +250,7 @@ declare const updateStatus: v.ObjectSchema<{
|
|
|
247
250
|
readonly progress: v.NumberSchema<undefined>;
|
|
248
251
|
readonly message: v.StringSchema<undefined>;
|
|
249
252
|
readonly error: v.StringSchema<undefined>;
|
|
253
|
+
readonly boot: v.OptionalSchema<v.PicklistSchema<["confirmed", "pending", "unknown"], undefined>, undefined>;
|
|
250
254
|
}, undefined>;
|
|
251
255
|
type UpdateStatus = v.InferOutput<typeof updateStatus>;
|
|
252
256
|
declare const rebootResponse: v.ObjectSchema<{
|
|
@@ -567,8 +571,9 @@ declare class ManagementApi {
|
|
|
567
571
|
proto: "tcp" | "udp";
|
|
568
572
|
}[];
|
|
569
573
|
command: string;
|
|
570
|
-
state: "
|
|
574
|
+
state: "idle" | "running" | "error";
|
|
571
575
|
mode?: "normal" | "development" | undefined;
|
|
576
|
+
password_set?: boolean | undefined;
|
|
572
577
|
}[]>;
|
|
573
578
|
/**
|
|
574
579
|
* Lists the AT1000 base images present on the device.
|
|
@@ -592,8 +597,9 @@ declare class ManagementApi {
|
|
|
592
597
|
proto: "tcp" | "udp";
|
|
593
598
|
}[];
|
|
594
599
|
command: string;
|
|
595
|
-
state: "
|
|
600
|
+
state: "idle" | "running" | "error";
|
|
596
601
|
mode?: "normal" | "development" | undefined;
|
|
602
|
+
password_set?: boolean | undefined;
|
|
597
603
|
}>;
|
|
598
604
|
/**
|
|
599
605
|
* Creates a new project from a preinstalled template.
|
|
@@ -611,11 +617,15 @@ declare class ManagementApi {
|
|
|
611
617
|
proto: "tcp" | "udp";
|
|
612
618
|
}[];
|
|
613
619
|
command: string;
|
|
614
|
-
state: "
|
|
620
|
+
state: "idle" | "running" | "error";
|
|
615
621
|
mode?: "normal" | "development" | undefined;
|
|
622
|
+
password_set?: boolean | undefined;
|
|
616
623
|
}>;
|
|
617
624
|
/**
|
|
618
|
-
* Imports a project from a container image archive (.tar / .tar.gz).
|
|
625
|
+
* Imports a project from a container image archive (.tar / .tar.gz). The archive streams
|
|
626
|
+
* straight to the device, so pass a lazily file-backed Blob (`await fs.openAsBlob(path)` on
|
|
627
|
+
* Node, a `File` from an input element in the browser): `new Blob([await readFile(path)])`
|
|
628
|
+
* buffers the whole archive in the caller's heap.
|
|
619
629
|
* @param file The image archive to import.
|
|
620
630
|
* @param name The project name (sent percent-encoded; the server decodes it).
|
|
621
631
|
* @returns The created project.
|
|
@@ -632,8 +642,9 @@ declare class ManagementApi {
|
|
|
632
642
|
proto: "tcp" | "udp";
|
|
633
643
|
}[];
|
|
634
644
|
command: string;
|
|
635
|
-
state: "
|
|
645
|
+
state: "idle" | "running" | "error";
|
|
636
646
|
mode?: "normal" | "development" | undefined;
|
|
647
|
+
password_set?: boolean | undefined;
|
|
637
648
|
}>;
|
|
638
649
|
/**
|
|
639
650
|
* Patches an existing project (`name`, `is_default`, `command`). An empty `command` clears it (entrypoint autodetect).
|
|
@@ -652,8 +663,9 @@ declare class ManagementApi {
|
|
|
652
663
|
proto: "tcp" | "udp";
|
|
653
664
|
}[];
|
|
654
665
|
command: string;
|
|
655
|
-
state: "
|
|
666
|
+
state: "idle" | "running" | "error";
|
|
656
667
|
mode?: "normal" | "development" | undefined;
|
|
668
|
+
password_set?: boolean | undefined;
|
|
657
669
|
}>;
|
|
658
670
|
/**
|
|
659
671
|
* Runs a project.
|
|
@@ -731,7 +743,10 @@ declare class ManagementApi {
|
|
|
731
743
|
deleteProject(projectId: string): Promise<any>;
|
|
732
744
|
/**
|
|
733
745
|
* Uploads a firmware bundle to the device and inspects it.
|
|
734
|
-
* The bundle is staged for installation but not installed yet.
|
|
746
|
+
* The bundle is staged for installation but not installed yet. The body streams straight to
|
|
747
|
+
* the device, so pass a lazily file-backed Blob (`await fs.openAsBlob(path)` on Node, a `File`
|
|
748
|
+
* from an input element in the browser): `new Blob([await readFile(path)])` buffers the whole
|
|
749
|
+
* bundle in the caller's heap.
|
|
735
750
|
* @param file The firmware bundle file (.raucb).
|
|
736
751
|
* @param filename Optional filename for the bundle. Defaults to 'bundle.raucb'.
|
|
737
752
|
* @returns Bundle metadata including version information.
|
|
@@ -769,6 +784,7 @@ declare class ManagementApi {
|
|
|
769
784
|
progress: number;
|
|
770
785
|
message: string;
|
|
771
786
|
error: string;
|
|
787
|
+
boot?: "confirmed" | "pending" | "unknown" | undefined;
|
|
772
788
|
}>;
|
|
773
789
|
/**
|
|
774
790
|
* Reboots the device.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"management.d.mts","names":[],"sources":["../src/api/management.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"management.d.mts","names":[],"sources":["../src/api/management.ts"],"mappings":";;;aAMY;EACV;EACA;EACA;EACA;EACA;EACA;;cAiFI,MAAI,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgBE,cAAc,EAAE,mBAAmB;cAMlC,aAAW,EAAA;;;;;KACZ,cAAc,EAAE,mBAAmB;cAMlC,SAAO,EAAA;KACR,UAAU,EAAE,mBAAmB;cAErC,SAAO,EAAA;;;;KACD,UAAU,EAAE,mBAAmB;cAE9B,SAAO,EAAA;;;;;;;;;;;;;;;;KAYR,UAAU,EAAE,mBAAmB;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}
|
package/build/management.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{a as e,c as t,i as n,l as r,n as i,o as a,r as o,s,t as c}from"./management-CuI4cenF.mjs";export{c as CommunicationInterfaceType,i as ManagementApi,o as calibrationData,n as calibrationState,e as portMapping,a as project,s as projectEvent,t as runMode,r as updateStatus};
|
package/build/node.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./package-ByQuarMd.cjs"),n=require("./at1000-DuULyDOw.cjs");let r=require("up-fetch"),i=require("node:os");i=e.t(i,1);let a=require("node:fs"),o=require("dns-packet");o=e.t(o,1);let s=require("node:events"),c=require("node:util");c=e.t(c,1);let l=require("ip-address");l=e.t(l,1);let u=require("node:dgram");u=e.t(u,1);const d=`224.0.0.251`,f=5353,p=`IPv4`,m=`IPv6`,h=[p,4,m,6];var g=class e{static getInterfaces(t){return t?e.getInterfacesFromStrings(t):e.getAllInterfaces()}static getAllInterfaces(){let e=[],t=[],n=i.default.networkInterfaces();for(let[r,i]of Object.entries(n))t.includes(r)||(t.push(r),i?.forEach(t=>{t.internal||!h.includes(t.family)||/^(2002|2001):/gi.exec(t.address)||e.push({name:r,address:t.address,family:t.family,scopeid:t.scopeid})}));if(!e.length)throw Error(`No usable network interfaces returned by OS.`);return e}static getInterfacesFromStrings(t){let n=Array.isArray(t)?t:[t],r=this.getAllInterfaces().filter(t=>n.reduce((n,r)=>n||!!(e.stringMatchesAddress(r,t.address)||t.name===r),!1));if(!r||!r.length)throw Error(`No usable network interfaces returned by OS.`);return r}static stringMatchesAddress(e,t){let n,r;try{n=new l.default.Address4(e),r=new l.default.Address4(t)}catch{try{n=new l.default.Address6(e),r=new l.default.Address6(t)}catch{return!1}}return n.bigInt()===r.bigInt()}};const _={interfaces:[],reuseAddr:!0,ttl:255,loopback:!0,onMessage:(e,t)=>{console.log(`Message `+e.toString())},socketError:e=>{console.log(`Socket error `+e.message)}};var v=class e{static validateSettings(e){if(!e.multicastAddress)throw Error(`Socket settings require multicastAddress`);if(!e.multicastPort)throw Error(`Socket settings require multicastPort`)}static createMulticastSocket(t){return new Promise((n,r)=>{let i=Object.assign({},_,t);e.validateSettings(i);let a=u.default.createSocket({type:l.default.Address4.isValid(i.multicastAddress)?`udp4`:`udp6`,reuseAddr:i.reuseAddr}),o=!1;a.on(`error`,e=>{o?i.socketError(e):(a.close(),n({success:!1,error:e}))}).on(`listening`,()=>{o=!0,a.setMulticastTTL(i.ttl??255),a.setMulticastLoopback(i.loopback??!0);let t=e.addMulticastMemberships(a,i);if(!t.memberships.length){o=!1,a.close(),n({success:!1,error:Error(`No interface memberships for multicast address `+i.multicastAddress)});return}n(Object.assign({success:!0},t,{socket:a}))}).on(`message`,(e,t)=>{i.onMessage(e,t)}),a.bind({port:i.multicastPort,exclusive:!1})})}static addMulticastMemberships(t,n){let r=[],i=[],a=l.default.Address4.isValid(n.multicastAddress)?[p,4]:[m,6];return n.interfaces.forEach(o=>{if(a.includes(o.family))try{t.addMembership(n.multicastAddress,e.interfaceAddress(o)),r.push(o)}catch{i.push(o)}}),{memberships:r,failedMemberships:i}}static async createSendSocket(t,n,r,i,a){return new Promise(o=>{let s=[`IPv4`,4].includes(t.family)?`udp4`:`udp6`,c=e.interfaceAddress(t),l=n.srcPort??0,d=!1,f=e=>{let l=u.default.createSocket({type:s,reuseAddr:!!n.reuseAddr,reusePort:!0}),p=!1;l.on(`error`,t=>{p?i(t):(l.close(),e!==0&&!d?(d=!0,a?.(`mDNS send socket bind to ${c}:${e} failed (${t.message}); falling back to ephemeral source port — discovery may be unreliable on strict firewalls.`),f(0)):o({success:!1,error:Error(t.message)}))}).on(`listening`,()=>{p=!0,o({success:!0,iface:t,socket:l,send:l.send.bind(l)})}).on(`message`,(e,n)=>{n.interface=t.name,r(e,n)}).bind(e,c)};f(l)})}static interfaceAddress(e){return[`IPv4`,4].includes(e.family)?e.address:e.scopeid?`${e.address}%${e.name}`:e.address}};const y={reuseAddr:!0,srcPort:5353,interfaces:null,ttl:255,loopback:!0,debug:!1};var b=class extends s.EventEmitter{Config;ready;receiveSockets;sendSockets;interfaces;destroyed;constructor(e){super(),this.Config=Object.assign({},y,e),this.ready=!1,this.receiveSockets=[],this.sendSockets=[]}async init(){try{this.interfaces=g.getInterfaces(this.Config.interfaces||void 0)}catch(e){throw this.emitError(e),e}return this.emitDebug(`Scanner interfaces: ${c.default.inspect(this.interfaces)}`),await this.createReceiveSockets(),await this.createSendSockets(),this.receiveSockets.length&&this.sendSockets.length&&(this.ready=!0),this.ready}async createReceiveSockets(){if(!this.interfaces)return[];let e=this.interfaces.filter(e=>[p,4].includes(e.family)),t=this.interfaces.filter(e=>[m,6].includes(e.family));if(this.emitDebug(`Create receive sockets for${e.length?` IPv4`:``}${e.length&&t.length?` and`:``}${t.length?` IPv6`:``}`),e.length){let t=await v.createMulticastSocket({multicastAddress:d,multicastPort:f,interfaces:e,onMessage:this.onMessage.bind(this),socketError:this.socketError.bind(this)});t.success?this.receiveSockets.push(t):t.error&&this.emitWarn(t.error.message)}if(t.length){let e=await v.createMulticastSocket({multicastAddress:`FF02::FB`,multicastPort:f,interfaces:t,onMessage:this.onMessage.bind(this),socketError:this.socketError.bind(this)});e.success?this.receiveSockets.push(e):e.error&&this.emitWarn(e.error.message)}return this.receiveSockets}async createSendSockets(){if(this.interfaces){this.emitDebug(`Create send sockets on ${this.interfaces.length} interfaces/addresses.`);for(let e=0;e<this.interfaces.length;e++){let t=await v.createSendSocket(this.interfaces[e],this.Config,this.onMessage.bind(this),this.socketError.bind(this),this.emitWarn.bind(this));t.success?this.sendSockets.push(t):t.error&&this.emitWarn(t.error.message)}}}onMessage(e,t){let n;try{n=o.default.decode(e)}catch(e){return this.emitWarn(e)}this.emit(`packet`,n,t)}socketError(e){e.code===`EACCES`||e.code===`EADDRINUSE`||e.code===`EADDRNOTAVAIL`?this.emitError(e):this.emitWarn(e)}query(e,t){let n;if(typeof e==`string`)n=[{name:e,type:t||`ANY`}];else if(Array.isArray(e))n=e;else throw Error(`Query questions must be an array of mDNS query questions.`);let r={type:`query`,questions:n};this.emitDebug(`Send mDNS query: ${c.default.inspect(r)}`),this.send(r)}send(e){if(this.destroyed)return;let t=o.default.encode(e);e.type===`query`&&this.setUnicastResponseBit(t);for(let e=0;e<this.sendSockets.length;e++){let n=this.sendSockets[e];if(n.send&&n.iface)try{n.send(t,0,t.length,f,[`IPv4`,4].includes(n.iface.family)?d:`FF02::FB%`+n.iface.name),this.emitDebug(`Send packet on ${n.iface.address}`)}catch{}}}setUnicastResponseBit(e){let t=e.readUInt16BE(4),n=12;for(let r=0;r<t&&n<e.length;r++){for(;n<e.length&&e[n]!==0;)n+=e[n]+1;n+=1,n+=2,n<e.length&&(e[n]|=128),n+=2}}destroy(){this.destroyed=!0,this.ready=!1,this.removeAllListeners(),this.sendSockets.forEach(e=>{try{e.socket?.close()}catch{}}),this.sendSockets=[],this.receiveSockets.forEach(e=>{try{e.socket?.close()}catch{}}),this.receiveSockets=[]}emitError(e){this.emit(`error`,e)}emitWarn(e){this.emit(`warn`,e)}emitDebug(e){this.Config.debug&&this.emit(`debug`,e)}};const x={debug:!1};var S=class extends s.EventEmitter{Config;scanner;types;namedServices;packetListener;constructor(e,t){super(),this.packetListener=this.onPacket.bind(this),this.scanner=e,this.Config=Object.assign({},x,t),this.types=[],this.namedServices={},this.forwardEvents(this.scanner),this.reset()}reset(){this.removeMDNSListener(this.scanner),this.types=[],this.namedServices={},this.listenMDNSEvents(this.scanner)}forwardEvents(e){e.on(`error`,e=>{this.emitError(e)}).on(`warn`,e=>{this.emitWarn(e)}).on(`debug`,e=>{this.emitDebug(e)})}listenMDNSEvents(e){e.on(`packet`,this.packetListener)}removeMDNSListener(e){e.removeListener(`packet`,this.packetListener)}onPacket(e,t){switch(this.emitDebug(`Received packet type ${e.type} from ${t.address}.`),e.type){case`query`:this.emit(`query`,e,t);break;case`response`:this.emitDebug(`Received response packet from ${t.address} with ${e.answers?e.answers.length:0} answers and ${e.additionals?e.additionals.length:0} additionals.`),e.answers&&this.processAnswers(e.answers,t),e.additionals&&this.processAnswers(e.additionals,t);break}}processAnswers(e,t){this.emitDebug(`Processing answers or additionals...`);let n=this.processSRVAnswers(e);this.processTXTAnswers(e),this.processAAnswers(e),this.processAAAAAnswers(e),this.processPTRAnswers(e,t),n.forEach(e=>{this.emit(`discovered`,{type:`service`,data:this.namedServices[e]})})}processSRVAnswers(e){let t=[];return e.forEach(e=>{if(e.type!==`SRV`)return;this.emitDebug(`Processing SRV answer.`);let n=e.name.toString();t.includes(n)||t.push(n),this.namedServices[n]=this.namedServices[n]||{},this.namedServices[n].service=e,this.namedServices[n].host=e.data.target.toString(),this.namedServices[n].port=e.data.port}),t}processTXTAnswers(e){e.forEach(e=>{if(e.type!==`TXT`)return;this.emitDebug(`Processing TXT answer.`);let t=e.data;if(Array.isArray(t)&&t.length>1){let n=e.name.toString();this.namedServices[n]=this.namedServices[n]||{},this.namedServices[n].txt=this.answerDataToKeyValues(Buffer.concat(t))}else if(Buffer.isBuffer(t)){let n=e.name.toString();this.namedServices[n]=this.namedServices[n]||{},this.namedServices[n].txt=this.answerDataToKeyValues(t)}})}processAAnswers(e){e.forEach(e=>{if(e.type!==`A`)return;this.emitDebug(`Processing A answer.`);let t=e.name.toString(),n=e.data.toString();for(let e in this.namedServices)this.namedServices[e].host===t&&(this.namedServices[e].addresses=this.namedServices[e].addresses||[],this.namedServices[e].addresses.reduce((e,t)=>e||t.address===n,!1)||this.namedServices[e].addresses.push({family:p,address:n}))})}processAAAAAnswers(e){e.forEach(e=>{if(e.type!==`AAAA`)return;this.emitDebug(`Processing AAAA answer.`);let t=e.name.toString(),n=e.data.toString();for(let e in this.namedServices)this.namedServices[e].host===t&&(this.namedServices[e].addresses=this.namedServices[e].addresses||[],this.namedServices[e].addresses.reduce((e,t)=>e||t.address===n,!1)||this.namedServices[e].addresses.push({family:m,address:n}))})}processPTRAnswers(e,t){e.forEach(e=>{if(e.type!==`PTR`)return;this.emitDebug(`Processing PTR answer.`);let n=this.serviceTypeFromPTR(e),r=e.data.toString();n!==r&&(this.namedServices[r]=this.namedServices[r]||{},this.namedServices[r].name=r.replace(`.`+n,``),this.namedServices[r].rinfo=t)})}serviceTypeFromPTR(e){let t=e.data,n=/(?:^|^.+?(?:\.))(_.*)$/gm.exec(t.toString()),r=n?n[1]:t.toString();return this.types.includes(r)||(this.types.push(r),this.emit(`discovered`,{type:`type`,data:r}),this.emitDebug(`Scanning service type ${r}.`),this.scanner.query(r,`ANY`)),r}answerDataToKeyValues(e){let t=[],n={},r=0,i=e[r];for(;i;){let a=e.slice(r+1,r+1+i);t.push(a.toString());let o=/^([^=]+)=([^=]*)$/.exec(a.toString());o&&(n[o[1]]=o[2]),r=r+1+i,i=e[r]}return{strings:t,keyValuePairs:n}}emitError(e){this.emit(`error`,e)}emitWarn(e){this.emit(`warn`,e)}emitDebug(e){this.Config.debug&&this.emit(`debug`,e)}};function C(e){return e.startsWith(`192.168.`)?0:e.startsWith(`169.254.`)?1:2}function w(){try{return(0,a.readFileSync)(`/etc/at1000/hostname`,`utf8`).trim()||void 0}catch{return}}function T(){try{return(0,a.readFileSync)(`/etc/at1000/project`,`utf8`).trim()||void 0}catch{return}}async function E(e){return{host:e,info:await new n.d((0,r.up)(fetch,()=>({baseUrl:`http://${n.r(e)}/v0`,timeout:1e3,parseRejected:(e,t)=>n.a(e,t.method)})),e).info()}}const D=async()=>{let e=w();if(e)for(let t of[`${e}.local`,`host.containers.internal`])try{if((await E(t)).info.hostname===e)return t}catch{}},O=async(e=500)=>{e<10&&(e=10);let t=new b({debug:!0}),r=new S(t);if(r.on(`error`,e=>{if(!e.includes(`bind ENOENT`))throw Error(e)}),!await t.init())throw Error(`Failed to initialize mDNS scanner`);t.query(`_at1000_server._tcp.local`),await new Promise(t=>setTimeout(t,e));let i=[...new Set(Object.values(r.namedServices).filter(e=>e.service!==void 0).filter(e=>(e.service?.name)?.endsWith(`_at1000_server._tcp.local`)).flatMap(e=>{let t=e.addresses??[],r=e.port,i=t.filter(e=>e.family===`IPv4`).map(e=>n.r(e.address,r)),a=t.filter(e=>e.family===`IPv6`).map(e=>n.r(e.address,r));return[...i,...a]}))];t.destroy();let a=(await Promise.allSettled(i.map(E))).filter(e=>e.status===`fulfilled`).map(e=>e.value),o=new Map;for(let e of a){let t=o.get(e.info.hostname);t?C(e.host)<C(t.host)&&o.set(e.info.hostname,e):o.set(e.info.hostname,e)}let s=[...o.values()],c=w();if(!c)return s.map(e=>e.host);let l=s.findIndex(e=>e.info.hostname===c);if(l>=0)return s.unshift(...s.splice(l,1)),s.map(e=>e.host);let u=await D();return u?[u,...s.map(e=>e.host)]:s.map(e=>e.host)};var k=class extends n.t{static apiVersion=t.t;static findDevices(e=500){return O(e)}static isStandalone(){return T()!==void 0}static findLocalDevice(){return D()}static async open(e,t){let r=T(),a=r?{kind:`project`,project:r,defaultLabel:r}:{kind:`remote`,defaultLabel:(0,i.hostname)()};return await n.t.openBase(e,t,a)}};exports.AT1000=k,exports.ApiError=n.n,exports.format_host_for_url=n.r,exports.host_without_port=n.i;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./rolldown-runtime-CMqjfN_6.cjs"),t=require("./package-DDLRsahz.cjs"),n=require("./management-BGrPAG5k.cjs"),r=require("./at1000-D9r6GCs0.cjs");let i=require("up-fetch"),a=require("node:os");a=e.t(a,1);let o=require("node:fs"),s=require("dns-packet");s=e.t(s,1);let c=require("node:events"),l=require("node:util");l=e.t(l,1);let u=require("ip-address");u=e.t(u,1);let d=require("node:dgram");d=e.t(d,1);const f=`224.0.0.251`,p=5353,m=`IPv4`,h=`IPv6`,g=[m,4,h,6];var _=class e{static getInterfaces(t){return t?e.getInterfacesFromStrings(t):e.getAllInterfaces()}static getAllInterfaces(){let e=[],t=[],n=a.default.networkInterfaces();for(let[r,i]of Object.entries(n))t.includes(r)||(t.push(r),i?.forEach(t=>{t.internal||!g.includes(t.family)||/^(2002|2001):/gi.exec(t.address)||e.push({name:r,address:t.address,family:t.family,scopeid:t.scopeid})}));if(!e.length)throw Error(`No usable network interfaces returned by OS.`);return e}static getInterfacesFromStrings(t){let n=Array.isArray(t)?t:[t],r=this.getAllInterfaces().filter(t=>n.reduce((n,r)=>n||!!(e.stringMatchesAddress(r,t.address)||t.name===r),!1));if(!r||!r.length)throw Error(`No usable network interfaces returned by OS.`);return r}static stringMatchesAddress(e,t){let n,r;try{n=new u.default.Address4(e),r=new u.default.Address4(t)}catch{try{n=new u.default.Address6(e),r=new u.default.Address6(t)}catch{return!1}}return n.bigInt()===r.bigInt()}};const v={interfaces:[],reuseAddr:!0,ttl:255,loopback:!0,onMessage:(e,t)=>{console.log(`Message `+e.toString())},socketError:e=>{console.log(`Socket error `+e.message)}};var y=class e{static validateSettings(e){if(!e.multicastAddress)throw Error(`Socket settings require multicastAddress`);if(!e.multicastPort)throw Error(`Socket settings require multicastPort`)}static createMulticastSocket(t){return new Promise((n,r)=>{let i=Object.assign({},v,t);e.validateSettings(i);let a=d.default.createSocket({type:u.default.Address4.isValid(i.multicastAddress)?`udp4`:`udp6`,reuseAddr:i.reuseAddr}),o=!1;a.on(`error`,e=>{o?i.socketError(e):(a.close(),n({success:!1,error:e}))}).on(`listening`,()=>{o=!0,a.setMulticastTTL(i.ttl??255),a.setMulticastLoopback(i.loopback??!0);let t=e.addMulticastMemberships(a,i);if(!t.memberships.length){o=!1,a.close(),n({success:!1,error:Error(`No interface memberships for multicast address `+i.multicastAddress)});return}n(Object.assign({success:!0},t,{socket:a}))}).on(`message`,(e,t)=>{i.onMessage(e,t)}),a.bind({port:i.multicastPort,exclusive:!1})})}static addMulticastMemberships(t,n){let r=[],i=[],a=u.default.Address4.isValid(n.multicastAddress)?[m,4]:[h,6];return n.interfaces.forEach(o=>{if(a.includes(o.family))try{t.addMembership(n.multicastAddress,e.interfaceAddress(o)),r.push(o)}catch{i.push(o)}}),{memberships:r,failedMemberships:i}}static async createSendSocket(t,n,r,i,a){return new Promise(o=>{let s=[`IPv4`,4].includes(t.family)?`udp4`:`udp6`,c=e.interfaceAddress(t),l=n.srcPort??0,u=!1,f=e=>{let l=d.default.createSocket({type:s,reuseAddr:!!n.reuseAddr,reusePort:!0}),p=!1;l.on(`error`,t=>{p?i(t):(l.close(),e!==0&&!u?(u=!0,a?.(`mDNS send socket bind to ${c}:${e} failed (${t.message}); falling back to ephemeral source port — discovery may be unreliable on strict firewalls.`),f(0)):o({success:!1,error:Error(t.message)}))}).on(`listening`,()=>{p=!0,o({success:!0,iface:t,socket:l,send:l.send.bind(l)})}).on(`message`,(e,n)=>{n.interface=t.name,r(e,n)}).bind(e,c)};f(l)})}static interfaceAddress(e){return[`IPv4`,4].includes(e.family)?e.address:e.scopeid?`${e.address}%${e.name}`:e.address}};const b={reuseAddr:!0,srcPort:5353,interfaces:null,ttl:255,loopback:!0,debug:!1};var x=class extends c.EventEmitter{Config;ready;receiveSockets;sendSockets;interfaces;destroyed;constructor(e){super(),this.Config=Object.assign({},b,e),this.ready=!1,this.receiveSockets=[],this.sendSockets=[]}async init(){try{this.interfaces=_.getInterfaces(this.Config.interfaces||void 0)}catch(e){throw this.emitError(e),e}return this.emitDebug(`Scanner interfaces: ${l.default.inspect(this.interfaces)}`),await this.createReceiveSockets(),await this.createSendSockets(),this.receiveSockets.length&&this.sendSockets.length&&(this.ready=!0),this.ready}async createReceiveSockets(){if(!this.interfaces)return[];let e=this.interfaces.filter(e=>[m,4].includes(e.family)),t=this.interfaces.filter(e=>[h,6].includes(e.family));if(this.emitDebug(`Create receive sockets for${e.length?` IPv4`:``}${e.length&&t.length?` and`:``}${t.length?` IPv6`:``}`),e.length){let t=await y.createMulticastSocket({multicastAddress:f,multicastPort:p,interfaces:e,onMessage:this.onMessage.bind(this),socketError:this.socketError.bind(this)});t.success?this.receiveSockets.push(t):t.error&&this.emitWarn(t.error.message)}if(t.length){let e=await y.createMulticastSocket({multicastAddress:`FF02::FB`,multicastPort:p,interfaces:t,onMessage:this.onMessage.bind(this),socketError:this.socketError.bind(this)});e.success?this.receiveSockets.push(e):e.error&&this.emitWarn(e.error.message)}return this.receiveSockets}async createSendSockets(){if(this.interfaces){this.emitDebug(`Create send sockets on ${this.interfaces.length} interfaces/addresses.`);for(let e=0;e<this.interfaces.length;e++){let t=await y.createSendSocket(this.interfaces[e],this.Config,this.onMessage.bind(this),this.socketError.bind(this),this.emitWarn.bind(this));t.success?this.sendSockets.push(t):t.error&&this.emitWarn(t.error.message)}}}onMessage(e,t){let n;try{n=s.default.decode(e)}catch(e){return this.emitWarn(e)}this.emit(`packet`,n,t)}socketError(e){e.code===`EACCES`||e.code===`EADDRINUSE`||e.code===`EADDRNOTAVAIL`?this.emitError(e):this.emitWarn(e)}query(e,t){let n;if(typeof e==`string`)n=[{name:e,type:t||`ANY`}];else if(Array.isArray(e))n=e;else throw Error(`Query questions must be an array of mDNS query questions.`);let r={type:`query`,questions:n};this.emitDebug(`Send mDNS query: ${l.default.inspect(r)}`),this.send(r)}send(e){if(this.destroyed)return;let t=s.default.encode(e);e.type===`query`&&this.setUnicastResponseBit(t);for(let e=0;e<this.sendSockets.length;e++){let n=this.sendSockets[e];if(n.send&&n.iface)try{n.send(t,0,t.length,p,[`IPv4`,4].includes(n.iface.family)?f:`FF02::FB%`+n.iface.name),this.emitDebug(`Send packet on ${n.iface.address}`)}catch{}}}setUnicastResponseBit(e){let t=e.readUInt16BE(4),n=12;for(let r=0;r<t&&n<e.length;r++){for(;n<e.length&&e[n]!==0;)n+=e[n]+1;n+=1,n+=2,n<e.length&&(e[n]|=128),n+=2}}destroy(){this.destroyed=!0,this.ready=!1,this.removeAllListeners(),this.sendSockets.forEach(e=>{try{e.socket?.close()}catch{}}),this.sendSockets=[],this.receiveSockets.forEach(e=>{try{e.socket?.close()}catch{}}),this.receiveSockets=[]}emitError(e){this.emit(`error`,e)}emitWarn(e){this.emit(`warn`,e)}emitDebug(e){this.Config.debug&&this.emit(`debug`,e)}};const S={debug:!1};var C=class extends c.EventEmitter{Config;scanner;types;namedServices;packetListener;constructor(e,t){super(),this.packetListener=this.onPacket.bind(this),this.scanner=e,this.Config=Object.assign({},S,t),this.types=[],this.namedServices={},this.forwardEvents(this.scanner),this.reset()}reset(){this.removeMDNSListener(this.scanner),this.types=[],this.namedServices={},this.listenMDNSEvents(this.scanner)}forwardEvents(e){e.on(`error`,e=>{this.emitError(e)}).on(`warn`,e=>{this.emitWarn(e)}).on(`debug`,e=>{this.emitDebug(e)})}listenMDNSEvents(e){e.on(`packet`,this.packetListener)}removeMDNSListener(e){e.removeListener(`packet`,this.packetListener)}onPacket(e,t){switch(this.emitDebug(`Received packet type ${e.type} from ${t.address}.`),e.type){case`query`:this.emit(`query`,e,t);break;case`response`:this.emitDebug(`Received response packet from ${t.address} with ${e.answers?e.answers.length:0} answers and ${e.additionals?e.additionals.length:0} additionals.`),e.answers&&this.processAnswers(e.answers,t),e.additionals&&this.processAnswers(e.additionals,t);break}}processAnswers(e,t){this.emitDebug(`Processing answers or additionals...`);let n=this.processSRVAnswers(e);this.processTXTAnswers(e),this.processAAnswers(e),this.processAAAAAnswers(e),this.processPTRAnswers(e,t),n.forEach(e=>{this.emit(`discovered`,{type:`service`,data:this.namedServices[e]})})}processSRVAnswers(e){let t=[];return e.forEach(e=>{if(e.type!==`SRV`)return;this.emitDebug(`Processing SRV answer.`);let n=e.name.toString();t.includes(n)||t.push(n),this.namedServices[n]=this.namedServices[n]||{},this.namedServices[n].service=e,this.namedServices[n].host=e.data.target.toString(),this.namedServices[n].port=e.data.port}),t}processTXTAnswers(e){e.forEach(e=>{if(e.type!==`TXT`)return;this.emitDebug(`Processing TXT answer.`);let t=e.data;if(Array.isArray(t)&&t.length>1){let n=e.name.toString();this.namedServices[n]=this.namedServices[n]||{},this.namedServices[n].txt=this.answerDataToKeyValues(Buffer.concat(t))}else if(Buffer.isBuffer(t)){let n=e.name.toString();this.namedServices[n]=this.namedServices[n]||{},this.namedServices[n].txt=this.answerDataToKeyValues(t)}})}processAAnswers(e){e.forEach(e=>{if(e.type!==`A`)return;this.emitDebug(`Processing A answer.`);let t=e.name.toString(),n=e.data.toString();for(let e in this.namedServices)this.namedServices[e].host===t&&(this.namedServices[e].addresses=this.namedServices[e].addresses||[],this.namedServices[e].addresses.reduce((e,t)=>e||t.address===n,!1)||this.namedServices[e].addresses.push({family:m,address:n}))})}processAAAAAnswers(e){e.forEach(e=>{if(e.type!==`AAAA`)return;this.emitDebug(`Processing AAAA answer.`);let t=e.name.toString(),n=e.data.toString();for(let e in this.namedServices)this.namedServices[e].host===t&&(this.namedServices[e].addresses=this.namedServices[e].addresses||[],this.namedServices[e].addresses.reduce((e,t)=>e||t.address===n,!1)||this.namedServices[e].addresses.push({family:h,address:n}))})}processPTRAnswers(e,t){e.forEach(e=>{if(e.type!==`PTR`)return;this.emitDebug(`Processing PTR answer.`);let n=this.serviceTypeFromPTR(e),r=e.data.toString();n!==r&&(this.namedServices[r]=this.namedServices[r]||{},this.namedServices[r].name=r.replace(`.`+n,``),this.namedServices[r].rinfo=t)})}serviceTypeFromPTR(e){let t=e.data,n=/(?:^|^.+?(?:\.))(_.*)$/gm.exec(t.toString()),r=n?n[1]:t.toString();return this.types.includes(r)||(this.types.push(r),this.emit(`discovered`,{type:`type`,data:r}),this.emitDebug(`Scanning service type ${r}.`),this.scanner.query(r,`ANY`)),r}answerDataToKeyValues(e){let t=[],n={},r=0,i=e[r];for(;i;){let a=e.slice(r+1,r+1+i);t.push(a.toString());let o=/^([^=]+)=([^=]*)$/.exec(a.toString());o&&(n[o[1]]=o[2]),r=r+1+i,i=e[r]}return{strings:t,keyValuePairs:n}}emitError(e){this.emit(`error`,e)}emitWarn(e){this.emit(`warn`,e)}emitDebug(e){this.Config.debug&&this.emit(`debug`,e)}};function w(e){return e.startsWith(`192.168.`)?0:e.startsWith(`169.254.`)?1:2}function T(){try{return(0,o.readFileSync)(`/etc/at1000/hostname`,`utf8`).trim()||void 0}catch{return}}function E(){try{return(0,o.readFileSync)(`/etc/at1000/project`,`utf8`).trim()||void 0}catch{return}}async function D(e){return{host:e,info:await new n.n((0,i.up)(fetch,()=>({baseUrl:`http://${n.u(e)}/v0`,timeout:1e3,parseRejected:(e,t)=>r.r(e,t.method)})),e).info()}}const O=async()=>{let e=T();if(e)for(let t of[`${e}.local`,`host.containers.internal`])try{if((await D(t)).info.hostname===e)return t}catch{}},k=async(e=500)=>{e<10&&(e=10);let t=new x({debug:!0}),r=new C(t);if(r.on(`error`,e=>{if(!e.includes(`bind ENOENT`))throw Error(e)}),!await t.init())throw Error(`Failed to initialize mDNS scanner`);t.query(`_at1000_server._tcp.local`),await new Promise(t=>setTimeout(t,e));let i=[...new Set(Object.values(r.namedServices).filter(e=>e.service!==void 0).filter(e=>(e.service?.name)?.endsWith(`_at1000_server._tcp.local`)).flatMap(e=>{let t=e.addresses??[],r=e.port,i=t.filter(e=>e.family===`IPv4`).map(e=>n.u(e.address,r)),a=t.filter(e=>e.family===`IPv6`).map(e=>n.u(e.address,r));return[...i,...a]}))];t.destroy();let a=(await Promise.allSettled(i.map(D))).filter(e=>e.status===`fulfilled`).map(e=>e.value),o=new Map;for(let e of a){let t=o.get(e.info.hostname);t?w(e.host)<w(t.host)&&o.set(e.info.hostname,e):o.set(e.info.hostname,e)}let s=[...o.values()],c=T();if(!c)return s.map(e=>e.host);let l=s.findIndex(e=>e.info.hostname===c);if(l>=0)return s.unshift(...s.splice(l,1)),s.map(e=>e.host);let u=await O();return u?[u,...s.map(e=>e.host)]:s.map(e=>e.host)};var A=class extends r.t{static apiVersion=t.t;static findDevices(e=500){return k(e)}static isStandalone(){return E()!==void 0}static findLocalDevice(){return O()}static async open(e,t){let n=E(),i=n?{kind:`project`,project:n,defaultLabel:n}:{kind:`remote`,defaultLabel:(0,a.hostname)()};return await r.t.openBase(e,t,i)}};exports.AT1000=A,exports.ApiError=r.n,exports.format_host_for_url=n.u,exports.host_without_port=n.d;
|
|
2
2
|
//# sourceMappingURL=node.cjs.map
|