inkdrop-model 2.11.5 → 2.11.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/lib/index.esm.js CHANGED
@@ -1,544 +1,450 @@
1
- import validator from '../validators/note';
2
- import { webcrypto } from 'node:crypto';
3
- import validator$1 from '../validators/book';
4
- import validator$2 from '../validators/tag';
5
- import validator$3 from '../validators/file';
6
-
7
- var $schema$3 = "http://json-schema.org/draft-07/schema#";
8
- var $id$3 = "note";
9
- var title$3 = "Note";
10
- var description$3 = "A note data";
11
- var type$3 = "object";
12
- var properties$3 = {
13
- _id: {
14
- description: "The unique document ID which should start with `note:` and the remains are randomly generated string",
15
- type: "string",
16
- minLength: 6,
17
- maxLength: 128,
18
- pattern: "^note:"
19
- },
20
- _rev: {
21
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
22
- type: "string"
23
- },
24
- bookId: {
25
- description: "The notebook ID",
26
- type: "string",
27
- minLength: 5,
28
- maxLength: 128,
29
- pattern: "^(book:|trash$)"
30
- },
31
- title: {
32
- description: "The note title",
33
- type: "string",
34
- maxLength: 256
35
- },
36
- doctype: {
37
- description: "The format type of the body field. It currently can take markdown only, reserved for the future",
38
- type: "string",
39
- "enum": [
40
- "markdown"
41
- ]
42
- },
43
- body: {
44
- description: "The content of the note represented with Markdown",
45
- type: "string",
46
- maxLength: 1048576
47
- },
48
- updatedAt: {
49
- description: "The date time when the note was last updated, represented with Unix timestamps in milliseconds",
50
- type: "number"
51
- },
52
- createdAt: {
53
- description: "The date time when the note was created, represented with Unix timestamps in milliseconds",
54
- type: "number"
55
- },
56
- tags: {
57
- description: "The list of tag IDs",
58
- type: "array",
59
- items: {
60
- type: "string"
1
+ import validator from "../validators/note";
2
+ import { webcrypto } from "node:crypto";
3
+ import validator$1 from "../validators/book";
4
+ import validator$2 from "../validators/tag";
5
+ import validator$3 from "../validators/file";
6
+ //#region json-schema/note.json
7
+ var note_default = {
8
+ $schema: "http://json-schema.org/draft-07/schema#",
9
+ $id: "note",
10
+ title: "Note",
11
+ description: "A note data",
12
+ type: "object",
13
+ properties: {
14
+ "_id": {
15
+ "description": "The unique document ID which should start with `note:` and the remains are randomly generated string",
16
+ "type": "string",
17
+ "minLength": 6,
18
+ "maxLength": 128,
19
+ "pattern": "^note:"
61
20
  },
62
- uniqueItems: true
63
- },
64
- numOfTasks: {
65
- description: "The number of tasks, extracted from body",
66
- type: "number"
67
- },
68
- numOfCheckedTasks: {
69
- description: "The number of checked tasks, extracted from body",
70
- type: "number"
71
- },
72
- migratedBy: {
73
- description: "The type of the data migration",
74
- type: "string",
75
- maxLength: 128
76
- },
77
- status: {
78
- description: "The status of the note",
79
- type: "string",
80
- "enum": [
81
- "none",
82
- "active",
83
- "onHold",
84
- "completed",
85
- "dropped"
86
- ]
87
- },
88
- share: {
89
- description: "The sharing mode of the note",
90
- type: "string",
91
- "enum": [
92
- "private",
93
- "public"
94
- ]
95
- },
96
- pinned: {
97
- description: "Whether the note is pinned to top",
98
- type: "boolean"
99
- },
100
- timestamp: {
101
- description: "The date time when the revision was written, represented with Unix timestamps in milliseconds",
102
- type: "number"
103
- },
104
- _conflicts: {
105
- description: "Conflicted revisions",
106
- type: "array",
107
- items: {
108
- type: "string"
21
+ "_rev": {
22
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
23
+ "type": "string"
109
24
  },
110
- uniqueItems: true
111
- }
112
- };
113
- var required$3 = [
114
- "_id",
115
- "bookId",
116
- "title",
117
- "doctype",
118
- "body",
119
- "updatedAt",
120
- "createdAt",
121
- "timestamp"
122
- ];
123
- var note = {
124
- $schema: $schema$3,
125
- $id: $id$3,
126
- title: title$3,
127
- description: description$3,
128
- type: type$3,
129
- properties: properties$3,
130
- required: required$3
25
+ "bookId": {
26
+ "description": "The notebook ID",
27
+ "type": "string",
28
+ "minLength": 5,
29
+ "maxLength": 128,
30
+ "pattern": "^(book:|trash$)"
31
+ },
32
+ "title": {
33
+ "description": "The note title",
34
+ "type": "string",
35
+ "maxLength": 256
36
+ },
37
+ "doctype": {
38
+ "description": "The format type of the body field. It currently can take markdown only, reserved for the future",
39
+ "type": "string",
40
+ "enum": ["markdown"]
41
+ },
42
+ "body": {
43
+ "description": "The content of the note represented with Markdown",
44
+ "type": "string",
45
+ "maxLength": 1048576
46
+ },
47
+ "updatedAt": {
48
+ "description": "The date time when the note was last updated, represented with Unix timestamps in milliseconds",
49
+ "type": "number"
50
+ },
51
+ "createdAt": {
52
+ "description": "The date time when the note was created, represented with Unix timestamps in milliseconds",
53
+ "type": "number"
54
+ },
55
+ "tags": {
56
+ "description": "The list of tag IDs",
57
+ "type": "array",
58
+ "items": { "type": "string" },
59
+ "uniqueItems": true
60
+ },
61
+ "numOfTasks": {
62
+ "description": "The number of tasks, extracted from body",
63
+ "type": "number"
64
+ },
65
+ "numOfCheckedTasks": {
66
+ "description": "The number of checked tasks, extracted from body",
67
+ "type": "number"
68
+ },
69
+ "migratedBy": {
70
+ "description": "The type of the data migration",
71
+ "type": "string",
72
+ "maxLength": 128
73
+ },
74
+ "status": {
75
+ "description": "The status of the note",
76
+ "type": "string",
77
+ "enum": [
78
+ "none",
79
+ "active",
80
+ "onHold",
81
+ "completed",
82
+ "dropped"
83
+ ]
84
+ },
85
+ "share": {
86
+ "description": "The sharing mode of the note",
87
+ "type": "string",
88
+ "enum": ["private", "public"]
89
+ },
90
+ "pinned": {
91
+ "description": "Whether the note is pinned to top",
92
+ "type": "boolean"
93
+ },
94
+ "timestamp": {
95
+ "description": "The date time when the revision was written, represented with Unix timestamps in milliseconds",
96
+ "type": "number"
97
+ },
98
+ "_conflicts": {
99
+ "description": "Conflicted revisions",
100
+ "type": "array",
101
+ "items": { "type": "string" },
102
+ "uniqueItems": true
103
+ }
104
+ },
105
+ required: [
106
+ "_id",
107
+ "bookId",
108
+ "title",
109
+ "doctype",
110
+ "body",
111
+ "updatedAt",
112
+ "createdAt",
113
+ "timestamp"
114
+ ]
131
115
  };
132
-
133
- const urlAlphabet =
134
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict';
135
-
116
+ //#endregion
117
+ //#region node_modules/.pnpm/nanoid@5.1.15/node_modules/nanoid/url-alphabet/index.js
118
+ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
119
+ //#endregion
120
+ //#region node_modules/.pnpm/nanoid@5.1.15/node_modules/nanoid/index.js
136
121
  const POOL_SIZE_MULTIPLIER = 128;
137
122
  let pool, poolOffset;
138
123
  function fillPool(bytes) {
139
- if (!pool || pool.length < bytes) {
140
- pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
141
- webcrypto.getRandomValues(pool);
142
- poolOffset = 0;
143
- } else if (poolOffset + bytes > pool.length) {
144
- webcrypto.getRandomValues(pool);
145
- poolOffset = 0;
146
- }
147
- poolOffset += bytes;
124
+ if (bytes < 0) throw new RangeError("Wrong ID size");
125
+ try {
126
+ if (!pool || pool.length < bytes) {
127
+ pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER);
128
+ webcrypto.getRandomValues(pool);
129
+ poolOffset = 0;
130
+ } else if (poolOffset + bytes > pool.length) {
131
+ webcrypto.getRandomValues(pool);
132
+ poolOffset = 0;
133
+ }
134
+ } catch (e) {
135
+ pool = void 0;
136
+ throw e;
137
+ }
138
+ poolOffset += bytes;
148
139
  }
149
140
  function nanoid(size = 21) {
150
- fillPool((size |= 0));
151
- let id = '';
152
- for (let i = poolOffset - size; i < poolOffset; i++) {
153
- id += urlAlphabet[pool[i] & 63];
154
- }
155
- return id
141
+ fillPool(size |= 0);
142
+ let id = "";
143
+ for (let i = poolOffset - size; i < poolOffset; i++) id += urlAlphabet[pool[i] & 63];
144
+ return id;
156
145
  }
157
-
146
+ //#endregion
147
+ //#region src/utils.ts
158
148
  function createDocId(prefix) {
159
- var id = nanoid(8);
160
- return "".concat(prefix).concat(id);
149
+ return `${prefix}${nanoid(8)}`;
161
150
  }
162
-
163
- /******************************************************************************
164
- Copyright (c) Microsoft Corporation.
165
-
166
- Permission to use, copy, modify, and/or distribute this software for any
167
- purpose with or without fee is hereby granted.
168
-
169
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
170
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
171
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
172
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
173
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
174
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
175
- PERFORMANCE OF THIS SOFTWARE.
176
- ***************************************************************************** */
177
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
178
-
179
- var extendStatics = function(d, b) {
180
- extendStatics = Object.setPrototypeOf ||
181
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
182
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
183
- return extendStatics(d, b);
184
- };
185
-
186
- function __extends(d, b) {
187
- if (typeof b !== "function" && b !== null)
188
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
189
- extendStatics(d, b);
190
- function __() { this.constructor = d; }
191
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
192
- }
193
-
194
- var __assign = function() {
195
- __assign = Object.assign || function __assign(t) {
196
- for (var s, i = 1, n = arguments.length; i < n; i++) {
197
- s = arguments[i];
198
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
199
- }
200
- return t;
201
- };
202
- return __assign.apply(this, arguments);
203
- };
204
-
205
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
206
- var e = new Error(message);
207
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
208
- };
209
-
151
+ //#endregion
152
+ //#region src/validator.ts
210
153
  function validationErrorsToMessage(errors) {
211
- if (errors instanceof Array) {
212
- return errors
213
- .map(function (e) {
214
- if (typeof e === 'object') {
215
- return "\"".concat(e.instancePath, "\" ").concat(e.message);
216
- }
217
- else {
218
- return e;
219
- }
220
- })
221
- .join(', ');
222
- }
223
- else {
224
- return errors;
225
- }
154
+ if (errors instanceof Array) return errors.map((e) => {
155
+ if (typeof e === "object") return `"${e.instancePath}" ${e.message}`;
156
+ else return e;
157
+ }).join(", ");
158
+ else return errors;
226
159
  }
227
- var InvalidDataError = /** @class */ (function (_super) {
228
- __extends(InvalidDataError, _super);
229
- function InvalidDataError(message, errors) {
230
- var _this = _super.call(this, message + ' ' + validationErrorsToMessage(errors)) || this;
231
- _this.name = 'InvalidDataError';
232
- _this.errors = errors;
233
- return _this;
234
- }
235
- return InvalidDataError;
236
- }(Error));
160
+ var InvalidDataError = class extends Error {
161
+ constructor(message, errors) {
162
+ super(message + " " + validationErrorsToMessage(errors));
163
+ this.name = "InvalidDataError";
164
+ this.errors = errors;
165
+ }
166
+ };
237
167
  function validateDocId(prefix, docId) {
238
- if (!docId.startsWith(prefix) || docId.length <= 5 || docId.length > 128) {
239
- throw new Error('Invalid document ID');
240
- }
241
- return true;
168
+ if (!docId.startsWith(prefix) || docId.length <= 5 || docId.length > 128) throw new Error("Invalid document ID");
169
+ return true;
242
170
  }
243
-
244
- var NOTE_DOCID_PREFIX = 'note:';
245
- var TRASH_BOOK_ID = 'trash';
246
- var NOTE_STATUS = {
247
- NONE: 'none',
248
- ACTIVE: 'active',
249
- ON_HOLD: 'onHold',
250
- COMPLETED: 'completed',
251
- DROPPED: 'dropped'
171
+ //#endregion
172
+ //#region src/note.ts
173
+ const NOTE_DOCID_PREFIX = "note:";
174
+ const TRASH_BOOK_ID = "trash";
175
+ const NOTE_STATUS = {
176
+ NONE: "none",
177
+ ACTIVE: "active",
178
+ ON_HOLD: "onHold",
179
+ COMPLETED: "completed",
180
+ DROPPED: "dropped"
252
181
  };
253
- var NOTE_VISIBILITY = {
254
- PRIVATE: 'private',
255
- PUBLIC: 'public'
182
+ const NOTE_VISIBILITY = {
183
+ PRIVATE: "private",
184
+ PUBLIC: "public"
256
185
  };
257
- var validateNote = validator;
258
- var NOTE_TITLE_MAX_LENGTH = 256;
186
+ const validateNote = validator;
187
+ const NOTE_TITLE_MAX_LENGTH = 256;
259
188
  function createNoteId() {
260
- return createDocId(NOTE_DOCID_PREFIX);
189
+ return createDocId(NOTE_DOCID_PREFIX);
261
190
  }
262
191
  function validateNoteId(docId) {
263
- return validateDocId(NOTE_DOCID_PREFIX, docId);
192
+ return validateDocId(NOTE_DOCID_PREFIX, docId);
264
193
  }
265
-
266
- var $schema$2 = "http://json-schema.org/draft-07/schema#";
267
- var $id$2 = "book";
268
- var title$2 = "Book";
269
- var description$2 = "A notebook data";
270
- var type$2 = "object";
271
- var properties$2 = {
272
- _id: {
273
- description: "The unique notebook ID which should start with `book:` and the remains are randomly generated string",
274
- type: "string",
275
- minLength: 6,
276
- maxLength: 128,
277
- pattern: "^book:"
278
- },
279
- _rev: {
280
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
281
- type: "string"
282
- },
283
- name: {
284
- description: "The notebook name",
285
- type: "string",
286
- minLength: 1,
287
- maxLength: 64
288
- },
289
- updatedAt: {
290
- description: "The date time when the notebook was last updated, represented with Unix timestamps in milliseconds",
291
- type: "number"
292
- },
293
- createdAt: {
294
- description: "The date time when the notebook was created, represented with Unix timestamps in milliseconds",
295
- type: "number"
296
- },
297
- count: {
298
- description: "It indicates the number of notes in the notebook",
299
- type: "number"
300
- },
301
- parentBookId: {
302
- description: "The ID of the parent notebook",
303
- type: [
304
- "string",
305
- "null"
306
- ]
307
- },
308
- order: {
309
- description: "A number used to manually sort notebooks. Notebooks are ordered by this value in ascending order. If not specified, notebooks fall back to alphabetical sorting by name.",
310
- type: "number"
311
- },
312
- icon: {
313
- description: "Custom icon for the notebook",
314
- type: "object",
315
- oneOf: [
316
- {
317
- properties: {
318
- type: {
319
- description: "Icon storage type",
194
+ //#endregion
195
+ //#region json-schema/book.json
196
+ var book_default = {
197
+ $schema: "http://json-schema.org/draft-07/schema#",
198
+ $id: "book",
199
+ title: "Book",
200
+ description: "A notebook data",
201
+ type: "object",
202
+ properties: {
203
+ "_id": {
204
+ "description": "The unique notebook ID which should start with `book:` and the remains are randomly generated string",
205
+ "type": "string",
206
+ "minLength": 6,
207
+ "maxLength": 128,
208
+ "pattern": "^book:"
209
+ },
210
+ "_rev": {
211
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
212
+ "type": "string"
213
+ },
214
+ "name": {
215
+ "description": "The notebook name",
216
+ "type": "string",
217
+ "minLength": 1,
218
+ "maxLength": 64
219
+ },
220
+ "updatedAt": {
221
+ "description": "The date time when the notebook was last updated, represented with Unix timestamps in milliseconds",
222
+ "type": "number"
223
+ },
224
+ "createdAt": {
225
+ "description": "The date time when the notebook was created, represented with Unix timestamps in milliseconds",
226
+ "type": "number"
227
+ },
228
+ "count": {
229
+ "description": "It indicates the number of notes in the notebook",
230
+ "type": "number"
231
+ },
232
+ "parentBookId": {
233
+ "description": "The ID of the parent notebook",
234
+ "type": ["string", "null"]
235
+ },
236
+ "order": {
237
+ "description": "A number used to manually sort notebooks. Notebooks are ordered by this value in ascending order. If not specified, notebooks fall back to alphabetical sorting by name.",
238
+ "type": "number"
239
+ },
240
+ "icon": {
241
+ "description": "Custom icon for the notebook",
242
+ "type": "object",
243
+ "oneOf": [{
244
+ "properties": {
245
+ "type": {
246
+ "description": "Icon storage type",
320
247
  "const": "inline"
321
248
  },
322
- svg: {
323
- description: "The SVG icon data. Must be less than 256kb",
324
- type: "string",
325
- maxLength: 262144
249
+ "svg": {
250
+ "description": "The SVG icon data. Must be less than 256kb",
251
+ "type": "string",
252
+ "maxLength": 262144
326
253
  }
327
254
  },
328
- required: [
329
- "type",
330
- "svg"
331
- ]
332
- },
333
- {
334
- properties: {
335
- type: {
336
- description: "Icon storage type",
255
+ "required": ["type", "svg"]
256
+ }, {
257
+ "properties": {
258
+ "type": {
259
+ "description": "Icon storage type",
337
260
  "const": "file"
338
261
  },
339
- docId: {
340
- description: "The document ID for the attachment file",
341
- type: "string",
342
- pattern: "^file:",
343
- minLength: 6,
344
- maxLength: 128
262
+ "docId": {
263
+ "description": "The document ID for the attachment file",
264
+ "type": "string",
265
+ "pattern": "^file:",
266
+ "minLength": 6,
267
+ "maxLength": 128
345
268
  }
346
269
  },
347
- required: [
348
- "type",
349
- "docId"
350
- ]
351
- }
352
- ]
353
- }
270
+ "required": ["type", "docId"]
271
+ }]
272
+ }
273
+ },
274
+ required: [
275
+ "_id",
276
+ "name",
277
+ "updatedAt",
278
+ "createdAt"
279
+ ]
354
280
  };
355
- var required$2 = [
356
- "_id",
357
- "name",
358
- "updatedAt",
359
- "createdAt"
360
- ];
361
- var book = {
362
- $schema: $schema$2,
363
- $id: $id$2,
364
- title: title$2,
365
- description: description$2,
366
- type: type$2,
367
- properties: properties$2,
368
- required: required$2
369
- };
370
-
371
- var BOOK_DOCID_PREFIX = 'book:';
372
- var validateBook = validator$1;
281
+ //#endregion
282
+ //#region src/book.ts
283
+ const BOOK_DOCID_PREFIX = "book:";
284
+ const validateBook = validator$1;
373
285
  function createBookId() {
374
- return createDocId(BOOK_DOCID_PREFIX);
286
+ return createDocId(BOOK_DOCID_PREFIX);
375
287
  }
376
288
  function validateBookId(docId) {
377
- return validateDocId(BOOK_DOCID_PREFIX, docId);
289
+ return validateDocId(BOOK_DOCID_PREFIX, docId);
378
290
  }
379
-
380
- var $schema$1 = "http://json-schema.org/draft-07/schema#";
381
- var $id$1 = "tag";
382
- var title$1 = "Tag";
383
- var description$1 = "A note tag";
384
- var type$1 = "object";
385
- var properties$1 = {
386
- _id: {
387
- description: "The unique tag ID which should start with `tag:` and the remains are randomly generated string",
388
- type: "string",
389
- minLength: 6,
390
- maxLength: 128,
391
- pattern: "^tag:"
392
- },
393
- _rev: {
394
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
395
- type: "string"
396
- },
397
- name: {
398
- description: "The name of the tag",
399
- type: "string",
400
- maxLength: 64
401
- },
402
- count: {
403
- description: "It indicates the number of notes with the tag",
404
- type: "number"
405
- },
406
- color: {
407
- description: "The color type of the tag",
408
- type: "string",
409
- "enum": [
410
- "default",
411
- "red",
412
- "orange",
413
- "yellow",
414
- "olive",
415
- "green",
416
- "teal",
417
- "blue",
418
- "violet",
419
- "purple",
420
- "pink",
421
- "brown",
422
- "grey",
423
- "black"
424
- ]
425
- },
426
- updatedAt: {
427
- description: "The date time when the tag was last updated, represented with Unix timestamps in milliseconds",
428
- type: "number"
429
- },
430
- createdAt: {
431
- description: "The date time when the tag was created, represented with Unix timestamps in milliseconds",
432
- type: "number"
433
- }
434
- };
435
- var required$1 = [
436
- "_id",
437
- "name",
438
- "count",
439
- "updatedAt",
440
- "createdAt"
441
- ];
442
- var tag = {
443
- $schema: $schema$1,
444
- $id: $id$1,
445
- title: title$1,
446
- description: description$1,
447
- type: type$1,
448
- properties: properties$1,
449
- required: required$1
291
+ //#endregion
292
+ //#region json-schema/tag.json
293
+ var tag_default = {
294
+ $schema: "http://json-schema.org/draft-07/schema#",
295
+ $id: "tag",
296
+ title: "Tag",
297
+ description: "A note tag",
298
+ type: "object",
299
+ properties: {
300
+ "_id": {
301
+ "description": "The unique tag ID which should start with `tag:` and the remains are randomly generated string",
302
+ "type": "string",
303
+ "minLength": 6,
304
+ "maxLength": 128,
305
+ "pattern": "^tag:"
306
+ },
307
+ "_rev": {
308
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
309
+ "type": "string"
310
+ },
311
+ "name": {
312
+ "description": "The name of the tag",
313
+ "type": "string",
314
+ "maxLength": 64
315
+ },
316
+ "count": {
317
+ "description": "It indicates the number of notes with the tag",
318
+ "type": "number"
319
+ },
320
+ "color": {
321
+ "description": "The color type of the tag",
322
+ "type": "string",
323
+ "enum": [
324
+ "default",
325
+ "red",
326
+ "orange",
327
+ "yellow",
328
+ "olive",
329
+ "green",
330
+ "teal",
331
+ "blue",
332
+ "violet",
333
+ "purple",
334
+ "pink",
335
+ "brown",
336
+ "grey",
337
+ "black"
338
+ ]
339
+ },
340
+ "updatedAt": {
341
+ "description": "The date time when the tag was last updated, represented with Unix timestamps in milliseconds",
342
+ "type": "number"
343
+ },
344
+ "createdAt": {
345
+ "description": "The date time when the tag was created, represented with Unix timestamps in milliseconds",
346
+ "type": "number"
347
+ }
348
+ },
349
+ required: [
350
+ "_id",
351
+ "name",
352
+ "count",
353
+ "updatedAt",
354
+ "createdAt"
355
+ ]
450
356
  };
451
-
452
- var TAG_COLOR = {
453
- DEFAULT: 'default',
454
- RED: 'red',
455
- ORANGE: 'orange',
456
- YELLOW: 'yellow',
457
- OLIVE: 'olive',
458
- GREEN: 'green',
459
- TEAL: 'teal',
460
- BLUE: 'blue',
461
- VIOLET: 'violet',
462
- PURPLE: 'purple',
463
- PINK: 'pink',
464
- BROWN: 'brown',
465
- GREY: 'grey',
466
- BLACK: 'black'
357
+ //#endregion
358
+ //#region src/tag.ts
359
+ const TAG_COLOR = {
360
+ DEFAULT: "default",
361
+ RED: "red",
362
+ ORANGE: "orange",
363
+ YELLOW: "yellow",
364
+ OLIVE: "olive",
365
+ GREEN: "green",
366
+ TEAL: "teal",
367
+ BLUE: "blue",
368
+ VIOLET: "violet",
369
+ PURPLE: "purple",
370
+ PINK: "pink",
371
+ BROWN: "brown",
372
+ GREY: "grey",
373
+ BLACK: "black"
467
374
  };
468
- var TAG_DOCID_PREFIX = 'tag:';
469
- var validateTag = validator$2;
375
+ const TAG_DOCID_PREFIX = "tag:";
376
+ const validateTag = validator$2;
470
377
  function createTagId() {
471
- return createDocId(TAG_DOCID_PREFIX);
378
+ return createDocId(TAG_DOCID_PREFIX);
472
379
  }
473
380
  function validateTagId(docId) {
474
- return validateDocId(TAG_DOCID_PREFIX, docId);
381
+ return validateDocId(TAG_DOCID_PREFIX, docId);
475
382
  }
476
-
477
- var $schema = "http://json-schema.org/draft-07/schema#";
478
- var $id = "file";
479
- var title = "File";
480
- var description = "An attachment file";
481
- var type = "object";
482
- var properties = {
483
- _id: {
484
- description: "The unique document ID which should start with `file:` and the remains are randomly generated string",
485
- type: "string",
486
- minLength: 6,
487
- maxLength: 128,
488
- pattern: "^file:"
489
- },
490
- _rev: {
491
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
492
- type: "string"
493
- },
494
- name: {
495
- description: "The file name",
496
- type: "string",
497
- minLength: 1,
498
- maxLength: 128
499
- },
500
- createdAt: {
501
- description: "The date time when the note was created, represented with Unix timestamps in milliseconds",
502
- type: "number"
503
- },
504
- contentType: {
505
- description: "The MIME type of the content",
506
- type: "string",
507
- "enum": [
508
- "image/png",
509
- "image/jpeg",
510
- "image/jpg",
511
- "image/svg+xml",
512
- "image/gif",
513
- "image/heic",
514
- "image/heif"
515
- ],
516
- maxLength: 128
517
- },
518
- contentLength: {
519
- description: "The content length of the file",
520
- type: "number",
521
- maximum: 10485760
522
- },
523
- publicIn: {
524
- description: "An array of the note IDs where the file is included",
525
- type: "array",
526
- items: {
527
- type: "string"
383
+ //#endregion
384
+ //#region json-schema/file.json
385
+ var file_default = {
386
+ $schema: "http://json-schema.org/draft-07/schema#",
387
+ $id: "file",
388
+ title: "File",
389
+ description: "An attachment file",
390
+ type: "object",
391
+ properties: {
392
+ "_id": {
393
+ "description": "The unique document ID which should start with `file:` and the remains are randomly generated string",
394
+ "type": "string",
395
+ "minLength": 6,
396
+ "maxLength": 128,
397
+ "pattern": "^file:"
528
398
  },
529
- uniqueItems: true
530
- },
531
- _attachments: {
532
- description: "The attachment file",
533
- type: "object",
534
- properties: {
535
- index: {
536
- description: "The attachment file",
537
- type: "object",
538
- properties: {
539
- content_type: {
540
- description: "The content type of the file",
541
- type: "string",
399
+ "_rev": {
400
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
401
+ "type": "string"
402
+ },
403
+ "name": {
404
+ "description": "The file name",
405
+ "type": "string",
406
+ "minLength": 1,
407
+ "maxLength": 128
408
+ },
409
+ "createdAt": {
410
+ "description": "The date time when the note was created, represented with Unix timestamps in milliseconds",
411
+ "type": "number"
412
+ },
413
+ "contentType": {
414
+ "description": "The MIME type of the content",
415
+ "type": "string",
416
+ "enum": [
417
+ "image/png",
418
+ "image/jpeg",
419
+ "image/jpg",
420
+ "image/svg+xml",
421
+ "image/gif",
422
+ "image/heic",
423
+ "image/heif"
424
+ ],
425
+ "maxLength": 128
426
+ },
427
+ "contentLength": {
428
+ "description": "The content length of the file",
429
+ "type": "number",
430
+ "maximum": 10485760
431
+ },
432
+ "publicIn": {
433
+ "description": "An array of the note IDs where the file is included",
434
+ "type": "array",
435
+ "items": { "type": "string" },
436
+ "uniqueItems": true
437
+ },
438
+ "_attachments": {
439
+ "description": "The attachment file",
440
+ "type": "object",
441
+ "properties": { "index": {
442
+ "description": "The attachment file",
443
+ "type": "object",
444
+ "properties": {
445
+ "content_type": {
446
+ "description": "The content type of the file",
447
+ "type": "string",
542
448
  "enum": [
543
449
  "image/png",
544
450
  "image/jpeg",
@@ -549,66 +455,54 @@ var properties = {
549
455
  "image/heif"
550
456
  ]
551
457
  },
552
- data: {
553
- description: "The file data",
554
- type: [
555
- "string",
556
- "object"
557
- ]
458
+ "data": {
459
+ "description": "The file data",
460
+ "type": ["string", "object"]
558
461
  }
559
462
  },
560
- required: [
561
- "content_type",
562
- "data"
563
- ]
564
- }
565
- },
566
- required: [
567
- "index"
568
- ]
569
- }
463
+ "required": ["content_type", "data"]
464
+ } },
465
+ "required": ["index"]
466
+ }
467
+ },
468
+ required: [
469
+ "_id",
470
+ "name",
471
+ "createdAt",
472
+ "contentType",
473
+ "contentLength",
474
+ "publicIn",
475
+ "_attachments"
476
+ ]
570
477
  };
571
- var required = [
572
- "_id",
573
- "name",
574
- "createdAt",
575
- "contentType",
576
- "contentLength",
577
- "publicIn",
578
- "_attachments"
478
+ //#endregion
479
+ //#region src/file.ts
480
+ const supportedImageFileTypes = [
481
+ "image/png",
482
+ "image/jpeg",
483
+ "image/jpg",
484
+ "image/svg+xml",
485
+ "image/gif",
486
+ "image/heic",
487
+ "image/heif"
579
488
  ];
580
- var file = {
581
- $schema: $schema,
582
- $id: $id,
583
- title: title,
584
- description: description,
585
- type: type,
586
- properties: properties,
587
- required: required
489
+ const SUPPORTED_IMAGE_MIME_TYPES = {
490
+ ...supportedImageFileTypes.reduce((hash, ft) => ({
491
+ ...hash,
492
+ [ft.split("/")[1]]: ft
493
+ }), {}),
494
+ jpg: "image/jpeg"
588
495
  };
589
-
590
- var supportedImageFileTypes = [
591
- 'image/png',
592
- 'image/jpeg',
593
- 'image/jpg',
594
- 'image/svg+xml',
595
- 'image/gif',
596
- 'image/heic',
597
- 'image/heif'
598
- ];
599
- var SUPPORTED_IMAGE_MIME_TYPES = __assign(__assign({}, supportedImageFileTypes.reduce(function (hash, ft) {
600
- var _a;
601
- return (__assign(__assign({}, hash), (_a = {}, _a[ft.split('/')[1]] = ft, _a)));
602
- }, {})), { jpg: 'image/jpeg' });
603
- var maxAttachmentFileSize = 10 * 1024 * 1024;
604
- var FILE_DOCID_PREFIX = 'file:';
605
- var validateFile = validator$3;
496
+ const maxAttachmentFileSize = 10 * 1024 * 1024;
497
+ const FILE_DOCID_PREFIX = "file:";
498
+ const validateFile = validator$3;
606
499
  function createFileId() {
607
- return createDocId(FILE_DOCID_PREFIX);
500
+ return createDocId(FILE_DOCID_PREFIX);
608
501
  }
609
502
  function validateFileId(docId) {
610
- return validateDocId(FILE_DOCID_PREFIX, docId);
503
+ return validateDocId(FILE_DOCID_PREFIX, docId);
611
504
  }
505
+ //#endregion
506
+ export { BOOK_DOCID_PREFIX, book_default as BookSchema, FILE_DOCID_PREFIX, file_default as FileSchema, InvalidDataError, NOTE_DOCID_PREFIX, NOTE_STATUS, NOTE_TITLE_MAX_LENGTH, NOTE_VISIBILITY, note_default as NoteSchema, SUPPORTED_IMAGE_MIME_TYPES, TAG_COLOR, TAG_DOCID_PREFIX, TRASH_BOOK_ID, tag_default as TagSchema, createBookId, createDocId, createFileId, createNoteId, createTagId, maxAttachmentFileSize, supportedImageFileTypes, validateBook, validateBookId, validateDocId, validateFile, validateFileId, validateNote, validateNoteId, validateTag, validateTagId, validationErrorsToMessage };
612
507
 
613
- export { BOOK_DOCID_PREFIX, book as BookSchema, FILE_DOCID_PREFIX, file as FileSchema, InvalidDataError, NOTE_DOCID_PREFIX, NOTE_STATUS, NOTE_TITLE_MAX_LENGTH, NOTE_VISIBILITY, note as NoteSchema, SUPPORTED_IMAGE_MIME_TYPES, TAG_COLOR, TAG_DOCID_PREFIX, TRASH_BOOK_ID, tag as TagSchema, createBookId, createDocId, createFileId, createNoteId, createTagId, maxAttachmentFileSize, supportedImageFileTypes, validateBook, validateBookId, validateDocId, validateFile, validateFileId, validateNote, validateNoteId, validateTag, validateTagId, validationErrorsToMessage };
614
- //# sourceMappingURL=index.esm.js.map
508
+ //# sourceMappingURL=index.esm.js.map