paperclip-github-plugin 0.15.4 → 0.15.6

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/worker.js CHANGED
@@ -17497,14 +17497,19 @@ var plugin = definePlugin({
17497
17497
  });
17498
17498
  ctx.actions.register("settings.updateBoardAccess", async (input, actionContext) => {
17499
17499
  const previous = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
17500
- const config = await getResolvedConfig(ctx);
17500
+ const [config, trustedConfig] = await Promise.all([
17501
+ getResolvedConfig(ctx),
17502
+ ctx.config.get().then((value) => normalizeConfig(value))
17503
+ ]);
17501
17504
  const record = normalizeActionRecord(input, actionContext);
17502
17505
  const companyId = normalizeCompanyId(record.companyId);
17503
17506
  if (!companyId) {
17504
17507
  throw new Error("A company id is required to update Paperclip board access.");
17505
17508
  }
17506
17509
  const nextSecretRef = normalizeSecretRef(record.paperclipBoardApiTokenRef);
17507
- const nextBoardApiToken = normalizeGitHubToken(record.paperclipBoardApiToken);
17510
+ const boardAccessRecord = record.paperclipBoardAccess && typeof record.paperclipBoardAccess === "object" ? record.paperclipBoardAccess : {};
17511
+ const boardAuthorizationRecord = boardAccessRecord.authorization && typeof boardAccessRecord.authorization === "object" ? boardAccessRecord.authorization : {};
17512
+ const nextBoardApiToken = normalizeGitHubToken(record.paperclipBoardApiToken) ?? normalizeGitHubToken(boardAuthorizationRecord.bearer);
17508
17513
  const nextPaperclipBoardApiTokenRefs = {
17509
17514
  ...previous.paperclipBoardApiTokenRefs ?? {}
17510
17515
  };
@@ -17517,7 +17522,8 @@ var plugin = definePlugin({
17517
17522
  if (nextSecretRef) {
17518
17523
  nextPaperclipBoardApiTokenRefs[companyId] = nextSecretRef;
17519
17524
  if (nextBoardApiToken) {
17520
- if (await shouldSeedExternalPaperclipBoardTokenFallback(ctx, companyId, nextSecretRef)) {
17525
+ const configuredSecretRef = getConfiguredPaperclipBoardApiTokenRef(trustedConfig, companyId);
17526
+ if (configuredSecretRef !== nextSecretRef || await shouldSeedExternalPaperclipBoardTokenFallback(ctx, companyId, nextSecretRef)) {
17521
17527
  await writeExternalCompanyPaperclipBoardApiTokenFallback(ctx, companyId, nextBoardApiToken);
17522
17528
  } else {
17523
17529
  await clearExternalCompanyPaperclipBoardApiTokenFallback(ctx, companyId);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",