inkdrop-model 2.11.5 → 2.12.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.
@@ -21,7 +21,7 @@
21
21
  "type": "string",
22
22
  "minLength": 5,
23
23
  "maxLength": 128,
24
- "pattern": "^(book:|trash$)"
24
+ "pattern": "^(book:|trash$|template$)"
25
25
  },
26
26
  "title": {
27
27
  "description": "The note title",
@@ -0,0 +1,568 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+ //#endregion
24
+ let validators_note = require("../validators/note");
25
+ validators_note = __toESM(validators_note);
26
+ let validators_book = require("../validators/book");
27
+ validators_book = __toESM(validators_book);
28
+ let validators_tag = require("../validators/tag");
29
+ validators_tag = __toESM(validators_tag);
30
+ let validators_file = require("../validators/file");
31
+ validators_file = __toESM(validators_file);
32
+ //#region json-schema/note.json
33
+ var note_default = {
34
+ $schema: "http://json-schema.org/draft-07/schema#",
35
+ $id: "note",
36
+ title: "Note",
37
+ description: "A note data",
38
+ type: "object",
39
+ properties: {
40
+ "_id": {
41
+ "description": "The unique document ID which should start with `note:` and the remains are randomly generated string",
42
+ "type": "string",
43
+ "minLength": 6,
44
+ "maxLength": 128,
45
+ "pattern": "^note:"
46
+ },
47
+ "_rev": {
48
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
49
+ "type": "string"
50
+ },
51
+ "bookId": {
52
+ "description": "The notebook ID",
53
+ "type": "string",
54
+ "minLength": 5,
55
+ "maxLength": 128,
56
+ "pattern": "^(book:|trash$|template$)"
57
+ },
58
+ "title": {
59
+ "description": "The note title",
60
+ "type": "string",
61
+ "maxLength": 256
62
+ },
63
+ "doctype": {
64
+ "description": "The format type of the body field. It currently can take markdown only, reserved for the future",
65
+ "type": "string",
66
+ "enum": ["markdown"]
67
+ },
68
+ "body": {
69
+ "description": "The content of the note represented with Markdown",
70
+ "type": "string",
71
+ "maxLength": 1048576
72
+ },
73
+ "updatedAt": {
74
+ "description": "The date time when the note was last updated, represented with Unix timestamps in milliseconds",
75
+ "type": "number"
76
+ },
77
+ "createdAt": {
78
+ "description": "The date time when the note was created, represented with Unix timestamps in milliseconds",
79
+ "type": "number"
80
+ },
81
+ "tags": {
82
+ "description": "The list of tag IDs",
83
+ "type": "array",
84
+ "items": { "type": "string" },
85
+ "uniqueItems": true
86
+ },
87
+ "numOfTasks": {
88
+ "description": "The number of tasks, extracted from body",
89
+ "type": "number"
90
+ },
91
+ "numOfCheckedTasks": {
92
+ "description": "The number of checked tasks, extracted from body",
93
+ "type": "number"
94
+ },
95
+ "migratedBy": {
96
+ "description": "The type of the data migration",
97
+ "type": "string",
98
+ "maxLength": 128
99
+ },
100
+ "status": {
101
+ "description": "The status of the note",
102
+ "type": "string",
103
+ "enum": [
104
+ "none",
105
+ "active",
106
+ "onHold",
107
+ "completed",
108
+ "dropped"
109
+ ]
110
+ },
111
+ "share": {
112
+ "description": "The sharing mode of the note",
113
+ "type": "string",
114
+ "enum": ["private", "public"]
115
+ },
116
+ "pinned": {
117
+ "description": "Whether the note is pinned to top",
118
+ "type": "boolean"
119
+ },
120
+ "timestamp": {
121
+ "description": "The date time when the revision was written, represented with Unix timestamps in milliseconds",
122
+ "type": "number"
123
+ },
124
+ "_conflicts": {
125
+ "description": "Conflicted revisions",
126
+ "type": "array",
127
+ "items": { "type": "string" },
128
+ "uniqueItems": true
129
+ }
130
+ },
131
+ required: [
132
+ "_id",
133
+ "bookId",
134
+ "title",
135
+ "doctype",
136
+ "body",
137
+ "updatedAt",
138
+ "createdAt",
139
+ "timestamp"
140
+ ]
141
+ };
142
+ //#endregion
143
+ //#region node_modules/.pnpm/nanoid@6.0.0/node_modules/nanoid/url-alphabet/index.js
144
+ let urlAlphabet = "useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";
145
+ //#endregion
146
+ //#region node_modules/.pnpm/nanoid@6.0.0/node_modules/nanoid/index.browser.js
147
+ let nanoid = (size = 21) => {
148
+ let id = "";
149
+ let bytes = crypto.getRandomValues(new Uint8Array(size |= 0));
150
+ while (size--) id += urlAlphabet[bytes[size] & 63];
151
+ return id;
152
+ };
153
+ //#endregion
154
+ //#region src/utils.ts
155
+ function createDocId(prefix) {
156
+ return `${prefix}${nanoid(8)}`;
157
+ }
158
+ //#endregion
159
+ //#region src/validator.ts
160
+ function validationErrorsToMessage(errors) {
161
+ if (errors instanceof Array) return errors.map((e) => {
162
+ if (typeof e === "object") return `"${e.instancePath}" ${e.message}`;
163
+ else return e;
164
+ }).join(", ");
165
+ else return errors;
166
+ }
167
+ var InvalidDataError = class extends Error {
168
+ constructor(message, errors) {
169
+ super(message + " " + validationErrorsToMessage(errors));
170
+ this.name = "InvalidDataError";
171
+ this.errors = errors;
172
+ }
173
+ };
174
+ function validateDocId(prefix, docId) {
175
+ if (!docId.startsWith(prefix) || docId.length <= 5 || docId.length > 128) throw new Error("Invalid document ID");
176
+ return true;
177
+ }
178
+ //#endregion
179
+ //#region src/note.ts
180
+ const NOTE_DOCID_PREFIX = "note:";
181
+ const TRASH_BOOK_ID = "trash";
182
+ const TEMPLATE_BOOK_ID = "template";
183
+ const NOTE_STATUS = {
184
+ NONE: "none",
185
+ ACTIVE: "active",
186
+ ON_HOLD: "onHold",
187
+ COMPLETED: "completed",
188
+ DROPPED: "dropped"
189
+ };
190
+ const NOTE_VISIBILITY = {
191
+ PRIVATE: "private",
192
+ PUBLIC: "public"
193
+ };
194
+ const validateNote = validators_note.default;
195
+ const NOTE_TITLE_MAX_LENGTH = 256;
196
+ function createNoteId() {
197
+ return createDocId(NOTE_DOCID_PREFIX);
198
+ }
199
+ function validateNoteId(docId) {
200
+ return validateDocId(NOTE_DOCID_PREFIX, docId);
201
+ }
202
+ //#endregion
203
+ //#region json-schema/book.json
204
+ var book_default = {
205
+ $schema: "http://json-schema.org/draft-07/schema#",
206
+ $id: "book",
207
+ title: "Book",
208
+ description: "A notebook data",
209
+ type: "object",
210
+ properties: {
211
+ "_id": {
212
+ "description": "The unique notebook ID which should start with `book:` and the remains are randomly generated string",
213
+ "type": "string",
214
+ "minLength": 6,
215
+ "maxLength": 128,
216
+ "pattern": "^book:"
217
+ },
218
+ "_rev": {
219
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
220
+ "type": "string"
221
+ },
222
+ "name": {
223
+ "description": "The notebook name",
224
+ "type": "string",
225
+ "minLength": 1,
226
+ "maxLength": 64
227
+ },
228
+ "updatedAt": {
229
+ "description": "The date time when the notebook was last updated, represented with Unix timestamps in milliseconds",
230
+ "type": "number"
231
+ },
232
+ "createdAt": {
233
+ "description": "The date time when the notebook was created, represented with Unix timestamps in milliseconds",
234
+ "type": "number"
235
+ },
236
+ "count": {
237
+ "description": "It indicates the number of notes in the notebook",
238
+ "type": "number"
239
+ },
240
+ "parentBookId": {
241
+ "description": "The ID of the parent notebook",
242
+ "type": ["string", "null"]
243
+ },
244
+ "order": {
245
+ "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.",
246
+ "type": "number"
247
+ },
248
+ "icon": {
249
+ "description": "Custom icon for the notebook",
250
+ "type": "object",
251
+ "oneOf": [{
252
+ "properties": {
253
+ "type": {
254
+ "description": "Icon storage type",
255
+ "const": "inline"
256
+ },
257
+ "svg": {
258
+ "description": "The SVG icon data. Must be less than 256kb",
259
+ "type": "string",
260
+ "maxLength": 262144
261
+ }
262
+ },
263
+ "required": ["type", "svg"]
264
+ }, {
265
+ "properties": {
266
+ "type": {
267
+ "description": "Icon storage type",
268
+ "const": "file"
269
+ },
270
+ "docId": {
271
+ "description": "The document ID for the attachment file",
272
+ "type": "string",
273
+ "pattern": "^file:",
274
+ "minLength": 6,
275
+ "maxLength": 128
276
+ }
277
+ },
278
+ "required": ["type", "docId"]
279
+ }]
280
+ }
281
+ },
282
+ required: [
283
+ "_id",
284
+ "name",
285
+ "updatedAt",
286
+ "createdAt"
287
+ ]
288
+ };
289
+ //#endregion
290
+ //#region src/book.ts
291
+ const BOOK_DOCID_PREFIX = "book:";
292
+ const validateBook = validators_book.default;
293
+ function createBookId() {
294
+ return createDocId(BOOK_DOCID_PREFIX);
295
+ }
296
+ function validateBookId(docId) {
297
+ return validateDocId(BOOK_DOCID_PREFIX, docId);
298
+ }
299
+ //#endregion
300
+ //#region json-schema/tag.json
301
+ var tag_default = {
302
+ $schema: "http://json-schema.org/draft-07/schema#",
303
+ $id: "tag",
304
+ title: "Tag",
305
+ description: "A note tag",
306
+ type: "object",
307
+ properties: {
308
+ "_id": {
309
+ "description": "The unique tag ID which should start with `tag:` and the remains are randomly generated string",
310
+ "type": "string",
311
+ "minLength": 6,
312
+ "maxLength": 128,
313
+ "pattern": "^tag:"
314
+ },
315
+ "_rev": {
316
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
317
+ "type": "string"
318
+ },
319
+ "name": {
320
+ "description": "The name of the tag",
321
+ "type": "string",
322
+ "maxLength": 64
323
+ },
324
+ "count": {
325
+ "description": "It indicates the number of notes with the tag",
326
+ "type": "number"
327
+ },
328
+ "color": {
329
+ "description": "The color type of the tag",
330
+ "type": "string",
331
+ "enum": [
332
+ "default",
333
+ "red",
334
+ "orange",
335
+ "yellow",
336
+ "olive",
337
+ "green",
338
+ "teal",
339
+ "blue",
340
+ "violet",
341
+ "purple",
342
+ "pink",
343
+ "brown",
344
+ "grey",
345
+ "black"
346
+ ]
347
+ },
348
+ "updatedAt": {
349
+ "description": "The date time when the tag was last updated, represented with Unix timestamps in milliseconds",
350
+ "type": "number"
351
+ },
352
+ "createdAt": {
353
+ "description": "The date time when the tag was created, represented with Unix timestamps in milliseconds",
354
+ "type": "number"
355
+ }
356
+ },
357
+ required: [
358
+ "_id",
359
+ "name",
360
+ "count",
361
+ "updatedAt",
362
+ "createdAt"
363
+ ]
364
+ };
365
+ //#endregion
366
+ //#region src/tag.ts
367
+ const TAG_COLOR = {
368
+ DEFAULT: "default",
369
+ RED: "red",
370
+ ORANGE: "orange",
371
+ YELLOW: "yellow",
372
+ OLIVE: "olive",
373
+ GREEN: "green",
374
+ TEAL: "teal",
375
+ BLUE: "blue",
376
+ VIOLET: "violet",
377
+ PURPLE: "purple",
378
+ PINK: "pink",
379
+ BROWN: "brown",
380
+ GREY: "grey",
381
+ BLACK: "black"
382
+ };
383
+ const TAG_DOCID_PREFIX = "tag:";
384
+ const validateTag = validators_tag.default;
385
+ function createTagId() {
386
+ return createDocId(TAG_DOCID_PREFIX);
387
+ }
388
+ function validateTagId(docId) {
389
+ return validateDocId(TAG_DOCID_PREFIX, docId);
390
+ }
391
+ //#endregion
392
+ //#region json-schema/file.json
393
+ var file_default = {
394
+ $schema: "http://json-schema.org/draft-07/schema#",
395
+ $id: "file",
396
+ title: "File",
397
+ description: "An attachment file",
398
+ type: "object",
399
+ properties: {
400
+ "_id": {
401
+ "description": "The unique document ID which should start with `file:` and the remains are randomly generated string",
402
+ "type": "string",
403
+ "minLength": 6,
404
+ "maxLength": 128,
405
+ "pattern": "^file:"
406
+ },
407
+ "_rev": {
408
+ "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
409
+ "type": "string"
410
+ },
411
+ "name": {
412
+ "description": "The file name",
413
+ "type": "string",
414
+ "minLength": 1,
415
+ "maxLength": 128
416
+ },
417
+ "createdAt": {
418
+ "description": "The date time when the note was created, represented with Unix timestamps in milliseconds",
419
+ "type": "number"
420
+ },
421
+ "contentType": {
422
+ "description": "The MIME type of the content",
423
+ "type": "string",
424
+ "enum": [
425
+ "image/png",
426
+ "image/jpeg",
427
+ "image/jpg",
428
+ "image/svg+xml",
429
+ "image/gif",
430
+ "image/heic",
431
+ "image/heif"
432
+ ],
433
+ "maxLength": 128
434
+ },
435
+ "contentLength": {
436
+ "description": "The content length of the file",
437
+ "type": "number",
438
+ "maximum": 10485760
439
+ },
440
+ "publicIn": {
441
+ "description": "An array of the note IDs where the file is included",
442
+ "type": "array",
443
+ "items": { "type": "string" },
444
+ "uniqueItems": true
445
+ },
446
+ "_attachments": {
447
+ "description": "The attachment file",
448
+ "type": "object",
449
+ "properties": { "index": {
450
+ "description": "The attachment file",
451
+ "type": "object",
452
+ "properties": {
453
+ "content_type": {
454
+ "description": "The content type of the file",
455
+ "type": "string",
456
+ "enum": [
457
+ "image/png",
458
+ "image/jpeg",
459
+ "image/jpg",
460
+ "image/svg+xml",
461
+ "image/gif",
462
+ "image/heic",
463
+ "image/heif"
464
+ ]
465
+ },
466
+ "data": {
467
+ "description": "The file data",
468
+ "type": ["string", "object"]
469
+ }
470
+ },
471
+ "required": ["content_type", "data"]
472
+ } },
473
+ "required": ["index"]
474
+ }
475
+ },
476
+ required: [
477
+ "_id",
478
+ "name",
479
+ "createdAt",
480
+ "contentType",
481
+ "contentLength",
482
+ "publicIn",
483
+ "_attachments"
484
+ ]
485
+ };
486
+ //#endregion
487
+ //#region src/file.ts
488
+ const supportedImageFileTypes = [
489
+ "image/png",
490
+ "image/jpeg",
491
+ "image/jpg",
492
+ "image/svg+xml",
493
+ "image/gif",
494
+ "image/heic",
495
+ "image/heif"
496
+ ];
497
+ const SUPPORTED_IMAGE_MIME_TYPES = {
498
+ ...supportedImageFileTypes.reduce((hash, ft) => ({
499
+ ...hash,
500
+ [ft.split("/")[1]]: ft
501
+ }), {}),
502
+ jpg: "image/jpeg"
503
+ };
504
+ const maxAttachmentFileSize = 10 * 1024 * 1024;
505
+ const FILE_DOCID_PREFIX = "file:";
506
+ const validateFile = validators_file.default;
507
+ function createFileId() {
508
+ return createDocId(FILE_DOCID_PREFIX);
509
+ }
510
+ function validateFileId(docId) {
511
+ return validateDocId(FILE_DOCID_PREFIX, docId);
512
+ }
513
+ //#endregion
514
+ exports.BOOK_DOCID_PREFIX = BOOK_DOCID_PREFIX;
515
+ Object.defineProperty(exports, "BookSchema", {
516
+ enumerable: true,
517
+ get: function() {
518
+ return book_default;
519
+ }
520
+ });
521
+ exports.FILE_DOCID_PREFIX = FILE_DOCID_PREFIX;
522
+ Object.defineProperty(exports, "FileSchema", {
523
+ enumerable: true,
524
+ get: function() {
525
+ return file_default;
526
+ }
527
+ });
528
+ exports.InvalidDataError = InvalidDataError;
529
+ exports.NOTE_DOCID_PREFIX = NOTE_DOCID_PREFIX;
530
+ exports.NOTE_STATUS = NOTE_STATUS;
531
+ exports.NOTE_TITLE_MAX_LENGTH = NOTE_TITLE_MAX_LENGTH;
532
+ exports.NOTE_VISIBILITY = NOTE_VISIBILITY;
533
+ Object.defineProperty(exports, "NoteSchema", {
534
+ enumerable: true,
535
+ get: function() {
536
+ return note_default;
537
+ }
538
+ });
539
+ exports.SUPPORTED_IMAGE_MIME_TYPES = SUPPORTED_IMAGE_MIME_TYPES;
540
+ exports.TAG_COLOR = TAG_COLOR;
541
+ exports.TAG_DOCID_PREFIX = TAG_DOCID_PREFIX;
542
+ exports.TEMPLATE_BOOK_ID = TEMPLATE_BOOK_ID;
543
+ exports.TRASH_BOOK_ID = TRASH_BOOK_ID;
544
+ Object.defineProperty(exports, "TagSchema", {
545
+ enumerable: true,
546
+ get: function() {
547
+ return tag_default;
548
+ }
549
+ });
550
+ exports.createBookId = createBookId;
551
+ exports.createDocId = createDocId;
552
+ exports.createFileId = createFileId;
553
+ exports.createNoteId = createNoteId;
554
+ exports.createTagId = createTagId;
555
+ exports.maxAttachmentFileSize = maxAttachmentFileSize;
556
+ exports.supportedImageFileTypes = supportedImageFileTypes;
557
+ exports.validateBook = validateBook;
558
+ exports.validateBookId = validateBookId;
559
+ exports.validateDocId = validateDocId;
560
+ exports.validateFile = validateFile;
561
+ exports.validateFileId = validateFileId;
562
+ exports.validateNote = validateNote;
563
+ exports.validateNoteId = validateNoteId;
564
+ exports.validateTag = validateTag;
565
+ exports.validateTagId = validateTagId;
566
+ exports.validationErrorsToMessage = validationErrorsToMessage;
567
+
568
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.js","names":["validator","validator","validator","validator"],"sources":["../json-schema/note.json","../node_modules/.pnpm/nanoid@6.0.0/node_modules/nanoid/url-alphabet/index.js","../node_modules/.pnpm/nanoid@6.0.0/node_modules/nanoid/index.browser.js","../src/utils.ts","../src/validator.ts","../src/note.ts","../json-schema/book.json","../src/book.ts","../json-schema/tag.json","../src/tag.ts","../json-schema/file.json","../src/file.ts"],"sourcesContent":["","export let urlAlphabet =\n 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'\n","\n\nimport { urlAlphabet } from './url-alphabet/index.js'\n\nexport { urlAlphabet }\n\nexport let random = bytes => crypto.getRandomValues(new Uint8Array(bytes))\n\nexport let customRandom = (alphabet, defaultSize, getRandom) => {\n let safeByteCutoff = 256 - (256 % alphabet.length)\n\n if (safeByteCutoff === 256) {\n let mask = alphabet.length - 1\n\n return (size = defaultSize) => {\n if (!size) return ''\n let id = ''\n while (true) {\n let bytes = getRandom(size)\n let j = size\n while (j--) {\n id += alphabet[bytes[j] & mask]\n if (id.length >= size) return id\n }\n }\n }\n }\n\n let step = Math.ceil((1.6 * 256 * defaultSize) / safeByteCutoff)\n\n return (size = defaultSize) => {\n if (!size) return ''\n let id = ''\n while (true) {\n let bytes = getRandom(step)\n let j = step\n while (j--) {\n if (bytes[j] < safeByteCutoff) {\n id += alphabet[bytes[j] % alphabet.length]\n if (id.length >= size) return id\n }\n }\n }\n }\n}\n\nexport let customAlphabet = (alphabet, size = 21) =>\n customRandom(alphabet, size | 0, random)\n\nexport let nanoid = (size = 21) => {\n let id = ''\n let bytes = crypto.getRandomValues(new Uint8Array((size |= 0)))\n while (size--) {\n id += urlAlphabet[bytes[size] & 63]\n }\n return id\n}\n","import { nanoid } from 'nanoid'\n\nexport function createDocId(prefix: string): string {\n const id = nanoid(8)\n return `${prefix}${id}`\n}\n","import type { ErrorObject } from 'ajv'\n\nexport function validationErrorsToMessage(errors: ErrorObject[]): string {\n if (errors instanceof Array) {\n return errors\n .map(e => {\n if (typeof e === 'object') {\n return `\"${e.instancePath}\" ${e.message}`\n } else {\n return e\n }\n })\n .join(', ')\n } else {\n return errors\n }\n}\nexport class InvalidDataError extends Error {\n name = 'InvalidDataError'\n errors: ErrorObject[]\n\n constructor(message: string, errors: ErrorObject[]) {\n super(message + ' ' + validationErrorsToMessage(errors))\n this.errors = errors\n }\n}\n\nexport function validateDocId(prefix: string, docId: string): boolean {\n if (!docId.startsWith(prefix) || docId.length <= 5 || docId.length > 128) {\n throw new Error('Invalid document ID')\n }\n return true\n}\n","import type { ValidateFunction } from 'ajv'\nimport NoteSchema from '../json-schema/note.json'\nimport validator from '../validators/note'\nimport type { EncryptedData } from './crypto'\nimport { createDocId } from './utils'\nimport { validateDocId } from './validator'\nexport type TrashBookId = 'trash'\nexport type TemplateBookId = 'template'\nexport type NoteStatus = 'none' | 'active' | 'onHold' | 'completed' | 'dropped'\nexport type NoteVisibility = 'private' | 'public'\nexport type NoteMetadata = {\n _id: string\n _rev?: string\n bookId: string\n doctype: string\n updatedAt: number\n createdAt: number\n tags?: string[]\n numOfTasks?: number\n numOfCheckedTasks?: number\n migratedBy?: string\n status?: NoteStatus\n share?: NoteVisibility\n pinned?: boolean\n timestamp: number\n _conflicts?: string[]\n}\nexport const NOTE_DOCID_PREFIX = 'note:'\nexport type Note = NoteMetadata & {\n title: string\n body: string\n}\nexport type EncryptedNote = NoteMetadata & {\n encryptedData: EncryptedData\n}\nexport const TRASH_BOOK_ID = 'trash'\nexport const TEMPLATE_BOOK_ID = 'template'\n\nexport const NOTE_STATUS: Readonly<{\n NONE: 'none'\n ACTIVE: 'active'\n ON_HOLD: 'onHold'\n COMPLETED: 'completed'\n DROPPED: 'dropped'\n}> = {\n NONE: 'none',\n ACTIVE: 'active',\n ON_HOLD: 'onHold',\n COMPLETED: 'completed',\n DROPPED: 'dropped'\n}\nexport const NOTE_VISIBILITY: Readonly<{\n PRIVATE: 'private'\n PUBLIC: 'public'\n}> = {\n PRIVATE: 'private',\n PUBLIC: 'public'\n}\nconst validateNote: ValidateFunction<Note> = validator as any\nexport { NoteSchema, validateNote }\n\nexport const NOTE_TITLE_MAX_LENGTH: number = 256\n\nexport function createNoteId(): string {\n return createDocId(NOTE_DOCID_PREFIX)\n}\n\nexport function validateNoteId(docId: string): boolean {\n return validateDocId(NOTE_DOCID_PREFIX, docId)\n}\n","","import type { ValidateFunction } from 'ajv'\nimport BookSchema from '../json-schema/book.json'\nimport validator from '../validators/book'\n\nimport type { EncryptedData } from './crypto'\nimport { createDocId } from './utils'\nimport { validateDocId } from './validator'\n\nexport type BookIconInline = {\n type: 'inline'\n svg: string\n}\nexport type BookIconFile = {\n type: 'file'\n docId: string\n}\nexport type BookIcon = BookIconInline | BookIconFile\n\nexport type BookMetadata = {\n _id: string\n _rev?: string\n updatedAt: number\n createdAt: number\n count?: number\n parentBookId?: null | string\n migratedBy?: string\n icon?: BookIcon\n order?: number\n}\nexport type Book = BookMetadata & {\n name: string\n}\nexport type EncryptedBook = BookMetadata & {\n encryptedData: EncryptedData\n}\n\nexport const BOOK_DOCID_PREFIX = 'book:'\n\nconst validateBook: ValidateFunction<Book> = validator as any\nexport { BookSchema, validateBook }\n\nexport function createBookId(): string {\n return createDocId(BOOK_DOCID_PREFIX)\n}\n\nexport function validateBookId(docId: string): boolean {\n return validateDocId(BOOK_DOCID_PREFIX, docId)\n}\n","","import type { ValidateFunction } from 'ajv'\nimport TagSchema from '../json-schema/tag.json'\nimport validator from '../validators/tag'\nimport type { EncryptedData } from './crypto'\nimport { createDocId } from './utils'\nimport { validateDocId } from './validator'\nexport type TagColor =\n | 'default'\n | 'red'\n | 'orange'\n | 'yellow'\n | 'olive'\n | 'green'\n | 'teal'\n | 'blue'\n | 'violet'\n | 'purple'\n | 'pink'\n | 'brown'\n | 'grey'\n | 'black'\nexport const TAG_COLOR: Readonly<{\n DEFAULT: 'default'\n RED: 'red'\n ORANGE: 'orange'\n YELLOW: 'yellow'\n OLIVE: 'olive'\n GREEN: 'green'\n TEAL: 'teal'\n BLUE: 'blue'\n VIOLET: 'violet'\n PURPLE: 'purple'\n PINK: 'pink'\n BROWN: 'brown'\n GREY: 'grey'\n BLACK: 'black'\n}> = {\n DEFAULT: 'default',\n RED: 'red',\n ORANGE: 'orange',\n YELLOW: 'yellow',\n OLIVE: 'olive',\n GREEN: 'green',\n TEAL: 'teal',\n BLUE: 'blue',\n VIOLET: 'violet',\n PURPLE: 'purple',\n PINK: 'pink',\n BROWN: 'brown',\n GREY: 'grey',\n BLACK: 'black'\n}\nexport type TagMetadata = {\n _id: string\n _rev?: string\n count?: number\n color: TagColor\n updatedAt: number\n createdAt: number\n}\nexport type Tag = TagMetadata & {\n name: string\n}\nexport type EncryptedTag = TagMetadata & {\n encryptedData: EncryptedData\n}\n\nexport const TAG_DOCID_PREFIX = 'tag:'\n\nconst validateTag: ValidateFunction<Tag> = validator as any\nexport { TagSchema, validateTag }\n\nexport function createTagId(): string {\n return createDocId(TAG_DOCID_PREFIX)\n}\n\nexport function validateTagId(docId: string): boolean {\n return validateDocId(TAG_DOCID_PREFIX, docId)\n}\n","","import type { ValidateFunction } from 'ajv'\nimport FileSchema from '../json-schema/file.json'\nimport validator from '../validators/file'\nimport type { EncryptionMetadata } from './crypto'\nimport { createDocId } from './utils'\nimport { validateDocId } from './validator'\nexport type ImageFileType =\n | 'image/png'\n | 'image/jpeg'\n | 'image/jpg'\n | 'image/svg+xml'\n | 'image/gif'\n | 'image/heic'\n | 'image/heif'\nexport const supportedImageFileTypes: ReadonlyArray<ImageFileType> = [\n 'image/png',\n 'image/jpeg',\n 'image/jpg',\n 'image/svg+xml',\n 'image/gif',\n 'image/heic',\n 'image/heif'\n]\nexport const SUPPORTED_IMAGE_MIME_TYPES: {\n readonly [mime: string]: ImageFileType\n} = {\n ...supportedImageFileTypes.reduce(\n (hash, ft) => ({ ...hash, [ft.split('/')[1]]: ft }),\n {} as Record<string, ImageFileType>\n ),\n jpg: 'image/jpeg'\n}\nexport const maxAttachmentFileSize: number = 10 * 1024 * 1024\nexport type FileAttachmentItem = {\n digest?: string\n content_type: ImageFileType\n data: Buffer | string\n length?: number\n}\nexport type File = {\n _id: string\n _rev?: string\n name: string\n createdAt: number\n contentType: ImageFileType\n contentLength: number\n publicIn: string[]\n _attachments: {\n index: FileAttachmentItem\n }\n md5digest?: string\n}\nexport type EncryptedFile = File & {\n encryptionData: EncryptionMetadata\n}\n\nexport const FILE_DOCID_PREFIX = 'file:'\n\nconst validateFile: ValidateFunction<File> = validator as any\nexport { FileSchema, validateFile }\n\nexport function createFileId(): string {\n return createDocId(FILE_DOCID_PREFIX)\n}\n\nexport function validateFileId(docId: string): boolean {\n return validateDocId(FILE_DOCID_PREFIX, docId)\n}\n"],"x_google_ignoreList":[1,2],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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