@sebspark/openapi-auth-iam 3.0.4 → 3.0.6
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.d.ts → index.d.mts} +3 -1
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +32 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +7 -7
- package/dist/index.js +0 -37
- package/dist/index.js.map +0 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
1
2
|
declare const apiGatewayTokenByUrlGenerator: (apiKey: string) => (url: string) => Promise<Record<string, string>>;
|
|
2
3
|
declare const apiGatewayTokenByClientIdGenerator: (apiKey: string, clientId: string) => () => Promise<Record<string, string>>;
|
|
3
4
|
declare const apiGatewayTokenRefresh: () => (url: string) => Promise<void>;
|
|
4
|
-
|
|
5
|
+
//#endregion
|
|
5
6
|
export { apiGatewayTokenByClientIdGenerator, apiGatewayTokenByUrlGenerator, apiGatewayTokenRefresh };
|
|
7
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"sourcesContent":[],"mappings":";cAMa,oEACiB,QAAQ;AADzB,cAoBA,kCAnBiB,EAAA,CAAA,MAAO,EAAA,MAAA,EAAA,QAAA,EAAA,MAAA,EAAA,GAAA,GAAA,GAuBlB,OAvBkB,CAuBV,MAvBU,CAAA,MAAA,EAAA,MAAA,CAAA,CAAA;AAmBxB,cAqBA,sBAFZ,EAAA,GAAA,GAAA,CAf0B,GAAA,EAAA,MAAR,EAAA,GAkBQ,OAlBD,CAAA,IAAA,CAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { clearCache, getApiGatewayTokenByClientId, getApiGatewayTokenByUrl } from "@sebspark/gcp-iam";
|
|
2
|
+
|
|
3
|
+
//#region src/index.ts
|
|
4
|
+
const apiGatewayTokenByUrlGenerator = (apiKey) => {
|
|
5
|
+
return async (url) => {
|
|
6
|
+
if (process.env.ENV === "local") return { "x-api-key": apiKey };
|
|
7
|
+
const token = await getApiGatewayTokenByUrl({ apiURL: url });
|
|
8
|
+
return {
|
|
9
|
+
"Proxy-Authorization": `Bearer ${token}`,
|
|
10
|
+
"x-api-key": apiKey
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
const apiGatewayTokenByClientIdGenerator = (apiKey, clientId) => {
|
|
15
|
+
return async () => {
|
|
16
|
+
if (process.env.ENV === "local") return { "x-api-key": apiKey };
|
|
17
|
+
const token = await getApiGatewayTokenByClientId(clientId);
|
|
18
|
+
return {
|
|
19
|
+
"Proxy-Authorization": `Bearer ${token}`,
|
|
20
|
+
"x-api-key": apiKey
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const apiGatewayTokenRefresh = () => {
|
|
25
|
+
return async (url) => {
|
|
26
|
+
return await clearCache(url);
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
export { apiGatewayTokenByClientIdGenerator, apiGatewayTokenByUrlGenerator, apiGatewayTokenRefresh };
|
|
32
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import {\n clearCache,\n getApiGatewayTokenByClientId,\n getApiGatewayTokenByUrl,\n} from '@sebspark/gcp-iam'\n\nexport const apiGatewayTokenByUrlGenerator = (apiKey: string) => {\n return async (url: string): Promise<Record<string, string>> => {\n // Skip token generation in local environment\n if (process.env.ENV === 'local') {\n return {\n 'x-api-key': apiKey,\n }\n }\n\n const token = await getApiGatewayTokenByUrl({\n apiURL: url,\n })\n\n return {\n 'Proxy-Authorization': `Bearer ${token}`,\n 'x-api-key': apiKey,\n }\n }\n}\n\nexport const apiGatewayTokenByClientIdGenerator = (\n apiKey: string,\n clientId: string\n) => {\n return async (): Promise<Record<string, string>> => {\n // Skip token generation in local environment\n if (process.env.ENV === 'local') {\n return {\n 'x-api-key': apiKey,\n }\n }\n\n const token = await getApiGatewayTokenByClientId(clientId)\n\n return {\n 'Proxy-Authorization': `Bearer ${token}`,\n 'x-api-key': apiKey,\n }\n }\n}\n\nexport const apiGatewayTokenRefresh = () => {\n return async (url: string) => {\n return await clearCache(url)\n }\n}\n"],"mappings":";;;AAMA,MAAa,iCAAiC,WAAmB;AAC/D,QAAO,OAAO,QAAiD;AAE7D,MAAI,QAAQ,IAAI,QAAQ,QACtB,QAAO,EACL,aAAa,QACd;EAGH,MAAM,QAAQ,MAAM,wBAAwB,EAC1C,QAAQ,KACT,CAAC;AAEF,SAAO;GACL,uBAAuB,UAAU;GACjC,aAAa;GACd;;;AAIL,MAAa,sCACX,QACA,aACG;AACH,QAAO,YAA6C;AAElD,MAAI,QAAQ,IAAI,QAAQ,QACtB,QAAO,EACL,aAAa,QACd;EAGH,MAAM,QAAQ,MAAM,6BAA6B,SAAS;AAE1D,SAAO;GACL,uBAAuB,UAAU;GACjC,aAAa;GACd;;;AAIL,MAAa,+BAA+B;AAC1C,QAAO,OAAO,QAAgB;AAC5B,SAAO,MAAM,WAAW,IAAI"}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/openapi-auth-iam",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.6",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "dist/index.
|
|
7
|
-
"types": "dist/index.d.
|
|
6
|
+
"main": "dist/index.mjs",
|
|
7
|
+
"types": "dist/index.d.mts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
-
"types": "./dist/index.d.
|
|
11
|
-
"import": "./dist/index.
|
|
10
|
+
"types": "./dist/index.d.mts",
|
|
11
|
+
"import": "./dist/index.mjs"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
|
-
"build": "
|
|
18
|
+
"build": "tsdown src/index.ts",
|
|
19
19
|
"depcheck": "depcheck",
|
|
20
20
|
"dev": "tsc --watch --noEmit",
|
|
21
21
|
"lint": "biome check .",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@sebspark/tsconfig": "*",
|
|
27
|
-
"
|
|
27
|
+
"tsdown": "0.16.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@sebspark/gcp-iam": "*"
|
package/dist/index.js
DELETED
|
@@ -1,37 +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
|
-
};
|
|
37
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import {\n clearCache,\n getApiGatewayTokenByClientId,\n getApiGatewayTokenByUrl,\n} from '@sebspark/gcp-iam'\n\nexport const apiGatewayTokenByUrlGenerator = (apiKey: string) => {\n return async (url: string): Promise<Record<string, string>> => {\n const token = await getApiGatewayTokenByUrl({\n apiURL: url,\n })\n\n return {\n 'Proxy-Authorization': `Bearer ${token}`,\n 'x-api-key': apiKey,\n }\n }\n}\n\nexport const apiGatewayTokenByClientIdGenerator = (\n apiKey: string,\n clientId: string\n) => {\n return async (): Promise<Record<string, string>> => {\n const token = await getApiGatewayTokenByClientId(clientId)\n\n return {\n 'Proxy-Authorization': `Bearer ${token}`,\n 'x-api-key': apiKey,\n }\n }\n}\n\nexport const apiGatewayTokenRefresh = () => {\n return async (url: string) => {\n return await clearCache(url)\n }\n}\n"],"mappings":";AAAA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEA,IAAM,gCAAgC,CAAC,WAAmB;AAC/D,SAAO,OAAO,QAAiD;AAC7D,UAAM,QAAQ,MAAM,wBAAwB;AAAA,MAC1C,QAAQ;AAAA,IACV,CAAC;AAED,WAAO;AAAA,MACL,uBAAuB,UAAU,KAAK;AAAA,MACtC,aAAa;AAAA,IACf;AAAA,EACF;AACF;AAEO,IAAM,qCAAqC,CAChD,QACA,aACG;AACH,SAAO,YAA6C;AAClD,UAAM,QAAQ,MAAM,6BAA6B,QAAQ;AAEzD,WAAO;AAAA,MACL,uBAAuB,UAAU,KAAK;AAAA,MACtC,aAAa;AAAA,IACf;AAAA,EACF;AACF;AAEO,IAAM,yBAAyB,MAAM;AAC1C,SAAO,OAAO,QAAgB;AAC5B,WAAO,MAAM,WAAW,GAAG;AAAA,EAC7B;AACF;","names":[]}
|