inkdrop-model 2.6.1 → 2.7.1

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.
@@ -1,340 +0,0 @@
1
- 'use strict';
2
- var ucs2length = require('ajv/lib/compile/ucs2length');
3
- var equal = require('ajv/lib/compile/equal');
4
- var validate = (function() {
5
- var pattern0 = new RegExp('^tag:');
6
- var refVal = [];
7
- return function validate(data, dataPath, parentData, parentDataProperty, rootData) {
8
- 'use strict'; /*# sourceURL=tag */
9
- var vErrors = null;
10
- var errors = 0;
11
- if ((data && typeof data === "object" && !Array.isArray(data))) {
12
- if (true) {
13
- var errs__0 = errors;
14
- var valid1 = true;
15
- var data1 = data._id;
16
- if (data1 === undefined) {
17
- valid1 = false;
18
- validate.errors = [{
19
- keyword: 'required',
20
- dataPath: (dataPath || '') + "",
21
- schemaPath: '#/required',
22
- params: {
23
- missingProperty: '_id'
24
- },
25
- message: 'should have required property \'_id\''
26
- }];
27
- return false;
28
- } else {
29
- var errs_1 = errors;
30
- if (typeof data1 === "string") {
31
- if (ucs2length(data1) > 128) {
32
- validate.errors = [{
33
- keyword: 'maxLength',
34
- dataPath: (dataPath || '') + '._id',
35
- schemaPath: '#/properties/_id/maxLength',
36
- params: {
37
- limit: 128
38
- },
39
- message: 'should NOT be longer than 128 characters'
40
- }];
41
- return false;
42
- } else {
43
- if (ucs2length(data1) < 6) {
44
- validate.errors = [{
45
- keyword: 'minLength',
46
- dataPath: (dataPath || '') + '._id',
47
- schemaPath: '#/properties/_id/minLength',
48
- params: {
49
- limit: 6
50
- },
51
- message: 'should NOT be shorter than 6 characters'
52
- }];
53
- return false;
54
- } else {
55
- if (!pattern0.test(data1)) {
56
- validate.errors = [{
57
- keyword: 'pattern',
58
- dataPath: (dataPath || '') + '._id',
59
- schemaPath: '#/properties/_id/pattern',
60
- params: {
61
- pattern: '^tag:'
62
- },
63
- message: 'should match pattern "^tag:"'
64
- }];
65
- return false;
66
- }
67
- }
68
- }
69
- } else {
70
- validate.errors = [{
71
- keyword: 'type',
72
- dataPath: (dataPath || '') + '._id',
73
- schemaPath: '#/properties/_id/type',
74
- params: {
75
- type: 'string'
76
- },
77
- message: 'should be string'
78
- }];
79
- return false;
80
- }
81
- var valid1 = errors === errs_1;
82
- }
83
- if (valid1) {
84
- if (data._rev === undefined) {
85
- valid1 = true;
86
- } else {
87
- var errs_1 = errors;
88
- if (typeof data._rev !== "string") {
89
- validate.errors = [{
90
- keyword: 'type',
91
- dataPath: (dataPath || '') + '._rev',
92
- schemaPath: '#/properties/_rev/type',
93
- params: {
94
- type: 'string'
95
- },
96
- message: 'should be string'
97
- }];
98
- return false;
99
- }
100
- var valid1 = errors === errs_1;
101
- }
102
- if (valid1) {
103
- var data1 = data.name;
104
- if (data1 === undefined) {
105
- valid1 = false;
106
- validate.errors = [{
107
- keyword: 'required',
108
- dataPath: (dataPath || '') + "",
109
- schemaPath: '#/required',
110
- params: {
111
- missingProperty: 'name'
112
- },
113
- message: 'should have required property \'name\''
114
- }];
115
- return false;
116
- } else {
117
- var errs_1 = errors;
118
- if (typeof data1 === "string") {
119
- if (ucs2length(data1) > 64) {
120
- validate.errors = [{
121
- keyword: 'maxLength',
122
- dataPath: (dataPath || '') + '.name',
123
- schemaPath: '#/properties/name/maxLength',
124
- params: {
125
- limit: 64
126
- },
127
- message: 'should NOT be longer than 64 characters'
128
- }];
129
- return false;
130
- }
131
- } else {
132
- validate.errors = [{
133
- keyword: 'type',
134
- dataPath: (dataPath || '') + '.name',
135
- schemaPath: '#/properties/name/type',
136
- params: {
137
- type: 'string'
138
- },
139
- message: 'should be string'
140
- }];
141
- return false;
142
- }
143
- var valid1 = errors === errs_1;
144
- }
145
- if (valid1) {
146
- if (data.count === undefined) {
147
- valid1 = false;
148
- validate.errors = [{
149
- keyword: 'required',
150
- dataPath: (dataPath || '') + "",
151
- schemaPath: '#/required',
152
- params: {
153
- missingProperty: 'count'
154
- },
155
- message: 'should have required property \'count\''
156
- }];
157
- return false;
158
- } else {
159
- var errs_1 = errors;
160
- if (typeof data.count !== "number") {
161
- validate.errors = [{
162
- keyword: 'type',
163
- dataPath: (dataPath || '') + '.count',
164
- schemaPath: '#/properties/count/type',
165
- params: {
166
- type: 'number'
167
- },
168
- message: 'should be number'
169
- }];
170
- return false;
171
- }
172
- var valid1 = errors === errs_1;
173
- }
174
- if (valid1) {
175
- var data1 = data.color;
176
- if (data1 === undefined) {
177
- valid1 = true;
178
- } else {
179
- var errs_1 = errors;
180
- if (typeof data1 !== "string") {
181
- validate.errors = [{
182
- keyword: 'type',
183
- dataPath: (dataPath || '') + '.color',
184
- schemaPath: '#/properties/color/type',
185
- params: {
186
- type: 'string'
187
- },
188
- message: 'should be string'
189
- }];
190
- return false;
191
- }
192
- var schema1 = validate.schema.properties.color.enum;
193
- var valid1;
194
- valid1 = false;
195
- for (var i1 = 0; i1 < schema1.length; i1++)
196
- if (equal(data1, schema1[i1])) {
197
- valid1 = true;
198
- break;
199
- } if (!valid1) {
200
- validate.errors = [{
201
- keyword: 'enum',
202
- dataPath: (dataPath || '') + '.color',
203
- schemaPath: '#/properties/color/enum',
204
- params: {
205
- allowedValues: schema1
206
- },
207
- message: 'should be equal to one of the allowed values'
208
- }];
209
- return false;
210
- }
211
- var valid1 = errors === errs_1;
212
- }
213
- if (valid1) {
214
- if (data.updatedAt === undefined) {
215
- valid1 = false;
216
- validate.errors = [{
217
- keyword: 'required',
218
- dataPath: (dataPath || '') + "",
219
- schemaPath: '#/required',
220
- params: {
221
- missingProperty: 'updatedAt'
222
- },
223
- message: 'should have required property \'updatedAt\''
224
- }];
225
- return false;
226
- } else {
227
- var errs_1 = errors;
228
- if (typeof data.updatedAt !== "number") {
229
- validate.errors = [{
230
- keyword: 'type',
231
- dataPath: (dataPath || '') + '.updatedAt',
232
- schemaPath: '#/properties/updatedAt/type',
233
- params: {
234
- type: 'number'
235
- },
236
- message: 'should be number'
237
- }];
238
- return false;
239
- }
240
- var valid1 = errors === errs_1;
241
- }
242
- if (valid1) {
243
- if (data.createdAt === undefined) {
244
- valid1 = false;
245
- validate.errors = [{
246
- keyword: 'required',
247
- dataPath: (dataPath || '') + "",
248
- schemaPath: '#/required',
249
- params: {
250
- missingProperty: 'createdAt'
251
- },
252
- message: 'should have required property \'createdAt\''
253
- }];
254
- return false;
255
- } else {
256
- var errs_1 = errors;
257
- if (typeof data.createdAt !== "number") {
258
- validate.errors = [{
259
- keyword: 'type',
260
- dataPath: (dataPath || '') + '.createdAt',
261
- schemaPath: '#/properties/createdAt/type',
262
- params: {
263
- type: 'number'
264
- },
265
- message: 'should be number'
266
- }];
267
- return false;
268
- }
269
- var valid1 = errors === errs_1;
270
- }
271
- }
272
- }
273
- }
274
- }
275
- }
276
- }
277
- }
278
- } else {
279
- validate.errors = [{
280
- keyword: 'type',
281
- dataPath: (dataPath || '') + "",
282
- schemaPath: '#/type',
283
- params: {
284
- type: 'object'
285
- },
286
- message: 'should be object'
287
- }];
288
- return false;
289
- }
290
- validate.errors = vErrors;
291
- return errors === 0;
292
- };
293
- })();
294
- validate.schema = {
295
- "$schema": "http://json-schema.org/draft-07/schema#",
296
- "id": "tag",
297
- "title": "Tag",
298
- "description": "A note tag",
299
- "type": "object",
300
- "properties": {
301
- "_id": {
302
- "description": "The unique tag ID which should start with `tag:` and the remains are randomly generated string",
303
- "type": "string",
304
- "minLength": 6,
305
- "maxLength": 128,
306
- "pattern": "^tag:",
307
- "example": "tag:0ebd717b"
308
- },
309
- "_rev": {
310
- "description": "This is a CouchDB specific field. The current MVCC-token/revision of this document (mandatory and immutable)",
311
- "type": "string",
312
- "example": "14-813af5085bb6a2648c3f0aca37fc821f"
313
- },
314
- "name": {
315
- "description": "The name of the tag",
316
- "type": "string",
317
- "maxLength": 64
318
- },
319
- "count": {
320
- "description": "It indicates the number of notes with the tag",
321
- "type": "number"
322
- },
323
- "color": {
324
- "description": "The color type of the tag",
325
- "type": "string",
326
- "enum": ["default", "red", "orange", "yellow", "olive", "green", "teal", "blue", "violet", "purple", "pink", "brown", "grey", "black"]
327
- },
328
- "updatedAt": {
329
- "description": "The date time when the tag was last updated, represented with Unix timestamps in milliseconds",
330
- "type": "number"
331
- },
332
- "createdAt": {
333
- "description": "The date time when the tag was created, represented with Unix timestamps in milliseconds",
334
- "type": "number"
335
- }
336
- },
337
- "required": ["_id", "name", "count", "updatedAt", "createdAt"]
338
- };
339
- validate.errors = null;
340
- module.exports = validate;