arcane-cli 1.11.4 → 1.11.5

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.
@@ -137,4 +137,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
137
137
 
138
138
  ### Master Reference
139
139
 
140
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
140
+ See the shared character animation specification for the full cross-character mapping.
@@ -135,4 +135,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
135
135
 
136
136
  ### Master Reference
137
137
 
138
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
138
+ See the shared character animation specification for the full cross-character mapping.
@@ -136,4 +136,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
136
136
 
137
137
  ### Master Reference
138
138
 
139
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
139
+ See the shared character animation specification for the full cross-character mapping.
@@ -140,4 +140,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
140
140
 
141
141
  ### Master Reference
142
142
 
143
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
143
+ See the shared character animation specification for the full cross-character mapping.
@@ -137,4 +137,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
137
137
 
138
138
  ### Master Reference
139
139
 
140
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
140
+ See the shared character animation specification for the full cross-character mapping.
@@ -136,4 +136,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
136
136
 
137
137
  ### Master Reference
138
138
 
139
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
139
+ See the shared character animation specification for the full cross-character mapping.
@@ -138,4 +138,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
138
138
 
139
139
  ### Master Reference
140
140
 
141
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
141
+ See the shared character animation specification for the full cross-character mapping.
@@ -137,4 +137,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
137
137
 
138
138
  ### Master Reference
139
139
 
140
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
140
+ See the shared character animation specification for the full cross-character mapping.
@@ -139,4 +139,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
139
139
 
140
140
  ### Master Reference
141
141
 
142
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
142
+ See the shared character animation specification for the full cross-character mapping.
@@ -137,4 +137,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
137
137
 
138
138
  ### Master Reference
139
139
 
140
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
140
+ See the shared character animation specification for the full cross-character mapping.
@@ -136,4 +136,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
136
136
 
137
137
  ### Master Reference
138
138
 
139
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
139
+ See the shared character animation specification for the full cross-character mapping.
@@ -138,4 +138,4 @@ Do not select weapon-carrying animations (Gun, Rifle, Shoot, Reload, Grenade, Bo
138
138
 
139
139
  ### Master Reference
140
140
 
141
- See dark-matter-complex/docs/animation-spec.md for the full cross-character mapping.
141
+ See the shared character animation specification for the full cross-character mapping.
package/dist/index.js CHANGED
@@ -7715,21 +7715,25 @@ var ChunkedSecretStore = class {
7715
7715
  };
7716
7716
 
7717
7717
  // src/modules/identity-config.ts
7718
+ function defineIdentityEnvironment(config) {
7719
+ return {
7720
+ ...config,
7721
+ discoveryUrl: `https://${config.signInHost}/${config.tenantId}/v2.0/.well-known/openid-configuration`
7722
+ };
7723
+ }
7718
7724
  var IDENTITY_ENVIRONMENTS = {
7719
- production: {
7725
+ production: defineIdentityEnvironment({
7720
7726
  environment: "production",
7721
7727
  tenantId: "9f8edbfb-291c-4c4a-b9cc-8820a04f8973",
7722
7728
  signInHost: "arcaneai.ciamlogin.com",
7723
- clientId: "7cd8f05d-9979-4458-8ca2-47c67748c41f",
7724
- discoveryUrl: "https://arcaneai.ciamlogin.com/9f8edbfb-291c-4c4a-b9cc-8820a04f8973/v2.0/.well-known/openid-configuration"
7725
- },
7726
- development: {
7729
+ clientId: "7cd8f05d-9979-4458-8ca2-47c67748c41f"
7730
+ }),
7731
+ development: defineIdentityEnvironment({
7727
7732
  environment: "development",
7728
7733
  tenantId: "b365de0e-3026-4afe-bf5b-556fccb4ffcf",
7729
7734
  signInHost: "arcaneaidev.ciamlogin.com",
7730
- clientId: "651be720-83cc-452b-8346-abf20713ad12",
7731
- discoveryUrl: "https://arcaneaidev.ciamlogin.com/b365de0e-3026-4afe-bf5b-556fccb4ffcf/v2.0/.well-known/openid-configuration"
7732
- }
7735
+ clientId: "651be720-83cc-452b-8346-abf20713ad12"
7736
+ })
7733
7737
  };
7734
7738
  var SIGN_IN_SCOPES = ["openid", "profile", "email", "offline_access"];
7735
7739
  var ENVIRONMENT_VARIABLE = "ARCANE_ENVIRONMENT";
@@ -7866,9 +7870,11 @@ async function browserLogin(config, options) {
7866
7870
  expectedState: state,
7867
7871
  expectedNonce: nonce,
7868
7872
  idTokenExpected: true
7869
- }).then((response) => {
7873
+ }).then(async (response) => {
7874
+ const result = toTokenResult(response);
7875
+ await options.onValidated?.(result);
7870
7876
  res.writeHead(200, { "content-type": "text/html; charset=utf-8" }).end(CLOSE_PAGE);
7871
- resolve5(toTokenResult(response));
7877
+ resolve5(result);
7872
7878
  }).catch((error) => {
7873
7879
  res.writeHead(200, { "content-type": "text/html; charset=utf-8" }).end(FAILED_PAGE);
7874
7880
  reject(error);
@@ -7938,6 +7944,17 @@ function createKeychainBackend(service = KEYCHAIN_SERVICE) {
7938
7944
 
7939
7945
  // src/modules/session-store.ts
7940
7946
  var INSECURE_SESSION_FILE_NAME = "session-insecure.json";
7947
+ var SessionClearError = class extends Error {
7948
+ constructor(keychainError, removed) {
7949
+ super(keychainError.message);
7950
+ this.keychainError = keychainError;
7951
+ this.removed = removed;
7952
+ this.name = "SessionClearError";
7953
+ this.cause = keychainError;
7954
+ }
7955
+ keychainError;
7956
+ removed;
7957
+ };
7941
7958
  function isIsoDate(value) {
7942
7959
  return typeof value === "string" && !Number.isNaN(Date.parse(value));
7943
7960
  }
@@ -8081,8 +8098,9 @@ function createSessionStorage(options = {}) {
8081
8098
  const removed = [];
8082
8099
  let keychainError;
8083
8100
  try {
8084
- if (keychain.load().state !== "signed-out") removed.push("keychain");
8101
+ const hadKeychainSession = keychain.load().state !== "signed-out";
8085
8102
  keychain.clear();
8103
+ if (hadKeychainSession) removed.push("keychain");
8086
8104
  } catch (error) {
8087
8105
  keychainError = error;
8088
8106
  }
@@ -8090,6 +8108,9 @@ function createSessionStorage(options = {}) {
8090
8108
  fileBackend.remove();
8091
8109
  removed.push("file");
8092
8110
  }
8111
+ if (keychainError instanceof KeychainUnavailableError) {
8112
+ throw new SessionClearError(keychainError, removed);
8113
+ }
8093
8114
  if (keychainError) throw keychainError;
8094
8115
  return { removed };
8095
8116
  }
@@ -8157,51 +8178,49 @@ async function runLogin(options, deps = defaultLoginDeps()) {
8157
8178
  process.exit(1);
8158
8179
  return;
8159
8180
  }
8160
- let result;
8181
+ let record;
8182
+ const saveValidatedSession = (result) => {
8183
+ const next = toSessionRecord(result, environment);
8184
+ deps.storage.save(next, { insecure: Boolean(options.insecureStorage) });
8185
+ record = next;
8186
+ };
8161
8187
  try {
8162
8188
  if (options.deviceCode) {
8163
- result = await deps.deviceLogin(config, {
8189
+ const result = await deps.deviceLogin(config, {
8164
8190
  scopes: SIGN_IN_SCOPES,
8165
8191
  prompt: (uri, code, seconds) => {
8166
8192
  printInfo(`Open ${uri} on any device and enter the code ${code}.`);
8167
8193
  printInfo(`Waiting up to ${Math.round(seconds / 60)} minutes for you to finish signing in.`);
8168
8194
  }
8169
8195
  });
8196
+ saveValidatedSession(result);
8170
8197
  } else {
8171
8198
  printInfo("Opening your browser to sign in to Arcane. Come back here when it says you are signed in.");
8172
- result = await deps.browserLogin(config, {
8199
+ await deps.browserLogin(config, {
8173
8200
  scopes: SIGN_IN_SCOPES,
8174
8201
  openUrl: deps.openUrl,
8202
+ onValidated: saveValidatedSession,
8175
8203
  onCannotOpen: (url) => {
8176
8204
  printWarning("No browser could be opened. Open this address yourself, or run `spell login --device-code`:");
8177
8205
  printInfo(url);
8178
8206
  }
8179
8207
  });
8208
+ if (!record) throw new Error("The browser sign-in ended without storing a session.");
8180
8209
  }
8181
- } catch (error) {
8182
- if (error instanceof LoginTimeoutError || error instanceof LoginDeniedError) {
8183
- console.error(`${error.message} Nothing was changed.`);
8184
- } else {
8185
- console.error(`The sign-in did not complete: ${safeErrorText(error)}. Nothing was changed.`);
8186
- }
8187
- process.exit(1);
8188
- return;
8189
- }
8190
- const record = toSessionRecord(result, environment);
8191
- try {
8192
- deps.storage.save(record, { insecure: Boolean(options.insecureStorage) });
8193
8210
  } catch (error) {
8194
8211
  if (error instanceof KeychainUnavailableError) {
8195
8212
  console.error(
8196
8213
  `${error.message} Nothing was stored. If this machine has no keychain, run \`spell login --insecure-storage\` to keep the session in a file instead (protected only by your account's file permissions).`
8197
8214
  );
8198
- process.exit(1);
8199
- return;
8215
+ } else if (error instanceof LoginTimeoutError || error instanceof LoginDeniedError) {
8216
+ console.error(`${error.message} Nothing was changed.`);
8217
+ } else {
8218
+ console.error(`The sign-in did not complete: ${safeErrorText(error)}. Nothing was changed.`);
8200
8219
  }
8201
- console.error(`The session could not be stored: ${safeErrorText(error)}`);
8202
8220
  process.exit(1);
8203
8221
  return;
8204
8222
  }
8223
+ if (!record) throw new Error("The sign-in completed without a stored session.");
8205
8224
  printSuccess(`Signed in as ${describeAccount(record)}.`);
8206
8225
  if (options.insecureStorage) printWarning(INSECURE_STORAGE_WARNING);
8207
8226
  }
@@ -8212,6 +8231,14 @@ function runLogout(storage = createSessionStorage()) {
8212
8231
  try {
8213
8232
  removed = storage.clear().removed;
8214
8233
  } catch (error) {
8234
+ if (error instanceof SessionClearError) {
8235
+ const fileResult = error.removed.includes("file") ? "The insecure session file was removed. " : "";
8236
+ console.error(
8237
+ `${fileResult}${error.keychainError.message} Any session in the OS keychain could not be verified or removed.`
8238
+ );
8239
+ process.exit(1);
8240
+ return;
8241
+ }
8215
8242
  if (error instanceof KeychainUnavailableError) {
8216
8243
  console.error(`${error.message} The session could not be removed from it.`);
8217
8244
  process.exit(1);