@naturalcycles/js-lib 14.101.0 → 14.102.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.
- package/dist/json-schema/jsonSchemaBuilder.d.ts +3 -0
- package/dist/json-schema/jsonSchemaBuilder.js +7 -2
- package/dist/json-schema/jsonSchemas.js +4 -4
- package/dist-esm/json-schema/jsonSchemaBuilder.js +7 -2
- package/dist-esm/json-schema/jsonSchemas.js +4 -4
- package/package.json +1 -1
- package/src/json-schema/jsonSchemaBuilder.ts +7 -2
- package/src/json-schema/jsonSchemas.ts +4 -4
|
@@ -19,6 +19,7 @@ export declare const jsonSchema: {
|
|
|
19
19
|
number(): JsonSchemaNumberBuilder;
|
|
20
20
|
integer(): JsonSchemaNumberBuilder;
|
|
21
21
|
unixTimestamp(): JsonSchemaNumberBuilder;
|
|
22
|
+
unixTimestamp2000(): JsonSchemaNumberBuilder;
|
|
22
23
|
string(): JsonSchemaStringBuilder;
|
|
23
24
|
dateString(): JsonSchemaStringBuilder;
|
|
24
25
|
object<T_4 extends AnyObject>(props: { [k in keyof T_4]: JsonSchemaAnyBuilder<T_4[k], JsonSchema<T_4[k]>>; }): JsonSchemaObjectBuilder<T_4>;
|
|
@@ -72,7 +73,9 @@ export declare class JsonSchemaNumberBuilder extends JsonSchemaAnyBuilder<number
|
|
|
72
73
|
float: () => this;
|
|
73
74
|
double: () => this;
|
|
74
75
|
unixTimestamp: () => this;
|
|
76
|
+
unixTimestamp2000: () => this;
|
|
75
77
|
unixTimestampMillis: () => this;
|
|
78
|
+
unixTimestampMillis2000: () => this;
|
|
76
79
|
utcOffset: () => this;
|
|
77
80
|
utcOffsetHours: () => this;
|
|
78
81
|
}
|
|
@@ -50,6 +50,9 @@ exports.jsonSchema = {
|
|
|
50
50
|
unixTimestamp() {
|
|
51
51
|
return new JsonSchemaNumberBuilder().unixTimestamp();
|
|
52
52
|
},
|
|
53
|
+
unixTimestamp2000() {
|
|
54
|
+
return new JsonSchemaNumberBuilder().unixTimestamp2000();
|
|
55
|
+
},
|
|
53
56
|
// string types
|
|
54
57
|
string() {
|
|
55
58
|
return new JsonSchemaStringBuilder();
|
|
@@ -167,7 +170,9 @@ class JsonSchemaNumberBuilder extends JsonSchemaAnyBuilder {
|
|
|
167
170
|
this.float = () => this.format('float');
|
|
168
171
|
this.double = () => this.format('double');
|
|
169
172
|
this.unixTimestamp = () => this.format('unixTimestamp');
|
|
173
|
+
this.unixTimestamp2000 = () => this.format('unixTimestamp2000');
|
|
170
174
|
this.unixTimestampMillis = () => this.format('unixTimestampMillis');
|
|
175
|
+
this.unixTimestampMillis2000 = () => this.format('unixTimestampMillis2000');
|
|
171
176
|
this.utcOffset = () => this.format('utcOffset');
|
|
172
177
|
this.utcOffsetHours = () => this.format('utcOffsetHours');
|
|
173
178
|
}
|
|
@@ -309,8 +314,8 @@ class JsonSchemaObjectBuilder extends JsonSchemaAnyBuilder {
|
|
|
309
314
|
baseDBEntity(idType = 'string') {
|
|
310
315
|
Object.assign(this.schema.properties, {
|
|
311
316
|
id: { type: idType },
|
|
312
|
-
created: { type: 'number', format: '
|
|
313
|
-
updated: { type: 'number', format: '
|
|
317
|
+
created: { type: 'number', format: 'unixTimestamp2000' },
|
|
318
|
+
updated: { type: 'number', format: 'unixTimestamp2000' },
|
|
314
319
|
});
|
|
315
320
|
return this;
|
|
316
321
|
}
|
|
@@ -4,11 +4,11 @@ exports.savedDBEntityJsonSchema = exports.baseDBEntityJsonSchema = void 0;
|
|
|
4
4
|
const jsonSchemaBuilder_1 = require("./jsonSchemaBuilder");
|
|
5
5
|
exports.baseDBEntityJsonSchema = jsonSchemaBuilder_1.jsonSchema.object({
|
|
6
6
|
id: jsonSchemaBuilder_1.jsonSchema.string().optional(),
|
|
7
|
-
created: jsonSchemaBuilder_1.jsonSchema.
|
|
8
|
-
updated: jsonSchemaBuilder_1.jsonSchema.
|
|
7
|
+
created: jsonSchemaBuilder_1.jsonSchema.unixTimestamp2000().optional(),
|
|
8
|
+
updated: jsonSchemaBuilder_1.jsonSchema.unixTimestamp2000().optional(),
|
|
9
9
|
});
|
|
10
10
|
exports.savedDBEntityJsonSchema = jsonSchemaBuilder_1.jsonSchema.object({
|
|
11
11
|
id: jsonSchemaBuilder_1.jsonSchema.string(),
|
|
12
|
-
created: jsonSchemaBuilder_1.jsonSchema.
|
|
13
|
-
updated: jsonSchemaBuilder_1.jsonSchema.
|
|
12
|
+
created: jsonSchemaBuilder_1.jsonSchema.unixTimestamp2000(),
|
|
13
|
+
updated: jsonSchemaBuilder_1.jsonSchema.unixTimestamp2000(),
|
|
14
14
|
});
|
|
@@ -47,6 +47,9 @@ export const jsonSchema = {
|
|
|
47
47
|
unixTimestamp() {
|
|
48
48
|
return new JsonSchemaNumberBuilder().unixTimestamp();
|
|
49
49
|
},
|
|
50
|
+
unixTimestamp2000() {
|
|
51
|
+
return new JsonSchemaNumberBuilder().unixTimestamp2000();
|
|
52
|
+
},
|
|
50
53
|
// string types
|
|
51
54
|
string() {
|
|
52
55
|
return new JsonSchemaStringBuilder();
|
|
@@ -163,7 +166,9 @@ export class JsonSchemaNumberBuilder extends JsonSchemaAnyBuilder {
|
|
|
163
166
|
this.float = () => this.format('float');
|
|
164
167
|
this.double = () => this.format('double');
|
|
165
168
|
this.unixTimestamp = () => this.format('unixTimestamp');
|
|
169
|
+
this.unixTimestamp2000 = () => this.format('unixTimestamp2000');
|
|
166
170
|
this.unixTimestampMillis = () => this.format('unixTimestampMillis');
|
|
171
|
+
this.unixTimestampMillis2000 = () => this.format('unixTimestampMillis2000');
|
|
167
172
|
this.utcOffset = () => this.format('utcOffset');
|
|
168
173
|
this.utcOffsetHours = () => this.format('utcOffsetHours');
|
|
169
174
|
}
|
|
@@ -304,8 +309,8 @@ export class JsonSchemaObjectBuilder extends JsonSchemaAnyBuilder {
|
|
|
304
309
|
baseDBEntity(idType = 'string') {
|
|
305
310
|
Object.assign(this.schema.properties, {
|
|
306
311
|
id: { type: idType },
|
|
307
|
-
created: { type: 'number', format: '
|
|
308
|
-
updated: { type: 'number', format: '
|
|
312
|
+
created: { type: 'number', format: 'unixTimestamp2000' },
|
|
313
|
+
updated: { type: 'number', format: 'unixTimestamp2000' },
|
|
309
314
|
});
|
|
310
315
|
return this;
|
|
311
316
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsonSchema } from './jsonSchemaBuilder';
|
|
2
2
|
export const baseDBEntityJsonSchema = jsonSchema.object({
|
|
3
3
|
id: jsonSchema.string().optional(),
|
|
4
|
-
created: jsonSchema.
|
|
5
|
-
updated: jsonSchema.
|
|
4
|
+
created: jsonSchema.unixTimestamp2000().optional(),
|
|
5
|
+
updated: jsonSchema.unixTimestamp2000().optional(),
|
|
6
6
|
});
|
|
7
7
|
export const savedDBEntityJsonSchema = jsonSchema.object({
|
|
8
8
|
id: jsonSchema.string(),
|
|
9
|
-
created: jsonSchema.
|
|
10
|
-
updated: jsonSchema.
|
|
9
|
+
created: jsonSchema.unixTimestamp2000(),
|
|
10
|
+
updated: jsonSchema.unixTimestamp2000(),
|
|
11
11
|
});
|
package/package.json
CHANGED
|
@@ -78,6 +78,9 @@ export const jsonSchema = {
|
|
|
78
78
|
unixTimestamp() {
|
|
79
79
|
return new JsonSchemaNumberBuilder().unixTimestamp()
|
|
80
80
|
},
|
|
81
|
+
unixTimestamp2000() {
|
|
82
|
+
return new JsonSchemaNumberBuilder().unixTimestamp2000()
|
|
83
|
+
},
|
|
81
84
|
// string types
|
|
82
85
|
string() {
|
|
83
86
|
return new JsonSchemaStringBuilder()
|
|
@@ -246,7 +249,9 @@ export class JsonSchemaNumberBuilder extends JsonSchemaAnyBuilder<number, JsonSc
|
|
|
246
249
|
float = () => this.format('float')
|
|
247
250
|
double = () => this.format('double')
|
|
248
251
|
unixTimestamp = () => this.format('unixTimestamp')
|
|
252
|
+
unixTimestamp2000 = () => this.format('unixTimestamp2000')
|
|
249
253
|
unixTimestampMillis = () => this.format('unixTimestampMillis')
|
|
254
|
+
unixTimestampMillis2000 = () => this.format('unixTimestampMillis2000')
|
|
250
255
|
utcOffset = () => this.format('utcOffset')
|
|
251
256
|
utcOffsetHours = () => this.format('utcOffsetHours')
|
|
252
257
|
}
|
|
@@ -370,8 +375,8 @@ export class JsonSchemaObjectBuilder<T extends AnyObject> extends JsonSchemaAnyB
|
|
|
370
375
|
): JsonSchemaObjectBuilder<T & BaseDBEntity<ID>> {
|
|
371
376
|
Object.assign(this.schema.properties, {
|
|
372
377
|
id: { type: idType },
|
|
373
|
-
created: { type: 'number', format: '
|
|
374
|
-
updated: { type: 'number', format: '
|
|
378
|
+
created: { type: 'number', format: 'unixTimestamp2000' },
|
|
379
|
+
updated: { type: 'number', format: 'unixTimestamp2000' },
|
|
375
380
|
})
|
|
376
381
|
|
|
377
382
|
return this
|
|
@@ -3,12 +3,12 @@ import { jsonSchema } from './jsonSchemaBuilder'
|
|
|
3
3
|
|
|
4
4
|
export const baseDBEntityJsonSchema = jsonSchema.object<BaseDBEntity>({
|
|
5
5
|
id: jsonSchema.string().optional(),
|
|
6
|
-
created: jsonSchema.
|
|
7
|
-
updated: jsonSchema.
|
|
6
|
+
created: jsonSchema.unixTimestamp2000().optional(),
|
|
7
|
+
updated: jsonSchema.unixTimestamp2000().optional(),
|
|
8
8
|
})
|
|
9
9
|
|
|
10
10
|
export const savedDBEntityJsonSchema = jsonSchema.object<SavedDBEntity>({
|
|
11
11
|
id: jsonSchema.string(),
|
|
12
|
-
created: jsonSchema.
|
|
13
|
-
updated: jsonSchema.
|
|
12
|
+
created: jsonSchema.unixTimestamp2000(),
|
|
13
|
+
updated: jsonSchema.unixTimestamp2000(),
|
|
14
14
|
})
|