npm package diff
Package: @forge/util
Versions: 1.4.10-next.0 - 1.4.10-next.0-experimental-effab31
File: package/packages/ari/google/index.js
Index: package/packages/ari/google/index.js
===================================================================
--- package/packages/ari/google/index.js
+++ package/packages/ari/google/index.js
@@ -16,8 +16,10 @@
// src/google/index.ts
var google_exports = {};
__export(google_exports, {
+ GoogleAccountAri: () => GoogleAccountAri,
+ GoogleCalendarEventAri: () => GoogleCalendarEventAri,
GoogleDocumentAri: () => GoogleDocumentAri,
GoogleFormAri: () => GoogleFormAri,
GooglePresentationAri: () => GooglePresentationAri,
GoogleSpreadsheetAri: () => GoogleSpreadsheetAri
@@ -28,9 +30,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}.`);
}
@@ -50,9 +52,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}.`);
}
@@ -277,16 +279,128 @@
return AnyAri.parse(this.toString());
}
};
+// src/google/account/types.ts
+var GoogleAccountAriResourceOwner = "google", GoogleAccountAriResourceType = "account";
+
+// src/google/account/manifest.ts
+var googleAccountAriStaticOpts = {
+ qualifier: "ari",
+ platformQualifier: "third-party",
+ cloudId: new RegExp("^$"),
+ // eslint-disable-line no-useless-escape
+ resourceOwner: GoogleAccountAriResourceOwner,
+ resourceType: GoogleAccountAriResourceType,
+ resourceIdSlug: "{accountId}",
+ resourceIdSegmentFormats: {
+ accountId: /[a-zA-Z0-9\-_.~@;{}=]{0,255}/
+ // eslint-disable-line no-useless-escape
+ }
+};
+
+// src/google/account/index.ts
+var GoogleAccountAri = class _GoogleAccountAri extends RegisteredAri {
+ constructor(opts) {
+ super(opts);
+ this._accountId = opts.resourceIdSegmentValues.accountId;
+ }
+ get accountId() {
+ return this._accountId;
+ }
+ static create(opts) {
+ let derivedOpts = {
+ qualifier: googleAccountAriStaticOpts.qualifier,
+ platformQualifier: googleAccountAriStaticOpts.platformQualifier,
+ cloudId: void 0,
+ resourceOwner: googleAccountAriStaticOpts.resourceOwner,
+ resourceType: googleAccountAriStaticOpts.resourceType,
+ resourceId: `${opts.accountId}`,
+ resourceIdSegmentValues: {
+ accountId: opts.accountId || ""
+ }
+ }, ariOpts = AriParser.fromOpts(derivedOpts, googleAccountAriStaticOpts);
+ return new _GoogleAccountAri(ariOpts);
+ }
+ static parse(maybeAri) {
+ let opts = AriParser.fromString(maybeAri, googleAccountAriStaticOpts);
+ return new _GoogleAccountAri(opts);
+ }
+ getVariables() {
+ return {
+ accountId: this.accountId
+ };
+ }
+};
+
+// src/google/calendar-event/types.ts
+var GoogleCalendarEventAriResourceOwner = "google", GoogleCalendarEventAriResourceType = "calendar-event";
+
+// src/google/calendar-event/manifest.ts
+var googleCalendarEventAriStaticOpts = {
+ qualifier: "ari",
+ platformQualifier: "third-party",
+ cloudId: new RegExp("^$"),
+ // eslint-disable-line no-useless-escape
+ resourceOwner: GoogleCalendarEventAriResourceOwner,
+ resourceType: GoogleCalendarEventAriResourceType,
+ resourceIdSlug: "calendarId/{calendarId}/eventId/{eventId}",
+ resourceIdSegmentFormats: {
+ calendarId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/,
+ // eslint-disable-line no-useless-escape
+ eventId: /[!a-zA-Z0-9\-_.~@:;{}=]+(\/[!a-zA-Z0-9\-_.~@:;{}=]+)*/
+ // eslint-disable-line no-useless-escape
+ }
+};
+
+// src/google/calendar-event/index.ts
+var GoogleCalendarEventAri = class _GoogleCalendarEventAri extends RegisteredAri {
+ constructor(opts) {
+ super(opts);
+ this._calendarId = opts.resourceIdSegmentValues.calendarId, this._eventId = opts.resourceIdSegmentValues.eventId;
+ }
+ get calendarId() {
+ return this._calendarId;
+ }
+ get eventId() {
+ return this._eventId;
+ }
+ static create(opts) {
+ let derivedOpts = {
+ qualifier: googleCalendarEventAriStaticOpts.qualifier,
+ platformQualifier: googleCalendarEventAriStaticOpts.platformQualifier,
+ cloudId: void 0,
+ resourceOwner: googleCalendarEventAriStaticOpts.resourceOwner,
+ resourceType: googleCalendarEventAriStaticOpts.resourceType,
+ resourceId: `calendarId/${opts.calendarId}/eventId/${opts.eventId}`,
+ resourceIdSegmentValues: {
+ calendarId: opts.calendarId,
+ eventId: opts.eventId
+ }
+ }, ariOpts = AriParser.fromOpts(derivedOpts, googleCalendarEventAriStaticOpts);
+ return new _GoogleCalendarEventAri(ariOpts);
+ }
+ static parse(maybeAri) {
+ let opts = AriParser.fromString(maybeAri, googleCalendarEventAriStaticOpts);
+ return new _GoogleCalendarEventAri(opts);
+ }
+ getVariables() {
+ return {
+ calendarId: this.calendarId,
+ eventId: this.eventId
+ };
+ }
+};
+
// src/google/document/types.ts
var GoogleDocumentAriResourceOwner = "google", GoogleDocumentAriResourceType = "document";
// src/google/document/manifest.ts
var googleDocumentAriStaticOpts = {
qualifier: "ari",
platformQualifier: "third-party",
cloudId: new RegExp("^$"),
+ // eslint-disable-line no-useless-escape
resourceOwner: GoogleDocumentAriResourceOwner,
resourceType: GoogleDocumentAriResourceType,
resourceIdSlug: "{docId}",
resourceIdSegmentFormats: {
@@ -336,8 +450,9 @@
var googleFormAriStaticOpts = {
qualifier: "ari",
platformQualifier: "third-party",
cloudId: new RegExp("^$"),
+ // eslint-disable-line no-useless-escape
resourceOwner: GoogleFormAriResourceOwner,
resourceType: GoogleFormAriResourceType,
resourceIdSlug: "{docId}",
resourceIdSegmentFormats: {
@@ -387,8 +502,9 @@
var googlePresentationAriStaticOpts = {
qualifier: "ari",
platformQualifier: "third-party",
cloudId: new RegExp("^$"),
+ // eslint-disable-line no-useless-escape
resourceOwner: GooglePresentationAriResourceOwner,
resourceType: GooglePresentationAriResourceType,
resourceIdSlug: "{docId}",
resourceIdSegmentFormats: {
@@ -438,8 +554,9 @@
var googleSpreadsheetAriStaticOpts = {
qualifier: "ari",
platformQualifier: "third-party",
cloudId: new RegExp("^$"),
+ // eslint-disable-line no-useless-escape
resourceOwner: GoogleSpreadsheetAriResourceOwner,
resourceType: GoogleSpreadsheetAriResourceType,
resourceIdSlug: "{docId}",
resourceIdSegmentFormats: {
@@ -482,8 +599,10 @@
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
+ GoogleAccountAri,
+ GoogleCalendarEventAri,
GoogleDocumentAri,
GoogleFormAri,
GooglePresentationAri,
GoogleSpreadsheetAri