npm package diff

Package: @forge/util

Versions: 1.4.10-next.0 - 1.4.10-next.0-experimental-effab31

File: package/packages/ari/chunk-4NKKA36Z.mjs

Index: package/packages/ari/chunk-4NKKA36Z.mjs
===================================================================
--- package/packages/ari/chunk-4NKKA36Z.mjs
+++ package/packages/ari/chunk-4NKKA36Z.mjs
@@ -0,0 +1,70 @@
+import {
+  BitbucketAppAriResourceOwner,
+  BitbucketAppAriResourceType
+} from "./chunk-HN5XXUJU.mjs";
+import {
+  RegisteredAri
+} from "./chunk-AB4PPISI.mjs";
+import {
+  AriParser
+} from "./chunk-S7RIZVFI.mjs";
+
+// src/bitbucket/app/manifest.ts
+var bitbucketAppAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
+  resourceOwner: BitbucketAppAriResourceOwner,
+  resourceType: BitbucketAppAriResourceType,
+  resourceIdSlug: "{workspaceId}/{appId}",
+  resourceIdSegmentFormats: {
+    workspaceId: /\{[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}}/,
+    // eslint-disable-line no-useless-escape
+    appId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
+    // eslint-disable-line no-useless-escape
+  }
+};
+
+// src/bitbucket/app/index.ts
+var BitbucketAppAri = class _BitbucketAppAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts);
+    this._workspaceId = opts.resourceIdSegmentValues.workspaceId, this._appId = opts.resourceIdSegmentValues.appId;
+  }
+  get workspaceId() {
+    return this._workspaceId;
+  }
+  get appId() {
+    return this._appId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: bitbucketAppAriStaticOpts.qualifier,
+      platformQualifier: bitbucketAppAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: bitbucketAppAriStaticOpts.resourceOwner,
+      resourceType: bitbucketAppAriStaticOpts.resourceType,
+      resourceId: `${opts.workspaceId}/${opts.appId}`,
+      resourceIdSegmentValues: {
+        workspaceId: opts.workspaceId,
+        appId: opts.appId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, bitbucketAppAriStaticOpts);
+    return new _BitbucketAppAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, bitbucketAppAriStaticOpts);
+    return new _BitbucketAppAri(opts);
+  }
+  getVariables() {
+    return {
+      workspaceId: this.workspaceId,
+      appId: this.appId
+    };
+  }
+};
+
+export {
+  BitbucketAppAri
+};