arcadible 1.0.7 → 1.0.9
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/package.json +1 -1
- package/src/account.js +16 -6
- package/src/util/os.js +4 -1
package/package.json
CHANGED
package/src/account.js
CHANGED
|
@@ -64,7 +64,7 @@ const expired = function (session) {
|
|
|
64
64
|
// the session is a credential, so only its owner can read it: the directory
|
|
65
65
|
// is 0700 and the file 0600. `mode` only applies when a file is created, so
|
|
66
66
|
// both are also set on every save, which fixes an older, readable file. The
|
|
67
|
-
// modes are ignored on Windows, where %
|
|
67
|
+
// modes are ignored on Windows, where %LOCALAPPDATA% is already private.
|
|
68
68
|
const save = function (current) {
|
|
69
69
|
return mkdir(dir, { mode: DIR_MODE, recursive: true })
|
|
70
70
|
.then(() => chmod(dir, DIR_MODE))
|
|
@@ -168,10 +168,13 @@ const get = function (onRefresh) {
|
|
|
168
168
|
// [function]
|
|
169
169
|
|
|
170
170
|
// a failed request's handler for commands that send the saved session's
|
|
171
|
-
// token
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
//
|
|
171
|
+
// token. The API refuses it (401) only when Supabase does: for a deleted
|
|
172
|
+
// account, or a token that expired by the server's clock though not by
|
|
173
|
+
// this one's. A refresh tells them apart: refused, the session is over, so
|
|
174
|
+
// it's removed and the error says to log in (session_expired); renewed, the
|
|
175
|
+
// session is kept, and the request's own error stands, so running the
|
|
176
|
+
// command again works. An ARC_TOKEN's refusal stays as it is, since logging
|
|
177
|
+
// in doesn't change the token.
|
|
175
178
|
const ended = function (current) {
|
|
176
179
|
return (ex) => {
|
|
177
180
|
if (
|
|
@@ -182,7 +185,14 @@ const ended = function (current) {
|
|
|
182
185
|
) {
|
|
183
186
|
throw ex;
|
|
184
187
|
}
|
|
185
|
-
return
|
|
188
|
+
return refresh(current).then(
|
|
189
|
+
() => {
|
|
190
|
+
throw ex;
|
|
191
|
+
},
|
|
192
|
+
(refreshEx) => {
|
|
193
|
+
throw refreshEx instanceof ArcError ? refreshEx : ex;
|
|
194
|
+
},
|
|
195
|
+
);
|
|
186
196
|
};
|
|
187
197
|
};
|
|
188
198
|
|
package/src/util/os.js
CHANGED
|
@@ -12,9 +12,12 @@ const join = path.join;
|
|
|
12
12
|
|
|
13
13
|
// [function]
|
|
14
14
|
|
|
15
|
+
// on Windows, the machine's own folder (%LOCALAPPDATA%), not the roaming one:
|
|
16
|
+
// the session is a credential, and the SDK's copy a cache, neither of which
|
|
17
|
+
// should follow a roaming profile to other machines
|
|
15
18
|
const configDir = function () {
|
|
16
19
|
if (process.platform === "win32") {
|
|
17
|
-
return process.env.
|
|
20
|
+
return process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local");
|
|
18
21
|
}
|
|
19
22
|
return join(homedir(), ".config");
|
|
20
23
|
};
|