npm package diff

Package: @forge/util

Versions: 1.4.10-next.0 - 1.4.10-next.0-experimental-effab31

File: package/packages/ari/support/index.js

Index: package/packages/ari/support/index.js
===================================================================
--- package/packages/ari/support/index.js
+++ package/packages/ari/support/index.js
@@ -16,18 +16,19 @@
 
 // src/support/index.ts
 var support_exports = {};
 __export(support_exports, {
-  SupportCustomerAri: () => SupportCustomerAri
+  SupportCustomerAri: () => SupportCustomerAri,
+  SupportCustomerSupportAri: () => SupportCustomerSupportAri
 });
 module.exports = __toCommonJS(support_exports);
 
 // src/errors.ts
 var ValidationError = class extends Error {
 };
 
 // src/core/rules/cloud-id.ts
-function validateCloudId(cloudId, format = new RegExp("^[a-zA-Z0-9\\-]*$")) {
+function validateCloudId(cloudId, format = new RegExp("^[a-zA-Z0-9_\\-.]{0,255}$")) {
   if (!cloudId.match(format))
     throw new ValidationError(`Invalid cloud ID, expected ID of format ${format}.`);
 }
 
@@ -47,9 +48,9 @@
     throw new ValidationError(`ARI must have a qualifier of 'ari'. Received: ${qualifier}`);
 }
 
 // src/core/rules/resource-id.ts
-function validateResourceId(id, format = new RegExp("[!a-zA-Z0-9\\-_.~@:{}=]+(/[!a-zA-Z0-9\\-_.~@:{}=]+)*" /* ANY_RESOURCE_ID */), key = "resourceId") {
+function validateResourceId(id, format = new RegExp("[!a-zA-Z0-9\\-_.~@:;{}=]+(/[!a-zA-Z0-9\\-_.~@:;{}=]+)*" /* ANY_RESOURCE_ID */), key = "resourceId") {
   let formatWithCarets = new RegExp(`^${format.source}$`);
   if (!id.match(formatWithCarets))
     throw new ValidationError(`Invalid ${key} - ${id}, expected ID of format ${formatWithCarets}.`);
 }
@@ -282,8 +283,9 @@
 var supportCustomerAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "cloud",
   cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
   resourceOwner: SupportCustomerAriResourceOwner,
   resourceType: SupportCustomerAriResourceType,
   resourceIdSlug: "{resourceName}",
   resourceIdSegmentFormats: {
@@ -324,8 +326,61 @@
       resourceName: this.resourceName
     };
   }
 };
+
+// src/support/customer-support/types.ts
+var SupportCustomerSupportAriResourceOwner = "support", SupportCustomerSupportAriResourceType = "customer-support";
+
+// src/support/customer-support/manifest.ts
+var supportCustomerSupportAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "cloud",
+  cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
+  resourceOwner: SupportCustomerSupportAriResourceOwner,
+  resourceType: SupportCustomerSupportAriResourceType,
+  resourceIdSlug: "{resourceName}",
+  resourceIdSegmentFormats: {
+    resourceName: /[a-zA-Z0-9\-_.]*/
+    // eslint-disable-line no-useless-escape
+  }
+};
+
+// src/support/customer-support/index.ts
+var SupportCustomerSupportAri = class _SupportCustomerSupportAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts);
+    this._resourceName = opts.resourceIdSegmentValues.resourceName;
+  }
+  get resourceName() {
+    return this._resourceName;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: supportCustomerSupportAriStaticOpts.qualifier,
+      platformQualifier: supportCustomerSupportAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: supportCustomerSupportAriStaticOpts.resourceOwner,
+      resourceType: supportCustomerSupportAriStaticOpts.resourceType,
+      resourceId: `${opts.resourceName}`,
+      resourceIdSegmentValues: {
+        resourceName: opts.resourceName || ""
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, supportCustomerSupportAriStaticOpts);
+    return new _SupportCustomerSupportAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, supportCustomerSupportAriStaticOpts);
+    return new _SupportCustomerSupportAri(opts);
+  }
+  getVariables() {
+    return {
+      resourceName: this.resourceName
+    };
+  }
+};
 // Annotate the CommonJS export names for ESM import in node:
 0 && (module.exports = {
-  SupportCustomerAri
+  SupportCustomerAri,
+  SupportCustomerSupportAri
 });