@forge/cli-shared 10.1.0-next.5 → 10.1.0-next.7
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 +14 -0
- package/out/apps/get-app-owner.d.ts.map +1 -1
- package/out/graphql/gql/graphql.d.ts +1 -1
- package/out/graphql/gql/graphql.d.ts.map +1 -1
- package/out/service/bridge-script-service.d.ts +1 -1
- package/out/service/bridge-script-service.d.ts.map +1 -1
- package/out/service/bridge-script-service.js +3 -3
- package/out/service/iframe-resizer-script-service.d.ts +1 -1
- package/out/service/iframe-resizer-script-service.d.ts.map +1 -1
- package/out/service/iframe-resizer-script-service.js +3 -3
- package/out/shared/forge-cli-attribution.d.ts +4 -0
- package/out/shared/forge-cli-attribution.d.ts.map +1 -1
- package/out/shared/forge-cli-attribution.js +15 -1
- package/out/shared/load-html.d.ts +3 -0
- package/out/shared/load-html.d.ts.map +1 -0
- package/out/shared/load-html.js +4 -0
- package/package.json +2 -2
|
@@ -2,6 +2,6 @@ export declare class BridgeScriptService {
|
|
|
2
2
|
private readonly env;
|
|
3
3
|
constructor(env?: string);
|
|
4
4
|
private createBridgeCoreScriptTag;
|
|
5
|
-
injectBridgeCore(content: Buffer, onError: () => void): Buffer
|
|
5
|
+
injectBridgeCore(content: Buffer, onError: () => void): Promise<Buffer>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=bridge-script-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-script-service.d.ts","sourceRoot":"","sources":["../../src/service/bridge-script-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge-script-service.d.ts","sourceRoot":"","sources":["../../src/service/bridge-script-service.ts"],"names":[],"mappings":"AAKA,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,SAAwC;IAExE,OAAO,CAAC,yBAAyB;IAIpB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;CAarF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { load } from 'cheerio';
|
|
2
1
|
import { CDNEnvironments, getEnvironmentConfig } from '../graphql/gateway.js';
|
|
2
|
+
import { loadHtml } from '../shared/load-html.js';
|
|
3
3
|
const BRIDGE_CORE_CDN_PATH = 'global-bridge.js';
|
|
4
4
|
const GLOBAL_FORGE_INSTALL_ID = 'forge';
|
|
5
5
|
export class BridgeScriptService {
|
|
@@ -10,8 +10,8 @@ export class BridgeScriptService {
|
|
|
10
10
|
createBridgeCoreScriptTag() {
|
|
11
11
|
return `<script src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${this.env}.atlassian-dev.net/${BRIDGE_CORE_CDN_PATH}"></script>`;
|
|
12
12
|
}
|
|
13
|
-
injectBridgeCore(content, onError) {
|
|
14
|
-
const $ =
|
|
13
|
+
async injectBridgeCore(content, onError) {
|
|
14
|
+
const $ = await loadHtml(content);
|
|
15
15
|
if ($('html').length === 0)
|
|
16
16
|
onError();
|
|
17
17
|
let head = $('head');
|
|
@@ -2,6 +2,6 @@ export declare class IframeResizerScriptService {
|
|
|
2
2
|
private readonly env;
|
|
3
3
|
constructor(env?: string);
|
|
4
4
|
private createIframeResizerScriptTag;
|
|
5
|
-
injectIframeResizer(content: Buffer, onError: () => void): Buffer
|
|
5
|
+
injectIframeResizer(content: Buffer, onError: () => void): Promise<Buffer>;
|
|
6
6
|
}
|
|
7
7
|
//# sourceMappingURL=iframe-resizer-script-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iframe-resizer-script-service.d.ts","sourceRoot":"","sources":["../../src/service/iframe-resizer-script-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"iframe-resizer-script-service.d.ts","sourceRoot":"","sources":["../../src/service/iframe-resizer-script-service.ts"],"names":[],"mappings":"AAKA,qBAAa,0BAA0B;IACzB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBAAH,GAAG,SAAwC;IAExE,OAAO,CAAC,4BAA4B;IAIvB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC;CAaxF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { load } from 'cheerio';
|
|
2
1
|
import { CDNEnvironments, getEnvironmentConfig } from '../graphql/gateway.js';
|
|
2
|
+
import { loadHtml } from '../shared/load-html.js';
|
|
3
3
|
const IFRAME_RESIZER_CDN_PATH = 'iframeResizer.contentWindow.min.js';
|
|
4
4
|
const GLOBAL_FORGE_INSTALL_ID = 'forge';
|
|
5
5
|
export class IframeResizerScriptService {
|
|
@@ -10,8 +10,8 @@ export class IframeResizerScriptService {
|
|
|
10
10
|
createIframeResizerScriptTag() {
|
|
11
11
|
return `<script async src="https://${GLOBAL_FORGE_INSTALL_ID}.cdn.${this.env}.atlassian-dev.net/${IFRAME_RESIZER_CDN_PATH}"></script>`;
|
|
12
12
|
}
|
|
13
|
-
injectIframeResizer(content, onError) {
|
|
14
|
-
const $ =
|
|
13
|
+
async injectIframeResizer(content, onError) {
|
|
14
|
+
const $ = await loadHtml(content);
|
|
15
15
|
if ($('html').length === 0)
|
|
16
16
|
onError();
|
|
17
17
|
let head = $('head');
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
export type SessionAttributionResolver = (attribution: Record<string, unknown>) => Record<string, string>;
|
|
1
2
|
export declare class ForgeCliAttribution {
|
|
3
|
+
private static sessionResolver;
|
|
4
|
+
static setSessionResolver(resolver: SessionAttributionResolver | undefined): void;
|
|
2
5
|
static isAgent(): boolean;
|
|
3
6
|
static isCI(): boolean;
|
|
4
7
|
static isAgentV2(): Promise<boolean>;
|
|
@@ -8,6 +11,7 @@ export declare class ForgeCliAttribution {
|
|
|
8
11
|
static agentHint(): Promise<string>;
|
|
9
12
|
static isStudio(): boolean;
|
|
10
13
|
static build(): Promise<Record<string, unknown>>;
|
|
14
|
+
private static resolveSession;
|
|
11
15
|
private static getWildcardAttribution;
|
|
12
16
|
private static getValidAttributionEnvValue;
|
|
13
17
|
private static isValidAttributionValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forge-cli-attribution.d.ts","sourceRoot":"","sources":["../../src/shared/forge-cli-attribution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forge-cli-attribution.d.ts","sourceRoot":"","sources":["../../src/shared/forge-cli-attribution.ts"],"names":[],"mappings":"AA4DA,MAAM,MAAM,0BAA0B,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1G,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,MAAM,CAAC,eAAe,CAAyC;WAMzD,kBAAkB,CAAC,QAAQ,EAAE,0BAA0B,GAAG,SAAS,GAAG,IAAI;WAY1E,OAAO,IAAI,OAAO;WASlB,IAAI,IAAI,OAAO;WAST,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;WAKnC,MAAM,IAAI,OAAO;WASjB,MAAM,IAAI,MAAM;WAIhB,SAAS,IAAI,MAAM;WASb,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;WAwBlC,QAAQ,IAAI,OAAO;WAWb,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA8B7D,OAAO,CAAC,MAAM,CAAC,cAAc;IAQ7B,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAgDrC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAK1C,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAStC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAIjC,OAAO,CAAC,MAAM,CAAC,YAAY;IAK3B,OAAO,CAAC,MAAM,CAAC,eAAe;IAS9B,OAAO,CAAC,MAAM,CAAC,UAAU;CAG1B"}
|
|
@@ -19,11 +19,16 @@ const RESERVED_ATTRIBUTION_FIELDS = new Set([
|
|
|
19
19
|
'isStudio',
|
|
20
20
|
'service',
|
|
21
21
|
'skillName',
|
|
22
|
+
'sessionIdSource',
|
|
22
23
|
'ciHint',
|
|
23
24
|
'isTerminal',
|
|
24
25
|
'isUnrecognizedNonTTY'
|
|
25
26
|
].map((field) => field.toLowerCase()));
|
|
26
27
|
export class ForgeCliAttribution {
|
|
28
|
+
static sessionResolver;
|
|
29
|
+
static setSessionResolver(resolver) {
|
|
30
|
+
this.sessionResolver = resolver;
|
|
31
|
+
}
|
|
27
32
|
static isAgent() {
|
|
28
33
|
return !process.stdin.isTTY && !process.stdout.isTTY && !this.isCI();
|
|
29
34
|
}
|
|
@@ -72,7 +77,7 @@ export class ForgeCliAttribution {
|
|
|
72
77
|
const isAgentV2 = agentHint !== UNKNOWN;
|
|
73
78
|
const isCIV2 = ciHint !== UNKNOWN;
|
|
74
79
|
const signals = readRunnerSignals(isAgentV2, isCIV2);
|
|
75
|
-
|
|
80
|
+
const attribution = {
|
|
76
81
|
isAgent: this.isAgent(),
|
|
77
82
|
isCI: this.isCI(),
|
|
78
83
|
skillName: this.skillName(),
|
|
@@ -85,6 +90,15 @@ export class ForgeCliAttribution {
|
|
|
85
90
|
isUnrecognizedNonTTY: String(signals.isUnrecognizedNonTTY),
|
|
86
91
|
...this.getWildcardAttribution()
|
|
87
92
|
};
|
|
93
|
+
return { ...attribution, ...this.resolveSession(attribution) };
|
|
94
|
+
}
|
|
95
|
+
static resolveSession(attribution) {
|
|
96
|
+
try {
|
|
97
|
+
return this.sessionResolver?.(attribution) ?? {};
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return {};
|
|
101
|
+
}
|
|
88
102
|
}
|
|
89
103
|
static getWildcardAttribution() {
|
|
90
104
|
const wildcardAttribution = {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-html.d.ts","sourceRoot":"","sources":["../../src/shared/load-html.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAI/C,eAAO,MAAM,QAAQ,GAAU,SAAS,MAAM,GAAG,MAAM,KAAG,OAAO,CAAC,UAAU,CAG3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/cli-shared",
|
|
3
|
-
"version": "10.1.0-next.
|
|
3
|
+
"version": "10.1.0-next.7",
|
|
4
4
|
"description": "Common functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
18
|
-
"@forge/manifest": "13.9.2-next.
|
|
18
|
+
"@forge/manifest": "13.9.2-next.1",
|
|
19
19
|
"@forge/util": "4.1.0",
|
|
20
20
|
"@forge/i18n": "1.0.2",
|
|
21
21
|
"@sentry/node": "7.106.0",
|