@forge/util

2.0.12.0.1-experimental-7890858
packages/ari/chunk-INMPKYET.mjs
+packages/ari/chunk-INMPKYET.mjsNew file
+67
Index: package/packages/ari/chunk-INMPKYET.mjs
===================================================================
--- package/packages/ari/chunk-INMPKYET.mjs
+++ package/packages/ari/chunk-INMPKYET.mjs
@@ -0,0 +1,67 @@
+import {
+  IdentityAppGrantAriResourceOwner,
+  IdentityAppGrantAriResourceType
+} from "./chunk-CRQ7RP44.mjs";
+import {
+  RegisteredAri
+} from "./chunk-AB4PPISI.mjs";
+import {
+  AriParser
+} from "./chunk-S7RIZVFI.mjs";
+
+// src/identity/app-grant/manifest.ts
+var identityAppGrantAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^$"),
+  resourceOwner: IdentityAppGrantAriResourceOwner,
+  resourceType: IdentityAppGrantAriResourceType,
+  resourceIdSlug: "{userId}-{clientId}",
+  resourceIdSegmentFormats: {
+    userId: /[a-zA-Z0-9_\-\:]{1,128}/,
+    // eslint-disable-line no-useless-escape
+    clientId: /[0-9a-zA-Z-_]{5,50}/
+  }
+};
+
+// src/identity/app-grant/index.ts
+var IdentityAppGrantAri = class _IdentityAppGrantAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts), this._userId = opts.resourceIdSegmentValues.userId, this._clientId = opts.resourceIdSegmentValues.clientId;
+  }
+  get userId() {
+    return this._userId;
+  }
+  get clientId() {
+    return this._clientId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: identityAppGrantAriStaticOpts.qualifier,
+      platformQualifier: identityAppGrantAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: identityAppGrantAriStaticOpts.resourceOwner,
+      resourceType: identityAppGrantAriStaticOpts.resourceType,
+      resourceId: `${opts.userId}-${opts.clientId}`,
+      resourceIdSegmentValues: {
+        userId: opts.userId,
+        clientId: opts.clientId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, identityAppGrantAriStaticOpts);
+    return new _IdentityAppGrantAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, identityAppGrantAriStaticOpts);
+    return new _IdentityAppGrantAri(opts);
+  }
+  getVariables() {
+    return {
+      userId: this.userId,
+      clientId: this.clientId
+    };
+  }
+};
+
+export {
+  IdentityAppGrantAri
+};