@mathrunet/masamune_cloudflare 3.1.9 → 3.1.10

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
@@ -1,4 +1,4 @@
1
- ## 3.1.9 (2026-07-01)
1
+ ## 3.1.10 (2026-07-02)
2
2
 
3
3
 
4
4
  ### chore
@@ -106,6 +106,7 @@
106
106
  * Add PDF creation function. ([de349b3](https://github.com/mathrunet/node_masamune/commit/de349b382bacd325929b2c6fa8330dbe7fe12b98))
107
107
  * Add removeOnlyEmoji method to String prototype and update usage in ModelFieldValue class ([dccecf8](https://github.com/mathrunet/node_masamune/commit/dccecf844ad7602e5acedfb4653620ac80c017cb))
108
108
  * Add required type. ([d92208c](https://github.com/mathrunet/node_masamune/commit/d92208cdb1e7340d2b9258a6a090123f581bf5d9))
109
+ * add scheduled workers support and enhance deployment functionality ([70ab4d6](https://github.com/mathrunet/node_masamune/commit/70ab4d6856badb8d86420acf757fc75823493aef))
109
110
  * add scheduler notification tests and update general test utilities and Firestore tests. ([710e462](https://github.com/mathrunet/node_masamune/commit/710e46287e7eb7fea6dd461e0d5354ce2f1bbfd2))
110
111
  * Add short video generation function using Gemini 2.5 Flash and FFmpeg, including tests, documentation, and updated ignore rules for temporary files. ([7e6cde2](https://github.com/mathrunet/node_masamune/commit/7e6cde28f7760c54058cb1e2073c6e97f552d39e))
111
112
  * Add SqlApiBase. ([ff6c5b2](https://github.com/mathrunet/node_masamune/commit/ff6c5b28905402f326904eb4052e86db82be4778))
@@ -152,6 +153,7 @@
152
153
  * Gmail stopped working, so I deleted it. ([c415079](https://github.com/mathrunet/node_masamune/commit/c4150799abeb996b0a08e3d9b7dccb232a2404f2))
153
154
  * Google Play Console data acquisition function implementation ([28ad81f](https://github.com/mathrunet/node_masamune/commit/28ad81ff6451c922ff16c40e52646571d2d39d60))
154
155
  * implement broad/detailed research and asset creation functions, alongside new documentation and tests ([0c1c05d](https://github.com/mathrunet/node_masamune/commit/0c1c05da72d25219080ac98809322b13667b047c))
156
+ * implement Cloudflare KV integration with document-oriented model ([b9af783](https://github.com/mathrunet/node_masamune/commit/b9af7834275e36fdf48977f59dec22f41760bcb8))
155
157
  * 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))
156
158
  * Implement retry mechanism for Vertex AI API calls in ResearchMarket function and enhance error handling ([ac03efe](https://github.com/mathrunet/node_masamune/commit/ac03efe06d7958ad7ebc9a405cf31c351a3b4298))
157
159
  * Implementation of data retrieval API. ([df9ad88](https://github.com/mathrunet/node_masamune/commit/df9ad88da46ccb85cea4172ed8c0107ea2c431f7))
package/dist/index.d.ts CHANGED
@@ -17,6 +17,7 @@ export * from "./lib/src/workers_auth_adapter_base";
17
17
  export * from "./lib/src/workers_rule_adapter_base";
18
18
  export * from "./lib/src/workers_data";
19
19
  export * from "./lib/src/request_process_workders_base";
20
+ export * from "./lib/src/schedule_process_workders_base";
20
21
  export * from "./lib/src/rules/rules_loader";
21
22
  export * from "./lib/src/rules/path_matcher";
22
23
  export * from "./lib/src/rules/rules_engine";
@@ -39,4 +40,7 @@ export * from "./lib/middlewares";
39
40
  *
40
41
  * [Workers]で定義された要素を配列として渡します。渡されたメソッドがデプロイされます。
41
42
  */
42
- export declare function deploy(deployWorkders: WorkersBase[], options?: WorkersOptions): hono.Hono;
43
+ export type WorkersDeployResult = hono.Hono & {
44
+ scheduled?: (event: ScheduledEvent, env: unknown, ctx: ExecutionContext) => Promise<void>;
45
+ };
46
+ export declare function deploy(deployWorkders: WorkersBase[], options?: WorkersOptions): WorkersDeployResult;
package/dist/index.js CHANGED
@@ -48,6 +48,7 @@ exports.deploy = deploy;
48
48
  * [YouTube]: https://www.youtube.com/c/mathrunetchannel
49
49
  */
50
50
  const hono = __importStar(require("hono"));
51
+ const schedule_process_workders_base_1 = require("./lib/src/schedule_process_workders_base");
51
52
  __exportStar(require("@mathrunet/masamune"), exports);
52
53
  __exportStar(require("./lib/api"), exports);
53
54
  __exportStar(require("./lib/src/workers_base"), exports);
@@ -55,6 +56,7 @@ __exportStar(require("./lib/src/workers_auth_adapter_base"), exports);
55
56
  __exportStar(require("./lib/src/workers_rule_adapter_base"), exports);
56
57
  __exportStar(require("./lib/src/workers_data"), exports);
57
58
  __exportStar(require("./lib/src/request_process_workders_base"), exports);
59
+ __exportStar(require("./lib/src/schedule_process_workders_base"), exports);
58
60
  __exportStar(require("./lib/src/rules/rules_loader"), exports);
59
61
  __exportStar(require("./lib/src/rules/path_matcher"), exports);
60
62
  __exportStar(require("./lib/src/rules/rules_engine"), exports);
@@ -62,26 +64,22 @@ __exportStar(require("./lib/adapters/firebase_auth_adapter"), exports);
62
64
  __exportStar(require("./lib/adapters/none_auth_adapter"), exports);
63
65
  __exportStar(require("./lib/adapters/rules_middleware"), exports);
64
66
  __exportStar(require("./lib/middlewares"), exports);
65
- /**
66
- * Methods for deploying to Cloudflare Workers.
67
- *
68
- * Cloudflare Workersにデプロイするためのメソッドです。
69
- *
70
- * @param exports
71
- * Pass the `exports` as is.
72
- *
73
- * `exports`をそのまま渡します。
74
- *
75
- * @param deployWorkders
76
- * The elements defined in [Workers] are passed as an array. The passed method is deployed.
77
- *
78
- * [Workers]で定義された要素を配列として渡します。渡されたメソッドがデプロイされます。
79
- */
80
67
  function deploy(deployWorkders, options = {}) {
81
68
  const app = new hono.Hono();
69
+ const scheduleWorkers = [];
82
70
  for (const worker of deployWorkders) {
71
+ if (worker instanceof schedule_process_workders_base_1.ScheduleProcessWorkdersBase) {
72
+ scheduleWorkers.push(worker);
73
+ continue;
74
+ }
83
75
  app.route(worker.path, worker.build(options));
84
76
  }
85
- return app;
77
+ const result = app;
78
+ if (scheduleWorkers.length > 0) {
79
+ result.scheduled = async (event, env, ctx) => {
80
+ await Promise.all(scheduleWorkers.map((worker) => worker.process(event, env, ctx)));
81
+ };
82
+ }
83
+ return result;
86
84
  }
87
85
  //# 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CA,wBAMC;AAjDD;;;;;;;;;GASG;AACH,2CAA6B;AAG7B,sDAAoC;AACpC,4CAA0B;AAC1B,yDAAuC;AACvC,sEAAoD;AACpD,sEAAoD;AACpD,yDAAuC;AACvC,0EAAwD;AACxD,+DAA6C;AAC7C,+DAA6C;AAC7C,+DAA6C;AAC7C,uEAAqD;AACrD,mEAAiD;AACjD,kEAAgD;AAChD,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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,wBAmBC;AAxED;;;;;;;;;GASG;AACH,2CAA6B;AAE7B,6FAAuF;AAEvF,sDAAoC;AACpC,4CAA0B;AAC1B,yDAAuC;AACvC,sEAAoD;AACpD,sEAAoD;AACpD,yDAAuC;AACvC,0EAAwD;AACxD,2EAAyD;AACzD,+DAA6C;AAC7C,+DAA6C;AAC7C,+DAA6C;AAC7C,uEAAqD;AACrD,mEAAiD;AACjD,kEAAgD;AAChD,oDAAkC;AAyBlC,SAAgB,MAAM,CAAC,cAA6B,EAAE,UAA0B,EAAE;IAC9E,MAAM,GAAG,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;IAC5B,MAAM,eAAe,GAAkC,EAAE,CAAC;IAC1D,KAAK,MAAM,MAAM,IAAI,cAAc,EAAE,CAAC;QAClC,IAAI,MAAM,YAAY,4DAA2B,EAAE,CAAC;YAChD,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7B,SAAS;QACb,CAAC;QACD,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;IAClD,CAAC;IACD,MAAM,MAAM,GAAG,GAA0B,CAAC;IAC1C,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7B,MAAM,CAAC,SAAS,GAAG,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE;YACzC,MAAM,OAAO,CAAC,GAAG,CACb,eAAe,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CACnE,CAAC;QACN,CAAC,CAAC;IACN,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"}
@@ -1,9 +1,19 @@
1
1
  declare global {
2
+ interface ScheduledEvent {
3
+ cron: string;
4
+ scheduledTime?: number;
5
+ }
6
+ interface ExecutionContext {
7
+ waitUntil(promise: Promise<unknown>): void;
8
+ passThroughOnException(): void;
9
+ }
2
10
  interface KVNamespace {
11
+ get(key: string, type: "text"): Promise<string | null>;
3
12
  get(key: string, type: "json"): Promise<unknown | null>;
4
13
  put(key: string, value: string, options?: {
5
14
  expirationTtl?: number | undefined;
6
15
  }): Promise<void>;
16
+ delete(key: string): Promise<void>;
7
17
  }
8
18
  interface JsonWebKeyWithKid extends JsonWebKey {
9
19
  kid: string;
@@ -0,0 +1,25 @@
1
+ import { Hono } from "hono";
2
+ import { WorkersBase, WorkersOptions } from "./workers_base";
3
+ /**
4
+ * Base class for defining Workers data for periodic scheduled execution.
5
+ *
6
+ * 定期スケジュール実行用のWorkersのデータを定義するためのベースクラス。
7
+ */
8
+ export declare abstract class ScheduleProcessWorkdersBase extends WorkersBase {
9
+ /**
10
+ * Base class for defining Workers data for periodic scheduled execution.
11
+ *
12
+ * 定期スケジュール実行用のWorkersのデータを定義するためのベースクラス。
13
+ */
14
+ constructor(options?: WorkersOptions);
15
+ /**
16
+ * Specify the actual contents of the scheduled process.
17
+ *
18
+ * 実際のスケジュール処理の中身を指定します。
19
+ */
20
+ abstract process(event: ScheduledEvent, env: unknown, ctx: ExecutionContext): Promise<void>;
21
+ data: {
22
+ [key: string]: any;
23
+ };
24
+ build(defaultOptions?: WorkersOptions): Hono;
25
+ }
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ScheduleProcessWorkdersBase = void 0;
4
+ const hono_1 = require("hono");
5
+ const workers_base_1 = require("./workers_base");
6
+ /**
7
+ * Base class for defining Workers data for periodic scheduled execution.
8
+ *
9
+ * 定期スケジュール実行用のWorkersのデータを定義するためのベースクラス。
10
+ */
11
+ class ScheduleProcessWorkdersBase extends workers_base_1.WorkersBase {
12
+ /**
13
+ * Base class for defining Workers data for periodic scheduled execution.
14
+ *
15
+ * 定期スケジュール実行用のWorkersのデータを定義するためのベースクラス。
16
+ */
17
+ constructor(options = {}) {
18
+ super({ options: options });
19
+ }
20
+ data = {};
21
+ build(defaultOptions = {}) {
22
+ return new hono_1.Hono();
23
+ }
24
+ }
25
+ exports.ScheduleProcessWorkdersBase = ScheduleProcessWorkdersBase;
26
+ //# sourceMappingURL=schedule_process_workders_base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schedule_process_workders_base.js","sourceRoot":"","sources":["../../../src/lib/src/schedule_process_workders_base.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAC5B,iDAA6D;AAE7D;;;;GAIG;AACH,MAAsB,2BAA4B,SAAQ,0BAAW;IACjE;;;;OAIG;IACH,YAAY,UAA0B,EAAE;QACpC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;IAChC,CAAC;IAaD,IAAI,GAA2B,EAAE,CAAC;IAClC,KAAK,CAAC,iBAAiC,EAAE;QACrC,OAAO,IAAI,WAAI,EAAE,CAAC;IACtB,CAAC;CACJ;AAzBD,kEAyBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mathrunet/masamune_cloudflare",
3
- "version": "3.1.9",
3
+ "version": "3.1.10",
4
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",