@trops/dash-core 0.1.719 → 0.1.721
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/index.esm.js +102 -61
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +102 -61
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3811,6 +3811,47 @@ function useWidgetUpdates() {
|
|
|
3811
3811
|
return setNeedsAuth(false);
|
|
3812
3812
|
}, []);
|
|
3813
3813
|
|
|
3814
|
+
// `updates` holds what the last registry check found. The app-launch
|
|
3815
|
+
// Update all dialog and the Widgets page each run this hook, so a
|
|
3816
|
+
// package can be updated (or uninstalled) through the other one. Keep
|
|
3817
|
+
// only entries whose package is still installed at the version the
|
|
3818
|
+
// check was made against; the installed list reloads on every install.
|
|
3819
|
+
var liveUpdates = React.useMemo(function () {
|
|
3820
|
+
if (!updates || updates.size === 0) return updates;
|
|
3821
|
+
var installedVersion = new Map();
|
|
3822
|
+
var _iterator2 = _createForOfIteratorHelper$$(installedWidgets),
|
|
3823
|
+
_step2;
|
|
3824
|
+
try {
|
|
3825
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3826
|
+
var w = _step2.value;
|
|
3827
|
+
if (!w || w.source !== "installed" || !w.version) continue;
|
|
3828
|
+
installedVersion.set(w.packageId || w.name, w.version);
|
|
3829
|
+
}
|
|
3830
|
+
} catch (err) {
|
|
3831
|
+
_iterator2.e(err);
|
|
3832
|
+
} finally {
|
|
3833
|
+
_iterator2.f();
|
|
3834
|
+
}
|
|
3835
|
+
var live = new Map();
|
|
3836
|
+
var _iterator3 = _createForOfIteratorHelper$$(updates),
|
|
3837
|
+
_step3;
|
|
3838
|
+
try {
|
|
3839
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
3840
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
3841
|
+
key = _step3$value[0],
|
|
3842
|
+
info = _step3$value[1];
|
|
3843
|
+
if (info && installedVersion.get(info.name) === info.currentVersion) {
|
|
3844
|
+
live.set(key, info);
|
|
3845
|
+
}
|
|
3846
|
+
}
|
|
3847
|
+
} catch (err) {
|
|
3848
|
+
_iterator3.e(err);
|
|
3849
|
+
} finally {
|
|
3850
|
+
_iterator3.f();
|
|
3851
|
+
}
|
|
3852
|
+
return live.size === updates.size ? updates : live;
|
|
3853
|
+
}, [updates, installedWidgets]);
|
|
3854
|
+
|
|
3814
3855
|
// Derived list of packages with updates available, deduped by
|
|
3815
3856
|
// package id. `updates` carries each entry under TWO keys (the
|
|
3816
3857
|
// package id AND each widget's CM key — see the .set() loop above);
|
|
@@ -3818,14 +3859,14 @@ function useWidgetUpdates() {
|
|
|
3818
3859
|
// widget names that ride along so users see what a single package
|
|
3819
3860
|
// update will actually bring with it.
|
|
3820
3861
|
var packagesWithUpdates = React.useMemo(function () {
|
|
3821
|
-
if (!
|
|
3862
|
+
if (!liveUpdates || liveUpdates.size === 0) return [];
|
|
3822
3863
|
var byPackage = new Map();
|
|
3823
|
-
var
|
|
3824
|
-
|
|
3864
|
+
var _iterator4 = _createForOfIteratorHelper$$(liveUpdates),
|
|
3865
|
+
_step4;
|
|
3825
3866
|
try {
|
|
3826
|
-
for (
|
|
3827
|
-
var
|
|
3828
|
-
info =
|
|
3867
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
3868
|
+
var _step4$value = _slicedToArray(_step4.value, 2),
|
|
3869
|
+
info = _step4$value[1];
|
|
3829
3870
|
if (!info || !info.name) continue;
|
|
3830
3871
|
if (!byPackage.has(info.name)) {
|
|
3831
3872
|
byPackage.set(info.name, {
|
|
@@ -3844,15 +3885,15 @@ function useWidgetUpdates() {
|
|
|
3844
3885
|
// modal for "Slack — updates SlackListChannels, SlackChannelMessages,
|
|
3845
3886
|
// SlackWidget" disclosure.
|
|
3846
3887
|
} catch (err) {
|
|
3847
|
-
|
|
3888
|
+
_iterator4.e(err);
|
|
3848
3889
|
} finally {
|
|
3849
|
-
|
|
3890
|
+
_iterator4.f();
|
|
3850
3891
|
}
|
|
3851
|
-
var
|
|
3852
|
-
|
|
3892
|
+
var _iterator5 = _createForOfIteratorHelper$$(installedWidgets),
|
|
3893
|
+
_step5;
|
|
3853
3894
|
try {
|
|
3854
|
-
for (
|
|
3855
|
-
var w =
|
|
3895
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3896
|
+
var w = _step5.value;
|
|
3856
3897
|
if (!w || w.source !== "installed") continue;
|
|
3857
3898
|
var pkgId = w.packageId || w.name;
|
|
3858
3899
|
var entry = byPackage.get(pkgId);
|
|
@@ -3861,14 +3902,14 @@ function useWidgetUpdates() {
|
|
|
3861
3902
|
}
|
|
3862
3903
|
}
|
|
3863
3904
|
} catch (err) {
|
|
3864
|
-
|
|
3905
|
+
_iterator5.e(err);
|
|
3865
3906
|
} finally {
|
|
3866
|
-
|
|
3907
|
+
_iterator5.f();
|
|
3867
3908
|
}
|
|
3868
3909
|
return Array.from(byPackage.values()).sort(function (a, b) {
|
|
3869
3910
|
return a.name.localeCompare(b.name);
|
|
3870
3911
|
});
|
|
3871
|
-
}, [
|
|
3912
|
+
}, [liveUpdates, installedWidgets]);
|
|
3872
3913
|
|
|
3873
3914
|
// Sequentially update each package in `packageNames`. Sequential
|
|
3874
3915
|
// (not parallel) on purpose: the install IPC hits a single registry
|
|
@@ -3898,7 +3939,7 @@ function useWidgetUpdates() {
|
|
|
3898
3939
|
var computeBatchPreflight = React.useCallback(/*#__PURE__*/function () {
|
|
3899
3940
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(packageNames) {
|
|
3900
3941
|
var _window$mainApi4;
|
|
3901
|
-
var manifests, allRows, _window$mainApi$widge3, _window$mainApi$widge4, rowByWidgetId, rowByComponentName,
|
|
3942
|
+
var manifests, allRows, _window$mainApi$widge3, _window$mainApi$widge4, rowByWidgetId, rowByComponentName, _iterator6, _step6, r, bare, widgetsWithMissing, _iterator7, _step7, _loop, _t7, _t8, _t9;
|
|
3902
3943
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
3903
3944
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3904
3945
|
case 0:
|
|
@@ -3979,28 +4020,28 @@ function useWidgetUpdates() {
|
|
|
3979
4020
|
// packageId) → grant rows (which are keyed by widgetId like
|
|
3980
4021
|
// `trops.slack.SlackChannels`).
|
|
3981
4022
|
rowByComponentName = new Map();
|
|
3982
|
-
|
|
4023
|
+
_iterator6 = _createForOfIteratorHelper$$(allRows);
|
|
3983
4024
|
try {
|
|
3984
|
-
for (
|
|
3985
|
-
r =
|
|
4025
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
4026
|
+
r = _step6.value;
|
|
3986
4027
|
bare = r.widgetId.split(".").pop();
|
|
3987
4028
|
if (bare) rowByComponentName.set(bare, r);
|
|
3988
4029
|
}
|
|
3989
4030
|
} catch (err) {
|
|
3990
|
-
|
|
4031
|
+
_iterator6.e(err);
|
|
3991
4032
|
} finally {
|
|
3992
|
-
|
|
4033
|
+
_iterator6.f();
|
|
3993
4034
|
}
|
|
3994
4035
|
widgetsWithMissing = [];
|
|
3995
|
-
|
|
4036
|
+
_iterator7 = _createForOfIteratorHelper$$(manifests);
|
|
3996
4037
|
_context5.prev = 8;
|
|
3997
4038
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
3998
4039
|
var _manifest$permissions, _manifest$permissions2;
|
|
3999
|
-
var
|
|
4040
|
+
var _step7$value, packageId, manifest, declaredMcp, byComponent, pkgWidgets, _iterator8, _step8, _normalizeGrantsByPro, _window$__dashAppCont, _byComponent$w$name, w, matchingRow, widgetId, grantedMcp, declaredForWidget, missingServers, _t6;
|
|
4000
4041
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
4001
4042
|
while (1) switch (_context4.prev = _context4.next) {
|
|
4002
4043
|
case 0:
|
|
4003
|
-
|
|
4044
|
+
_step7$value = _step7.value, packageId = _step7$value.name, manifest = _step7$value.manifest;
|
|
4004
4045
|
declaredMcp = manifest === null || manifest === void 0 || (_manifest$permissions = manifest.permissions) === null || _manifest$permissions === void 0 ? void 0 : _manifest$permissions.mcp;
|
|
4005
4046
|
if (!(!declaredMcp || Object.keys(declaredMcp).length === 0)) {
|
|
4006
4047
|
_context4.next = 1;
|
|
@@ -4017,15 +4058,15 @@ function useWidgetUpdates() {
|
|
|
4017
4058
|
pkgWidgets = installedWidgets.filter(function (w) {
|
|
4018
4059
|
return (w.packageId || w.name) === packageId;
|
|
4019
4060
|
});
|
|
4020
|
-
|
|
4061
|
+
_iterator8 = _createForOfIteratorHelper$$(pkgWidgets);
|
|
4021
4062
|
_context4.prev = 2;
|
|
4022
|
-
|
|
4063
|
+
_iterator8.s();
|
|
4023
4064
|
case 3:
|
|
4024
|
-
if ((
|
|
4065
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
4025
4066
|
_context4.next = 6;
|
|
4026
4067
|
break;
|
|
4027
4068
|
}
|
|
4028
|
-
w =
|
|
4069
|
+
w = _step8.value;
|
|
4029
4070
|
matchingRow = rowByComponentName.get(w.name) || rowByWidgetId.get("".concat(packageId, ".").concat(w.name));
|
|
4030
4071
|
widgetId = (matchingRow === null || matchingRow === void 0 ? void 0 : matchingRow.widgetId) || "".concat(packageId, ".").concat(w.name); // Saved grants are keyed by provider name ("Algolia Public HR"),
|
|
4031
4072
|
// declared permissions by provider type ("algolia"). Compare
|
|
@@ -4059,10 +4100,10 @@ function useWidgetUpdates() {
|
|
|
4059
4100
|
case 7:
|
|
4060
4101
|
_context4.prev = 7;
|
|
4061
4102
|
_t6 = _context4["catch"](2);
|
|
4062
|
-
|
|
4103
|
+
_iterator8.e(_t6);
|
|
4063
4104
|
case 8:
|
|
4064
4105
|
_context4.prev = 8;
|
|
4065
|
-
|
|
4106
|
+
_iterator8.f();
|
|
4066
4107
|
return _context4.finish(8);
|
|
4067
4108
|
case 9:
|
|
4068
4109
|
case "end":
|
|
@@ -4070,9 +4111,9 @@ function useWidgetUpdates() {
|
|
|
4070
4111
|
}
|
|
4071
4112
|
}, _loop, null, [[2, 7, 8, 9]]);
|
|
4072
4113
|
});
|
|
4073
|
-
|
|
4114
|
+
_iterator7.s();
|
|
4074
4115
|
case 9:
|
|
4075
|
-
if ((
|
|
4116
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
4076
4117
|
_context5.next = 12;
|
|
4077
4118
|
break;
|
|
4078
4119
|
}
|
|
@@ -4092,10 +4133,10 @@ function useWidgetUpdates() {
|
|
|
4092
4133
|
case 13:
|
|
4093
4134
|
_context5.prev = 13;
|
|
4094
4135
|
_t9 = _context5["catch"](8);
|
|
4095
|
-
|
|
4136
|
+
_iterator7.e(_t9);
|
|
4096
4137
|
case 14:
|
|
4097
4138
|
_context5.prev = 14;
|
|
4098
|
-
|
|
4139
|
+
_iterator7.f();
|
|
4099
4140
|
return _context5.finish(14);
|
|
4100
4141
|
case 15:
|
|
4101
4142
|
pushDiag("preflight:computed", {
|
|
@@ -4117,7 +4158,7 @@ function useWidgetUpdates() {
|
|
|
4117
4158
|
}(), [installedWidgets, appProviders]);
|
|
4118
4159
|
var updatePackages = React.useCallback(/*#__PURE__*/function () {
|
|
4119
4160
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(packageNames) {
|
|
4120
|
-
var initial,
|
|
4161
|
+
var initial, _iterator9, _step9, name, preflight, decision, accepted, _iterator0, _step0, w, acceptedAddition, merged, _window$mainApi5, _window$mainApi5$setG, succeeded, failed, failedDetails, _iterator1, _step1, _loop2, succeededSet, _t1, _t10, _t11, _t12;
|
|
4121
4162
|
return _regeneratorRuntime.wrap(function (_context7) {
|
|
4122
4163
|
while (1) switch (_context7.prev = _context7.next) {
|
|
4123
4164
|
case 0:
|
|
@@ -4133,18 +4174,18 @@ function useWidgetUpdates() {
|
|
|
4133
4174
|
// Seed every selected package as pending so the modal renders
|
|
4134
4175
|
// the full per-row state from the first paint.
|
|
4135
4176
|
initial = new Map();
|
|
4136
|
-
|
|
4177
|
+
_iterator9 = _createForOfIteratorHelper$$(packageNames);
|
|
4137
4178
|
try {
|
|
4138
|
-
for (
|
|
4139
|
-
name =
|
|
4179
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
4180
|
+
name = _step9.value;
|
|
4140
4181
|
initial.set(name, {
|
|
4141
4182
|
status: "pending"
|
|
4142
4183
|
});
|
|
4143
4184
|
}
|
|
4144
4185
|
} catch (err) {
|
|
4145
|
-
|
|
4186
|
+
_iterator9.e(err);
|
|
4146
4187
|
} finally {
|
|
4147
|
-
|
|
4188
|
+
_iterator9.f();
|
|
4148
4189
|
}
|
|
4149
4190
|
setBatchStatus(initial);
|
|
4150
4191
|
setIsBatchUpdating(true);
|
|
@@ -4193,15 +4234,15 @@ function useWidgetUpdates() {
|
|
|
4193
4234
|
// loop so the freshly-installed code can immediately use
|
|
4194
4235
|
// what was approved (and is gated from what wasn't).
|
|
4195
4236
|
accepted = decision.acceptedByWidgetId || {};
|
|
4196
|
-
|
|
4237
|
+
_iterator0 = _createForOfIteratorHelper$$(preflight.widgets);
|
|
4197
4238
|
_context7.prev = 6;
|
|
4198
|
-
|
|
4239
|
+
_iterator0.s();
|
|
4199
4240
|
case 7:
|
|
4200
|
-
if ((
|
|
4241
|
+
if ((_step0 = _iterator0.n()).done) {
|
|
4201
4242
|
_context7.next = 13;
|
|
4202
4243
|
break;
|
|
4203
4244
|
}
|
|
4204
|
-
w =
|
|
4245
|
+
w = _step0.value;
|
|
4205
4246
|
acceptedAddition = accepted[w.widgetId];
|
|
4206
4247
|
if (acceptedAddition) {
|
|
4207
4248
|
_context7.next = 8;
|
|
@@ -4243,10 +4284,10 @@ function useWidgetUpdates() {
|
|
|
4243
4284
|
case 14:
|
|
4244
4285
|
_context7.prev = 14;
|
|
4245
4286
|
_t10 = _context7["catch"](6);
|
|
4246
|
-
|
|
4287
|
+
_iterator0.e(_t10);
|
|
4247
4288
|
case 15:
|
|
4248
4289
|
_context7.prev = 15;
|
|
4249
|
-
|
|
4290
|
+
_iterator0.f();
|
|
4250
4291
|
return _context7.finish(15);
|
|
4251
4292
|
case 16:
|
|
4252
4293
|
_context7.next = 18;
|
|
@@ -4277,14 +4318,14 @@ function useWidgetUpdates() {
|
|
|
4277
4318
|
// e.g. a stale registry zip or a verify mismatch).
|
|
4278
4319
|
failedDetails = [];
|
|
4279
4320
|
_context7.prev = 19;
|
|
4280
|
-
|
|
4321
|
+
_iterator1 = _createForOfIteratorHelper$$(packageNames);
|
|
4281
4322
|
_context7.prev = 20;
|
|
4282
4323
|
_loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
|
|
4283
4324
|
var pkgName, msg, _t0;
|
|
4284
4325
|
return _regeneratorRuntime.wrap(function (_context6) {
|
|
4285
4326
|
while (1) switch (_context6.prev = _context6.next) {
|
|
4286
4327
|
case 0:
|
|
4287
|
-
pkgName =
|
|
4328
|
+
pkgName = _step1.value;
|
|
4288
4329
|
// Mark in-progress BEFORE the await so the spinner appears
|
|
4289
4330
|
// immediately, not after the install finishes.
|
|
4290
4331
|
setBatchStatus(function (prev) {
|
|
@@ -4336,9 +4377,9 @@ function useWidgetUpdates() {
|
|
|
4336
4377
|
}
|
|
4337
4378
|
}, _loop2, null, [[1, 3]]);
|
|
4338
4379
|
});
|
|
4339
|
-
|
|
4380
|
+
_iterator1.s();
|
|
4340
4381
|
case 21:
|
|
4341
|
-
if ((
|
|
4382
|
+
if ((_step1 = _iterator1.n()).done) {
|
|
4342
4383
|
_context7.next = 23;
|
|
4343
4384
|
break;
|
|
4344
4385
|
}
|
|
@@ -4352,10 +4393,10 @@ function useWidgetUpdates() {
|
|
|
4352
4393
|
case 24:
|
|
4353
4394
|
_context7.prev = 24;
|
|
4354
4395
|
_t12 = _context7["catch"](20);
|
|
4355
|
-
|
|
4396
|
+
_iterator1.e(_t12);
|
|
4356
4397
|
case 25:
|
|
4357
4398
|
_context7.prev = 25;
|
|
4358
|
-
|
|
4399
|
+
_iterator1.f();
|
|
4359
4400
|
return _context7.finish(25);
|
|
4360
4401
|
case 26:
|
|
4361
4402
|
_context7.prev = 26;
|
|
@@ -4384,21 +4425,21 @@ function useWidgetUpdates() {
|
|
|
4384
4425
|
succeededSet = new Set(succeeded);
|
|
4385
4426
|
setUpdates(function (prev) {
|
|
4386
4427
|
var next = new Map(prev);
|
|
4387
|
-
var
|
|
4388
|
-
|
|
4428
|
+
var _iterator10 = _createForOfIteratorHelper$$(next),
|
|
4429
|
+
_step10;
|
|
4389
4430
|
try {
|
|
4390
|
-
for (
|
|
4391
|
-
var
|
|
4392
|
-
key =
|
|
4393
|
-
val =
|
|
4431
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
4432
|
+
var _step10$value = _slicedToArray(_step10.value, 2),
|
|
4433
|
+
key = _step10$value[0],
|
|
4434
|
+
val = _step10$value[1];
|
|
4394
4435
|
if (val && succeededSet.has(val.name)) {
|
|
4395
4436
|
next["delete"](key);
|
|
4396
4437
|
}
|
|
4397
4438
|
}
|
|
4398
4439
|
} catch (err) {
|
|
4399
|
-
|
|
4440
|
+
_iterator10.e(err);
|
|
4400
4441
|
} finally {
|
|
4401
|
-
|
|
4442
|
+
_iterator10.f();
|
|
4402
4443
|
}
|
|
4403
4444
|
return next;
|
|
4404
4445
|
});
|
|
@@ -4419,7 +4460,7 @@ function useWidgetUpdates() {
|
|
|
4419
4460
|
};
|
|
4420
4461
|
}(), [updateWidget, computeBatchPreflight]);
|
|
4421
4462
|
return {
|
|
4422
|
-
updates:
|
|
4463
|
+
updates: liveUpdates,
|
|
4423
4464
|
packagesWithUpdates: packagesWithUpdates,
|
|
4424
4465
|
isChecking: isChecking,
|
|
4425
4466
|
updateWidget: updateWidget,
|