@heroku/applink 1.0.0-ea → 1.0.0-ea.1
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
CHANGED
|
@@ -9,8 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
- Initial
|
|
11
11
|
|
|
12
|
-
## [1.0.0-ea] - 2025-
|
|
12
|
+
## [1.0.0-ea] - 2025-06-05
|
|
13
13
|
- Update CODEOWNERS
|
|
14
14
|
- Updated `getAuthorization` to use the correct API URL.
|
|
15
15
|
- Rename `getConnection(name: string)` -> `getAuthorization(developerName: string, attachmentNameOrColorUrl = "HEROKU_APPLINK")`, accepting a new attachmentNameOrColorOrUrl to use a specific Applink addon's config.
|
|
16
16
|
- Remove node-fetch in favor of native fetch, add `HTTPResponseError`
|
|
17
|
+
|
|
18
|
+
## [1.0.0-ea.0] - 2025-06-06
|
|
19
|
+
- Add `X-App-UUID` header, `heroku-applink-node-sdk` UA.
|
|
20
|
+
|
|
21
|
+
## [1.0.0-ea.1] - 2025-06-06
|
|
22
|
+
- Remove dynamic UA.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
type AppUuid = string;
|
|
1
2
|
interface AddonConfig {
|
|
2
3
|
apiUrl: string;
|
|
3
4
|
token: string;
|
|
5
|
+
appUuid: AppUuid;
|
|
4
6
|
}
|
|
5
7
|
export declare function resolveAddonConfigByAttachmentOrColor(attachmentOrColor: string): AddonConfig;
|
|
6
8
|
export declare function resolveAddonConfigByUrl(url: string): AddonConfig;
|
|
@@ -3,6 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.resolveAddonConfigByAttachmentOrColor = resolveAddonConfigByAttachmentOrColor;
|
|
4
4
|
exports.resolveAddonConfigByUrl = resolveAddonConfigByUrl;
|
|
5
5
|
function resolveAddonConfigByAttachmentOrColor(attachmentOrColor) {
|
|
6
|
+
const appUuid = process.env.HEROKU_APP_ID;
|
|
7
|
+
if (!appUuid) {
|
|
8
|
+
throw Error(`Heroku Applink app UUID not found`);
|
|
9
|
+
}
|
|
6
10
|
const addon = process.env.HEROKU_APPLINK_ADDON_NAME || "HEROKU_APPLINK";
|
|
7
11
|
let apiUrl;
|
|
8
12
|
let token;
|
|
@@ -18,9 +22,14 @@ function resolveAddonConfigByAttachmentOrColor(attachmentOrColor) {
|
|
|
18
22
|
return {
|
|
19
23
|
apiUrl,
|
|
20
24
|
token,
|
|
25
|
+
appUuid,
|
|
21
26
|
};
|
|
22
27
|
}
|
|
23
28
|
function resolveAddonConfigByUrl(url) {
|
|
29
|
+
const appUuid = process.env.HEROKU_APP_ID;
|
|
30
|
+
if (!appUuid) {
|
|
31
|
+
throw Error(`Heroku Applink app UUID not found`);
|
|
32
|
+
}
|
|
24
33
|
const envVarEntries = Object.entries(process.env);
|
|
25
34
|
const matchingApiUrlEntry = envVarEntries.find(([key, value]) => key.endsWith("_API_URL") && value.toLowerCase() === url.toLowerCase());
|
|
26
35
|
if (!matchingApiUrlEntry) {
|
|
@@ -35,5 +44,6 @@ function resolveAddonConfigByUrl(url) {
|
|
|
35
44
|
return {
|
|
36
45
|
apiUrl: matchingApiUrlEntry[1],
|
|
37
46
|
token,
|
|
47
|
+
appUuid,
|
|
38
48
|
};
|
|
39
49
|
}
|
package/dist/utils/request.js
CHANGED
|
@@ -10,7 +10,12 @@ class HTTPResponseError extends Error {
|
|
|
10
10
|
exports.HTTPResponseError = HTTPResponseError;
|
|
11
11
|
class HttpRequestUtil {
|
|
12
12
|
async request(url, opts, json = true) {
|
|
13
|
-
const
|
|
13
|
+
const defaultOpts = {
|
|
14
|
+
headers: {
|
|
15
|
+
"User-Agent": `heroku-applink-node-sdk/1.0`,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const response = await fetch(url, { ...defaultOpts, ...opts });
|
|
14
19
|
if (!response.ok) {
|
|
15
20
|
throw new HTTPResponseError(response);
|
|
16
21
|
}
|