@pisell/pisellos 0.10.76 → 0.10.77
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/apis/picoding.d.ts +0 -0
- package/dist/effects/index.d.ts +19 -0
- package/dist/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/dist/model/strategy/adapter/dataVariant/evaluator.d.ts +105 -0
- package/dist/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/dist/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/dist/model/strategy/adapter/dataVariant/type.d.ts +173 -0
- package/dist/model/strategy/adapter/promotion/adapter.d.ts +70 -0
- package/dist/model/strategy/adapter/promotion/examples.d.ts +224 -0
- package/dist/model/strategy/adapter/promotion/index.js +0 -9
- package/dist/model/strategy/adapter/promotion/type.d.ts +535 -0
- package/dist/model/strategy/adapter/type.d.ts +28 -0
- package/dist/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/dist/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/dist/model/strategy/adapter/walletPass/type.d.ts +192 -0
- package/dist/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/dist/model/strategy/engine.d.ts +119 -0
- package/dist/model/strategy/type.d.ts +245 -0
- package/dist/modules/Account/types.d.ts +56 -0
- package/dist/modules/BookingContext/types.d.ts +104 -0
- package/dist/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/dist/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/dist/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/dist/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/dist/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/dist/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/dist/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/dist/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/dist/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/dist/modules/Customer/constants.d.ts +7 -0
- package/dist/modules/Date/types.d.ts +84 -0
- package/dist/modules/Date/utils.d.ts +36 -0
- package/dist/modules/FulfillmentTiming/index.d.ts +11 -0
- package/dist/modules/FulfillmentTiming/types.d.ts +67 -0
- package/dist/modules/Order/payment-utils.d.ts +26 -0
- package/dist/modules/Order/pickupTiming.d.ts +46 -0
- package/dist/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/dist/modules/Order/utils/orderCollectionIdentity.d.ts +68 -0
- package/dist/modules/Order/utils/weighedProduct.d.ts +12 -0
- package/dist/modules/Payment/cashRecommendationAlgorithm.d.ts +21 -0
- package/dist/modules/Payment/mx51.d.ts +0 -0
- package/dist/modules/Payment/types.d.ts +943 -0
- package/dist/modules/Payment/utils.d.ts +19 -0
- package/dist/modules/Quotation/types.d.ts +61 -0
- package/dist/modules/Resource/types.d.ts +50 -0
- package/dist/modules/Resource/utils.d.ts +23 -0
- package/dist/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/dist/modules/SalesSummary/types.d.ts +69 -0
- package/dist/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/dist/modules/ScanOrderLogger/types.d.ts +53 -0
- package/dist/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
- package/dist/modules/Schedule/type.d.ts +157 -0
- package/dist/modules/Schedule/types.d.ts +201 -0
- package/dist/modules/Schedule/utils.d.ts +67 -0
- package/dist/modules/Step/tyeps.d.ts +20 -0
- package/dist/modules/SurchargeList/types.d.ts +15 -0
- package/dist/plugins/app.d.ts +10 -0
- package/dist/plugins/shopStore.d.ts +4 -0
- package/dist/plugins/user.d.ts +7 -0
- package/dist/server/modules/floor-plan/types.d.ts +43 -0
- package/dist/server/modules/menu/types.d.ts +68 -0
- package/dist/server/modules/payment/types.d.ts +9 -0
- package/dist/server/modules/quotation/types.d.ts +50 -0
- package/dist/server/modules/resource/types.d.ts +121 -0
- package/dist/server/modules/schedule/types.d.ts +1 -0
- package/dist/server/modules/schedule/utils.d.ts +32 -0
- package/dist/server/types.d.ts +66 -0
- package/dist/server/utils/index.d.ts +5 -0
- package/dist/server/utils/schedule.d.ts +14 -0
- package/dist/server/utils/time.d.ts +18 -0
- package/dist/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/dist/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/dist/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/dist/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +38 -0
- package/dist/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/dist/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/dist/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/dist/solution/PlaceOrder/index.d.ts +0 -0
- package/dist/solution/RegisterAndLogin/config.d.ts +93 -0
- package/dist/solution/RegisterAndLogin/types.d.ts +445 -0
- package/dist/solution/RegisterAndLogin/utils.d.ts +103 -0
- package/dist/solution/UnifiedBookingSales/index.js +107 -58
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/dist/solution/UnifiedBookingSales/remoteOccupancyCache.js +4 -0
- package/dist/solution/UnifiedBookingSales/types.d.ts +2 -0
- package/dist/store/createStore.d.ts +3 -0
- package/dist/types/index.d.ts +132 -0
- package/dist/utils/os-private-payload.d.ts +5 -0
- package/dist/utils/payment-number.d.ts +9 -0
- package/dist/utils/task.d.ts +40 -0
- package/dist/utils/watch.d.ts +102 -0
- package/lib/apis/picoding.d.ts +0 -0
- package/lib/effects/index.d.ts +19 -0
- package/lib/model/strategy/adapter/dataVariant/adapter.d.ts +50 -0
- package/lib/model/strategy/adapter/dataVariant/evaluator.d.ts +105 -0
- package/lib/model/strategy/adapter/dataVariant/examples.d.ts +39 -0
- package/lib/model/strategy/adapter/dataVariant/index.d.ts +4 -0
- package/lib/model/strategy/adapter/dataVariant/type.d.ts +173 -0
- package/lib/model/strategy/adapter/promotion/adapter.d.ts +70 -0
- package/lib/model/strategy/adapter/promotion/examples.d.ts +224 -0
- package/lib/model/strategy/adapter/promotion/index.js +1 -46
- package/lib/model/strategy/adapter/promotion/type.d.ts +535 -0
- package/lib/model/strategy/adapter/type.d.ts +28 -0
- package/lib/model/strategy/adapter/walletPass/index.d.ts +32 -0
- package/lib/model/strategy/adapter/walletPass/locales.d.ts +1 -0
- package/lib/model/strategy/adapter/walletPass/type.d.ts +192 -0
- package/lib/model/strategy/adapter/walletPass/utils.d.ts +50 -0
- package/lib/model/strategy/engine.d.ts +119 -0
- package/lib/model/strategy/type.d.ts +245 -0
- package/lib/modules/Account/types.d.ts +56 -0
- package/lib/modules/BookingContext/types.d.ts +104 -0
- package/lib/modules/BookingContext/utils/cacheItemToBookingInput.d.ts +76 -0
- package/lib/modules/BookingContext/utils/flexible.d.ts +28 -0
- package/lib/modules/BookingContext/utils/formatResourceList.d.ts +8 -0
- package/lib/modules/BookingContext/utils/noResource.d.ts +13 -0
- package/lib/modules/BookingContext/utils/orderLineDisplay.d.ts +1 -0
- package/lib/modules/BookingContext/utils/resourceErrors.d.ts +41 -0
- package/lib/modules/BookingContext/utils/resourceSelection.d.ts +7 -0
- package/lib/modules/BookingContext/utils/serviceTimes.d.ts +55 -0
- package/lib/modules/BookingContext/utils/timeSlices.d.ts +42 -0
- package/lib/modules/Customer/constants.d.ts +7 -0
- package/lib/modules/Date/types.d.ts +84 -0
- package/lib/modules/Date/utils.d.ts +36 -0
- package/lib/modules/FulfillmentTiming/index.d.ts +11 -0
- package/lib/modules/FulfillmentTiming/types.d.ts +67 -0
- package/lib/modules/Order/payment-utils.d.ts +26 -0
- package/lib/modules/Order/pickupTiming.d.ts +46 -0
- package/lib/modules/Order/utils/manualProductDiscount.d.ts +106 -0
- package/lib/modules/Order/utils/orderCollectionIdentity.d.ts +68 -0
- package/lib/modules/Order/utils/weighedProduct.d.ts +12 -0
- package/lib/modules/Payment/cashRecommendationAlgorithm.d.ts +21 -0
- package/lib/modules/Payment/mx51.d.ts +0 -0
- package/lib/modules/Payment/types.d.ts +943 -0
- package/lib/modules/Payment/utils.d.ts +19 -0
- package/lib/modules/Quotation/types.d.ts +61 -0
- package/lib/modules/Resource/types.d.ts +50 -0
- package/lib/modules/Resource/utils.d.ts +23 -0
- package/lib/modules/ResourcePlanner/localClock.d.ts +33 -0
- package/lib/modules/SalesSummary/types.d.ts +69 -0
- package/lib/modules/ScanOrderLogger/providers/feishu.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/providers/grafana.d.ts +2 -0
- package/lib/modules/ScanOrderLogger/types.d.ts +53 -0
- package/lib/modules/Schedule/getDateIsInSchedule.d.ts +32 -0
- package/lib/modules/Schedule/type.d.ts +157 -0
- package/lib/modules/Schedule/types.d.ts +201 -0
- package/lib/modules/Schedule/utils.d.ts +67 -0
- package/lib/modules/Step/tyeps.d.ts +20 -0
- package/lib/modules/SurchargeList/types.d.ts +15 -0
- package/lib/plugins/app.d.ts +10 -0
- package/lib/plugins/shopStore.d.ts +4 -0
- package/lib/plugins/user.d.ts +7 -0
- package/lib/server/modules/floor-plan/types.d.ts +43 -0
- package/lib/server/modules/menu/types.d.ts +68 -0
- package/lib/server/modules/payment/types.d.ts +9 -0
- package/lib/server/modules/quotation/types.d.ts +50 -0
- package/lib/server/modules/resource/types.d.ts +121 -0
- package/lib/server/modules/schedule/types.d.ts +1 -0
- package/lib/server/modules/schedule/utils.d.ts +32 -0
- package/lib/server/types.d.ts +66 -0
- package/lib/server/utils/index.d.ts +5 -0
- package/lib/server/utils/schedule.d.ts +14 -0
- package/lib/server/utils/time.d.ts +18 -0
- package/lib/solution/BookingTicket/utils/bookingStatus.d.ts +77 -0
- package/lib/solution/BookingTicket/utils/exampleData.d.ts +123 -0
- package/lib/solution/BookingTicket/utils/resolveBestAddTimePlan.d.ts +185 -0
- package/lib/solution/BookingTicket/utils/scan/formatGlobalScan.d.ts +38 -0
- package/lib/solution/BookingTicket/utils/scan/scanCache.d.ts +78 -0
- package/lib/solution/BookingTicket/utils/scan/scanProductValues.d.ts +21 -0
- package/lib/solution/BookingTicket/utils/weighingProductSku.d.ts +5 -0
- package/lib/solution/PlaceOrder/index.d.ts +0 -0
- package/lib/solution/RegisterAndLogin/config.d.ts +93 -0
- package/lib/solution/RegisterAndLogin/types.d.ts +445 -0
- package/lib/solution/RegisterAndLogin/utils.d.ts +103 -0
- package/lib/solution/UnifiedBookingSales/index.js +42 -11
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.d.ts +2 -0
- package/lib/solution/UnifiedBookingSales/remoteOccupancyCache.js +2 -0
- package/lib/solution/UnifiedBookingSales/types.d.ts +2 -0
- package/lib/store/createStore.d.ts +3 -0
- package/lib/types/index.d.ts +132 -0
- package/lib/utils/os-private-payload.d.ts +5 -0
- package/lib/utils/payment-number.d.ts +9 -0
- package/lib/utils/task.d.ts +40 -0
- package/lib/utils/watch.d.ts +102 -0
- package/package.json +1 -1
|
@@ -245,6 +245,7 @@ var MAX_AVAILABILITY_RANGE_DAYS = 90;
|
|
|
245
245
|
var MAX_AVAILABILITY_CONTEXT_REGISTRY = 128;
|
|
246
246
|
var MAX_AVAILABILITY_PROJECTION_POOL = 16;
|
|
247
247
|
var MAX_REMOTE_OCCUPANCY_RESOURCE_DATE_CELLS = 4096;
|
|
248
|
+
var PREVIEW_OCCUPANCY_CACHE_MAX_AGE_MS = 30 * 1000;
|
|
248
249
|
function isValidClockTime(value) {
|
|
249
250
|
var match = /^(\d{2}):(\d{2})$/.exec(value);
|
|
250
251
|
if (!match) return false;
|
|
@@ -4323,6 +4324,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4323
4324
|
key: "assertAvailabilityPrepareParams",
|
|
4324
4325
|
value: function assertAvailabilityPrepareParams(params) {
|
|
4325
4326
|
var _params$dateRange3, _params$dateRange4;
|
|
4327
|
+
if (params.occupancyCachePolicy !== undefined && params.occupancyCachePolicy !== 'cache_first') {
|
|
4328
|
+
throw new AvailabilityError('INVALID_TARGET_FILTER', 'Unknown occupancyCachePolicy');
|
|
4329
|
+
}
|
|
4326
4330
|
assertAvailabilityCatalogProductIds(params.productIds, 'prepare.productIds');
|
|
4327
4331
|
var hasProductAnchor = Array.isArray(params.productIds) && params.productIds.length > 0;
|
|
4328
4332
|
var hasResourceAnchor = Array.isArray(params.resourceIds) && params.resourceIds.length > 0;
|
|
@@ -4731,7 +4735,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4731
4735
|
key: "fetchAndPublishAvailabilityResourcesV2",
|
|
4732
4736
|
value: function () {
|
|
4733
4737
|
var _fetchAndPublishAvailabilityResourcesV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee43(params) {
|
|
4734
|
-
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources;
|
|
4738
|
+
var normalizedResourceIds, scopeKey, cacheParams, cachedRawResources, epoch, covering, coveredResources;
|
|
4735
4739
|
return _regeneratorRuntime().wrap(function _callee43$(_context43) {
|
|
4736
4740
|
while (1) switch (_context43.prev = _context43.next) {
|
|
4737
4741
|
case 0:
|
|
@@ -4746,7 +4750,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4746
4750
|
cacheParams = {
|
|
4747
4751
|
scopeKey: scopeKey,
|
|
4748
4752
|
resourceIds: normalizedResourceIds,
|
|
4749
|
-
dateRange: params.dateRange
|
|
4753
|
+
dateRange: params.dateRange,
|
|
4754
|
+
maxAgeMs: params.maxAgeMs
|
|
4750
4755
|
};
|
|
4751
4756
|
cachedRawResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4752
4757
|
if (!cachedRawResources) {
|
|
@@ -4764,15 +4769,51 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4764
4769
|
}
|
|
4765
4770
|
return _context43.abrupt("return", cachedRawResources);
|
|
4766
4771
|
case 9:
|
|
4767
|
-
|
|
4772
|
+
if (!(params.maxAgeMs !== undefined)) {
|
|
4773
|
+
_context43.next = 20;
|
|
4774
|
+
break;
|
|
4775
|
+
}
|
|
4776
|
+
// A visible-month request can cover a concurrent day/resource-subset preview.
|
|
4777
|
+
// Only share fully covering requests; partial overlaps keep the normal fetch path.
|
|
4778
|
+
epoch = this.availabilityRemoteResourceEpoch;
|
|
4779
|
+
covering = Array.from(this.availabilityRemoteResourceQueryInFlight.values()).find(function (entry) {
|
|
4780
|
+
return entry.epoch === epoch && entry.scopeKey === scopeKey && entry.dateRange.startDate <= params.dateRange.startDate && entry.dateRange.endDate >= params.dateRange.endDate && normalizedResourceIds.every(function (id) {
|
|
4781
|
+
return entry.resourceIds.some(function (other) {
|
|
4782
|
+
return String(other) === String(id);
|
|
4783
|
+
});
|
|
4784
|
+
});
|
|
4785
|
+
});
|
|
4786
|
+
if (!covering) {
|
|
4787
|
+
_context43.next = 20;
|
|
4788
|
+
break;
|
|
4789
|
+
}
|
|
4790
|
+
_context43.next = 15;
|
|
4791
|
+
return covering.promise;
|
|
4792
|
+
case 15:
|
|
4793
|
+
if (!(epoch !== this.availabilityRemoteResourceEpoch)) {
|
|
4794
|
+
_context43.next = 17;
|
|
4795
|
+
break;
|
|
4796
|
+
}
|
|
4797
|
+
throw this.createAvailabilityFacadeError('AVAILABILITY_CONTEXT_NOT_FOUND', 'Resource settings changed while loading. Please prepare again.');
|
|
4798
|
+
case 17:
|
|
4799
|
+
// Read a detached, correctly sliced graph after publication. A newer overlapping
|
|
4800
|
+
// response may have invalidated cells, in which case fetch this exact range below.
|
|
4801
|
+
coveredResources = this.availabilityRemoteOccupancyCache.read(cacheParams);
|
|
4802
|
+
if (!coveredResources) {
|
|
4803
|
+
_context43.next = 20;
|
|
4804
|
+
break;
|
|
4805
|
+
}
|
|
4806
|
+
return _context43.abrupt("return", coveredResources);
|
|
4807
|
+
case 20:
|
|
4808
|
+
_context43.next = 22;
|
|
4768
4809
|
return this.refreshAvailabilityRemoteResourceQuery({
|
|
4769
4810
|
timezone: params.timezone,
|
|
4770
4811
|
dateRange: params.dateRange,
|
|
4771
4812
|
resourceIds: normalizedResourceIds
|
|
4772
4813
|
});
|
|
4773
|
-
case
|
|
4814
|
+
case 22:
|
|
4774
4815
|
return _context43.abrupt("return", _context43.sent);
|
|
4775
|
-
case
|
|
4816
|
+
case 23:
|
|
4776
4817
|
case "end":
|
|
4777
4818
|
return _context43.stop();
|
|
4778
4819
|
}
|
|
@@ -4787,7 +4828,8 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4787
4828
|
key: "refreshAvailabilityRemoteResourceQuery",
|
|
4788
4829
|
value: function () {
|
|
4789
4830
|
var _refreshAvailabilityRemoteResourceQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee44(params) {
|
|
4790
|
-
var
|
|
4831
|
+
var _this16 = this;
|
|
4832
|
+
var normalizedResourceIds, queryKey, epoch, existing, writeVersion, scopeKey, promise, current;
|
|
4791
4833
|
return _regeneratorRuntime().wrap(function _callee44$(_context44) {
|
|
4792
4834
|
while (1) switch (_context44.prev = _context44.next) {
|
|
4793
4835
|
case 0:
|
|
@@ -4816,42 +4858,47 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4816
4858
|
case 10:
|
|
4817
4859
|
this.availabilityRemoteResourceQuerySequence += 1;
|
|
4818
4860
|
writeVersion = this.availabilityRemoteResourceQuerySequence;
|
|
4861
|
+
scopeKey = this.buildAvailabilityRemoteResourceScopeKey(params.timezone);
|
|
4819
4862
|
promise = this.fetchAvailabilityResourcesV2({
|
|
4820
4863
|
dateRange: params.dateRange,
|
|
4821
4864
|
resourceIds: normalizedResourceIds
|
|
4865
|
+
}).then(function (rawResources) {
|
|
4866
|
+
if (epoch === _this16.availabilityRemoteResourceEpoch) {
|
|
4867
|
+
_this16.availabilityRemoteOccupancyCache.publish({
|
|
4868
|
+
scopeKey: scopeKey,
|
|
4869
|
+
timezoneName: params.timezone,
|
|
4870
|
+
resourceIds: normalizedResourceIds,
|
|
4871
|
+
dateRange: params.dateRange,
|
|
4872
|
+
rawResources: rawResources,
|
|
4873
|
+
version: writeVersion
|
|
4874
|
+
});
|
|
4875
|
+
}
|
|
4876
|
+
return rawResources;
|
|
4822
4877
|
});
|
|
4823
4878
|
this.availabilityRemoteResourceQueryInFlight.set(queryKey, {
|
|
4824
4879
|
epoch: epoch,
|
|
4880
|
+
scopeKey: scopeKey,
|
|
4881
|
+
dateRange: _objectSpread({}, params.dateRange),
|
|
4882
|
+
resourceIds: _toConsumableArray(normalizedResourceIds),
|
|
4825
4883
|
promise: promise
|
|
4826
4884
|
});
|
|
4827
|
-
_context44.prev =
|
|
4828
|
-
_context44.next =
|
|
4885
|
+
_context44.prev = 15;
|
|
4886
|
+
_context44.next = 18;
|
|
4829
4887
|
return promise;
|
|
4830
|
-
case
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
scopeKey: this.buildAvailabilityRemoteResourceScopeKey(params.timezone),
|
|
4835
|
-
timezoneName: params.timezone,
|
|
4836
|
-
resourceIds: normalizedResourceIds,
|
|
4837
|
-
dateRange: params.dateRange,
|
|
4838
|
-
rawResources: rawResources,
|
|
4839
|
-
version: writeVersion
|
|
4840
|
-
});
|
|
4841
|
-
}
|
|
4842
|
-
return _context44.abrupt("return", rawResources);
|
|
4843
|
-
case 20:
|
|
4844
|
-
_context44.prev = 20;
|
|
4888
|
+
case 18:
|
|
4889
|
+
return _context44.abrupt("return", _context44.sent);
|
|
4890
|
+
case 19:
|
|
4891
|
+
_context44.prev = 19;
|
|
4845
4892
|
current = this.availabilityRemoteResourceQueryInFlight.get(queryKey);
|
|
4846
4893
|
if ((current === null || current === void 0 ? void 0 : current.promise) === promise) {
|
|
4847
4894
|
this.availabilityRemoteResourceQueryInFlight.delete(queryKey);
|
|
4848
4895
|
}
|
|
4849
|
-
return _context44.finish(
|
|
4850
|
-
case
|
|
4896
|
+
return _context44.finish(19);
|
|
4897
|
+
case 23:
|
|
4851
4898
|
case "end":
|
|
4852
4899
|
return _context44.stop();
|
|
4853
4900
|
}
|
|
4854
|
-
}, _callee44, this, [[
|
|
4901
|
+
}, _callee44, this, [[15,, 19, 23]]);
|
|
4855
4902
|
}));
|
|
4856
4903
|
function refreshAvailabilityRemoteResourceQuery(_x30) {
|
|
4857
4904
|
return _refreshAvailabilityRemoteResourceQuery.apply(this, arguments);
|
|
@@ -4930,8 +4977,10 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
4930
4977
|
case 17:
|
|
4931
4978
|
_context45.next = 19;
|
|
4932
4979
|
return this.fetchAndPublishAvailabilityResourcesV2(_objectSpread(_objectSpread({}, remoteQuery), {}, {
|
|
4933
|
-
useCacheOnHit:
|
|
4934
|
-
}
|
|
4980
|
+
useCacheOnHit: params.fetchPolicy !== 'cache_first'
|
|
4981
|
+
}, params.fetchPolicy === 'cache_first' ? {
|
|
4982
|
+
maxAgeMs: PREVIEW_OCCUPANCY_CACHE_MAX_AGE_MS
|
|
4983
|
+
} : {}));
|
|
4935
4984
|
case 19:
|
|
4936
4985
|
_context45.t0 = _context45.sent;
|
|
4937
4986
|
case 20:
|
|
@@ -5021,7 +5070,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5021
5070
|
}, {
|
|
5022
5071
|
key: "collectCartResourceOccupancies",
|
|
5023
5072
|
value: function collectCartResourceOccupancies(tempOrder, exclusions) {
|
|
5024
|
-
var
|
|
5073
|
+
var _this17 = this;
|
|
5025
5074
|
var bookings = Array.isArray(tempOrder === null || tempOrder === void 0 ? void 0 : tempOrder.bookings) ? tempOrder.bookings : [];
|
|
5026
5075
|
return bookings.flatMap(function (booking) {
|
|
5027
5076
|
var _ref51, _booking$product_uid2, _booking$metadata2;
|
|
@@ -5038,7 +5087,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5038
5087
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
5039
5088
|
startAt: startAt,
|
|
5040
5089
|
endAt: endAt,
|
|
5041
|
-
fixedOffsetMinutes:
|
|
5090
|
+
fixedOffsetMinutes: _this17.getAvailabilityRuntimeOffsetMinutes(),
|
|
5042
5091
|
rollOverEnd: false
|
|
5043
5092
|
});
|
|
5044
5093
|
if (!range) return [];
|
|
@@ -5056,7 +5105,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5056
5105
|
resource: resource
|
|
5057
5106
|
}
|
|
5058
5107
|
};
|
|
5059
|
-
return
|
|
5108
|
+
return _this17.occupancyIsExcluded(occupancy, exclusions) ? [] : [occupancy];
|
|
5060
5109
|
});
|
|
5061
5110
|
});
|
|
5062
5111
|
}
|
|
@@ -5123,16 +5172,16 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5123
5172
|
}, {
|
|
5124
5173
|
key: "assertContextualQueryFreshness",
|
|
5125
5174
|
value: function assertContextualQueryFreshness(context, request) {
|
|
5126
|
-
var
|
|
5175
|
+
var _this18 = this;
|
|
5127
5176
|
if (request.target === 'time') {
|
|
5128
5177
|
request.candidates.forEach(function (candidate) {
|
|
5129
|
-
|
|
5178
|
+
_this18.assertAvailabilityCandidateFreshness(context, candidate);
|
|
5130
5179
|
});
|
|
5131
5180
|
return;
|
|
5132
5181
|
}
|
|
5133
5182
|
if (request.target === 'resource') {
|
|
5134
5183
|
request.selectedRanges.forEach(function (candidate) {
|
|
5135
|
-
|
|
5184
|
+
_this18.assertAvailabilityCandidateFreshness(context, candidate);
|
|
5136
5185
|
});
|
|
5137
5186
|
}
|
|
5138
5187
|
}
|
|
@@ -5180,7 +5229,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5180
5229
|
key: "buildAvailabilityProjectionSnapshot",
|
|
5181
5230
|
value: function () {
|
|
5182
5231
|
var _buildAvailabilityProjectionSnapshot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee46(params) {
|
|
5183
|
-
var
|
|
5232
|
+
var _this19 = this;
|
|
5184
5233
|
var options,
|
|
5185
5234
|
normalizedPrepareParams,
|
|
5186
5235
|
timezoneLabel,
|
|
@@ -5236,7 +5285,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5236
5285
|
rawResources: normalizedPrepareParams.rawResources,
|
|
5237
5286
|
scheduleList: scheduleList,
|
|
5238
5287
|
// An explicit internal policy (notably commit's cache_only) remains authoritative.
|
|
5239
|
-
fetchPolicy: options.resourceFetchPolicy || (normalizedPrepareParams.refreshOccupancies ? 'refresh' : 'default'),
|
|
5288
|
+
fetchPolicy: options.resourceFetchPolicy || (normalizedPrepareParams.refreshOccupancies ? 'refresh' : normalizedPrepareParams.occupancyCachePolicy === 'cache_first' ? 'cache_first' : 'default'),
|
|
5240
5289
|
fallbackResources: options.fallbackResources
|
|
5241
5290
|
});
|
|
5242
5291
|
case 14:
|
|
@@ -5247,7 +5296,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5247
5296
|
var range = normalizeAvailabilityLocalDateTimeRange({
|
|
5248
5297
|
startAt: occupancy.startAt,
|
|
5249
5298
|
endAt: occupancy.endAt,
|
|
5250
|
-
fixedOffsetMinutes:
|
|
5299
|
+
fixedOffsetMinutes: _this19.getAvailabilityRuntimeOffsetMinutes(),
|
|
5251
5300
|
rollOverEnd: false
|
|
5252
5301
|
});
|
|
5253
5302
|
if (!range) return [];
|
|
@@ -5257,7 +5306,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5257
5306
|
})];
|
|
5258
5307
|
});
|
|
5259
5308
|
remoteOccupancies = [].concat(_toConsumableArray(loadedResources.resourceOccupancies), _toConsumableArray(loadedResources.includesInjectedRawOccupancies ? [] : injectedRawOccupancies)).filter(function (occupancy) {
|
|
5260
|
-
return !
|
|
5309
|
+
return !_this19.occupancyIsExcluded(occupancy, exclusions);
|
|
5261
5310
|
});
|
|
5262
5311
|
cartOccupancies = this.collectCartResourceOccupancies(tempOrder, exclusions);
|
|
5263
5312
|
preparedAt = this.getAvailabilityRuntimeDateTime();
|
|
@@ -5399,7 +5448,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5399
5448
|
key: "refreshAvailabilityContextProjection",
|
|
5400
5449
|
value: function () {
|
|
5401
5450
|
var _refreshAvailabilityContextProjection = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee49(params) {
|
|
5402
|
-
var
|
|
5451
|
+
var _this20 = this;
|
|
5403
5452
|
var existingInFlight, context, expectedVersion, expectedRefreshNonce, expectedLifecycleGeneration, refreshPromise, current;
|
|
5404
5453
|
return _regeneratorRuntime().wrap(function _callee49$(_context49) {
|
|
5405
5454
|
while (1) switch (_context49.prev = _context49.next) {
|
|
@@ -5424,25 +5473,25 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5424
5473
|
while (1) switch (_context48.prev = _context48.next) {
|
|
5425
5474
|
case 0:
|
|
5426
5475
|
_context48.next = 2;
|
|
5427
|
-
return
|
|
5476
|
+
return _this20.buildAvailabilityProjectionSnapshot(_this20.cloneAvailabilityPrepareParams(context.prepareParams), {
|
|
5428
5477
|
durationCandidateAnchorAt: context.durationCandidateAnchorAt
|
|
5429
5478
|
});
|
|
5430
5479
|
case 2:
|
|
5431
5480
|
snapshot = _context48.sent;
|
|
5432
|
-
currentContext =
|
|
5481
|
+
currentContext = _this20.availabilityContextRegistry.get(params.contextId);
|
|
5433
5482
|
if (currentContext) {
|
|
5434
5483
|
_context48.next = 6;
|
|
5435
5484
|
break;
|
|
5436
5485
|
}
|
|
5437
5486
|
return _context48.abrupt("return", null);
|
|
5438
5487
|
case 6:
|
|
5439
|
-
if (!(expectedLifecycleGeneration !==
|
|
5488
|
+
if (!(expectedLifecycleGeneration !== _this20.availabilityLifecycleGeneration || currentContext.activeVersion !== expectedVersion || currentContext.refreshNonce !== expectedRefreshNonce || currentContext.lifecycleGeneration !== expectedLifecycleGeneration)) {
|
|
5440
5489
|
_context48.next = 8;
|
|
5441
5490
|
break;
|
|
5442
5491
|
}
|
|
5443
5492
|
return _context48.abrupt("return", null);
|
|
5444
5493
|
case 8:
|
|
5445
|
-
projectionEntry =
|
|
5494
|
+
projectionEntry = _this20.storeAvailabilityProjectionEntry({
|
|
5446
5495
|
contextId: currentContext.contextId,
|
|
5447
5496
|
prepareParams: snapshot.prepareParams,
|
|
5448
5497
|
prepareKey: currentContext.prepareKey,
|
|
@@ -5451,7 +5500,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5451
5500
|
incrementVersion: true
|
|
5452
5501
|
});
|
|
5453
5502
|
_context48.next = 11;
|
|
5454
|
-
return
|
|
5503
|
+
return _this20.emitAvailabilityDiagnostic({
|
|
5455
5504
|
action: 'refresh',
|
|
5456
5505
|
contextId: currentContext.contextId,
|
|
5457
5506
|
contextVersion: projectionEntry.contextVersion,
|
|
@@ -5716,7 +5765,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5716
5765
|
var _getProductTimeRanges = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee54(contextId) {
|
|
5717
5766
|
var _this$otherParams$pla,
|
|
5718
5767
|
_this$otherParams36,
|
|
5719
|
-
|
|
5768
|
+
_this21 = this;
|
|
5720
5769
|
var request,
|
|
5721
5770
|
_yield$this$ensureAva,
|
|
5722
5771
|
context,
|
|
@@ -5754,7 +5803,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5754
5803
|
}).map(function (group) {
|
|
5755
5804
|
return _objectSpread(_objectSpread({}, group), {}, {
|
|
5756
5805
|
ranges: group.ranges.map(function (candidate) {
|
|
5757
|
-
return
|
|
5806
|
+
return _this21.decorateAvailabilityCandidate(context.contextId, contextVersion, candidate);
|
|
5758
5807
|
})
|
|
5759
5808
|
});
|
|
5760
5809
|
}));
|
|
@@ -5918,7 +5967,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5918
5967
|
_params$availabilityC3,
|
|
5919
5968
|
_this$store$order11,
|
|
5920
5969
|
_this$store$order11$e,
|
|
5921
|
-
|
|
5970
|
+
_this22 = this;
|
|
5922
5971
|
var normalizedContextId, isEditingSelection, isPartyReplacement, strictAvailability, hasCommitGuard, guardedOrder, getGuardedCommitIdentity, guardedCommitIdentity, availabilityCommitTargetGuard, guardedCommitPublished, _params$bookingCount, _ref56, _params$orderProduct$, _params$orderProduct, _params$orderProduct2, _params$orderProduct3, _params$orderProduct$2, _params$orderProduct4, _params$orderProduct5, _editingLine$product_, _baseProjection$meta$, _refreshedProjection$, _baseProjection$meta$2, _this$otherParams$pla3, _this$otherParams38, _params$orderProduct$3, _params$orderProduct6, _existingBooking$hold, _existingBooking$meta, _ref57, _params$orderProduct$4, _params$orderProduct7, _params$orderProduct8, _existingBooking$meta2, _existingBooking$meta3, _existingBooking$hold2, _transformed$metadata, _nextContext$activeVe, bookingCount, orderProductQuantity, partySize, _yield$this$ensureAva3, context, projectionEntry, refreshed, boundEditingUids, orderProductId, editingLine, _editingLine$product_2, baseProjection, commitWriteGuard, prepareParams, fallbackResources, commitSnapshot, refreshedProjection, _baseProjection$meta$3, latestContext, candidateDurationMinutes, candidateStartTime, allowPosAvailabilityOverride, refreshedRanges, refreshedCandidateBase, product, validation, forced, capacityConflict, revalidationEntry, revalidatedContext, refreshedCandidate, availabilityCommitGuard, existingBooking, existingBookingUid, booking, transformed, productLineUid, bookingUid, productLineUids, bookingUids, relatedRetailProducts, _transformed$product_, _transformed$product_2, _transformed$product_3, _ref58, _transformed$product_4, update, _this$getTempOrder5, _this$getTempOrder6, _params$salesNotes, _params$salesNotes2, _ref59, beforeProductLineUids, beforeBookingUids, products, addedLines, addedBookings, targetStillCurrent, nextContext, result, emit, release;
|
|
5923
5972
|
return _regeneratorRuntime().wrap(function _callee56$(_context56) {
|
|
5924
5973
|
while (1) switch (_context56.prev = _context56.next) {
|
|
@@ -5947,18 +5996,18 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
5947
5996
|
if (hasCommitGuard) (_this$store$order11 = this.store.order) === null || _this$store$order11 === void 0 || (_this$store$order11$e = _this$store$order11.ensureTempOrder) === null || _this$store$order11$e === void 0 || _this$store$order11$e.call(_this$store$order11);
|
|
5948
5997
|
guardedOrder = hasCommitGuard ? this.getTempOrder() : null;
|
|
5949
5998
|
getGuardedCommitIdentity = function getGuardedCommitIdentity() {
|
|
5950
|
-
var
|
|
5999
|
+
var _this22$otherParams$s, _this22$otherParams, _this22$otherParams2, _this22$core, _this22$getTempOrder, _this22$getTempOrder2;
|
|
5951
6000
|
return JSON.stringify(stableValue({
|
|
5952
|
-
scope:
|
|
5953
|
-
shopId: (
|
|
5954
|
-
contextShopId: (
|
|
5955
|
-
orderId: (
|
|
5956
|
-
externalSaleNumber: (
|
|
6001
|
+
scope: _this22.getAvailabilityScopeDescriptor(),
|
|
6002
|
+
shopId: (_this22$otherParams$s = (_this22$otherParams = _this22.otherParams) === null || _this22$otherParams === void 0 ? void 0 : _this22$otherParams.shop_id) !== null && _this22$otherParams$s !== void 0 ? _this22$otherParams$s : (_this22$otherParams2 = _this22.otherParams) === null || _this22$otherParams2 === void 0 ? void 0 : _this22$otherParams2.shopId,
|
|
6003
|
+
contextShopId: (_this22$core = _this22.core) === null || _this22$core === void 0 || (_this22$core = _this22$core.context) === null || _this22$core === void 0 ? void 0 : _this22$core.shop_id,
|
|
6004
|
+
orderId: (_this22$getTempOrder = _this22.getTempOrder()) === null || _this22$getTempOrder === void 0 ? void 0 : _this22$getTempOrder.order_id,
|
|
6005
|
+
externalSaleNumber: (_this22$getTempOrder2 = _this22.getTempOrder()) === null || _this22$getTempOrder2 === void 0 ? void 0 : _this22$getTempOrder2.external_sale_number
|
|
5957
6006
|
}));
|
|
5958
6007
|
};
|
|
5959
6008
|
guardedCommitIdentity = hasCommitGuard ? getGuardedCommitIdentity() : '';
|
|
5960
6009
|
availabilityCommitTargetGuard = function availabilityCommitTargetGuard() {
|
|
5961
|
-
return
|
|
6010
|
+
return _this22.getTempOrder() === guardedOrder && getGuardedCommitIdentity() === guardedCommitIdentity;
|
|
5962
6011
|
};
|
|
5963
6012
|
guardedCommitPublished = false;
|
|
5964
6013
|
_context56.next = 18;
|
|
@@ -6301,9 +6350,9 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6301
6350
|
availabilityCommitGuard = hasCommitGuard ? function () {
|
|
6302
6351
|
var _params$availabilityC4;
|
|
6303
6352
|
(_params$availabilityC4 = params.availabilityCommitGuard) === null || _params$availabilityC4 === void 0 || _params$availabilityC4.call(params);
|
|
6304
|
-
|
|
6353
|
+
_this22.assertAvailabilityCommitWriteCAS(commitWriteGuard);
|
|
6305
6354
|
if (!availabilityCommitTargetGuard()) {
|
|
6306
|
-
throw
|
|
6355
|
+
throw _this22.createAvailabilityFacadeError('AVAILABILITY_SELECTION_STALE', '预约加购期间订单或业务已变化');
|
|
6307
6356
|
}
|
|
6308
6357
|
if (!strictAvailability) return;
|
|
6309
6358
|
var currentValidation = validateAvailabilitySelection(refreshedProjection, {
|
|
@@ -6374,7 +6423,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6374
6423
|
}
|
|
6375
6424
|
relatedRetailProducts = params.relatedRetailProducts.map(function (source) {
|
|
6376
6425
|
var _line$metadata3;
|
|
6377
|
-
var line =
|
|
6426
|
+
var line = _this22.buildUnifiedOrderProduct(source, 'unified_booking_sales_retail');
|
|
6378
6427
|
if (!line) throw new AvailabilityError('INVALID_TARGET_FILTER', '无法生成附加商品订单行');
|
|
6379
6428
|
if (((_line$metadata3 = line.metadata) === null || _line$metadata3 === void 0 ? void 0 : _line$metadata3.venue_booking_role) === 'party_extra') {
|
|
6380
6429
|
line.holder_config = {
|
|
@@ -6519,7 +6568,7 @@ export var UnifiedBookingSalesImpl = /*#__PURE__*/function (_BookingTicket) {
|
|
|
6519
6568
|
}
|
|
6520
6569
|
// A notification failure after publication must not invite a duplicate add.
|
|
6521
6570
|
emit = function emit() {
|
|
6522
|
-
return
|
|
6571
|
+
return _this22.core.effects.emit("".concat(_this22.name, ":").concat(UnifiedBookingSalesHooks.onAvailabilitySelectionCommitted), result);
|
|
6523
6572
|
};
|
|
6524
6573
|
if (!guardedCommitPublished) {
|
|
6525
6574
|
_context56.next = 180;
|
|
@@ -11,6 +11,8 @@ export declare class AvailabilityRemoteOccupancyCache {
|
|
|
11
11
|
scopeKey: string;
|
|
12
12
|
resourceIds: AvailabilityId[];
|
|
13
13
|
dateRange: AvailabilityDateRange;
|
|
14
|
+
/** Only opt-in preview reads expire cells; legacy reads retain their SWR semantics. */
|
|
15
|
+
maxAgeMs?: number;
|
|
14
16
|
}): Record<string, any>[] | null;
|
|
15
17
|
hasCompleteCoverage(params: {
|
|
16
18
|
scopeKey: string;
|
|
@@ -146,6 +146,7 @@ export var AvailabilityRemoteOccupancyCache = /*#__PURE__*/function () {
|
|
|
146
146
|
var requestedResourceIds = uniqueIds(params.resourceIds);
|
|
147
147
|
var requestedDates = buildDateList(params.dateRange);
|
|
148
148
|
if (requestedResourceIds.length === 0 || requestedDates.length === 0) return [];
|
|
149
|
+
var now = Date.now();
|
|
149
150
|
var resources = [];
|
|
150
151
|
var _iterator = _createForOfIteratorHelper(requestedResourceIds),
|
|
151
152
|
_step;
|
|
@@ -164,6 +165,9 @@ export var AvailabilityRemoteOccupancyCache = /*#__PURE__*/function () {
|
|
|
164
165
|
if (!cell) return {
|
|
165
166
|
v: null
|
|
166
167
|
};
|
|
168
|
+
if (params.maxAgeMs !== undefined && (now < cell.fetchedAt || now - cell.fetchedAt >= params.maxAgeMs)) return {
|
|
169
|
+
v: null
|
|
170
|
+
};
|
|
167
171
|
cell.eventList.forEach(function (rawEvent) {
|
|
168
172
|
eventList.set(buildEventIdentity(resourceId, rawEvent), cloneDeep(rawEvent));
|
|
169
173
|
});
|
|
@@ -85,6 +85,8 @@ export interface UnifiedBookingSalesPrepareAvailabilityProjectionParams {
|
|
|
85
85
|
publishCatalog?: boolean;
|
|
86
86
|
/** Await remote occupancy refresh instead of stale-while-revalidate. Ignores rawResources; does not lock resources. */
|
|
87
87
|
refreshOccupancies?: boolean;
|
|
88
|
+
/** Preview only: reuse complete resource/date coverage for 30 seconds without a background request. refreshOccupancies takes precedence. Omit to retain stale-while-revalidate. */
|
|
89
|
+
occupancyCachePolicy?: 'cache_first';
|
|
88
90
|
/** Enforce configured sale cutoffs and disable manual POS availability overrides for this context. Defaults to false. */
|
|
89
91
|
strictAvailability?: boolean;
|
|
90
92
|
rawResources?: Record<string, any>[];
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pisell OS 核心类型定义
|
|
3
|
+
*/
|
|
4
|
+
export interface Plugin {
|
|
5
|
+
name: string;
|
|
6
|
+
version: string;
|
|
7
|
+
initialize: () => Promise<void> | void;
|
|
8
|
+
destroy?: () => Promise<void> | void;
|
|
9
|
+
getLocalStorage?: (key: string) => string | null;
|
|
10
|
+
}
|
|
11
|
+
export interface PluginOptions {
|
|
12
|
+
dependencies?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface Module {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
initialize: (core: PisellCore, options: ModuleOptions) => Promise<void> | void;
|
|
18
|
+
/**
|
|
19
|
+
* 父级解决方案运行时更新 otherParams 后,显式通知子模块刷新自己的运行态参数。
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* await module.updateOtherParams?.({ channel: 'pos' }, { changedParams: { channel: 'pos' } });
|
|
23
|
+
*/
|
|
24
|
+
updateOtherParams?: (params: Record<string, any>, meta?: {
|
|
25
|
+
changedParams?: Record<string, any>;
|
|
26
|
+
cover?: boolean;
|
|
27
|
+
}) => Promise<void> | void;
|
|
28
|
+
destroy?: () => Promise<void> | void;
|
|
29
|
+
exports?: Record<string, any>;
|
|
30
|
+
isSolution?: boolean;
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export interface ModuleOptions {
|
|
34
|
+
dependencies?: string[];
|
|
35
|
+
plugins?: string[];
|
|
36
|
+
hooks?: any;
|
|
37
|
+
store?: Record<string, any>;
|
|
38
|
+
initialState?: Record<string, any>;
|
|
39
|
+
otherParams?: Record<string, any>;
|
|
40
|
+
}
|
|
41
|
+
export type EventHandler = (data?: any) => void;
|
|
42
|
+
export interface PisellCore {
|
|
43
|
+
registerPlugin: (plugin: Plugin, options?: PluginOptions) => void;
|
|
44
|
+
getPlugin: <T extends Plugin>(name: string) => T | null;
|
|
45
|
+
hasPlugin: (name: string) => boolean;
|
|
46
|
+
registerModule: (module: Module, options?: ModuleOptions) => void;
|
|
47
|
+
unregisterModule: (module: Module, options?: ModuleOptions) => void;
|
|
48
|
+
getModule: <T extends Module>(name: string) => T | null;
|
|
49
|
+
getModuleExports: <T = any>(name: string) => T | null;
|
|
50
|
+
hasModule: (name: string) => boolean;
|
|
51
|
+
getModuleNames: () => string[];
|
|
52
|
+
effects: {
|
|
53
|
+
on: (event: string, callback: (payload: any) => void) => () => void;
|
|
54
|
+
once: (event: string, callback: (payload: any) => void) => () => void;
|
|
55
|
+
only: (event: string, callback: (payload: any) => void) => () => void;
|
|
56
|
+
off: (event: string, callback: (payload: any) => void) => void;
|
|
57
|
+
emit: (event: string, payload: any, value?: any) => Promise<{
|
|
58
|
+
status: boolean;
|
|
59
|
+
data: any;
|
|
60
|
+
}>;
|
|
61
|
+
offByModuleDestroy: (module: string) => void;
|
|
62
|
+
};
|
|
63
|
+
context: BusinessContext;
|
|
64
|
+
validateContext: (config: ModuleContextConfig) => boolean;
|
|
65
|
+
serverOptions?: ServerOptions;
|
|
66
|
+
server?: any;
|
|
67
|
+
setContext: (ctx: Partial<BusinessContext>) => void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* 业务上下文接口
|
|
71
|
+
*/
|
|
72
|
+
export interface BusinessContext {
|
|
73
|
+
userId?: string;
|
|
74
|
+
companyId?: string;
|
|
75
|
+
locale?: string;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* 上下文验证规则
|
|
80
|
+
*/
|
|
81
|
+
export interface ContextValidationRule {
|
|
82
|
+
name: string;
|
|
83
|
+
required: boolean;
|
|
84
|
+
validate?: (value: any) => boolean;
|
|
85
|
+
message?: string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* 模块上下文配置
|
|
89
|
+
*/
|
|
90
|
+
export interface ModuleContextConfig {
|
|
91
|
+
name: string;
|
|
92
|
+
validations: ContextValidationRule[];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Server 模块配置
|
|
96
|
+
*/
|
|
97
|
+
export interface ServerModuleConfig {
|
|
98
|
+
/** 模块名称 */
|
|
99
|
+
name: string;
|
|
100
|
+
/** 是否自动预加载数据 */
|
|
101
|
+
preload?: boolean;
|
|
102
|
+
/** 模块配置参数 */
|
|
103
|
+
config?: Record<string, any>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Server 配置选项
|
|
107
|
+
*/
|
|
108
|
+
export interface ServerOptions {
|
|
109
|
+
All_DATA_SOURCES: Record<string, any>;
|
|
110
|
+
/** 要启用的模块列表 */
|
|
111
|
+
modules?: string[] | ServerModuleConfig[];
|
|
112
|
+
/** 是否自动初始化数据 */
|
|
113
|
+
autoInitData?: boolean;
|
|
114
|
+
}
|
|
115
|
+
export interface PisellOSOptions {
|
|
116
|
+
debug?: boolean;
|
|
117
|
+
plugins?: Array<{
|
|
118
|
+
plugin: Plugin;
|
|
119
|
+
options?: PluginOptions;
|
|
120
|
+
}>;
|
|
121
|
+
modules?: Array<{
|
|
122
|
+
module: Module;
|
|
123
|
+
options?: ModuleOptions;
|
|
124
|
+
}>;
|
|
125
|
+
context?: BusinessContext;
|
|
126
|
+
/** Server 配置 */
|
|
127
|
+
server?: ServerOptions;
|
|
128
|
+
}
|
|
129
|
+
export interface InitializeServerOptions {
|
|
130
|
+
onModuleLoad?: (module: string) => void;
|
|
131
|
+
onModuleLoadComplete?: (module: string) => void;
|
|
132
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type PaymentNumberAppDataGetter = (key: string) => unknown;
|
|
2
|
+
/**
|
|
3
|
+
* Resolve the synchronous fallback without caching runtime device data.
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolvePaymentNumberDevicePrefixFromDeviceId(getAppData: PaymentNumberAppDataGetter): string;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the latest device segment when a new payment number is generated.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolvePaymentNumberDevicePrefix(getAppData: PaymentNumberAppDataGetter): Promise<string>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
type Action = (...args: any[]) => Promise<any>;
|
|
2
|
+
type Task = {
|
|
3
|
+
uuid: string;
|
|
4
|
+
type: string;
|
|
5
|
+
actionParams?: Record<string, any>;
|
|
6
|
+
};
|
|
7
|
+
declare class Tasks {
|
|
8
|
+
private actions;
|
|
9
|
+
private taskQueue;
|
|
10
|
+
isRunning: boolean;
|
|
11
|
+
constructor(actions?: Map<string, Action>);
|
|
12
|
+
/**
|
|
13
|
+
* 清空所有任务
|
|
14
|
+
*/
|
|
15
|
+
clear(): void;
|
|
16
|
+
/**
|
|
17
|
+
* 清空任务执行队列
|
|
18
|
+
*/
|
|
19
|
+
clearTaskQueue(): void;
|
|
20
|
+
/**
|
|
21
|
+
* 添加action
|
|
22
|
+
* @param name action名称
|
|
23
|
+
* @param action action函数
|
|
24
|
+
*/
|
|
25
|
+
addAction(name: string, action: Action): void;
|
|
26
|
+
/**
|
|
27
|
+
* 添加任务
|
|
28
|
+
* @param task 任务
|
|
29
|
+
*/
|
|
30
|
+
addTask(task: Task): void;
|
|
31
|
+
/**
|
|
32
|
+
* 执行任务
|
|
33
|
+
*/
|
|
34
|
+
run(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* 判定当前的任务是否依然存在
|
|
37
|
+
*/
|
|
38
|
+
isTaskExist(uuid: string): boolean;
|
|
39
|
+
}
|
|
40
|
+
export default Tasks;
|