@2112-lab/central-plant 0.3.18 → 0.3.21
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/bundle/index.js
CHANGED
|
@@ -38938,7 +38938,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
38938
38938
|
* Initialize the CentralPlant manager
|
|
38939
38939
|
*
|
|
38940
38940
|
* @constructor
|
|
38941
|
-
* @version 0.3.
|
|
38941
|
+
* @version 0.3.21
|
|
38942
38942
|
* @updated 2025-10-22
|
|
38943
38943
|
*
|
|
38944
38944
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -46180,12 +46180,14 @@ function _measureS3Transfer() {
|
|
|
46180
46180
|
var fileSize,
|
|
46181
46181
|
startTime,
|
|
46182
46182
|
executeTransfer,
|
|
46183
|
+
isExpiredToken,
|
|
46183
46184
|
Auth,
|
|
46184
46185
|
endTime,
|
|
46185
46186
|
duration,
|
|
46186
46187
|
_args2 = arguments,
|
|
46187
46188
|
_t,
|
|
46188
|
-
_t2
|
|
46189
|
+
_t2,
|
|
46190
|
+
_t3;
|
|
46189
46191
|
return _regenerator().w(function (_context2) {
|
|
46190
46192
|
while (1) switch (_context2.n) {
|
|
46191
46193
|
case 0:
|
|
@@ -46226,8 +46228,12 @@ function _measureS3Transfer() {
|
|
|
46226
46228
|
case 3:
|
|
46227
46229
|
_context2.p = 3;
|
|
46228
46230
|
_t = _context2.v;
|
|
46229
|
-
|
|
46230
|
-
|
|
46231
|
+
// Check for ExpiredToken error.
|
|
46232
|
+
// AWS SDK v3 (used by Amplify v5) sets error.name, not error.code.
|
|
46233
|
+
// error.message is 'The provided token has expired.' (no 'ExpiredToken' substring).
|
|
46234
|
+
isExpiredToken = _t.code === 'ExpiredToken' || _t.Code === 'ExpiredToken' || _t.name === 'ExpiredToken' || _t.message && _t.message.toLowerCase().includes('token has expired');
|
|
46235
|
+
if (!isExpiredToken) {
|
|
46236
|
+
_context2.n = 12;
|
|
46231
46237
|
break;
|
|
46232
46238
|
}
|
|
46233
46239
|
console.warn("\u26A0\uFE0F Token expired during ".concat(operation, ". Attempting session refresh and retry..."));
|
|
@@ -46240,35 +46246,50 @@ function _measureS3Transfer() {
|
|
|
46240
46246
|
throw _t;
|
|
46241
46247
|
case 4:
|
|
46242
46248
|
_context2.p = 4;
|
|
46243
|
-
_context2.
|
|
46249
|
+
_context2.p = 5;
|
|
46250
|
+
_context2.n = 6;
|
|
46251
|
+
return Auth.currentSession();
|
|
46252
|
+
case 6:
|
|
46253
|
+
console.log("\u2705 User Pool session refreshed for ".concat(operation, "."));
|
|
46254
|
+
_context2.n = 8;
|
|
46255
|
+
break;
|
|
46256
|
+
case 7:
|
|
46257
|
+
_context2.p = 7;
|
|
46258
|
+
_t2 = _context2.v;
|
|
46259
|
+
// If currentSession() fails the refresh token itself is expired —
|
|
46260
|
+
// the user needs to sign in again. Surface that immediately.
|
|
46261
|
+
console.error("\u274C Failed to refresh User Pool session during ".concat(operation, ":"), _t2);
|
|
46262
|
+
throw _t2;
|
|
46263
|
+
case 8:
|
|
46264
|
+
_context2.n = 9;
|
|
46244
46265
|
return Auth.currentCredentials({
|
|
46245
46266
|
bypassCache: true
|
|
46246
46267
|
});
|
|
46247
|
-
case
|
|
46248
|
-
console.log("\u2705
|
|
46268
|
+
case 9:
|
|
46269
|
+
console.log("\u2705 STS credentials refreshed. Retrying ".concat(operation, "..."));
|
|
46249
46270
|
|
|
46250
46271
|
// Reset timer for the retry
|
|
46251
46272
|
startTime = performance.now();
|
|
46252
|
-
_context2.n =
|
|
46273
|
+
_context2.n = 10;
|
|
46253
46274
|
return executeTransfer();
|
|
46254
|
-
case
|
|
46275
|
+
case 10:
|
|
46255
46276
|
return _context2.a(2, _context2.v);
|
|
46256
|
-
case
|
|
46257
|
-
_context2.p =
|
|
46258
|
-
|
|
46259
|
-
console.error("\u274C Retry failed for ".concat(operation, ":"),
|
|
46277
|
+
case 11:
|
|
46278
|
+
_context2.p = 11;
|
|
46279
|
+
_t3 = _context2.v;
|
|
46280
|
+
console.error("\u274C Retry failed for ".concat(operation, ":"), _t3);
|
|
46260
46281
|
// If retry fails, throw the Retry Error (likely unrelated or persistent auth issue)
|
|
46261
|
-
throw
|
|
46262
|
-
case
|
|
46282
|
+
throw _t3;
|
|
46283
|
+
case 12:
|
|
46263
46284
|
// Standard error handling for non-expired tokens (or if logic above didn't catch it)
|
|
46264
46285
|
endTime = performance.now();
|
|
46265
46286
|
duration = ((endTime - startTime) / 1000).toFixed(3);
|
|
46266
46287
|
console.error("\u274C S3 ".concat(operation, " failed after ").concat(duration, "s:"), _t);
|
|
46267
46288
|
throw _t;
|
|
46268
|
-
case
|
|
46289
|
+
case 13:
|
|
46269
46290
|
return _context2.a(2);
|
|
46270
46291
|
}
|
|
46271
|
-
}, _callee2, null, [[
|
|
46292
|
+
}, _callee2, null, [[5, 7], [4, 11], [1, 3]]);
|
|
46272
46293
|
}));
|
|
46273
46294
|
return _measureS3Transfer.apply(this, arguments);
|
|
46274
46295
|
}
|
|
@@ -35,7 +35,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
35
35
|
* Initialize the CentralPlant manager
|
|
36
36
|
*
|
|
37
37
|
* @constructor
|
|
38
|
-
* @version 0.3.
|
|
38
|
+
* @version 0.3.21
|
|
39
39
|
* @updated 2025-10-22
|
|
40
40
|
*
|
|
41
41
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -28,12 +28,14 @@ function _measureS3Transfer() {
|
|
|
28
28
|
var fileSize,
|
|
29
29
|
startTime,
|
|
30
30
|
executeTransfer,
|
|
31
|
+
isExpiredToken,
|
|
31
32
|
Auth,
|
|
32
33
|
endTime,
|
|
33
34
|
duration,
|
|
34
35
|
_args2 = arguments,
|
|
35
36
|
_t,
|
|
36
|
-
_t2
|
|
37
|
+
_t2,
|
|
38
|
+
_t3;
|
|
37
39
|
return _rollupPluginBabelHelpers.regenerator().w(function (_context2) {
|
|
38
40
|
while (1) switch (_context2.n) {
|
|
39
41
|
case 0:
|
|
@@ -74,8 +76,12 @@ function _measureS3Transfer() {
|
|
|
74
76
|
case 3:
|
|
75
77
|
_context2.p = 3;
|
|
76
78
|
_t = _context2.v;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
+
// Check for ExpiredToken error.
|
|
80
|
+
// AWS SDK v3 (used by Amplify v5) sets error.name, not error.code.
|
|
81
|
+
// error.message is 'The provided token has expired.' (no 'ExpiredToken' substring).
|
|
82
|
+
isExpiredToken = _t.code === 'ExpiredToken' || _t.Code === 'ExpiredToken' || _t.name === 'ExpiredToken' || _t.message && _t.message.toLowerCase().includes('token has expired');
|
|
83
|
+
if (!isExpiredToken) {
|
|
84
|
+
_context2.n = 12;
|
|
79
85
|
break;
|
|
80
86
|
}
|
|
81
87
|
console.warn("\u26A0\uFE0F Token expired during ".concat(operation, ". Attempting session refresh and retry..."));
|
|
@@ -88,35 +94,50 @@ function _measureS3Transfer() {
|
|
|
88
94
|
throw _t;
|
|
89
95
|
case 4:
|
|
90
96
|
_context2.p = 4;
|
|
91
|
-
_context2.
|
|
97
|
+
_context2.p = 5;
|
|
98
|
+
_context2.n = 6;
|
|
99
|
+
return Auth.currentSession();
|
|
100
|
+
case 6:
|
|
101
|
+
console.log("\u2705 User Pool session refreshed for ".concat(operation, "."));
|
|
102
|
+
_context2.n = 8;
|
|
103
|
+
break;
|
|
104
|
+
case 7:
|
|
105
|
+
_context2.p = 7;
|
|
106
|
+
_t2 = _context2.v;
|
|
107
|
+
// If currentSession() fails the refresh token itself is expired —
|
|
108
|
+
// the user needs to sign in again. Surface that immediately.
|
|
109
|
+
console.error("\u274C Failed to refresh User Pool session during ".concat(operation, ":"), _t2);
|
|
110
|
+
throw _t2;
|
|
111
|
+
case 8:
|
|
112
|
+
_context2.n = 9;
|
|
92
113
|
return Auth.currentCredentials({
|
|
93
114
|
bypassCache: true
|
|
94
115
|
});
|
|
95
|
-
case
|
|
96
|
-
console.log("\u2705
|
|
116
|
+
case 9:
|
|
117
|
+
console.log("\u2705 STS credentials refreshed. Retrying ".concat(operation, "..."));
|
|
97
118
|
|
|
98
119
|
// Reset timer for the retry
|
|
99
120
|
startTime = performance.now();
|
|
100
|
-
_context2.n =
|
|
121
|
+
_context2.n = 10;
|
|
101
122
|
return executeTransfer();
|
|
102
|
-
case
|
|
123
|
+
case 10:
|
|
103
124
|
return _context2.a(2, _context2.v);
|
|
104
|
-
case
|
|
105
|
-
_context2.p =
|
|
106
|
-
|
|
107
|
-
console.error("\u274C Retry failed for ".concat(operation, ":"),
|
|
125
|
+
case 11:
|
|
126
|
+
_context2.p = 11;
|
|
127
|
+
_t3 = _context2.v;
|
|
128
|
+
console.error("\u274C Retry failed for ".concat(operation, ":"), _t3);
|
|
108
129
|
// If retry fails, throw the Retry Error (likely unrelated or persistent auth issue)
|
|
109
|
-
throw
|
|
110
|
-
case
|
|
130
|
+
throw _t3;
|
|
131
|
+
case 12:
|
|
111
132
|
// Standard error handling for non-expired tokens (or if logic above didn't catch it)
|
|
112
133
|
endTime = performance.now();
|
|
113
134
|
duration = ((endTime - startTime) / 1000).toFixed(3);
|
|
114
135
|
console.error("\u274C S3 ".concat(operation, " failed after ").concat(duration, "s:"), _t);
|
|
115
136
|
throw _t;
|
|
116
|
-
case
|
|
137
|
+
case 13:
|
|
117
138
|
return _context2.a(2);
|
|
118
139
|
}
|
|
119
|
-
}, _callee2, null, [[
|
|
140
|
+
}, _callee2, null, [[5, 7], [4, 11], [1, 3]]);
|
|
120
141
|
}));
|
|
121
142
|
return _measureS3Transfer.apply(this, arguments);
|
|
122
143
|
}
|
|
@@ -31,7 +31,7 @@ var CentralPlant = /*#__PURE__*/function (_BaseDisposable) {
|
|
|
31
31
|
* Initialize the CentralPlant manager
|
|
32
32
|
*
|
|
33
33
|
* @constructor
|
|
34
|
-
* @version 0.3.
|
|
34
|
+
* @version 0.3.21
|
|
35
35
|
* @updated 2025-10-22
|
|
36
36
|
*
|
|
37
37
|
* @description Creates a new CentralPlant instance and initializes internal managers and utilities.
|
|
@@ -24,12 +24,14 @@ function _measureS3Transfer() {
|
|
|
24
24
|
var fileSize,
|
|
25
25
|
startTime,
|
|
26
26
|
executeTransfer,
|
|
27
|
+
isExpiredToken,
|
|
27
28
|
Auth,
|
|
28
29
|
endTime,
|
|
29
30
|
duration,
|
|
30
31
|
_args2 = arguments,
|
|
31
32
|
_t,
|
|
32
|
-
_t2
|
|
33
|
+
_t2,
|
|
34
|
+
_t3;
|
|
33
35
|
return _regenerator().w(function (_context2) {
|
|
34
36
|
while (1) switch (_context2.n) {
|
|
35
37
|
case 0:
|
|
@@ -70,8 +72,12 @@ function _measureS3Transfer() {
|
|
|
70
72
|
case 3:
|
|
71
73
|
_context2.p = 3;
|
|
72
74
|
_t = _context2.v;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
+
// Check for ExpiredToken error.
|
|
76
|
+
// AWS SDK v3 (used by Amplify v5) sets error.name, not error.code.
|
|
77
|
+
// error.message is 'The provided token has expired.' (no 'ExpiredToken' substring).
|
|
78
|
+
isExpiredToken = _t.code === 'ExpiredToken' || _t.Code === 'ExpiredToken' || _t.name === 'ExpiredToken' || _t.message && _t.message.toLowerCase().includes('token has expired');
|
|
79
|
+
if (!isExpiredToken) {
|
|
80
|
+
_context2.n = 12;
|
|
75
81
|
break;
|
|
76
82
|
}
|
|
77
83
|
console.warn("\u26A0\uFE0F Token expired during ".concat(operation, ". Attempting session refresh and retry..."));
|
|
@@ -84,35 +90,50 @@ function _measureS3Transfer() {
|
|
|
84
90
|
throw _t;
|
|
85
91
|
case 4:
|
|
86
92
|
_context2.p = 4;
|
|
87
|
-
_context2.
|
|
93
|
+
_context2.p = 5;
|
|
94
|
+
_context2.n = 6;
|
|
95
|
+
return Auth.currentSession();
|
|
96
|
+
case 6:
|
|
97
|
+
console.log("\u2705 User Pool session refreshed for ".concat(operation, "."));
|
|
98
|
+
_context2.n = 8;
|
|
99
|
+
break;
|
|
100
|
+
case 7:
|
|
101
|
+
_context2.p = 7;
|
|
102
|
+
_t2 = _context2.v;
|
|
103
|
+
// If currentSession() fails the refresh token itself is expired —
|
|
104
|
+
// the user needs to sign in again. Surface that immediately.
|
|
105
|
+
console.error("\u274C Failed to refresh User Pool session during ".concat(operation, ":"), _t2);
|
|
106
|
+
throw _t2;
|
|
107
|
+
case 8:
|
|
108
|
+
_context2.n = 9;
|
|
88
109
|
return Auth.currentCredentials({
|
|
89
110
|
bypassCache: true
|
|
90
111
|
});
|
|
91
|
-
case
|
|
92
|
-
console.log("\u2705
|
|
112
|
+
case 9:
|
|
113
|
+
console.log("\u2705 STS credentials refreshed. Retrying ".concat(operation, "..."));
|
|
93
114
|
|
|
94
115
|
// Reset timer for the retry
|
|
95
116
|
startTime = performance.now();
|
|
96
|
-
_context2.n =
|
|
117
|
+
_context2.n = 10;
|
|
97
118
|
return executeTransfer();
|
|
98
|
-
case
|
|
119
|
+
case 10:
|
|
99
120
|
return _context2.a(2, _context2.v);
|
|
100
|
-
case
|
|
101
|
-
_context2.p =
|
|
102
|
-
|
|
103
|
-
console.error("\u274C Retry failed for ".concat(operation, ":"),
|
|
121
|
+
case 11:
|
|
122
|
+
_context2.p = 11;
|
|
123
|
+
_t3 = _context2.v;
|
|
124
|
+
console.error("\u274C Retry failed for ".concat(operation, ":"), _t3);
|
|
104
125
|
// If retry fails, throw the Retry Error (likely unrelated or persistent auth issue)
|
|
105
|
-
throw
|
|
106
|
-
case
|
|
126
|
+
throw _t3;
|
|
127
|
+
case 12:
|
|
107
128
|
// Standard error handling for non-expired tokens (or if logic above didn't catch it)
|
|
108
129
|
endTime = performance.now();
|
|
109
130
|
duration = ((endTime - startTime) / 1000).toFixed(3);
|
|
110
131
|
console.error("\u274C S3 ".concat(operation, " failed after ").concat(duration, "s:"), _t);
|
|
111
132
|
throw _t;
|
|
112
|
-
case
|
|
133
|
+
case 13:
|
|
113
134
|
return _context2.a(2);
|
|
114
135
|
}
|
|
115
|
-
}, _callee2, null, [[
|
|
136
|
+
}, _callee2, null, [[5, 7], [4, 11], [1, 3]]);
|
|
116
137
|
}));
|
|
117
138
|
return _measureS3Transfer.apply(this, arguments);
|
|
118
139
|
}
|