@nmshd/consumption 2.0.0-beta.14 → 2.0.0-beta.17
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/buildInformation.js +4 -4
- package/dist/consumption/ConsumptionBaseController.d.ts +1 -1
- package/dist/consumption/ConsumptionBaseController.js +1 -1
- package/dist/consumption/ConsumptionBaseController.js.map +1 -1
- package/dist/consumption/ConsumptionController.d.ts +3 -7
- package/dist/consumption/ConsumptionController.js +12 -13
- package/dist/consumption/ConsumptionController.js.map +1 -1
- package/dist/consumption/ConsumptionControllerName.d.ts +1 -0
- package/dist/consumption/ConsumptionControllerName.js +1 -0
- package/dist/consumption/ConsumptionControllerName.js.map +1 -1
- package/dist/consumption/ConsumptionIds.d.ts +1 -0
- package/dist/consumption/ConsumptionIds.js +1 -0
- package/dist/consumption/ConsumptionIds.js.map +1 -1
- package/dist/modules/attributeListeners/AttributeListenersController.d.ts +18 -0
- package/dist/modules/attributeListeners/AttributeListenersController.js +44 -0
- package/dist/modules/attributeListeners/AttributeListenersController.js.map +1 -0
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.d.ts +6 -0
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js +12 -0
- package/dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js.map +1 -0
- package/dist/modules/attributeListeners/events/index.d.ts +1 -0
- package/dist/modules/attributeListeners/events/index.js +18 -0
- package/dist/modules/attributeListeners/events/index.js.map +1 -0
- package/dist/modules/attributeListeners/index.d.ts +4 -0
- package/dist/modules/attributeListeners/index.js +21 -0
- package/dist/modules/attributeListeners/index.js.map +1 -0
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.d.ts +12 -0
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js +31 -0
- package/dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js.map +1 -0
- package/dist/modules/attributeListeners/local/LocalAttributeListener.d.ts +19 -0
- package/dist/modules/attributeListeners/local/LocalAttributeListener.js +48 -0
- package/dist/modules/attributeListeners/local/LocalAttributeListener.js.map +1 -0
- package/dist/modules/attributes/local/CreateAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/CreateLocalAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/CreatePeerLocalAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/CreateSharedLocalAttributeCopyParams.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttribute.js.map +1 -1
- package/dist/modules/attributes/local/LocalAttributeShareInfo.js.map +1 -1
- package/dist/modules/attributes/local/SucceedLocalAttributeParams.js.map +1 -1
- package/dist/modules/attributes/local/UpdateLocalAttributeParams.js.map +1 -1
- package/dist/modules/drafts/local/Draft.js.map +1 -1
- package/dist/modules/index.d.ts +1 -0
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/requests/incoming/checkPrerequisites/CheckPrerequisitesOfIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/complete/CompleteIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/decide/InternalDecideRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/received/ReceivedIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/incoming/requireManualDecision/RequireManualDecisionOfIncomingRequestParameters.js.map +1 -1
- package/dist/modules/requests/index.d.ts +1 -0
- package/dist/modules/requests/index.js +1 -0
- package/dist/modules/requests/index.js.map +1 -1
- package/dist/modules/requests/itemProcessors/createAttribute/AcceptCreateAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/readAttribute/AcceptReadAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.d.ts +7 -0
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js +19 -0
- package/dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js.map +1 -0
- package/dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js.map +1 -1
- package/dist/modules/requests/local/LocalRequest.js.map +1 -1
- package/dist/modules/requests/local/LocalRequestStatusLogEntry.js.map +1 -1
- package/dist/modules/requests/local/LocalResponse.js.map +1 -1
- package/dist/modules/requests/outgoing/completeOutgoingRequest/CompleteOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/createFromRelationshipCreationChange/CreateOutgoingRequestFromRelationshipCreationChangeParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/createOutgoingRequest/CanCreateOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/createOutgoingRequest/CreateOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/requests/outgoing/sentOutgoingRequest/SentOutgoingRequestParameters.js.map +1 -1
- package/dist/modules/settings/local/Setting.js.map +1 -1
- package/lib-web/nmshd.consumption.js +329 -42
- package/lib-web/nmshd.consumption.js.map +1 -1
- package/lib-web/nmshd.consumption.min.js +1 -1
- package/lib-web/nmshd.consumption.min.js.map +1 -1
- package/package.json +8 -8
|
@@ -17,10 +17,10 @@ const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
|
17
17
|
const crypto_1 = __webpack_require__(/*! @nmshd/crypto */ "@nmshd/crypto");
|
|
18
18
|
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
19
19
|
exports.buildInformation = {
|
|
20
|
-
version: "2.0.0-beta.
|
|
21
|
-
build: "
|
|
22
|
-
date: "2022-09-
|
|
23
|
-
commit: "
|
|
20
|
+
version: "2.0.0-beta.17",
|
|
21
|
+
build: "69",
|
|
22
|
+
date: "2022-09-13T13:29:39+00:00",
|
|
23
|
+
commit: "6d1b71f76a7b494ad8e651047661af7c3bbbee8d",
|
|
24
24
|
dependencies: {"@js-soft/docdb-querytranslator":"^1.1.0","ts-simple-nameof":"^1.3.1"},
|
|
25
25
|
libraries: {
|
|
26
26
|
transport: transport_1.buildInformation,
|
|
@@ -59,7 +59,7 @@ class ConsumptionBaseController {
|
|
|
59
59
|
return Promise.resolve(this);
|
|
60
60
|
}
|
|
61
61
|
parseArray(values, type) {
|
|
62
|
-
return values.map((v) => type.
|
|
62
|
+
return values.map((v) => type.fromAny(v));
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
exports.ConsumptionBaseController = ConsumptionBaseController;
|
|
@@ -79,12 +79,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
79
79
|
exports.ConsumptionController = void 0;
|
|
80
80
|
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
81
81
|
const modules_1 = __webpack_require__(/*! ../modules */ "./dist/modules/index.js");
|
|
82
|
-
const LocalAttributesController_1 = __webpack_require__(/*! ../modules/attributes/LocalAttributesController */ "./dist/modules/attributes/LocalAttributesController.js");
|
|
83
|
-
const DraftsController_1 = __webpack_require__(/*! ../modules/drafts/DraftsController */ "./dist/modules/drafts/DraftsController.js");
|
|
84
|
-
const IncomingRequestsController_1 = __webpack_require__(/*! ../modules/requests/incoming/IncomingRequestsController */ "./dist/modules/requests/incoming/IncomingRequestsController.js");
|
|
85
|
-
const RequestItemProcessorRegistry_1 = __webpack_require__(/*! ../modules/requests/itemProcessors/RequestItemProcessorRegistry */ "./dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js");
|
|
86
|
-
const OutgoingRequestsController_1 = __webpack_require__(/*! ../modules/requests/outgoing/OutgoingRequestsController */ "./dist/modules/requests/outgoing/OutgoingRequestsController.js");
|
|
87
|
-
const SettingsController_1 = __webpack_require__(/*! ../modules/settings/SettingsController */ "./dist/modules/settings/SettingsController.js");
|
|
88
82
|
class ConsumptionController {
|
|
89
83
|
constructor(transport, accountController) {
|
|
90
84
|
this.transport = transport;
|
|
@@ -105,16 +99,20 @@ class ConsumptionController {
|
|
|
105
99
|
get settings() {
|
|
106
100
|
return this._settings;
|
|
107
101
|
}
|
|
102
|
+
get attributeListeners() {
|
|
103
|
+
return this._attributeListeners;
|
|
104
|
+
}
|
|
108
105
|
async init(requestItemProcessorOverrides = new Map()) {
|
|
109
|
-
this._attributes = await new
|
|
110
|
-
this._drafts = await new
|
|
111
|
-
const processorRegistry = new
|
|
106
|
+
this._attributes = await new modules_1.LocalAttributesController(this, this.transport.eventBus, this.accountController.identity).init();
|
|
107
|
+
this._drafts = await new modules_1.DraftsController(this).init();
|
|
108
|
+
const processorRegistry = new modules_1.RequestItemProcessorRegistry(this, this.getDefaultProcessors());
|
|
112
109
|
for (const [itemConstructor, processorConstructor] of requestItemProcessorOverrides) {
|
|
113
110
|
processorRegistry.registerOrReplaceProcessor(itemConstructor, processorConstructor);
|
|
114
111
|
}
|
|
115
|
-
this._outgoingRequests = await new
|
|
116
|
-
this._incomingRequests = await new
|
|
117
|
-
this._settings = await new
|
|
112
|
+
this._outgoingRequests = await new modules_1.OutgoingRequestsController(await this.accountController.getSynchronizedCollection("Requests"), processorRegistry, this, this.transport.eventBus, this.accountController.identity).init();
|
|
113
|
+
this._incomingRequests = await new modules_1.IncomingRequestsController(await this.accountController.getSynchronizedCollection("Requests"), processorRegistry, this, this.transport.eventBus, this.accountController.identity).init();
|
|
114
|
+
this._settings = await new modules_1.SettingsController(this).init();
|
|
115
|
+
this._attributeListeners = await new modules_1.AttributeListenersController(this, this.transport.eventBus, this.accountController.identity).init();
|
|
118
116
|
return this;
|
|
119
117
|
}
|
|
120
118
|
getDefaultProcessors() {
|
|
@@ -124,7 +122,8 @@ class ConsumptionController {
|
|
|
124
122
|
[content_1.ReadAttributeRequestItem, modules_1.ReadAttributeRequestItemProcessor],
|
|
125
123
|
[content_1.ProposeAttributeRequestItem, modules_1.ProposeAttributeRequestItemProcessor],
|
|
126
124
|
[content_1.ConsentRequestItem, modules_1.GenericRequestItemProcessor],
|
|
127
|
-
[content_1.AuthenticationRequestItem, modules_1.GenericRequestItemProcessor]
|
|
125
|
+
[content_1.AuthenticationRequestItem, modules_1.GenericRequestItemProcessor],
|
|
126
|
+
[content_1.RegisterAttributeListenerRequestItem, modules_1.RegisterAttributeListenerRequestItemProcessor]
|
|
128
127
|
]);
|
|
129
128
|
}
|
|
130
129
|
}
|
|
@@ -146,6 +145,7 @@ exports.ConsumptionControllerName = void 0;
|
|
|
146
145
|
var ConsumptionControllerName;
|
|
147
146
|
(function (ConsumptionControllerName) {
|
|
148
147
|
ConsumptionControllerName["LocalAttributesController"] = "LocalAttributesController";
|
|
148
|
+
ConsumptionControllerName["AttributeListenersController"] = "AttributeListenersController";
|
|
149
149
|
ConsumptionControllerName["DraftsController"] = "DraftsController";
|
|
150
150
|
ConsumptionControllerName["RelationshipInfoController"] = "RelationshipInfoController";
|
|
151
151
|
ConsumptionControllerName["SingleRelationshipController"] = "SingleRelationshipController";
|
|
@@ -258,6 +258,7 @@ ConsumptionIds.draft = new transport_1.CoreIdHelper("LCLDRF");
|
|
|
258
258
|
ConsumptionIds.setting = new transport_1.CoreIdHelper("LCLSET");
|
|
259
259
|
ConsumptionIds.attribute = new transport_1.CoreIdHelper("ATT");
|
|
260
260
|
ConsumptionIds.request = new transport_1.CoreIdHelper("REQ");
|
|
261
|
+
ConsumptionIds.attributeListener = new transport_1.CoreIdHelper("ATL");
|
|
261
262
|
//# sourceMappingURL=ConsumptionIds.js.map
|
|
262
263
|
|
|
263
264
|
/***/ }),
|
|
@@ -324,6 +325,240 @@ __exportStar(__webpack_require__(/*! ./modules */ "./dist/modules/index.js"), ex
|
|
|
324
325
|
|
|
325
326
|
/***/ }),
|
|
326
327
|
|
|
328
|
+
/***/ "./dist/modules/attributeListeners/AttributeListenersController.js":
|
|
329
|
+
/*!*************************************************************************!*\
|
|
330
|
+
!*** ./dist/modules/attributeListeners/AttributeListenersController.js ***!
|
|
331
|
+
\*************************************************************************/
|
|
332
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
333
|
+
|
|
334
|
+
"use strict";
|
|
335
|
+
|
|
336
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
337
|
+
exports.AttributeListenersController = void 0;
|
|
338
|
+
const consumption_1 = __webpack_require__(/*! ../../consumption */ "./dist/consumption/index.js");
|
|
339
|
+
const ConsumptionBaseController_1 = __webpack_require__(/*! ../../consumption/ConsumptionBaseController */ "./dist/consumption/ConsumptionBaseController.js");
|
|
340
|
+
const ConsumptionControllerName_1 = __webpack_require__(/*! ../../consumption/ConsumptionControllerName */ "./dist/consumption/ConsumptionControllerName.js");
|
|
341
|
+
const events_1 = __webpack_require__(/*! ./events */ "./dist/modules/attributeListeners/events/index.js");
|
|
342
|
+
const CreateLocalAttributeListenerParams_1 = __webpack_require__(/*! ./local/CreateLocalAttributeListenerParams */ "./dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js");
|
|
343
|
+
const LocalAttributeListener_1 = __webpack_require__(/*! ./local/LocalAttributeListener */ "./dist/modules/attributeListeners/local/LocalAttributeListener.js");
|
|
344
|
+
class AttributeListenersController extends ConsumptionBaseController_1.ConsumptionBaseController {
|
|
345
|
+
constructor(parent, eventBus, identity) {
|
|
346
|
+
super(ConsumptionControllerName_1.ConsumptionControllerName.AttributeListenersController, parent);
|
|
347
|
+
this.eventBus = eventBus;
|
|
348
|
+
this.identity = identity;
|
|
349
|
+
}
|
|
350
|
+
async init() {
|
|
351
|
+
await super.init();
|
|
352
|
+
this.attributeListeners = await this.parent.accountController.getSynchronizedCollection("AttributeListeners");
|
|
353
|
+
return this;
|
|
354
|
+
}
|
|
355
|
+
async getAttributeListeners(query) {
|
|
356
|
+
const items = await this.attributeListeners.find(query);
|
|
357
|
+
return this.parseArray(items, LocalAttributeListener_1.LocalAttributeListener);
|
|
358
|
+
}
|
|
359
|
+
async getAttributeListener(id) {
|
|
360
|
+
const listener = await this.attributeListeners.read(id.toString());
|
|
361
|
+
if (!listener)
|
|
362
|
+
return;
|
|
363
|
+
return LocalAttributeListener_1.LocalAttributeListener.from(listener);
|
|
364
|
+
}
|
|
365
|
+
async createAttributeListener(params) {
|
|
366
|
+
const parsedParams = CreateLocalAttributeListenerParams_1.CreateLocalAttributeListenerParams.from(params);
|
|
367
|
+
const listener = LocalAttributeListener_1.LocalAttributeListener.from({
|
|
368
|
+
id: await consumption_1.ConsumptionIds.attributeListener.generate(),
|
|
369
|
+
query: parsedParams.query,
|
|
370
|
+
peer: parsedParams.peer
|
|
371
|
+
});
|
|
372
|
+
await this.attributeListeners.create(listener);
|
|
373
|
+
this.eventBus.publish(new events_1.AttributeListenerCreatedEvent(this.identity.address.toString(), listener));
|
|
374
|
+
return listener;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
exports.AttributeListenersController = AttributeListenersController;
|
|
378
|
+
//# sourceMappingURL=AttributeListenersController.js.map
|
|
379
|
+
|
|
380
|
+
/***/ }),
|
|
381
|
+
|
|
382
|
+
/***/ "./dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js":
|
|
383
|
+
/*!*********************************************************************************!*\
|
|
384
|
+
!*** ./dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js ***!
|
|
385
|
+
\*********************************************************************************/
|
|
386
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
387
|
+
|
|
388
|
+
"use strict";
|
|
389
|
+
|
|
390
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
391
|
+
exports.AttributeListenerCreatedEvent = void 0;
|
|
392
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
393
|
+
class AttributeListenerCreatedEvent extends transport_1.TransportDataEvent {
|
|
394
|
+
constructor(eventTargetAddress, data) {
|
|
395
|
+
super(AttributeListenerCreatedEvent.namespace, eventTargetAddress, data);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
exports.AttributeListenerCreatedEvent = AttributeListenerCreatedEvent;
|
|
399
|
+
AttributeListenerCreatedEvent.namespace = "consumption.attributeListenerCreated";
|
|
400
|
+
//# sourceMappingURL=AttributeListenerCreatedEvent.js.map
|
|
401
|
+
|
|
402
|
+
/***/ }),
|
|
403
|
+
|
|
404
|
+
/***/ "./dist/modules/attributeListeners/events/index.js":
|
|
405
|
+
/*!*********************************************************!*\
|
|
406
|
+
!*** ./dist/modules/attributeListeners/events/index.js ***!
|
|
407
|
+
\*********************************************************/
|
|
408
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
409
|
+
|
|
410
|
+
"use strict";
|
|
411
|
+
|
|
412
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
413
|
+
if (k2 === undefined) k2 = k;
|
|
414
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
415
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
416
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
417
|
+
}
|
|
418
|
+
Object.defineProperty(o, k2, desc);
|
|
419
|
+
}) : (function(o, m, k, k2) {
|
|
420
|
+
if (k2 === undefined) k2 = k;
|
|
421
|
+
o[k2] = m[k];
|
|
422
|
+
}));
|
|
423
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
424
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
425
|
+
};
|
|
426
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
427
|
+
__exportStar(__webpack_require__(/*! ./AttributeListenerCreatedEvent */ "./dist/modules/attributeListeners/events/AttributeListenerCreatedEvent.js"), exports);
|
|
428
|
+
//# sourceMappingURL=index.js.map
|
|
429
|
+
|
|
430
|
+
/***/ }),
|
|
431
|
+
|
|
432
|
+
/***/ "./dist/modules/attributeListeners/index.js":
|
|
433
|
+
/*!**************************************************!*\
|
|
434
|
+
!*** ./dist/modules/attributeListeners/index.js ***!
|
|
435
|
+
\**************************************************/
|
|
436
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
437
|
+
|
|
438
|
+
"use strict";
|
|
439
|
+
|
|
440
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
441
|
+
if (k2 === undefined) k2 = k;
|
|
442
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
443
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
444
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
445
|
+
}
|
|
446
|
+
Object.defineProperty(o, k2, desc);
|
|
447
|
+
}) : (function(o, m, k, k2) {
|
|
448
|
+
if (k2 === undefined) k2 = k;
|
|
449
|
+
o[k2] = m[k];
|
|
450
|
+
}));
|
|
451
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
452
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
453
|
+
};
|
|
454
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
455
|
+
__exportStar(__webpack_require__(/*! ./AttributeListenersController */ "./dist/modules/attributeListeners/AttributeListenersController.js"), exports);
|
|
456
|
+
__exportStar(__webpack_require__(/*! ./events */ "./dist/modules/attributeListeners/events/index.js"), exports);
|
|
457
|
+
__exportStar(__webpack_require__(/*! ./local/CreateLocalAttributeListenerParams */ "./dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js"), exports);
|
|
458
|
+
__exportStar(__webpack_require__(/*! ./local/LocalAttributeListener */ "./dist/modules/attributeListeners/local/LocalAttributeListener.js"), exports);
|
|
459
|
+
//# sourceMappingURL=index.js.map
|
|
460
|
+
|
|
461
|
+
/***/ }),
|
|
462
|
+
|
|
463
|
+
/***/ "./dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js":
|
|
464
|
+
/*!*************************************************************************************!*\
|
|
465
|
+
!*** ./dist/modules/attributeListeners/local/CreateLocalAttributeListenerParams.js ***!
|
|
466
|
+
\*************************************************************************************/
|
|
467
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
468
|
+
|
|
469
|
+
"use strict";
|
|
470
|
+
|
|
471
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
472
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
473
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
474
|
+
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;
|
|
475
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
476
|
+
};
|
|
477
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
478
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
479
|
+
};
|
|
480
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
481
|
+
exports.CreateLocalAttributeListenerParams = void 0;
|
|
482
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
483
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
484
|
+
class CreateLocalAttributeListenerParams extends ts_serval_1.Serializable {
|
|
485
|
+
static from(value) {
|
|
486
|
+
return this.fromAny(value);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
__decorate([
|
|
490
|
+
(0, ts_serval_1.serialize)(),
|
|
491
|
+
(0, ts_serval_1.validate)(),
|
|
492
|
+
__metadata("design:type", Object)
|
|
493
|
+
], CreateLocalAttributeListenerParams.prototype, "query", void 0);
|
|
494
|
+
__decorate([
|
|
495
|
+
(0, ts_serval_1.serialize)(),
|
|
496
|
+
(0, ts_serval_1.validate)(),
|
|
497
|
+
__metadata("design:type", transport_1.CoreAddress)
|
|
498
|
+
], CreateLocalAttributeListenerParams.prototype, "peer", void 0);
|
|
499
|
+
exports.CreateLocalAttributeListenerParams = CreateLocalAttributeListenerParams;
|
|
500
|
+
//# sourceMappingURL=CreateLocalAttributeListenerParams.js.map
|
|
501
|
+
|
|
502
|
+
/***/ }),
|
|
503
|
+
|
|
504
|
+
/***/ "./dist/modules/attributeListeners/local/LocalAttributeListener.js":
|
|
505
|
+
/*!*************************************************************************!*\
|
|
506
|
+
!*** ./dist/modules/attributeListeners/local/LocalAttributeListener.js ***!
|
|
507
|
+
\*************************************************************************/
|
|
508
|
+
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
|
509
|
+
|
|
510
|
+
"use strict";
|
|
511
|
+
|
|
512
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
513
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
514
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
515
|
+
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;
|
|
516
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
517
|
+
};
|
|
518
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
519
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
520
|
+
};
|
|
521
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
522
|
+
exports.LocalAttributeListener = void 0;
|
|
523
|
+
const ts_serval_1 = __webpack_require__(/*! @js-soft/ts-serval */ "@js-soft/ts-serval");
|
|
524
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
525
|
+
const transport_1 = __webpack_require__(/*! @nmshd/transport */ "@nmshd/transport");
|
|
526
|
+
const ts_simple_nameof_1 = __webpack_require__(/*! ts-simple-nameof */ "./node_modules/ts-simple-nameof/index.js");
|
|
527
|
+
let LocalAttributeListener = class LocalAttributeListener extends transport_1.CoreSynchronizable {
|
|
528
|
+
constructor() {
|
|
529
|
+
super(...arguments);
|
|
530
|
+
this.userdataProperties = [
|
|
531
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.query),
|
|
532
|
+
(0, ts_simple_nameof_1.nameof)((r) => r.peer)
|
|
533
|
+
];
|
|
534
|
+
}
|
|
535
|
+
static from(value) {
|
|
536
|
+
return this.fromAny(value);
|
|
537
|
+
}
|
|
538
|
+
toJSON() {
|
|
539
|
+
return super.toJSON();
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
__decorate([
|
|
543
|
+
(0, ts_serval_1.serialize)({
|
|
544
|
+
unionTypes: [content_1.IdentityAttributeQuery, content_1.RelationshipAttributeQuery, content_1.ThirdPartyRelationshipAttributeQuery]
|
|
545
|
+
}),
|
|
546
|
+
(0, ts_serval_1.validate)(),
|
|
547
|
+
__metadata("design:type", Object)
|
|
548
|
+
], LocalAttributeListener.prototype, "query", void 0);
|
|
549
|
+
__decorate([
|
|
550
|
+
(0, ts_serval_1.serialize)(),
|
|
551
|
+
(0, ts_serval_1.validate)(),
|
|
552
|
+
__metadata("design:type", transport_1.CoreAddress)
|
|
553
|
+
], LocalAttributeListener.prototype, "peer", void 0);
|
|
554
|
+
LocalAttributeListener = __decorate([
|
|
555
|
+
(0, ts_serval_1.type)("LocalAttributeListener")
|
|
556
|
+
], LocalAttributeListener);
|
|
557
|
+
exports.LocalAttributeListener = LocalAttributeListener;
|
|
558
|
+
//# sourceMappingURL=LocalAttributeListener.js.map
|
|
559
|
+
|
|
560
|
+
/***/ }),
|
|
561
|
+
|
|
327
562
|
/***/ "./dist/modules/attributes/LocalAttributesController.js":
|
|
328
563
|
/*!**************************************************************!*\
|
|
329
564
|
!*** ./dist/modules/attributes/LocalAttributesController.js ***!
|
|
@@ -1433,6 +1668,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
1433
1668
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
1434
1669
|
};
|
|
1435
1670
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1671
|
+
__exportStar(__webpack_require__(/*! ./attributeListeners */ "./dist/modules/attributeListeners/index.js"), exports);
|
|
1436
1672
|
__exportStar(__webpack_require__(/*! ./attributes */ "./dist/modules/attributes/index.js"), exports);
|
|
1437
1673
|
__exportStar(__webpack_require__(/*! ./drafts */ "./dist/modules/drafts/index.js"), exports);
|
|
1438
1674
|
__exportStar(__webpack_require__(/*! ./requests */ "./dist/modules/requests/index.js"), exports);
|
|
@@ -2306,6 +2542,7 @@ __exportStar(__webpack_require__(/*! ./itemProcessors/ProcessorConstructor */ ".
|
|
|
2306
2542
|
__exportStar(__webpack_require__(/*! ./itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/proposeAttribute/AcceptProposeAttributeRequestItemParameters.js"), exports);
|
|
2307
2543
|
__exportStar(__webpack_require__(/*! ./itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/proposeAttribute/ProposeAttributeRequestItemProcessor.js"), exports);
|
|
2308
2544
|
__exportStar(__webpack_require__(/*! ./itemProcessors/readAttribute/ReadAttributeRequestItemProcessor */ "./dist/modules/requests/itemProcessors/readAttribute/ReadAttributeRequestItemProcessor.js"), exports);
|
|
2545
|
+
__exportStar(__webpack_require__(/*! ./itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor */ "./dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js"), exports);
|
|
2309
2546
|
__exportStar(__webpack_require__(/*! ./itemProcessors/RequestItemConstructor */ "./dist/modules/requests/itemProcessors/RequestItemConstructor.js"), exports);
|
|
2310
2547
|
__exportStar(__webpack_require__(/*! ./itemProcessors/RequestItemProcessorRegistry */ "./dist/modules/requests/itemProcessors/RequestItemProcessorRegistry.js"), exports);
|
|
2311
2548
|
__exportStar(__webpack_require__(/*! ./itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters */ "./dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js"), exports);
|
|
@@ -2969,6 +3206,35 @@ exports.ReadAttributeRequestItemProcessor = ReadAttributeRequestItemProcessor;
|
|
|
2969
3206
|
|
|
2970
3207
|
/***/ }),
|
|
2971
3208
|
|
|
3209
|
+
/***/ "./dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js":
|
|
3210
|
+
/*!*************************************************************************************************************************!*\
|
|
3211
|
+
!*** ./dist/modules/requests/itemProcessors/registerAttributeListener/RegisterAttributeListenerRequestItemProcessor.js ***!
|
|
3212
|
+
\*************************************************************************************************************************/
|
|
3213
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
3214
|
+
|
|
3215
|
+
"use strict";
|
|
3216
|
+
|
|
3217
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3218
|
+
exports.RegisterAttributeListenerRequestItemProcessor = void 0;
|
|
3219
|
+
const content_1 = __webpack_require__(/*! @nmshd/content */ "@nmshd/content");
|
|
3220
|
+
const GenericRequestItemProcessor_1 = __webpack_require__(/*! ../GenericRequestItemProcessor */ "./dist/modules/requests/itemProcessors/GenericRequestItemProcessor.js");
|
|
3221
|
+
class RegisterAttributeListenerRequestItemProcessor extends GenericRequestItemProcessor_1.GenericRequestItemProcessor {
|
|
3222
|
+
async accept(requestItem, _params, requestInfo) {
|
|
3223
|
+
const listener = await this.consumptionController.attributeListeners.createAttributeListener({
|
|
3224
|
+
peer: requestInfo.peer,
|
|
3225
|
+
query: requestItem.query
|
|
3226
|
+
});
|
|
3227
|
+
return content_1.RegisterAttributeListenerAcceptResponseItem.from({
|
|
3228
|
+
result: content_1.ResponseItemResult.Accepted,
|
|
3229
|
+
listenerId: listener.id.toString()
|
|
3230
|
+
});
|
|
3231
|
+
}
|
|
3232
|
+
}
|
|
3233
|
+
exports.RegisterAttributeListenerRequestItemProcessor = RegisterAttributeListenerRequestItemProcessor;
|
|
3234
|
+
//# sourceMappingURL=RegisterAttributeListenerRequestItemProcessor.js.map
|
|
3235
|
+
|
|
3236
|
+
/***/ }),
|
|
3237
|
+
|
|
2972
3238
|
/***/ "./dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js":
|
|
2973
3239
|
/*!**********************************************************************************************************!*\
|
|
2974
3240
|
!*** ./dist/modules/requests/itemProcessors/shareAttribute/AcceptShareAttributeRequestItemParameters.js ***!
|
|
@@ -9111,7 +9377,8 @@ function clone$1(dur, alts, clear = false) {
|
|
|
9111
9377
|
...(alts.values || {})
|
|
9112
9378
|
},
|
|
9113
9379
|
loc: dur.loc.clone(alts.loc),
|
|
9114
|
-
conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy
|
|
9380
|
+
conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
|
|
9381
|
+
matrix: alts.matrix || dur.matrix
|
|
9115
9382
|
};
|
|
9116
9383
|
return new Duration(conf);
|
|
9117
9384
|
}
|
|
@@ -9150,7 +9417,7 @@ function normalizeValues(matrix, vals) {
|
|
|
9150
9417
|
*
|
|
9151
9418
|
* Here is a brief overview of commonly used methods and getters in Duration:
|
|
9152
9419
|
*
|
|
9153
|
-
* * **Creation** To create a Duration, use {@link Duration
|
|
9420
|
+
* * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}.
|
|
9154
9421
|
* * **Unit values** See the {@link Duration#years}, {@link Duration#months}, {@link Duration#weeks}, {@link Duration#days}, {@link Duration#hours}, {@link Duration#minutes}, {@link Duration#seconds}, {@link Duration#milliseconds} accessors.
|
|
9155
9422
|
* * **Configuration** See {@link Duration#locale} and {@link Duration#numberingSystem} accessors.
|
|
9156
9423
|
* * **Transformation** To create new Durations out of old ones use {@link Duration#plus}, {@link Duration#minus}, {@link Duration#normalize}, {@link Duration#set}, {@link Duration#reconfigure}, {@link Duration#shiftTo}, and {@link Duration#negate}.
|
|
@@ -9166,10 +9433,16 @@ class Duration {
|
|
|
9166
9433
|
*/
|
|
9167
9434
|
constructor(config) {
|
|
9168
9435
|
const accurate = config.conversionAccuracy === "longterm" || false;
|
|
9436
|
+
let matrix = accurate ? accurateMatrix : casualMatrix;
|
|
9437
|
+
|
|
9438
|
+
if (config.matrix) {
|
|
9439
|
+
matrix = config.matrix;
|
|
9440
|
+
}
|
|
9169
9441
|
/**
|
|
9170
9442
|
* @access private
|
|
9171
9443
|
*/
|
|
9172
9444
|
|
|
9445
|
+
|
|
9173
9446
|
this.values = config.values;
|
|
9174
9447
|
/**
|
|
9175
9448
|
* @access private
|
|
@@ -9190,7 +9463,7 @@ class Duration {
|
|
|
9190
9463
|
* @access private
|
|
9191
9464
|
*/
|
|
9192
9465
|
|
|
9193
|
-
this.matrix =
|
|
9466
|
+
this.matrix = matrix;
|
|
9194
9467
|
/**
|
|
9195
9468
|
* @access private
|
|
9196
9469
|
*/
|
|
@@ -9229,7 +9502,8 @@ class Duration {
|
|
|
9229
9502
|
* @param {Object} [opts=[]] - options for creating this Duration
|
|
9230
9503
|
* @param {string} [opts.locale='en-US'] - the locale to use
|
|
9231
9504
|
* @param {string} opts.numberingSystem - the numbering system to use
|
|
9232
|
-
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
|
|
9505
|
+
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
|
|
9506
|
+
* @param {string} [opts.matrix=Object] - the custom conversion system to use
|
|
9233
9507
|
* @return {Duration}
|
|
9234
9508
|
*/
|
|
9235
9509
|
|
|
@@ -9242,7 +9516,8 @@ class Duration {
|
|
|
9242
9516
|
return new Duration({
|
|
9243
9517
|
values: normalizeObject(obj, Duration.normalizeUnit),
|
|
9244
9518
|
loc: Locale.fromObject(opts),
|
|
9245
|
-
conversionAccuracy: opts.conversionAccuracy
|
|
9519
|
+
conversionAccuracy: opts.conversionAccuracy,
|
|
9520
|
+
matrix: opts.matrix
|
|
9246
9521
|
});
|
|
9247
9522
|
}
|
|
9248
9523
|
/**
|
|
@@ -9274,7 +9549,8 @@ class Duration {
|
|
|
9274
9549
|
* @param {Object} opts - options for parsing
|
|
9275
9550
|
* @param {string} [opts.locale='en-US'] - the locale to use
|
|
9276
9551
|
* @param {string} opts.numberingSystem - the numbering system to use
|
|
9277
|
-
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
|
|
9552
|
+
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
|
|
9553
|
+
* @param {string} [opts.matrix=Object] - the preset conversion system to use
|
|
9278
9554
|
* @see https://en.wikipedia.org/wiki/ISO_8601#Durations
|
|
9279
9555
|
* @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 }
|
|
9280
9556
|
* @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 }
|
|
@@ -9298,7 +9574,8 @@ class Duration {
|
|
|
9298
9574
|
* @param {Object} opts - options for parsing
|
|
9299
9575
|
* @param {string} [opts.locale='en-US'] - the locale to use
|
|
9300
9576
|
* @param {string} opts.numberingSystem - the numbering system to use
|
|
9301
|
-
* @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use
|
|
9577
|
+
* @param {string} [opts.conversionAccuracy='casual'] - the preset conversion system to use
|
|
9578
|
+
* @param {string} [opts.matrix=Object] - the conversion system to use
|
|
9302
9579
|
* @see https://en.wikipedia.org/wiki/ISO_8601#Times
|
|
9303
9580
|
* @example Duration.fromISOTime('11:22:33.444').toObject() //=> { hours: 11, minutes: 22, seconds: 33, milliseconds: 444 }
|
|
9304
9581
|
* @example Duration.fromISOTime('11:00').toObject() //=> { hours: 11, minutes: 0, seconds: 0 }
|
|
@@ -9629,7 +9906,7 @@ class Duration {
|
|
|
9629
9906
|
* Scale this Duration by the specified amount. Return a newly-constructed Duration.
|
|
9630
9907
|
* @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number.
|
|
9631
9908
|
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits(x => x * 2) //=> { hours: 2, minutes: 60 }
|
|
9632
|
-
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "
|
|
9909
|
+
* @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnits((x, u) => u === "hours" ? x * 2 : x) //=> { hours: 2, minutes: 30 }
|
|
9633
9910
|
* @return {Duration}
|
|
9634
9911
|
*/
|
|
9635
9912
|
|
|
@@ -9687,20 +9964,18 @@ class Duration {
|
|
|
9687
9964
|
reconfigure({
|
|
9688
9965
|
locale,
|
|
9689
9966
|
numberingSystem,
|
|
9690
|
-
conversionAccuracy
|
|
9967
|
+
conversionAccuracy,
|
|
9968
|
+
matrix
|
|
9691
9969
|
} = {}) {
|
|
9692
9970
|
const loc = this.loc.clone({
|
|
9693
9971
|
locale,
|
|
9694
9972
|
numberingSystem
|
|
9695
|
-
})
|
|
9696
|
-
|
|
9697
|
-
loc
|
|
9973
|
+
});
|
|
9974
|
+
const opts = {
|
|
9975
|
+
loc,
|
|
9976
|
+
matrix,
|
|
9977
|
+
conversionAccuracy
|
|
9698
9978
|
};
|
|
9699
|
-
|
|
9700
|
-
if (conversionAccuracy) {
|
|
9701
|
-
opts.conversionAccuracy = conversionAccuracy;
|
|
9702
|
-
}
|
|
9703
|
-
|
|
9704
9979
|
return clone$1(this, opts);
|
|
9705
9980
|
}
|
|
9706
9981
|
/**
|
|
@@ -9974,10 +10249,10 @@ function validateStartEnd(start, end) {
|
|
|
9974
10249
|
*
|
|
9975
10250
|
* Here is a brief overview of the most commonly used methods and getters in Interval:
|
|
9976
10251
|
*
|
|
9977
|
-
* * **Creation** To create an Interval, use {@link Interval
|
|
10252
|
+
* * **Creation** To create an Interval, use {@link Interval.fromDateTimes}, {@link Interval.after}, {@link Interval.before}, or {@link Interval.fromISO}.
|
|
9978
10253
|
* * **Accessors** Use {@link Interval#start} and {@link Interval#end} to get the start and end.
|
|
9979
10254
|
* * **Interrogation** To analyze the Interval, use {@link Interval#count}, {@link Interval#length}, {@link Interval#hasSame}, {@link Interval#contains}, {@link Interval#isAfter}, or {@link Interval#isBefore}.
|
|
9980
|
-
* * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval
|
|
10255
|
+
* * **Transformation** To create other Intervals out of this one, use {@link Interval#set}, {@link Interval#splitAt}, {@link Interval#splitBy}, {@link Interval#divideEqually}, {@link Interval.merge}, {@link Interval.xor}, {@link Interval#union}, {@link Interval#intersection}, or {@link Interval#difference}.
|
|
9981
10256
|
* * **Comparison** To compare this Interval to another one, use {@link Interval#equals}, {@link Interval#overlaps}, {@link Interval#abutsStart}, {@link Interval#abutsEnd}, {@link Interval#engulfs}
|
|
9982
10257
|
* * **Output** To convert the Interval into other representations, see {@link Interval#toString}, {@link Interval#toISO}, {@link Interval#toISODate}, {@link Interval#toISOTime}, {@link Interval#toFormat}, and {@link Interval#toDuration}.
|
|
9983
10258
|
*/
|
|
@@ -11418,7 +11693,6 @@ function expandMacroTokens(tokens, locale) {
|
|
|
11418
11693
|
* @private
|
|
11419
11694
|
*/
|
|
11420
11695
|
|
|
11421
|
-
|
|
11422
11696
|
function explainFromTokens(locale, input, format) {
|
|
11423
11697
|
const tokens = expandMacroTokens(Formatter.parseFormat(format), locale),
|
|
11424
11698
|
units = tokens.map(t => unitForToken(t, locale)),
|
|
@@ -12014,7 +12288,7 @@ function lastOpts(argList) {
|
|
|
12014
12288
|
*
|
|
12015
12289
|
* Here is a brief overview of the most commonly used functionality it provides:
|
|
12016
12290
|
*
|
|
12017
|
-
* * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime
|
|
12291
|
+
* * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link DateTime.local}, {@link DateTime.utc}, and (most flexibly) {@link DateTime.fromObject}. To create one from a standard string format, use {@link DateTime.fromISO}, {@link DateTime.fromHTTP}, and {@link DateTime.fromRFC2822}. To create one from a custom string format, use {@link DateTime.fromFormat}. To create one from a native JS date, use {@link DateTime.fromJSDate}.
|
|
12018
12292
|
* * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link DateTime#toObject}), use the {@link DateTime#year}, {@link DateTime#month},
|
|
12019
12293
|
* {@link DateTime#day}, {@link DateTime#hour}, {@link DateTime#minute}, {@link DateTime#second}, {@link DateTime#millisecond} accessors.
|
|
12020
12294
|
* * **Week calendar**: For ISO week calendar attributes, see the {@link DateTime#weekYear}, {@link DateTime#weekNumber}, and {@link DateTime#weekday} accessors.
|
|
@@ -12553,6 +12827,19 @@ class DateTime {
|
|
|
12553
12827
|
static parseFormatForOpts(formatOpts, localeOpts = {}) {
|
|
12554
12828
|
const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
|
|
12555
12829
|
return !tokenList ? null : tokenList.map(t => t ? t.val : null).join("");
|
|
12830
|
+
}
|
|
12831
|
+
/**
|
|
12832
|
+
* Produce the the fully expanded format token for the locale
|
|
12833
|
+
* Does NOT quote characters, so quoted tokens will not round trip correctly
|
|
12834
|
+
* @param fmt
|
|
12835
|
+
* @param localeOpts
|
|
12836
|
+
* @returns {string}
|
|
12837
|
+
*/
|
|
12838
|
+
|
|
12839
|
+
|
|
12840
|
+
static expandFormat(fmt, localeOpts = {}) {
|
|
12841
|
+
const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
|
|
12842
|
+
return expanded.map(t => t.val).join("");
|
|
12556
12843
|
} // INFO
|
|
12557
12844
|
|
|
12558
12845
|
/**
|
|
@@ -13245,8 +13532,8 @@ class DateTime {
|
|
|
13245
13532
|
* @param {Object} opts - opts to override the configuration options on this DateTime
|
|
13246
13533
|
* @example DateTime.now().toLocaleString(); //=> 4/20/2017
|
|
13247
13534
|
* @example DateTime.now().setLocale('en-gb').toLocaleString(); //=> '20/04/2017'
|
|
13248
|
-
* @example DateTime.now().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017'
|
|
13249
13535
|
* @example DateTime.now().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017'
|
|
13536
|
+
* @example DateTime.now().toLocaleString(DateTime.DATE_FULL, { locale: 'fr' }); //=> '28 août 2022'
|
|
13250
13537
|
* @example DateTime.now().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM'
|
|
13251
13538
|
* @example DateTime.now().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM'
|
|
13252
13539
|
* @example DateTime.now().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20'
|
|
@@ -13283,7 +13570,7 @@ class DateTime {
|
|
|
13283
13570
|
* @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0
|
|
13284
13571
|
* @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0
|
|
13285
13572
|
* @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00'
|
|
13286
|
-
* @param {boolean} [opts.extendedZone=
|
|
13573
|
+
* @param {boolean} [opts.extendedZone=false] - add the time zone format extension
|
|
13287
13574
|
* @param {string} [opts.format='extended'] - choose between the basic and extended format
|
|
13288
13575
|
* @example DateTime.utc(1983, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z'
|
|
13289
13576
|
* @example DateTime.now().toISO() //=> '2017-04-22T20:47:05.335-04:00'
|
|
@@ -13988,7 +14275,7 @@ function friendlyDateTime(dateTimeish) {
|
|
|
13988
14275
|
}
|
|
13989
14276
|
}
|
|
13990
14277
|
|
|
13991
|
-
const VERSION = "3.0.
|
|
14278
|
+
const VERSION = "3.0.3";
|
|
13992
14279
|
|
|
13993
14280
|
exports.DateTime = DateTime;
|
|
13994
14281
|
exports.Duration = Duration;
|