paperclip-github-plugin 0.4.6 → 0.4.8

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
@@ -2528,6 +2528,13 @@ async function buildIssueGitHubDetails(ctx, input) {
2528
2528
  githubIssueNumber: entityMatch.data.githubIssueNumber,
2529
2529
  githubIssueUrl: entityMatch.data.githubIssueUrl,
2530
2530
  repositoryUrl: entityMatch.data.repositoryUrl,
2531
+ ...entityMatch.data.creatorLogin ? {
2532
+ creator: buildProjectPullRequestPerson({
2533
+ login: entityMatch.data.creatorLogin,
2534
+ url: entityMatch.data.creatorUrl,
2535
+ avatarUrl: entityMatch.data.creatorAvatarUrl
2536
+ })
2537
+ } : {},
2531
2538
  githubIssueState: entityMatch.data.githubIssueState,
2532
2539
  githubIssueStateReason: entityMatch.data.githubIssueStateReason,
2533
2540
  commentsCount: entityMatch.data.commentsCount,
@@ -3737,13 +3744,18 @@ function normalizeGitHubIssueLabels(value) {
3737
3744
  return labels;
3738
3745
  }
3739
3746
  function normalizeGitHubIssueRecord(issue) {
3747
+ const authorLogin = normalizeGitHubUsername(issue.user?.login);
3748
+ const authorUrl = typeof issue.user?.html_url === "string" && issue.user.html_url.trim() ? issue.user.html_url.trim() : void 0;
3749
+ const authorAvatarUrl = typeof issue.user?.avatar_url === "string" && issue.user.avatar_url.trim() ? issue.user.avatar_url.trim() : void 0;
3740
3750
  return {
3741
3751
  id: issue.id,
3742
3752
  number: issue.number,
3743
3753
  title: stripNullBytes(issue.title),
3744
3754
  body: typeof issue.body === "string" ? stripNullBytes(issue.body) : null,
3745
3755
  htmlUrl: issue.html_url,
3746
- ...normalizeGitHubUsername(issue.user?.login) ? { authorLogin: normalizeGitHubUsername(issue.user?.login) } : {},
3756
+ ...authorLogin ? { authorLogin } : {},
3757
+ ...authorUrl ? { authorUrl } : {},
3758
+ ...authorAvatarUrl ? { authorAvatarUrl } : {},
3747
3759
  ...normalizeGitHubLowercaseString(issue.author_association) ? { authorAssociation: normalizeGitHubLowercaseString(issue.author_association) } : {},
3748
3760
  labels: normalizeGitHubIssueLabels(issue.labels),
3749
3761
  state: issue.state === "closed" ? "closed" : "open",
@@ -4983,6 +4995,9 @@ function normalizeGitHubIssueLinkEntityData(value) {
4983
4995
  const githubIssueId = typeof record.githubIssueId === "number" && record.githubIssueId > 0 ? Math.floor(record.githubIssueId) : void 0;
4984
4996
  const githubIssueNumber = typeof record.githubIssueNumber === "number" && record.githubIssueNumber > 0 ? Math.floor(record.githubIssueNumber) : void 0;
4985
4997
  const githubIssueUrl = typeof record.githubIssueUrl === "string" ? normalizeGitHubIssueHtmlUrl(record.githubIssueUrl) : void 0;
4998
+ const creatorLogin = typeof record.creatorLogin === "string" ? normalizeGitHubUsername(record.creatorLogin) : void 0;
4999
+ const creatorUrl = typeof record.creatorUrl === "string" && record.creatorUrl.trim() ? record.creatorUrl.trim() : void 0;
5000
+ const creatorAvatarUrl = typeof record.creatorAvatarUrl === "string" && record.creatorAvatarUrl.trim() ? record.creatorAvatarUrl.trim() : void 0;
4986
5001
  const githubIssueState = record.githubIssueState === "closed" ? "closed" : record.githubIssueState === "open" ? "open" : void 0;
4987
5002
  const commentsCount = typeof record.commentsCount === "number" && record.commentsCount >= 0 ? Math.floor(record.commentsCount) : 0;
4988
5003
  const syncedAt = typeof record.syncedAt === "string" && record.syncedAt.trim() ? record.syncedAt.trim() : void 0;
@@ -4997,6 +5012,9 @@ function normalizeGitHubIssueLinkEntityData(value) {
4997
5012
  githubIssueId,
4998
5013
  githubIssueNumber,
4999
5014
  githubIssueUrl,
5015
+ ...creatorLogin ? { creatorLogin } : {},
5016
+ ...creatorUrl ? { creatorUrl } : {},
5017
+ ...creatorAvatarUrl ? { creatorAvatarUrl } : {},
5000
5018
  githubIssueState,
5001
5019
  ...githubIssueStateReason ? { githubIssueStateReason } : {},
5002
5020
  commentsCount,
@@ -5201,6 +5219,9 @@ function buildGitHubIssueLinkRecord(target, issueId, githubIssue, linkedPullRequ
5201
5219
  githubIssueId: githubIssue.id,
5202
5220
  githubIssueNumber: githubIssue.number,
5203
5221
  githubIssueUrl,
5222
+ ...githubIssue.authorLogin ? { creatorLogin: githubIssue.authorLogin } : {},
5223
+ ...githubIssue.authorUrl ? { creatorUrl: githubIssue.authorUrl } : {},
5224
+ ...githubIssue.authorAvatarUrl ? { creatorAvatarUrl: githubIssue.authorAvatarUrl } : {},
5204
5225
  githubIssueState: githubIssue.state,
5205
5226
  ...githubIssue.stateReason ? { githubIssueStateReason: githubIssue.stateReason } : {},
5206
5227
  commentsCount: githubIssue.commentsCount,
@@ -10052,28 +10073,25 @@ async function performSync(ctx, trigger, options = {}) {
10052
10073
  await ctx.state.set(IMPORT_REGISTRY_SCOPE, nextRegistry);
10053
10074
  return materializeScopedSettings(next2, config, targetCompanyId);
10054
10075
  }
10055
- const next = {
10056
- ...currentSettings,
10057
- syncState: {
10058
- status: "success",
10059
- message: `${options.target ? `GitHub sync for ${options.target.displayLabel} is complete. ` : "Sync complete. "}Imported ${createdIssuesCount} issues, updated ${updatedStatusesCount} issue status${updatedStatusesCount === 1 ? "" : "es"}, updated ${updatedLabelsCount} issue label set${updatedLabelsCount === 1 ? "" : "s"}, updated ${updatedDescriptionsCount} issue description${updatedDescriptionsCount === 1 ? "" : "s"}, and skipped ${skippedIssuesCount} already-synced issue${skippedIssuesCount === 1 ? "" : "s"}.`,
10060
- checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
10061
- syncedIssuesCount,
10062
- createdIssuesCount,
10063
- skippedIssuesCount,
10064
- erroredIssuesCount: 0,
10065
- lastRunTrigger: trigger
10066
- }
10076
+ const nextSyncState = {
10077
+ status: "success",
10078
+ message: `${options.target ? `GitHub sync for ${options.target.displayLabel} is complete. ` : "Sync complete. "}Imported ${createdIssuesCount} issues, updated ${updatedStatusesCount} issue status${updatedStatusesCount === 1 ? "" : "es"}, updated ${updatedLabelsCount} issue label set${updatedLabelsCount === 1 ? "" : "s"}, updated ${updatedDescriptionsCount} issue description${updatedDescriptionsCount === 1 ? "" : "s"}, and skipped ${skippedIssuesCount} already-synced issue${skippedIssuesCount === 1 ? "" : "s"}.`,
10079
+ checkedAt: (/* @__PURE__ */ new Date()).toISOString(),
10080
+ syncedIssuesCount,
10081
+ createdIssuesCount,
10082
+ skippedIssuesCount,
10083
+ erroredIssuesCount: 0,
10084
+ lastRunTrigger: trigger
10067
10085
  };
10068
- await ctx.state.set(SETTINGS_SCOPE, next);
10069
- await ctx.state.set(SYNC_STATE_SCOPE, next.syncState);
10086
+ const next = await saveSettingsSyncState(ctx, currentSettings, nextSyncState, targetCompanyId);
10070
10087
  await ctx.state.set(IMPORT_REGISTRY_SCOPE, nextRegistry);
10071
10088
  return next;
10072
10089
  } catch (error) {
10073
10090
  if (error instanceof SyncCancellationError) {
10074
- const next2 = {
10075
- ...currentSettings,
10076
- syncState: createCancelledSyncState({
10091
+ const next2 = await saveSettingsSyncState(
10092
+ ctx,
10093
+ currentSettings,
10094
+ createCancelledSyncState({
10077
10095
  message: buildCancelledSyncMessage(options.target, currentProgress),
10078
10096
  trigger,
10079
10097
  syncedIssuesCount,
@@ -10081,10 +10099,9 @@ async function performSync(ctx, trigger, options = {}) {
10081
10099
  skippedIssuesCount,
10082
10100
  erroredIssuesCount: recoverableFailures.length,
10083
10101
  progress: currentProgress
10084
- })
10085
- };
10086
- await ctx.state.set(SETTINGS_SCOPE, next2);
10087
- await ctx.state.set(SYNC_STATE_SCOPE, next2.syncState);
10102
+ }),
10103
+ targetCompanyId
10104
+ );
10088
10105
  await ctx.state.set(IMPORT_REGISTRY_SCOPE, nextRegistry);
10089
10106
  return next2;
10090
10107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paperclip-github-plugin",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Paperclip plugin for synchronizing GitHub issues into Paperclip projects.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",