From 9a22301916574eed4bd13491412b511f23dd2246 Mon Sep 17 00:00:00 2001 From: daichitakahashi Date: Tue, 26 Nov 2024 18:35:13 +0900 Subject: [PATCH 1/2] feat: new separated "@cf-eventhub/pulumi" package --- .changeset/config.json | 2 +- .changeset/famous-scissors-swim.md | 6 + .pnpmfile.cjs | 6 + cf-eventhub/package.json | 17 +-- cf-eventhub/src/core/index.ts | 1 + iac/pulumi/package.json | 32 +++++ .../iac/pulumi => iac/pulumi/src}/index.ts | 7 +- iac/pulumi/tsconfig.json | 15 +++ package.json | 4 +- pnpm-lock.yaml | 110 +++++++++++++++++- pnpm-workspace.yaml | 1 + 11 files changed, 180 insertions(+), 21 deletions(-) create mode 100644 .changeset/famous-scissors-swim.md create mode 100644 iac/pulumi/package.json rename {cf-eventhub/src/iac/pulumi => iac/pulumi/src}/index.ts (97%) create mode 100644 iac/pulumi/tsconfig.json diff --git a/.changeset/config.json b/.changeset/config.json index 59bc931..6d9a815 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -4,7 +4,7 @@ "commit": false, "fixed": [], "linked": [], - "access": "restricted", + "access": "public", "baseBranch": "main", "updateInternalDependencies": "patch", "ignore": ["dev-eventhub", "flaky-handler", "stable-handler"] diff --git a/.changeset/famous-scissors-swim.md b/.changeset/famous-scissors-swim.md new file mode 100644 index 0000000..e11b0bd --- /dev/null +++ b/.changeset/famous-scissors-swim.md @@ -0,0 +1,6 @@ +--- +"cf-eventhub": patch +"@cf-eventhub/pulumi": patch +--- + +New separated "@cf-eventhub/pulumi" package diff --git a/.pnpmfile.cjs b/.pnpmfile.cjs index 73389ad..132ba0a 100644 --- a/.pnpmfile.cjs +++ b/.pnpmfile.cjs @@ -5,6 +5,12 @@ function readPackage(pkg, _) { "cf-eventhub": "workspace:../cf-eventhub", }; } + if (pkg.name === "@cf-eventhub/pulumi") { + pkg.dependencies = { + ...pkg.dependencies, + "cf-eventhub": "workspace:../../cf-eventhub", + }; + } return pkg; } diff --git a/cf-eventhub/package.json b/cf-eventhub/package.json index f5eddaf..deb9261 100644 --- a/cf-eventhub/package.json +++ b/cf-eventhub/package.json @@ -2,6 +2,7 @@ "name": "cf-eventhub", "type": "module", "version": "0.0.3", + "keywords": ["cloudflare"], "scripts": { "build": "tsup --external cloudflare:workers", "test": "vitest -c vitest.config.worker.mts", @@ -33,36 +34,36 @@ "tsup": { "entry": [ "src/**/*.ts", - "!src/**/*.test.ts" + "!src/**/*.test.ts", + "!src/repositorytest/**/*.ts" ], "splitting": false, "sourcemap": true, - "format": [ - "esm" - ], + "format": ["esm", "cjs"], "dts": true, "clean": true }, "exports": { ".": { "import": "./dist/index.js", + "require": "./dist/index.cjs", "types": "./dist/index.d.ts" }, "./core": { "import": "./dist/core/index.js", + "require": "./dist/core/index.cjs", "types": "./dist/core/index.d.ts" }, "./dev": { "import": "./dist/dev/index.js", + "require": "./dist/dev/index.cjs", "types": "./dist/dev/index.d.ts" }, "./postgresjs": { "import": "./dist/postgres/postgresjs.js", + "require": "./dist/postgres/index.cjs", "types": "./dist/postgres/postgresjs.d.ts" } }, - "files": [ - "dist", - "src/migration" - ] + "files": ["dist", "src/migration"] } diff --git a/cf-eventhub/src/core/index.ts b/cf-eventhub/src/core/index.ts index 1a8ee8d..9c44072 100644 --- a/cf-eventhub/src/core/index.ts +++ b/cf-eventhub/src/core/index.ts @@ -1,5 +1,6 @@ export * from "./logger"; export * from "./executor"; export * from "./hub"; +export * from "./hub/routing"; export * from "./repository"; export * from "./type"; diff --git a/iac/pulumi/package.json b/iac/pulumi/package.json new file mode 100644 index 0000000..ab32a26 --- /dev/null +++ b/iac/pulumi/package.json @@ -0,0 +1,32 @@ +{ + "name": "@cf-eventhub/pulumi", + "main": "src/index.ts", + "type": "commonjs", + "version": "0.0.0", + "keywords": ["pulumi", "cloudflare"], + "scripts": { + "build": "tsup" + }, + "devDependencies": { + "tsup": "^8.3.5", + "typescript": "^5.7.2" + }, + "dependencies": { + "@pulumi/cloudflare": "^5.40.0", + "@pulumi/pulumi": "^3.113.0", + "cf-eventhub": "^0.0.3" + }, + "tsup": { + "entry": ["src/index.ts"], + "splitting": false, + "sourcemap": true, + "format": ["esm", "cjs"], + "dts": true, + "clean": true + }, + "exports": { + "import": "./dist/index.mjs", + "require": "./dist/index.js" + }, + "files": ["dist"] +} diff --git a/cf-eventhub/src/iac/pulumi/index.ts b/iac/pulumi/src/index.ts similarity index 97% rename from cf-eventhub/src/iac/pulumi/index.ts rename to iac/pulumi/src/index.ts index 3d12fc9..305081e 100644 --- a/cf-eventhub/src/iac/pulumi/index.ts +++ b/iac/pulumi/src/index.ts @@ -1,7 +1,6 @@ import { Queue, WorkersCronTrigger } from "@pulumi/cloudflare"; import { type Input, jsonStringify } from "@pulumi/pulumi"; - -import type { Config, ConfigInput } from "../../core/hub/routing"; +import type { Config, ConfigInput } from "cf-eventhub/core"; export type HandlerWorkerScriptBinding = { readonly name: Input; @@ -238,12 +237,12 @@ export abstract class EventHub< this.handlers = handlers; } - abstract createEventHubWorkerScript( + protected abstract createEventHubWorkerScript( name: string, args: CreateEventHubWorkerScriptArgs, ): _WorkerScript; - abstract createExecutorWorkerScript( + protected abstract createExecutorWorkerScript( name: string, args: CreateExecutorWorkerScriptArgs, ): _WorkerScript; diff --git a/iac/pulumi/tsconfig.json b/iac/pulumi/tsconfig.json new file mode 100644 index 0000000..b1b687a --- /dev/null +++ b/iac/pulumi/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "strict": true, + "outDir": "bin", + "target": "es2020", + "module": "NodeNext", + "moduleResolution": "nodenext", + "sourceMap": true, + "experimentalDecorators": true, + "pretty": true, + "noFallthroughCasesInSwitch": true, + "noImplicitReturns": true, + "forceConsistentCasingInFileNames": true + } +} diff --git a/package.json b/package.json index d152722..25d6f51 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "cf-eventhub", "version": "1.0.0", + "private": true, "description": "", "main": "index.js", "scripts": { @@ -16,8 +17,5 @@ "devDependencies": { "@changesets/cli": "^2.27.10", "chalk": "^5.3.0" - }, - "publishConfig": { - "access": "public" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c20ab42..922e7d6 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,7 +4,7 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false -pnpmfileChecksum: 2xymqq6lgv3tkdy2l5pmw3qa4m +pnpmfileChecksum: nw5vsqr5biqd3d5ajmdz2cgymm importers: @@ -79,6 +79,25 @@ importers: specifier: ^3.87.0 version: 3.87.0(@cloudflare/workers-types@4.20241112.0) + iac/pulumi: + dependencies: + '@pulumi/cloudflare': + specifier: ^5.40.0 + version: 5.43.0(typescript@5.7.2) + '@pulumi/pulumi': + specifier: ^3.113.0 + version: 3.139.0(typescript@5.7.2) + cf-eventhub: + specifier: workspace:../../cf-eventhub + version: link:../../cf-eventhub + devDependencies: + tsup: + specifier: ^8.3.5 + version: 8.3.5(postcss@8.4.49)(typescript@5.7.2)(yaml@2.6.0) + typescript: + specifier: ^5.7.2 + version: 5.7.2 + internal/dev-eventhub: dependencies: cf-eventhub: @@ -3298,6 +3317,11 @@ packages: engines: {node: '>=14.17'} hasBin: true + typescript@5.7.2: + resolution: {integrity: sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==} + engines: {node: '>=14.17'} + hasBin: true + ufo@1.5.4: resolution: {integrity: sha512-UsUk3byDzKd04EyoZ7U4DOlxQaD14JUKQl6/P7wiX4FNvUfm3XL246n9W5AmqwW5RSFJ27NAuM0iLscAOYUiGQ==} @@ -4500,6 +4524,15 @@ snapshots: - ts-node - typescript + '@pulumi/cloudflare@5.43.0(typescript@5.7.2)': + dependencies: + '@pulumi/pulumi': 3.139.0(typescript@5.7.2) + transitivePeerDependencies: + - bluebird + - supports-color + - ts-node + - typescript + '@pulumi/pulumi@3.139.0(typescript@5.6.3)': dependencies: '@grpc/grpc-js': 1.12.2 @@ -4538,6 +4571,44 @@ snapshots: - bluebird - supports-color + '@pulumi/pulumi@3.139.0(typescript@5.7.2)': + dependencies: + '@grpc/grpc-js': 1.12.2 + '@logdna/tail-file': 2.2.0 + '@npmcli/arborist': 7.5.4 + '@opentelemetry/api': 1.9.0 + '@opentelemetry/exporter-zipkin': 1.27.0(@opentelemetry/api@1.9.0) + '@opentelemetry/instrumentation': 0.52.1(@opentelemetry/api@1.9.0) + '@opentelemetry/instrumentation-grpc': 0.52.1(@opentelemetry/api@1.9.0) + '@opentelemetry/resources': 1.27.0(@opentelemetry/api@1.9.0) + '@opentelemetry/sdk-trace-base': 1.27.0(@opentelemetry/api@1.9.0) + '@opentelemetry/sdk-trace-node': 1.27.0(@opentelemetry/api@1.9.0) + '@opentelemetry/semantic-conventions': 1.27.0 + '@pulumi/query': 0.3.0 + '@types/google-protobuf': 3.15.12 + '@types/semver': 7.5.8 + '@types/tmp': 0.2.6 + execa: 5.1.1 + fdir: 6.4.2(picomatch@3.0.1) + google-protobuf: 3.21.4 + got: 11.8.6 + ini: 2.0.0 + js-yaml: 3.14.1 + minimist: 1.2.8 + normalize-package-data: 6.0.2 + picomatch: 3.0.1 + pkg-dir: 7.0.0 + require-from-string: 2.0.2 + semver: 7.6.3 + source-map-support: 0.5.21 + tmp: 0.2.3 + upath: 1.2.0 + optionalDependencies: + typescript: 5.7.2 + transitivePeerDependencies: + - bluebird + - supports-color + '@pulumi/query@0.3.0': {} '@rollup/rollup-android-arm-eabi@4.27.2': @@ -4643,7 +4714,7 @@ snapshots: dependencies: '@types/http-cache-semantics': 4.0.4 '@types/keyv': 3.1.4 - '@types/node': 22.9.0 + '@types/node': 18.19.64 '@types/responselike': 1.0.3 '@types/docker-modem@3.0.6': @@ -4667,7 +4738,7 @@ snapshots: '@types/keyv@3.1.4': dependencies: - '@types/node': 22.9.0 + '@types/node': 18.19.64 '@types/node-forge@1.3.11': dependencies: @@ -4685,7 +4756,7 @@ snapshots: '@types/responselike@1.0.3': dependencies: - '@types/node': 22.9.0 + '@types/node': 18.19.64 '@types/semver@7.5.8': {} @@ -6123,7 +6194,7 @@ snapshots: '@protobufjs/path': 1.1.2 '@protobufjs/pool': 1.1.0 '@protobufjs/utf8': 1.1.0 - '@types/node': 22.9.0 + '@types/node': 18.19.64 long: 5.2.3 pump@3.0.2: @@ -6576,6 +6647,33 @@ snapshots: - tsx - yaml + tsup@8.3.5(postcss@8.4.49)(typescript@5.7.2)(yaml@2.6.0): + dependencies: + bundle-require: 5.0.0(esbuild@0.24.0) + cac: 6.7.14 + chokidar: 4.0.1 + consola: 3.2.3 + debug: 4.3.7 + esbuild: 0.24.0 + joycon: 3.1.1 + picocolors: 1.1.1 + postcss-load-config: 6.0.1(postcss@8.4.49)(yaml@2.6.0) + resolve-from: 5.0.0 + rollup: 4.27.2 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tinyexec: 0.3.1 + tinyglobby: 0.2.10 + tree-kill: 1.2.2 + optionalDependencies: + postcss: 8.4.49 + typescript: 5.7.2 + transitivePeerDependencies: + - jiti + - supports-color + - tsx + - yaml + tuf-js@2.2.1: dependencies: '@tufjs/models': 2.0.1 @@ -6598,6 +6696,8 @@ snapshots: typescript@5.6.3: {} + typescript@5.7.2: {} + ufo@1.5.4: {} underscore@1.12.1: {} diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 1363a0e..6bcbc3a 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,4 +1,5 @@ packages: - cf-eventhub - web-console + - iac/pulumi - internal/* From b4bdc0f5879279f997d0dfa5c57b77ca0a496aca Mon Sep 17 00:00:00 2001 From: daichitakahashi Date: Tue, 26 Nov 2024 18:36:12 +0900 Subject: [PATCH 2/2] bump version --- .changeset/famous-scissors-swim.md | 6 ------ cf-eventhub/CHANGELOG.md | 6 ++++++ cf-eventhub/package.json | 16 ++++++++++++---- iac/pulumi/CHANGELOG.md | 9 +++++++++ iac/pulumi/package.json | 22 ++++++++++++++++------ web-console/package.json | 2 +- 6 files changed, 44 insertions(+), 17 deletions(-) delete mode 100644 .changeset/famous-scissors-swim.md create mode 100644 iac/pulumi/CHANGELOG.md diff --git a/.changeset/famous-scissors-swim.md b/.changeset/famous-scissors-swim.md deleted file mode 100644 index e11b0bd..0000000 --- a/.changeset/famous-scissors-swim.md +++ /dev/null @@ -1,6 +0,0 @@ ---- -"cf-eventhub": patch -"@cf-eventhub/pulumi": patch ---- - -New separated "@cf-eventhub/pulumi" package diff --git a/cf-eventhub/CHANGELOG.md b/cf-eventhub/CHANGELOG.md index 007a914..5734ff7 100644 --- a/cf-eventhub/CHANGELOG.md +++ b/cf-eventhub/CHANGELOG.md @@ -1,5 +1,11 @@ # cf-eventhub +## 0.0.4 + +### Patch Changes + +- 9a22301: New separated "@cf-eventhub/pulumi" package + ## 0.0.3 ### Patch Changes diff --git a/cf-eventhub/package.json b/cf-eventhub/package.json index deb9261..bfebb78 100644 --- a/cf-eventhub/package.json +++ b/cf-eventhub/package.json @@ -1,8 +1,10 @@ { "name": "cf-eventhub", "type": "module", - "version": "0.0.3", - "keywords": ["cloudflare"], + "version": "0.0.4", + "keywords": [ + "cloudflare" + ], "scripts": { "build": "tsup --external cloudflare:workers", "test": "vitest -c vitest.config.worker.mts", @@ -39,7 +41,10 @@ ], "splitting": false, "sourcemap": true, - "format": ["esm", "cjs"], + "format": [ + "esm", + "cjs" + ], "dts": true, "clean": true }, @@ -65,5 +70,8 @@ "types": "./dist/postgres/postgresjs.d.ts" } }, - "files": ["dist", "src/migration"] + "files": [ + "dist", + "src/migration" + ] } diff --git a/iac/pulumi/CHANGELOG.md b/iac/pulumi/CHANGELOG.md new file mode 100644 index 0000000..858501b --- /dev/null +++ b/iac/pulumi/CHANGELOG.md @@ -0,0 +1,9 @@ +# @cf-eventhub/pulumi + +## 0.0.1 + +### Patch Changes + +- 9a22301: New separated "@cf-eventhub/pulumi" package +- Updated dependencies [9a22301] + - cf-eventhub@0.0.4 diff --git a/iac/pulumi/package.json b/iac/pulumi/package.json index ab32a26..d62f232 100644 --- a/iac/pulumi/package.json +++ b/iac/pulumi/package.json @@ -2,8 +2,11 @@ "name": "@cf-eventhub/pulumi", "main": "src/index.ts", "type": "commonjs", - "version": "0.0.0", - "keywords": ["pulumi", "cloudflare"], + "version": "0.0.1", + "keywords": [ + "pulumi", + "cloudflare" + ], "scripts": { "build": "tsup" }, @@ -14,13 +17,18 @@ "dependencies": { "@pulumi/cloudflare": "^5.40.0", "@pulumi/pulumi": "^3.113.0", - "cf-eventhub": "^0.0.3" + "cf-eventhub": "^0.0.4" }, "tsup": { - "entry": ["src/index.ts"], + "entry": [ + "src/index.ts" + ], "splitting": false, "sourcemap": true, - "format": ["esm", "cjs"], + "format": [ + "esm", + "cjs" + ], "dts": true, "clean": true }, @@ -28,5 +36,7 @@ "import": "./dist/index.mjs", "require": "./dist/index.js" }, - "files": ["dist"] + "files": [ + "dist" + ] } diff --git a/web-console/package.json b/web-console/package.json index 0c2e2f0..cc1179b 100644 --- a/web-console/package.json +++ b/web-console/package.json @@ -18,7 +18,7 @@ "typed-htmx": "^0.3.1", "typescript": "^5.6.2", "wrangler": "^3.83.0", - "cf-eventhub": "^0.0.3" + "cf-eventhub": "^0.0.4" }, "tsup": { "entry": [