paperclip-github-plugin 0.3.6 → 0.4.0
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/README.md +15 -7
- package/dist/manifest.js +1 -1
- package/dist/ui/index.js +412 -25
- package/dist/ui/index.js.map +3 -3
- package/dist/worker.js +64 -5
- package/package.json +1 -1
package/dist/worker.js
CHANGED
|
@@ -1600,13 +1600,16 @@ function buildGitHubRepositoryTokenCapabilityAudit(params) {
|
|
|
1600
1600
|
function normalizeSecretRef(value) {
|
|
1601
1601
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
1602
1602
|
}
|
|
1603
|
-
function
|
|
1603
|
+
function normalizeGitHubLowercaseString(value) {
|
|
1604
1604
|
if (typeof value !== "string") {
|
|
1605
1605
|
return void 0;
|
|
1606
1606
|
}
|
|
1607
1607
|
const trimmed = stripNullBytes(value).trim();
|
|
1608
1608
|
return trimmed ? trimmed.toLowerCase() : void 0;
|
|
1609
1609
|
}
|
|
1610
|
+
function normalizeGitHubUserLogin(value) {
|
|
1611
|
+
return normalizeGitHubLowercaseString(value);
|
|
1612
|
+
}
|
|
1610
1613
|
function normalizeGitHubTokenRef(value) {
|
|
1611
1614
|
return normalizeSecretRef(value);
|
|
1612
1615
|
}
|
|
@@ -2624,17 +2627,27 @@ function getPublicSettings(settings) {
|
|
|
2624
2627
|
const {
|
|
2625
2628
|
githubTokenRef: _githubTokenRef,
|
|
2626
2629
|
paperclipBoardApiTokenRefs: _paperclipBoardApiTokenRefs,
|
|
2630
|
+
paperclipBoardAccessIdentityByCompanyId: _paperclipBoardAccessIdentityByCompanyId,
|
|
2627
2631
|
companyAdvancedSettingsByCompanyId: _companyAdvancedSettingsByCompanyId,
|
|
2628
2632
|
...publicSettings
|
|
2629
2633
|
} = settings;
|
|
2630
2634
|
return publicSettings;
|
|
2631
2635
|
}
|
|
2636
|
+
function getPaperclipBoardAccessIdentity(settings, companyId) {
|
|
2637
|
+
const normalizedCompanyId = normalizeCompanyId(companyId);
|
|
2638
|
+
if (!normalizedCompanyId) {
|
|
2639
|
+
return void 0;
|
|
2640
|
+
}
|
|
2641
|
+
return normalizeOptionalString2(settings.paperclipBoardAccessIdentityByCompanyId?.[normalizedCompanyId]);
|
|
2642
|
+
}
|
|
2632
2643
|
function getPublicSettingsForScope(settings, companyId) {
|
|
2633
2644
|
const publicSettings = getPublicSettings(settings);
|
|
2645
|
+
const paperclipBoardAccessIdentity = getPaperclipBoardAccessIdentity(settings, companyId);
|
|
2634
2646
|
return {
|
|
2635
2647
|
...publicSettings,
|
|
2636
2648
|
mappings: filterMappingsByCompany(publicSettings.mappings, companyId),
|
|
2637
|
-
advancedSettings: getCompanyAdvancedSettings(settings, companyId)
|
|
2649
|
+
advancedSettings: getCompanyAdvancedSettings(settings, companyId),
|
|
2650
|
+
...paperclipBoardAccessIdentity ? { paperclipBoardAccessIdentity } : {}
|
|
2638
2651
|
};
|
|
2639
2652
|
}
|
|
2640
2653
|
async function listAvailableAssignees(ctx, companyId) {
|
|
@@ -3036,6 +3049,20 @@ function normalizePaperclipBoardApiTokenRefs(value) {
|
|
|
3036
3049
|
}
|
|
3037
3050
|
return Object.fromEntries(entries);
|
|
3038
3051
|
}
|
|
3052
|
+
function normalizePaperclipBoardAccessIdentityByCompanyId(value) {
|
|
3053
|
+
if (!value || typeof value !== "object") {
|
|
3054
|
+
return void 0;
|
|
3055
|
+
}
|
|
3056
|
+
const entries = Object.entries(value).map(([companyId, identityLabel]) => {
|
|
3057
|
+
const normalizedCompanyId = normalizeCompanyId(companyId);
|
|
3058
|
+
const normalizedIdentityLabel = normalizeOptionalString2(identityLabel);
|
|
3059
|
+
return normalizedCompanyId && normalizedIdentityLabel ? [normalizedCompanyId, normalizedIdentityLabel] : null;
|
|
3060
|
+
}).filter((entry) => entry !== null);
|
|
3061
|
+
if (entries.length === 0) {
|
|
3062
|
+
return void 0;
|
|
3063
|
+
}
|
|
3064
|
+
return Object.fromEntries(entries);
|
|
3065
|
+
}
|
|
3039
3066
|
function normalizeSyncCancellationRequest(value) {
|
|
3040
3067
|
if (!value || typeof value !== "object") {
|
|
3041
3068
|
return null;
|
|
@@ -3122,6 +3149,10 @@ function normalizeIgnoredIssueAuthorUsernames(value) {
|
|
|
3122
3149
|
const entries = Array.isArray(value) ? value.map((entry) => normalizeGitHubUsername(entry)).filter((entry) => Boolean(entry)) : typeof value === "string" ? parseIgnoredIssueAuthorUsernames(value) : [];
|
|
3123
3150
|
return [...new Set(entries)];
|
|
3124
3151
|
}
|
|
3152
|
+
function normalizeAgentIds(value) {
|
|
3153
|
+
const entries = Array.isArray(value) ? value.map((entry) => normalizeOptionalString2(entry)).filter((entry) => Boolean(entry)) : [];
|
|
3154
|
+
return [...new Set(entries)].sort((left, right) => left.localeCompare(right));
|
|
3155
|
+
}
|
|
3125
3156
|
function normalizeAdvancedSettings(value) {
|
|
3126
3157
|
if (!value || typeof value !== "object") {
|
|
3127
3158
|
return DEFAULT_ADVANCED_SETTINGS;
|
|
@@ -3130,10 +3161,12 @@ function normalizeAdvancedSettings(value) {
|
|
|
3130
3161
|
const defaultAssigneeAgentId = normalizeOptionalString2(record.defaultAssigneeAgentId);
|
|
3131
3162
|
const defaultStatus = "defaultStatus" in record ? coercePaperclipIssueStatus(record.defaultStatus) : DEFAULT_ADVANCED_SETTINGS.defaultStatus;
|
|
3132
3163
|
const ignoredIssueAuthorUsernames = "ignoredIssueAuthorUsernames" in record ? normalizeIgnoredIssueAuthorUsernames(record.ignoredIssueAuthorUsernames) : DEFAULT_ADVANCED_SETTINGS.ignoredIssueAuthorUsernames;
|
|
3164
|
+
const githubTokenPropagationAgentIds = "githubTokenPropagationAgentIds" in record ? normalizeAgentIds(record.githubTokenPropagationAgentIds) : [];
|
|
3133
3165
|
return {
|
|
3134
3166
|
...defaultAssigneeAgentId ? { defaultAssigneeAgentId } : {},
|
|
3135
3167
|
defaultStatus,
|
|
3136
|
-
ignoredIssueAuthorUsernames
|
|
3168
|
+
ignoredIssueAuthorUsernames,
|
|
3169
|
+
...githubTokenPropagationAgentIds.length > 0 ? { githubTokenPropagationAgentIds } : {}
|
|
3137
3170
|
};
|
|
3138
3171
|
}
|
|
3139
3172
|
function normalizeCompanyAdvancedSettingsByCompanyId(value) {
|
|
@@ -3235,7 +3268,11 @@ function normalizeSettings(value) {
|
|
|
3235
3268
|
const record = value;
|
|
3236
3269
|
const paperclipApiBaseUrl = resolvePaperclipApiBaseUrl(record.paperclipApiBaseUrl);
|
|
3237
3270
|
const githubTokenRef = normalizeGitHubTokenRef(record.githubTokenRef);
|
|
3271
|
+
const githubTokenLogin = normalizeOptionalString2(record.githubTokenLogin);
|
|
3238
3272
|
const paperclipBoardApiTokenRefs = normalizePaperclipBoardApiTokenRefs(record.paperclipBoardApiTokenRefs);
|
|
3273
|
+
const paperclipBoardAccessIdentityByCompanyId = normalizePaperclipBoardAccessIdentityByCompanyId(
|
|
3274
|
+
record.paperclipBoardAccessIdentityByCompanyId
|
|
3275
|
+
);
|
|
3239
3276
|
const companyAdvancedSettingsByCompanyId = normalizeCompanyAdvancedSettingsByCompanyId(record.companyAdvancedSettingsByCompanyId);
|
|
3240
3277
|
return {
|
|
3241
3278
|
mappings: normalizeMappings(record.mappings),
|
|
@@ -3243,7 +3280,9 @@ function normalizeSettings(value) {
|
|
|
3243
3280
|
scheduleFrequencyMinutes: normalizeScheduleFrequencyMinutes(record.scheduleFrequencyMinutes),
|
|
3244
3281
|
...paperclipApiBaseUrl ? { paperclipApiBaseUrl } : {},
|
|
3245
3282
|
...githubTokenRef ? { githubTokenRef } : {},
|
|
3283
|
+
...githubTokenLogin ? { githubTokenLogin } : {},
|
|
3246
3284
|
...paperclipBoardApiTokenRefs ? { paperclipBoardApiTokenRefs } : {},
|
|
3285
|
+
...paperclipBoardAccessIdentityByCompanyId ? { paperclipBoardAccessIdentityByCompanyId } : {},
|
|
3247
3286
|
...companyAdvancedSettingsByCompanyId ? { companyAdvancedSettingsByCompanyId } : {},
|
|
3248
3287
|
updatedAt: typeof record.updatedAt === "string" ? record.updatedAt : void 0
|
|
3249
3288
|
};
|
|
@@ -4207,8 +4246,9 @@ async function isGitHubUserRepositoryMaintainer(octokit, repository, login, cach
|
|
|
4207
4246
|
"X-GitHub-Api-Version": GITHUB_API_VERSION
|
|
4208
4247
|
}
|
|
4209
4248
|
});
|
|
4210
|
-
const
|
|
4211
|
-
const
|
|
4249
|
+
const permission = response.data && typeof response.data === "object" && "permission" in response.data ? normalizeGitHubLowercaseString(response.data.permission) : void 0;
|
|
4250
|
+
const roleName = response.data && typeof response.data === "object" && "role_name" in response.data ? normalizeGitHubLowercaseString(response.data.role_name) : void 0;
|
|
4251
|
+
const isMaintainer = (permission ? GITHUB_REPOSITORY_MAINTAINER_ROLE_NAMES.has(permission) : false) || (roleName ? GITHUB_REPOSITORY_MAINTAINER_ROLE_NAMES.has(roleName) : false);
|
|
4212
4252
|
cache.set(cacheKey, isMaintainer);
|
|
4213
4253
|
return isMaintainer;
|
|
4214
4254
|
} catch (error) {
|
|
@@ -10561,6 +10601,7 @@ var plugin = definePlugin({
|
|
|
10561
10601
|
const hasMappingsPatch = "mappings" in record;
|
|
10562
10602
|
const hasAdvancedSettingsPatch = "advancedSettings" in record;
|
|
10563
10603
|
const githubTokenRef = "githubTokenRef" in record ? normalizeGitHubTokenRef(record.githubTokenRef) : normalizeGitHubTokenRef(previous.githubTokenRef) ?? normalizeGitHubTokenRef(config.githubTokenRef);
|
|
10604
|
+
const githubTokenLogin = "githubTokenLogin" in record ? normalizeOptionalString2(record.githubTokenLogin) : previous.githubTokenLogin;
|
|
10564
10605
|
const inputMappings = hasMappingsPatch ? normalizeMappings(record.mappings) : previous.mappings;
|
|
10565
10606
|
const nextCompanyAdvancedSettingsByCompanyId = {
|
|
10566
10607
|
...previous.companyAdvancedSettingsByCompanyId ?? {}
|
|
@@ -10580,7 +10621,9 @@ var plugin = definePlugin({
|
|
|
10580
10621
|
syncState: previous.syncState,
|
|
10581
10622
|
scheduleFrequencyMinutes: "scheduleFrequencyMinutes" in record ? record.scheduleFrequencyMinutes : previous.scheduleFrequencyMinutes,
|
|
10582
10623
|
paperclipApiBaseUrl: "paperclipApiBaseUrl" in record ? resolveTrustedPaperclipApiBaseUrlInput(record.paperclipApiBaseUrl, previous, config) : getConfiguredPaperclipApiBaseUrl(previous, config),
|
|
10624
|
+
...githubTokenLogin ? { githubTokenLogin } : {},
|
|
10583
10625
|
paperclipBoardApiTokenRefs: previous.paperclipBoardApiTokenRefs,
|
|
10626
|
+
paperclipBoardAccessIdentityByCompanyId: previous.paperclipBoardAccessIdentityByCompanyId,
|
|
10584
10627
|
...Object.keys(nextCompanyAdvancedSettingsByCompanyId).length > 0 ? { companyAdvancedSettingsByCompanyId: nextCompanyAdvancedSettingsByCompanyId } : {},
|
|
10585
10628
|
...githubTokenRef ? { githubTokenRef } : {}
|
|
10586
10629
|
});
|
|
@@ -10596,7 +10639,9 @@ var plugin = definePlugin({
|
|
|
10596
10639
|
syncState: previous.syncState,
|
|
10597
10640
|
scheduleFrequencyMinutes: current.scheduleFrequencyMinutes,
|
|
10598
10641
|
...current.paperclipApiBaseUrl ? { paperclipApiBaseUrl: current.paperclipApiBaseUrl } : {},
|
|
10642
|
+
...current.githubTokenLogin ? { githubTokenLogin: current.githubTokenLogin } : {},
|
|
10599
10643
|
...current.paperclipBoardApiTokenRefs ? { paperclipBoardApiTokenRefs: current.paperclipBoardApiTokenRefs } : {},
|
|
10644
|
+
...current.paperclipBoardAccessIdentityByCompanyId ? { paperclipBoardAccessIdentityByCompanyId: current.paperclipBoardAccessIdentityByCompanyId } : {},
|
|
10600
10645
|
...current.companyAdvancedSettingsByCompanyId ? { companyAdvancedSettingsByCompanyId: current.companyAdvancedSettingsByCompanyId } : {},
|
|
10601
10646
|
...githubTokenRef ? { githubTokenRef } : {},
|
|
10602
10647
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -10624,18 +10669,32 @@ var plugin = definePlugin({
|
|
|
10624
10669
|
const nextPaperclipBoardApiTokenRefs = {
|
|
10625
10670
|
...previous.paperclipBoardApiTokenRefs ?? {}
|
|
10626
10671
|
};
|
|
10672
|
+
const nextPaperclipBoardAccessIdentityByCompanyId = {
|
|
10673
|
+
...previous.paperclipBoardAccessIdentityByCompanyId ?? {}
|
|
10674
|
+
};
|
|
10627
10675
|
if (nextSecretRef) {
|
|
10628
10676
|
nextPaperclipBoardApiTokenRefs[companyId] = nextSecretRef;
|
|
10629
10677
|
} else {
|
|
10630
10678
|
delete nextPaperclipBoardApiTokenRefs[companyId];
|
|
10679
|
+
delete nextPaperclipBoardAccessIdentityByCompanyId[companyId];
|
|
10680
|
+
}
|
|
10681
|
+
if ("paperclipBoardAccessIdentity" in record) {
|
|
10682
|
+
const nextIdentityLabel = normalizeOptionalString2(record.paperclipBoardAccessIdentity);
|
|
10683
|
+
if (nextIdentityLabel) {
|
|
10684
|
+
nextPaperclipBoardAccessIdentityByCompanyId[companyId] = nextIdentityLabel;
|
|
10685
|
+
} else {
|
|
10686
|
+
delete nextPaperclipBoardAccessIdentityByCompanyId[companyId];
|
|
10687
|
+
}
|
|
10631
10688
|
}
|
|
10632
10689
|
const {
|
|
10633
10690
|
paperclipBoardApiTokenRefs: _previousPaperclipBoardApiTokenRefs,
|
|
10691
|
+
paperclipBoardAccessIdentityByCompanyId: _previousPaperclipBoardAccessIdentityByCompanyId,
|
|
10634
10692
|
...previousWithoutBoardAccess
|
|
10635
10693
|
} = previous;
|
|
10636
10694
|
const next = sanitizeSettingsForCurrentSetup({
|
|
10637
10695
|
...previousWithoutBoardAccess,
|
|
10638
10696
|
...Object.keys(nextPaperclipBoardApiTokenRefs).length > 0 ? { paperclipBoardApiTokenRefs: nextPaperclipBoardApiTokenRefs } : {},
|
|
10697
|
+
...Object.keys(nextPaperclipBoardAccessIdentityByCompanyId).length > 0 ? { paperclipBoardAccessIdentityByCompanyId: nextPaperclipBoardAccessIdentityByCompanyId } : {},
|
|
10639
10698
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
10640
10699
|
}, {
|
|
10641
10700
|
hasToken: hasConfiguredGithubToken(previous, config),
|