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