@sebspark/openapi-auth-iam 2.0.1 → 3.0.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/dist/index.js +10 -33
- package/package.json +3 -3
- package/dist/index.d.mts +0 -5
- package/dist/index.mjs +0 -36
package/dist/index.js
CHANGED
|
@@ -1,34 +1,12 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
1
|
// src/index.ts
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
});
|
|
27
|
-
module.exports = __toCommonJS(index_exports);
|
|
28
|
-
var import_gcp_iam = require("@sebspark/gcp-iam");
|
|
2
|
+
import {
|
|
3
|
+
clearCache,
|
|
4
|
+
getApiGatewayTokenByClientId,
|
|
5
|
+
getApiGatewayTokenByUrl
|
|
6
|
+
} from "@sebspark/gcp-iam";
|
|
29
7
|
var apiGatewayTokenByUrlGenerator = (apiKey) => {
|
|
30
8
|
return async (url) => {
|
|
31
|
-
const token = await
|
|
9
|
+
const token = await getApiGatewayTokenByUrl({
|
|
32
10
|
apiURL: url
|
|
33
11
|
});
|
|
34
12
|
return {
|
|
@@ -39,7 +17,7 @@ var apiGatewayTokenByUrlGenerator = (apiKey) => {
|
|
|
39
17
|
};
|
|
40
18
|
var apiGatewayTokenByClientIdGenerator = (apiKey, clientId) => {
|
|
41
19
|
return async () => {
|
|
42
|
-
const token = await
|
|
20
|
+
const token = await getApiGatewayTokenByClientId(clientId);
|
|
43
21
|
return {
|
|
44
22
|
"Proxy-Authorization": `Bearer ${token}`,
|
|
45
23
|
"x-api-key": apiKey
|
|
@@ -48,12 +26,11 @@ var apiGatewayTokenByClientIdGenerator = (apiKey, clientId) => {
|
|
|
48
26
|
};
|
|
49
27
|
var apiGatewayTokenRefresh = () => {
|
|
50
28
|
return async (url) => {
|
|
51
|
-
return await
|
|
29
|
+
return await clearCache(url);
|
|
52
30
|
};
|
|
53
31
|
};
|
|
54
|
-
|
|
55
|
-
0 && (module.exports = {
|
|
32
|
+
export {
|
|
56
33
|
apiGatewayTokenByClientIdGenerator,
|
|
57
34
|
apiGatewayTokenByUrlGenerator,
|
|
58
35
|
apiGatewayTokenRefresh
|
|
59
|
-
}
|
|
36
|
+
};
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/openapi-auth-iam",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.mjs",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist"
|
|
10
10
|
],
|
|
11
11
|
"scripts": {
|
|
12
|
-
"build": "tsup-node src/index.ts --format esm
|
|
12
|
+
"build": "tsup-node src/index.ts --format esm --target node22 --dts",
|
|
13
13
|
"dev": "tsc --watch --noEmit",
|
|
14
14
|
"lint": "biome check .",
|
|
15
15
|
"test": "vitest run --passWithNoTests --coverage",
|
package/dist/index.d.mts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
declare const apiGatewayTokenByUrlGenerator: (apiKey: string) => (url: string) => Promise<Record<string, string>>;
|
|
2
|
-
declare const apiGatewayTokenByClientIdGenerator: (apiKey: string, clientId: string) => () => Promise<Record<string, string>>;
|
|
3
|
-
declare const apiGatewayTokenRefresh: () => (url: string) => Promise<void>;
|
|
4
|
-
|
|
5
|
-
export { apiGatewayTokenByClientIdGenerator, apiGatewayTokenByUrlGenerator, apiGatewayTokenRefresh };
|
package/dist/index.mjs
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
// src/index.ts
|
|
2
|
-
import {
|
|
3
|
-
clearCache,
|
|
4
|
-
getApiGatewayTokenByClientId,
|
|
5
|
-
getApiGatewayTokenByUrl
|
|
6
|
-
} from "@sebspark/gcp-iam";
|
|
7
|
-
var apiGatewayTokenByUrlGenerator = (apiKey) => {
|
|
8
|
-
return async (url) => {
|
|
9
|
-
const token = await getApiGatewayTokenByUrl({
|
|
10
|
-
apiURL: url
|
|
11
|
-
});
|
|
12
|
-
return {
|
|
13
|
-
"Proxy-Authorization": `Bearer ${token}`,
|
|
14
|
-
"x-api-key": apiKey
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
var apiGatewayTokenByClientIdGenerator = (apiKey, clientId) => {
|
|
19
|
-
return async () => {
|
|
20
|
-
const token = await getApiGatewayTokenByClientId(clientId);
|
|
21
|
-
return {
|
|
22
|
-
"Proxy-Authorization": `Bearer ${token}`,
|
|
23
|
-
"x-api-key": apiKey
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
var apiGatewayTokenRefresh = () => {
|
|
28
|
-
return async (url) => {
|
|
29
|
-
return await clearCache(url);
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
apiGatewayTokenByClientIdGenerator,
|
|
34
|
-
apiGatewayTokenByUrlGenerator,
|
|
35
|
-
apiGatewayTokenRefresh
|
|
36
|
-
};
|