paperclip-github-plugin 0.9.14 → 0.10.1

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
@@ -836,6 +836,14 @@ var pluginRuntimeContext = null;
836
836
  function normalizeCompanyId(value) {
837
837
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
838
838
  }
839
+ function normalizeActionRecord(input, context) {
840
+ const record = input && typeof input === "object" ? { ...input } : {};
841
+ const scopedCompanyId = normalizeCompanyId(context?.companyId);
842
+ if (scopedCompanyId) {
843
+ record.companyId = scopedCompanyId;
844
+ }
845
+ return record;
846
+ }
839
847
  var activeSyncPromise = null;
840
848
  var activeRunningSyncState = null;
841
849
  var activeRunningSyncCompanyId;
@@ -15908,8 +15916,8 @@ var plugin = definePlugin({
15908
15916
  const record = input && typeof input === "object" ? input : {};
15909
15917
  return buildCommentAnnotationData(ctx, record);
15910
15918
  });
15911
- ctx.actions.register("issue.linkGitHubItem", async (input) => {
15912
- const record = input && typeof input === "object" ? input : {};
15919
+ ctx.actions.register("issue.linkGitHubItem", async (input, actionContext) => {
15920
+ const record = normalizeActionRecord(input, actionContext);
15913
15921
  const kind = normalizeIssueGitHubLinkKind(record.kind);
15914
15922
  if (!kind) {
15915
15923
  throw new Error('kind must be "issue" or "pull_request".');
@@ -15936,8 +15944,8 @@ var plugin = definePlugin({
15936
15944
  requireUnlinked: true
15937
15945
  });
15938
15946
  });
15939
- ctx.actions.register("issue.unlinkGitHubItem", async (input) => {
15940
- const record = input && typeof input === "object" ? input : {};
15947
+ ctx.actions.register("issue.unlinkGitHubItem", async (input, actionContext) => {
15948
+ const record = normalizeActionRecord(input, actionContext);
15941
15949
  const companyId = normalizeCompanyId(record.companyId);
15942
15950
  const issueId = normalizeOptionalString2(record.issueId);
15943
15951
  if (!companyId || !issueId) {
@@ -15948,10 +15956,10 @@ var plugin = definePlugin({
15948
15956
  issueId
15949
15957
  });
15950
15958
  });
15951
- ctx.actions.register("settings.saveRegistration", async (input) => {
15959
+ ctx.actions.register("settings.saveRegistration", async (input, actionContext) => {
15952
15960
  const previous = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
15953
15961
  const config = await getResolvedConfig(ctx);
15954
- const record = input && typeof input === "object" ? input : {};
15962
+ const record = normalizeActionRecord(input, actionContext);
15955
15963
  const requestedCompanyId = normalizeCompanyId(record.companyId);
15956
15964
  const requestedGitHubTokenLogin = "githubTokenLogin" in record ? normalizeOptionalString2(record.githubTokenLogin) : void 0;
15957
15965
  const hasMappingsPatch = "mappings" in record;
@@ -16053,10 +16061,10 @@ var plugin = definePlugin({
16053
16061
  availableAssignees: requestedCompanyId ? await listAvailableAssignees(ctx, requestedCompanyId, next) : []
16054
16062
  };
16055
16063
  });
16056
- ctx.actions.register("settings.updateBoardAccess", async (input) => {
16064
+ ctx.actions.register("settings.updateBoardAccess", async (input, actionContext) => {
16057
16065
  const previous = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
16058
16066
  const config = await getResolvedConfig(ctx);
16059
- const record = input && typeof input === "object" ? input : {};
16067
+ const record = normalizeActionRecord(input, actionContext);
16060
16068
  const companyId = normalizeCompanyId(record.companyId);
16061
16069
  if (!companyId) {
16062
16070
  throw new Error("A company id is required to update Paperclip board access.");
@@ -16127,16 +16135,17 @@ var plugin = definePlugin({
16127
16135
  paperclipBoardAccessConfigured: hasConfiguredPaperclipBoardAccess(next, config, companyId)
16128
16136
  };
16129
16137
  });
16130
- ctx.actions.register("settings.validateToken", async (input) => {
16131
- const token = input && typeof input === "object" && "token" in input ? input.token : void 0;
16138
+ ctx.actions.register("settings.validateToken", async (input, actionContext) => {
16139
+ const record = normalizeActionRecord(input, actionContext);
16140
+ const token = "token" in record ? record.token : void 0;
16132
16141
  const trimmedToken = typeof token === "string" ? token.trim() : "";
16133
16142
  if (!trimmedToken) {
16134
16143
  throw new Error("Enter a GitHub token.");
16135
16144
  }
16136
16145
  return validateGithubToken(ctx, trimmedToken);
16137
16146
  });
16138
- ctx.actions.register("settings.ensureGitHubTokenAvailable", async (input) => {
16139
- const record = input && typeof input === "object" ? input : {};
16147
+ ctx.actions.register("settings.ensureGitHubTokenAvailable", async (input, actionContext) => {
16148
+ const record = normalizeActionRecord(input, actionContext);
16140
16149
  const companyId = normalizeCompanyId(record.companyId);
16141
16150
  const githubTokenRef = normalizeSecretRef(record.githubTokenRef);
16142
16151
  const token = normalizeGitHubToken(record.token);
@@ -16173,48 +16182,49 @@ var plugin = definePlugin({
16173
16182
  fallbackStored: true
16174
16183
  };
16175
16184
  });
16176
- ctx.actions.register("project.pullRequests.createIssue", async (input) => {
16177
- const record = input && typeof input === "object" ? input : {};
16185
+ ctx.actions.register("project.pullRequests.createIssue", async (input, actionContext) => {
16186
+ const record = normalizeActionRecord(input, actionContext);
16178
16187
  return createProjectPullRequestPaperclipIssue(ctx, record);
16179
16188
  });
16180
- ctx.actions.register("project.pullRequests.refresh", async (input) => {
16181
- const record = input && typeof input === "object" ? input : {};
16189
+ ctx.actions.register("project.pullRequests.refresh", async (input, actionContext) => {
16190
+ const record = normalizeActionRecord(input, actionContext);
16182
16191
  return refreshProjectPullRequests(ctx, record);
16183
16192
  });
16184
- ctx.actions.register("project.pullRequests.updateBranch", async (input) => {
16185
- const record = input && typeof input === "object" ? input : {};
16193
+ ctx.actions.register("project.pullRequests.updateBranch", async (input, actionContext) => {
16194
+ const record = normalizeActionRecord(input, actionContext);
16186
16195
  return updateProjectPullRequestBranch(ctx, record);
16187
16196
  });
16188
- ctx.actions.register("project.pullRequests.requestCopilotAction", async (input) => {
16189
- const record = input && typeof input === "object" ? input : {};
16197
+ ctx.actions.register("project.pullRequests.requestCopilotAction", async (input, actionContext) => {
16198
+ const record = normalizeActionRecord(input, actionContext);
16190
16199
  return requestProjectPullRequestCopilotAction(ctx, record);
16191
16200
  });
16192
- ctx.actions.register("project.pullRequests.merge", async (input) => {
16193
- const record = input && typeof input === "object" ? input : {};
16201
+ ctx.actions.register("project.pullRequests.merge", async (input, actionContext) => {
16202
+ const record = normalizeActionRecord(input, actionContext);
16194
16203
  return mergeProjectPullRequest(ctx, record);
16195
16204
  });
16196
- ctx.actions.register("project.pullRequests.close", async (input) => {
16197
- const record = input && typeof input === "object" ? input : {};
16205
+ ctx.actions.register("project.pullRequests.close", async (input, actionContext) => {
16206
+ const record = normalizeActionRecord(input, actionContext);
16198
16207
  return closeProjectPullRequest(ctx, record);
16199
16208
  });
16200
- ctx.actions.register("project.pullRequests.addComment", async (input) => {
16201
- const record = input && typeof input === "object" ? input : {};
16209
+ ctx.actions.register("project.pullRequests.addComment", async (input, actionContext) => {
16210
+ const record = normalizeActionRecord(input, actionContext);
16202
16211
  return addProjectPullRequestComment(ctx, record);
16203
16212
  });
16204
- ctx.actions.register("project.pullRequests.review", async (input) => {
16205
- const record = input && typeof input === "object" ? input : {};
16213
+ ctx.actions.register("project.pullRequests.review", async (input, actionContext) => {
16214
+ const record = normalizeActionRecord(input, actionContext);
16206
16215
  return reviewProjectPullRequest(ctx, record);
16207
16216
  });
16208
- ctx.actions.register("project.pullRequests.rerunCi", async (input) => {
16209
- const record = input && typeof input === "object" ? input : {};
16217
+ ctx.actions.register("project.pullRequests.rerunCi", async (input, actionContext) => {
16218
+ const record = normalizeActionRecord(input, actionContext);
16210
16219
  return rerunProjectPullRequestCi(ctx, record);
16211
16220
  });
16212
- ctx.actions.register("sync.runNow", async (input) => {
16213
- const waitForCompletion = input && typeof input === "object" && "waitForCompletion" in input ? Boolean(input.waitForCompletion) : false;
16214
- const paperclipApiBaseUrl = input && typeof input === "object" && "paperclipApiBaseUrl" in input ? input.paperclipApiBaseUrl : void 0;
16215
- const companyId = input && typeof input === "object" && "companyId" in input && typeof input.companyId === "string" ? input.companyId : void 0;
16216
- const projectId = input && typeof input === "object" && "projectId" in input && typeof input.projectId === "string" ? input.projectId : void 0;
16217
- const issueId = input && typeof input === "object" && "issueId" in input && typeof input.issueId === "string" ? input.issueId : void 0;
16221
+ ctx.actions.register("sync.runNow", async (input, actionContext) => {
16222
+ const record = normalizeActionRecord(input, actionContext);
16223
+ const waitForCompletion = "waitForCompletion" in record ? Boolean(record.waitForCompletion) : false;
16224
+ const paperclipApiBaseUrl = "paperclipApiBaseUrl" in record ? record.paperclipApiBaseUrl : void 0;
16225
+ const companyId = "companyId" in record && typeof record.companyId === "string" ? record.companyId : void 0;
16226
+ const projectId = "projectId" in record && typeof record.projectId === "string" ? record.projectId : void 0;
16227
+ const issueId = "issueId" in record && typeof record.issueId === "string" ? record.issueId : void 0;
16218
16228
  const currentSettings = normalizeSettings(await ctx.state.get(SETTINGS_SCOPE));
16219
16229
  const target = await resolveManualSyncTarget(ctx, currentSettings, {
16220
16230
  ...companyId ? { companyId } : {},
@@ -16269,7 +16279,7 @@ var plugin = definePlugin({
16269
16279
  if (job.trigger === "schedule" && !shouldRunScheduledSync(reconciledSettings, job.scheduledAt)) {
16270
16280
  return;
16271
16281
  }
16272
- await startSync(ctx, trigger);
16282
+ await startSync(ctx, trigger, { awaitCompletion: true });
16273
16283
  return;
16274
16284
  }
16275
16285
  for (const target of scheduledTargets) {
@@ -16277,7 +16287,10 @@ var plugin = definePlugin({
16277
16287
  if (job.trigger === "schedule" && !shouldRunScheduledSync(scopedSettings, job.scheduledAt)) {
16278
16288
  continue;
16279
16289
  }
16280
- await startSync(ctx, trigger, target ? { target } : {});
16290
+ await startSync(ctx, trigger, {
16291
+ awaitCompletion: true,
16292
+ ...target ? { target } : {}
16293
+ });
16281
16294
  }
16282
16295
  });
16283
16296
  },
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.9.14",
3
+ "version": "0.10.1",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
- "packageManager": "pnpm@11.2.2",
7
+ "packageManager": "pnpm@11.5.2",
8
8
  "engines": {
9
9
  "node": ">=20"
10
10
  },
@@ -41,19 +41,19 @@
41
41
  },
42
42
  "dependencies": {
43
43
  "@octokit/rest": "^22.0.1",
44
- "@paperclipai/plugin-sdk": "^2026.517.0",
45
- "react": "^19.2.6",
44
+ "@paperclipai/plugin-sdk": "^2026.529.0",
45
+ "react": "^19.2.7",
46
46
  "react-markdown": "^10.1.0",
47
47
  "rehype-raw": "^7.0.0",
48
48
  "rehype-sanitize": "^6.0.0",
49
49
  "remark-gfm": "^4.0.1"
50
50
  },
51
51
  "devDependencies": {
52
- "@types/node": "24.12.4",
53
- "@types/react": "19.2.15",
52
+ "@types/node": "24.13.1",
53
+ "@types/react": "19.2.17",
54
54
  "esbuild": "0.28.0",
55
55
  "playwright": "1.60.0",
56
- "tsx": "4.22.3",
56
+ "tsx": "4.22.4",
57
57
  "typescript": "6.0.3"
58
58
  }
59
59
  }