@sebbo2002/vestaboard 4.0.2-develop.9 → 5.0.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/README.md +20 -21
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -119
- package/dist/index.d.ts +119 -119
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/package.json +68 -64
package/dist/index.d.cts
CHANGED
|
@@ -1,27 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* You can build a message like this:
|
|
3
|
+
*
|
|
4
|
+
* ```javascript
|
|
5
|
+
* import { Message } from '@sebbo2002/vestaboard';
|
|
6
|
+
*
|
|
7
|
+
* const myMessage = new Message('Hello World');
|
|
8
|
+
*
|
|
9
|
+
* // same as
|
|
10
|
+
*
|
|
11
|
+
* const myOtherMessage = new Message()
|
|
12
|
+
* .write('Hello World')
|
|
13
|
+
* .center();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare class Message {
|
|
17
|
+
private static readonly splitter;
|
|
18
|
+
get isEmpty(): boolean;
|
|
19
|
+
private readonly board;
|
|
20
|
+
private cursor;
|
|
21
|
+
constructor(message?: BoardCharArray | string);
|
|
22
|
+
static char2char(char: string): number[];
|
|
23
|
+
static charToString(char: number): string;
|
|
24
|
+
static getColumnSizesFromData(rows: Array<string[]>, options?: MessageWriteOptions): number[];
|
|
25
|
+
static removeEmojisFromChars(chars: number[]): number[];
|
|
26
|
+
static splitCharsIntoLines(chars: number[], lineLength: [number, number]): Array<number[]>;
|
|
27
|
+
static string2chars(word: string, options?: MessageWriteOptions): number[];
|
|
28
|
+
/**
|
|
29
|
+
* Center the current message content
|
|
30
|
+
*/
|
|
31
|
+
center(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Fills the board with the passed character or text. The text
|
|
34
|
+
* is repeated again and again until the board is completely filled.
|
|
35
|
+
*/
|
|
36
|
+
fill(text?: string): this;
|
|
37
|
+
/**
|
|
38
|
+
* Generate a table with the given data
|
|
39
|
+
*
|
|
40
|
+
* @example new Message().table([
|
|
41
|
+
* ['now', 'Daily'],
|
|
42
|
+
* ['13:00', 'Super Secret Meeting'],
|
|
43
|
+
* ['16:30', 'Awesome Presentation']
|
|
44
|
+
* ])
|
|
45
|
+
*
|
|
46
|
+
* #==============================================#
|
|
47
|
+
* # N O W D A I L Y #
|
|
48
|
+
* # #
|
|
49
|
+
* # 1 3 : 0 0 S U P E R S E C R E T #
|
|
50
|
+
* # M E E T I N G #
|
|
51
|
+
* # #
|
|
52
|
+
* # 1 6 : 3 0 A W E S O M E P R E S E N T - #
|
|
53
|
+
* #==============================================#
|
|
54
|
+
*/
|
|
55
|
+
table(rows: Array<string[]>): this;
|
|
56
|
+
toCharArray(): BoardCharArray;
|
|
57
|
+
toString(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Write a text on your new message. If your message is not empty it will continue
|
|
60
|
+
* where you last left off (`position: MessageWritePosition.CURRENT`). Alternatively
|
|
61
|
+
* you can continue on the next line or give an exact position.
|
|
62
|
+
*
|
|
63
|
+
* @param text
|
|
64
|
+
* @param options
|
|
65
|
+
*/
|
|
66
|
+
write(text: string, options?: MessageWriteOptions): this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare class ReadWriteAPI {
|
|
70
|
+
private readonly key;
|
|
71
|
+
private readonly options;
|
|
72
|
+
constructor(key: string, options?: RequestOptions);
|
|
73
|
+
getCurrentMessage(): Promise<Message>;
|
|
74
|
+
postMessage(message: Message | string): Promise<void>;
|
|
75
|
+
private request;
|
|
76
|
+
}
|
|
77
|
+
|
|
1
78
|
declare class SubscriptionAPI {
|
|
2
79
|
private readonly key;
|
|
3
|
-
private readonly secret;
|
|
4
80
|
private readonly options;
|
|
81
|
+
private readonly secret;
|
|
5
82
|
constructor(key: string, secret: string, options?: RequestOptions);
|
|
6
|
-
private request;
|
|
7
|
-
getViewer(): Promise<Viewer>;
|
|
8
83
|
getSubscriptions(): Promise<Subscriptions>;
|
|
84
|
+
getViewer(): Promise<Viewer>;
|
|
9
85
|
postMessage(message: Message | string): Promise<SubscriptionPostResponse[]>;
|
|
10
86
|
postMessage(message: Message | string, subscriptionId: string): Promise<SubscriptionPostResponse>;
|
|
11
87
|
postMessage(message: Message | string, subscriptionIds: string[]): Promise<SubscriptionPostResponse[]>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare class ReadWriteAPI {
|
|
15
|
-
private readonly key;
|
|
16
|
-
private readonly options;
|
|
17
|
-
constructor(key: string, options?: RequestOptions);
|
|
18
88
|
private request;
|
|
19
|
-
getCurrentMessage(): Promise<Message>;
|
|
20
|
-
postMessage(message: Message | string): Promise<void>;
|
|
21
89
|
}
|
|
22
90
|
|
|
23
91
|
declare const BOARD_LINE_LENGTH = 22;
|
|
24
92
|
declare const BOARD_LINES = 6;
|
|
93
|
+
declare enum MessageWritePosition {
|
|
94
|
+
CURRENT = 0,
|
|
95
|
+
NO_SPACE_BETWEEN = 1,
|
|
96
|
+
NEXT_LINE = 2
|
|
97
|
+
}
|
|
98
|
+
type BoardCharArray = [
|
|
99
|
+
BoardCharLine,
|
|
100
|
+
BoardCharLine,
|
|
101
|
+
BoardCharLine,
|
|
102
|
+
BoardCharLine,
|
|
103
|
+
BoardCharLine,
|
|
104
|
+
BoardCharLine
|
|
105
|
+
];
|
|
25
106
|
type BoardCharLine = [
|
|
26
107
|
number,
|
|
27
108
|
number,
|
|
@@ -46,28 +127,22 @@ type BoardCharLine = [
|
|
|
46
127
|
number,
|
|
47
128
|
number
|
|
48
129
|
];
|
|
49
|
-
type
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
];
|
|
130
|
+
type Boards = Array<LocalAPI | ReadWriteAPI | SubscriptionAPI>;
|
|
131
|
+
interface Installation {
|
|
132
|
+
_id: string;
|
|
133
|
+
installable?: {
|
|
134
|
+
_id: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
57
137
|
interface MessageWriteCoords {
|
|
58
138
|
line: number;
|
|
59
139
|
row?: number;
|
|
60
140
|
width?: number;
|
|
61
141
|
}
|
|
62
|
-
declare enum MessageWritePosition {
|
|
63
|
-
CURRENT = 0,
|
|
64
|
-
NO_SPACE_BETWEEN = 1,
|
|
65
|
-
NEXT_LINE = 2
|
|
66
|
-
}
|
|
67
142
|
interface MessageWriteOptions {
|
|
68
|
-
|
|
143
|
+
fallbackChar?: null | number;
|
|
69
144
|
indent?: boolean | number;
|
|
70
|
-
|
|
145
|
+
position?: MessageWriteCoords | MessageWritePosition;
|
|
71
146
|
removeUnsupportedWords?: boolean;
|
|
72
147
|
}
|
|
73
148
|
interface RequestFetchOptions {
|
|
@@ -76,132 +151,57 @@ interface RequestFetchOptions {
|
|
|
76
151
|
method?: string;
|
|
77
152
|
}
|
|
78
153
|
interface RequestFetchResponse {
|
|
154
|
+
json(): Promise<unknown>;
|
|
79
155
|
readonly ok: boolean;
|
|
80
156
|
readonly status: number;
|
|
81
157
|
readonly statusText: string;
|
|
82
|
-
json(): Promise<unknown>;
|
|
83
158
|
}
|
|
84
|
-
type RequestOptionsFetch = (url: string, init?: RequestFetchOptions) => Promise<RequestFetchResponse>;
|
|
85
159
|
interface RequestOptions {
|
|
86
160
|
fetch?: RequestOptionsFetch;
|
|
87
161
|
parseResponse?: boolean;
|
|
88
162
|
}
|
|
89
|
-
|
|
90
|
-
_id: string;
|
|
91
|
-
installable?: {
|
|
92
|
-
_id: string;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
interface Viewer {
|
|
96
|
-
type: string;
|
|
97
|
-
_id: string;
|
|
98
|
-
_created: string;
|
|
99
|
-
installation: {
|
|
100
|
-
_id: string;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
163
|
+
type RequestOptionsFetch = (url: string, init?: RequestFetchOptions) => Promise<RequestFetchResponse>;
|
|
103
164
|
interface Subscription {
|
|
104
|
-
_id: string;
|
|
105
165
|
_created: string;
|
|
106
|
-
|
|
166
|
+
_id: string;
|
|
107
167
|
boards: Array<{
|
|
108
168
|
_id: string;
|
|
109
169
|
}>;
|
|
110
|
-
|
|
111
|
-
interface Subscriptions {
|
|
112
|
-
subscriptions: Subscription[];
|
|
170
|
+
installation: Installation;
|
|
113
171
|
}
|
|
114
172
|
interface SubscriptionPostResponse {
|
|
115
173
|
message: {
|
|
116
|
-
id: string;
|
|
117
174
|
created: number;
|
|
175
|
+
id: string;
|
|
118
176
|
};
|
|
119
177
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* // same as
|
|
131
|
-
*
|
|
132
|
-
* const myOtherMessage = new Message()
|
|
133
|
-
* .write('Hello World')
|
|
134
|
-
* .center();
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
declare class Message {
|
|
138
|
-
private static readonly splitter;
|
|
139
|
-
private readonly board;
|
|
140
|
-
private cursor;
|
|
141
|
-
constructor(message?: BoardCharArray | string);
|
|
142
|
-
static string2chars(word: string, options?: MessageWriteOptions): number[];
|
|
143
|
-
static char2char(char: string): number[];
|
|
144
|
-
static charToString(char: number): string;
|
|
145
|
-
static splitCharsIntoLines(chars: number[], lineLength: [number, number]): Array<number[]>;
|
|
146
|
-
static removeEmojisFromChars(chars: number[]): number[];
|
|
147
|
-
static getColumnSizesFromData(rows: Array<string[]>, options?: MessageWriteOptions): number[];
|
|
148
|
-
get isEmpty(): boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Fills the board with the passed character or text. The text
|
|
151
|
-
* is repeated again and again until the board is completely filled.
|
|
152
|
-
*/
|
|
153
|
-
fill(text?: string): this;
|
|
154
|
-
/**
|
|
155
|
-
* Write a text on your new message. If your message is not empty it will continue
|
|
156
|
-
* where you last left off (`position: MessageWritePosition.CURRENT`). Alternatively
|
|
157
|
-
* you can continue on the next line or give an exact position.
|
|
158
|
-
*
|
|
159
|
-
* @param text
|
|
160
|
-
* @param options
|
|
161
|
-
*/
|
|
162
|
-
write(text: string, options?: MessageWriteOptions): this;
|
|
163
|
-
/**
|
|
164
|
-
* Generate a table with the given data
|
|
165
|
-
*
|
|
166
|
-
* @example new Message().table([
|
|
167
|
-
* ['now', 'Daily'],
|
|
168
|
-
* ['13:00', 'Super Secret Meeting'],
|
|
169
|
-
* ['16:30', 'Awesome Presentation']
|
|
170
|
-
* ])
|
|
171
|
-
*
|
|
172
|
-
* #==============================================#
|
|
173
|
-
* # N O W D A I L Y #
|
|
174
|
-
* # #
|
|
175
|
-
* # 1 3 : 0 0 S U P E R S E C R E T #
|
|
176
|
-
* # M E E T I N G #
|
|
177
|
-
* # #
|
|
178
|
-
* # 1 6 : 3 0 A W E S O M E P R E S E N T - #
|
|
179
|
-
* #==============================================#
|
|
180
|
-
*/
|
|
181
|
-
table(rows: Array<string[]>): this;
|
|
182
|
-
/**
|
|
183
|
-
* Center the current message content
|
|
184
|
-
*/
|
|
185
|
-
center(): void;
|
|
186
|
-
toString(): string;
|
|
187
|
-
toCharArray(): BoardCharArray;
|
|
178
|
+
interface Subscriptions {
|
|
179
|
+
subscriptions: Subscription[];
|
|
180
|
+
}
|
|
181
|
+
interface Viewer {
|
|
182
|
+
_created: string;
|
|
183
|
+
_id: string;
|
|
184
|
+
installation: {
|
|
185
|
+
_id: string;
|
|
186
|
+
};
|
|
187
|
+
type: string;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
declare class LocalAPI {
|
|
191
|
-
private readonly key;
|
|
192
191
|
private readonly host;
|
|
192
|
+
private readonly key;
|
|
193
193
|
private readonly options;
|
|
194
194
|
constructor(key: string, host?: string, options?: RequestOptions);
|
|
195
|
-
private request;
|
|
196
195
|
getCurrentMessage(): Promise<Message>;
|
|
197
196
|
postMessage(message: Message | string): Promise<void>;
|
|
197
|
+
private request;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
declare class MultipleBoards {
|
|
201
201
|
private readonly boards;
|
|
202
202
|
constructor(boards?: Boards);
|
|
203
|
-
push(...boards: Boards): void;
|
|
204
203
|
postMessage(message: Message | string): Promise<void>;
|
|
204
|
+
push(...boards: Boards): void;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
export { BOARD_LINES, BOARD_LINE_LENGTH, type BoardCharArray, type BoardCharLine, type Boards, type Installation, LocalAPI, Message, type MessageWriteCoords, type MessageWriteOptions, MessageWritePosition, MultipleBoards, ReadWriteAPI, type RequestOptions, type Subscription, SubscriptionAPI, type SubscriptionPostResponse, type Subscriptions, type Viewer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,27 +1,108 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* You can build a message like this:
|
|
3
|
+
*
|
|
4
|
+
* ```javascript
|
|
5
|
+
* import { Message } from '@sebbo2002/vestaboard';
|
|
6
|
+
*
|
|
7
|
+
* const myMessage = new Message('Hello World');
|
|
8
|
+
*
|
|
9
|
+
* // same as
|
|
10
|
+
*
|
|
11
|
+
* const myOtherMessage = new Message()
|
|
12
|
+
* .write('Hello World')
|
|
13
|
+
* .center();
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
declare class Message {
|
|
17
|
+
private static readonly splitter;
|
|
18
|
+
get isEmpty(): boolean;
|
|
19
|
+
private readonly board;
|
|
20
|
+
private cursor;
|
|
21
|
+
constructor(message?: BoardCharArray | string);
|
|
22
|
+
static char2char(char: string): number[];
|
|
23
|
+
static charToString(char: number): string;
|
|
24
|
+
static getColumnSizesFromData(rows: Array<string[]>, options?: MessageWriteOptions): number[];
|
|
25
|
+
static removeEmojisFromChars(chars: number[]): number[];
|
|
26
|
+
static splitCharsIntoLines(chars: number[], lineLength: [number, number]): Array<number[]>;
|
|
27
|
+
static string2chars(word: string, options?: MessageWriteOptions): number[];
|
|
28
|
+
/**
|
|
29
|
+
* Center the current message content
|
|
30
|
+
*/
|
|
31
|
+
center(): void;
|
|
32
|
+
/**
|
|
33
|
+
* Fills the board with the passed character or text. The text
|
|
34
|
+
* is repeated again and again until the board is completely filled.
|
|
35
|
+
*/
|
|
36
|
+
fill(text?: string): this;
|
|
37
|
+
/**
|
|
38
|
+
* Generate a table with the given data
|
|
39
|
+
*
|
|
40
|
+
* @example new Message().table([
|
|
41
|
+
* ['now', 'Daily'],
|
|
42
|
+
* ['13:00', 'Super Secret Meeting'],
|
|
43
|
+
* ['16:30', 'Awesome Presentation']
|
|
44
|
+
* ])
|
|
45
|
+
*
|
|
46
|
+
* #==============================================#
|
|
47
|
+
* # N O W D A I L Y #
|
|
48
|
+
* # #
|
|
49
|
+
* # 1 3 : 0 0 S U P E R S E C R E T #
|
|
50
|
+
* # M E E T I N G #
|
|
51
|
+
* # #
|
|
52
|
+
* # 1 6 : 3 0 A W E S O M E P R E S E N T - #
|
|
53
|
+
* #==============================================#
|
|
54
|
+
*/
|
|
55
|
+
table(rows: Array<string[]>): this;
|
|
56
|
+
toCharArray(): BoardCharArray;
|
|
57
|
+
toString(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Write a text on your new message. If your message is not empty it will continue
|
|
60
|
+
* where you last left off (`position: MessageWritePosition.CURRENT`). Alternatively
|
|
61
|
+
* you can continue on the next line or give an exact position.
|
|
62
|
+
*
|
|
63
|
+
* @param text
|
|
64
|
+
* @param options
|
|
65
|
+
*/
|
|
66
|
+
write(text: string, options?: MessageWriteOptions): this;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
declare class ReadWriteAPI {
|
|
70
|
+
private readonly key;
|
|
71
|
+
private readonly options;
|
|
72
|
+
constructor(key: string, options?: RequestOptions);
|
|
73
|
+
getCurrentMessage(): Promise<Message>;
|
|
74
|
+
postMessage(message: Message | string): Promise<void>;
|
|
75
|
+
private request;
|
|
76
|
+
}
|
|
77
|
+
|
|
1
78
|
declare class SubscriptionAPI {
|
|
2
79
|
private readonly key;
|
|
3
|
-
private readonly secret;
|
|
4
80
|
private readonly options;
|
|
81
|
+
private readonly secret;
|
|
5
82
|
constructor(key: string, secret: string, options?: RequestOptions);
|
|
6
|
-
private request;
|
|
7
|
-
getViewer(): Promise<Viewer>;
|
|
8
83
|
getSubscriptions(): Promise<Subscriptions>;
|
|
84
|
+
getViewer(): Promise<Viewer>;
|
|
9
85
|
postMessage(message: Message | string): Promise<SubscriptionPostResponse[]>;
|
|
10
86
|
postMessage(message: Message | string, subscriptionId: string): Promise<SubscriptionPostResponse>;
|
|
11
87
|
postMessage(message: Message | string, subscriptionIds: string[]): Promise<SubscriptionPostResponse[]>;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare class ReadWriteAPI {
|
|
15
|
-
private readonly key;
|
|
16
|
-
private readonly options;
|
|
17
|
-
constructor(key: string, options?: RequestOptions);
|
|
18
88
|
private request;
|
|
19
|
-
getCurrentMessage(): Promise<Message>;
|
|
20
|
-
postMessage(message: Message | string): Promise<void>;
|
|
21
89
|
}
|
|
22
90
|
|
|
23
91
|
declare const BOARD_LINE_LENGTH = 22;
|
|
24
92
|
declare const BOARD_LINES = 6;
|
|
93
|
+
declare enum MessageWritePosition {
|
|
94
|
+
CURRENT = 0,
|
|
95
|
+
NO_SPACE_BETWEEN = 1,
|
|
96
|
+
NEXT_LINE = 2
|
|
97
|
+
}
|
|
98
|
+
type BoardCharArray = [
|
|
99
|
+
BoardCharLine,
|
|
100
|
+
BoardCharLine,
|
|
101
|
+
BoardCharLine,
|
|
102
|
+
BoardCharLine,
|
|
103
|
+
BoardCharLine,
|
|
104
|
+
BoardCharLine
|
|
105
|
+
];
|
|
25
106
|
type BoardCharLine = [
|
|
26
107
|
number,
|
|
27
108
|
number,
|
|
@@ -46,28 +127,22 @@ type BoardCharLine = [
|
|
|
46
127
|
number,
|
|
47
128
|
number
|
|
48
129
|
];
|
|
49
|
-
type
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
];
|
|
130
|
+
type Boards = Array<LocalAPI | ReadWriteAPI | SubscriptionAPI>;
|
|
131
|
+
interface Installation {
|
|
132
|
+
_id: string;
|
|
133
|
+
installable?: {
|
|
134
|
+
_id: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
57
137
|
interface MessageWriteCoords {
|
|
58
138
|
line: number;
|
|
59
139
|
row?: number;
|
|
60
140
|
width?: number;
|
|
61
141
|
}
|
|
62
|
-
declare enum MessageWritePosition {
|
|
63
|
-
CURRENT = 0,
|
|
64
|
-
NO_SPACE_BETWEEN = 1,
|
|
65
|
-
NEXT_LINE = 2
|
|
66
|
-
}
|
|
67
142
|
interface MessageWriteOptions {
|
|
68
|
-
|
|
143
|
+
fallbackChar?: null | number;
|
|
69
144
|
indent?: boolean | number;
|
|
70
|
-
|
|
145
|
+
position?: MessageWriteCoords | MessageWritePosition;
|
|
71
146
|
removeUnsupportedWords?: boolean;
|
|
72
147
|
}
|
|
73
148
|
interface RequestFetchOptions {
|
|
@@ -76,132 +151,57 @@ interface RequestFetchOptions {
|
|
|
76
151
|
method?: string;
|
|
77
152
|
}
|
|
78
153
|
interface RequestFetchResponse {
|
|
154
|
+
json(): Promise<unknown>;
|
|
79
155
|
readonly ok: boolean;
|
|
80
156
|
readonly status: number;
|
|
81
157
|
readonly statusText: string;
|
|
82
|
-
json(): Promise<unknown>;
|
|
83
158
|
}
|
|
84
|
-
type RequestOptionsFetch = (url: string, init?: RequestFetchOptions) => Promise<RequestFetchResponse>;
|
|
85
159
|
interface RequestOptions {
|
|
86
160
|
fetch?: RequestOptionsFetch;
|
|
87
161
|
parseResponse?: boolean;
|
|
88
162
|
}
|
|
89
|
-
|
|
90
|
-
_id: string;
|
|
91
|
-
installable?: {
|
|
92
|
-
_id: string;
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
interface Viewer {
|
|
96
|
-
type: string;
|
|
97
|
-
_id: string;
|
|
98
|
-
_created: string;
|
|
99
|
-
installation: {
|
|
100
|
-
_id: string;
|
|
101
|
-
};
|
|
102
|
-
}
|
|
163
|
+
type RequestOptionsFetch = (url: string, init?: RequestFetchOptions) => Promise<RequestFetchResponse>;
|
|
103
164
|
interface Subscription {
|
|
104
|
-
_id: string;
|
|
105
165
|
_created: string;
|
|
106
|
-
|
|
166
|
+
_id: string;
|
|
107
167
|
boards: Array<{
|
|
108
168
|
_id: string;
|
|
109
169
|
}>;
|
|
110
|
-
|
|
111
|
-
interface Subscriptions {
|
|
112
|
-
subscriptions: Subscription[];
|
|
170
|
+
installation: Installation;
|
|
113
171
|
}
|
|
114
172
|
interface SubscriptionPostResponse {
|
|
115
173
|
message: {
|
|
116
|
-
id: string;
|
|
117
174
|
created: number;
|
|
175
|
+
id: string;
|
|
118
176
|
};
|
|
119
177
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* // same as
|
|
131
|
-
*
|
|
132
|
-
* const myOtherMessage = new Message()
|
|
133
|
-
* .write('Hello World')
|
|
134
|
-
* .center();
|
|
135
|
-
* ```
|
|
136
|
-
*/
|
|
137
|
-
declare class Message {
|
|
138
|
-
private static readonly splitter;
|
|
139
|
-
private readonly board;
|
|
140
|
-
private cursor;
|
|
141
|
-
constructor(message?: BoardCharArray | string);
|
|
142
|
-
static string2chars(word: string, options?: MessageWriteOptions): number[];
|
|
143
|
-
static char2char(char: string): number[];
|
|
144
|
-
static charToString(char: number): string;
|
|
145
|
-
static splitCharsIntoLines(chars: number[], lineLength: [number, number]): Array<number[]>;
|
|
146
|
-
static removeEmojisFromChars(chars: number[]): number[];
|
|
147
|
-
static getColumnSizesFromData(rows: Array<string[]>, options?: MessageWriteOptions): number[];
|
|
148
|
-
get isEmpty(): boolean;
|
|
149
|
-
/**
|
|
150
|
-
* Fills the board with the passed character or text. The text
|
|
151
|
-
* is repeated again and again until the board is completely filled.
|
|
152
|
-
*/
|
|
153
|
-
fill(text?: string): this;
|
|
154
|
-
/**
|
|
155
|
-
* Write a text on your new message. If your message is not empty it will continue
|
|
156
|
-
* where you last left off (`position: MessageWritePosition.CURRENT`). Alternatively
|
|
157
|
-
* you can continue on the next line or give an exact position.
|
|
158
|
-
*
|
|
159
|
-
* @param text
|
|
160
|
-
* @param options
|
|
161
|
-
*/
|
|
162
|
-
write(text: string, options?: MessageWriteOptions): this;
|
|
163
|
-
/**
|
|
164
|
-
* Generate a table with the given data
|
|
165
|
-
*
|
|
166
|
-
* @example new Message().table([
|
|
167
|
-
* ['now', 'Daily'],
|
|
168
|
-
* ['13:00', 'Super Secret Meeting'],
|
|
169
|
-
* ['16:30', 'Awesome Presentation']
|
|
170
|
-
* ])
|
|
171
|
-
*
|
|
172
|
-
* #==============================================#
|
|
173
|
-
* # N O W D A I L Y #
|
|
174
|
-
* # #
|
|
175
|
-
* # 1 3 : 0 0 S U P E R S E C R E T #
|
|
176
|
-
* # M E E T I N G #
|
|
177
|
-
* # #
|
|
178
|
-
* # 1 6 : 3 0 A W E S O M E P R E S E N T - #
|
|
179
|
-
* #==============================================#
|
|
180
|
-
*/
|
|
181
|
-
table(rows: Array<string[]>): this;
|
|
182
|
-
/**
|
|
183
|
-
* Center the current message content
|
|
184
|
-
*/
|
|
185
|
-
center(): void;
|
|
186
|
-
toString(): string;
|
|
187
|
-
toCharArray(): BoardCharArray;
|
|
178
|
+
interface Subscriptions {
|
|
179
|
+
subscriptions: Subscription[];
|
|
180
|
+
}
|
|
181
|
+
interface Viewer {
|
|
182
|
+
_created: string;
|
|
183
|
+
_id: string;
|
|
184
|
+
installation: {
|
|
185
|
+
_id: string;
|
|
186
|
+
};
|
|
187
|
+
type: string;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
declare class LocalAPI {
|
|
191
|
-
private readonly key;
|
|
192
191
|
private readonly host;
|
|
192
|
+
private readonly key;
|
|
193
193
|
private readonly options;
|
|
194
194
|
constructor(key: string, host?: string, options?: RequestOptions);
|
|
195
|
-
private request;
|
|
196
195
|
getCurrentMessage(): Promise<Message>;
|
|
197
196
|
postMessage(message: Message | string): Promise<void>;
|
|
197
|
+
private request;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
declare class MultipleBoards {
|
|
201
201
|
private readonly boards;
|
|
202
202
|
constructor(boards?: Boards);
|
|
203
|
-
push(...boards: Boards): void;
|
|
204
203
|
postMessage(message: Message | string): Promise<void>;
|
|
204
|
+
push(...boards: Boards): void;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
207
|
export { BOARD_LINES, BOARD_LINE_LENGTH, type BoardCharArray, type BoardCharLine, type Boards, type Installation, LocalAPI, Message, type MessageWriteCoords, type MessageWriteOptions, MessageWritePosition, MultipleBoards, ReadWriteAPI, type RequestOptions, type Subscription, SubscriptionAPI, type SubscriptionPostResponse, type Subscriptions, type Viewer };
|