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.js CHANGED
@@ -3925,14 +3925,27 @@ async function readIndex(instanceUrl, token, scope, id, indexSlug) {
3925
3925
  return [];
3926
3926
  }
3927
3927
  }
3928
+ async function sleep2(ms) {
3929
+ return new Promise((resolve) => setTimeout(resolve, ms));
3930
+ }
3928
3931
  async function writeIndex(instanceUrl, token, scope, id, indexSlug, entries) {
3929
- const content = formatIndex(entries) || "# Skills Index";
3930
- try {
3931
- await updateWikiPage(instanceUrl, token, scope, id, indexSlug, content);
3932
- } catch (updateErr) {
3933
- if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
3932
+ const content = formatIndex(entries) || "# Skills Registry";
3933
+ for (let attempt = 0; attempt < 3; attempt++) {
3934
+ try {
3935
+ await updateWikiPage(instanceUrl, token, scope, id, indexSlug, content);
3936
+ return;
3937
+ } catch (updateErr) {
3938
+ const msg = updateErr.message ?? "";
3939
+ if (msg.includes("not found") || msg.includes("404")) {
3940
+ await createWikiPage(instanceUrl, token, scope, id, indexSlug, content);
3941
+ return;
3942
+ }
3943
+ if (attempt < 2) {
3944
+ await sleep2(1e3 * (attempt + 1));
3945
+ continue;
3946
+ }
3934
3947
  throw updateErr;
3935
- await createWikiPage(instanceUrl, token, scope, id, indexSlug, content);
3948
+ }
3936
3949
  }
3937
3950
  }
3938
3951
  async function upsertIndexEntry(instanceUrl, token, scope, id, indexSlug, entry) {
@@ -3953,12 +3966,30 @@ async function removeIndexEntry(instanceUrl, token, scope, id, indexSlug, name)
3953
3966
  }
3954
3967
  }
3955
3968
  async function upsertPage(instanceUrl, token, scope, id, slug, content) {
3956
- try {
3957
- await updateWikiPage(instanceUrl, token, scope, id, slug, content);
3958
- } catch (updateErr) {
3959
- if (!updateErr.message?.includes("not found") && !updateErr.message?.includes("404"))
3969
+ for (let attempt = 0; attempt < 3; attempt++) {
3970
+ try {
3971
+ await updateWikiPage(instanceUrl, token, scope, id, slug, content);
3972
+ return;
3973
+ } catch (updateErr) {
3974
+ const msg = updateErr.message ?? "";
3975
+ if (msg.includes("not found") || msg.includes("404")) {
3976
+ try {
3977
+ await createWikiPage(instanceUrl, token, scope, id, slug, content);
3978
+ return;
3979
+ } catch (createErr) {
3980
+ if (attempt < 2 && (createErr.message?.includes("Duplicate") || createErr.message?.includes("reference"))) {
3981
+ await sleep2(1e3 * (attempt + 1));
3982
+ continue;
3983
+ }
3984
+ throw createErr;
3985
+ }
3986
+ }
3987
+ if (attempt < 2) {
3988
+ await sleep2(1e3 * (attempt + 1));
3989
+ continue;
3990
+ }
3960
3991
  throw updateErr;
3961
- await createWikiPage(instanceUrl, token, scope, id, slug, content);
3992
+ }
3962
3993
  }
3963
3994
  }
3964
3995
  var EMPTY_FILE_SENTINEL = "__EMPTY_FILE__";