@nmshd/runtime 1.3.5 → 1.4.2
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/DatabaseSchemaUpgrader.d.ts +12 -0
- package/dist/DatabaseSchemaUpgrader.js +82 -0
- package/dist/DatabaseSchemaUpgrader.js.map +1 -0
- package/dist/Runtime.d.ts +1 -1
- package/dist/Runtime.js +4 -2
- package/dist/Runtime.js.map +1 -1
- package/dist/buildInformation.js +5 -5
- package/dist/extensibility/facades/transport/AccountFacade.d.ts +3 -3
- package/dist/extensibility/facades/transport/AccountFacade.js +4 -4
- package/dist/extensibility/facades/transport/AccountFacade.js.map +1 -1
- package/dist/useCases/common/Schemas.d.ts +2 -0
- package/dist/useCases/common/Schemas.js +22 -2
- package/dist/useCases/common/Schemas.js.map +1 -1
- package/dist/useCases/transport/account/SyncDatawallet.d.ts +5 -2
- package/dist/useCases/transport/account/SyncDatawallet.js +2 -2
- package/dist/useCases/transport/account/SyncDatawallet.js.map +1 -1
- package/dist/useCases/transport/account/SyncEverything.d.ts +5 -2
- package/dist/useCases/transport/account/SyncEverything.js +4 -4
- package/dist/useCases/transport/account/SyncEverything.js.map +1 -1
- package/lib-web/nmshd.runtime.js +185 -53
- package/lib-web/nmshd.runtime.js.map +1 -1
- package/lib-web/nmshd.runtime.min.js +3 -3
- package/lib-web/nmshd.runtime.min.js.map +1 -1
- package/package.json +19 -19
package/lib-web/nmshd.runtime.js
CHANGED
|
@@ -2,6 +2,98 @@ var NMSHDRuntime;
|
|
|
2
2
|
/******/ (() => { // webpackBootstrap
|
|
3
3
|
/******/ var __webpack_modules__ = ({
|
|
4
4
|
|
|
5
|
+
/***/ "./dist/DatabaseSchemaUpgrader.js":
|
|
6
|
+
/*!****************************************!*\
|
|
7
|
+
!*** ./dist/DatabaseSchemaUpgrader.js ***!
|
|
8
|
+
\****************************************/
|
|
9
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
10
|
+
|
|
11
|
+
"use strict";
|
|
12
|
+
|
|
13
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
14
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
|
+
};
|
|
19
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
20
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
21
|
+
};
|
|
22
|
+
var RuntimeDatabaseSchemaMetadata_1;
|
|
23
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
24
|
+
exports.DatabaseSchemaUpgrader = void 0;
|
|
25
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
26
|
+
let RuntimeDatabaseSchemaMetadata = RuntimeDatabaseSchemaMetadata_1 = class RuntimeDatabaseSchemaMetadata extends ts_serval_1.Serializable {
|
|
27
|
+
static from(value) {
|
|
28
|
+
if (!value.id)
|
|
29
|
+
value.id = RuntimeDatabaseSchemaMetadata_1.DATABASE_SCHEMA_ID;
|
|
30
|
+
return super.fromT(value, RuntimeDatabaseSchemaMetadata_1);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
RuntimeDatabaseSchemaMetadata.DATABASE_SCHEMA_ID = "databaseSchema";
|
|
34
|
+
__decorate([
|
|
35
|
+
(0, ts_serval_1.serialize)(),
|
|
36
|
+
(0, ts_serval_1.validate)({ customValidator: (value) => (value === RuntimeDatabaseSchemaMetadata_1.DATABASE_SCHEMA_ID ? undefined : "Invalid database schema id") }),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], RuntimeDatabaseSchemaMetadata.prototype, "id", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, ts_serval_1.serialize)(),
|
|
41
|
+
(0, ts_serval_1.validate)({ min: 0 }),
|
|
42
|
+
__metadata("design:type", Number)
|
|
43
|
+
], RuntimeDatabaseSchemaMetadata.prototype, "version", void 0);
|
|
44
|
+
RuntimeDatabaseSchemaMetadata = RuntimeDatabaseSchemaMetadata_1 = __decorate([
|
|
45
|
+
(0, ts_serval_1.type)("RuntimeDatabaseSchemaMetadata")
|
|
46
|
+
], RuntimeDatabaseSchemaMetadata);
|
|
47
|
+
class DatabaseSchemaUpgrader {
|
|
48
|
+
constructor(accountController, consumptionController) {
|
|
49
|
+
this.accountController = accountController;
|
|
50
|
+
this.consumptionController = consumptionController;
|
|
51
|
+
this.CURRENT_DATABASE_SCHEMA_VERSION = 1;
|
|
52
|
+
this.DATABASE_SCHEMA_QUERY = { id: RuntimeDatabaseSchemaMetadata.DATABASE_SCHEMA_ID };
|
|
53
|
+
}
|
|
54
|
+
async upgradeSchemaVersion() {
|
|
55
|
+
let version = await this.getVersionFromDB();
|
|
56
|
+
while (version < this.CURRENT_DATABASE_SCHEMA_VERSION) {
|
|
57
|
+
version++;
|
|
58
|
+
const upgradeLogic = UPGRADE_LOGIC[version];
|
|
59
|
+
if (!upgradeLogic)
|
|
60
|
+
throw new Error(`No upgrade logic found for version '${version}'`);
|
|
61
|
+
await upgradeLogic(this.accountController, this.consumptionController);
|
|
62
|
+
await this.writeVersionToDB(version);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
async getVersionFromDB() {
|
|
66
|
+
const metaCollection = await this.accountController.db.getCollection("meta");
|
|
67
|
+
const doc = await metaCollection.findOne(this.DATABASE_SCHEMA_QUERY);
|
|
68
|
+
// If no version is found, assume version 0
|
|
69
|
+
if (!doc)
|
|
70
|
+
return 0;
|
|
71
|
+
const metadata = RuntimeDatabaseSchemaMetadata.from(doc);
|
|
72
|
+
return metadata.version;
|
|
73
|
+
}
|
|
74
|
+
async writeVersionToDB(version) {
|
|
75
|
+
const metaCollection = await this.accountController.db.getCollection("meta");
|
|
76
|
+
const metadata = RuntimeDatabaseSchemaMetadata.from({ version });
|
|
77
|
+
const oldDoc = await metaCollection.findOne(this.DATABASE_SCHEMA_QUERY);
|
|
78
|
+
if (oldDoc) {
|
|
79
|
+
await metaCollection.update(oldDoc, metadata);
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
await metaCollection.create(metadata);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.DatabaseSchemaUpgrader = DatabaseSchemaUpgrader;
|
|
87
|
+
const UPGRADE_LOGIC = {
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
89
|
+
1: () => {
|
|
90
|
+
// noop
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=DatabaseSchemaUpgrader.js.map
|
|
94
|
+
|
|
95
|
+
/***/ }),
|
|
96
|
+
|
|
5
97
|
/***/ "./dist/Runtime.js":
|
|
6
98
|
/*!*************************!*\
|
|
7
99
|
!*** ./dist/Runtime.js ***!
|
|
@@ -16,6 +108,7 @@ const ts_utils_1 = __webpack_require__(/*! @js-soft/ts-utils */ "./node_modules/
|
|
|
16
108
|
const consumption_1 = __webpack_require__(/*! @nmshd/consumption */ "@nmshd/consumption");
|
|
17
109
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
18
110
|
const typescript_ioc_1 = __webpack_require__(/*! typescript-ioc */ "./node_modules/typescript-ioc/dist/typescript-ioc.js");
|
|
111
|
+
const DatabaseSchemaUpgrader_1 = __webpack_require__(/*! ./DatabaseSchemaUpgrader */ "./dist/DatabaseSchemaUpgrader.js");
|
|
19
112
|
const dataViews_1 = __webpack_require__(/*! ./dataViews */ "./dist/dataViews/index.js");
|
|
20
113
|
const events_1 = __webpack_require__(/*! ./events */ "./dist/events/index.js");
|
|
21
114
|
const extensibility_1 = __webpack_require__(/*! ./extensibility */ "./dist/extensibility/index.js");
|
|
@@ -47,12 +140,13 @@ class Runtime {
|
|
|
47
140
|
throw useCases_1.RuntimeErrors.startup.noActiveExpander();
|
|
48
141
|
return this._expander;
|
|
49
142
|
}
|
|
50
|
-
login(accountController, consumptionController) {
|
|
143
|
+
async login(accountController, consumptionController) {
|
|
51
144
|
this._accountController = accountController;
|
|
52
145
|
this._transportServices = typescript_ioc_1.Container.get(extensibility_1.TransportServices);
|
|
53
146
|
this._consumptionController = consumptionController;
|
|
54
147
|
this._consumptionServices = typescript_ioc_1.Container.get(extensibility_1.ConsumptionServices);
|
|
55
148
|
this._expander = typescript_ioc_1.Container.get(dataViews_1.DataViewExpander);
|
|
149
|
+
await new DatabaseSchemaUpgrader_1.DatabaseSchemaUpgrader(accountController, consumptionController).upgradeSchemaVersion();
|
|
56
150
|
return this;
|
|
57
151
|
}
|
|
58
152
|
get modules() {
|
|
@@ -184,7 +278,7 @@ class Runtime {
|
|
|
184
278
|
const moduleConfiguration = this.runtimeConfig.modules[moduleName];
|
|
185
279
|
moduleConfiguration.name = moduleName;
|
|
186
280
|
if (!moduleConfiguration.enabled) {
|
|
187
|
-
this.logger.
|
|
281
|
+
this.logger.debug(`Skip loading module '${this.getModuleName(moduleConfiguration)}' because it is not enabled.`);
|
|
188
282
|
continue;
|
|
189
283
|
}
|
|
190
284
|
if (!moduleConfiguration.location) {
|
|
@@ -329,11 +423,11 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
329
423
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
330
424
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
331
425
|
exports.buildInformation = {
|
|
332
|
-
version: "1.
|
|
333
|
-
build: "
|
|
334
|
-
date: "2022-
|
|
335
|
-
commit: "
|
|
336
|
-
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.
|
|
426
|
+
version: "1.4.2",
|
|
427
|
+
build: "47",
|
|
428
|
+
date: "2022-05-04T09:46:44+00:00",
|
|
429
|
+
commit: "539fb85b12ae38c95b2c0d144765637028c90b07",
|
|
430
|
+
dependencies: {"@js-soft/docdb-querytranslator":"1.0.1","@js-soft/logging-abstractions":"1.0.0","@js-soft/ts-serval":"1.1.1","@js-soft/ts-utils":"^1.1.1","@nmshd/consumption":"1.0.15","@nmshd/content":"1.1.5","@nmshd/crypto":"1.0.8","@nmshd/transport":"1.2.1","ajv":"^8.11.0","ajv-errors":"^3.0.0","ajv-formats":"^2.1.1","fluent-ts-validator":"3.0.3","json-stringify-safe":"^5.0.1","luxon":"^2.3.2","qrcode":"1.5.0","reflect-metadata":"0.1.13","ts-simple-nameof":"1.3.1","typescript-ioc":"3.2.2"},
|
|
337
431
|
libraries: {
|
|
338
432
|
serval: ts_serval_1.buildInformation,
|
|
339
433
|
consumption: consumption_1.buildInformation,
|
|
@@ -2480,11 +2574,11 @@ let AccountFacade = class AccountFacade {
|
|
|
2480
2574
|
async registerPushNotificationToken(request) {
|
|
2481
2575
|
return await this.registerPushNotificationTokenUseCase.execute(request);
|
|
2482
2576
|
}
|
|
2483
|
-
async syncDatawallet() {
|
|
2484
|
-
return await this.syncDatawalletUseCase.execute();
|
|
2577
|
+
async syncDatawallet(request = {}) {
|
|
2578
|
+
return await this.syncDatawalletUseCase.execute(request);
|
|
2485
2579
|
}
|
|
2486
|
-
async syncEverything() {
|
|
2487
|
-
return await this.syncEverythingUseCase.execute();
|
|
2580
|
+
async syncEverything(request = {}) {
|
|
2581
|
+
return await this.syncEverythingUseCase.execute(request);
|
|
2488
2582
|
}
|
|
2489
2583
|
async getSyncInfo() {
|
|
2490
2584
|
return await this.getSyncInfoUseCase.execute();
|
|
@@ -4239,8 +4333,8 @@ exports.JsonSchema = JsonSchema;
|
|
|
4239
4333
|
"use strict";
|
|
4240
4334
|
|
|
4241
4335
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4242
|
-
exports.
|
|
4243
|
-
exports.LoadPeerTokenRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.CreateRelationshipChangeRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileRequest = exports.LoadPeerFileRequest = exports.LoadPeerFileViaReferenceRequest = exports.LoadPeerFileViaSecretRequest = exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.UpdateDeviceRequest = void 0;
|
|
4336
|
+
exports.DeleteDeviceRequest = exports.CreateDeviceOnboardingTokenRequest = exports.CreateDeviceRequest = exports.ValidateChallengeRequest = exports.CreateChallengeRequest = exports.CreateDeviceChallengeRequest = exports.CreateIdentityChallengeRequest = exports.CreateRelationshipChallengeRequest = exports.SyncEverythingRequest = exports.DownloadAttachmentRequest = exports.DownloadFileRequest = exports.SyncDatawalletRequest = exports.RegisterPushNotificationTokenRequest = exports.UpdateSharedItemRequest = exports.GetSharedItemsSharedWithAddressRequest = exports.GetSharedItemsSharedByAddressRequest = exports.GetSharedItemsByReferenceRequest = exports.GetSharedItemsByAddressRequest = exports.GetSharedItemsRequest = exports.GetSharedItemRequest = exports.DeleteSharedItemRequest = exports.CreateSharedItemRequest = exports.UpdateSettingRequest = exports.GetSettingsRequest = exports.GetSettingRequest = exports.DeleteSettingRequest = exports.CreateSettingRequest = exports.UpdateRelationshipInfoRequest = exports.GetRelationshipInfoByRelationshipRequest = exports.GetRelationshipInfoRequest = exports.DeleteRelationshipInfoByRelationshipRequest = exports.DeleteRelationshipInfoRequest = exports.CreateRelationshipInfoRequest = exports.UpdateDraftRequest = exports.GetDraftsRequest = exports.GetDraftRequest = exports.DeleteDraftRequest = exports.CreateDraftRequest = exports.UpdateAttributeRequest = exports.SucceedAttributeRequest = exports.GetHistoryByNameRequest = exports.GetAttributesRequest = exports.GetAttributeByNameRequest = exports.GetAttributeRequest = exports.DeleteAttributeByNameRequest = exports.DeleteAttributeRequest = exports.CreateAttributeRequest = exports.GetAttributesByNamesRequest = exports.LoadPeerTokenAnonymousByTruncatedReferenceRequest = exports.LoadPeerTokenAnonymousByIdAndKeyRequest = void 0;
|
|
4337
|
+
exports.LoadPeerTokenRequest = exports.GetTokensRequest = exports.GetTokenRequest = exports.GetQRCodeForTokenRequest = exports.CreateOwnTokenRequest = exports.LoadPeerRelationshipTemplateRequest = exports.GetRelationshipTemplatesRequest = exports.GetRelationshipTemplateRequest = exports.CreateTokenQrCodeForOwnTemplateRequest = exports.CreateTokenForOwnTemplateRequest = exports.CreateOwnRelationshipTemplateRequest = exports.RevokeRelationshipChangeRequest = exports.RejectRelationshipChangeRequest = exports.GetRelationshipsRequest = exports.GetRelationshipByAddressRequest = exports.GetRelationshipRequest = exports.CreateRelationshipChangeRequest = exports.CreateRelationshipRequest = exports.AcceptRelationshipChangeRequest = exports.SendMessageRequest = exports.GetMessagesRequest = exports.GetMessageRequest = exports.GetAttachmentMetadataRequest = exports.CheckIdentityRequest = exports.UploadOwnFileRequest = exports.LoadPeerFileRequest = exports.LoadPeerFileViaReferenceRequest = exports.LoadPeerFileViaSecretRequest = exports.GetFilesRequest = exports.GetFileRequest = exports.CreateTokenQrCodeForFileRequest = exports.CreateTokenForFileRequest = exports.UpdateDeviceRequest = exports.GetDeviceOnboardingInfoRequest = exports.GetDeviceRequest = void 0;
|
|
4244
4338
|
exports.LoadPeerTokenAnonymousByIdAndKeyRequest = {
|
|
4245
4339
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
4246
4340
|
"$ref": "#/definitions/LoadPeerTokenAnonymousByIdAndKeyRequest",
|
|
@@ -5252,6 +5346,16 @@ exports.RegisterPushNotificationTokenRequest = {
|
|
|
5252
5346
|
}
|
|
5253
5347
|
}
|
|
5254
5348
|
};
|
|
5349
|
+
exports.SyncDatawalletRequest = {
|
|
5350
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5351
|
+
"$ref": "#/definitions/SyncDatawalletRequest",
|
|
5352
|
+
"definitions": {
|
|
5353
|
+
"SyncDatawalletRequest": {
|
|
5354
|
+
"type": "object",
|
|
5355
|
+
"additionalProperties": false
|
|
5356
|
+
}
|
|
5357
|
+
}
|
|
5358
|
+
};
|
|
5255
5359
|
exports.DownloadFileRequest = {
|
|
5256
5360
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5257
5361
|
"$ref": "#/definitions/DownloadFileRequest",
|
|
@@ -5293,6 +5397,16 @@ exports.DownloadAttachmentRequest = {
|
|
|
5293
5397
|
}
|
|
5294
5398
|
}
|
|
5295
5399
|
};
|
|
5400
|
+
exports.SyncEverythingRequest = {
|
|
5401
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5402
|
+
"$ref": "#/definitions/SyncEverythingRequest",
|
|
5403
|
+
"definitions": {
|
|
5404
|
+
"SyncEverythingRequest": {
|
|
5405
|
+
"type": "object",
|
|
5406
|
+
"additionalProperties": false
|
|
5407
|
+
}
|
|
5408
|
+
}
|
|
5409
|
+
};
|
|
5296
5410
|
exports.CreateRelationshipChallengeRequest = {
|
|
5297
5411
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
5298
5412
|
"$ref": "#/definitions/CreateRelationshipChallengeRequest",
|
|
@@ -9638,8 +9752,8 @@ let SyncDatawalletUseCase = class SyncDatawalletUseCase extends common_1.UseCase
|
|
|
9638
9752
|
super();
|
|
9639
9753
|
this.accountController = accountController;
|
|
9640
9754
|
}
|
|
9641
|
-
async executeInternal() {
|
|
9642
|
-
await this.accountController.syncDatawallet(true);
|
|
9755
|
+
async executeInternal(request) {
|
|
9756
|
+
await this.accountController.syncDatawallet(true, request.callback);
|
|
9643
9757
|
return ts_utils_1.Result.ok(undefined);
|
|
9644
9758
|
}
|
|
9645
9759
|
};
|
|
@@ -9690,11 +9804,11 @@ let SyncEverythingUseCase = class SyncEverythingUseCase extends common_1.UseCase
|
|
|
9690
9804
|
this.eventBus = eventBus;
|
|
9691
9805
|
this.logger = loggerFactory.getLogger(SyncEverythingUseCase);
|
|
9692
9806
|
}
|
|
9693
|
-
async executeInternal() {
|
|
9807
|
+
async executeInternal(request) {
|
|
9694
9808
|
if (this.currentSync) {
|
|
9695
9809
|
return await this.currentSync;
|
|
9696
9810
|
}
|
|
9697
|
-
this.currentSync = this._executeInternal();
|
|
9811
|
+
this.currentSync = this._executeInternal(request);
|
|
9698
9812
|
try {
|
|
9699
9813
|
return await this.currentSync;
|
|
9700
9814
|
}
|
|
@@ -9702,8 +9816,8 @@ let SyncEverythingUseCase = class SyncEverythingUseCase extends common_1.UseCase
|
|
|
9702
9816
|
this.currentSync = undefined;
|
|
9703
9817
|
}
|
|
9704
9818
|
}
|
|
9705
|
-
async _executeInternal() {
|
|
9706
|
-
const changedItems = await this.accountController.syncEverything();
|
|
9819
|
+
async _executeInternal(request) {
|
|
9820
|
+
const changedItems = await this.accountController.syncEverything(request.callback);
|
|
9707
9821
|
const messageDTOs = changedItems.messages.map((m) => MessageMapper_1.MessageMapper.toMessageDTO(m));
|
|
9708
9822
|
const relationshipDTOs = changedItems.relationships.map((r) => RelationshipMapper_1.RelationshipMapper.toRelationshipDTO(r));
|
|
9709
9823
|
const eventTargetAddress = this.identityController.identity.address.toString();
|
|
@@ -19962,7 +20076,7 @@ const def = {
|
|
|
19962
20076
|
for (let i = 0; i < oneOf.length; i++) {
|
|
19963
20077
|
let sch = oneOf[i];
|
|
19964
20078
|
if ((sch === null || sch === void 0 ? void 0 : sch.$ref) && !(0, util_1.schemaHasRulesButRef)(sch, it.self.RULES)) {
|
|
19965
|
-
sch = compile_1.resolveRef.call(it.self, it.schemaEnv, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref);
|
|
20079
|
+
sch = compile_1.resolveRef.call(it.self, it.schemaEnv.root, it.baseId, sch === null || sch === void 0 ? void 0 : sch.$ref);
|
|
19966
20080
|
if (sch instanceof compile_1.SchemaEnv)
|
|
19967
20081
|
sch = sch.schema;
|
|
19968
20082
|
}
|
|
@@ -20259,7 +20373,8 @@ const def = {
|
|
|
20259
20373
|
if (!$data && schema.length === 0)
|
|
20260
20374
|
throw new Error("enum must have non-empty array");
|
|
20261
20375
|
const useLoop = schema.length >= it.opts.loopEnum;
|
|
20262
|
-
|
|
20376
|
+
let eql;
|
|
20377
|
+
const getEql = () => (eql !== null && eql !== void 0 ? eql : (eql = (0, util_1.useFunc)(gen, equal_1.default)));
|
|
20263
20378
|
let valid;
|
|
20264
20379
|
if (useLoop || $data) {
|
|
20265
20380
|
valid = gen.let("valid");
|
|
@@ -20275,12 +20390,12 @@ const def = {
|
|
|
20275
20390
|
cxt.pass(valid);
|
|
20276
20391
|
function loopEnum() {
|
|
20277
20392
|
gen.assign(valid, false);
|
|
20278
|
-
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${
|
|
20393
|
+
gen.forOf("v", schemaCode, (v) => gen.if((0, codegen_1._) `${getEql()}(${data}, ${v})`, () => gen.assign(valid, true).break()));
|
|
20279
20394
|
}
|
|
20280
20395
|
function equalCode(vSchema, i) {
|
|
20281
20396
|
const sch = schema[i];
|
|
20282
20397
|
return typeof sch === "object" && sch !== null
|
|
20283
|
-
? (0, codegen_1._) `${
|
|
20398
|
+
? (0, codegen_1._) `${getEql()}(${data}, ${vSchema}[${i}])`
|
|
20284
20399
|
: (0, codegen_1._) `${data} === ${sch}`;
|
|
20285
20400
|
}
|
|
20286
20401
|
},
|
|
@@ -20454,7 +20569,7 @@ const codegen_1 = __webpack_require__(/*! ../../compile/codegen */ "./node_modul
|
|
|
20454
20569
|
const error = {
|
|
20455
20570
|
message({ keyword, schemaCode }) {
|
|
20456
20571
|
const comp = keyword === "maxProperties" ? "more" : "fewer";
|
|
20457
|
-
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode}
|
|
20572
|
+
return (0, codegen_1.str) `must NOT have ${comp} than ${schemaCode} properties`;
|
|
20458
20573
|
},
|
|
20459
20574
|
params: ({ schemaCode }) => (0, codegen_1._) `{limit: ${schemaCode}}`,
|
|
20460
20575
|
};
|
|
@@ -29023,6 +29138,9 @@ var Formatter = /*#__PURE__*/function () {
|
|
|
29023
29138
|
case "d":
|
|
29024
29139
|
return "day";
|
|
29025
29140
|
|
|
29141
|
+
case "w":
|
|
29142
|
+
return "week";
|
|
29143
|
+
|
|
29026
29144
|
case "M":
|
|
29027
29145
|
return "month";
|
|
29028
29146
|
|
|
@@ -29272,7 +29390,6 @@ var SystemZone = /*#__PURE__*/function (_Zone) {
|
|
|
29272
29390
|
return SystemZone;
|
|
29273
29391
|
}(Zone);
|
|
29274
29392
|
|
|
29275
|
-
RegExp("^" + ianaRegex.source + "$");
|
|
29276
29393
|
var dtfCache = {};
|
|
29277
29394
|
|
|
29278
29395
|
function makeDTF(zone) {
|
|
@@ -29285,7 +29402,8 @@ function makeDTF(zone) {
|
|
|
29285
29402
|
day: "2-digit",
|
|
29286
29403
|
hour: "2-digit",
|
|
29287
29404
|
minute: "2-digit",
|
|
29288
|
-
second: "2-digit"
|
|
29405
|
+
second: "2-digit",
|
|
29406
|
+
era: "short"
|
|
29289
29407
|
});
|
|
29290
29408
|
}
|
|
29291
29409
|
|
|
@@ -29296,34 +29414,38 @@ var typeToPos = {
|
|
|
29296
29414
|
year: 0,
|
|
29297
29415
|
month: 1,
|
|
29298
29416
|
day: 2,
|
|
29299
|
-
|
|
29300
|
-
|
|
29301
|
-
|
|
29417
|
+
era: 3,
|
|
29418
|
+
hour: 4,
|
|
29419
|
+
minute: 5,
|
|
29420
|
+
second: 6
|
|
29302
29421
|
};
|
|
29303
29422
|
|
|
29304
29423
|
function hackyOffset(dtf, date) {
|
|
29305
29424
|
var formatted = dtf.format(date).replace(/\u200E/g, ""),
|
|
29306
|
-
parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted),
|
|
29425
|
+
parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted),
|
|
29307
29426
|
fMonth = parsed[1],
|
|
29308
29427
|
fDay = parsed[2],
|
|
29309
29428
|
fYear = parsed[3],
|
|
29310
|
-
|
|
29311
|
-
|
|
29312
|
-
|
|
29313
|
-
|
|
29429
|
+
fadOrBc = parsed[4],
|
|
29430
|
+
fHour = parsed[5],
|
|
29431
|
+
fMinute = parsed[6],
|
|
29432
|
+
fSecond = parsed[7];
|
|
29433
|
+
return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
|
|
29314
29434
|
}
|
|
29315
29435
|
|
|
29316
29436
|
function partsOffset(dtf, date) {
|
|
29317
|
-
var formatted = dtf.formatToParts(date)
|
|
29318
|
-
|
|
29437
|
+
var formatted = dtf.formatToParts(date);
|
|
29438
|
+
var filled = [];
|
|
29319
29439
|
|
|
29320
29440
|
for (var i = 0; i < formatted.length; i++) {
|
|
29321
29441
|
var _formatted$i = formatted[i],
|
|
29322
29442
|
type = _formatted$i.type,
|
|
29323
|
-
value = _formatted$i.value
|
|
29324
|
-
|
|
29443
|
+
value = _formatted$i.value;
|
|
29444
|
+
var pos = typeToPos[type];
|
|
29325
29445
|
|
|
29326
|
-
if (
|
|
29446
|
+
if (type === "era") {
|
|
29447
|
+
filled[pos] = value;
|
|
29448
|
+
} else if (!isUndefined(pos)) {
|
|
29327
29449
|
filled[pos] = parseInt(value, 10);
|
|
29328
29450
|
}
|
|
29329
29451
|
}
|
|
@@ -29366,7 +29488,7 @@ var IANAZone = /*#__PURE__*/function (_Zone) {
|
|
|
29366
29488
|
* @param {string} s - The string to check validity on
|
|
29367
29489
|
* @example IANAZone.isValidSpecifier("America/New_York") //=> true
|
|
29368
29490
|
* @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false
|
|
29369
|
-
* @deprecated This method returns false some valid IANA names. Use isValidZone instead
|
|
29491
|
+
* @deprecated This method returns false for some valid IANA names. Use isValidZone instead.
|
|
29370
29492
|
* @return {boolean}
|
|
29371
29493
|
*/
|
|
29372
29494
|
;
|
|
@@ -29434,15 +29556,20 @@ var IANAZone = /*#__PURE__*/function (_Zone) {
|
|
|
29434
29556
|
_proto.offset = function offset(ts) {
|
|
29435
29557
|
var date = new Date(ts);
|
|
29436
29558
|
if (isNaN(date)) return NaN;
|
|
29559
|
+
var dtf = makeDTF(this.name);
|
|
29437
29560
|
|
|
29438
|
-
var
|
|
29439
|
-
_ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date),
|
|
29561
|
+
var _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date),
|
|
29440
29562
|
year = _ref2[0],
|
|
29441
29563
|
month = _ref2[1],
|
|
29442
29564
|
day = _ref2[2],
|
|
29443
|
-
|
|
29444
|
-
|
|
29445
|
-
|
|
29565
|
+
adOrBc = _ref2[3],
|
|
29566
|
+
hour = _ref2[4],
|
|
29567
|
+
minute = _ref2[5],
|
|
29568
|
+
second = _ref2[6];
|
|
29569
|
+
|
|
29570
|
+
if (adOrBc === "BC") {
|
|
29571
|
+
year = -Math.abs(year) + 1;
|
|
29572
|
+
} // because we're using hour12 and https://bugs.chromium.org/p/chromium/issues/detail?id=1025564&can=2&q=%2224%3A00%22%20datetimeformat
|
|
29446
29573
|
|
|
29447
29574
|
|
|
29448
29575
|
var adjustedHour = hour === 24 ? 0 : hour;
|
|
@@ -31159,6 +31286,7 @@ var Duration = /*#__PURE__*/function () {
|
|
|
31159
31286
|
* * `m` for minutes
|
|
31160
31287
|
* * `h` for hours
|
|
31161
31288
|
* * `d` for days
|
|
31289
|
+
* * `w` for weeks
|
|
31162
31290
|
* * `M` for months
|
|
31163
31291
|
* * `y` for years
|
|
31164
31292
|
* Notes:
|
|
@@ -31185,8 +31313,9 @@ var Duration = /*#__PURE__*/function () {
|
|
|
31185
31313
|
return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID$2;
|
|
31186
31314
|
}
|
|
31187
31315
|
/**
|
|
31188
|
-
* Returns a string representation of a Duration with all units included
|
|
31189
|
-
* To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
|
|
31316
|
+
* Returns a string representation of a Duration with all units included.
|
|
31317
|
+
* To modify its behavior use the `listStyle` and any Intl.NumberFormat option, though `unitDisplay` is especially relevant.
|
|
31318
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
31190
31319
|
* @param opts - On option object to override the formatting. Accepts the same keys as the options parameter of the native `Int.NumberFormat` constructor, as well as `listStyle`.
|
|
31191
31320
|
* @example
|
|
31192
31321
|
* ```js
|
|
@@ -33459,7 +33588,13 @@ function unitOutOfRange(unit, value) {
|
|
|
33459
33588
|
}
|
|
33460
33589
|
|
|
33461
33590
|
function dayOfWeek(year, month, day) {
|
|
33462
|
-
var
|
|
33591
|
+
var d = new Date(Date.UTC(year, month - 1, day));
|
|
33592
|
+
|
|
33593
|
+
if (year < 100 && year >= 0) {
|
|
33594
|
+
d.setUTCFullYear(d.getUTCFullYear() - 1900);
|
|
33595
|
+
}
|
|
33596
|
+
|
|
33597
|
+
var js = d.getUTCDay();
|
|
33463
33598
|
return js === 0 ? 7 : js;
|
|
33464
33599
|
}
|
|
33465
33600
|
|
|
@@ -33887,9 +34022,6 @@ function normalizeUnit(unit) {
|
|
|
33887
34022
|
} // this is a dumbed down version of fromObject() that runs about 60% faster
|
|
33888
34023
|
// but doesn't do any validation, makes a bunch of assumptions about what units
|
|
33889
34024
|
// are present, and so on.
|
|
33890
|
-
// this is a dumbed down version of fromObject() that runs about 60% faster
|
|
33891
|
-
// but doesn't do any validation, makes a bunch of assumptions about what units
|
|
33892
|
-
// are present, and so on.
|
|
33893
34025
|
|
|
33894
34026
|
|
|
33895
34027
|
function quickDT(obj, opts) {
|
|
@@ -34591,7 +34723,7 @@ var DateTime = /*#__PURE__*/function () {
|
|
|
34591
34723
|
}
|
|
34592
34724
|
}
|
|
34593
34725
|
/**
|
|
34594
|
-
* Check if an object is
|
|
34726
|
+
* Check if an object is an instance of DateTime. Works across context boundaries
|
|
34595
34727
|
* @param {object} o
|
|
34596
34728
|
* @return {boolean}
|
|
34597
34729
|
*/
|
|
@@ -36189,7 +36321,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
36189
36321
|
}
|
|
36190
36322
|
}
|
|
36191
36323
|
|
|
36192
|
-
var VERSION = "2.3.
|
|
36324
|
+
var VERSION = "2.3.2";
|
|
36193
36325
|
|
|
36194
36326
|
exports.DateTime = DateTime;
|
|
36195
36327
|
exports.Duration = Duration;
|