@forge/util

2.0.12.0.1-experimental-7890858
packages/ari/chunk-KSWQFO4B.mjs
+packages/ari/chunk-KSWQFO4B.mjsNew file
+71
Index: package/packages/ari/chunk-KSWQFO4B.mjs
===================================================================
--- package/packages/ari/chunk-KSWQFO4B.mjs
+++ package/packages/ari/chunk-KSWQFO4B.mjs
@@ -0,0 +1,71 @@
+import {
+  RadarWorkerAriResourceOwner,
+  RadarWorkerAriResourceType
+} from "./chunk-GH5TR45G.mjs";
+import {
+  RegisteredAri
+} from "./chunk-AB4PPISI.mjs";
+import {
+  AriParser
+} from "./chunk-S7RIZVFI.mjs";
+
+// src/radar/worker/manifest.ts
+var radarWorkerAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^[a-zA-Z0-9_\\-.]{1,255}$"),
+  resourceOwner: RadarWorkerAriResourceOwner,
+  resourceType: RadarWorkerAriResourceType,
+  resourceIdSlug: "{workspaceId}/{workerId}",
+  resourceIdSegmentFormats: {
+    workspaceId: /[a-zA-Z0-9\-]+/,
+    // eslint-disable-line no-useless-escape
+    workerId: /[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/
+  }
+};
+
+// src/radar/worker/index.ts
+var RadarWorkerAri = class _RadarWorkerAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts), this._siteId = opts.cloudId || "", this._workspaceId = opts.resourceIdSegmentValues.workspaceId, this._workerId = opts.resourceIdSegmentValues.workerId;
+  }
+  get siteId() {
+    return this._siteId;
+  }
+  get workspaceId() {
+    return this._workspaceId;
+  }
+  get workerId() {
+    return this._workerId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: radarWorkerAriStaticOpts.qualifier,
+      platformQualifier: radarWorkerAriStaticOpts.platformQualifier,
+      cloudId: opts.siteId,
+      resourceOwner: radarWorkerAriStaticOpts.resourceOwner,
+      resourceType: radarWorkerAriStaticOpts.resourceType,
+      resourceId: `${opts.workspaceId}/${opts.workerId}`,
+      resourceIdSegmentValues: {
+        workspaceId: opts.workspaceId,
+        workerId: opts.workerId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, radarWorkerAriStaticOpts);
+    return new _RadarWorkerAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, radarWorkerAriStaticOpts);
+    return new _RadarWorkerAri(opts);
+  }
+  getVariables() {
+    return {
+      siteId: this.siteId,
+      workspaceId: this.workspaceId,
+      workerId: this.workerId
+    };
+  }
+};
+
+export {
+  RadarWorkerAri
+};