@forge/cli-shared 5.4.0-next.2 → 5.4.0-next.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/out/ari/ari.d.ts +18 -1
- package/out/ari/ari.d.ts.map +1 -1
- package/out/ari/ari.js +53 -2
- package/out/graphql/graphql-types.d.ts +308 -42
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +30 -4
- package/out/ui/text.d.ts +2 -0
- package/out/ui/text.d.ts.map +1 -1
- package/out/ui/text.js +2 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/out/ari/ari.d.ts
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
|
-
import { Ari } from '@forge/util/packages/ari';
|
|
1
|
+
import { Ari, AnyAri } from '@forge/util/packages/ari';
|
|
2
|
+
export declare const SITE_RESOURCE_TYPE = "site";
|
|
3
|
+
export declare const WORKSPACE_RESOURCE_TYPE = "workspace";
|
|
4
|
+
export declare const TRELLO_RESOURCE_OWNER = "trello";
|
|
5
|
+
export declare const BITBUCKET_RESOURCE_OWNER = "bitbucket";
|
|
2
6
|
export declare function appIdToAriString(appId: string): string;
|
|
3
7
|
export declare function buildContextAri(cloudId: string, product: string): Ari;
|
|
4
8
|
export declare function buildExtensionAri(appId: string, environmentId: string, functionKey: string): Ari;
|
|
5
9
|
export declare function encodeContext(context: Ari, extension: Ari): string;
|
|
10
|
+
export declare class UnknownSiteWithoutResourceIdError extends Error {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
export declare class UnknownWorkspaceWithoutCloudIdError extends Error {
|
|
14
|
+
constructor();
|
|
15
|
+
}
|
|
16
|
+
export declare class UnknownBBWorkspaceWithoutResourceIdError extends Error {
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
19
|
+
export interface EnrichedAri extends AnyAri {
|
|
20
|
+
derivedCloudId: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseInstallationContext(installationContext: string): EnrichedAri;
|
|
6
23
|
//# sourceMappingURL=ari.d.ts.map
|
package/out/ari/ari.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ari.d.ts","sourceRoot":"","sources":["../../src/ari/ari.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,
|
|
1
|
+
{"version":3,"file":"ari.d.ts","sourceRoot":"","sources":["../../src/ari/ari.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIvD,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,uBAAuB,cAAc,CAAC;AACnD,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,wBAAwB,cAAc,CAAC;AAEpD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAID,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,CAMrE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,CAMhG;AAGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,MAAM,CAKlE;AACD,qBAAa,iCAAkC,SAAQ,KAAK;;CAI3D;AACD,qBAAa,mCAAoC,SAAQ,KAAK;;CAI7D;AAED,qBAAa,wCAAyC,SAAQ,KAAK;;CAIlE;AASD,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC,cAAc,EAAE,MAAM,CAAC;CACxB;AACD,wBAAgB,wBAAwB,CAAC,mBAAmB,EAAE,MAAM,GAAG,WAAW,CAyBjF"}
|
package/out/ari/ari.js
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeContext = exports.buildExtensionAri = exports.buildContextAri = exports.appIdToAriString = void 0;
|
|
3
|
+
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;
|
|
4
4
|
const ari_1 = require("@forge/util/packages/ari");
|
|
5
5
|
const shared_1 = require("../shared");
|
|
6
|
+
const ui_1 = require("../ui");
|
|
7
|
+
exports.SITE_RESOURCE_TYPE = 'site';
|
|
8
|
+
exports.WORKSPACE_RESOURCE_TYPE = 'workspace';
|
|
9
|
+
exports.TRELLO_RESOURCE_OWNER = 'trello';
|
|
10
|
+
exports.BITBUCKET_RESOURCE_OWNER = 'bitbucket';
|
|
6
11
|
function appIdToAriString(appId) {
|
|
7
12
|
return `ari:cloud:ecosystem::app/${appId}`;
|
|
8
13
|
}
|
|
@@ -10,7 +15,7 @@ exports.appIdToAriString = appIdToAriString;
|
|
|
10
15
|
function buildContextAri(cloudId, product) {
|
|
11
16
|
return ari_1.AnyAri.create({
|
|
12
17
|
resourceOwner: (0, shared_1.ariResourceOwner)(product),
|
|
13
|
-
resourceType:
|
|
18
|
+
resourceType: exports.SITE_RESOURCE_TYPE,
|
|
14
19
|
resourceId: cloudId
|
|
15
20
|
});
|
|
16
21
|
}
|
|
@@ -28,3 +33,49 @@ function encodeContext(context, extension) {
|
|
|
28
33
|
return Buffer.from(serialised, 'utf-8').toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_');
|
|
29
34
|
}
|
|
30
35
|
exports.encodeContext = encodeContext;
|
|
36
|
+
class UnknownSiteWithoutResourceIdError extends Error {
|
|
37
|
+
constructor() {
|
|
38
|
+
super(ui_1.Text.installList.noResourceId);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.UnknownSiteWithoutResourceIdError = UnknownSiteWithoutResourceIdError;
|
|
42
|
+
class UnknownWorkspaceWithoutCloudIdError extends Error {
|
|
43
|
+
constructor() {
|
|
44
|
+
super(ui_1.Text.installList.noCloudId);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.UnknownWorkspaceWithoutCloudIdError = UnknownWorkspaceWithoutCloudIdError;
|
|
48
|
+
class UnknownBBWorkspaceWithoutResourceIdError extends Error {
|
|
49
|
+
constructor() {
|
|
50
|
+
super(ui_1.Text.installList.bbNoResourceId);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.UnknownBBWorkspaceWithoutResourceIdError = UnknownBBWorkspaceWithoutResourceIdError;
|
|
54
|
+
function parseInstallationContext(installationContext) {
|
|
55
|
+
const context = ari_1.AnyAri.parse(installationContext);
|
|
56
|
+
switch (context.resourceType) {
|
|
57
|
+
case exports.SITE_RESOURCE_TYPE:
|
|
58
|
+
if (!context.resourceId) {
|
|
59
|
+
throw new UnknownSiteWithoutResourceIdError();
|
|
60
|
+
}
|
|
61
|
+
context.derivedCloudId = context.resourceId;
|
|
62
|
+
break;
|
|
63
|
+
case exports.WORKSPACE_RESOURCE_TYPE:
|
|
64
|
+
if (context.resourceOwner === exports.BITBUCKET_RESOURCE_OWNER) {
|
|
65
|
+
if (!context.resourceId) {
|
|
66
|
+
throw new UnknownBBWorkspaceWithoutResourceIdError();
|
|
67
|
+
}
|
|
68
|
+
context.derivedCloudId = context.resourceId;
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
else if (!context.cloudId) {
|
|
72
|
+
throw new UnknownWorkspaceWithoutCloudIdError();
|
|
73
|
+
}
|
|
74
|
+
context.derivedCloudId = context.cloudId;
|
|
75
|
+
break;
|
|
76
|
+
default:
|
|
77
|
+
throw new Error('Unknown resource type');
|
|
78
|
+
}
|
|
79
|
+
return context;
|
|
80
|
+
}
|
|
81
|
+
exports.parseInstallationContext = parseInstallationContext;
|