inkdrop-model 2.11.4 → 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,519 +1,450 @@
1
- import validator from '../validators/note';
2
- import { nanoid } from 'nanoid';
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
-
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
121
+ const POOL_SIZE_MULTIPLIER = 128;
122
+ let pool, poolOffset;
123
+ function fillPool(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;
139
+ }
140
+ function nanoid(size = 21) {
141
+ fillPool(size |= 0);
142
+ let id = "";
143
+ for (let i = poolOffset - size; i < poolOffset; i++) id += urlAlphabet[pool[i] & 63];
144
+ return id;
145
+ }
146
+ //#endregion
147
+ //#region src/utils.ts
133
148
  function createDocId(prefix) {
134
- var id = nanoid(8);
135
- return "".concat(prefix).concat(id);
149
+ return `${prefix}${nanoid(8)}`;
136
150
  }
137
-
138
- /******************************************************************************
139
- Copyright (c) Microsoft Corporation.
140
-
141
- Permission to use, copy, modify, and/or distribute this software for any
142
- purpose with or without fee is hereby granted.
143
-
144
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
145
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
146
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
147
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
148
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
149
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
150
- PERFORMANCE OF THIS SOFTWARE.
151
- ***************************************************************************** */
152
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
153
-
154
- var extendStatics = function(d, b) {
155
- extendStatics = Object.setPrototypeOf ||
156
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
157
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
158
- return extendStatics(d, b);
159
- };
160
-
161
- function __extends(d, b) {
162
- if (typeof b !== "function" && b !== null)
163
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
164
- extendStatics(d, b);
165
- function __() { this.constructor = d; }
166
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
167
- }
168
-
169
- var __assign = function() {
170
- __assign = Object.assign || function __assign(t) {
171
- for (var s, i = 1, n = arguments.length; i < n; i++) {
172
- s = arguments[i];
173
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
174
- }
175
- return t;
176
- };
177
- return __assign.apply(this, arguments);
178
- };
179
-
180
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
181
- var e = new Error(message);
182
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
183
- };
184
-
151
+ //#endregion
152
+ //#region src/validator.ts
185
153
  function validationErrorsToMessage(errors) {
186
- if (errors instanceof Array) {
187
- return errors
188
- .map(function (e) {
189
- if (typeof e === 'object') {
190
- return "\"".concat(e.instancePath, "\" ").concat(e.message);
191
- }
192
- else {
193
- return e;
194
- }
195
- })
196
- .join(', ');
197
- }
198
- else {
199
- return errors;
200
- }
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;
201
159
  }
202
- var InvalidDataError = /** @class */ (function (_super) {
203
- __extends(InvalidDataError, _super);
204
- function InvalidDataError(message, errors) {
205
- var _this = _super.call(this, message + ' ' + validationErrorsToMessage(errors)) || this;
206
- _this.name = 'InvalidDataError';
207
- _this.errors = errors;
208
- return _this;
209
- }
210
- return InvalidDataError;
211
- }(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
+ };
212
167
  function validateDocId(prefix, docId) {
213
- if (!docId.startsWith(prefix) || docId.length <= 5 || docId.length > 128) {
214
- throw new Error('Invalid document ID');
215
- }
216
- return true;
168
+ if (!docId.startsWith(prefix) || docId.length <= 5 || docId.length > 128) throw new Error("Invalid document ID");
169
+ return true;
217
170
  }
218
-
219
- var NOTE_DOCID_PREFIX = 'note:';
220
- var TRASH_BOOK_ID = 'trash';
221
- var NOTE_STATUS = {
222
- NONE: 'none',
223
- ACTIVE: 'active',
224
- ON_HOLD: 'onHold',
225
- COMPLETED: 'completed',
226
- 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"
227
181
  };
228
- var NOTE_VISIBILITY = {
229
- PRIVATE: 'private',
230
- PUBLIC: 'public'
182
+ const NOTE_VISIBILITY = {
183
+ PRIVATE: "private",
184
+ PUBLIC: "public"
231
185
  };
232
- var validateNote = validator;
233
- var NOTE_TITLE_MAX_LENGTH = 256;
186
+ const validateNote = validator;
187
+ const NOTE_TITLE_MAX_LENGTH = 256;
234
188
  function createNoteId() {
235
- return createDocId(NOTE_DOCID_PREFIX);
189
+ return createDocId(NOTE_DOCID_PREFIX);
236
190
  }
237
191
  function validateNoteId(docId) {
238
- return validateDocId(NOTE_DOCID_PREFIX, docId);
192
+ return validateDocId(NOTE_DOCID_PREFIX, docId);
239
193
  }
240
-
241
- var $schema$2 = "http://json-schema.org/draft-07/schema#";
242
- var $id$2 = "book";
243
- var title$2 = "Book";
244
- var description$2 = "A notebook data";
245
- var type$2 = "object";
246
- var properties$2 = {
247
- _id: {
248
- description: "The unique notebook ID which should start with `book:` and the remains are randomly generated string",
249
- type: "string",
250
- minLength: 6,
251
- maxLength: 128,
252
- pattern: "^book:"
253
- },
254
- _rev: {
255
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
256
- type: "string"
257
- },
258
- name: {
259
- description: "The notebook name",
260
- type: "string",
261
- minLength: 1,
262
- maxLength: 64
263
- },
264
- updatedAt: {
265
- description: "The date time when the notebook was last updated, represented with Unix timestamps in milliseconds",
266
- type: "number"
267
- },
268
- createdAt: {
269
- description: "The date time when the notebook was created, represented with Unix timestamps in milliseconds",
270
- type: "number"
271
- },
272
- count: {
273
- description: "It indicates the number of notes in the notebook",
274
- type: "number"
275
- },
276
- parentBookId: {
277
- description: "The ID of the parent notebook",
278
- type: [
279
- "string",
280
- "null"
281
- ]
282
- },
283
- order: {
284
- 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.",
285
- type: "number"
286
- },
287
- icon: {
288
- description: "Custom icon for the notebook",
289
- type: "object",
290
- oneOf: [
291
- {
292
- properties: {
293
- type: {
294
- 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",
295
247
  "const": "inline"
296
248
  },
297
- svg: {
298
- description: "The SVG icon data. Must be less than 256kb",
299
- type: "string",
300
- maxLength: 262144
249
+ "svg": {
250
+ "description": "The SVG icon data. Must be less than 256kb",
251
+ "type": "string",
252
+ "maxLength": 262144
301
253
  }
302
254
  },
303
- required: [
304
- "type",
305
- "svg"
306
- ]
307
- },
308
- {
309
- properties: {
310
- type: {
311
- description: "Icon storage type",
255
+ "required": ["type", "svg"]
256
+ }, {
257
+ "properties": {
258
+ "type": {
259
+ "description": "Icon storage type",
312
260
  "const": "file"
313
261
  },
314
- docId: {
315
- description: "The document ID for the attachment file",
316
- type: "string",
317
- pattern: "^file:",
318
- minLength: 6,
319
- 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
320
268
  }
321
269
  },
322
- required: [
323
- "type",
324
- "docId"
325
- ]
326
- }
327
- ]
328
- }
270
+ "required": ["type", "docId"]
271
+ }]
272
+ }
273
+ },
274
+ required: [
275
+ "_id",
276
+ "name",
277
+ "updatedAt",
278
+ "createdAt"
279
+ ]
329
280
  };
330
- var required$2 = [
331
- "_id",
332
- "name",
333
- "updatedAt",
334
- "createdAt"
335
- ];
336
- var book = {
337
- $schema: $schema$2,
338
- $id: $id$2,
339
- title: title$2,
340
- description: description$2,
341
- type: type$2,
342
- properties: properties$2,
343
- required: required$2
344
- };
345
-
346
- var BOOK_DOCID_PREFIX = 'book:';
347
- var validateBook = validator$1;
281
+ //#endregion
282
+ //#region src/book.ts
283
+ const BOOK_DOCID_PREFIX = "book:";
284
+ const validateBook = validator$1;
348
285
  function createBookId() {
349
- return createDocId(BOOK_DOCID_PREFIX);
286
+ return createDocId(BOOK_DOCID_PREFIX);
350
287
  }
351
288
  function validateBookId(docId) {
352
- return validateDocId(BOOK_DOCID_PREFIX, docId);
289
+ return validateDocId(BOOK_DOCID_PREFIX, docId);
353
290
  }
354
-
355
- var $schema$1 = "http://json-schema.org/draft-07/schema#";
356
- var $id$1 = "tag";
357
- var title$1 = "Tag";
358
- var description$1 = "A note tag";
359
- var type$1 = "object";
360
- var properties$1 = {
361
- _id: {
362
- description: "The unique tag ID which should start with `tag:` and the remains are randomly generated string",
363
- type: "string",
364
- minLength: 6,
365
- maxLength: 128,
366
- pattern: "^tag:"
367
- },
368
- _rev: {
369
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
370
- type: "string"
371
- },
372
- name: {
373
- description: "The name of the tag",
374
- type: "string",
375
- maxLength: 64
376
- },
377
- count: {
378
- description: "It indicates the number of notes with the tag",
379
- type: "number"
380
- },
381
- color: {
382
- description: "The color type of the tag",
383
- type: "string",
384
- "enum": [
385
- "default",
386
- "red",
387
- "orange",
388
- "yellow",
389
- "olive",
390
- "green",
391
- "teal",
392
- "blue",
393
- "violet",
394
- "purple",
395
- "pink",
396
- "brown",
397
- "grey",
398
- "black"
399
- ]
400
- },
401
- updatedAt: {
402
- description: "The date time when the tag was last updated, represented with Unix timestamps in milliseconds",
403
- type: "number"
404
- },
405
- createdAt: {
406
- description: "The date time when the tag was created, represented with Unix timestamps in milliseconds",
407
- type: "number"
408
- }
409
- };
410
- var required$1 = [
411
- "_id",
412
- "name",
413
- "count",
414
- "updatedAt",
415
- "createdAt"
416
- ];
417
- var tag = {
418
- $schema: $schema$1,
419
- $id: $id$1,
420
- title: title$1,
421
- description: description$1,
422
- type: type$1,
423
- properties: properties$1,
424
- 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
+ ]
425
356
  };
426
-
427
- var TAG_COLOR = {
428
- DEFAULT: 'default',
429
- RED: 'red',
430
- ORANGE: 'orange',
431
- YELLOW: 'yellow',
432
- OLIVE: 'olive',
433
- GREEN: 'green',
434
- TEAL: 'teal',
435
- BLUE: 'blue',
436
- VIOLET: 'violet',
437
- PURPLE: 'purple',
438
- PINK: 'pink',
439
- BROWN: 'brown',
440
- GREY: 'grey',
441
- 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"
442
374
  };
443
- var TAG_DOCID_PREFIX = 'tag:';
444
- var validateTag = validator$2;
375
+ const TAG_DOCID_PREFIX = "tag:";
376
+ const validateTag = validator$2;
445
377
  function createTagId() {
446
- return createDocId(TAG_DOCID_PREFIX);
378
+ return createDocId(TAG_DOCID_PREFIX);
447
379
  }
448
380
  function validateTagId(docId) {
449
- return validateDocId(TAG_DOCID_PREFIX, docId);
381
+ return validateDocId(TAG_DOCID_PREFIX, docId);
450
382
  }
451
-
452
- var $schema = "http://json-schema.org/draft-07/schema#";
453
- var $id = "file";
454
- var title = "File";
455
- var description = "An attachment file";
456
- var type = "object";
457
- var properties = {
458
- _id: {
459
- description: "The unique document ID which should start with `file:` and the remains are randomly generated string",
460
- type: "string",
461
- minLength: 6,
462
- maxLength: 128,
463
- pattern: "^file:"
464
- },
465
- _rev: {
466
- description: "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable).",
467
- type: "string"
468
- },
469
- name: {
470
- description: "The file name",
471
- type: "string",
472
- minLength: 1,
473
- maxLength: 128
474
- },
475
- createdAt: {
476
- description: "The date time when the note was created, represented with Unix timestamps in milliseconds",
477
- type: "number"
478
- },
479
- contentType: {
480
- description: "The MIME type of the content",
481
- type: "string",
482
- "enum": [
483
- "image/png",
484
- "image/jpeg",
485
- "image/jpg",
486
- "image/svg+xml",
487
- "image/gif",
488
- "image/heic",
489
- "image/heif"
490
- ],
491
- maxLength: 128
492
- },
493
- contentLength: {
494
- description: "The content length of the file",
495
- type: "number",
496
- maximum: 10485760
497
- },
498
- publicIn: {
499
- description: "An array of the note IDs where the file is included",
500
- type: "array",
501
- items: {
502
- 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:"
503
398
  },
504
- uniqueItems: true
505
- },
506
- _attachments: {
507
- description: "The attachment file",
508
- type: "object",
509
- properties: {
510
- index: {
511
- description: "The attachment file",
512
- type: "object",
513
- properties: {
514
- content_type: {
515
- description: "The content type of the file",
516
- 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",
517
448
  "enum": [
518
449
  "image/png",
519
450
  "image/jpeg",
@@ -524,66 +455,54 @@ var properties = {
524
455
  "image/heif"
525
456
  ]
526
457
  },
527
- data: {
528
- description: "The file data",
529
- type: [
530
- "string",
531
- "object"
532
- ]
458
+ "data": {
459
+ "description": "The file data",
460
+ "type": ["string", "object"]
533
461
  }
534
462
  },
535
- required: [
536
- "content_type",
537
- "data"
538
- ]
539
- }
540
- },
541
- required: [
542
- "index"
543
- ]
544
- }
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
+ ]
545
477
  };
546
- var required = [
547
- "_id",
548
- "name",
549
- "createdAt",
550
- "contentType",
551
- "contentLength",
552
- "publicIn",
553
- "_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"
554
488
  ];
555
- var file = {
556
- $schema: $schema,
557
- $id: $id,
558
- title: title,
559
- description: description,
560
- type: type,
561
- properties: properties,
562
- 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"
563
495
  };
564
-
565
- var supportedImageFileTypes = [
566
- 'image/png',
567
- 'image/jpeg',
568
- 'image/jpg',
569
- 'image/svg+xml',
570
- 'image/gif',
571
- 'image/heic',
572
- 'image/heif'
573
- ];
574
- var SUPPORTED_IMAGE_MIME_TYPES = __assign(__assign({}, supportedImageFileTypes.reduce(function (hash, ft) {
575
- var _a;
576
- return (__assign(__assign({}, hash), (_a = {}, _a[ft.split('/')[1]] = ft, _a)));
577
- }, {})), { jpg: 'image/jpeg' });
578
- var maxAttachmentFileSize = 10 * 1024 * 1024;
579
- var FILE_DOCID_PREFIX = 'file:';
580
- var validateFile = validator$3;
496
+ const maxAttachmentFileSize = 10 * 1024 * 1024;
497
+ const FILE_DOCID_PREFIX = "file:";
498
+ const validateFile = validator$3;
581
499
  function createFileId() {
582
- return createDocId(FILE_DOCID_PREFIX);
500
+ return createDocId(FILE_DOCID_PREFIX);
583
501
  }
584
502
  function validateFileId(docId) {
585
- return validateDocId(FILE_DOCID_PREFIX, docId);
503
+ return validateDocId(FILE_DOCID_PREFIX, docId);
586
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 };
587
507
 
588
- 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 };
589
- //# sourceMappingURL=index.esm.js.map
508
+ //# sourceMappingURL=index.esm.js.map