@vtecx/vtecxnext 1.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 ADDED
@@ -0,0 +1,2 @@
1
+ # vtecxnext
2
+ vte.cx Next.js api
@@ -0,0 +1 @@
1
+ export * from './vtecxnext';
package/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./vtecxnext"), exports);
@@ -0,0 +1,470 @@
1
+ import { IncomingMessage, ServerResponse } from 'http';
2
+ /**
3
+ * Hello world.
4
+ */
5
+ export declare const hello: () => void;
6
+ /**
7
+ * X-Requested-With header check.
8
+ * If not specified, set status 417 to the response.
9
+ * @param req request
10
+ * @param res response
11
+ * @return false if no X-Requested-With header is specified
12
+ */
13
+ export declare const checkXRequestedWith: (req: IncomingMessage, res: ServerResponse) => boolean;
14
+ /**
15
+ * Sends an feed response(including message) to the client using the specified status.
16
+ * @param res response
17
+ * @param statusCode status code
18
+ * @param message message
19
+ * @return true
20
+ */
21
+ export declare const sendMessage: (res: ServerResponse, statusCode: number, message: string) => boolean;
22
+ /**
23
+ * login.
24
+ * Request authentication with WSSE.
25
+ * If the login is successful, sets the authentication information in a cookie.
26
+ * @param req request
27
+ * @param res response
28
+ * @param wsse WSSE
29
+ * @param reCaptchaToken reCAPTCHA token
30
+ * @return true if log in has been successful.
31
+ */
32
+ export declare const login: (req: IncomingMessage, res: ServerResponse, wsse: string, reCaptchaToken?: string) => Promise<boolean>;
33
+ /**
34
+ * logout.
35
+ * If the logout is successful, delete the authentication information in a cookie.
36
+ * @param req request
37
+ * @param res response
38
+ * @return true if log out has been successful.
39
+ */
40
+ export declare const logout: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
41
+ /**
42
+ * get login uid
43
+ * @param req request
44
+ * @param res response
45
+ * @return uid
46
+ */
47
+ export declare const uid: (req: IncomingMessage, res: ServerResponse) => Promise<string>;
48
+ /**
49
+ * get login whoami
50
+ * @param req request (for authentication)
51
+ * @param res response (for authentication)
52
+ * @return login user information
53
+ */
54
+ export declare const whoami: (req: IncomingMessage, res: ServerResponse) => Promise<any>;
55
+ /**
56
+ * whether you are logged in
57
+ * @param req request (for authentication)
58
+ * @param res response (for authentication)
59
+ * @return true if logged in
60
+ */
61
+ export declare const isLoggedin: (req: IncomingMessage, res: ServerResponse) => Promise<boolean>;
62
+ /**
63
+ * register a log entry
64
+ * @param req request (for authentication)
65
+ * @param res response (for authentication)
66
+ * @param message message
67
+ * @param title title
68
+ * @param subtitle subtitle
69
+ * @return true if successful
70
+ */
71
+ export declare const log: (req: IncomingMessage, res: ServerResponse, message: string, title?: string, subtitle?: string) => Promise<boolean>;
72
+ /**
73
+ * get entry
74
+ * @param req request (for authentication)
75
+ * @param res response (for authentication)
76
+ * @param uri key
77
+ * @return entry
78
+ */
79
+ export declare const getEntry: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<any>;
80
+ /**
81
+ * get entry
82
+ * @param req request (for authentication)
83
+ * @param res response (for authentication)
84
+ * @param uri key and conditions
85
+ * @return feed (entry array)
86
+ */
87
+ export declare const getFeed: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<any>;
88
+ /**
89
+ * get count
90
+ * @param req request (for authentication)
91
+ * @param res response (for authentication)
92
+ * @param uri key and conditions
93
+ * @return count
94
+ */
95
+ export declare const count: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<number | null>;
96
+ /**
97
+ * register entries
98
+ * @param req request (for authentication)
99
+ * @param res response (for authentication)
100
+ * @param feed entries (JSON)
101
+ * @param uri parent key if not specified in entry
102
+ * @return registed entries
103
+ */
104
+ export declare const post: (req: IncomingMessage, res: ServerResponse, feed: any, uri?: string) => Promise<any>;
105
+ /**
106
+ * update entries
107
+ * @param req request (for authentication)
108
+ * @param res response (for authentication)
109
+ * @param feed entries (JSON)
110
+ * @param isbulk Forcibly execute even if it exceeds the upper limit of entries of request feed.
111
+ * @param parallel Execute parallel if this param is true. Valid only if 'isbulk' is true.
112
+ * @param async Execute asynchronous if this param is true. Valid only if 'isbulk' is true.
113
+ * @return updated entries
114
+ */
115
+ export declare const put: (req: IncomingMessage, res: ServerResponse, feed: any, isbulk?: boolean, parallel?: boolean, async?: boolean) => Promise<any>;
116
+ /**
117
+ * delete entry
118
+ * @param req request (for authentication)
119
+ * @param res response (for authentication)
120
+ * @param uri key
121
+ * @param revision number of revision
122
+ * @return true if successful
123
+ */
124
+ export declare const deleteEntry: (req: IncomingMessage, res: ServerResponse, uri: string, revision?: number) => Promise<boolean>;
125
+ /**
126
+ * delete folder
127
+ * @param req request (for authentication)
128
+ * @param res response (for authentication)
129
+ * @param uri parent key
130
+ * @param async execute async
131
+ * @return true if successful
132
+ */
133
+ export declare const deleteFolder: (req: IncomingMessage, res: ServerResponse, uri: string, async?: boolean) => Promise<boolean>;
134
+ /**
135
+ * allocate numbers
136
+ * @param req request (for authentication)
137
+ * @param res response (for authentication)
138
+ * @param uri key
139
+ * @param num number to allocate
140
+ * @return allocated numbers. comma separated if multiple.
141
+ */
142
+ export declare const allocids: (req: IncomingMessage, res: ServerResponse, uri: string, num: number) => Promise<string>;
143
+ /**
144
+ * add a number
145
+ * @param req request (for authentication)
146
+ * @param res response (for authentication)
147
+ * @param uri key
148
+ * @param num number to add
149
+ * @return added number
150
+ */
151
+ export declare const addids: (req: IncomingMessage, res: ServerResponse, uri: string, num: number) => Promise<number | null>;
152
+ /**
153
+ * get a added number
154
+ * @param req request (for authentication)
155
+ * @param res response (for authentication)
156
+ * @param uri key
157
+ * @return added number
158
+ */
159
+ export declare const getids: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<number | null>;
160
+ /**
161
+ * set a number
162
+ * @param req request (for authentication)
163
+ * @param res response (for authentication)
164
+ * @param uri key
165
+ * @param num number to set
166
+ * @return set number
167
+ */
168
+ export declare const setids: (req: IncomingMessage, res: ServerResponse, uri: string, num: number) => Promise<number | null>;
169
+ /**
170
+ * set a addition range
171
+ * @param req request (for authentication)
172
+ * @param res response (for authentication)
173
+ * @param uri key
174
+ * @param range addition range
175
+ * @return addition range
176
+ */
177
+ export declare const rangeids: (req: IncomingMessage, res: ServerResponse, uri: string, range: string) => Promise<string>;
178
+ /**
179
+ * get a addition range
180
+ * @param req request (for authentication)
181
+ * @param res response (for authentication)
182
+ * @param uri key
183
+ * @return addition range
184
+ */
185
+ export declare const getRangeids: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<string>;
186
+ /**
187
+ * set feed to session
188
+ * @param req request (for authentication)
189
+ * @param res response (for authentication)
190
+ * @param name name
191
+ * @param feed entries (JSON)
192
+ * @return true if successful
193
+ */
194
+ export declare const setSessionFeed: (req: IncomingMessage, res: ServerResponse, name: string, feed: any) => Promise<boolean>;
195
+ /**
196
+ * set entry to session
197
+ * @param req request (for authentication)
198
+ * @param res response (for authentication)
199
+ * @param name name
200
+ * @param entry entry (JSON)
201
+ * @return true if successful
202
+ */
203
+ export declare const setSessionEntry: (req: IncomingMessage, res: ServerResponse, name: string, entry: any) => Promise<boolean>;
204
+ /**
205
+ * set string to session
206
+ * @param req request (for authentication)
207
+ * @param res response (for authentication)
208
+ * @param name name
209
+ * @param str string
210
+ * @return true if successful
211
+ */
212
+ export declare const setSessionString: (req: IncomingMessage, res: ServerResponse, name: string, str: string) => Promise<boolean>;
213
+ /**
214
+ * set number to session
215
+ * @param req request (for authentication)
216
+ * @param res response (for authentication)
217
+ * @param name name
218
+ * @param num number
219
+ * @return true if successful
220
+ */
221
+ export declare const setSessionLong: (req: IncomingMessage, res: ServerResponse, name: string, num: number) => Promise<boolean>;
222
+ /**
223
+ * add number in session
224
+ * @param req request (for authentication)
225
+ * @param res response (for authentication)
226
+ * @param name name
227
+ * @param num number to add
228
+ * @return true if successful
229
+ */
230
+ export declare const incrementSession: (req: IncomingMessage, res: ServerResponse, name: string, num: number) => Promise<number | null>;
231
+ /**
232
+ * delete feed from session
233
+ * @param req request (for authentication)
234
+ * @param res response (for authentication)
235
+ * @param name name
236
+ * @return true if successful
237
+ */
238
+ export declare const deleteSessionFeed: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<boolean>;
239
+ /**
240
+ * delete entry from session
241
+ * @param req request (for authentication)
242
+ * @param res response (for authentication)
243
+ * @param name name
244
+ * @return true if successful
245
+ */
246
+ export declare const deleteSessionEntry: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<boolean>;
247
+ /**
248
+ * delete string from session
249
+ * @param req request (for authentication)
250
+ * @param res response (for authentication)
251
+ * @param name name
252
+ * @return true if successful
253
+ */
254
+ export declare const deleteSessionString: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<boolean>;
255
+ /**
256
+ * delete number from session
257
+ * @param req request (for authentication)
258
+ * @param res response (for authentication)
259
+ * @param name name
260
+ * @return true if successful
261
+ */
262
+ export declare const deleteSessionLong: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<boolean>;
263
+ /**
264
+ * get feed from session
265
+ * @param req request (for authentication)
266
+ * @param res response (for authentication)
267
+ * @param name name
268
+ * @return feed
269
+ */
270
+ export declare const getSessionFeed: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<any>;
271
+ /**
272
+ * get entry from session
273
+ * @param req request (for authentication)
274
+ * @param res response (for authentication)
275
+ * @param name name
276
+ * @return entry
277
+ */
278
+ export declare const getSessionEntry: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<any>;
279
+ /**
280
+ * get string from session
281
+ * @param req request (for authentication)
282
+ * @param res response (for authentication)
283
+ * @param name name
284
+ * @return string
285
+ */
286
+ export declare const getSessionString: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<string | null>;
287
+ /**
288
+ * get number from session
289
+ * @param req request (for authentication)
290
+ * @param res response (for authentication)
291
+ * @param name name
292
+ * @return number
293
+ */
294
+ export declare const getSessionLong: (req: IncomingMessage, res: ServerResponse, name: string) => Promise<number | null>;
295
+ /**
296
+ * pagination
297
+ * @param req request (for authentication)
298
+ * @param res response (for authentication)
299
+ * @param uri key and conditions
300
+ * @param pagerange page range
301
+ * @return feed Maximum number of pages in the specified page range, and total count.
302
+ */
303
+ export declare const pagination: (req: IncomingMessage, res: ServerResponse, uri: string, pagerange: string) => Promise<any>;
304
+ /**
305
+ * get page
306
+ * @param req request (for authentication)
307
+ * @param res response (for authentication)
308
+ * @param uri key and conditions
309
+ * @param num page number
310
+ * @return feed Maximum number of pages in the specified page range, and total count.
311
+ */
312
+ export declare const getPage: (req: IncomingMessage, res: ServerResponse, uri: string, num: number) => Promise<any>;
313
+ /**
314
+ * post data to bigquery
315
+ * @param req request (for authentication)
316
+ * @param res response (for authentication)
317
+ * @param feed entries (JSON)
318
+ * @param async execute async
319
+ * @param tablenames key:entity's prop name, value:BigQuery table name
320
+ * @return true if successful
321
+ */
322
+ export declare const postBQ: (req: IncomingMessage, res: ServerResponse, feed: any, async?: boolean, tablenames?: any) => Promise<boolean>;
323
+ /**
324
+ * delete data from bigquery
325
+ * @param req request (for authentication)
326
+ * @param res response (for authentication)
327
+ * @param keys delete keys
328
+ * @param async execute async
329
+ * @param tablenames key:entity's prop name, value:BigQuery table name
330
+ * @return true if successful
331
+ */
332
+ export declare const deleteBQ: (req: IncomingMessage, res: ServerResponse, keys: string[], async?: boolean, tablenames?: any) => Promise<boolean>;
333
+ /**
334
+ * query bigquery
335
+ * @param req request (for authentication)
336
+ * @param res response (for authentication)
337
+ * @param sql query sql
338
+ * @param values values of query arguments
339
+ * @param parent parent name of result json
340
+ * @return query results in JSON format
341
+ */
342
+ export declare const getBQ: (req: IncomingMessage, res: ServerResponse, sql: string, values?: any[], parent?: string) => Promise<any>;
343
+ /**
344
+ * Search BigQuery and return results in CSV format.
345
+ * @param req request (for authentication)
346
+ * @param res response
347
+ * @param sql query sql
348
+ * @param values values of query arguments
349
+ * @param filename file name of csv
350
+ * @param parent parent name of result json
351
+ * @return true
352
+ */
353
+ export declare const getBQCsv: (req: IncomingMessage, res: ServerResponse, sql: string, values?: any[], filename?: string, parent?: string) => Promise<boolean>;
354
+ /**
355
+ * Create PDF
356
+ * @param req request (for authentication)
357
+ * @param res response
358
+ * @param htmlTemplate PDF layout
359
+ * @param filename PDF file name
360
+ * @return true
361
+ */
362
+ export declare const toPdf: (req: IncomingMessage, res: ServerResponse, htmlTemplate: string, filename?: string) => Promise<boolean>;
363
+ /**
364
+ * put the signature of uri and revision.
365
+ * @param req request (for authentication)
366
+ * @param res response (for authentication)
367
+ * @param uri key
368
+ * @param revision revision
369
+ * @return signed entry
370
+ */
371
+ export declare const putSignature: (req: IncomingMessage, res: ServerResponse, uri: string, revision?: number) => Promise<any>;
372
+ /**
373
+ * puts the signature of uri and revision.
374
+ * @param req request (for authentication)
375
+ * @param res response (for authentication)
376
+ * @param feed entries
377
+ * @return signed entries
378
+ */
379
+ export declare const putSignatures: (req: IncomingMessage, res: ServerResponse, feed: any) => Promise<any>;
380
+ /**
381
+ * delete the signature.
382
+ * @param req request (for authentication)
383
+ * @param res response (for authentication)
384
+ * @param uri key
385
+ * @param revision revision
386
+ * @return true if successful
387
+ */
388
+ export declare const deleteSignature: (req: IncomingMessage, res: ServerResponse, uri: string, revision?: number) => Promise<boolean>;
389
+ /**
390
+ * check the signature.
391
+ * @param req request (for authentication)
392
+ * @param res response (for authentication)
393
+ * @param uri key
394
+ * @return true if the signature is valid
395
+ */
396
+ export declare const checkSignature: (req: IncomingMessage, res: ServerResponse, uri: string) => Promise<boolean>;
397
+ /**
398
+ * Send an mail (with attachments)
399
+ * @param req request (for authentication)
400
+ * @param res response (for authentication)
401
+ * @param entry email contents
402
+ * @param to email addresses to
403
+ * @param cc email addresses cc
404
+ * @param bcc email addresses bcc
405
+ * @param attachments keys of attachment files
406
+ * @return true if successful
407
+ */
408
+ export declare const sendMail: (req: IncomingMessage, res: ServerResponse, entry: any, to: string[], cc?: string[], bcc?: string[], attachments?: string[]) => Promise<boolean>;
409
+ /**
410
+ * push notification to clients.
411
+ * @param req request (for authentication)
412
+ * @param res response (for authentication)
413
+ * @param message message
414
+ * @param to clients to
415
+ * @param title title
416
+ * @param subtitle subtitle (Expo)
417
+ * @param imageUrl url of image (FCM)
418
+ * @param data key value data (Expo)
419
+ * @return true if successful
420
+ */
421
+ export declare const pushNotification: (req: IncomingMessage, res: ServerResponse, message: string, to: string[], title?: string, subtitle?: string, imageUrl?: string, data?: any) => Promise<boolean>;
422
+ /**
423
+ * set status of MessageQueue.
424
+ * @param req request (for authentication)
425
+ * @param res response (for authentication)
426
+ * @param flag true if on, false if off
427
+ * @param channel channel
428
+ */
429
+ export declare const setMessageQueueStatus: (req: IncomingMessage, res: ServerResponse, flag: boolean, channel: string) => Promise<boolean>;
430
+ /**
431
+ * set MessageQueue.
432
+ * @param req request (for authentication)
433
+ * @param res response (for authentication)
434
+ * @param feed entries (JSON)
435
+ * @param channel channel
436
+ * @return true if successful
437
+ */
438
+ export declare const setMessageQueue: (req: IncomingMessage, res: ServerResponse, feed: any, channel: string) => Promise<boolean>;
439
+ /**
440
+ * get feed from session
441
+ * @param req request (for authentication)
442
+ * @param res response (for authentication)
443
+ * @param name name
444
+ * @return feed
445
+ */
446
+ export declare const getMessageQueue: (req: IncomingMessage, res: ServerResponse, channel: string) => Promise<any>;
447
+ /**
448
+ * join to the group
449
+ * @param req request (for authentication)
450
+ * @param res response (for authentication)
451
+ * @param group group
452
+ * @param selfid hierarchical name under my group alias
453
+ * @return feed
454
+ */
455
+ export declare const joinGroup: (req: IncomingMessage, res: ServerResponse, group: string, selfid: string) => Promise<any>;
456
+ /**
457
+ * leave from the group
458
+ * @param req request (for authentication)
459
+ * @param res response (for authentication)
460
+ * @param group group
461
+ * @return feed
462
+ */
463
+ export declare const leaveGroup: (req: IncomingMessage, res: ServerResponse, group: string) => Promise<boolean>;
464
+ /**
465
+ * Error returned from vte.cx
466
+ */
467
+ export declare class VtecxNextError extends Error {
468
+ status: number;
469
+ constructor(status: number, message: string);
470
+ }