opencode-gitlab-dap 1.16.2 → 1.16.3

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/index.cjs CHANGED
@@ -4084,14 +4084,27 @@ async function readIndex(instanceUrl, token, scope, id, indexSlug) {
4084
4084
  return [];
4085
4085
  }
4086
4086
  }
4087
+ async function sleep2(ms) {
4088
+ return new Promise((resolve) => setTimeout(resolve, ms));
4089
+ }
4087
4090
  async function writeIndex(instanceUrl, token, scope, id, indexSlug, entries) {
4088
- const content = formatIndex(entries) || "# Skills Index";
4089
- try {
4090
- await updateWikiPage(instanceUrl, token, scope, id, indexSlug, content);
4091
- } catch (updateErr) {
4092
- if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
4091
+ const content = formatIndex(entries) || "# Skills Registry";
4092
+ for (let attempt = 0; attempt < 3; attempt++) {
4093
+ try {
4094
+ await updateWikiPage(instanceUrl, token, scope, id, indexSlug, content);
4095
+ return;
4096
+ } catch (updateErr) {
4097
+ const msg = updateErr.message ?? "";
4098
+ if (msg.includes("not found") || msg.includes("404")) {
4099
+ await createWikiPage(instanceUrl, token, scope, id, indexSlug, content);
4100
+ return;
4101
+ }
4102
+ if (attempt < 2) {
4103
+ await sleep2(1e3 * (attempt + 1));
4104
+ continue;
4105
+ }
4093
4106
  throw updateErr;
4094
- await createWikiPage(instanceUrl, token, scope, id, indexSlug, content);
4107
+ }
4095
4108
  }
4096
4109
  }
4097
4110
  async function upsertIndexEntry(instanceUrl, token, scope, id, indexSlug, entry) {
@@ -4112,12 +4125,30 @@ async function removeIndexEntry(instanceUrl, token, scope, id, indexSlug, name)
4112
4125
  }
4113
4126
  }
4114
4127
  async function upsertPage(instanceUrl, token, scope, id, slug, content) {
4115
- try {
4116
- await updateWikiPage(instanceUrl, token, scope, id, slug, content);
4117
- } catch (updateErr) {
4118
- if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
4128
+ for (let attempt = 0; attempt < 3; attempt++) {
4129
+ try {
4130
+ await updateWikiPage(instanceUrl, token, scope, id, slug, content);
4131
+ return;
4132
+ } catch (updateErr) {
4133
+ const msg = updateErr.message ?? "";
4134
+ if (msg.includes("not found") || msg.includes("404")) {
4135
+ try {
4136
+ await createWikiPage(instanceUrl, token, scope, id, slug, content);
4137
+ return;
4138
+ } catch (createErr) {
4139
+ if (attempt < 2 && (createErr.message?.includes("Duplicate") || createErr.message?.includes("reference"))) {
4140
+ await sleep2(1e3 * (attempt + 1));
4141
+ continue;
4142
+ }
4143
+ throw createErr;
4144
+ }
4145
+ }
4146
+ if (attempt < 2) {
4147
+ await sleep2(1e3 * (attempt + 1));
4148
+ continue;
4149
+ }
4119
4150
  throw updateErr;
4120
- await createWikiPage(instanceUrl, token, scope, id, slug, content);
4151
+ }
4121
4152
  }
4122
4153
  }
4123
4154
  var EMPTY_FILE_SENTINEL = "__EMPTY_FILE__";