@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.esm.js
CHANGED
|
@@ -3793,6 +3793,47 @@ function useWidgetUpdates() {
|
|
|
3793
3793
|
return setNeedsAuth(false);
|
|
3794
3794
|
}, []);
|
|
3795
3795
|
|
|
3796
|
+
// `updates` holds what the last registry check found. The app-launch
|
|
3797
|
+
// Update all dialog and the Widgets page each run this hook, so a
|
|
3798
|
+
// package can be updated (or uninstalled) through the other one. Keep
|
|
3799
|
+
// only entries whose package is still installed at the version the
|
|
3800
|
+
// check was made against; the installed list reloads on every install.
|
|
3801
|
+
var liveUpdates = useMemo(function () {
|
|
3802
|
+
if (!updates || updates.size === 0) return updates;
|
|
3803
|
+
var installedVersion = new Map();
|
|
3804
|
+
var _iterator2 = _createForOfIteratorHelper$$(installedWidgets),
|
|
3805
|
+
_step2;
|
|
3806
|
+
try {
|
|
3807
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
3808
|
+
var w = _step2.value;
|
|
3809
|
+
if (!w || w.source !== "installed" || !w.version) continue;
|
|
3810
|
+
installedVersion.set(w.packageId || w.name, w.version);
|
|
3811
|
+
}
|
|
3812
|
+
} catch (err) {
|
|
3813
|
+
_iterator2.e(err);
|
|
3814
|
+
} finally {
|
|
3815
|
+
_iterator2.f();
|
|
3816
|
+
}
|
|
3817
|
+
var live = new Map();
|
|
3818
|
+
var _iterator3 = _createForOfIteratorHelper$$(updates),
|
|
3819
|
+
_step3;
|
|
3820
|
+
try {
|
|
3821
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
3822
|
+
var _step3$value = _slicedToArray(_step3.value, 2),
|
|
3823
|
+
key = _step3$value[0],
|
|
3824
|
+
info = _step3$value[1];
|
|
3825
|
+
if (info && installedVersion.get(info.name) === info.currentVersion) {
|
|
3826
|
+
live.set(key, info);
|
|
3827
|
+
}
|
|
3828
|
+
}
|
|
3829
|
+
} catch (err) {
|
|
3830
|
+
_iterator3.e(err);
|
|
3831
|
+
} finally {
|
|
3832
|
+
_iterator3.f();
|
|
3833
|
+
}
|
|
3834
|
+
return live.size === updates.size ? updates : live;
|
|
3835
|
+
}, [updates, installedWidgets]);
|
|
3836
|
+
|
|
3796
3837
|
// Derived list of packages with updates available, deduped by
|
|
3797
3838
|
// package id. `updates` carries each entry under TWO keys (the
|
|
3798
3839
|
// package id AND each widget's CM key — see the .set() loop above);
|
|
@@ -3800,14 +3841,14 @@ function useWidgetUpdates() {
|
|
|
3800
3841
|
// widget names that ride along so users see what a single package
|
|
3801
3842
|
// update will actually bring with it.
|
|
3802
3843
|
var packagesWithUpdates = useMemo(function () {
|
|
3803
|
-
if (!
|
|
3844
|
+
if (!liveUpdates || liveUpdates.size === 0) return [];
|
|
3804
3845
|
var byPackage = new Map();
|
|
3805
|
-
var
|
|
3806
|
-
|
|
3846
|
+
var _iterator4 = _createForOfIteratorHelper$$(liveUpdates),
|
|
3847
|
+
_step4;
|
|
3807
3848
|
try {
|
|
3808
|
-
for (
|
|
3809
|
-
var
|
|
3810
|
-
info =
|
|
3849
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
3850
|
+
var _step4$value = _slicedToArray(_step4.value, 2),
|
|
3851
|
+
info = _step4$value[1];
|
|
3811
3852
|
if (!info || !info.name) continue;
|
|
3812
3853
|
if (!byPackage.has(info.name)) {
|
|
3813
3854
|
byPackage.set(info.name, {
|
|
@@ -3826,15 +3867,15 @@ function useWidgetUpdates() {
|
|
|
3826
3867
|
// modal for "Slack — updates SlackListChannels, SlackChannelMessages,
|
|
3827
3868
|
// SlackWidget" disclosure.
|
|
3828
3869
|
} catch (err) {
|
|
3829
|
-
|
|
3870
|
+
_iterator4.e(err);
|
|
3830
3871
|
} finally {
|
|
3831
|
-
|
|
3872
|
+
_iterator4.f();
|
|
3832
3873
|
}
|
|
3833
|
-
var
|
|
3834
|
-
|
|
3874
|
+
var _iterator5 = _createForOfIteratorHelper$$(installedWidgets),
|
|
3875
|
+
_step5;
|
|
3835
3876
|
try {
|
|
3836
|
-
for (
|
|
3837
|
-
var w =
|
|
3877
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
3878
|
+
var w = _step5.value;
|
|
3838
3879
|
if (!w || w.source !== "installed") continue;
|
|
3839
3880
|
var pkgId = w.packageId || w.name;
|
|
3840
3881
|
var entry = byPackage.get(pkgId);
|
|
@@ -3843,14 +3884,14 @@ function useWidgetUpdates() {
|
|
|
3843
3884
|
}
|
|
3844
3885
|
}
|
|
3845
3886
|
} catch (err) {
|
|
3846
|
-
|
|
3887
|
+
_iterator5.e(err);
|
|
3847
3888
|
} finally {
|
|
3848
|
-
|
|
3889
|
+
_iterator5.f();
|
|
3849
3890
|
}
|
|
3850
3891
|
return Array.from(byPackage.values()).sort(function (a, b) {
|
|
3851
3892
|
return a.name.localeCompare(b.name);
|
|
3852
3893
|
});
|
|
3853
|
-
}, [
|
|
3894
|
+
}, [liveUpdates, installedWidgets]);
|
|
3854
3895
|
|
|
3855
3896
|
// Sequentially update each package in `packageNames`. Sequential
|
|
3856
3897
|
// (not parallel) on purpose: the install IPC hits a single registry
|
|
@@ -3880,7 +3921,7 @@ function useWidgetUpdates() {
|
|
|
3880
3921
|
var computeBatchPreflight = useCallback(/*#__PURE__*/function () {
|
|
3881
3922
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(packageNames) {
|
|
3882
3923
|
var _window$mainApi4;
|
|
3883
|
-
var manifests, allRows, _window$mainApi$widge3, _window$mainApi$widge4, rowByWidgetId, rowByComponentName,
|
|
3924
|
+
var manifests, allRows, _window$mainApi$widge3, _window$mainApi$widge4, rowByWidgetId, rowByComponentName, _iterator6, _step6, r, bare, widgetsWithMissing, _iterator7, _step7, _loop, _t7, _t8, _t9;
|
|
3884
3925
|
return _regeneratorRuntime.wrap(function (_context5) {
|
|
3885
3926
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3886
3927
|
case 0:
|
|
@@ -3961,28 +4002,28 @@ function useWidgetUpdates() {
|
|
|
3961
4002
|
// packageId) → grant rows (which are keyed by widgetId like
|
|
3962
4003
|
// `trops.slack.SlackChannels`).
|
|
3963
4004
|
rowByComponentName = new Map();
|
|
3964
|
-
|
|
4005
|
+
_iterator6 = _createForOfIteratorHelper$$(allRows);
|
|
3965
4006
|
try {
|
|
3966
|
-
for (
|
|
3967
|
-
r =
|
|
4007
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
4008
|
+
r = _step6.value;
|
|
3968
4009
|
bare = r.widgetId.split(".").pop();
|
|
3969
4010
|
if (bare) rowByComponentName.set(bare, r);
|
|
3970
4011
|
}
|
|
3971
4012
|
} catch (err) {
|
|
3972
|
-
|
|
4013
|
+
_iterator6.e(err);
|
|
3973
4014
|
} finally {
|
|
3974
|
-
|
|
4015
|
+
_iterator6.f();
|
|
3975
4016
|
}
|
|
3976
4017
|
widgetsWithMissing = [];
|
|
3977
|
-
|
|
4018
|
+
_iterator7 = _createForOfIteratorHelper$$(manifests);
|
|
3978
4019
|
_context5.prev = 8;
|
|
3979
4020
|
_loop = /*#__PURE__*/_regeneratorRuntime.mark(function _loop() {
|
|
3980
4021
|
var _manifest$permissions, _manifest$permissions2;
|
|
3981
|
-
var
|
|
4022
|
+
var _step7$value, packageId, manifest, declaredMcp, byComponent, pkgWidgets, _iterator8, _step8, _normalizeGrantsByPro, _window$__dashAppCont, _byComponent$w$name, w, matchingRow, widgetId, grantedMcp, declaredForWidget, missingServers, _t6;
|
|
3982
4023
|
return _regeneratorRuntime.wrap(function (_context4) {
|
|
3983
4024
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3984
4025
|
case 0:
|
|
3985
|
-
|
|
4026
|
+
_step7$value = _step7.value, packageId = _step7$value.name, manifest = _step7$value.manifest;
|
|
3986
4027
|
declaredMcp = manifest === null || manifest === void 0 || (_manifest$permissions = manifest.permissions) === null || _manifest$permissions === void 0 ? void 0 : _manifest$permissions.mcp;
|
|
3987
4028
|
if (!(!declaredMcp || Object.keys(declaredMcp).length === 0)) {
|
|
3988
4029
|
_context4.next = 1;
|
|
@@ -3999,15 +4040,15 @@ function useWidgetUpdates() {
|
|
|
3999
4040
|
pkgWidgets = installedWidgets.filter(function (w) {
|
|
4000
4041
|
return (w.packageId || w.name) === packageId;
|
|
4001
4042
|
});
|
|
4002
|
-
|
|
4043
|
+
_iterator8 = _createForOfIteratorHelper$$(pkgWidgets);
|
|
4003
4044
|
_context4.prev = 2;
|
|
4004
|
-
|
|
4045
|
+
_iterator8.s();
|
|
4005
4046
|
case 3:
|
|
4006
|
-
if ((
|
|
4047
|
+
if ((_step8 = _iterator8.n()).done) {
|
|
4007
4048
|
_context4.next = 6;
|
|
4008
4049
|
break;
|
|
4009
4050
|
}
|
|
4010
|
-
w =
|
|
4051
|
+
w = _step8.value;
|
|
4011
4052
|
matchingRow = rowByComponentName.get(w.name) || rowByWidgetId.get("".concat(packageId, ".").concat(w.name));
|
|
4012
4053
|
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"),
|
|
4013
4054
|
// declared permissions by provider type ("algolia"). Compare
|
|
@@ -4041,10 +4082,10 @@ function useWidgetUpdates() {
|
|
|
4041
4082
|
case 7:
|
|
4042
4083
|
_context4.prev = 7;
|
|
4043
4084
|
_t6 = _context4["catch"](2);
|
|
4044
|
-
|
|
4085
|
+
_iterator8.e(_t6);
|
|
4045
4086
|
case 8:
|
|
4046
4087
|
_context4.prev = 8;
|
|
4047
|
-
|
|
4088
|
+
_iterator8.f();
|
|
4048
4089
|
return _context4.finish(8);
|
|
4049
4090
|
case 9:
|
|
4050
4091
|
case "end":
|
|
@@ -4052,9 +4093,9 @@ function useWidgetUpdates() {
|
|
|
4052
4093
|
}
|
|
4053
4094
|
}, _loop, null, [[2, 7, 8, 9]]);
|
|
4054
4095
|
});
|
|
4055
|
-
|
|
4096
|
+
_iterator7.s();
|
|
4056
4097
|
case 9:
|
|
4057
|
-
if ((
|
|
4098
|
+
if ((_step7 = _iterator7.n()).done) {
|
|
4058
4099
|
_context5.next = 12;
|
|
4059
4100
|
break;
|
|
4060
4101
|
}
|
|
@@ -4074,10 +4115,10 @@ function useWidgetUpdates() {
|
|
|
4074
4115
|
case 13:
|
|
4075
4116
|
_context5.prev = 13;
|
|
4076
4117
|
_t9 = _context5["catch"](8);
|
|
4077
|
-
|
|
4118
|
+
_iterator7.e(_t9);
|
|
4078
4119
|
case 14:
|
|
4079
4120
|
_context5.prev = 14;
|
|
4080
|
-
|
|
4121
|
+
_iterator7.f();
|
|
4081
4122
|
return _context5.finish(14);
|
|
4082
4123
|
case 15:
|
|
4083
4124
|
pushDiag("preflight:computed", {
|
|
@@ -4099,7 +4140,7 @@ function useWidgetUpdates() {
|
|
|
4099
4140
|
}(), [installedWidgets, appProviders]);
|
|
4100
4141
|
var updatePackages = useCallback(/*#__PURE__*/function () {
|
|
4101
4142
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(packageNames) {
|
|
4102
|
-
var initial,
|
|
4143
|
+
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;
|
|
4103
4144
|
return _regeneratorRuntime.wrap(function (_context7) {
|
|
4104
4145
|
while (1) switch (_context7.prev = _context7.next) {
|
|
4105
4146
|
case 0:
|
|
@@ -4115,18 +4156,18 @@ function useWidgetUpdates() {
|
|
|
4115
4156
|
// Seed every selected package as pending so the modal renders
|
|
4116
4157
|
// the full per-row state from the first paint.
|
|
4117
4158
|
initial = new Map();
|
|
4118
|
-
|
|
4159
|
+
_iterator9 = _createForOfIteratorHelper$$(packageNames);
|
|
4119
4160
|
try {
|
|
4120
|
-
for (
|
|
4121
|
-
name =
|
|
4161
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
4162
|
+
name = _step9.value;
|
|
4122
4163
|
initial.set(name, {
|
|
4123
4164
|
status: "pending"
|
|
4124
4165
|
});
|
|
4125
4166
|
}
|
|
4126
4167
|
} catch (err) {
|
|
4127
|
-
|
|
4168
|
+
_iterator9.e(err);
|
|
4128
4169
|
} finally {
|
|
4129
|
-
|
|
4170
|
+
_iterator9.f();
|
|
4130
4171
|
}
|
|
4131
4172
|
setBatchStatus(initial);
|
|
4132
4173
|
setIsBatchUpdating(true);
|
|
@@ -4175,15 +4216,15 @@ function useWidgetUpdates() {
|
|
|
4175
4216
|
// loop so the freshly-installed code can immediately use
|
|
4176
4217
|
// what was approved (and is gated from what wasn't).
|
|
4177
4218
|
accepted = decision.acceptedByWidgetId || {};
|
|
4178
|
-
|
|
4219
|
+
_iterator0 = _createForOfIteratorHelper$$(preflight.widgets);
|
|
4179
4220
|
_context7.prev = 6;
|
|
4180
|
-
|
|
4221
|
+
_iterator0.s();
|
|
4181
4222
|
case 7:
|
|
4182
|
-
if ((
|
|
4223
|
+
if ((_step0 = _iterator0.n()).done) {
|
|
4183
4224
|
_context7.next = 13;
|
|
4184
4225
|
break;
|
|
4185
4226
|
}
|
|
4186
|
-
w =
|
|
4227
|
+
w = _step0.value;
|
|
4187
4228
|
acceptedAddition = accepted[w.widgetId];
|
|
4188
4229
|
if (acceptedAddition) {
|
|
4189
4230
|
_context7.next = 8;
|
|
@@ -4225,10 +4266,10 @@ function useWidgetUpdates() {
|
|
|
4225
4266
|
case 14:
|
|
4226
4267
|
_context7.prev = 14;
|
|
4227
4268
|
_t10 = _context7["catch"](6);
|
|
4228
|
-
|
|
4269
|
+
_iterator0.e(_t10);
|
|
4229
4270
|
case 15:
|
|
4230
4271
|
_context7.prev = 15;
|
|
4231
|
-
|
|
4272
|
+
_iterator0.f();
|
|
4232
4273
|
return _context7.finish(15);
|
|
4233
4274
|
case 16:
|
|
4234
4275
|
_context7.next = 18;
|
|
@@ -4259,14 +4300,14 @@ function useWidgetUpdates() {
|
|
|
4259
4300
|
// e.g. a stale registry zip or a verify mismatch).
|
|
4260
4301
|
failedDetails = [];
|
|
4261
4302
|
_context7.prev = 19;
|
|
4262
|
-
|
|
4303
|
+
_iterator1 = _createForOfIteratorHelper$$(packageNames);
|
|
4263
4304
|
_context7.prev = 20;
|
|
4264
4305
|
_loop2 = /*#__PURE__*/_regeneratorRuntime.mark(function _loop2() {
|
|
4265
4306
|
var pkgName, msg, _t0;
|
|
4266
4307
|
return _regeneratorRuntime.wrap(function (_context6) {
|
|
4267
4308
|
while (1) switch (_context6.prev = _context6.next) {
|
|
4268
4309
|
case 0:
|
|
4269
|
-
pkgName =
|
|
4310
|
+
pkgName = _step1.value;
|
|
4270
4311
|
// Mark in-progress BEFORE the await so the spinner appears
|
|
4271
4312
|
// immediately, not after the install finishes.
|
|
4272
4313
|
setBatchStatus(function (prev) {
|
|
@@ -4318,9 +4359,9 @@ function useWidgetUpdates() {
|
|
|
4318
4359
|
}
|
|
4319
4360
|
}, _loop2, null, [[1, 3]]);
|
|
4320
4361
|
});
|
|
4321
|
-
|
|
4362
|
+
_iterator1.s();
|
|
4322
4363
|
case 21:
|
|
4323
|
-
if ((
|
|
4364
|
+
if ((_step1 = _iterator1.n()).done) {
|
|
4324
4365
|
_context7.next = 23;
|
|
4325
4366
|
break;
|
|
4326
4367
|
}
|
|
@@ -4334,10 +4375,10 @@ function useWidgetUpdates() {
|
|
|
4334
4375
|
case 24:
|
|
4335
4376
|
_context7.prev = 24;
|
|
4336
4377
|
_t12 = _context7["catch"](20);
|
|
4337
|
-
|
|
4378
|
+
_iterator1.e(_t12);
|
|
4338
4379
|
case 25:
|
|
4339
4380
|
_context7.prev = 25;
|
|
4340
|
-
|
|
4381
|
+
_iterator1.f();
|
|
4341
4382
|
return _context7.finish(25);
|
|
4342
4383
|
case 26:
|
|
4343
4384
|
_context7.prev = 26;
|
|
@@ -4366,21 +4407,21 @@ function useWidgetUpdates() {
|
|
|
4366
4407
|
succeededSet = new Set(succeeded);
|
|
4367
4408
|
setUpdates(function (prev) {
|
|
4368
4409
|
var next = new Map(prev);
|
|
4369
|
-
var
|
|
4370
|
-
|
|
4410
|
+
var _iterator10 = _createForOfIteratorHelper$$(next),
|
|
4411
|
+
_step10;
|
|
4371
4412
|
try {
|
|
4372
|
-
for (
|
|
4373
|
-
var
|
|
4374
|
-
key =
|
|
4375
|
-
val =
|
|
4413
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
4414
|
+
var _step10$value = _slicedToArray(_step10.value, 2),
|
|
4415
|
+
key = _step10$value[0],
|
|
4416
|
+
val = _step10$value[1];
|
|
4376
4417
|
if (val && succeededSet.has(val.name)) {
|
|
4377
4418
|
next["delete"](key);
|
|
4378
4419
|
}
|
|
4379
4420
|
}
|
|
4380
4421
|
} catch (err) {
|
|
4381
|
-
|
|
4422
|
+
_iterator10.e(err);
|
|
4382
4423
|
} finally {
|
|
4383
|
-
|
|
4424
|
+
_iterator10.f();
|
|
4384
4425
|
}
|
|
4385
4426
|
return next;
|
|
4386
4427
|
});
|
|
@@ -4401,7 +4442,7 @@ function useWidgetUpdates() {
|
|
|
4401
4442
|
};
|
|
4402
4443
|
}(), [updateWidget, computeBatchPreflight]);
|
|
4403
4444
|
return {
|
|
4404
|
-
updates:
|
|
4445
|
+
updates: liveUpdates,
|
|
4405
4446
|
packagesWithUpdates: packagesWithUpdates,
|
|
4406
4447
|
isChecking: isChecking,
|
|
4407
4448
|
updateWidget: updateWidget,
|