@forge/util

2.0.12.0.1-experimental-7890858
packages/ari/chunk-7YTG3YLE.mjs
+packages/ari/chunk-7YTG3YLE.mjsNew file
+76
Index: package/packages/ari/chunk-7YTG3YLE.mjs
===================================================================
--- package/packages/ari/chunk-7YTG3YLE.mjs
+++ package/packages/ari/chunk-7YTG3YLE.mjs
@@ -0,0 +1,76 @@
+import {
+  BlocksSyncedBlockAriResourceOwner,
+  BlocksSyncedBlockAriResourceType
+} from "./chunk-NXGYGBE2.mjs";
+import {
+  RegisteredAri
+} from "./chunk-AB4PPISI.mjs";
+import {
+  AriParser
+} from "./chunk-S7RIZVFI.mjs";
+
+// src/blocks/synced-block/manifest.ts
+var blocksSyncedBlockAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^[a-zA-Z0-9_\\-.]{1,255}$"),
+  resourceOwner: BlocksSyncedBlockAriResourceOwner,
+  resourceType: BlocksSyncedBlockAriResourceType,
+  resourceIdSlug: "{product}/{sourceId}/{resourceIdParam}",
+  resourceIdSegmentFormats: {
+    product: /(confluence-page|jira-work-item)/,
+    sourceId: /[a-zA-Z0-9-]+/,
+    resourceIdParam: /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/
+  }
+};
+
+// src/blocks/synced-block/index.ts
+var BlocksSyncedBlockAri = class _BlocksSyncedBlockAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts), this._siteId = opts.cloudId || "", this._product = opts.resourceIdSegmentValues.product, this._sourceId = opts.resourceIdSegmentValues.sourceId, this._resourceIdParam = opts.resourceIdSegmentValues.resourceIdParam;
+  }
+  get siteId() {
+    return this._siteId;
+  }
+  get product() {
+    return this._product;
+  }
+  get sourceId() {
+    return this._sourceId;
+  }
+  get resourceIdParam() {
+    return this._resourceIdParam;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: blocksSyncedBlockAriStaticOpts.qualifier,
+      platformQualifier: blocksSyncedBlockAriStaticOpts.platformQualifier,
+      cloudId: opts.siteId,
+      resourceOwner: blocksSyncedBlockAriStaticOpts.resourceOwner,
+      resourceType: blocksSyncedBlockAriStaticOpts.resourceType,
+      resourceId: `${opts.product}/${opts.sourceId}/${opts.resourceIdParam}`,
+      resourceIdSegmentValues: {
+        product: opts.product,
+        sourceId: opts.sourceId,
+        resourceIdParam: opts.resourceIdParam
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, blocksSyncedBlockAriStaticOpts);
+    return new _BlocksSyncedBlockAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, blocksSyncedBlockAriStaticOpts);
+    return new _BlocksSyncedBlockAri(opts);
+  }
+  getVariables() {
+    return {
+      siteId: this.siteId,
+      product: this.product,
+      sourceId: this.sourceId,
+      resourceIdParam: this.resourceIdParam
+    };
+  }
+};
+
+export {
+  BlocksSyncedBlockAri
+};