@mathrunet/masamune_cloudflare 3.1.1 → 3.1.5
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 +3 -1
- package/README.md +11 -14
- package/dist/functions.d.ts +3 -3
- package/dist/functions.js +4 -4
- package/dist/functions.js.map +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/middlewares/firebase_authentication_middleware.d.ts +76 -0
- package/dist/lib/middlewares/firebase_authentication_middleware.js +86 -0
- package/dist/lib/middlewares/firebase_authentication_middleware.js.map +1 -0
- package/dist/lib/middlewares/index.d.ts +2 -0
- package/dist/lib/middlewares/index.js +19 -0
- package/dist/lib/middlewares/index.js.map +1 -0
- package/dist/lib/middlewares/no_authentication_middleware.d.ts +10 -0
- package/dist/lib/middlewares/no_authentication_middleware.js +18 -0
- package/dist/lib/middlewares/no_authentication_middleware.js.map +1 -0
- package/dist/lib/src/cloudflare_workers_types.d.ts +12 -0
- package/dist/lib/src/cloudflare_workers_types.js +3 -0
- package/dist/lib/src/cloudflare_workers_types.js.map +1 -0
- package/dist/lib/src/request_process_workders_base.d.ts +1 -1
- package/dist/lib/src/request_process_workders_base.js +3 -1
- package/dist/lib/src/request_process_workders_base.js.map +1 -1
- package/dist/lib/src/workers_authentication_middleware_base.d.ts +41 -0
- package/dist/lib/src/workers_authentication_middleware_base.js +20 -0
- package/dist/lib/src/workers_authentication_middleware_base.js.map +1 -0
- package/dist/lib/src/workers_base.d.ts +26 -1
- package/dist/lib/src/workers_base.js +34 -0
- package/dist/lib/src/workers_base.js.map +1 -1
- package/dist/lib/src/workers_data.d.ts +2 -2
- package/dist/lib/src/workers_data.js +4 -2
- package/dist/lib/src/workers_data.js.map +1 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## 3.1.
|
|
1
|
+
## 3.1.5 (2026-06-30)
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
### chore
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
* Add CallProcessFunctionBase. ([f5c72ab](https://github.com/mathrunet/node_masamune/commit/f5c72ab340239039e3ae4e63f1babe8cf4953f58))
|
|
89
89
|
* Add comprehensive JSDoc documentation to marketing functions ([7ea0e10](https://github.com/mathrunet/node_masamune/commit/7ea0e109f07440e8a73214650ad67953bb8b3878))
|
|
90
90
|
* Add convertTo methods to remaining TypeScript converters ([36c5630](https://github.com/mathrunet/node_masamune/commit/36c56306e2f1418ec447af29883147854ae49fba))
|
|
91
|
+
* Add Firebase Authentication middleware and related functionality to Cloudflare package ([bf31d7f](https://github.com/mathrunet/node_masamune/commit/bf31d7f857f5a98b06da27b8ba4b593d70317a69))
|
|
91
92
|
* Add Github summary function. ([3320b2e](https://github.com/mathrunet/node_masamune/commit/3320b2e894b7f85e61a5f891b2d3095bf53d79bd))
|
|
92
93
|
* Add GoogleToken. ([953ae3b](https://github.com/mathrunet/node_masamune/commit/953ae3bef001cfbec2eb2795bab727ee7d1c87cf))
|
|
93
94
|
* Add HLS function. ([bfa96e5](https://github.com/mathrunet/node_masamune/commit/bfa96e5b176180e84dafea9b75612bcd68fb3424))
|
|
@@ -154,6 +155,7 @@
|
|
|
154
155
|
* implement Firebase function to generate short video metadata using Vertex AI, including tests and development documentation. ([2251993](https://github.com/mathrunet/node_masamune/commit/22519933c8b1f84fc7ae26a5754c6c02d96b5969))
|
|
155
156
|
* Implement retry mechanism for Vertex AI API calls in ResearchMarket function and enhance error handling ([ac03efe](https://github.com/mathrunet/node_masamune/commit/ac03efe06d7958ad7ebc9a405cf31c351a3b4298))
|
|
156
157
|
* Implementation of data retrieval API. ([df9ad88](https://github.com/mathrunet/node_masamune/commit/df9ad88da46ccb85cea4172ed8c0107ea2c431f7))
|
|
158
|
+
* Initial commit. ([b69ba81](https://github.com/mathrunet/node_masamune/commit/b69ba81f4377d149c313ba40227af4be1d0ba150))
|
|
157
159
|
* Initial commit. ([26b8a08](https://github.com/mathrunet/node_masamune/commit/26b8a08df3582fd80dc7ecc204654f6b7f5c9098))
|
|
158
160
|
* Initial commit. ([5e83638](https://github.com/mathrunet/node_masamune/commit/5e836385d1789fff488396c67ace73d7f55205e8))
|
|
159
161
|
* Initial commit. ([b9200aa](https://github.com/mathrunet/node_masamune/commit/b9200aa75f64e6890a946f7de0a49fd823143651))
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<a href="https://mathru.net">
|
|
3
3
|
<img width="240px" src="https://raw.githubusercontent.com/mathrunet/node_masamune/main/.github/images/icon.png" alt="Masamune logo" style="border-radius: 32px"s><br/>
|
|
4
4
|
</a>
|
|
5
|
-
<h1 align="center">Masamune Framework</h1>
|
|
5
|
+
<h1 align="center">Masamune Framework for Cloudflare Workers</h1>
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
@@ -39,30 +39,27 @@ Also, [katana_functions_firebase](https://pub.dev/packages/katana_functions_fire
|
|
|
39
39
|
Install the following packages
|
|
40
40
|
|
|
41
41
|
```bash
|
|
42
|
-
npm install @mathrunet/
|
|
42
|
+
npm install @mathrunet/masamune_cloudflare
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
# Implementation
|
|
46
46
|
|
|
47
|
-
|
|
47
|
+
Pass the return value of the `deploy` function to `export default`. It is defined by passing various Workers to the `deploy` function.
|
|
48
48
|
|
|
49
|
-
```
|
|
50
|
-
import * as m from "@mathrunet/
|
|
49
|
+
```typescript
|
|
50
|
+
import * as m from "@mathrunet/masamune_cloudflare";
|
|
51
51
|
|
|
52
|
-
// Define [m.Functions.xxxx] for the functions to be added to
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
m.deploy(
|
|
56
|
-
exports,
|
|
52
|
+
// Define [m.Functions.xxxx] for the functions to be added to Workers.
|
|
53
|
+
//
|
|
54
|
+
// Workersに追加する機能を[m.Functions.xxxx]を定義してください。
|
|
55
|
+
export default m.deploy(
|
|
57
56
|
[
|
|
58
|
-
//
|
|
59
|
-
m.
|
|
57
|
+
// Worker for Test.
|
|
58
|
+
m.TestWorkers.test,
|
|
60
59
|
],
|
|
61
60
|
);
|
|
62
61
|
```
|
|
63
62
|
|
|
64
|
-
Functions passed to deploy are deployed to Cloud Functions for Firebase.
|
|
65
|
-
|
|
66
63
|
# GitHub Sponsors
|
|
67
64
|
|
|
68
65
|
Sponsors are always welcome. Thank you for your support!
|
package/dist/functions.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { WorkersOptions } from "./lib/src/workers_base";
|
|
2
2
|
import { WorkersData } from "./lib/src/workers_data";
|
|
3
3
|
/**
|
|
4
|
-
* Define a list of applicable
|
|
4
|
+
* Define a list of applicable Functions for Cloudflare Workers.
|
|
5
5
|
*
|
|
6
|
-
* Cloudflare Workers用の適用可能な
|
|
6
|
+
* Cloudflare Workers用の適用可能なFunctionsの一覧を定義します。
|
|
7
7
|
*/
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const Functions: {
|
|
9
9
|
/**
|
|
10
10
|
* Endpoints for testing.
|
|
11
11
|
*
|
package/dist/functions.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Functions = void 0;
|
|
4
4
|
const workers_data_1 = require("./lib/src/workers_data");
|
|
5
5
|
/**
|
|
6
|
-
* Define a list of applicable
|
|
6
|
+
* Define a list of applicable Functions for Cloudflare Workers.
|
|
7
7
|
*
|
|
8
|
-
* Cloudflare Workers用の適用可能な
|
|
8
|
+
* Cloudflare Workers用の適用可能なFunctionsの一覧を定義します。
|
|
9
9
|
*/
|
|
10
|
-
exports.
|
|
10
|
+
exports.Functions = {
|
|
11
11
|
/**
|
|
12
12
|
* Endpoints for testing.
|
|
13
13
|
*
|
package/dist/functions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AAErD;;;;GAIG;AACU,QAAA,
|
|
1
|
+
{"version":3,"file":"functions.js","sourceRoot":"","sources":["../src/functions.ts"],"names":[],"mappings":";;;AACA,yDAAqD;AAErD;;;;GAIG;AACU,QAAA,SAAS,GAAG;IACvB;;;;OAIG;IACH,IAAI,EAAE,CAAC,UAA0B,EAAE,EAAE,EAAE,CAAC,IAAI,0BAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;CACrH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 mathru. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Manages packages on Cloudflare Workers for the server portion (NodeJS) of the Masamune framework.
|
|
5
|
+
*
|
|
6
|
+
* To use, import * as masamune from "@mathrunet/masamune_cloudflare";
|
|
7
|
+
*
|
|
8
|
+
* [mathru.net]: https://mathru.net
|
|
9
|
+
* [YouTube]: https://www.youtube.com/c/mathrunetchannel
|
|
10
|
+
*/
|
|
11
|
+
import * as hono from "hono";
|
|
12
|
+
import { WorkersBase, WorkersOptions } from "./lib/src/workers_base";
|
|
2
13
|
export * from "@mathrunet/masamune";
|
|
3
14
|
export * from "./lib/api";
|
|
4
15
|
export * from "./lib/src/workers_base";
|
|
16
|
+
export * from "./lib/src/workers_authentication_middleware_base";
|
|
5
17
|
export * from "./lib/src/workers_data";
|
|
6
18
|
export * from "./lib/src/request_process_workders_base";
|
|
19
|
+
export * from "./lib/middlewares";
|
|
7
20
|
/**
|
|
8
21
|
* Methods for deploying to Cloudflare Workers.
|
|
9
22
|
*
|
|
@@ -19,4 +32,4 @@ export * from "./lib/src/request_process_workders_base";
|
|
|
19
32
|
*
|
|
20
33
|
* [Workers]で定義された要素を配列として渡します。渡されたメソッドがデプロイされます。
|
|
21
34
|
*/
|
|
22
|
-
export declare function deploy(
|
|
35
|
+
export declare function deploy(deployWorkders: WorkersBase[], options?: WorkersOptions): hono.Hono;
|
package/dist/index.js
CHANGED
|
@@ -42,7 +42,7 @@ exports.deploy = deploy;
|
|
|
42
42
|
*
|
|
43
43
|
* Manages packages on Cloudflare Workers for the server portion (NodeJS) of the Masamune framework.
|
|
44
44
|
*
|
|
45
|
-
* To use, import * as masamune from "@mathrunet/
|
|
45
|
+
* To use, import * as masamune from "@mathrunet/masamune_cloudflare";
|
|
46
46
|
*
|
|
47
47
|
* [mathru.net]: https://mathru.net
|
|
48
48
|
* [YouTube]: https://www.youtube.com/c/mathrunetchannel
|
|
@@ -51,8 +51,10 @@ const hono = __importStar(require("hono"));
|
|
|
51
51
|
__exportStar(require("@mathrunet/masamune"), exports);
|
|
52
52
|
__exportStar(require("./lib/api"), exports);
|
|
53
53
|
__exportStar(require("./lib/src/workers_base"), exports);
|
|
54
|
+
__exportStar(require("./lib/src/workers_authentication_middleware_base"), exports);
|
|
54
55
|
__exportStar(require("./lib/src/workers_data"), exports);
|
|
55
56
|
__exportStar(require("./lib/src/request_process_workders_base"), exports);
|
|
57
|
+
__exportStar(require("./lib/middlewares"), exports);
|
|
56
58
|
/**
|
|
57
59
|
* Methods for deploying to Cloudflare Workers.
|
|
58
60
|
*
|
|
@@ -68,11 +70,11 @@ __exportStar(require("./lib/src/request_process_workders_base"), exports);
|
|
|
68
70
|
*
|
|
69
71
|
* [Workers]で定義された要素を配列として渡します。渡されたメソッドがデプロイされます。
|
|
70
72
|
*/
|
|
71
|
-
function deploy(
|
|
73
|
+
function deploy(deployWorkders, options = {}) {
|
|
72
74
|
const app = new hono.Hono();
|
|
73
75
|
for (const worker of deployWorkders) {
|
|
74
|
-
app.route(worker.path, worker.build());
|
|
76
|
+
app.route(worker.path, worker.build(options));
|
|
75
77
|
}
|
|
76
|
-
|
|
78
|
+
return app;
|
|
77
79
|
}
|
|
78
80
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,wBAMC;AA1CD;;;;;;;;;GASG;AACH,2CAA6B;AAG7B,sDAAoC;AACpC,4CAA0B;AAC1B,yDAAuC;AACvC,mFAAiE;AACjE,yDAAuC;AACvC,0EAAwD;AACxD,oDAAkC;AAElC;;;;;;;;;;;;;;GAcG;AACH,SAAgB,MAAM,CAAC,cAA6B,EAAE,UAA0B,EAAE;IAC9E,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;QAClC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { EmulatorEnv, KeyStorer } from "firebase-auth-cloudflare-workers";
|
|
2
|
+
import { Context, MiddlewareHandler } from "hono";
|
|
3
|
+
import { WorkersAuthenticationMiddlewareBase } from "../src/workers_authentication_middleware_base";
|
|
4
|
+
/**
|
|
5
|
+
* Options for Firebase Authentication middleware.
|
|
6
|
+
*
|
|
7
|
+
* Firebase Authenticationミドルウェアのオプション。
|
|
8
|
+
*/
|
|
9
|
+
export interface FirebaseAuthenticationMiddlewareOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Firebase project ID.
|
|
12
|
+
*
|
|
13
|
+
* FirebaseプロジェクトID。
|
|
14
|
+
*/
|
|
15
|
+
projectId: string;
|
|
16
|
+
/**
|
|
17
|
+
* Store for Firebase public keys.
|
|
18
|
+
*
|
|
19
|
+
* Firebase公開鍵の保存先。
|
|
20
|
+
*/
|
|
21
|
+
keyStore?: KeyStorer | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to check if the ID token was revoked.
|
|
24
|
+
*
|
|
25
|
+
* IDトークンの失効を確認するかどうか。
|
|
26
|
+
*/
|
|
27
|
+
checkRevoked?: boolean | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* Emulator environment settings.
|
|
30
|
+
*
|
|
31
|
+
* エミュレーター環境設定。
|
|
32
|
+
*/
|
|
33
|
+
emulatorEnv?: EmulatorEnv | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Seconds to tolerate clock skew.
|
|
36
|
+
*
|
|
37
|
+
* 時刻ずれを許容する秒数。
|
|
38
|
+
*/
|
|
39
|
+
clockSkewSeconds?: number | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Authorization header name.
|
|
42
|
+
*
|
|
43
|
+
* Authorizationヘッダー名。
|
|
44
|
+
*/
|
|
45
|
+
authorizationHeader?: string | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Response returned when authentication fails.
|
|
48
|
+
*
|
|
49
|
+
* 認証失敗時に返すレスポンス。
|
|
50
|
+
*/
|
|
51
|
+
unauthorizedResponse?: (context: Context, error?: unknown) => Response | Promise<Response>;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Firebase public key store using the Cloudflare Cache API.
|
|
55
|
+
*
|
|
56
|
+
* Cloudflare Cache APIを利用したFirebase公開鍵ストア。
|
|
57
|
+
*/
|
|
58
|
+
export declare class FirebaseCacheApiKeyStorer implements KeyStorer {
|
|
59
|
+
constructor(projectId: string, cacheName?: string);
|
|
60
|
+
private readonly cacheKey;
|
|
61
|
+
private readonly cacheName;
|
|
62
|
+
get<ExpectedValue = unknown>(): Promise<ExpectedValue | null>;
|
|
63
|
+
put(value: string, expirationTtl: number): Promise<void>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Middleware for Firebase Authentication.
|
|
67
|
+
*
|
|
68
|
+
* Firebase Authentication用のミドルウェア。
|
|
69
|
+
*/
|
|
70
|
+
export declare class FirebaseAuthenticationMiddleware extends WorkersAuthenticationMiddlewareBase {
|
|
71
|
+
constructor(options: FirebaseAuthenticationMiddlewareOptions);
|
|
72
|
+
private readonly options;
|
|
73
|
+
build(): MiddlewareHandler;
|
|
74
|
+
private getBearerToken;
|
|
75
|
+
private unauthorized;
|
|
76
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FirebaseAuthenticationMiddleware = exports.FirebaseCacheApiKeyStorer = void 0;
|
|
4
|
+
const firebase_auth_cloudflare_workers_1 = require("firebase-auth-cloudflare-workers");
|
|
5
|
+
const workers_authentication_middleware_base_1 = require("../src/workers_authentication_middleware_base");
|
|
6
|
+
/**
|
|
7
|
+
* Firebase public key store using the Cloudflare Cache API.
|
|
8
|
+
*
|
|
9
|
+
* Cloudflare Cache APIを利用したFirebase公開鍵ストア。
|
|
10
|
+
*/
|
|
11
|
+
class FirebaseCacheApiKeyStorer {
|
|
12
|
+
constructor(projectId, cacheName = "firebase-pubkeys-v1") {
|
|
13
|
+
this.cacheKey = new Request(`https://cache.internal/firebase/pubkeys/${projectId}`);
|
|
14
|
+
this.cacheName = cacheName;
|
|
15
|
+
}
|
|
16
|
+
cacheKey;
|
|
17
|
+
cacheName;
|
|
18
|
+
async get() {
|
|
19
|
+
const cache = await caches.open(this.cacheName);
|
|
20
|
+
const hit = await cache.match(this.cacheKey);
|
|
21
|
+
if (!hit) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
return await hit.json();
|
|
25
|
+
}
|
|
26
|
+
async put(value, expirationTtl) {
|
|
27
|
+
const cache = await caches.open(this.cacheName);
|
|
28
|
+
await cache.put(this.cacheKey, new Response(value, {
|
|
29
|
+
headers: {
|
|
30
|
+
"content-type": "application/json",
|
|
31
|
+
"cache-control": `public, max-age=${expirationTtl}`,
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.FirebaseCacheApiKeyStorer = FirebaseCacheApiKeyStorer;
|
|
37
|
+
/**
|
|
38
|
+
* Middleware for Firebase Authentication.
|
|
39
|
+
*
|
|
40
|
+
* Firebase Authentication用のミドルウェア。
|
|
41
|
+
*/
|
|
42
|
+
class FirebaseAuthenticationMiddleware extends workers_authentication_middleware_base_1.WorkersAuthenticationMiddlewareBase {
|
|
43
|
+
constructor(options) {
|
|
44
|
+
super();
|
|
45
|
+
this.options = options;
|
|
46
|
+
}
|
|
47
|
+
options;
|
|
48
|
+
build() {
|
|
49
|
+
return async (context, next) => {
|
|
50
|
+
const token = this.getBearerToken(context);
|
|
51
|
+
if (!token) {
|
|
52
|
+
return await this.unauthorized(context);
|
|
53
|
+
}
|
|
54
|
+
try {
|
|
55
|
+
const keyStore = this.options.keyStore ?? new FirebaseCacheApiKeyStorer(this.options.projectId);
|
|
56
|
+
const auth = firebase_auth_cloudflare_workers_1.Auth.getOrInitialize(this.options.projectId, keyStore);
|
|
57
|
+
const decoded = await auth.verifyIdToken(token, this.options.checkRevoked, this.options.emulatorEnv, this.options.clockSkewSeconds);
|
|
58
|
+
this.setAuthenticationContext(context, {
|
|
59
|
+
uid: decoded.uid,
|
|
60
|
+
token: decoded,
|
|
61
|
+
});
|
|
62
|
+
await next();
|
|
63
|
+
}
|
|
64
|
+
catch (error) {
|
|
65
|
+
return await this.unauthorized(context, error);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
getBearerToken(context) {
|
|
70
|
+
const headerName = this.options.authorizationHeader ?? "Authorization";
|
|
71
|
+
const authorization = context.req.header(headerName);
|
|
72
|
+
if (!authorization) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const match = authorization.match(/^Bearer\s+(.+)$/i);
|
|
76
|
+
return match?.[1];
|
|
77
|
+
}
|
|
78
|
+
async unauthorized(context, error) {
|
|
79
|
+
if (this.options.unauthorizedResponse) {
|
|
80
|
+
return await this.options.unauthorizedResponse(context, error);
|
|
81
|
+
}
|
|
82
|
+
return context.json({ error: "Unauthorized" }, 401);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
exports.FirebaseAuthenticationMiddleware = FirebaseAuthenticationMiddleware;
|
|
86
|
+
//# sourceMappingURL=firebase_authentication_middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"firebase_authentication_middleware.js","sourceRoot":"","sources":["../../../src/lib/middlewares/firebase_authentication_middleware.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./firebase_authentication_middleware"), exports);
|
|
18
|
+
__exportStar(require("./no_authentication_middleware"), exports);
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/middlewares/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uEAAqD;AACrD,iEAA+C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { MiddlewareHandler } from "hono";
|
|
2
|
+
import { WorkersAuthenticationMiddlewareBase } from "../src/workers_authentication_middleware_base";
|
|
3
|
+
/**
|
|
4
|
+
* Middleware that does not perform authentication.
|
|
5
|
+
*
|
|
6
|
+
* 認証を行わないミドルウェア。
|
|
7
|
+
*/
|
|
8
|
+
export declare class NoAuthenticationMiddleware extends WorkersAuthenticationMiddlewareBase {
|
|
9
|
+
build(): MiddlewareHandler;
|
|
10
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoAuthenticationMiddleware = void 0;
|
|
4
|
+
const workers_authentication_middleware_base_1 = require("../src/workers_authentication_middleware_base");
|
|
5
|
+
/**
|
|
6
|
+
* Middleware that does not perform authentication.
|
|
7
|
+
*
|
|
8
|
+
* 認証を行わないミドルウェア。
|
|
9
|
+
*/
|
|
10
|
+
class NoAuthenticationMiddleware extends workers_authentication_middleware_base_1.WorkersAuthenticationMiddlewareBase {
|
|
11
|
+
build() {
|
|
12
|
+
return async (_, next) => {
|
|
13
|
+
await next();
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.NoAuthenticationMiddleware = NoAuthenticationMiddleware;
|
|
18
|
+
//# sourceMappingURL=no_authentication_middleware.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no_authentication_middleware.js","sourceRoot":"","sources":["../../../src/lib/middlewares/no_authentication_middleware.ts"],"names":[],"mappings":";;;AACA,0GAAoG;AAEpG;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,4EAAmC;IAC/E,KAAK;QACD,OAAO,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE;YACrB,MAAM,IAAI,EAAE,CAAC;QACjB,CAAC,CAAC;IACN,CAAC;CACJ;AAND,gEAMC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface KVNamespace {
|
|
3
|
+
get(key: string, type: "json"): Promise<unknown | null>;
|
|
4
|
+
put(key: string, value: string, options?: {
|
|
5
|
+
expirationTtl?: number | undefined;
|
|
6
|
+
}): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
interface JsonWebKeyWithKid extends JsonWebKey {
|
|
9
|
+
kid: string;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudflare_workers_types.js","sourceRoot":"","sources":["../../../src/lib/src/cloudflare_workers_types.ts"],"names":[],"mappings":""}
|
|
@@ -18,8 +18,10 @@ class RequestProcessWorkdersBase extends workers_base_1.WorkersBase {
|
|
|
18
18
|
super({ options: options });
|
|
19
19
|
}
|
|
20
20
|
data = {};
|
|
21
|
-
build() {
|
|
21
|
+
build(defaultOptions = {}) {
|
|
22
22
|
const hono = new hono_1.Hono();
|
|
23
|
+
const options = this.resolveOptions(defaultOptions);
|
|
24
|
+
this.applyAuthentication(hono, options);
|
|
23
25
|
return this.process(hono);
|
|
24
26
|
}
|
|
25
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request_process_workders_base.js","sourceRoot":"","sources":["../../../src/lib/src/request_process_workders_base.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,+BAA4B;AAG5B;;;;GAIG;AACH,MAAsB,0BAA2B,SAAQ,0BAAW;IAChE;;;;OAIG;IACH,YAAY,UAA0B,EAAE;QACpC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IAoBD,IAAI,GAA2B,EAAE,CAAC;IAClC,KAAK;
|
|
1
|
+
{"version":3,"file":"request_process_workders_base.js","sourceRoot":"","sources":["../../../src/lib/src/request_process_workders_base.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,+BAA4B;AAG5B;;;;GAIG;AACH,MAAsB,0BAA2B,SAAQ,0BAAW;IAChE;;;;OAIG;IACH,YAAY,UAA0B,EAAE;QACpC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IAoBD,IAAI,GAA2B,EAAE,CAAC;IAClC,KAAK,CAAC,iBAAiC,EAAE;QACrC,MAAM,IAAI,GAAG,IAAI,WAAI,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACpD,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;CACJ;AAnCD,gEAmCC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Context, MiddlewareHandler } from "hono";
|
|
2
|
+
/**
|
|
3
|
+
* Authentication context for Cloudflare Workers.
|
|
4
|
+
*
|
|
5
|
+
* Cloudflare Workersの認証コンテキスト。
|
|
6
|
+
*/
|
|
7
|
+
export interface WorkersAuthenticationContext {
|
|
8
|
+
/**
|
|
9
|
+
* User ID.
|
|
10
|
+
*
|
|
11
|
+
* ユーザーID。
|
|
12
|
+
*/
|
|
13
|
+
uid?: string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* Decoded authentication token.
|
|
16
|
+
*
|
|
17
|
+
* デコード済みの認証トークン。
|
|
18
|
+
*/
|
|
19
|
+
token?: {
|
|
20
|
+
[key: string]: any;
|
|
21
|
+
} | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Base class for authentication middleware for Cloudflare Workers.
|
|
25
|
+
*
|
|
26
|
+
* Cloudflare Workers用の認証ミドルウェアのベースクラス。
|
|
27
|
+
*/
|
|
28
|
+
export declare abstract class WorkersAuthenticationMiddlewareBase {
|
|
29
|
+
/**
|
|
30
|
+
* Create Hono middleware.
|
|
31
|
+
*
|
|
32
|
+
* Honoミドルウェアを作成します。
|
|
33
|
+
*/
|
|
34
|
+
abstract build(): MiddlewareHandler;
|
|
35
|
+
/**
|
|
36
|
+
* Set authentication context.
|
|
37
|
+
*
|
|
38
|
+
* 認証コンテキストを設定します。
|
|
39
|
+
*/
|
|
40
|
+
protected setAuthenticationContext(context: Context, authentication: WorkersAuthenticationContext): void;
|
|
41
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.WorkersAuthenticationMiddlewareBase = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Base class for authentication middleware for Cloudflare Workers.
|
|
6
|
+
*
|
|
7
|
+
* Cloudflare Workers用の認証ミドルウェアのベースクラス。
|
|
8
|
+
*/
|
|
9
|
+
class WorkersAuthenticationMiddlewareBase {
|
|
10
|
+
/**
|
|
11
|
+
* Set authentication context.
|
|
12
|
+
*
|
|
13
|
+
* 認証コンテキストを設定します。
|
|
14
|
+
*/
|
|
15
|
+
setAuthenticationContext(context, authentication) {
|
|
16
|
+
context.set("authentication", authentication);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.WorkersAuthenticationMiddlewareBase = WorkersAuthenticationMiddlewareBase;
|
|
20
|
+
//# sourceMappingURL=workers_authentication_middleware_base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"workers_authentication_middleware_base.js","sourceRoot":"","sources":["../../../src/lib/src/workers_authentication_middleware_base.ts"],"names":[],"mappings":";;;AAuBA;;;;GAIG;AACH,MAAsB,mCAAmC;IAQrD;;;;OAIG;IACO,wBAAwB,CAC9B,OAAgB,EAChB,cAA4C;QAE5C,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAClD,CAAC;CACJ;AAnBD,kFAmBC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
+
import { WorkersAuthenticationMiddlewareBase } from "./workers_authentication_middleware_base";
|
|
2
3
|
/**
|
|
3
4
|
* Define Function data for Cloudflare Workers.
|
|
4
5
|
*
|
|
@@ -63,7 +64,19 @@ export declare abstract class WorkersBase {
|
|
|
63
64
|
*
|
|
64
65
|
* Cloudflare Workersを生成するためのコードを記述します。
|
|
65
66
|
*/
|
|
66
|
-
abstract build(): Hono;
|
|
67
|
+
abstract build(defaultOptions?: WorkersOptions): Hono;
|
|
68
|
+
/**
|
|
69
|
+
* Merge default options and worker options.
|
|
70
|
+
*
|
|
71
|
+
* デフォルトオプションとWorkerのオプションをマージします。
|
|
72
|
+
*/
|
|
73
|
+
protected resolveOptions(defaultOptions?: WorkersOptions): WorkersOptions;
|
|
74
|
+
/**
|
|
75
|
+
* Apply authentication middleware.
|
|
76
|
+
*
|
|
77
|
+
* 認証ミドルウェアを適用します。
|
|
78
|
+
*/
|
|
79
|
+
protected applyAuthentication(hono: Hono, options: WorkersOptions): Hono;
|
|
67
80
|
}
|
|
68
81
|
/**
|
|
69
82
|
* Specifies the options for the process.
|
|
@@ -71,4 +84,16 @@ export declare abstract class WorkersBase {
|
|
|
71
84
|
* 処理のオプションを指定します。
|
|
72
85
|
*/
|
|
73
86
|
export interface WorkersOptions {
|
|
87
|
+
/**
|
|
88
|
+
* Authentication middleware.
|
|
89
|
+
*
|
|
90
|
+
* 認証ミドルウェア。
|
|
91
|
+
*/
|
|
92
|
+
authentication?: WorkersAuthenticationMiddlewareBase | null | undefined;
|
|
74
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Merge Workers options.
|
|
96
|
+
*
|
|
97
|
+
* Workersのオプションをマージします。
|
|
98
|
+
*/
|
|
99
|
+
export declare function resolveWorkersOptions(defaultOptions?: WorkersOptions, options?: WorkersOptions): WorkersOptions;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.WorkersBase = void 0;
|
|
4
|
+
exports.resolveWorkersOptions = resolveWorkersOptions;
|
|
4
5
|
/**
|
|
5
6
|
* Define Function data for Cloudflare Workers.
|
|
6
7
|
*
|
|
@@ -52,6 +53,39 @@ class WorkersBase {
|
|
|
52
53
|
* 処理のオプションを指定します。
|
|
53
54
|
*/
|
|
54
55
|
options;
|
|
56
|
+
/**
|
|
57
|
+
* Merge default options and worker options.
|
|
58
|
+
*
|
|
59
|
+
* デフォルトオプションとWorkerのオプションをマージします。
|
|
60
|
+
*/
|
|
61
|
+
resolveOptions(defaultOptions = {}) {
|
|
62
|
+
return resolveWorkersOptions(defaultOptions, this.options);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Apply authentication middleware.
|
|
66
|
+
*
|
|
67
|
+
* 認証ミドルウェアを適用します。
|
|
68
|
+
*/
|
|
69
|
+
applyAuthentication(hono, options) {
|
|
70
|
+
if (options.authentication) {
|
|
71
|
+
hono.use("*", options.authentication.build());
|
|
72
|
+
}
|
|
73
|
+
return hono;
|
|
74
|
+
}
|
|
55
75
|
}
|
|
56
76
|
exports.WorkersBase = WorkersBase;
|
|
77
|
+
/**
|
|
78
|
+
* Merge Workers options.
|
|
79
|
+
*
|
|
80
|
+
* Workersのオプションをマージします。
|
|
81
|
+
*/
|
|
82
|
+
function resolveWorkersOptions(defaultOptions = {}, options = {}) {
|
|
83
|
+
return {
|
|
84
|
+
...defaultOptions,
|
|
85
|
+
...options,
|
|
86
|
+
authentication: options.authentication === undefined
|
|
87
|
+
? defaultOptions.authentication
|
|
88
|
+
: options.authentication,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
57
91
|
//# sourceMappingURL=workers_base.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workers_base.js","sourceRoot":"","sources":["../../../src/lib/src/workers_base.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"workers_base.js","sourceRoot":"","sources":["../../../src/lib/src/workers_base.ts"],"names":[],"mappings":";;;AA6HA,sDAWC;AArID;;;;;;;;GAQG;AACH,MAAsB,WAAW;IAC7B;;;;;;;;OAQG;IACH,YAAY,EACR,IAAI,EACJ,IAAI,EACJ,IAAI,GAAG,EAAE,EACT,OAAO,GAUV;QACG,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;IACjC,CAAC;IAED;;;;;OAKG;IACM,IAAI,CAAS;IAEtB;;;;;OAKG;IACM,IAAI,CAIiB;IAE9B;;;;OAIG;IACM,IAAI,CAAyB;IAEtC;;;;OAIG;IACM,OAAO,CAAiB;IASjC;;;;OAIG;IACO,cAAc,CAAC,iBAAiC,EAAE;QACxD,OAAO,qBAAqB,CAAC,cAAc,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC;IAED;;;;OAIG;IACO,mBAAmB,CAAC,IAAU,EAAE,OAAuB;QAC7D,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AA5FD,kCA4FC;AAgBD;;;;GAIG;AACH,SAAgB,qBAAqB,CACjC,iBAAiC,EAAE,EACnC,UAA0B,EAAE;IAE5B,OAAO;QACH,GAAG,cAAc;QACjB,GAAG,OAAO;QACV,cAAc,EAAE,OAAO,CAAC,cAAc,KAAK,SAAS;YAChD,CAAC,CAAC,cAAc,CAAC,cAAc;YAC/B,CAAC,CAAC,OAAO,CAAC,cAAc;KAC/B,CAAC;AACN,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WorkersBase } from "./workers_base";
|
|
1
|
+
import { WorkersBase, WorkersOptions } from "./workers_base";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
3
|
/**
|
|
4
4
|
* Define Function data for Cloudflare Workers.
|
|
@@ -6,5 +6,5 @@ import { Hono } from "hono";
|
|
|
6
6
|
* Cloudflare Workers用のFunctionのデータを定義します。
|
|
7
7
|
*/
|
|
8
8
|
export declare class WorkersData extends WorkersBase {
|
|
9
|
-
build(): Hono;
|
|
9
|
+
build(defaultOptions?: WorkersOptions): Hono;
|
|
10
10
|
}
|
|
@@ -9,12 +9,14 @@ const hono_1 = require("hono");
|
|
|
9
9
|
* Cloudflare Workers用のFunctionのデータを定義します。
|
|
10
10
|
*/
|
|
11
11
|
class WorkersData extends workers_base_1.WorkersBase {
|
|
12
|
-
build() {
|
|
12
|
+
build(defaultOptions = {}) {
|
|
13
13
|
const hono = new hono_1.Hono();
|
|
14
|
+
const options = this.resolveOptions(defaultOptions);
|
|
15
|
+
this.applyAuthentication(hono, options);
|
|
14
16
|
if (!this.func) {
|
|
15
17
|
return hono;
|
|
16
18
|
}
|
|
17
|
-
return this.func(hono,
|
|
19
|
+
return this.func(hono, options, this.data);
|
|
18
20
|
}
|
|
19
21
|
}
|
|
20
22
|
exports.WorkersData = WorkersData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workers_data.js","sourceRoot":"","sources":["../../../src/lib/src/workers_data.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"workers_data.js","sourceRoot":"","sources":["../../../src/lib/src/workers_data.ts"],"names":[],"mappings":";;;AAAA,iDAA6D;AAC7D,+BAA4B;AAE5B;;;;GAIG;AACH,MAAa,WAAY,SAAQ,0BAAW;IACxC,KAAK,CAAC,iBAAiC,EAAE;QACrC,MAAM,IAAI,GAAG,IAAI,WAAI,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,CAAC;QACpD,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CACZ,IAAI,EACJ,OAAO,EACP,IAAI,CAAC,IAAI,CACZ,CAAC;IACN,CAAC;CACJ;AAdD,kCAcC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mathrunet/masamune_cloudflare",
|
|
3
|
-
"version": "3.1.
|
|
4
|
-
"description": "Manages packages on Cloudflare Workers for the server portion
|
|
3
|
+
"version": "3.1.5",
|
|
4
|
+
"description": "Manages packages on Cloudflare Workers for the server portion of the Masamune framework.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -41,6 +41,7 @@
|
|
|
41
41
|
"homepage": "https://github.com/mathrunet/node_masamune#readme",
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@mathrunet/masamune": "^3.10.2",
|
|
44
|
+
"firebase-auth-cloudflare-workers": "^2.0.6",
|
|
44
45
|
"hono": "^4.12.27",
|
|
45
46
|
"typescript": "^5.9.2"
|
|
46
47
|
},
|