@forge/util

2.0.12.0.1-experimental-7890858
packages/ari/bitbucket/index.js
~packages/ari/bitbucket/index.jsModified
+67−36
Index: package/packages/ari/bitbucket/index.js
===================================================================
--- package/packages/ari/bitbucket/index.js
+++ package/packages/ari/bitbucket/index.js
@@ -20,8 +20,9 @@
   BitbucketAppAri: () => BitbucketAppAri,
   BitbucketOauthConsumerAri: () => BitbucketOauthConsumerAri,
   BitbucketProjectAri: () => BitbucketProjectAri,
   BitbucketPullrequestAri: () => BitbucketPullrequestAri,
+  BitbucketPullrequestCommentAri: () => BitbucketPullrequestCommentAri,
   BitbucketRepositoryAri: () => BitbucketRepositoryAri,
   BitbucketRepositoryTransferAri: () => BitbucketRepositoryTransferAri,
   BitbucketSiteAri: () => BitbucketSiteAri,
   BitbucketTeamAri: () => BitbucketTeamAri,
@@ -283,32 +284,28 @@
   }
 };
 
 // src/bitbucket/app/types.ts
-var BitbucketAppAriResourceOwner = "bitbucket", BitbucketAppAriResourceType = "app";
+var BitbucketAppAriResourceOwner = "bitbucket";
 
 // src/bitbucket/app/manifest.ts
 var bitbucketAppAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketAppAriResourceOwner,
-  resourceType: BitbucketAppAriResourceType,
+  resourceType: "app",
   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;
+    super(opts), this._workspaceId = opts.resourceIdSegmentValues.workspaceId, this._appId = opts.resourceIdSegmentValues.appId;
   }
   get workspaceId() {
     return this._workspaceId;
   }
@@ -349,23 +346,20 @@
 var bitbucketOauthConsumerAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketOauthConsumerAriResourceOwner,
   resourceType: BitbucketOauthConsumerAriResourceType,
   resourceIdSlug: "{clientId}",
   resourceIdSegmentFormats: {
     clientId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
-    // eslint-disable-line no-useless-escape
   }
 };
 
 // src/bitbucket/oauth-consumer/index.ts
 var BitbucketOauthConsumerAri = class _BitbucketOauthConsumerAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._clientId = opts.resourceIdSegmentValues.clientId;
+    super(opts), this._clientId = opts.resourceIdSegmentValues.clientId;
   }
   get clientId() {
     return this._clientId;
   }
@@ -401,23 +395,20 @@
 var bitbucketProjectAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketProjectAriResourceOwner,
   resourceType: BitbucketProjectAriResourceType,
   resourceIdSlug: "{projectId}",
   resourceIdSegmentFormats: {
     projectId: /[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
   }
 };
 
 // src/bitbucket/project/index.ts
 var BitbucketProjectAri = class _BitbucketProjectAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._projectId = opts.resourceIdSegmentValues.projectId;
+    super(opts), this._projectId = opts.resourceIdSegmentValues.projectId;
   }
   get projectId() {
     return this._projectId;
   }
@@ -453,23 +444,20 @@
 var bitbucketPullrequestAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketPullrequestAriResourceOwner,
   resourceType: BitbucketPullrequestAriResourceType,
   resourceIdSlug: "{pullRequestId}",
   resourceIdSegmentFormats: {
     pullRequestId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
-    // eslint-disable-line no-useless-escape
   }
 };
 
 // src/bitbucket/pullrequest/index.ts
 var BitbucketPullrequestAri = class _BitbucketPullrequestAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._pullRequestId = opts.resourceIdSegmentValues.pullRequestId;
+    super(opts), this._pullRequestId = opts.resourceIdSegmentValues.pullRequestId;
   }
   get pullRequestId() {
     return this._pullRequestId;
   }
@@ -497,31 +485,83 @@
     };
   }
 };
 
+// src/bitbucket/pullrequest-comment/types.ts
+var BitbucketPullrequestCommentAriResourceOwner = "bitbucket", BitbucketPullrequestCommentAriResourceType = "pullrequest-comment";
+
+// src/bitbucket/pullrequest-comment/manifest.ts
+var bitbucketPullrequestCommentAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^$"),
+  resourceOwner: BitbucketPullrequestCommentAriResourceOwner,
+  resourceType: BitbucketPullrequestCommentAriResourceType,
+  resourceIdSlug: "{pullRequestId}/{commentId}",
+  resourceIdSegmentFormats: {
+    pullRequestId: /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}:[0-9]+/,
+    commentId: /[0-9]+/
+  }
+};
+
+// src/bitbucket/pullrequest-comment/index.ts
+var BitbucketPullrequestCommentAri = class _BitbucketPullrequestCommentAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts), this._pullRequestId = opts.resourceIdSegmentValues.pullRequestId, this._commentId = opts.resourceIdSegmentValues.commentId;
+  }
+  get pullRequestId() {
+    return this._pullRequestId;
+  }
+  get commentId() {
+    return this._commentId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: bitbucketPullrequestCommentAriStaticOpts.qualifier,
+      platformQualifier: bitbucketPullrequestCommentAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: bitbucketPullrequestCommentAriStaticOpts.resourceOwner,
+      resourceType: bitbucketPullrequestCommentAriStaticOpts.resourceType,
+      resourceId: `${opts.pullRequestId}/${opts.commentId}`,
+      resourceIdSegmentValues: {
+        pullRequestId: opts.pullRequestId,
+        commentId: opts.commentId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, bitbucketPullrequestCommentAriStaticOpts);
+    return new _BitbucketPullrequestCommentAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, bitbucketPullrequestCommentAriStaticOpts);
+    return new _BitbucketPullrequestCommentAri(opts);
+  }
+  getVariables() {
+    return {
+      pullRequestId: this.pullRequestId,
+      commentId: this.commentId
+    };
+  }
+};
+
 // src/bitbucket/repository/types.ts
 var BitbucketRepositoryAriResourceOwner = "bitbucket", BitbucketRepositoryAriResourceType = "repository";
 
 // src/bitbucket/repository/manifest.ts
 var bitbucketRepositoryAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketRepositoryAriResourceOwner,
   resourceType: BitbucketRepositoryAriResourceType,
   resourceIdSlug: "{repositoryId}",
   resourceIdSegmentFormats: {
     repositoryId: /[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
   }
 };
 
 // src/bitbucket/repository/index.ts
 var BitbucketRepositoryAri = class _BitbucketRepositoryAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._repositoryId = opts.resourceIdSegmentValues.repositoryId;
+    super(opts), this._repositoryId = opts.resourceIdSegmentValues.repositoryId;
   }
   get repositoryId() {
     return this._repositoryId;
   }
@@ -557,23 +597,20 @@
 var bitbucketRepositoryTransferAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketRepositoryTransferAriResourceOwner,
   resourceType: BitbucketRepositoryTransferAriResourceType,
   resourceIdSlug: "{transferId}",
   resourceIdSegmentFormats: {
     transferId: /[a-f0-9]{32}/
-    // eslint-disable-line no-useless-escape
   }
 };
 
 // src/bitbucket/repository-transfer/index.ts
 var BitbucketRepositoryTransferAri = class _BitbucketRepositoryTransferAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._transferId = opts.resourceIdSegmentValues.transferId;
+    super(opts), this._transferId = opts.resourceIdSegmentValues.transferId;
   }
   get transferId() {
     return this._transferId;
   }
@@ -609,9 +646,8 @@
 var bitbucketSiteAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketSiteAriResourceOwner,
   resourceType: BitbucketSiteAriResourceType,
   resourceIdSlug: "bitbucket",
   resourceIdSegmentFormats: {}
@@ -650,23 +686,20 @@
 var bitbucketTeamAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketTeamAriResourceOwner,
   resourceType: BitbucketTeamAriResourceType,
   resourceIdSlug: "{teamId}",
   resourceIdSegmentFormats: {
     teamId: /[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
   }
 };
 
 // src/bitbucket/team/index.ts
 var BitbucketTeamAri = class _BitbucketTeamAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._teamId = opts.resourceIdSegmentValues.teamId;
+    super(opts), this._teamId = opts.resourceIdSegmentValues.teamId;
   }
   get teamId() {
     return this._teamId;
   }
@@ -702,23 +735,20 @@
 var bitbucketWorkspaceAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
-  // eslint-disable-line no-useless-escape
   resourceOwner: BitbucketWorkspaceAriResourceOwner,
   resourceType: BitbucketWorkspaceAriResourceType,
   resourceIdSlug: "{workspaceId}",
   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
   }
 };
 
 // src/bitbucket/workspace/index.ts
 var BitbucketWorkspaceAri = class _BitbucketWorkspaceAri extends RegisteredAri {
   constructor(opts) {
-    super(opts);
-    this._workspaceId = opts.resourceIdSegmentValues.workspaceId;
+    super(opts), this._workspaceId = opts.resourceIdSegmentValues.workspaceId;
   }
   get workspaceId() {
     return this._workspaceId;
   }
@@ -751,8 +781,9 @@
   BitbucketAppAri,
   BitbucketOauthConsumerAri,
   BitbucketProjectAri,
   BitbucketPullrequestAri,
+  BitbucketPullrequestCommentAri,
   BitbucketRepositoryAri,
   BitbucketRepositoryTransferAri,
   BitbucketSiteAri,
   BitbucketTeamAri,