@forge/util

2.0.12.0.1-experimental-7890858
packages/ari/chunk-UIMORLV4.mjs
+packages/ari/chunk-UIMORLV4.mjsNew file
+77
Index: package/packages/ari/chunk-UIMORLV4.mjs
===================================================================
--- package/packages/ari/chunk-UIMORLV4.mjs
+++ package/packages/ari/chunk-UIMORLV4.mjs
@@ -0,0 +1,77 @@
+import {
+  MercuryCustomFieldAriResourceOwner,
+  MercuryCustomFieldAriResourceType
+} from "./chunk-4BBF6KFQ.mjs";
+import {
+  RegisteredAri
+} from "./chunk-AB4PPISI.mjs";
+import {
+  AriParser
+} from "./chunk-S7RIZVFI.mjs";
+
+// src/mercury/custom-field/manifest.ts
+var mercuryCustomFieldAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^[a-zA-Z0-9_\\-.]{1,255}$"),
+  resourceOwner: MercuryCustomFieldAriResourceOwner,
+  resourceType: MercuryCustomFieldAriResourceType,
+  resourceIdSlug: "{entityType}/workspace/{workspaceId}/{customFieldId}",
+  resourceIdSegmentFormats: {
+    entityType: /(change-proposal|focus-area)/,
+    workspaceId: /[a-zA-Z0-9\-]+/,
+    // eslint-disable-line no-useless-escape
+    customFieldId: /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/
+  }
+};
+
+// src/mercury/custom-field/index.ts
+var MercuryCustomFieldAri = class _MercuryCustomFieldAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts), this._siteId = opts.cloudId || "", this._entityType = opts.resourceIdSegmentValues.entityType, this._workspaceId = opts.resourceIdSegmentValues.workspaceId, this._customFieldId = opts.resourceIdSegmentValues.customFieldId;
+  }
+  get siteId() {
+    return this._siteId;
+  }
+  get entityType() {
+    return this._entityType;
+  }
+  get workspaceId() {
+    return this._workspaceId;
+  }
+  get customFieldId() {
+    return this._customFieldId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: mercuryCustomFieldAriStaticOpts.qualifier,
+      platformQualifier: mercuryCustomFieldAriStaticOpts.platformQualifier,
+      cloudId: opts.siteId,
+      resourceOwner: mercuryCustomFieldAriStaticOpts.resourceOwner,
+      resourceType: mercuryCustomFieldAriStaticOpts.resourceType,
+      resourceId: `${opts.entityType}/workspace/${opts.workspaceId}/${opts.customFieldId}`,
+      resourceIdSegmentValues: {
+        entityType: opts.entityType,
+        workspaceId: opts.workspaceId,
+        customFieldId: opts.customFieldId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, mercuryCustomFieldAriStaticOpts);
+    return new _MercuryCustomFieldAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, mercuryCustomFieldAriStaticOpts);
+    return new _MercuryCustomFieldAri(opts);
+  }
+  getVariables() {
+    return {
+      siteId: this.siteId,
+      entityType: this.entityType,
+      workspaceId: this.workspaceId,
+      customFieldId: this.customFieldId
+    };
+  }
+};
+
+export {
+  MercuryCustomFieldAri
+};