quote0 1.0.0-alpha.4 → 1.0.0-alpha.6

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/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Quote/0 SDK & CLI
2
2
 
3
+ [![pkg.pr.new](https://pkg.pr.new/badge/MrWillCom/quote0)](https://pkg.pr.new/~/MrWillCom/quote0)
4
+
3
5
  TypeScript SDK and CLI for Quote/0.
4
6
 
5
7
  > [!CAUTION]
@@ -0,0 +1,21 @@
1
+ //#region src/api/base.d.ts
2
+ interface BaseClientArgs {
3
+ apiKey: string;
4
+ }
5
+ declare class BaseClient {
6
+ protected apiKey: string;
7
+ constructor({
8
+ apiKey
9
+ }: BaseClientArgs);
10
+ static readonly API_ENDPOINT = "https://dot.mindreset.tech/api";
11
+ protected readonly apiEndpoint = "https://dot.mindreset.tech/api";
12
+ static readonly DISPLAY: {
13
+ width: number;
14
+ height: number;
15
+ };
16
+ protected composeApiUrl(path: string): string;
17
+ protected fetchApi(path: string, options?: RequestInit): Promise<unknown>;
18
+ }
19
+ //#endregion
20
+ export { BaseClient, BaseClientArgs };
21
+ //# sourceMappingURL=base.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.mts","names":[],"sources":["../../src/api/base.ts"],"mappings":";UAAiB,cAAA;EACf,MAAA;AAAA;AAAA,cAGI,UAAA;EAAA,UACM,MAAA;;IACI;EAAA,GAAU,cAAA;EAAA,gBAIR,YAAA;EAAA,mBACG,WAAA;EAAA,gBAEH,OAAA;;;;YAEN,aAAA,CAAc,IAAA;EAAA,UAMR,QAAA,CAAS,IAAA,UAAc,OAAA,GAAU,WAAA,GAAW,OAAA;AAAA"}
@@ -1,2 +1,2 @@
1
- var e=class e{apiKey;constructor({apiKey:e}){this.apiKey=e}static API_ENDPOINT=`https://dot.mindreset.tech/api`;apiEndpoint=e.API_ENDPOINT;static DISPLAY={width:296,height:152};composeApiUrl(e){return e.startsWith(`/`)?this.apiEndpoint+e:this.apiEndpoint+`/`+e}async fetchApi(e,t){let n=this.composeApiUrl(e),r=Object.assign({method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer `+this.apiKey}},t??{});try{let e=await fetch(n,r);if(e.ok)return await e.json();throw Error(`API request failed with status ${e.status}: ${e.statusText}`)}catch(e){throw e}}},t=class extends e{async next({deviceId:e}){return await this.fetchApi(`/authV2/open/device/${e}/next`,{method:`POST`})}async pushImage({deviceId:e},t){return await this.fetchApi(`/authV2/open/device/${e}/image`,{method:`POST`,body:JSON.stringify(t)})}},n=class extends e{async list(){return await this.fetchApi(`/authV2/open/devices`)}async status({deviceId:e}){return await this.fetchApi(`/authV2/open/device/${e}/status`)}};export{t as n,e as r,n as t};
2
- //# sourceMappingURL=device-CSVHxulH.mjs.map
1
+ var e=class e{apiKey;constructor({apiKey:e}){this.apiKey=e}static API_ENDPOINT=`https://dot.mindreset.tech/api`;apiEndpoint=e.API_ENDPOINT;static DISPLAY={width:296,height:152};composeApiUrl(e){return e.startsWith(`/`)?this.apiEndpoint+e:this.apiEndpoint+`/`+e}async fetchApi(e,t){let n=this.composeApiUrl(e),r=Object.assign({method:`GET`,headers:{"Content-Type":`application/json`,Authorization:`Bearer `+this.apiKey}},t??{});try{let e=await fetch(n,r);if(e.ok)return await e.json();throw Error(`API request failed with status ${e.status}: ${e.statusText}`)}catch(e){throw e}}};export{e as default};
2
+ //# sourceMappingURL=base.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.mjs","names":[],"sources":["../../src/api/base.ts"],"sourcesContent":["export interface BaseClientArgs {\n apiKey: string\n}\n\nclass BaseClient {\n protected apiKey: string\n constructor({ apiKey }: BaseClientArgs) {\n this.apiKey = apiKey\n }\n\n static readonly API_ENDPOINT = 'https://dot.mindreset.tech/api'\n protected readonly apiEndpoint = BaseClient.API_ENDPOINT\n\n static readonly DISPLAY = { width: 296, height: 152 }\n\n protected composeApiUrl(path: string) {\n return path.startsWith('/')\n ? this.apiEndpoint + path\n : this.apiEndpoint + '/' + path\n }\n\n protected async fetchApi(path: string, options?: RequestInit) {\n const url = this.composeApiUrl(path)\n const mergedOptions = Object.assign(\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: 'Bearer ' + this.apiKey,\n },\n },\n options ?? {},\n )\n\n try {\n const response = await fetch(url, mergedOptions)\n\n if (response.ok) {\n return await response.json()\n } else {\n throw new Error(\n `API request failed with status ${response.status}: ${response.statusText}`,\n )\n }\n } catch (error) {\n throw error\n }\n }\n}\n\nexport default BaseClient\n"],"mappings":"AAIA,IAAM,EAAN,MAAM,CAAW,CACf,OACA,YAAY,CAAE,UAA0B,CACtC,KAAK,OAAS,EAGhB,OAAgB,aAAe,iCAC/B,YAAiC,EAAW,aAE5C,OAAgB,QAAU,CAAE,MAAO,IAAK,OAAQ,IAAK,CAErD,cAAwB,EAAc,CACpC,OAAO,EAAK,WAAW,IAAI,CACvB,KAAK,YAAc,EACnB,KAAK,YAAc,IAAM,EAG/B,MAAgB,SAAS,EAAc,EAAuB,CAC5D,IAAM,EAAM,KAAK,cAAc,EAAK,CAC9B,EAAgB,OAAO,OAC3B,CACE,OAAQ,MACR,QAAS,CACP,eAAgB,mBAChB,cAAe,UAAY,KAAK,OACjC,CACF,CACD,GAAW,EAAE,CACd,CAED,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAK,EAAc,CAEhD,GAAI,EAAS,GACX,OAAO,MAAM,EAAS,MAAM,CAE5B,MAAU,MACR,kCAAkC,EAAS,OAAO,IAAI,EAAS,aAChE,OAEI,EAAO,CACd,MAAM"}
@@ -1,88 +1,7 @@
1
- //#region src/api/base.d.ts
2
- interface BaseClientArgs {
3
- apiKey: string;
4
- }
5
- declare class BaseClient {
6
- protected apiKey: string;
7
- constructor({
8
- apiKey
9
- }: BaseClientArgs);
10
- static readonly API_ENDPOINT = "https://dot.mindreset.tech/api";
11
- protected readonly apiEndpoint = "https://dot.mindreset.tech/api";
12
- static readonly DISPLAY: {
13
- width: number;
14
- height: number;
15
- };
16
- protected composeApiUrl(path: string): string;
17
- protected fetchApi(path: string, options?: RequestInit): Promise<unknown>;
18
- }
19
- //#endregion
20
- //#region src/api/modules/content.d.ts
21
- declare class ContentModule extends BaseClient {
22
- next({
23
- deviceId
24
- }: {
25
- deviceId: string;
26
- }): Promise<{
27
- code: number;
28
- message: string;
29
- }>;
30
- pushImage({
31
- deviceId
32
- }: {
33
- deviceId: string;
34
- }, options: {
35
- refreshNow?: boolean;
36
- image: string;
37
- link?: string;
38
- border?: 0 | 1;
39
- ditherType?: 'DIFFUSION' | 'ORDERED' | 'NONE';
40
- ditherKernel?: 'THRESHOLD' | 'ATKINSON' | 'BURKES' | 'FLOYD_STEINBERG' | 'SIERRA2' | 'STUCKI' | 'JARVIS_JUDICE_NINKE' | 'DIFFUSION_ROW' | 'DIFFUSION_COLUMN' | 'DIFFUSION_2D';
41
- taskKey?: string;
42
- }): Promise<{
43
- code: number;
44
- message: string;
45
- }>;
46
- }
47
- //#endregion
48
- //#region src/api/modules/device.d.ts
49
- declare class DeviceModule extends BaseClient {
50
- list(): Promise<{
51
- id: string;
52
- series: string;
53
- model: string;
54
- edition: 1 | 2;
55
- }[]>;
56
- status({
57
- deviceId
58
- }: {
59
- deviceId: string;
60
- }): Promise<{
61
- deviceId: string;
62
- alias: string | null;
63
- location: string | null;
64
- status: {
65
- version: string;
66
- current: string;
67
- description: string;
68
- battery: string;
69
- wifi: string;
70
- };
71
- renderInfo: {
72
- last: string;
73
- current: {
74
- rotated: boolean;
75
- border: number;
76
- image: string[];
77
- };
78
- next: {
79
- battery: string;
80
- power: string;
81
- };
82
- };
83
- }>;
84
- }
85
- //#endregion
1
+ import { BaseClient, BaseClientArgs } from "./base.mjs";
2
+ import { BORDER, Border, ContentModule, DITHER_KERNELS, DITHER_TYPES, DitherKernel, DitherType } from "./modules/content.mjs";
3
+ import { DeviceModule } from "./modules/device.mjs";
4
+
86
5
  //#region src/api/index.d.ts
87
6
  declare class Quote0 extends BaseClient {
88
7
  device: DeviceModule;
@@ -94,5 +13,5 @@ declare class Quote0 extends BaseClient {
94
13
  };
95
14
  }
96
15
  //#endregion
97
- export { Quote0 as default };
16
+ export { BORDER, type Border, DITHER_KERNELS, DITHER_TYPES, type DitherKernel, type DitherType, Quote0 as default };
98
17
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/api/base.ts","../../src/api/modules/content.ts","../../src/api/modules/device.ts","../../src/api/index.ts"],"mappings":";UAAiB,cAAA;EACf,MAAA;AAAA;AAAA,cAGI,UAAA;EAAA,UACM,MAAA;;IACI;EAAA,GAAU,cAAA;EAAA,gBAIR,YAAA;EAAA,mBACG,WAAA;EAAA,gBAEH,OAAA;;;;YAEN,aAAA,CAAc,IAAA;EAAA,UAMR,QAAA,CAAS,IAAA,UAAc,OAAA,GAAU,WAAA,GAAW,OAAA;AAAA;;;cCnBxD,aAAA,SAAsB,UAAA;EACpB,IAAA,CAAA;IAAO;EAAA;IAAc,QAAA;EAAA,IAAkB,OAAA;;;;EAWvC,SAAA,CAAA;IACF;EAAA;IAAc,QAAA;EAAA,GAChB,OAAA;IACE,UAAA;IACA,KAAA;IACA,IAAA;IACA,MAAA;IACA,UAAA;IACA,YAAA;IAWA,OAAA;EAAA,IACD,OAAA;;;;;;;cChCC,YAAA,SAAqB,UAAA;EACnB,IAAA,CAAA,GAAI,OAAA;;;;;;EAWJ,MAAA,CAAA;IAAS;EAAA;IAAc,QAAA;EAAA,IAAkB,OAAA;;;;;MAQzC,OAAA;MACA,OAAA;MACA,WAAA;MACA,OAAA;MACA,IAAA;IAAA;;MAGA,IAAA;MACA,OAAA;QACE,OAAA;QACA,MAAA;QACA,KAAA;MAAA;MAEF,IAAA;QACE,OAAA;QACA,KAAA;MAAA;IAAA;EAAA;AAAA;;;cCjCJ,MAAA,SAAe,UAAA;EACnB,MAAA,EAAQ,YAAA;EACR,OAAA,EAAS,aAAA;cAEG,IAAA,EAAM,cAAA;EAAA,SAOT,OAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/api/index.ts"],"mappings":";;;;;cAIM,MAAA,SAAe,UAAA;EACnB,MAAA,EAAQ,YAAA;EACR,OAAA,EAAS,aAAA;cAEG,IAAA,EAAM,cAAA;EAAA,SAOT,OAAA"}
@@ -1,2 +1,2 @@
1
- import{n as e,r as t,t as n}from"../device-CSVHxulH.mjs";var r=class extends t{device;content;constructor(t){super(t),this.device=new n(t),this.content=new e(t)}display=t.DISPLAY};export{r as default};
1
+ import e from"./base.mjs";import t,{BORDER as n,DITHER_KERNELS as r,DITHER_TYPES as i}from"./modules/content.mjs";import a from"./modules/device.mjs";var o=class extends e{device;content;constructor(e){super(e),this.device=new a(e),this.content=new t(e)}display=e.DISPLAY};export{n as BORDER,r as DITHER_KERNELS,i as DITHER_TYPES,o as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../../src/api/index.ts"],"sourcesContent":["import BaseClient, { type BaseClientArgs } from './base'\nimport ContentModule from './modules/content'\nimport DeviceModule from './modules/device'\n\nclass Quote0 extends BaseClient {\n device: DeviceModule\n content: ContentModule\n\n constructor(args: BaseClientArgs) {\n super(args)\n\n this.device = new DeviceModule(args)\n this.content = new ContentModule(args)\n }\n\n readonly display = BaseClient.DISPLAY\n}\n\nexport default Quote0\n"],"mappings":"yDAIA,IAAM,EAAN,cAAqB,CAAW,CAC9B,OACA,QAEA,YAAY,EAAsB,CAChC,MAAM,EAAK,CAEX,KAAK,OAAS,IAAI,EAAa,EAAK,CACpC,KAAK,QAAU,IAAI,EAAc,EAAK,CAGxC,QAAmB,EAAW"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../../src/api/index.ts"],"sourcesContent":["import BaseClient, { type BaseClientArgs } from './base'\nimport ContentModule from './modules/content'\nimport DeviceModule from './modules/device'\n\nclass Quote0 extends BaseClient {\n device: DeviceModule\n content: ContentModule\n\n constructor(args: BaseClientArgs) {\n super(args)\n\n this.device = new DeviceModule(args)\n this.content = new ContentModule(args)\n }\n\n readonly display = BaseClient.DISPLAY\n}\n\nexport default Quote0\n\nexport {\n BORDER,\n DITHER_TYPES,\n DITHER_KERNELS,\n type Border,\n type DitherType,\n type DitherKernel,\n} from './modules/content'\n"],"mappings":"sJAIA,IAAM,EAAN,cAAqB,CAAW,CAC9B,OACA,QAEA,YAAY,EAAsB,CAChC,MAAM,EAAK,CAEX,KAAK,OAAS,IAAI,EAAa,EAAK,CACpC,KAAK,QAAU,IAAI,EAAc,EAAK,CAGxC,QAAmB,EAAW"}
@@ -0,0 +1,76 @@
1
+ import { BaseClient } from "../base.mjs";
2
+
3
+ //#region src/api/modules/content.d.ts
4
+ declare const BORDER: readonly [0, 1];
5
+ type Border = (typeof BORDER)[number];
6
+ declare const DITHER_TYPES: readonly ["DIFFUSION", "ORDERED", "NONE"];
7
+ type DitherType = (typeof DITHER_TYPES)[number];
8
+ declare const DITHER_KERNELS: readonly ["THRESHOLD", "ATKINSON", "BURKES", "FLOYD_STEINBERG", "SIERRA2", "STUCKI", "JARVIS_JUDICE_NINKE", "DIFFUSION_ROW", "DIFFUSION_COLUMN", "DIFFUSION_2D"];
9
+ type DitherKernel = (typeof DITHER_KERNELS)[number];
10
+ declare const TASK_TYPES: readonly ["fixed", "loop"];
11
+ type TaskType = (typeof TASK_TYPES)[number];
12
+ declare class ContentModule extends BaseClient {
13
+ next({
14
+ deviceId
15
+ }: {
16
+ deviceId: string;
17
+ }): Promise<{
18
+ code: number;
19
+ message: string;
20
+ }>;
21
+ list({
22
+ deviceId,
23
+ taskType
24
+ }: {
25
+ deviceId: string;
26
+ taskType: TaskType;
27
+ }): Promise<{
28
+ type: "TEXT_API" | "IMAGE_API" | "GENERAL";
29
+ key: string | null;
30
+ refreshNow?: boolean;
31
+ title?: string;
32
+ message?: string;
33
+ signature?: string;
34
+ icon?: string;
35
+ link?: string;
36
+ image?: string;
37
+ border?: Border;
38
+ ditherType?: string;
39
+ ditherKernel?: string;
40
+ }>;
41
+ pushText({
42
+ deviceId
43
+ }: {
44
+ deviceId: string;
45
+ }, options: {
46
+ refreshNow?: boolean;
47
+ title?: string;
48
+ message?: string;
49
+ signature?: string;
50
+ icon?: string;
51
+ link?: string;
52
+ taskKey?: string;
53
+ }): Promise<{
54
+ code: number;
55
+ message: string;
56
+ }>;
57
+ pushImage({
58
+ deviceId
59
+ }: {
60
+ deviceId: string;
61
+ }, options: {
62
+ refreshNow?: boolean;
63
+ image: string;
64
+ link?: string;
65
+ border?: Border;
66
+ ditherType?: DitherType;
67
+ ditherKernel?: DitherKernel;
68
+ taskKey?: string;
69
+ }): Promise<{
70
+ code: number;
71
+ message: string;
72
+ }>;
73
+ }
74
+ //#endregion
75
+ export { BORDER, Border, ContentModule, DITHER_KERNELS, DITHER_TYPES, DitherKernel, DitherType };
76
+ //# sourceMappingURL=content.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.d.mts","names":[],"sources":["../../../src/api/modules/content.ts"],"mappings":";;;cAEa,MAAA;AAAA,KACD,MAAA,WAAiB,MAAA;AAAA,cAEhB,YAAA;AAAA,KACD,UAAA,WAAqB,YAAA;AAAA,cAEpB,cAAA;AAAA,KAYD,YAAA,WAAuB,cAAA;AAAA,cAEtB,UAAA;AAAA,KACD,QAAA,WAAmB,UAAA;AAAA,cAEzB,aAAA,SAAsB,UAAA;EACpB,IAAA,CAAA;IAAO;EAAA;IAAc,QAAA;EAAA,IAAkB,OAAA;;;;EAWvC,IAAA,CAAA;IAAO,QAAA;IAAU;EAAA;IAAc,QAAA;IAAkB,QAAA,EAAU,QAAA;EAAA,IAAU,OAAA;;;;;;;;;;aAa9D,MAAA;;;;EAQP,QAAA,CAAA;IACF;EAAA;IAAc,QAAA;EAAA,GAChB,OAAA;IACE,UAAA;IACA,KAAA;IACA,OAAA;IACA,SAAA;IACA,IAAA;IACA,IAAA;IACA,OAAA;EAAA,IACD,OAAA;;;;EAUG,SAAA,CAAA;IACF;EAAA;IAAc,QAAA;EAAA,GAChB,OAAA;IACE,UAAA;IACA,KAAA;IACA,IAAA;IACA,MAAA,GAAS,MAAA;IACT,UAAA,GAAa,UAAA;IACb,YAAA,GAAe,YAAA;IACf,OAAA;EAAA,IACD,OAAA"}
@@ -0,0 +1,2 @@
1
+ import e from"../base.mjs";const t=[0,1],n=[`DIFFUSION`,`ORDERED`,`NONE`],r=[`THRESHOLD`,`ATKINSON`,`BURKES`,`FLOYD_STEINBERG`,`SIERRA2`,`STUCKI`,`JARVIS_JUDICE_NINKE`,`DIFFUSION_ROW`,`DIFFUSION_COLUMN`,`DIFFUSION_2D`];var i=class extends e{async next({deviceId:e}){return await this.fetchApi(`/authV2/open/device/${e}/next`,{method:`POST`})}async list({deviceId:e,taskType:t}){return await this.fetchApi(`/api/authV2/open/device/${e}/${t}/list`)}async pushText({deviceId:e},t){return await this.fetchApi(`/api/authV2/open/device/${e}/text`,{method:`POST`,body:JSON.stringify(t)})}async pushImage({deviceId:e},t){return await this.fetchApi(`/authV2/open/device/${e}/image`,{method:`POST`,body:JSON.stringify(t)})}};export{t as BORDER,r as DITHER_KERNELS,n as DITHER_TYPES,i as default};
2
+ //# sourceMappingURL=content.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"content.mjs","names":[],"sources":["../../../src/api/modules/content.ts"],"sourcesContent":["import BaseClient from '../base'\n\nexport const BORDER = [0, 1] as const\nexport type Border = (typeof BORDER)[number]\n\nexport const DITHER_TYPES = ['DIFFUSION', 'ORDERED', 'NONE'] as const\nexport type DitherType = (typeof DITHER_TYPES)[number]\n\nexport const DITHER_KERNELS = [\n 'THRESHOLD',\n 'ATKINSON',\n 'BURKES',\n 'FLOYD_STEINBERG',\n 'SIERRA2',\n 'STUCKI',\n 'JARVIS_JUDICE_NINKE',\n 'DIFFUSION_ROW',\n 'DIFFUSION_COLUMN',\n 'DIFFUSION_2D',\n] as const\nexport type DitherKernel = (typeof DITHER_KERNELS)[number]\n\nexport const TASK_TYPES = ['fixed', 'loop'] as const\nexport type TaskType = (typeof TASK_TYPES)[number]\n\nclass ContentModule extends BaseClient {\n async next({ deviceId }: { deviceId: string }) {\n const response = (await this.fetchApi(\n `/authV2/open/device/${deviceId}/next`,\n {\n method: 'POST',\n },\n )) as { code: number; message: string }\n\n return response\n }\n\n async list({ deviceId, taskType }: { deviceId: string; taskType: TaskType }) {\n const response = (await this.fetchApi(\n `/api/authV2/open/device/${deviceId}/${taskType}/list`,\n )) as {\n type: 'TEXT_API' | 'IMAGE_API' | 'GENERAL'\n key: string | null\n refreshNow?: boolean\n title?: string\n message?: string\n signature?: string\n icon?: string\n link?: string\n image?: string\n border?: Border\n ditherType?: string\n ditherKernel?: string\n }\n\n return response\n }\n\n async pushText(\n { deviceId }: { deviceId: string },\n options: {\n refreshNow?: boolean\n title?: string\n message?: string\n signature?: string\n icon?: string\n link?: string\n taskKey?: string\n },\n ) {\n const response = (await this.fetchApi(\n `/api/authV2/open/device/${deviceId}/text`,\n { method: 'POST', body: JSON.stringify(options) },\n )) as { code: number; message: string }\n\n return response\n }\n\n async pushImage(\n { deviceId }: { deviceId: string },\n options: {\n refreshNow?: boolean\n image: string\n link?: string\n border?: Border\n ditherType?: DitherType\n ditherKernel?: DitherKernel\n taskKey?: string\n },\n ) {\n const response = (await this.fetchApi(\n `/authV2/open/device/${deviceId}/image`,\n { method: 'POST', body: JSON.stringify(options) },\n )) as { code: number; message: string }\n\n return response\n }\n}\n\nexport default ContentModule\n"],"mappings":"2BAEA,MAAa,EAAS,CAAC,EAAG,EAAE,CAGf,EAAe,CAAC,YAAa,UAAW,OAAO,CAG/C,EAAiB,CAC5B,YACA,WACA,SACA,kBACA,UACA,SACA,sBACA,gBACA,mBACA,eACD,CAMD,IAAM,EAAN,cAA4B,CAAW,CACrC,MAAM,KAAK,CAAE,YAAkC,CAQ7C,OAPkB,MAAM,KAAK,SAC3B,uBAAuB,EAAS,OAChC,CACE,OAAQ,OACT,CACF,CAKH,MAAM,KAAK,CAAE,WAAU,YAAsD,CAkB3E,OAjBkB,MAAM,KAAK,SAC3B,2BAA2B,EAAS,GAAG,EAAS,OACjD,CAkBH,MAAM,SACJ,CAAE,YACF,EASA,CAMA,OALkB,MAAM,KAAK,SAC3B,2BAA2B,EAAS,OACpC,CAAE,OAAQ,OAAQ,KAAM,KAAK,UAAU,EAAQ,CAAE,CAClD,CAKH,MAAM,UACJ,CAAE,YACF,EASA,CAMA,OALkB,MAAM,KAAK,SAC3B,uBAAuB,EAAS,QAChC,CAAE,OAAQ,OAAQ,KAAM,KAAK,UAAU,EAAQ,CAAE,CAClD"}
@@ -0,0 +1,42 @@
1
+ import { BaseClient } from "../base.mjs";
2
+
3
+ //#region src/api/modules/device.d.ts
4
+ declare class DeviceModule extends BaseClient {
5
+ list(): Promise<{
6
+ id: string;
7
+ series: string;
8
+ model: string;
9
+ edition: 1 | 2;
10
+ }[]>;
11
+ status({
12
+ deviceId
13
+ }: {
14
+ deviceId: string;
15
+ }): Promise<{
16
+ deviceId: string;
17
+ alias: string | null;
18
+ location: string | null;
19
+ status: {
20
+ version: string;
21
+ current: string;
22
+ description: string;
23
+ battery: string;
24
+ wifi: string;
25
+ };
26
+ renderInfo: {
27
+ last: string;
28
+ current: {
29
+ rotated: boolean;
30
+ border: number;
31
+ image: string[];
32
+ };
33
+ next: {
34
+ battery: string;
35
+ power: string;
36
+ };
37
+ };
38
+ }>;
39
+ }
40
+ //#endregion
41
+ export { DeviceModule };
42
+ //# sourceMappingURL=device.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.d.mts","names":[],"sources":["../../../src/api/modules/device.ts"],"mappings":";;;cAEM,YAAA,SAAqB,UAAA;EACnB,IAAA,CAAA,GAAI,OAAA;;;;;;EAWJ,MAAA,CAAA;IAAS;EAAA;IAAc,QAAA;EAAA,IAAkB,OAAA;;;;;MAQzC,OAAA;MACA,OAAA;MACA,WAAA;MACA,OAAA;MACA,IAAA;IAAA;;MAGA,IAAA;MACA,OAAA;QACE,OAAA;QACA,MAAA;QACA,KAAA;MAAA;MAEF,IAAA;QACE,OAAA;QACA,KAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -0,0 +1,2 @@
1
+ import e from"../base.mjs";var t=class extends e{async list(){return await this.fetchApi(`/authV2/open/devices`)}async status({deviceId:e}){return await this.fetchApi(`/authV2/open/device/${e}/status`)}};export{t as default};
2
+ //# sourceMappingURL=device.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"device.mjs","names":[],"sources":["../../../src/api/modules/device.ts"],"sourcesContent":["import BaseClient from '../base'\n\nclass DeviceModule extends BaseClient {\n async list() {\n const response = (await this.fetchApi(`/authV2/open/devices`)) as {\n id: string\n series: string\n model: string\n edition: 1 | 2\n }[]\n\n return response\n }\n\n async status({ deviceId }: { deviceId: string }) {\n const response = (await this.fetchApi(\n `/authV2/open/device/${deviceId}/status`,\n )) as {\n deviceId: string\n alias: string | null\n location: string | null\n status: {\n version: string\n current: string\n description: string\n battery: string\n wifi: string\n }\n renderInfo: {\n last: string\n current: {\n rotated: boolean\n border: number\n image: string[]\n }\n next: {\n battery: string\n power: string\n }\n }\n }\n\n return response\n }\n}\n\nexport default DeviceModule\n"],"mappings":"2BAEA,IAAM,EAAN,cAA2B,CAAW,CACpC,MAAM,MAAO,CAQX,OAPkB,MAAM,KAAK,SAAS,uBAAuB,CAU/D,MAAM,OAAO,CAAE,YAAkC,CA4B/C,OA3BkB,MAAM,KAAK,SAC3B,uBAAuB,EAAS,SACjC"}
@@ -0,0 +1,2 @@
1
+ import{Box as e}from"ink";import{jsx as t}from"react/jsx-runtime";function n({...n}){return t(e,{borderStyle:`round`,flexDirection:`column`,...n})}export{n as default};
2
+ //# sourceMappingURL=Container.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Container.mjs","names":[],"sources":["../../src/components/Container.tsx"],"sourcesContent":["import { Box } from 'ink'\nimport type React from 'react'\n\nexport default function Container({\n ...props\n}: React.ComponentProps<typeof Box>) {\n return <Box borderStyle=\"round\" flexDirection=\"column\" {...props} />\n}\n"],"mappings":"kEAGA,SAAwB,EAAU,CAChC,GAAG,GACgC,CACnC,OAAO,EAAC,EAAA,CAAI,YAAY,QAAQ,cAAc,SAAS,GAAI,GAAS"}
@@ -0,0 +1,2 @@
1
+ import{Box as e,Text as t}from"ink";import{Fragment as n,jsx as r,jsxs as i}from"react/jsx-runtime";function a({leading:a,children:o,trailing:s,...c}){return i(e,{justifyContent:`space-between`,...c,children:[i(e,{children:[a&&i(n,{children:[a,r(t,{children:` `})]}),o]}),r(e,{children:s})]})}export{a as default};
2
+ //# sourceMappingURL=ListItem.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ListItem.mjs","names":[],"sources":["../../src/components/ListItem.tsx"],"sourcesContent":["import { Box, Text } from 'ink'\n\nexport default function ListItem({\n leading,\n children,\n trailing,\n ...props\n}: React.ComponentProps<typeof Box> & {\n leading?: React.ReactNode\n children?: React.ReactNode\n trailing?: React.ReactNode\n}) {\n return (\n <Box justifyContent=\"space-between\" {...props}>\n <Box>\n {leading && (\n <>\n {leading}\n <Text> </Text>\n </>\n )}\n {children}\n </Box>\n <Box>{trailing}</Box>\n </Box>\n )\n}\n"],"mappings":"oGAEA,SAAwB,EAAS,CAC/B,UACA,WACA,WACA,GAAG,GAKF,CACD,OACE,EAAC,EAAA,CAAI,eAAe,gBAAgB,GAAI,YACtC,EAAC,EAAA,CAAA,SAAA,CACE,GACC,EAAA,EAAA,CAAA,SAAA,CACG,EACD,EAAC,EAAA,CAAA,SAAK,IAAA,CAAQ,CAAA,CAAA,CACb,CAEJ,EAAA,CAAA,CACG,CACN,EAAC,EAAA,CAAA,SAAK,EAAA,CAAe,CAAA,EACjB"}
@@ -0,0 +1,2 @@
1
+ import e from"../utils/ink-props-helpers.mjs";import{Box as t}from"ink";import{jsx as n}from"react/jsx-runtime";import r from"react";function i({isLast:r,...i}){return n(t,{...r!==!0&&{borderStyle:`single`,borderDimColor:!0,...e.border(`bottom`)},paddingX:1,flexDirection:`column`,...i})}function a({children:e}){let t=r.Children.toArray(e);return r.Children.map(t,(e,r)=>n(i,{isLast:r===t.length-1,children:e}))}export{a as SectionList};
2
+ //# sourceMappingURL=Section.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Section.mjs","names":[],"sources":["../../src/components/Section.tsx"],"sourcesContent":["import { Box } from 'ink'\nimport { inkPropsHelpers } from '../utils'\nimport React from 'react'\n\nfunction Section({\n isLast,\n ...props\n}: React.ComponentProps<typeof Box> & { isLast?: boolean }) {\n return (\n <Box\n {...(isLast !== true && {\n borderStyle: 'single',\n borderDimColor: true,\n ...inkPropsHelpers.border('bottom'),\n })}\n paddingX={1}\n flexDirection=\"column\"\n {...props}\n />\n )\n}\n\nfunction SectionList({ children }: { children: React.ReactNode }) {\n const arrayChildren = React.Children.toArray(children)\n return React.Children.map(arrayChildren, (child, i) => (\n <Section isLast={i === arrayChildren.length - 1}>{child}</Section>\n ))\n}\n\nexport { Section, SectionList }\nexport default Section\n"],"mappings":"qIAIA,SAAS,EAAQ,CACf,SACA,GAAG,GACuD,CAC1D,OACE,EAAC,EAAA,CACC,GAAK,IAAW,IAAQ,CACtB,YAAa,SACb,eAAgB,GAChB,GAAG,EAAgB,OAAO,SAAS,CACpC,CACD,SAAU,EACV,cAAc,SACd,GAAI,GACJ,CAIN,SAAS,EAAY,CAAE,YAA2C,CAChE,IAAM,EAAgB,EAAM,SAAS,QAAQ,EAAS,CACtD,OAAO,EAAM,SAAS,IAAI,GAAgB,EAAO,IAC/C,EAAC,EAAA,CAAQ,OAAQ,IAAM,EAAc,OAAS,WAAI,GAAgB,CAClE"}
@@ -0,0 +1,2 @@
1
+ import{name as e}from"./package.mjs";import t from"conf";import{parse as n,stringify as r}from"yaml";const i=new t({projectName:e,fileExtension:`yaml`,serialize:r,deserialize:n});export{i as default};
2
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.mjs","names":[],"sources":["../src/config.ts"],"sourcesContent":["import Conf from 'conf'\nimport { parse, stringify } from 'yaml'\nimport { name } from '../package.json'\n\nconst config = new Conf({\n projectName: name,\n fileExtension: 'yaml',\n serialize: stringify,\n deserialize: parse,\n})\n\nexport default config\n"],"mappings":"qGAIA,MAAM,EAAS,IAAI,EAAK,CACtB,YAAa,EACb,cAAe,OACf,UAAW,EACX,YAAa,EACd,CAAC"}
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  #!/usr/bin/env node
2
- import e from"./api/index.mjs";import t from"yargs";import{hideBin as n}from"yargs/helpers";import{Box as r,Text as i,render as a}from"ink";import{Fragment as o,jsx as s,jsxs as c}from"react/jsx-runtime";import l from"react";import{UncontrolledTextInput as u}from"ink-text-input";import d from"conf";import{parse as f,stringify as p}from"yaml";import m from"node:fs/promises";function h({...e}){return s(r,{borderStyle:`round`,flexDirection:`column`,...e})}const g={border:(...e)=>({borderTop:e.includes(`top`),borderRight:e.includes(`right`),borderBottom:e.includes(`bottom`),borderLeft:e.includes(`left`)})};function _({isLast:e,...t}){return s(r,{...e!==!0&&{borderStyle:`single`,borderDimColor:!0,...g.border(`bottom`)},paddingX:1,flexDirection:`column`,...t})}function v({children:e}){let t=l.Children.toArray(e);return l.Children.map(t,(e,n)=>s(_,{isLast:n===t.length-1,children:e}))}function y({leading:e,children:t,trailing:n,...a}){return c(r,{justifyContent:`space-between`,...a,children:[c(r,{children:[e&&c(o,{children:[e,s(i,{children:` `})]}),t]}),s(r,{children:n})]})}const b=new d({projectName:`quote0`,fileExtension:`yaml`,serialize:p,deserialize:f}),x=new e({apiKey:b.get(`apiKey`,``)});t(n(process.argv)).scriptName(`quote0`).command(`auth`,`Enter and save API key`,e=>e,async e=>{a(s(()=>{let[e,t]=l.useState(!1);return s(h,{children:c(v,{children:[s(y,{children:s(i,{children:`Authentication`})}),e?s(i,{dimColor:!0,children:`API key saved`}):s(u,{initialValue:b.get(`apiKey`,``),onSubmit:e=>{e.length===0?(b.delete(`apiKey`),t(!0)):(b.set(`apiKey`,e),t(!0))},placeholder:`API key…`,mask:`*`})]})})},{}))}).command(`device`,`Manage devices`,e=>e.command(`list`,`List all devices`,e=>e,async e=>{try{let e=await x.device.list();a(s(()=>s(h,{children:c(v,{children:[s(y,{trailing:c(i,{dimColor:!0,children:[e.length,`/`,e.length]}),children:s(i,{children:`Devices`})}),[...e.length===0?[s(y,{children:s(i,{dimColor:!0,children:`No devices found`})})]:e.map(e=>c(r,{flexDirection:`column`,children:[s(y,{trailing:s(i,{children:e.id}),children:s(i,{dimColor:!0,children:`ID`})}),s(y,{trailing:s(i,{children:e.series}),children:s(i,{dimColor:!0,children:`Series`})}),s(y,{trailing:s(i,{children:e.model}),children:s(i,{dimColor:!0,children:`Model`})}),s(y,{trailing:s(i,{children:e.edition}),children:s(i,{dimColor:!0,children:`Edition`})})]}))]]})}),{}))}catch(e){console.error(e)}}).command(`status <device-id>`,`Check device status`,e=>e.positional(`device-id`,{describe:`Device ID to check status for`,type:`string`}),async e=>{try{let t=await x.device.status({deviceId:e.deviceId});a(s(h,{children:c(v,{children:[s(y,{trailing:c(i,{children:[s(i,{dimColor:!0,children:`Device ID: `}),t.deviceId]}),children:c(r,{gap:1,children:[s(i,{children:t.alias}),s(i,{dimColor:!0,children:t.location}),s(i,{dimColor:!0,children:t.status.battery})]})}),s(r,{flexDirection:`column`,children:[...[[`Status`,t.status.current],[`Last Render`,t.renderInfo.last],[`Next Render (Battery)`,t.renderInfo.next.battery],[`Next Render (Power)`,t.renderInfo.next.power],[`Current Images`,t.renderInfo.current.image.length],[`Version`,c(i,{children:[s(i,{dimColor:!0,children:`v`}),t.status.version]})]].map(([e,t])=>s(y,{trailing:s(i,{children:t}),children:s(i,{dimColor:!0,children:e})}))]})]})}))}catch(e){console.error(e)}}),async e=>{}).command(`content`,`Manage content`,e=>e.command(`next <device-id>`,`Switch to next content`,e=>e.positional(`device-id`,{describe:`Device ID to switch content for`,type:`string`}),async e=>{try{let t=await x.content.next({deviceId:e.deviceId});a(s(h,{children:c(v,{children:[s(i,{children:`Next Content`}),s(i,{children:t.message})]})}))}catch(e){console.error(e)}}).command(`image <device-id>`,`Push an image to device`,e=>e.positional(`device-id`,{describe:`Device ID to push image to`,type:`string`}).option(`f`,{alias:`file`,describe:`Path to image file`,type:`string`,demandOption:!0}),async e=>{let t=(await m.readFile(e.f)).toString(`base64`),n=await x.content.pushImage({deviceId:e.deviceId},{image:t});a(s(()=>s(h,{children:c(v,{children:[s(i,{children:`Push Image`}),s(y,{children:s(i,{children:n.message})})]})}),{}))}),async e=>{}).demandCommand(1,`Please specify a command`).strict().parse();export{};
2
+ import{BORDER as e,DITHER_KERNELS as t,DITHER_TYPES as n}from"./api/modules/content.mjs";import r from"./api/index.mjs";import i from"./components/Container.mjs";import{SectionList as a}from"./components/Section.mjs";import o from"./components/ListItem.mjs";import s from"./config.mjs";import c from"yargs";import{hideBin as l}from"yargs/helpers";import{Box as u,Text as d,render as f}from"ink";import{jsx as p,jsxs as m}from"react/jsx-runtime";import h from"react";import{UncontrolledTextInput as g}from"ink-text-input";import _ from"node:fs/promises";const v=new r({apiKey:s.get(`apiKey`,``)});c(l(process.argv)).scriptName(`quote0`).command(`auth`,`Enter and save API key`,e=>e,async e=>{f(p(()=>{let[e,t]=h.useState(!1);return p(i,{children:m(a,{children:[p(o,{children:p(d,{children:`Authentication`})}),e?p(d,{dimColor:!0,children:`API key saved`}):p(g,{initialValue:s.get(`apiKey`,``),onSubmit:e=>{e.length===0?(s.delete(`apiKey`),t(!0)):(s.set(`apiKey`,e),t(!0))},placeholder:`API key…`,mask:`*`})]})})},{}))}).command(`device`,`Manage devices`,e=>e.demandCommand(1).command(`list`,`List all devices`,e=>e,async e=>{try{let e=await v.device.list();f(p(()=>p(i,{children:m(a,{children:[p(o,{trailing:m(d,{dimColor:!0,children:[e.length,`/`,e.length]}),children:p(d,{children:`Devices`})}),[...e.length===0?[p(o,{children:p(d,{dimColor:!0,children:`No devices found`})})]:e.map(e=>m(u,{flexDirection:`column`,children:[p(o,{trailing:p(d,{children:e.id}),children:p(d,{dimColor:!0,children:`ID`})}),p(o,{trailing:p(d,{children:e.series}),children:p(d,{dimColor:!0,children:`Series`})}),p(o,{trailing:p(d,{children:e.model}),children:p(d,{dimColor:!0,children:`Model`})}),p(o,{trailing:p(d,{children:e.edition}),children:p(d,{dimColor:!0,children:`Edition`})})]}))]]})}),{}))}catch(e){console.error(e)}}).command(`status <device-id>`,`Check device status`,e=>e.positional(`device-id`,{describe:`Device ID to check status for`,type:`string`}),async e=>{try{let t=await v.device.status({deviceId:e.deviceId});f(p(i,{children:m(a,{children:[p(o,{trailing:m(d,{children:[p(d,{dimColor:!0,children:`Device ID: `}),t.deviceId]}),children:m(u,{gap:1,children:[p(d,{children:t.alias}),p(d,{dimColor:!0,children:t.location}),p(d,{dimColor:!0,children:t.status.battery})]})}),p(u,{flexDirection:`column`,children:[...[[`Status`,t.status.current],[`Battery`,t.status.battery],[`Wi-Fi`,t.status.wifi],[`Last Render`,t.renderInfo.last],[`Next Render (Battery)`,t.renderInfo.next.battery],[`Next Render (Power)`,t.renderInfo.next.power],[`Current Images`,t.renderInfo.current.image.length],[`Version`,m(d,{children:[p(d,{dimColor:!0,children:`v`}),t.status.version]})]].map(([e,t])=>p(o,{trailing:p(d,{children:t}),children:p(d,{dimColor:!0,children:e})}))]})]})}))}catch(e){console.error(e)}})).command(`content`,`Manage content`,r=>r.demandCommand(1).command(`next <device-id>`,`Switch to next content`,e=>e.positional(`device-id`,{describe:`Device ID to switch content for`,type:`string`}),async e=>{try{let t=await v.content.next({deviceId:e.deviceId});f(p(i,{children:m(a,{children:[p(d,{children:`Next Content`}),p(d,{children:t.message})]})}))}catch(e){console.error(e)}}).command(`image <device-id>`,`Push an image to device`,r=>r.positional(`device-id`,{describe:`Device ID to push image to`,type:`string`}).option(`f`,{alias:`file`,describe:`Path to image file`,type:`string`,demandOption:!0}).option(`refresh-now`,{describe:`Whether to refresh the device immediately`,type:`boolean`}).option(`link`,{describe:`Optional link to open when image is tapped`,type:`string`}).option(`border`,{describe:`Whether to add a border around the image`,type:`number`,choices:e}).option(`dither-type`,{describe:`Dithering algorithm to use`,type:`string`,choices:n}).option(`dither-kernel`,{describe:`Dithering kernel to use (if dither-type is DIFFUSION)`,type:`string`,choices:t}).option(`task-key`,{describe:`Optional task key to track rendering status`,type:`string`}),async e=>{let t=(await _.readFile(e.f)).toString(`base64`),n=await v.content.pushImage({deviceId:e.deviceId},{image:t,refreshNow:e.refreshNow,link:e.link,border:e.border,ditherType:e.ditherType,ditherKernel:e.ditherKernel,taskKey:e.taskKey});f(p(()=>p(i,{children:m(a,{children:[p(d,{children:`Push Image`}),p(o,{children:p(d,{children:n.message})})]})}),{}))})).demandCommand(1,`Please specify a command`).strict().parse();export{};
3
3
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/components/Container.tsx","../src/utils/ink-props-helpers.ts","../src/components/Section.tsx","../src/components/ListItem.tsx","../package.json","../src/config.ts","../src/index.tsx"],"sourcesContent":["import { Box } from 'ink'\nimport type React from 'react'\n\nexport default function Container({\n ...props\n}: React.ComponentProps<typeof Box>) {\n return <Box borderStyle=\"round\" flexDirection=\"column\" {...props} />\n}\n","const inkPropsHelpers = {\n border: (...directions: ('top' | 'right' | 'bottom' | 'left')[]) => {\n return {\n borderTop: directions.includes('top'),\n borderRight: directions.includes('right'),\n borderBottom: directions.includes('bottom'),\n borderLeft: directions.includes('left'),\n }\n },\n}\n\nexport default inkPropsHelpers\n","import { Box } from 'ink'\nimport { inkPropsHelpers } from '../utils'\nimport React from 'react'\n\nfunction Section({\n isLast,\n ...props\n}: React.ComponentProps<typeof Box> & { isLast?: boolean }) {\n return (\n <Box\n {...(isLast !== true && {\n borderStyle: 'single',\n borderDimColor: true,\n ...inkPropsHelpers.border('bottom'),\n })}\n paddingX={1}\n flexDirection=\"column\"\n {...props}\n />\n )\n}\n\nfunction SectionList({ children }: { children: React.ReactNode }) {\n const arrayChildren = React.Children.toArray(children)\n return React.Children.map(arrayChildren, (child, i) => (\n <Section isLast={i === arrayChildren.length - 1}>{child}</Section>\n ))\n}\n\nexport { Section, SectionList }\nexport default Section\n","import { Box, Text } from 'ink'\n\nexport default function ListItem({\n leading,\n children,\n trailing,\n ...props\n}: React.ComponentProps<typeof Box> & {\n leading?: React.ReactNode\n children?: React.ReactNode\n trailing?: React.ReactNode\n}) {\n return (\n <Box justifyContent=\"space-between\" {...props}>\n <Box>\n {leading && (\n <>\n {leading}\n <Text> </Text>\n </>\n )}\n {children}\n </Box>\n <Box>{trailing}</Box>\n </Box>\n )\n}\n","","import Conf from 'conf'\nimport { parse, stringify } from 'yaml'\nimport { name } from '../package.json'\n\nconst config = new Conf({\n projectName: name,\n fileExtension: 'yaml',\n serialize: stringify,\n deserialize: parse,\n})\n\nexport default config\n","#!/usr/bin/env node\n\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { Box, render, Text } from 'ink'\nimport Quote0 from './api'\nimport Container from './components/Container'\nimport { SectionList } from './components/Section'\nimport ListItem from './components/ListItem'\nimport { UncontrolledTextInput } from 'ink-text-input'\nimport config from './config'\nimport React from 'react'\nimport fs from 'node:fs/promises'\n\nconst quote0 = new Quote0({\n apiKey: config.get('apiKey', ''),\n})\n\nyargs(hideBin(process.argv))\n .scriptName('quote0')\n .command(\n 'auth',\n 'Enter and save API key',\n yargs => yargs,\n async argv => {\n const Main = () => {\n const [submitted, setSubmitted] = React.useState(false)\n\n return (\n <Container>\n <SectionList>\n <ListItem>\n <Text>Authentication</Text>\n </ListItem>\n {!submitted ? (\n <UncontrolledTextInput\n initialValue={config.get('apiKey', '')}\n onSubmit={v => {\n if (v.length === 0) {\n config.delete('apiKey')\n setSubmitted(true)\n } else {\n config.set('apiKey', v)\n setSubmitted(true)\n }\n }}\n placeholder=\"API key…\"\n mask=\"*\"\n />\n ) : (\n <Text dimColor>API key saved</Text>\n )}\n </SectionList>\n </Container>\n )\n }\n\n render(<Main />)\n },\n )\n .command(\n 'device',\n 'Manage devices',\n yargs =>\n yargs\n .command(\n 'list',\n 'List all devices',\n yargs => yargs,\n async argv => {\n try {\n const devices = await quote0.device.list()\n\n const Main = () => (\n <Container>\n <SectionList>\n <ListItem\n trailing={\n <Text dimColor>\n {devices.length}/{devices.length}\n </Text>\n }\n >\n <Text>Devices</Text>\n </ListItem>\n {...devices.length === 0\n ? [\n <ListItem>\n <Text dimColor>No devices found</Text>\n </ListItem>,\n ]\n : devices.map(device => (\n <Box flexDirection=\"column\">\n <ListItem trailing={<Text>{device.id}</Text>}>\n <Text dimColor>ID</Text>\n </ListItem>\n <ListItem trailing={<Text>{device.series}</Text>}>\n <Text dimColor>Series</Text>\n </ListItem>\n <ListItem trailing={<Text>{device.model}</Text>}>\n <Text dimColor>Model</Text>\n </ListItem>\n <ListItem trailing={<Text>{device.edition}</Text>}>\n <Text dimColor>Edition</Text>\n </ListItem>\n </Box>\n ))}\n </SectionList>\n </Container>\n )\n\n render(<Main />)\n } catch (error) {\n console.error(error)\n }\n },\n )\n .command(\n 'status <device-id>',\n 'Check device status',\n yargs =>\n yargs.positional('device-id', {\n describe: 'Device ID to check status for',\n type: 'string',\n }),\n async argv => {\n try {\n const response = await quote0.device.status({\n deviceId: argv.deviceId!,\n })\n\n render(\n <Container>\n <SectionList>\n <ListItem\n trailing={\n <Text>\n <Text dimColor>Device ID: </Text>\n {response.deviceId}\n </Text>\n }\n >\n <Box gap={1}>\n <Text>{response.alias}</Text>\n <Text dimColor>{response.location}</Text>\n <Text dimColor>{response.status.battery}</Text>\n </Box>\n </ListItem>\n <Box flexDirection=\"column\">\n {...[\n ['Status', response.status.current],\n ['Last Render', response.renderInfo.last],\n [\n 'Next Render (Battery)',\n response.renderInfo.next.battery,\n ],\n ['Next Render (Power)', response.renderInfo.next.power],\n [\n 'Current Images',\n response.renderInfo.current.image.length,\n ],\n [\n 'Version',\n <Text>\n <Text dimColor>v</Text>\n {response.status.version}\n </Text>,\n ],\n ].map(([k, v]) => (\n <ListItem trailing={<Text>{v}</Text>}>\n <Text dimColor>{k}</Text>\n </ListItem>\n ))}\n </Box>\n </SectionList>\n </Container>,\n )\n } catch (error) {\n console.error(error)\n }\n },\n ),\n async argv => {},\n )\n .command(\n 'content',\n 'Manage content',\n yargs =>\n yargs\n .command(\n 'next <device-id>',\n 'Switch to next content',\n yargs =>\n yargs.positional('device-id', {\n describe: 'Device ID to switch content for',\n type: 'string',\n }),\n async argv => {\n try {\n const response = await quote0.content.next({\n deviceId: argv.deviceId!,\n })\n\n render(\n <Container>\n <SectionList>\n <Text>Next Content</Text>\n <Text>{response.message}</Text>\n </SectionList>\n </Container>,\n )\n } catch (error) {\n console.error(error)\n }\n },\n )\n .command(\n 'image <device-id>',\n 'Push an image to device',\n yargs =>\n yargs\n .positional('device-id', {\n describe: 'Device ID to push image to',\n type: 'string',\n })\n .option('f', {\n alias: 'file',\n describe: 'Path to image file',\n type: 'string',\n demandOption: true,\n }),\n async argv => {\n const file = await fs.readFile(argv.f)\n const base64 = file.toString('base64')\n\n const response = await quote0.content.pushImage(\n { deviceId: argv.deviceId! },\n { image: base64 },\n )\n\n const Main = () => {\n return (\n <Container>\n <SectionList>\n <Text>Push Image</Text>\n <ListItem>\n <Text>{response.message}</Text>\n </ListItem>\n </SectionList>\n </Container>\n )\n }\n\n render(<Main />)\n },\n ),\n async argv => {},\n )\n .demandCommand(1, 'Please specify a command')\n .strict()\n .parse()\n"],"mappings":";wXAGA,SAAwB,EAAU,CAChC,GAAG,GACgC,CACnC,OAAO,EAAC,EAAA,CAAI,YAAY,QAAQ,cAAc,SAAS,GAAI,GAAS,CCNtE,MAAM,EAAkB,CACtB,QAAS,GAAG,KACH,CACL,UAAW,EAAW,SAAS,MAAM,CACrC,YAAa,EAAW,SAAS,QAAQ,CACzC,aAAc,EAAW,SAAS,SAAS,CAC3C,WAAY,EAAW,S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/bin/env node\n\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { Box, render, Text } from 'ink'\nimport Quote0, { BORDER, DITHER_TYPES, DITHER_KERNELS } from './api'\nimport Container from './components/Container'\nimport { SectionList } from './components/Section'\nimport ListItem from './components/ListItem'\nimport { UncontrolledTextInput } from 'ink-text-input'\nimport config from './config'\nimport React from 'react'\nimport fs from 'node:fs/promises'\n\nconst quote0 = new Quote0({\n apiKey: config.get('apiKey', ''),\n})\n\nyargs(hideBin(process.argv))\n .scriptName('quote0')\n .command(\n 'auth',\n 'Enter and save API key',\n yargs => yargs,\n async argv => {\n const Main = () => {\n const [submitted, setSubmitted] = React.useState(false)\n\n return (\n <Container>\n <SectionList>\n <ListItem>\n <Text>Authentication</Text>\n </ListItem>\n {!submitted ? (\n <UncontrolledTextInput\n initialValue={config.get('apiKey', '')}\n onSubmit={v => {\n if (v.length === 0) {\n config.delete('apiKey')\n setSubmitted(true)\n } else {\n config.set('apiKey', v)\n setSubmitted(true)\n }\n }}\n placeholder=\"API key…\"\n mask=\"*\"\n />\n ) : (\n <Text dimColor>API key saved</Text>\n )}\n </SectionList>\n </Container>\n )\n }\n\n render(<Main />)\n },\n )\n .command('device', 'Manage devices', yargs =>\n yargs\n .demandCommand(1)\n .command(\n 'list',\n 'List all devices',\n yargs => yargs,\n async argv => {\n try {\n const devices = await quote0.device.list()\n\n const Main = () => (\n <Container>\n <SectionList>\n <ListItem\n trailing={\n <Text dimColor>\n {devices.length}/{devices.length}\n </Text>\n }\n >\n <Text>Devices</Text>\n </ListItem>\n {...devices.length === 0\n ? [\n <ListItem>\n <Text dimColor>No devices found</Text>\n </ListItem>,\n ]\n : devices.map(device => (\n <Box flexDirection=\"column\">\n <ListItem trailing={<Text>{device.id}</Text>}>\n <Text dimColor>ID</Text>\n </ListItem>\n <ListItem trailing={<Text>{device.series}</Text>}>\n <Text dimColor>Series</Text>\n </ListItem>\n <ListItem trailing={<Text>{device.model}</Text>}>\n <Text dimColor>Model</Text>\n </ListItem>\n <ListItem trailing={<Text>{device.edition}</Text>}>\n <Text dimColor>Edition</Text>\n </ListItem>\n </Box>\n ))}\n </SectionList>\n </Container>\n )\n\n render(<Main />)\n } catch (error) {\n console.error(error)\n }\n },\n )\n .command(\n 'status <device-id>',\n 'Check device status',\n yargs =>\n yargs.positional('device-id', {\n describe: 'Device ID to check status for',\n type: 'string',\n }),\n async argv => {\n try {\n const response = await quote0.device.status({\n deviceId: argv.deviceId!,\n })\n\n render(\n <Container>\n <SectionList>\n <ListItem\n trailing={\n <Text>\n <Text dimColor>Device ID: </Text>\n {response.deviceId}\n </Text>\n }\n >\n <Box gap={1}>\n <Text>{response.alias}</Text>\n <Text dimColor>{response.location}</Text>\n <Text dimColor>{response.status.battery}</Text>\n </Box>\n </ListItem>\n <Box flexDirection=\"column\">\n {...[\n ['Status', response.status.current],\n ['Battery', response.status.battery],\n ['Wi-Fi', response.status.wifi],\n ['Last Render', response.renderInfo.last],\n [\n 'Next Render (Battery)',\n response.renderInfo.next.battery,\n ],\n ['Next Render (Power)', response.renderInfo.next.power],\n [\n 'Current Images',\n response.renderInfo.current.image.length,\n ],\n [\n 'Version',\n <Text>\n <Text dimColor>v</Text>\n {response.status.version}\n </Text>,\n ],\n ].map(([k, v]) => (\n <ListItem trailing={<Text>{v}</Text>}>\n <Text dimColor>{k}</Text>\n </ListItem>\n ))}\n </Box>\n </SectionList>\n </Container>,\n )\n } catch (error) {\n console.error(error)\n }\n },\n ),\n )\n .command('content', 'Manage content', yargs =>\n yargs\n .demandCommand(1)\n .command(\n 'next <device-id>',\n 'Switch to next content',\n yargs =>\n yargs.positional('device-id', {\n describe: 'Device ID to switch content for',\n type: 'string',\n }),\n async argv => {\n try {\n const response = await quote0.content.next({\n deviceId: argv.deviceId!,\n })\n\n render(\n <Container>\n <SectionList>\n <Text>Next Content</Text>\n <Text>{response.message}</Text>\n </SectionList>\n </Container>,\n )\n } catch (error) {\n console.error(error)\n }\n },\n )\n .command(\n 'image <device-id>',\n 'Push an image to device',\n yargs =>\n yargs\n .positional('device-id', {\n describe: 'Device ID to push image to',\n type: 'string',\n })\n .option('f', {\n alias: 'file',\n describe: 'Path to image file',\n type: 'string',\n demandOption: true,\n })\n .option('refresh-now', {\n describe: 'Whether to refresh the device immediately',\n type: 'boolean',\n })\n .option('link', {\n describe: 'Optional link to open when image is tapped',\n type: 'string',\n })\n .option('border', {\n describe: 'Whether to add a border around the image',\n type: 'number',\n choices: BORDER,\n })\n .option('dither-type', {\n describe: 'Dithering algorithm to use',\n type: 'string',\n choices: DITHER_TYPES,\n })\n .option('dither-kernel', {\n describe: 'Dithering kernel to use (if dither-type is DIFFUSION)',\n type: 'string',\n choices: DITHER_KERNELS,\n })\n .option('task-key', {\n describe: 'Optional task key to track rendering status',\n type: 'string',\n }),\n async argv => {\n const file = await fs.readFile(argv.f)\n const base64 = file.toString('base64')\n\n const response = await quote0.content.pushImage(\n { deviceId: argv.deviceId! },\n {\n image: base64,\n refreshNow: argv.refreshNow,\n link: argv.link,\n border: argv.border,\n ditherType: argv.ditherType,\n ditherKernel: argv.ditherKernel,\n taskKey: argv.taskKey,\n },\n )\n\n const Main = () => {\n return (\n <Container>\n <SectionList>\n <Text>Push Image</Text>\n <ListItem>\n <Text>{response.message}</Text>\n </ListItem>\n </SectionList>\n </Container>\n )\n }\n\n render(<Main />)\n },\n ),\n )\n .demandCommand(1, 'Please specify a command')\n .strict()\n .parse()\n"],"mappings":";yiBAcA,MAAM,EAAS,IAAI,EAAO,CACxB,OAAQ,EAAO,IAAI,SAAU,GAAG,CACjC,CAAC,CAEF,EAAM,EAAQ,QAAQ,KAAK,CAAC,CACzB,WAAW,SAAS,CACpB,QACC,OACA,yBACA,GAAS,EACT,KAAM,IAAQ,CAiCZ,EAAO,MAhCY,CACjB,GAAM,CAAC,EAAW,GAAgB,EAAM,SAAS,GAAM,CAEvD,OACE,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAAA,SAAA,CACC,EAAC,EAAA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C,CACN,KAAM,IAAQ,CAEZ,IAAM,GADO,MAAM,EAAG,SAAS,EAAK,EAAE,EAClB,SAAS,SAAS,CAEhC,EAAW,MAAM,EAAO,QAAQ,UACpC,CAAE,SAAU,EAAK,SAAW,CAC5B,CACE,MAAO,EACP,WAAY,EAAK,WACjB,KAAM,EAAK,KACX,OAAQ,EAAK,OACb,WAAY,EAAK,WACjB,aAAc,EAAK,aACnB,QAAS,EAAK,QACf,CACF,CAeD,EAAO,MAXH,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAAA,SAAA,CACC,EAAC,EAAA,CAAA,SAAK,aAAA,CAAiB,CACvB,EAAC,EAAA,CAAA,SACC,EAAC,EAAA,CAAA,SAAM,EAAS,QAAA,CAAe,CAAA,CACtB,CAAA,CAAA,CACC,CAAA,CACJ,CAIR,EAAA,CAAO,CAAC,EAEnB,CACJ,CACA,cAAc,EAAG,2BAA2B,CAC5C,QAAQ,CACR,OAAO"}
@@ -0,0 +1,2 @@
1
+ var e=`quote0`;export{e as name};
2
+ //# sourceMappingURL=package.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.mjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -0,0 +1,2 @@
1
+ const e={border:(...e)=>({borderTop:e.includes(`top`),borderRight:e.includes(`right`),borderBottom:e.includes(`bottom`),borderLeft:e.includes(`left`)})};export{e as default};
2
+ //# sourceMappingURL=ink-props-helpers.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ink-props-helpers.mjs","names":[],"sources":["../../src/utils/ink-props-helpers.ts"],"sourcesContent":["const inkPropsHelpers = {\n border: (...directions: ('top' | 'right' | 'bottom' | 'left')[]) => {\n return {\n borderTop: directions.includes('top'),\n borderRight: directions.includes('right'),\n borderBottom: directions.includes('bottom'),\n borderLeft: directions.includes('left'),\n }\n },\n}\n\nexport default inkPropsHelpers\n"],"mappings":"AAAA,MAAM,EAAkB,CACtB,QAAS,GAAG,KACH,CACL,UAAW,EAAW,SAAS,MAAM,CACrC,YAAa,EAAW,SAAS,QAAQ,CACzC,aAAc,EAAW,SAAS,SAAS,CAC3C,WAAY,EAAW,SAAS,OAAO,CACxC,EAEJ"}
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "quote0",
3
- "version": "1.0.0-alpha.4",
3
+ "version": "1.0.0-alpha.6",
4
4
  "description": "TypeScript SDK and CLI for Quote/0.",
5
5
  "type": "module",
6
- "main": "dist/api/index.mjs",
6
+ "exports": {
7
+ ".": "./dist/api/index.mjs"
8
+ },
7
9
  "files": [
8
10
  "dist"
9
11
  ],
@@ -1 +0,0 @@
1
- {"version":3,"file":"device-CSVHxulH.mjs","names":[],"sources":["../src/api/base.ts","../src/api/modules/content.ts","../src/api/modules/device.ts"],"sourcesContent":["export interface BaseClientArgs {\n apiKey: string\n}\n\nclass BaseClient {\n protected apiKey: string\n constructor({ apiKey }: BaseClientArgs) {\n this.apiKey = apiKey\n }\n\n static readonly API_ENDPOINT = 'https://dot.mindreset.tech/api'\n protected readonly apiEndpoint = BaseClient.API_ENDPOINT\n\n static readonly DISPLAY = { width: 296, height: 152 }\n\n protected composeApiUrl(path: string) {\n return path.startsWith('/')\n ? this.apiEndpoint + path\n : this.apiEndpoint + '/' + path\n }\n\n protected async fetchApi(path: string, options?: RequestInit) {\n const url = this.composeApiUrl(path)\n const mergedOptions = Object.assign(\n {\n method: 'GET',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: 'Bearer ' + this.apiKey,\n },\n },\n options ?? {},\n )\n\n try {\n const response = await fetch(url, mergedOptions)\n\n if (response.ok) {\n return await response.json()\n } else {\n throw new Error(\n `API request failed with status ${response.status}: ${response.statusText}`,\n )\n }\n } catch (error) {\n throw error\n }\n }\n}\n\nexport default BaseClient\n","import BaseClient from '../base'\n\nclass ContentModule extends BaseClient {\n async next({ deviceId }: { deviceId: string }) {\n const response = (await this.fetchApi(\n `/authV2/open/device/${deviceId}/next`,\n {\n method: 'POST',\n },\n )) as { code: number; message: string }\n\n return response\n }\n\n async pushImage(\n { deviceId }: { deviceId: string },\n options: {\n refreshNow?: boolean\n image: string\n link?: string\n border?: 0 | 1\n ditherType?: 'DIFFUSION' | 'ORDERED' | 'NONE'\n ditherKernel?:\n | 'THRESHOLD'\n | 'ATKINSON'\n | 'BURKES'\n | 'FLOYD_STEINBERG'\n | 'SIERRA2'\n | 'STUCKI'\n | 'JARVIS_JUDICE_NINKE'\n | 'DIFFUSION_ROW'\n | 'DIFFUSION_COLUMN'\n | 'DIFFUSION_2D'\n taskKey?: string\n },\n ) {\n const response = (await this.fetchApi(\n `/authV2/open/device/${deviceId}/image`,\n { method: 'POST', body: JSON.stringify(options) },\n )) as { code: number; message: string }\n\n return response\n }\n}\n\nexport default ContentModule\n","import BaseClient from '../base'\n\nclass DeviceModule extends BaseClient {\n async list() {\n const response = (await this.fetchApi(`/authV2/open/devices`)) as {\n id: string\n series: string\n model: string\n edition: 1 | 2\n }[]\n\n return response\n }\n\n async status({ deviceId }: { deviceId: string }) {\n const response = (await this.fetchApi(\n `/authV2/open/device/${deviceId}/status`,\n )) as {\n deviceId: string\n alias: string | null\n location: string | null\n status: {\n version: string\n current: string\n description: string\n battery: string\n wifi: string\n }\n renderInfo: {\n last: string\n current: {\n rotated: boolean\n border: number\n image: string[]\n }\n next: {\n battery: string\n power: string\n }\n }\n }\n\n return response\n }\n}\n\nexport default DeviceModule\n"],"mappings":"AAIA,IAAM,EAAN,MAAM,CAAW,CACf,OACA,YAAY,CAAE,UAA0B,CACtC,KAAK,OAAS,EAGhB,OAAgB,aAAe,iCAC/B,YAAiC,EAAW,aAE5C,OAAgB,QAAU,CAAE,MAAO,IAAK,OAAQ,IAAK,CAErD,cAAwB,EAAc,CACpC,OAAO,EAAK,WAAW,IAAI,CACvB,KAAK,YAAc,EACnB,KAAK,YAAc,IAAM,EAG/B,MAAgB,SAAS,EAAc,EAAuB,CAC5D,IAAM,EAAM,KAAK,cAAc,EAAK,CAC9B,EAAgB,OAAO,OAC3B,CACE,OAAQ,MACR,QAAS,CACP,eAAgB,mBAChB,cAAe,UAAY,KAAK,OACjC,CACF,CACD,GAAW,EAAE,CACd,CAED,GAAI,CACF,IAAM,EAAW,MAAM,MAAM,EAAK,EAAc,CAEhD,GAAI,EAAS,GACX,OAAO,MAAM,EAAS,MAAM,CAE5B,MAAU,MACR,kCAAkC,EAAS,OAAO,IAAI,EAAS,aAChE,OAEI,EAAO,CACd,MAAM,KC3CN,EAAN,cAA4B,CAAW,CACrC,MAAM,KAAK,CAAE,YAAkC,CAQ7C,OAPkB,MAAM,KAAK,SAC3B,uBAAuB,EAAS,OAChC,CACE,OAAQ,OACT,CACF,CAKH,MAAM,UACJ,CAAE,YACF,EAmBA,CAMA,OALkB,MAAM,KAAK,SAC3B,uBAAuB,EAAS,QAChC,CAAE,OAAQ,OAAQ,KAAM,KAAK,UAAU,EAAQ,CAAE,CAClD,GCrCC,EAAN,cAA2B,CAAW,CACpC,MAAM,MAAO,CAQX,OAPkB,MAAM,KAAK,SAAS,uBAAuB,CAU/D,MAAM,OAAO,CAAE,YAAkC,CA4B/C,OA3BkB,MAAM,KAAK,SAC3B,uBAAuB,EAAS,SACjC"}