npm package diff
Package: @forge/cli-shared
Versions: 5.5.0-next.12 - 5.3.1-next.0-experimental-204139e
File: package/out/ari/ari.js
Index: package/out/ari/ari.js
===================================================================
--- package/out/ari/ari.js
+++ package/out/ari/ari.js
@@ -1,22 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.parseInstallationContext = exports.UnknownBBWorkspaceWithoutResourceIdError = exports.UnknownWorkspaceWithoutCloudIdError = exports.UnknownSiteWithoutResourceIdError = exports.encodeContext = exports.buildExtensionAri = exports.buildContextAri = exports.appIdToAriString = exports.BITBUCKET_RESOURCE_OWNER = exports.TRELLO_RESOURCE_OWNER = exports.WORKSPACE_RESOURCE_TYPE = exports.SITE_RESOURCE_TYPE = void 0;
+exports.encodeContext = exports.buildExtensionAri = exports.buildContextAri = exports.appIdToAriString = void 0;
const ari_1 = require("@forge/util/packages/ari");
const shared_1 = require("../shared");
-const ui_1 = require("../ui");
-exports.SITE_RESOURCE_TYPE = 'site';
-exports.WORKSPACE_RESOURCE_TYPE = 'workspace';
-exports.TRELLO_RESOURCE_OWNER = 'trello';
-exports.BITBUCKET_RESOURCE_OWNER = 'bitbucket';
function appIdToAriString(appId) {
return `ari:cloud:ecosystem::app/${appId}`;
}
exports.appIdToAriString = appIdToAriString;
function buildContextAri(cloudId, product) {
return ari_1.AnyAri.create({
resourceOwner: (0, shared_1.ariResourceOwner)(product),
- resourceType: exports.SITE_RESOURCE_TYPE,
+ resourceType: 'site',
resourceId: cloudId
});
}
exports.buildContextAri = buildContextAri;
@@ -32,50 +27,4 @@
const serialised = JSON.stringify({ ctx: context.toString(), ext: extension.toString() });
return Buffer.from(serialised, 'utf-8').toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
}
exports.encodeContext = encodeContext;
-class UnknownSiteWithoutResourceIdError extends Error {
- constructor() {
- super(ui_1.Text.installList.noResourceId);
- }
-}
-exports.UnknownSiteWithoutResourceIdError = UnknownSiteWithoutResourceIdError;
-class UnknownWorkspaceWithoutCloudIdError extends Error {
- constructor() {
- super(ui_1.Text.installList.noCloudId);
- }
-}
-exports.UnknownWorkspaceWithoutCloudIdError = UnknownWorkspaceWithoutCloudIdError;
-class UnknownBBWorkspaceWithoutResourceIdError extends Error {
- constructor() {
- super(ui_1.Text.installList.bbNoResourceId);
- }
-}
-exports.UnknownBBWorkspaceWithoutResourceIdError = UnknownBBWorkspaceWithoutResourceIdError;
-function parseInstallationContext(installationContext) {
- const context = ari_1.AnyAri.parse(installationContext);
- switch (context.resourceType) {
- case exports.SITE_RESOURCE_TYPE:
- if (!context.resourceId) {
- throw new UnknownSiteWithoutResourceIdError();
- }
- context.derivedCloudId = context.resourceId;
- break;
- case exports.WORKSPACE_RESOURCE_TYPE:
- if (context.resourceOwner === exports.BITBUCKET_RESOURCE_OWNER) {
- if (!context.resourceId) {
- throw new UnknownBBWorkspaceWithoutResourceIdError();
- }
- context.derivedCloudId = context.resourceId;
- break;
- }
- else if (!context.cloudId) {
- throw new UnknownWorkspaceWithoutCloudIdError();
- }
- context.derivedCloudId = context.cloudId;
- break;
- default:
- throw new Error('Unknown resource type');
- }
- return context;
-}
-exports.parseInstallationContext = parseInstallationContext;