npm package diff

Package: @forge/util

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

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

Index: package/packages/ari/microsoft/index.js
===================================================================
--- package/packages/ari/microsoft/index.js
+++ package/packages/ari/microsoft/index.js
@@ -16,9 +16,12 @@
 
 // src/microsoft/index.ts
 var microsoft_exports = {};
 __export(microsoft_exports, {
+  MicrosoftAccountAri: () => MicrosoftAccountAri,
+  MicrosoftCalendarEventAri: () => MicrosoftCalendarEventAri,
   MicrosoftChannelAri: () => MicrosoftChannelAri,
+  MicrosoftChatAri: () => MicrosoftChatAri,
   MicrosoftSharepointDocumentAri: () => MicrosoftSharepointDocumentAri
 });
 module.exports = __toCommonJS(microsoft_exports);
 
@@ -26,9 +29,9 @@
 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}.`);
 }
 
@@ -48,9 +51,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}.`);
 }
@@ -275,38 +278,145 @@
     return AnyAri.parse(this.toString());
   }
 };
 
+// src/microsoft/account/types.ts
+var MicrosoftAccountAriResourceOwner = "microsoft", MicrosoftAccountAriResourceType = "account";
+
+// src/microsoft/account/manifest.ts
+var microsoftAccountAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "third-party",
+  cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
+  resourceOwner: MicrosoftAccountAriResourceOwner,
+  resourceType: MicrosoftAccountAriResourceType,
+  resourceIdSlug: "{accountId}",
+  resourceIdSegmentFormats: {
+    accountId: /[a-zA-Z0-9\-_.~@;{}=]{0,255}/
+    // eslint-disable-line no-useless-escape
+  }
+};
+
+// src/microsoft/account/index.ts
+var MicrosoftAccountAri = class _MicrosoftAccountAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts);
+    this._accountId = opts.resourceIdSegmentValues.accountId;
+  }
+  get accountId() {
+    return this._accountId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: microsoftAccountAriStaticOpts.qualifier,
+      platformQualifier: microsoftAccountAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: microsoftAccountAriStaticOpts.resourceOwner,
+      resourceType: microsoftAccountAriStaticOpts.resourceType,
+      resourceId: `${opts.accountId}`,
+      resourceIdSegmentValues: {
+        accountId: opts.accountId || ""
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, microsoftAccountAriStaticOpts);
+    return new _MicrosoftAccountAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, microsoftAccountAriStaticOpts);
+    return new _MicrosoftAccountAri(opts);
+  }
+  getVariables() {
+    return {
+      accountId: this.accountId
+    };
+  }
+};
+
+// src/microsoft/calendar-event/types.ts
+var MicrosoftCalendarEventAriResourceOwner = "microsoft", MicrosoftCalendarEventAriResourceType = "calendar-event";
+
+// src/microsoft/calendar-event/manifest.ts
+var microsoftCalendarEventAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "third-party",
+  cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
+  resourceOwner: MicrosoftCalendarEventAriResourceOwner,
+  resourceType: MicrosoftCalendarEventAriResourceType,
+  resourceIdSlug: "outlook/userId/{userId}/calendarEventId/{calendarEventId}",
+  resourceIdSegmentFormats: {
+    userId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/,
+    // eslint-disable-line no-useless-escape
+    calendarEventId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
+    // eslint-disable-line no-useless-escape
+  }
+};
+
+// src/microsoft/calendar-event/index.ts
+var MicrosoftCalendarEventAri = class _MicrosoftCalendarEventAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts);
+    this._userId = opts.resourceIdSegmentValues.userId, this._calendarEventId = opts.resourceIdSegmentValues.calendarEventId;
+  }
+  get userId() {
+    return this._userId;
+  }
+  get calendarEventId() {
+    return this._calendarEventId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: microsoftCalendarEventAriStaticOpts.qualifier,
+      platformQualifier: microsoftCalendarEventAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: microsoftCalendarEventAriStaticOpts.resourceOwner,
+      resourceType: microsoftCalendarEventAriStaticOpts.resourceType,
+      resourceId: `outlook/userId/${opts.userId}/calendarEventId/${opts.calendarEventId}`,
+      resourceIdSegmentValues: {
+        userId: opts.userId,
+        calendarEventId: opts.calendarEventId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, microsoftCalendarEventAriStaticOpts);
+    return new _MicrosoftCalendarEventAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, microsoftCalendarEventAriStaticOpts);
+    return new _MicrosoftCalendarEventAri(opts);
+  }
+  getVariables() {
+    return {
+      userId: this.userId,
+      calendarEventId: this.calendarEventId
+    };
+  }
+};
+
 // src/microsoft/channel/types.ts
 var MicrosoftChannelAriResourceOwner = "microsoft", MicrosoftChannelAriResourceType = "channel";
 
 // src/microsoft/channel/manifest.ts
 var microsoftChannelAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "third-party",
   cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
   resourceOwner: MicrosoftChannelAriResourceOwner,
   resourceType: MicrosoftChannelAriResourceType,
-  resourceIdSlug: "tenantId/{tenantId}/teamId/{teamId}/channelId/{channelId}",
+  resourceIdSlug: "teamId/{teamId}/channelId/{channelId}",
   resourceIdSegmentFormats: {
-    tenantId: /[!a-zA-Z0-9\-_.~@:{}=]+(\/[!a-zA-Z0-9\-_.~@:{}=]+)*/,
+    teamId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/,
     // eslint-disable-line no-useless-escape
-    teamId: /[!a-zA-Z0-9\-_.~@:{}=]+(\/[!a-zA-Z0-9\-_.~@:{}=]+)*/,
+    channelId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
     // eslint-disable-line no-useless-escape
-    channelId: /[!a-zA-Z0-9\-_.~@:{}=]+(\/[!a-zA-Z0-9\-_.~@:{}=]+)*/
-    // eslint-disable-line no-useless-escape
   }
 };
 
 // src/microsoft/channel/index.ts
 var MicrosoftChannelAri = class _MicrosoftChannelAri extends RegisteredAri {
   constructor(opts) {
     super(opts);
-    this._tenantId = opts.resourceIdSegmentValues.tenantId, this._teamId = opts.resourceIdSegmentValues.teamId, this._channelId = opts.resourceIdSegmentValues.channelId;
+    this._teamId = opts.resourceIdSegmentValues.teamId, this._channelId = opts.resourceIdSegmentValues.channelId;
   }
-  get tenantId() {
-    return this._tenantId;
-  }
   get teamId() {
     return this._teamId;
   }
   get channelId() {
@@ -318,11 +428,10 @@
       platformQualifier: microsoftChannelAriStaticOpts.platformQualifier,
       cloudId: void 0,
       resourceOwner: microsoftChannelAriStaticOpts.resourceOwner,
       resourceType: microsoftChannelAriStaticOpts.resourceType,
-      resourceId: `tenantId/${opts.tenantId}/teamId/${opts.teamId}/channelId/${opts.channelId}`,
+      resourceId: `teamId/${opts.teamId}/channelId/${opts.channelId}`,
       resourceIdSegmentValues: {
-        tenantId: opts.tenantId,
         teamId: opts.teamId,
         channelId: opts.channelId
       }
     }, ariOpts = AriParser.fromOpts(derivedOpts, microsoftChannelAriStaticOpts);
@@ -333,30 +442,89 @@
     return new _MicrosoftChannelAri(opts);
   }
   getVariables() {
     return {
-      tenantId: this.tenantId,
       teamId: this.teamId,
       channelId: this.channelId
     };
   }
 };
 
+// src/microsoft/chat/types.ts
+var MicrosoftChatAriResourceOwner = "microsoft", MicrosoftChatAriResourceType = "chat";
+
+// src/microsoft/chat/manifest.ts
+var microsoftChatAriStaticOpts = {
+  qualifier: "ari",
+  platformQualifier: "third-party",
+  cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
+  resourceOwner: MicrosoftChatAriResourceOwner,
+  resourceType: MicrosoftChatAriResourceType,
+  resourceIdSlug: "chatId/{chatId}/messageId/{messageId}",
+  resourceIdSegmentFormats: {
+    chatId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/,
+    // eslint-disable-line no-useless-escape
+    messageId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
+    // eslint-disable-line no-useless-escape
+  }
+};
+
+// src/microsoft/chat/index.ts
+var MicrosoftChatAri = class _MicrosoftChatAri extends RegisteredAri {
+  constructor(opts) {
+    super(opts);
+    this._chatId = opts.resourceIdSegmentValues.chatId, this._messageId = opts.resourceIdSegmentValues.messageId;
+  }
+  get chatId() {
+    return this._chatId;
+  }
+  get messageId() {
+    return this._messageId;
+  }
+  static create(opts) {
+    let derivedOpts = {
+      qualifier: microsoftChatAriStaticOpts.qualifier,
+      platformQualifier: microsoftChatAriStaticOpts.platformQualifier,
+      cloudId: void 0,
+      resourceOwner: microsoftChatAriStaticOpts.resourceOwner,
+      resourceType: microsoftChatAriStaticOpts.resourceType,
+      resourceId: `chatId/${opts.chatId}/messageId/${opts.messageId}`,
+      resourceIdSegmentValues: {
+        chatId: opts.chatId,
+        messageId: opts.messageId
+      }
+    }, ariOpts = AriParser.fromOpts(derivedOpts, microsoftChatAriStaticOpts);
+    return new _MicrosoftChatAri(ariOpts);
+  }
+  static parse(maybeAri) {
+    let opts = AriParser.fromString(maybeAri, microsoftChatAriStaticOpts);
+    return new _MicrosoftChatAri(opts);
+  }
+  getVariables() {
+    return {
+      chatId: this.chatId,
+      messageId: this.messageId
+    };
+  }
+};
+
 // src/microsoft/sharepoint-document/types.ts
 var MicrosoftSharepointDocumentAriResourceOwner = "microsoft", MicrosoftSharepointDocumentAriResourceType = "sharepoint-document";
 
 // src/microsoft/sharepoint-document/manifest.ts
 var microsoftSharepointDocumentAriStaticOpts = {
   qualifier: "ari",
   platformQualifier: "third-party",
   cloudId: new RegExp("^$"),
+  // eslint-disable-line no-useless-escape
   resourceOwner: MicrosoftSharepointDocumentAriResourceOwner,
   resourceType: MicrosoftSharepointDocumentAriResourceType,
   resourceIdSlug: "driveId/{driveId}/fileId/{fileId}",
   resourceIdSegmentFormats: {
-    driveId: /[!a-zA-Z0-9\-_.~@:{}=]+(\/[!a-zA-Z0-9\-_.~@:{}=]+)*/,
+    driveId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/,
     // eslint-disable-line no-useless-escape
-    fileId: /[!a-zA-Z0-9\-_.~@:{}=]+(\/[!a-zA-Z0-9\-_.~@:{}=]+)*/
+    fileId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
     // eslint-disable-line no-useless-escape
   }
 };
 
@@ -399,7 +567,10 @@
   }
 };
 // Annotate the CommonJS export names for ESM import in node:
 0 && (module.exports = {
+  MicrosoftAccountAri,
+  MicrosoftCalendarEventAri,
   MicrosoftChannelAri,
+  MicrosoftChatAri,
   MicrosoftSharepointDocumentAri
 });