diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 20bcdd6c40..4bf4c78050 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -230,7 +230,7 @@ jobs: matrix: include: - batch: pg-core - packages: 'pgpm/ast pgpm/traverse pgpm/bundle pgpm/core pgpm/cli jobs/knative-job-service packages/client packages/safegres postgres/pg-codegen' + packages: 'pgpm/ast pgpm/traverse pgpm/bundle pgpm/core pgpm/cli packages/client packages/safegres postgres/pg-codegen' - batch: pg-postgres packages: 'postgres/pgsql-test postgres/drizzle-orm-test postgres/introspectron graphile/graphile-test graphile/graphile-connection-filter graphile/graphile-postgis' - batch: pg-graphql diff --git a/AGENTS.md b/AGENTS.md index f9640c4673..b1ff9c683d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -26,7 +26,6 @@ This guide helps AI agents quickly navigate the Constructive monorepo. Construct - **`streaming/*`** – S3 helpers and stream hashing utilities - **`extensions/*`** – PGPM extension modules (Postgres extensions packaged as PGPM modules) - **`graphile/*`** – Graphile/PostGraphile plugins (kept under their own namespace) -- **`jobs/*`** – Knative job scheduling (worker, scheduler, service) and examples ## Entry Points diff --git a/CLAUDE.md b/CLAUDE.md index 2ec838a522..3aac6ee6b8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -70,13 +70,12 @@ React Query Hooks or Prisma-like ORM Client | `postgres/` | PostgreSQL utilities - introspection, testing (pgsql-test), seeding, AST, query context | | `packages/` | Shared utilities - CLI (`cnc`), ORM base, query builder, server utils, client | | `uploads/` | File streaming - S3/MinIO, ETags, content-type detection, UUID hashing | -| `jobs/` | Knative job scheduling - worker, scheduler, service | ### Key Packages & CLIs **`pgpm` CLI** (`pgpm/cli`) - PostgreSQL Package Manager. Commands: `init`, `add`, `deploy`, `revert`, `verify`, `plan`, `install`, `export`, `docker`, `dump`, `tag`. Manages SQL migrations in Sqitch-compatible format with dependency resolution. -**`cnc` CLI** (`packages/cli`, binary: `cnc` or `constructive`) - Full dev toolkit. Commands: `server` (start PostGraphile), `explorer` (GraphiQL UI), `codegen` (generate SDK), `get-graphql-schema`, `jobs`, `context`, `auth`, `execute`. +**`cnc` CLI** (`packages/cli`, binary: `cnc` or `constructive`) - Full dev toolkit. Commands: `server` (start PostGraphile), `explorer` (GraphiQL UI), `codegen` (generate SDK), `get-graphql-schema`, `context`, `auth`, `execute`. **`graphql/codegen`** - Generates type-safe clients from GraphQL schema or endpoint: - `--react-query` mode: TanStack Query v5 hooks with query key factories @@ -110,10 +109,6 @@ test('example', async () => { **`graphile/graphile-test`** - GraphQL testing with PostGraphile snapshot support. -### Job System - -Background jobs use Knative: jobs are added to `app_jobs.jobs` table → `knative-job-worker` polls and picks up → POSTs to Knative function URL → function executes (e.g., send email) → returns status. - ### Database Configuration Tests require PostgreSQL. Standard PG env vars: diff --git a/docker-compose.jobs.yml b/docker-compose.jobs.yml deleted file mode 100644 index a59e8db210..0000000000 --- a/docker-compose.jobs.yml +++ /dev/null @@ -1,123 +0,0 @@ -services: - # Constructive Admin GraphQL API server (internal, header-based routing) - constructive-admin-server: - container_name: constructive-admin-server - image: constructive:dev - build: - context: . - dockerfile: ./Dockerfile - entrypoint: ["constructive", "server", "--host", "0.0.0.0", "--port", "3000", "--origin", "*"] - environment: - NODE_ENV: development - # Server - PORT: "3000" - SERVER_HOST: "0.0.0.0" - SERVER_TRUST_PROXY: "true" - SERVER_ORIGIN: "*" - SERVER_STRICT_AUTH: "false" - # Postgres connection (matches postgres service) - PGHOST: postgres - PGPORT: "5432" - PGUSER: postgres - PGPASSWORD: password - PGDATABASE: constructive - # Api configuration - API_ENABLE_SERVICES: "true" - API_EXPOSED_SCHEMAS: "metaschema_public,constructive_routing_public,constructive_auth_public" - # API_IS_PUBLIC=false enables header-based routing (X-Api-Name, X-Database-Id, X-Meta-Schema) - API_IS_PUBLIC: "false" - # Meta schemas used for schema validation and X-Meta-Schema routing - API_META_SCHEMAS: "metaschema_public,constructive_catalog_public,constructive_routing_public,constructive_apps_public,metaschema_modules_public,constructive_auth_public" - API_ANON_ROLE: "administrator" - API_ROLE_NAME: "administrator" - ports: - - "3002:3000" - networks: - constructive-net: - aliases: - - constructive-admin-server - - # Constructive Public GraphQL API server (external, domain-based routing) - constructive-server: - container_name: constructive-server - image: constructive:dev - entrypoint: ["constructive", "server", "--host", "0.0.0.0", "--port", "3000", "--origin", "*"] - environment: - NODE_ENV: development - # Server - PORT: "3000" - SERVER_HOST: "0.0.0.0" - SERVER_TRUST_PROXY: "true" - SERVER_ORIGIN: "*" - SERVER_STRICT_AUTH: "false" - # Postgres connection (matches postgres service) - PGHOST: postgres - PGPORT: "5432" - PGUSER: postgres - PGPASSWORD: password - PGDATABASE: constructive - # Api configuration - API_ENABLE_SERVICES: "false" - API_EXPOSED_SCHEMAS: "metaschema_public,constructive_routing_public,constructive_auth_public" - # Public-facing server - API_IS_PUBLIC: "true" - # Meta schemas used for schema validation - API_META_SCHEMAS: "metaschema_public,constructive_catalog_public,constructive_routing_public,constructive_apps_public,metaschema_modules_public,constructive_auth_public" - API_ANON_ROLE: "anonymous" - API_ROLE_NAME: "authenticated" - ports: - - "3000:3000" - networks: - constructive-net: - aliases: - - constructive-server - - # Jobs runtime: callback server + worker + scheduler. - # NOTE: the send-email / send-verification-link cloud functions have moved to - # constructive-db; the worker reaches deployed functions over HTTP via the - # gateway env below (INTERNAL_GATEWAY_URL / INTERNAL_GATEWAY_DEVELOPMENT_MAP), - # which must point at wherever those functions are deployed. - knative-job-service: - container_name: knative-job-service - image: constructive:dev - entrypoint: ["node", "jobs/knative-job-service/dist/run.js"] - environment: - NODE_ENV: development - - # Postgres (jobs extension lives in this DB) - PGUSER: postgres - PGHOST: postgres - PGPASSWORD: password - PGPORT: "5432" - PGDATABASE: constructive - JOBS_SCHEMA: app_jobs - - # Worker configuration - JOBS_SUPPORT_ANY: "false" - JOBS_SUPPORTED: "email:send_verification_link,email:send_email" - HOSTNAME: "knative-job-service-1" - - # Callback HTTP server (job completion callbacks) - INTERNAL_JOBS_CALLBACK_PORT: "8080" - INTERNAL_JOBS_CALLBACK_URL: "http://knative-job-service:8080/callback" - # Hostname used by job-utils.getCallbackBaseUrl for callbacks - JOBS_CALLBACK_HOST: "knative-job-service" - - # Function gateway base URL (used by worker when no dev map is present). - # Point this at the deployed cloud functions (now in constructive-db). - INTERNAL_GATEWAY_URL: "${INTERNAL_GATEWAY_URL:-}" - - # Development-only map from task identifier -> function URL. Populate with - # the URLs of the deployed functions, e.g. - # '{"email:send_verification_link":"http://:8080","email:send_email":"http://:8080"}' - INTERNAL_GATEWAY_DEVELOPMENT_MAP: "${INTERNAL_GATEWAY_DEVELOPMENT_MAP:-}" - - ports: - - "8080:8080" - networks: - - constructive-net - -networks: - constructive-net: - external: true - name: constructive-net diff --git a/graphql/env/__tests__/__snapshots__/merge.test.ts.snap b/graphql/env/__tests__/__snapshots__/merge.test.ts.snap index f3db438c19..6c2fcbb7af 100644 --- a/graphql/env/__tests__/__snapshots__/merge.test.ts.snap +++ b/graphql/env/__tests__/__snapshots__/merge.test.ts.snap @@ -76,32 +76,6 @@ exports[`getEnvOptions merges pgpm defaults, graphql defaults, config, env, and "override_schema", ], }, - "jobs": { - "gateway": { - "callbackPort": 12345, - "callbackUrl": "http://callback:12345", - "gatewayUrl": "http://gateway:8080", - }, - "scheduler": { - "gracefulShutdown": true, - "hostname": "scheduler-0", - "pollInterval": 1000, - "schema": "app_jobs", - "supportAny": true, - "supported": [], - }, - "schema": { - "schema": "app_jobs", - }, - "worker": { - "gracefulShutdown": true, - "hostname": "worker-0", - "pollInterval": 1000, - "schema": "app_jobs", - "supportAny": true, - "supported": [], - }, - }, "migrations": { "codegen": { "useTx": false, diff --git a/graphql/types/src/constructive.ts b/graphql/types/src/constructive.ts index 708969413e..0fcf331ba5 100644 --- a/graphql/types/src/constructive.ts +++ b/graphql/types/src/constructive.ts @@ -7,8 +7,7 @@ import { DeploymentOptions, ServerOptions, CDNOptions, - MigrationOptions, - JobsConfig + MigrationOptions } from '@pgpmjs/types'; import { GraphileOptions, @@ -56,8 +55,6 @@ export interface ConstructiveOptions extends PgpmOptions, ConstructiveGraphQLOpt deployment?: DeploymentOptions; /** Migration and code generation options */ migrations?: MigrationOptions; - /** Job system configuration */ - jobs?: JobsConfig; /** LLM provider configuration (embeddings, chat, RAG) */ llm?: LlmOptions; /** SMS provider configuration */ diff --git a/jobs/README.md b/jobs/README.md deleted file mode 100644 index fd5d8ab5ef..0000000000 --- a/jobs/README.md +++ /dev/null @@ -1,309 +0,0 @@ -# Jobs (Knative) - -

- -

- -

- - - - -

- -This document describes the **current** jobs setup using: - -- PostgreSQL + `pgpm-database-jobs` (`app_jobs.*`) -- `@constructive-io/knative-job-service` + `@constructive-io/knative-job-worker` -- Knative functions (deployed separately, e.g. in constructive-db) - ---- - -## 1. Database: jobs extension - -Jobs live entirely in Postgres, provided by the `pgpm-database-jobs` extension. - -Key pieces: - -- Schema: `app_jobs` -- Tables: - - `app_jobs.jobs` – queued / running jobs - - `app_jobs.scheduled_jobs` – cron-like scheduled jobs -- Functions: - - `app_jobs.add_job(...)` - - `app_jobs.add_scheduled_job(...)` - - `app_jobs.get_job(...)` - - `app_jobs.get_scheduled_job(...)` - - `app_jobs.complete_job(...)` - - `app_jobs.fail_job(...)` - - `app_jobs.run_scheduled_job(...)` - -Install the extension into your **app database** (the same DB your API uses). In SQL: - -```sql -CREATE EXTENSION IF NOT EXISTS pgpm-database-jobs; -``` - -Once installed you should see: - -```sql -\dt app_jobs.* -``` - -and at least `app_jobs.jobs` and `app_jobs.scheduled_jobs` present. - ---- - -## 2. Knative job worker + service - -The jobs runtime consists of: - -- `@constructive-io/knative-job-service` - - Starts: - - an HTTP callback server (`@constructive-io/knative-job-server`) - - a Knative job worker (`@constructive-io/knative-job-worker`) - - a scheduler (`@constructive-io/job-scheduler`) -- `@constructive-io/knative-job-worker` - - Polls `app_jobs.jobs` for work - - For each job, `POST`s to `${KNATIVE_SERVICE_URL}/${task_identifier}` - - Uses `X-Worker-Id`, `X-Job-Id`, `X-Database-Id`, `X-Actor-Id` headers and JSON payload - -### Required env vars (knative-job-service) - -From `jobs/knative-job-service/src/env.ts`: - -- Postgres - - `PGUSER` – DB user - - `PGHOST` – DB host - - `PGPASSWORD` – DB password - - `PGPORT` – DB port (default `5432`) - - `PGDATABASE` – the app DB that has `pgpm-database-jobs` installed - - `JOBS_SCHEMA` – schema for jobs (default `app_jobs`) - -- Worker configuration - - `JOBS_SUPPORT_ANY` – `true` to accept all tasks, `false` to restrict - - `JOBS_SUPPORTED` – comma-separated list of task names if `JOBS_SUPPORT_ANY=false` - - `HOSTNAME` – worker/scheduler ID (used in logs and job-utils) - -- Callback server - - `INTERNAL_JOBS_CALLBACK_PORT` – port to bind the callback HTTP server (default `12345`) - - `INTERNAL_JOBS_CALLBACK_URL` – full URL to that server, e.g. - `http://knative-job-service.interweb.svc.cluster.local:8080` - -- Function gateway - - `KNATIVE_SERVICE_URL` – base URL for Knative functions, e.g. - `http://send-email.interweb.svc.cluster.local` - - `INTERNAL_GATEWAY_URL` – fallback used by the worker; set this equal to `KNATIVE_SERVICE_URL` to keep env validation happy - ---- - -## 3. Cloud functions (moved to constructive-db) - -The email cloud functions (e.g. `send-email`, `send-verification-link`) used to -live in this repo under `functions/`. They have been **moved to constructive-db** -and are deployed separately. - -The jobs worker is agnostic to where a function runs. For each job it `POST`s the -payload to the function URL resolved from `INTERNAL_GATEWAY_DEVELOPMENT_MAP` -(task identifier -> URL) or `INTERNAL_GATEWAY_URL`. A function receives the job -payload as JSON and must return `{ complete: true }` on success, or a non-2xx -response to fail the job (the worker records the error and retries up to -`max_attempts`). - ---- - -## 4. Local Development with Docker Compose - -### Start the jobs stack - -```bash -# Start postgres and minio first -docker-compose up -d - -# Start the jobs services -docker-compose -f docker-compose.jobs.yml up --build -``` - -### Services started - -| Service | Port | Description | -|---------|------|-------------| -| `constructive-admin-server` | 3001 | GraphQL API with `API_IS_PUBLIC=false` | -| `knative-job-service` | 8080 | Job worker + callback server | - -The email cloud functions are deployed separately (constructive-db); point the -worker at them via `INTERNAL_GATEWAY_URL` / `INTERNAL_GATEWAY_DEVELOPMENT_MAP`. - -### Test GraphQL access - -```bash -# Introspect the private API -curl -X POST http://localhost:3001/graphql \ - -H "Content-Type: application/json" \ - -H "Host: private.localhost" \ - -d '{"query": "{ __schema { queryType { fields { name } } } }"}' - -# List databases -curl -X POST http://localhost:3001/graphql \ - -H "Content-Type: application/json" \ - -H "Host: private.localhost" \ - -d '{"query": "{ databases { nodes { id name } } }"}' - -# List users -curl -X POST http://localhost:3001/graphql \ - -H "Content-Type: application/json" \ - -H "Host: private.localhost" \ - -d '{"query": "{ users { nodes { id username displayName } } }"}' -``` - ---- - -## 5. Enqueue a job (send-verification-link) - -### Get required IDs - -```bash -# Get Database ID -DBID="$(docker exec -i postgres psql -U postgres -d constructive -Atc \ - 'SELECT id FROM metaschema_public.database ORDER BY created_at LIMIT 1;')" -echo "Database ID: $DBID" - -# Get User ID (for sender_id in invite emails) -SENDER_ID="$(docker exec -i postgres psql -U postgres -d constructive -Atc \ - 'SELECT id FROM roles_public.users ORDER BY created_at LIMIT 1;')" -echo "Sender ID: $SENDER_ID" -``` - -### Enqueue invite_email job - -```bash -# Set JWT claims so add_job can read database_id and actor_id internally -docker exec -it postgres \ - psql -U postgres -d constructive -c " - SELECT set_config('jwt.claims.database_id', '$DBID', true); - SELECT set_config('jwt.claims.user_id', '$SENDER_ID', true); - SELECT app_jobs.add_job( - 'email:send_verification_link', - json_build_object( - 'email_type', 'invite_email', - 'email', 'user@example.com', - 'invite_token', 'invite-token-123', - 'sender_id', '$SENDER_ID' - )::json - ); - " -``` - -### Enqueue forgot_password job - -```bash -docker exec -it postgres \ - psql -U postgres -d constructive -c " - SELECT set_config('jwt.claims.database_id', '$DBID', true); - SELECT app_jobs.add_job( - 'email:send_verification_link', - json_build_object( - 'email_type', 'forgot_password', - 'email', 'user@example.com', - 'user_id', '$SENDER_ID', - 'reset_token', 'reset-token-123' - )::json - ); - " -``` - -### Enqueue email_verification job - -```bash -docker exec -it postgres \ - psql -U postgres -d constructive -c " - SELECT set_config('jwt.claims.database_id', '$DBID', true); - SELECT app_jobs.add_job( - 'email:send_verification_link', - json_build_object( - 'email_type', 'email_verification', - 'email', 'user@example.com', - 'email_id', '$(uuidgen)', - 'verification_token', 'verify-token-123' - )::json - ); - " -``` - -### Watch the logs - -```bash -# Watch job service logs -docker logs -f knative-job-service -``` - -### Job flow - -1. `app_jobs.add_job` inserts into `app_jobs.jobs` and fires `NOTIFY "jobs:insert"` -2. `knative-job-worker` receives notification, picks up the job -3. Worker `POST`s payload to the function URL (resolved from the gateway map) -4. The function processes the payload (e.g. renders and sends an email) -5. Returns `{ complete: true }` and job is marked complete - -You can inspect the queue directly: - -```sql -SELECT - id, - task_identifier, - attempts, - max_attempts, - last_error, - locked_by, - locked_at, - run_at, - created_at, - updated_at -FROM app_jobs.jobs -ORDER BY id DESC; -``` - -Completed jobs are removed from `app_jobs.jobs` by the completion logic; failed jobs with retries will show a `last_error` and incremented `attempts`. - ---- - -## 5. Scheduled jobs (optional) - -You can also use `app_jobs.scheduled_jobs` and `@constructive-io/job-scheduler` to run recurring jobs. - -Example (generic, not specific to `send-email`): - -```sql --- database_id and actor_id are read from JWT claims automatically -SELECT app_jobs.add_scheduled_job( - identifier := 'some-task-name', - payload := json_build_object('foo', 'bar'), - schedule_info := json_build_object( - 'start', NOW(), - 'end', NOW() + '1 day'::interval, - 'rule', '*/5 * * * *' -- every 5 minutes (cron rule) - ) -); -``` - -The scheduler will: - -1. Read from `app_jobs.scheduled_jobs`. -2. Use `app_jobs.run_scheduled_job` to materialize real jobs into `app_jobs.jobs`. -3. The worker then processes them like any other job. - -Inspect scheduled jobs: - -```sql -SELECT - id, - task_identifier, - payload, - schedule_info, - last_scheduled, - last_scheduled_id -FROM app_jobs.scheduled_jobs -ORDER BY id DESC; -``` - ---- diff --git a/jobs/job-pg/CHANGELOG.md b/jobs/job-pg/CHANGELOG.md deleted file mode 100644 index ae50b68a86..0000000000 --- a/jobs/job-pg/CHANGELOG.md +++ /dev/null @@ -1,256 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.16.1...@constructive-io/job-pg@2.16.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.16.0...@constructive-io/job-pg@2.16.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.15.0...@constructive-io/job-pg@2.16.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.6...@constructive-io/job-pg@2.15.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.14.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.5...@constructive-io/job-pg@2.14.6) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.14.5](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.4...@constructive-io/job-pg@2.14.5) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.14.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.3...@constructive-io/job-pg@2.14.4) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.2...@constructive-io/job-pg@2.14.3) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.1...@constructive-io/job-pg@2.14.2) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.14.0...@constructive-io/job-pg@2.14.1) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.13.1...@constructive-io/job-pg@2.14.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.13.0...@constructive-io/job-pg@2.13.1) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.12.1...@constructive-io/job-pg@2.13.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.12.0...@constructive-io/job-pg@2.12.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.11.1...@constructive-io/job-pg@2.12.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.11.0...@constructive-io/job-pg@2.11.1) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.10.1...@constructive-io/job-pg@2.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.10.0...@constructive-io/job-pg@2.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.9.0...@constructive-io/job-pg@2.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.8.0...@constructive-io/job-pg@2.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.7.0...@constructive-io/job-pg@2.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.6.0...@constructive-io/job-pg@2.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.5.4...@constructive-io/job-pg@2.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.5.3...@constructive-io/job-pg@2.5.4) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.5.2...@constructive-io/job-pg@2.5.3) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.5.1...@constructive-io/job-pg@2.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.5.0...@constructive-io/job-pg@2.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.4.4...@constructive-io/job-pg@2.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.4.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.4.3...@constructive-io/job-pg@2.4.4) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.4.2...@constructive-io/job-pg@2.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.4.1...@constructive-io/job-pg@2.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.3.0...@constructive-io/job-pg@2.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.3.0...@constructive-io/job-pg@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.2.2...@constructive-io/job-pg@2.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.2.1...@constructive-io/job-pg@2.2.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.2.0...@constructive-io/job-pg@2.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.1.0...@constructive-io/job-pg@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@2.0.0...@constructive-io/job-pg@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@1.1.0...@constructive-io/job-pg@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@1.0.0...@constructive-io/job-pg@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.5.1...@constructive-io/job-pg@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.5.0...@constructive-io/job-pg@0.5.1) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [0.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.4.1...@constructive-io/job-pg@0.5.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.4.0...@constructive-io/job-pg@0.4.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/job-pg - -# [0.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.21...@constructive-io/job-pg@0.4.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.21](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.20...@constructive-io/job-pg@0.3.21) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.20](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.19...@constructive-io/job-pg@0.3.20) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.19](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.18...@constructive-io/job-pg@0.3.19) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.18](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.17...@constructive-io/job-pg@0.3.18) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.17](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.16...@constructive-io/job-pg@0.3.17) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.16](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.15...@constructive-io/job-pg@0.3.16) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.15](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.14...@constructive-io/job-pg@0.3.15) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.14](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.13...@constructive-io/job-pg@0.3.14) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.13](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.12...@constructive-io/job-pg@0.3.13) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.12](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.11...@constructive-io/job-pg@0.3.12) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.11](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.10...@constructive-io/job-pg@0.3.11) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.10](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.9...@constructive-io/job-pg@0.3.10) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.9](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.8...@constructive-io/job-pg@0.3.9) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.8](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.7...@constructive-io/job-pg@0.3.8) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.7](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.6...@constructive-io/job-pg@0.3.7) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.5...@constructive-io/job-pg@0.3.6) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/job-pg - -## 0.3.5 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/job-pg - -## [0.3.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-pg@0.3.3...@constructive-io/job-pg@0.3.4) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/job-pg diff --git a/jobs/job-pg/README.md b/jobs/job-pg/README.md deleted file mode 100644 index 8bc958db94..0000000000 --- a/jobs/job-pg/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# job-pg - -

- -

- -

- - - - - -

- diff --git a/jobs/job-pg/jest.config.js b/jobs/job-pg/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/job-pg/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/job-pg/package.json b/jobs/job-pg/package.json deleted file mode 100644 index e3ac648348..0000000000 --- a/jobs/job-pg/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@constructive-io/job-pg", - "version": "2.16.2", - "description": "job pg", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/job-pg#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@constructive-io/job-utils": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "pg": "8.21.0" - } -} diff --git a/jobs/job-pg/src/index.ts b/jobs/job-pg/src/index.ts deleted file mode 100644 index 10e5530c39..0000000000 --- a/jobs/job-pg/src/index.ts +++ /dev/null @@ -1,104 +0,0 @@ -import { Pool, PoolConfig } from 'pg'; -import { getJobPgConfig } from '@constructive-io/job-utils'; -import { createLogger } from '@pgpmjs/logger'; - -// k8s only does SIGINT -// other events are bad for babel-watch -const SYS_EVENTS = [ - // 'SIGUSR2', - 'SIGINT' - // 'SIGTERM', - // 'SIGPIPE', - // 'SIGHUP', - // 'SIGABRT' -]; - -function once unknown>( - fn: T, - context?: unknown -): (...args: Parameters) => ReturnType | undefined { - let called = false; - let result: ReturnType | undefined; - - return function (this: unknown, ...args: Parameters) { - if (!called && fn) { - // context is just forwarded through, it is not inspected - result = fn.apply((context ?? this) as never, args) as ReturnType; - called = true; - } - return result; - }; -} - -const pgPoolConfig: PoolConfig = getJobPgConfig() as PoolConfig; - -const logger = createLogger('job-pg'); - -const end = (pool: Pool): void => { - try { - // Pool has internal state flags, but they are not part of the public type - const state = pool as unknown as { - ended?: boolean; - ending?: boolean; - }; - if (state.ended || state.ending) { - logger.error( - 'DO NOT CLOSE pool, why are you trying to call end() when already ended?' - ); - return; - } - void pool.end(); - logger.info('successfully closed pool.'); - } catch (e) { - process.stderr.write(String(e)); - } -}; - -// Callbacks registered for pool close events can accept arbitrary arguments -// (we forward whatever was passed to `onClose`). -type PoolCloseCallback = (...args: any[]) => Promise | void; - -class PoolManager { - private pgPool: Pool; - private callbacks: Array<[PoolCloseCallback, any, any[]]>; - private _closed: boolean; - - constructor({ pgPool = new Pool(pgPoolConfig) }: { pgPool?: Pool } = {}) { - this.pgPool = pgPool; - this.callbacks = []; - this._closed = false; - - const closeOnce = once(async () => { - logger.info('closing pg pool manager...'); - await this.close(); - }, this); - - SYS_EVENTS.forEach((event) => { - process.on(event, closeOnce); - }); - } - - onClose(fn: PoolCloseCallback, context?: any, args: any[] = []): void { - this.callbacks.push([fn, context, args]); - } - - getPool(): Pool { - return this.pgPool; - } - - async close(): Promise { - if (this._closed) return; - - for (const [fn, context, args] of this.callbacks) { - logger.info('closing fn', fn.name); - await fn.apply(context, args); - } - - end(this.pgPool); - this._closed = true; - } -} - -const mngr = new PoolManager(); - -export default mngr; diff --git a/jobs/job-pg/tsconfig.esm.json b/jobs/job-pg/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/job-pg/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/job-pg/tsconfig.json b/jobs/job-pg/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/job-pg/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/job-scheduler/CHANGELOG.md b/jobs/job-scheduler/CHANGELOG.md deleted file mode 100644 index f5e8e15d00..0000000000 --- a/jobs/job-scheduler/CHANGELOG.md +++ /dev/null @@ -1,260 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.16.1...@constructive-io/job-scheduler@2.16.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.16.0...@constructive-io/job-scheduler@2.16.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.15.0...@constructive-io/job-scheduler@2.16.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.6...@constructive-io/job-scheduler@2.15.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.14.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.5...@constructive-io/job-scheduler@2.14.6) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.14.5](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.4...@constructive-io/job-scheduler@2.14.5) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.14.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.3...@constructive-io/job-scheduler@2.14.4) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.2...@constructive-io/job-scheduler@2.14.3) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.1...@constructive-io/job-scheduler@2.14.2) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.14.0...@constructive-io/job-scheduler@2.14.1) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.13.1...@constructive-io/job-scheduler@2.14.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.13.0...@constructive-io/job-scheduler@2.13.1) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.12.1...@constructive-io/job-scheduler@2.13.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.12.0...@constructive-io/job-scheduler@2.12.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.11.1...@constructive-io/job-scheduler@2.12.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.11.0...@constructive-io/job-scheduler@2.11.1) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.10.1...@constructive-io/job-scheduler@2.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.10.0...@constructive-io/job-scheduler@2.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.9.0...@constructive-io/job-scheduler@2.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.8.0...@constructive-io/job-scheduler@2.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.7.0...@constructive-io/job-scheduler@2.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.6.0...@constructive-io/job-scheduler@2.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.5.4...@constructive-io/job-scheduler@2.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.5.3...@constructive-io/job-scheduler@2.5.4) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.5.2...@constructive-io/job-scheduler@2.5.3) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.5.1...@constructive-io/job-scheduler@2.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.5.0...@constructive-io/job-scheduler@2.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.4.4...@constructive-io/job-scheduler@2.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.4.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.4.3...@constructive-io/job-scheduler@2.4.4) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.4.2...@constructive-io/job-scheduler@2.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.4.1...@constructive-io/job-scheduler@2.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.3.0...@constructive-io/job-scheduler@2.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.3.0...@constructive-io/job-scheduler@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.2.2...@constructive-io/job-scheduler@2.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.2.1...@constructive-io/job-scheduler@2.2.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.2.0...@constructive-io/job-scheduler@2.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.1.0...@constructive-io/job-scheduler@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.0.1...@constructive-io/job-scheduler@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [2.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@2.0.0...@constructive-io/job-scheduler@2.0.1) (2026-02-15) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@1.1.0...@constructive-io/job-scheduler@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@1.0.0...@constructive-io/job-scheduler@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.5.1...@constructive-io/job-scheduler@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.5.0...@constructive-io/job-scheduler@0.5.1) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [0.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.4.1...@constructive-io/job-scheduler@0.5.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.4.0...@constructive-io/job-scheduler@0.4.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -# [0.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.23...@constructive-io/job-scheduler@0.4.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.23](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.22...@constructive-io/job-scheduler@0.3.23) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.22](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.21...@constructive-io/job-scheduler@0.3.22) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.21](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.20...@constructive-io/job-scheduler@0.3.21) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.20](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.19...@constructive-io/job-scheduler@0.3.20) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.19](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.18...@constructive-io/job-scheduler@0.3.19) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.18](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.17...@constructive-io/job-scheduler@0.3.18) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.17](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.16...@constructive-io/job-scheduler@0.3.17) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.16](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.15...@constructive-io/job-scheduler@0.3.16) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.15](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.14...@constructive-io/job-scheduler@0.3.15) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.14](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.13...@constructive-io/job-scheduler@0.3.14) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.13](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.12...@constructive-io/job-scheduler@0.3.13) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.12](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.11...@constructive-io/job-scheduler@0.3.12) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.11](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.10...@constructive-io/job-scheduler@0.3.11) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.10](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.9...@constructive-io/job-scheduler@0.3.10) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.9](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.8...@constructive-io/job-scheduler@0.3.9) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.8](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.7...@constructive-io/job-scheduler@0.3.8) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## 0.3.7 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/job-scheduler - -## [0.3.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-scheduler@0.3.5...@constructive-io/job-scheduler@0.3.6) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/job-scheduler diff --git a/jobs/job-scheduler/README.md b/jobs/job-scheduler/README.md deleted file mode 100644 index db1b308c0d..0000000000 --- a/jobs/job-scheduler/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# job-scheduler - -

- -

- -

- - - - - -

- diff --git a/jobs/job-scheduler/jest.config.js b/jobs/job-scheduler/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/job-scheduler/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/job-scheduler/package.json b/jobs/job-scheduler/package.json deleted file mode 100644 index e967099c2f..0000000000 --- a/jobs/job-scheduler/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "@constructive-io/job-scheduler", - "version": "2.16.2", - "description": "job scheduler", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/job-scheduler#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@constructive-io/job-pg": "workspace:^", - "@constructive-io/job-utils": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "node-schedule": "^2.1.1" - } -} diff --git a/jobs/job-scheduler/src/index.ts b/jobs/job-scheduler/src/index.ts deleted file mode 100644 index 9d258feea4..0000000000 --- a/jobs/job-scheduler/src/index.ts +++ /dev/null @@ -1,280 +0,0 @@ -import * as jobs from '@constructive-io/job-utils'; -import type { PgClientLike } from '@constructive-io/job-utils'; -import schedule from 'node-schedule'; -import poolManager from '@constructive-io/job-pg'; -import type { Pool, PoolClient } from 'pg'; -import { Logger } from '@pgpmjs/logger'; - -export interface ScheduledJobRow { - id: number | string; - task_identifier: string; - schedule_info: unknown; -} - -interface SchedulerJobHandle { - cancel(): void; -} - -const log = new Logger('jobs:scheduler'); - -export default class Scheduler { - idleDelay: number; - supportedTaskNames: string[]; - workerId: string; - doNextTimer?: NodeJS.Timeout; - pgPool: Pool; - jobs: Record; - _initialized?: boolean; - listenClient?: PoolClient; - listenRelease?: () => void; - stopped?: boolean; - - constructor({ - tasks, - idleDelay = 15000, - pgPool = poolManager.getPool(), - workerId = 'scheduler-0' - }: { - tasks: string[]; - idleDelay?: number; - pgPool?: Pool; - workerId?: string; - }) { - /* - * idleDelay: This is how long to wait between polling for jobs. - * - * Note: this does NOT need to be short, because we use LISTEN/NOTIFY to be - * notified when new jobs are added - this is just used in the case where - * LISTEN/NOTIFY fails for whatever reason. - */ - this.idleDelay = idleDelay; - this.supportedTaskNames = tasks; - this.workerId = workerId; - this.doNextTimer = undefined; - this.pgPool = pgPool; - this.jobs = {}; - poolManager.onClose(async () => { - await jobs.releaseScheduledJobs(pgPool, { - workerId: this.workerId, - // When ids is omitted the DB function releases all scheduled jobs - ids: undefined as unknown as Array - }); - }); - } - async initialize(client: PgClientLike) { - if (this._initialized === true) return; - await jobs.releaseScheduledJobs(client, { - workerId: this.workerId, - // When ids is omitted the DB function releases all scheduled jobs - ids: undefined as unknown as Array - }); - this._initialized = true; - await this.doNext(client); - } - async handleFatalError( - client: PgClientLike, - { - err, - fatalError, - jobId - }: { err?: Error; fatalError: unknown; jobId: ScheduledJobRow['id'] } - ) { - const when = err ? `after failure '${err.message}'` : 'after success'; - log.error(`Failed to release job '${jobId}' ${when}; committing seppuku`); - log.error(String(fatalError)); - await poolManager.close(); - process.exit(1); - } - async handleError( - client: PgClientLike, - { - err, - job, - duration - }: { err: Error; job: ScheduledJobRow; duration: string } - ) { - log.error( - `Failed to initialize scheduler for ${job.id} (${job.task_identifier}) with error ${err.message} (${duration}ms)` - ); - const j = this.jobs[job.id]; - if (j) j.cancel(); - await jobs.releaseScheduledJobs(client, { - workerId: this.workerId, - ids: [job.id] - }); - } - async handleSuccess( - client: PgClientLike, - { job, duration }: { job: ScheduledJobRow; duration: string } - ) { - log.info( - `initialized ${job.id} (${job.task_identifier}) with success (${duration}ms)` - ); - } - async scheduleJob(client: PgClientLike, job: ScheduledJobRow) { - const { id, task_identifier, schedule_info } = job; - const j = schedule.scheduleJob(schedule_info as never, async () => { - const newjob = (await jobs.runScheduledJob(client, { - jobId: id - })) as ScheduledJobRow | null; - - if (newjob) { - if (newjob.id) { - log.info(`spinning up job[${newjob.task_identifier}]`); - } else { - // this means the scheduled_job has been deleted from db, so cancel it - log.info( - `attempted job[${job.task_identifier}] but it's probably non existent, unscheduling...` - ); - const scheduledJob = this.jobs[job.id]; - if (scheduledJob) scheduledJob.cancel(); - } - } else { - log.info( - `job already scheduled but not yet run or complete: [${job.task_identifier}]` - ); - } - }); - this.jobs[id] = j as SchedulerJobHandle; - } - async doNext(client: PgClientLike): Promise { - if (this.stopped) return; - if (!this._initialized) { - return await this.initialize(client); - } - - if (this.doNextTimer) { - clearTimeout(this.doNextTimer); - this.doNextTimer = undefined; - } - try { - const job = await jobs.getScheduledJob(client, { - workerId: this.workerId, - supportedTaskNames: jobs.getJobSupportAny() - ? null - : this.supportedTaskNames - }); - if (!job || !job.id) { - if (!this.stopped) { - this.doNextTimer = setTimeout( - () => this.doNext(client), - this.idleDelay - ); - } - return; - } - const start = process.hrtime(); - - let err: Error | null = null; - try { - await this.scheduleJob(client, job); - } catch (error) { - err = error as Error; - } - - const durationRaw = process.hrtime(start); - const duration = ((durationRaw[0] * 1e9 + durationRaw[1]) / 1e6).toFixed( - 2 - ); - const jobId = job.id; - try { - if (err) { - await this.handleError(client, { err, job, duration }); - } else { - await this.handleSuccess(client, { job, duration }); - } - } catch (fatalError: unknown) { - await this.handleFatalError(client, { err, fatalError, jobId }); - } - if (!this.stopped) { - return this.doNext(client); - } - return; - } catch (err: unknown) { - if (!this.stopped) { - this.doNextTimer = setTimeout( - () => this.doNext(client), - this.idleDelay - ); - } - } - } - async listen(): Promise { - if (this.stopped) return; - let client: PoolClient; - let release: () => void; - try { - client = await this.pgPool.connect(); - release = () => client.release(); - } catch (err) { - log.error('Error connecting with notify listener', err); - if (err instanceof Error && err.stack) { - log.debug(err.stack); - } - if (!this.stopped) { - setTimeout(() => this.listen(), 5000); - } - return; - } - if (this.stopped) { - release(); - return; - } - this.listenClient = client; - this.listenRelease = release; - client.on('notification', () => { - log.info('a NEW scheduled JOB!'); - if (this.doNextTimer) { - // Must be idle, do something! - this.doNext(client); - } - }); - client.query('LISTEN "scheduled_jobs:insert"'); - client.on('error', (e: unknown) => { - if (this.stopped) { - release(); - return; - } - log.error('Error with database notify listener', e); - if (e instanceof Error && e.stack) { - log.debug(e.stack); - } - release(); - if (!this.stopped) { - this.listen(); - } - }); - log.info( - `${this.workerId} connected and looking for scheduled jobs...` - ); - this.doNext(client); - } - - async stop(): Promise { - this.stopped = true; - if (this.doNextTimer) { - clearTimeout(this.doNextTimer); - this.doNextTimer = undefined; - } - Object.values(this.jobs).forEach((job) => job.cancel()); - this.jobs = {}; - - const client = this.listenClient; - const release = this.listenRelease; - this.listenClient = undefined; - this.listenRelease = undefined; - - if (client && release) { - client.removeAllListeners('notification'); - client.removeAllListeners('error'); - try { - await client.query('UNLISTEN "scheduled_jobs:insert"'); - } catch { - // Ignore listener cleanup errors during shutdown. - } - release(); - } - } -} - -export { Scheduler }; diff --git a/jobs/job-scheduler/src/run.ts b/jobs/job-scheduler/src/run.ts deleted file mode 100644 index ae4bda1f89..0000000000 --- a/jobs/job-scheduler/src/run.ts +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env node - -import Scheduler from './index'; -import poolManager from '@constructive-io/job-pg'; -import { - getSchedulerHostname, - getJobSupported -} from '@constructive-io/job-utils'; - -const pgPool = poolManager.getPool(); - -const scheduler = new Scheduler({ - pgPool, - workerId: getSchedulerHostname(), - tasks: getJobSupported() -}); - -scheduler.listen(); diff --git a/jobs/job-scheduler/tsconfig.esm.json b/jobs/job-scheduler/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/job-scheduler/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/job-scheduler/tsconfig.json b/jobs/job-scheduler/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/job-scheduler/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/job-utils/CHANGELOG.md b/jobs/job-utils/CHANGELOG.md deleted file mode 100644 index f0a1068f7f..0000000000 --- a/jobs/job-utils/CHANGELOG.md +++ /dev/null @@ -1,258 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.16.1...@constructive-io/job-utils@2.16.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.16.0...@constructive-io/job-utils@2.16.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.15.0...@constructive-io/job-utils@2.16.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.6...@constructive-io/job-utils@2.15.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.14.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.5...@constructive-io/job-utils@2.14.6) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.14.5](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.4...@constructive-io/job-utils@2.14.5) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.14.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.3...@constructive-io/job-utils@2.14.4) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.2...@constructive-io/job-utils@2.14.3) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.1...@constructive-io/job-utils@2.14.2) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.14.0...@constructive-io/job-utils@2.14.1) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.13.1...@constructive-io/job-utils@2.14.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.13.0...@constructive-io/job-utils@2.13.1) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.12.1...@constructive-io/job-utils@2.13.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.12.0...@constructive-io/job-utils@2.12.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.11.1...@constructive-io/job-utils@2.12.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.11.0...@constructive-io/job-utils@2.11.1) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.10.1...@constructive-io/job-utils@2.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.10.0...@constructive-io/job-utils@2.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.9.0...@constructive-io/job-utils@2.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.8.0...@constructive-io/job-utils@2.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.7.0...@constructive-io/job-utils@2.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.6.0...@constructive-io/job-utils@2.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.5.4...@constructive-io/job-utils@2.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.5.3...@constructive-io/job-utils@2.5.4) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.5.2...@constructive-io/job-utils@2.5.3) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.5.1...@constructive-io/job-utils@2.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.5.0...@constructive-io/job-utils@2.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.4.4...@constructive-io/job-utils@2.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.4.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.4.3...@constructive-io/job-utils@2.4.4) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.4.2...@constructive-io/job-utils@2.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.4.1...@constructive-io/job-utils@2.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.3.0...@constructive-io/job-utils@2.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.3.0...@constructive-io/job-utils@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.2.2...@constructive-io/job-utils@2.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.2.1...@constructive-io/job-utils@2.2.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.2.0...@constructive-io/job-utils@2.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.1.0...@constructive-io/job-utils@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@2.0.0...@constructive-io/job-utils@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@1.1.0...@constructive-io/job-utils@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@1.0.0...@constructive-io/job-utils@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.7.1...@constructive-io/job-utils@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.7.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.7.0...@constructive-io/job-utils@0.7.1) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [0.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.6.1...@constructive-io/job-utils@0.7.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.6.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.6.0...@constructive-io/job-utils@0.6.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/job-utils - -# [0.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.16...@constructive-io/job-utils@0.6.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.16](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.15...@constructive-io/job-utils@0.5.16) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.15](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.14...@constructive-io/job-utils@0.5.15) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.14](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.13...@constructive-io/job-utils@0.5.14) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.13](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.12...@constructive-io/job-utils@0.5.13) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.12](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.11...@constructive-io/job-utils@0.5.12) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.11](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.10...@constructive-io/job-utils@0.5.11) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.10](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.9...@constructive-io/job-utils@0.5.10) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.9](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.8...@constructive-io/job-utils@0.5.9) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.8](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.7...@constructive-io/job-utils@0.5.8) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.7](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.6...@constructive-io/job-utils@0.5.7) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.5...@constructive-io/job-utils@0.5.6) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.5](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.4...@constructive-io/job-utils@0.5.5) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.3...@constructive-io/job-utils@0.5.4) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.2...@constructive-io/job-utils@0.5.3) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.1...@constructive-io/job-utils@0.5.2) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/job-utils - -## [0.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.5.0...@constructive-io/job-utils@0.5.1) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/job-utils - -# 0.5.0 (2025-12-18) - -### Features - -- rebrand PGPM packages to @pgpmjs/\* ([734d865](https://github.com/constructive-io/jobs/commit/734d8655ced175f51567c513ac1ee4c843df98b7)) - -## [0.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-utils@0.4.2...@constructive-io/job-utils@0.4.3) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/job-utils diff --git a/jobs/job-utils/README.md b/jobs/job-utils/README.md deleted file mode 100644 index 6395823dab..0000000000 --- a/jobs/job-utils/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# job-utils - -

- -

- -

- - - - - -

- diff --git a/jobs/job-utils/jest.config.js b/jobs/job-utils/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/job-utils/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/job-utils/package.json b/jobs/job-utils/package.json deleted file mode 100644 index 76a521cbbc..0000000000 --- a/jobs/job-utils/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "@constructive-io/job-utils", - "version": "2.16.2", - "description": "job utils", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/job-utils#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@pgpmjs/env": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "@pgpmjs/types": "workspace:^", - "pg-cache": "workspace:^", - "pg-env": "workspace:^" - } -} diff --git a/jobs/job-utils/src/index.ts b/jobs/job-utils/src/index.ts deleted file mode 100644 index ab8b70f04a..0000000000 --- a/jobs/job-utils/src/index.ts +++ /dev/null @@ -1,144 +0,0 @@ -import type { - FailJobParams, - CompleteJobParams, - GetJobParams, - GetScheduledJobParams, - RunScheduledJobParams, - ReleaseScheduledJobsParams, - ReleaseJobsParams -} from '@pgpmjs/types'; - -import { - getJobSchema, - getJobPgConfig, - getJobPool, - getJobConnectionString, - getJobSupportAny, - getJobSupported, - getWorkerHostname, - getSchedulerHostname, - getJobGatewayConfig, - getJobGatewayDevMap, - getJobsCallbackPort, - getCallbackBaseUrl, - getNodeEnvironment -} from './runtime'; - -import { Logger } from '@pgpmjs/logger'; - -const log = new Logger('jobs:core'); - -export type PgClientLike = { - query(text: string, params?: any[]): Promise<{ rows: T[] }>; -}; - -export { - getJobSchema, - getJobPgConfig, - getJobPool, - getJobConnectionString, - getJobSupportAny, - getJobSupported, - getWorkerHostname, - getSchedulerHostname, - getJobGatewayConfig, - getJobGatewayDevMap, - getJobsCallbackPort, - getCallbackBaseUrl, - getNodeEnvironment -}; - -const JOBS_SCHEMA = getJobSchema(); - -export const failJob = async ( - client: PgClientLike, - { workerId, jobId, message }: FailJobParams -) => { - log.warn(`failJob worker[${workerId}] job[${jobId}] ${message}`); - await client.query( - `SELECT * FROM "${JOBS_SCHEMA}".fail_job($1, $2, $3);`, - [workerId, jobId, message] - ); -}; - -export const completeJob = async ( - client: PgClientLike, - { workerId, jobId }: CompleteJobParams -) => { - log.info(`completeJob worker[${workerId}] job[${jobId}]`); - await client.query( - `SELECT * FROM "${JOBS_SCHEMA}".complete_job($1, $2);`, - [workerId, jobId] - ); -}; - -export const getJob = async ( - client: PgClientLike, - { workerId, supportedTaskNames }: GetJobParams -): Promise => { - log.debug(`getJob worker[${workerId}]`); - const { - rows: [job] - } = await client.query( - `SELECT * FROM "${JOBS_SCHEMA}".get_job($1, $2::text[]);`, - [workerId, supportedTaskNames] - ); - return (job as T) ?? null; -}; - -export const getScheduledJob = async ( - client: PgClientLike, - { workerId, supportedTaskNames }: GetScheduledJobParams -): Promise => { - log.debug(`getScheduledJob worker[${workerId}]`); - const { - rows: [job] - } = await client.query( - `SELECT * FROM "${JOBS_SCHEMA}".get_scheduled_job($1, $2::text[]);`, - [workerId, supportedTaskNames] - ); - return (job as T) ?? null; -}; - -export const runScheduledJob = async ( - client: PgClientLike, - { jobId }: RunScheduledJobParams -): Promise => { - log.info(`runScheduledJob job[${jobId}]`); - try { - const { - rows: [job] - } = await client.query( - `SELECT * FROM "${JOBS_SCHEMA}".run_scheduled_job($1);`, - [jobId] - ); - return job ?? null; - } catch (e: any) { - if (e?.message === 'ALREADY_SCHEDULED') { - return null; - } - throw e; - } -}; - -export const releaseScheduledJobs = async ( - client: PgClientLike, - { workerId, ids }: ReleaseScheduledJobsParams -) => { - log.info(`releaseScheduledJobs worker[${workerId}]`); - return client.query( - `SELECT "${JOBS_SCHEMA}".release_scheduled_jobs($1, $2::bigint[]);`, - [workerId, ids ?? null] - ); -}; - -export const releaseJobs = async ( - client: PgClientLike, - { workerId }: ReleaseJobsParams -) => { - log.info(`releaseJobs worker[${workerId}]`); - return client.query( - `SELECT "${JOBS_SCHEMA}".release_jobs($1);`, - [workerId] - ); -}; diff --git a/jobs/job-utils/src/runtime.ts b/jobs/job-utils/src/runtime.ts deleted file mode 100644 index 3d91b70daf..0000000000 --- a/jobs/job-utils/src/runtime.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { getEnvOptions, getNodeEnv, parseEnvBoolean } from '@pgpmjs/env'; -import { defaultPgConfig, getPgEnvVars, type PgConfig } from 'pg-env'; -import { buildConnectionString, getPgPool } from 'pg-cache'; -import type { Pool } from 'pg'; -import type { PgpmOptions } from '@pgpmjs/types'; -import { jobsDefaults } from '@pgpmjs/types'; - -type Maybe = T | null | undefined; - -const toStrArray = (v: Maybe): string[] | undefined => - v ? v.split(',').map(s => s.trim()).filter(Boolean) : undefined; - -// ---- PG config ---- -export const getJobPgConfig = (): PgConfig => { - const opts: PgpmOptions = getEnvOptions(); - const envOnly = getPgEnvVars(); - - return { - ...defaultPgConfig, - ...(opts.pg ?? {}), - ...envOnly - }; -}; - -export const getJobPool = (): Pool => - getPgPool(getJobPgConfig()); - -export const getJobConnectionString = (): string => { - const cfg = getJobPgConfig(); - return buildConnectionString(cfg.user, cfg.password, cfg.host, cfg.port, cfg.database); -}; - -// ---- Schema ---- -export const getJobSchema = (): string => { - const opts: PgpmOptions = getEnvOptions(); - const fromOpts: string | undefined = opts.jobs?.schema?.schema; - return ( - fromOpts || - jobsDefaults.schema?.schema || - 'app_jobs' - ); -}; - -// ---- SupportAny / Supported ---- -export const getJobSupportAny = (): boolean => { - const opts: PgpmOptions = getEnvOptions(); - const envVal = parseEnvBoolean(process.env.JOBS_SUPPORT_ANY); - if (typeof envVal === 'boolean') return envVal; - - const worker: boolean | undefined = opts.jobs?.worker?.supportAny; - const scheduler: boolean | undefined = opts.jobs?.scheduler?.supportAny; - - return ( - worker ?? - scheduler ?? - jobsDefaults.worker?.supportAny ?? - true - ); -}; - -export const getJobSupported = (): string[] => { - const opts: PgpmOptions = getEnvOptions(); - const worker: string[] | undefined = opts.jobs?.worker?.supported; - const scheduler: string[] | undefined = opts.jobs?.scheduler?.supported; - - return ( - worker ?? - scheduler ?? - jobsDefaults.worker?.supported ?? - [] - ); -}; - -// ---- Hostnames ---- -export const getWorkerHostname = (): string => { - const opts: PgpmOptions = getEnvOptions(); - return ( - process.env.HOSTNAME || - opts.jobs?.worker?.hostname || - jobsDefaults.worker?.hostname || - 'worker-0' - ); -}; - -export const getSchedulerHostname = (): string => { - const opts: PgpmOptions = getEnvOptions(); - return ( - process.env.HOSTNAME || - opts.jobs?.scheduler?.hostname || - jobsDefaults.scheduler?.hostname || - 'scheduler-0' - ); -}; - -// ---- Job gateway config (generic HTTP gateway) ---- -export const getJobGatewayConfig = () => { - const opts: PgpmOptions = getEnvOptions(); - const gateway = opts.jobs?.gateway ?? {}; - const defaults = jobsDefaults.gateway ?? {}; - - return { - gatewayUrl: gateway.gatewayUrl || defaults.gatewayUrl, - callbackUrl: gateway.callbackUrl || defaults.callbackUrl, - callbackPort: gateway.callbackPort ?? defaults.callbackPort - }; -}; - -export const getJobGatewayDevMap = (): - | Record - | null => { - const map = process.env.INTERNAL_GATEWAY_DEVELOPMENT_MAP; - if (!map) return null; - try { - return JSON.parse(map); - } catch (err) { - console.warn( - '[getJobGatewayDevMap] Failed to parse INTERNAL_GATEWAY_DEVELOPMENT_MAP as JSON:', - err, - 'Value:', - map - ); - return null; - } -}; - -export const getNodeEnvironment = getNodeEnv; - -// Neutral callback helpers (generic HTTP callback) -export const getJobsCallbackPort = (): number => { - const { callbackPort } = getJobGatewayConfig(); - return callbackPort; -}; - -export const getCallbackBaseUrl = (): string => { - if (process.env.INTERNAL_JOBS_CALLBACK_URL) { - return process.env.INTERNAL_JOBS_CALLBACK_URL; - } - const host = process.env.JOBS_CALLBACK_HOST || 'jobs-callback'; - const port = getJobsCallbackPort(); - return `http://${host}:${port}/callback`; -}; diff --git a/jobs/job-utils/tsconfig.esm.json b/jobs/job-utils/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/job-utils/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/job-utils/tsconfig.json b/jobs/job-utils/tsconfig.json deleted file mode 100644 index 1a9d5696cb..0000000000 --- a/jobs/job-utils/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/job-worker/CHANGELOG.md b/jobs/job-worker/CHANGELOG.md deleted file mode 100644 index 832940ba9e..0000000000 --- a/jobs/job-worker/CHANGELOG.md +++ /dev/null @@ -1,256 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.16.1...@constructive-io/job-worker@2.16.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.16.0...@constructive-io/job-worker@2.16.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.15.0...@constructive-io/job-worker@2.16.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.6...@constructive-io/job-worker@2.15.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.14.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.5...@constructive-io/job-worker@2.14.6) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.14.5](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.4...@constructive-io/job-worker@2.14.5) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.14.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.3...@constructive-io/job-worker@2.14.4) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.2...@constructive-io/job-worker@2.14.3) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.1...@constructive-io/job-worker@2.14.2) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.14.0...@constructive-io/job-worker@2.14.1) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.13.1...@constructive-io/job-worker@2.14.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.13.0...@constructive-io/job-worker@2.13.1) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.12.1...@constructive-io/job-worker@2.13.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.12.0...@constructive-io/job-worker@2.12.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.11.1...@constructive-io/job-worker@2.12.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.11.0...@constructive-io/job-worker@2.11.1) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.10.1...@constructive-io/job-worker@2.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.10.0...@constructive-io/job-worker@2.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.9.0...@constructive-io/job-worker@2.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.8.0...@constructive-io/job-worker@2.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.7.0...@constructive-io/job-worker@2.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.6.0...@constructive-io/job-worker@2.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.5.4...@constructive-io/job-worker@2.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.5.3...@constructive-io/job-worker@2.5.4) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.5.2...@constructive-io/job-worker@2.5.3) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.5.1...@constructive-io/job-worker@2.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.5.0...@constructive-io/job-worker@2.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.4.4...@constructive-io/job-worker@2.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.4.4](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.4.3...@constructive-io/job-worker@2.4.4) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.4.2...@constructive-io/job-worker@2.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.4.1...@constructive-io/job-worker@2.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.3.0...@constructive-io/job-worker@2.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.3.0...@constructive-io/job-worker@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.2.2...@constructive-io/job-worker@2.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.2.1...@constructive-io/job-worker@2.2.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.2.0...@constructive-io/job-worker@2.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.1.0...@constructive-io/job-worker@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@2.0.0...@constructive-io/job-worker@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@1.1.0...@constructive-io/job-worker@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@1.0.0...@constructive-io/job-worker@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.5.1...@constructive-io/job-worker@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.5.0...@constructive-io/job-worker@0.5.1) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [0.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.4.1...@constructive-io/job-worker@0.5.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.4.0...@constructive-io/job-worker@0.4.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/job-worker - -# [0.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.23...@constructive-io/job-worker@0.4.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.23](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.22...@constructive-io/job-worker@0.3.23) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.22](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.21...@constructive-io/job-worker@0.3.22) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.21](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.20...@constructive-io/job-worker@0.3.21) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.20](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.19...@constructive-io/job-worker@0.3.20) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.19](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.18...@constructive-io/job-worker@0.3.19) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.18](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.17...@constructive-io/job-worker@0.3.18) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.17](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.16...@constructive-io/job-worker@0.3.17) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.16](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.15...@constructive-io/job-worker@0.3.16) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.15](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.14...@constructive-io/job-worker@0.3.15) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.14](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.13...@constructive-io/job-worker@0.3.14) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.13](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.12...@constructive-io/job-worker@0.3.13) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.12](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.11...@constructive-io/job-worker@0.3.12) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.11](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.10...@constructive-io/job-worker@0.3.11) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.10](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.9...@constructive-io/job-worker@0.3.10) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.9](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.8...@constructive-io/job-worker@0.3.9) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.8](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.7...@constructive-io/job-worker@0.3.8) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/job-worker - -## 0.3.7 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/job-worker - -## [0.3.6](https://github.com/constructive-io/jobs/compare/@constructive-io/job-worker@0.3.5...@constructive-io/job-worker@0.3.6) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/job-worker diff --git a/jobs/job-worker/README.md b/jobs/job-worker/README.md deleted file mode 100644 index ec9c50296b..0000000000 --- a/jobs/job-worker/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# job-worker - -

- -

- -

- - - - - -

- diff --git a/jobs/job-worker/jest.config.js b/jobs/job-worker/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/job-worker/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/job-worker/package.json b/jobs/job-worker/package.json deleted file mode 100644 index cab8d1569f..0000000000 --- a/jobs/job-worker/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "@constructive-io/job-worker", - "version": "2.16.2", - "description": "job worker", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/job-worker#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@constructive-io/job-utils": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "pg": "8.21.0" - } -} diff --git a/jobs/job-worker/src/index.ts b/jobs/job-worker/src/index.ts deleted file mode 100644 index c228471081..0000000000 --- a/jobs/job-worker/src/index.ts +++ /dev/null @@ -1,221 +0,0 @@ -import pg from 'pg'; -import type { Pool, PoolClient } from 'pg'; -import * as jobs from '@constructive-io/job-utils'; -import type { PgClientLike } from '@constructive-io/job-utils'; -import { createLogger } from '@pgpmjs/logger'; - -const pgPoolConfig = { - connectionString: jobs.getJobConnectionString() -}; - -function once unknown>( - fn: T, - context?: unknown -): (...args: Parameters) => ReturnType | undefined { - let result: ReturnType | undefined; - return function (this: unknown, ...args: Parameters) { - if (fn) { - result = fn.apply((context ?? this) as never, args) as ReturnType; - fn = null as unknown as T; - } - return result; - }; -} - -export interface JobRow { - id: number | string; - task_identifier: string; - payload?: unknown; -} - -export interface WorkerContext { - pgPool: Pool; - workerId: string; -} - -export type TaskHandler = ( - ctx: WorkerContext, - job: JobRow -) => Promise | void; - -const logger = createLogger('job-worker'); - -export default class Worker { - tasks: Record; - idleDelay: number; - supportedTaskNames: string[]; - workerId: string; - doNextTimer?: NodeJS.Timeout; - pgPool: Pool; - _ended?: boolean; - - // tasks is required; other options are optional - constructor({ - tasks, - idleDelay = 15000, - pgPool = new (pg as any).Pool(pgPoolConfig), - workerId = jobs.getWorkerHostname() - }: { - tasks: Record; - idleDelay?: number; - pgPool?: Pool; - workerId?: string; - }) { - this.tasks = tasks; - /* - * idleDelay: This is how long to wait between polling for jobs. - * - * Note: this does NOT need to be short, because we use LISTEN/NOTIFY to be - * notified when new jobs are added - this is just used in the case where - * LISTEN/NOTIFY fails for whatever reason. - */ - this.idleDelay = idleDelay; - - this.supportedTaskNames = Object.keys(this.tasks); - this.workerId = workerId; - this.doNextTimer = undefined; - this.pgPool = pgPool; - const close = () => { - logger.info('closing connection...'); - this.close(); - }; - process.once('SIGTERM', close); - process.once('SIGINT', close); - } - close() { - if (!this._ended) { - this.pgPool.end(); - } - this._ended = true; - } - handleFatalError({ - err, - fatalError, - jobId - }: { - err?: Error; - fatalError: unknown; - jobId: JobRow['id']; - }) { - const when = err ? `after failure '${err.message}'` : 'after success'; - logger.error( - `Failed to release job '${jobId}' ${when}; committing seppuku` - ); - logger.error(fatalError); - process.exit(1); - } - async handleError( - client: PgClientLike, - { err, job, duration }: { err: Error; job: JobRow; duration: string } - ) { - logger.error( - `Failed task ${job.id} (${job.task_identifier}) with error ${err.message} (${duration}ms)`, - { err, stack: err.stack } - ); - logger.error(err.stack); - await jobs.failJob(client, { - workerId: this.workerId, - jobId: job.id, - message: err.message - }); - } - async handleSuccess( - client: PgClientLike, - { job, duration }: { job: JobRow; duration: string } - ) { - logger.info( - `Completed task ${job.id} (${job.task_identifier}) with success (${duration}ms)` - ); - await jobs.completeJob(client, { workerId: this.workerId, jobId: job.id }); - } - async doWork(job: JobRow) { - const { task_identifier } = job; - const worker = this.tasks[task_identifier]; - if (!worker) { - throw new Error('Unsupported task'); - } - await worker( - { - pgPool: this.pgPool, - workerId: this.workerId - }, - job - ); - } - async doNext(client: PgClientLike): Promise { - if (this.doNextTimer) { - clearTimeout(this.doNextTimer); - this.doNextTimer = undefined; - } - try { - const job = (await jobs.getJob(client, { - workerId: this.workerId, - supportedTaskNames: this.supportedTaskNames - })) as JobRow | undefined; - if (!job || !job.id) { - this.doNextTimer = setTimeout( - () => this.doNext(client), - this.idleDelay - ); - return; - } - const start = process.hrtime(); - - let err: Error | null = null; - try { - await this.doWork(job); - } catch (error) { - err = error as Error; - } - const durationRaw = process.hrtime(start); - const duration = ((durationRaw[0] * 1e9 + durationRaw[1]) / 1e6).toFixed( - 2 - ); - const jobId = job.id; - try { - if (err) { - await this.handleError(client, { err, job, duration }); - } else { - await this.handleSuccess(client, { job, duration }); - } - } catch (fatalError: unknown) { - this.handleFatalError({ err, fatalError, jobId }); - } - return this.doNext(client); - } catch (err: unknown) { - this.doNextTimer = setTimeout(() => this.doNext(client), this.idleDelay); - } - } - listen() { - const listenForChanges = ( - err: Error | null, - client: PoolClient, - release: () => void - ) => { - if (err) { - logger.error('Error connecting with notify listener', err); - // Try again in 5 seconds - // should this really be done in the node process? - setTimeout(this.listen, 5000); - return; - } - client.on('notification', () => { - if (this.doNextTimer) { - // Must be idle, do something! - this.doNext(client); - } - }); - client.query('LISTEN "jobs:insert"'); - client.on('error', (e: unknown) => { - logger.error('Error with database notify listener', e); - release(); - this.listen(); - }); - logger.info(`${this.workerId} connected and looking for jobs...`); - this.doNext(client); - }; - this.pgPool.connect(listenForChanges); - } -} - -export { Worker }; diff --git a/jobs/job-worker/src/run.ts b/jobs/job-worker/src/run.ts deleted file mode 100644 index 64a0631b27..0000000000 --- a/jobs/job-worker/src/run.ts +++ /dev/null @@ -1,19 +0,0 @@ -import Worker, { WorkerContext, JobRow } from './index'; -import { createLogger } from '@pgpmjs/logger'; - -const logger = createLogger('job-worker-run'); - -const worker = new Worker({ - tasks: { - hello: async ( - { pgPool, workerId }: WorkerContext, - job: JobRow - ) => { - logger.info('hello'); - await pgPool.query('select 1'); - logger.info(JSON.stringify(job, null, 2)); - } - } -}); - -worker.listen(); diff --git a/jobs/job-worker/tsconfig.esm.json b/jobs/job-worker/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/job-worker/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/job-worker/tsconfig.json b/jobs/job-worker/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/job-worker/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/jobs-examples/fields-trigger.sql b/jobs/jobs-examples/fields-trigger.sql deleted file mode 100644 index dadea84ef8..0000000000 --- a/jobs/jobs-examples/fields-trigger.sql +++ /dev/null @@ -1,84 +0,0 @@ -DROP SCHEMA IF EXISTS my_test_schema CASCADE; - -CREATE SCHEMA IF NOT EXISTS my_test_schema; - -CREATE FUNCTION my_test_schema.json_build_object_apply (arguments text[]) - RETURNS json - AS $$ -DECLARE - arg text; - _sql text; - _res json; - args text[]; -BEGIN - _sql = 'SELECT json_build_object('; - FOR arg IN - SELECT - unnest(arguments) - LOOP - args = array_append(args, format('''%s''', arg)); - END LOOP; - _sql = _sql || format('%s);', array_to_string(args, ',')); - EXECUTE _sql INTO _res; - RETURN _res; -END; -$$ -LANGUAGE 'plpgsql'; - -CREATE TABLE my_test_schema.my_table ( - id serial PRIMARY KEY, - name text NOT NULL, - val numeric DEFAULT 0 -); - -CREATE FUNCTION my_test_schema.tg_add_job_with_fields () - RETURNS TRIGGER - AS $$ -DECLARE - arg text; - fn text; - i int; - args text[]; -BEGIN - FOR i IN - SELECT - * - FROM - generate_series(1, TG_NARGS) g (i) - LOOP - IF (i = 1) THEN - fn = TG_ARGV[i - 1]; - ELSE - args = array_append(args, TG_ARGV[i - 1]); - IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN - EXECUTE format('SELECT ($1).%s::text', TG_ARGV[i - 1]) - USING NEW INTO arg; - END IF; - IF (TG_OP = 'DELETE') THEN - EXECUTE format('SELECT ($1).%s::text', TG_ARGV[i - 1]) - USING OLD INTO arg; - END IF; - args = array_append(args, arg); - END IF; - END LOOP; - PERFORM - app_jobs.add_job (fn, my_test_schema.json_build_object_apply (args)); - IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN - RETURN NEW; - END IF; - IF (TG_OP = 'DELETE') THEN - RETURN OLD; - END IF; -END; -$$ -LANGUAGE plpgsql -VOLATILE; - -CREATE TRIGGER my_trigger - AFTER INSERT ON my_test_schema.my_table - FOR EACH ROW - EXECUTE PROCEDURE my_test_schema.tg_add_job_with_fields ('example-fn', 'id', 'name', 'val'); - -INSERT INTO my_test_schema.my_table (name, val) - VALUES ('name1', 0), ('name2', 1), ('name3', 2); - diff --git a/jobs/jobs-examples/simple-trigger.sql b/jobs/jobs-examples/simple-trigger.sql deleted file mode 100644 index 9a172c0864..0000000000 --- a/jobs/jobs-examples/simple-trigger.sql +++ /dev/null @@ -1,37 +0,0 @@ -DROP SCHEMA IF EXISTS my_test_schema CASCADE; - -CREATE SCHEMA IF NOT EXISTS my_test_schema; - -CREATE TABLE my_test_schema.my_table ( - id serial PRIMARY KEY, - name text NOT NULL, - val numeric DEFAULT 0 -); - -CREATE FUNCTION my_test_schema.tg_add_job_with_row_id () - RETURNS TRIGGER - AS $$ -BEGIN - IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN - PERFORM - app_jobs.add_job (tg_argv[0], json_build_object('id', NEW.id)); - RETURN NEW; - END IF; - IF (TG_OP = 'DELETE') THEN - PERFORM - app_jobs.add_job (tg_argv[0], json_build_object('id', OLD.id)); - RETURN OLD; - END IF; -END; -$$ -LANGUAGE plpgsql -VOLATILE; - -CREATE TRIGGER my_trigger - AFTER INSERT ON my_test_schema.my_table - FOR EACH ROW - EXECUTE PROCEDURE my_test_schema.tg_add_job_with_row_id ('example-fn'); - -INSERT INTO my_test_schema.my_table (name, val) - VALUES ('name1', 0), ('name2', 1), ('name3', 2); - diff --git a/jobs/jobs-examples/to-json-trigger.sql b/jobs/jobs-examples/to-json-trigger.sql deleted file mode 100644 index 1fee4ca677..0000000000 --- a/jobs/jobs-examples/to-json-trigger.sql +++ /dev/null @@ -1,37 +0,0 @@ -DROP SCHEMA IF EXISTS my_test_schema CASCADE; - -CREATE SCHEMA IF NOT EXISTS my_test_schema; - -CREATE TABLE my_test_schema.my_table ( - id serial PRIMARY KEY, - name text NOT NULL, - val numeric DEFAULT 0 -); - -CREATE FUNCTION my_test_schema.tg_add_job_with_row () - RETURNS TRIGGER - AS $$ -BEGIN - IF (TG_OP = 'INSERT' OR TG_OP = 'UPDATE') THEN - PERFORM - app_jobs.add_job (TG_ARGV[0], to_json(NEW)); - RETURN NEW; - END IF; - IF (TG_OP = 'DELETE') THEN - PERFORM - app_jobs.add_job (TG_ARGV[0], to_json(OLD)); - RETURN OLD; - END IF; -END; -$$ -LANGUAGE plpgsql -VOLATILE; - -CREATE TRIGGER my_trigger - AFTER INSERT ON my_test_schema.my_table - FOR EACH ROW - EXECUTE PROCEDURE my_test_schema.tg_add_job_with_row ('example-fn'); - -INSERT INTO my_test_schema.my_table (name, val) - VALUES ('name1', 0), ('name2', 1), ('name3', 2); - diff --git a/jobs/knative-job-example/CHANGELOG.md b/jobs/knative-job-example/CHANGELOG.md deleted file mode 100644 index 0f862fde2f..0000000000 --- a/jobs/knative-job-example/CHANGELOG.md +++ /dev/null @@ -1,148 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.13.1...@constructive-io/knative-job-example@1.14.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.13.0...@constructive-io/knative-job-example@1.13.1) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.12.0...@constructive-io/knative-job-example@1.13.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.11.1...@constructive-io/knative-job-example@1.12.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.11.0...@constructive-io/knative-job-example@1.11.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.10.1...@constructive-io/knative-job-example@1.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.10.0...@constructive-io/knative-job-example@1.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.9.0...@constructive-io/knative-job-example@1.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.8.0...@constructive-io/knative-job-example@1.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.7.0...@constructive-io/knative-job-example@1.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.6.0...@constructive-io/knative-job-example@1.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.5.2...@constructive-io/knative-job-example@1.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.5.1...@constructive-io/knative-job-example@1.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.5.0...@constructive-io/knative-job-example@1.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.4.3...@constructive-io/knative-job-example@1.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.4.2...@constructive-io/knative-job-example@1.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.4.1...@constructive-io/knative-job-example@1.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.3.0...@constructive-io/knative-job-example@1.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.3.0...@constructive-io/knative-job-example@1.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.2.1...@constructive-io/knative-job-example@1.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.2.0...@constructive-io/knative-job-example@1.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.1.1...@constructive-io/knative-job-example@1.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [1.1.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.1.0...@constructive-io/knative-job-example@1.1.1) (2026-02-15) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@1.0.0...@constructive-io/knative-job-example@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.4.1...@constructive-io/knative-job-example@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.4.0...@constructive-io/knative-job-example@0.4.1) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [0.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.3.1...@constructive-io/knative-job-example@0.4.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.3.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.3.0...@constructive-io/knative-job-example@0.3.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -# [0.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.9...@constructive-io/knative-job-example@0.3.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.2.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.8...@constructive-io/knative-job-example@0.2.9) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.2.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.7...@constructive-io/knative-job-example@0.2.8) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.2.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.6...@constructive-io/knative-job-example@0.2.7) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.2.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.5...@constructive-io/knative-job-example@0.2.6) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.2.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.4...@constructive-io/knative-job-example@0.2.5) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## 0.2.4 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/knative-job-example - -## [0.2.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-example@0.2.2...@constructive-io/knative-job-example@0.2.3) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/knative-job-example diff --git a/jobs/knative-job-example/Dockerfile b/jobs/knative-job-example/Dockerfile deleted file mode 100644 index fa45fd2089..0000000000 --- a/jobs/knative-job-example/Dockerfile +++ /dev/null @@ -1,27 +0,0 @@ -FROM node:22-alpine - -RUN addgroup -S app && adduser -S -g app app -RUN mkdir -p /home/app - -WORKDIR /home/app -ARG NPM_TOKEN -COPY .npmrc .npmrc -COPY package.json . -COPY main /home/app/main -ENV NODE_ENV production -ENV NPM_CONFIG_LOGLEVEL warn -RUN yarn install --production -RUN rm .npmrc -RUN chown -R app:app /home/app - -ENV cgi_headers="true" -ENV fprocess="node main/index.js" -ENV mode="http" -ENV PORT 10101 -ENV upstream_url="http://127.0.0.1:10101" - -ENV exec_timeout="20s" -ENV write_timeout="25s" -ENV read_timeout="25s" - -USER app diff --git a/jobs/knative-job-example/README.md b/jobs/knative-job-example/README.md deleted file mode 100644 index cd1af44266..0000000000 --- a/jobs/knative-job-example/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# knative-job-example - -

- -

- -

- - - - - -

- diff --git a/jobs/knative-job-example/jest.config.js b/jobs/knative-job-example/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/knative-job-example/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/knative-job-example/package.json b/jobs/knative-job-example/package.json deleted file mode 100644 index 7e39562b56..0000000000 --- a/jobs/knative-job-example/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@constructive-io/knative-job-example", - "version": "1.14.0", - "description": "job example", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/knative-job-example#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "private": true, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@constructive-io/knative-job-fn": "workspace:^" - } -} diff --git a/jobs/knative-job-example/src/index.ts b/jobs/knative-job-example/src/index.ts deleted file mode 100644 index 84303ab19d..0000000000 --- a/jobs/knative-job-example/src/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createJobApp } from '@constructive-io/knative-job-fn'; - -const app = createJobApp(); - -app.post('/', async (req: any, res: any, next: any) => { - if (req.body.throw) { - next(new Error('THROWN_ERROR')); - } else { - res.status(200).json({ - fn: 'example-fn', - message: 'hi I did a lot of work', - body: req.body - }); - } -}); - -const port = Number(process.env.PORT) || 10101; -app.listen(port); diff --git a/jobs/knative-job-example/tsconfig.esm.json b/jobs/knative-job-example/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/knative-job-example/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/knative-job-example/tsconfig.json b/jobs/knative-job-example/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/knative-job-example/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/knative-job-fn/CHANGELOG.md b/jobs/knative-job-fn/CHANGELOG.md deleted file mode 100644 index c377390066..0000000000 --- a/jobs/knative-job-fn/CHANGELOG.md +++ /dev/null @@ -1,144 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -# [1.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.13.1...@constructive-io/knative-job-fn@1.14.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.13.0...@constructive-io/knative-job-fn@1.13.1) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.12.0...@constructive-io/knative-job-fn@1.13.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.11.1...@constructive-io/knative-job-fn@1.12.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.11.0...@constructive-io/knative-job-fn@1.11.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.10.1...@constructive-io/knative-job-fn@1.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.10.0...@constructive-io/knative-job-fn@1.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.9.0...@constructive-io/knative-job-fn@1.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.8.0...@constructive-io/knative-job-fn@1.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.7.0...@constructive-io/knative-job-fn@1.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.6.0...@constructive-io/knative-job-fn@1.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.5.2...@constructive-io/knative-job-fn@1.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.5.1...@constructive-io/knative-job-fn@1.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.5.0...@constructive-io/knative-job-fn@1.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.4.3...@constructive-io/knative-job-fn@1.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.4.2...@constructive-io/knative-job-fn@1.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.4.1...@constructive-io/knative-job-fn@1.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.3.0...@constructive-io/knative-job-fn@1.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.3.0...@constructive-io/knative-job-fn@1.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.2.1...@constructive-io/knative-job-fn@1.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.2.0...@constructive-io/knative-job-fn@1.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.1.1...@constructive-io/knative-job-fn@1.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [1.1.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.1.0...@constructive-io/knative-job-fn@1.1.1) (2026-02-15) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@1.0.0...@constructive-io/knative-job-fn@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.4.1...@constructive-io/knative-job-fn@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.4.0...@constructive-io/knative-job-fn@0.4.1) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [0.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.3.1...@constructive-io/knative-job-fn@0.4.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.3.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.3.0...@constructive-io/knative-job-fn@0.3.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -# [0.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.2.8...@constructive-io/knative-job-fn@0.3.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.2.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.2.7...@constructive-io/knative-job-fn@0.2.8) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.2.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.2.6...@constructive-io/knative-job-fn@0.2.7) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.2.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.2.5...@constructive-io/knative-job-fn@0.2.6) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.2.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.2.4...@constructive-io/knative-job-fn@0.2.5) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## 0.2.4 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/knative-job-fn - -## [0.2.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-fn@0.2.2...@constructive-io/knative-job-fn@0.2.3) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/knative-job-fn diff --git a/jobs/knative-job-fn/README.md b/jobs/knative-job-fn/README.md deleted file mode 100644 index b30f34c721..0000000000 --- a/jobs/knative-job-fn/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# knative-job-fn - -

- -

- -

- - - - - -

- diff --git a/jobs/knative-job-fn/jest.config.js b/jobs/knative-job-fn/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/knative-job-fn/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/knative-job-fn/package.json b/jobs/knative-job-fn/package.json deleted file mode 100644 index c970460a00..0000000000 --- a/jobs/knative-job-fn/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "@constructive-io/knative-job-fn", - "version": "1.14.0", - "description": "knative job fn", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/knative-job-fn#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@pgpmjs/logger": "workspace:^", - "express": "5.2.1" - } -} diff --git a/jobs/knative-job-fn/src/index.ts b/jobs/knative-job-fn/src/index.ts deleted file mode 100644 index 466822cd6f..0000000000 --- a/jobs/knative-job-fn/src/index.ts +++ /dev/null @@ -1,295 +0,0 @@ -import express from 'express'; -import http from 'node:http'; -import https from 'node:https'; -import { URL } from 'node:url'; -import type { Server as HttpServer } from 'http'; -import { createLogger } from '@pgpmjs/logger'; - -type JobCallbackStatus = 'success' | 'error'; - -type JobContext = { - callbackUrl: string | undefined; - workerId: string | undefined; - jobId: string | undefined; - databaseId: string | undefined; -}; - -function getHeaders(req: any) { - return { - 'x-worker-id': req.get('X-Worker-Id'), - 'x-job-id': req.get('X-Job-Id'), - 'x-database-id': req.get('X-Database-Id'), - 'x-callback-url': req.get('X-Callback-Url') - }; -} - -// Normalize callback URL so it always points at the /callback endpoint. -const normalizeCallbackUrl = (rawUrl: string): string => { - try { - const url = new URL(rawUrl); - if (!url.pathname || url.pathname === '/') { - url.pathname = '/callback'; - } - return url.toString(); - } catch { - return rawUrl; - } -}; - -const postJson = ( - urlStr: string, - headers: Record, - body: Record -): Promise => { - return new Promise((resolve, reject) => { - let url: URL; - try { - url = new URL(urlStr); - } catch (e) { - return reject(e); - } - - const isHttps = url.protocol === 'https:'; - const client = isHttps ? https : http; - - const req = client.request( - { - hostname: url.hostname, - port: url.port || (isHttps ? 443 : 80), - path: url.pathname + url.search, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - ...headers - } - }, - (res) => { - // Drain response data but ignore contents; callback server - // only uses status for debugging. - res.on('data', () => {}); - res.on('end', () => resolve()); - } - ); - - req.on('error', (err) => reject(err)); - req.write(JSON.stringify(body)); - req.end(); - }); -}; - -const sendJobCallback = async ( - ctx: JobContext, - status: JobCallbackStatus, - errorMessage?: string -) => { - const { callbackUrl, workerId, jobId, databaseId } = ctx; - if (!callbackUrl || !workerId || !jobId) { - return; - } - - const target = normalizeCallbackUrl(callbackUrl); - - const headers: Record = { - 'X-Worker-Id': workerId, - 'X-Job-Id': jobId - }; - - if (databaseId) { - headers['X-Database-Id'] = databaseId; - } - - const body: Record = { - status - }; - - if (status === 'error') { - headers['X-Job-Error'] = 'true'; - body.error = errorMessage || 'ERROR'; - } - - try { - logger.info('Sending job callback', { - status, - target: normalizeCallbackUrl(callbackUrl), - workerId, - jobId, - databaseId - }); - await postJson(target, headers, body); - } catch (err) { - logger.error('Failed to POST job callback', { - target, - status, - err - }); - } -}; - -const logger = createLogger('knative-job-fn'); - -const createJobApp = () => { - const app: any = express(); - - app.use(express.json()); - - // Basic request logging for all incoming job invocations. - app.use((req: any, res: any, next: any) => { - try { - // Log only the headers we care about plus a shallow body snapshot - const headers = getHeaders(req); - - let body: any; - if (req.body && typeof req.body === 'object') { - // Only log top-level keys to avoid exposing sensitive body contents. - body = { keys: Object.keys(req.body) }; - } else if (typeof req.body === 'string') { - // For string bodies, log only the length. - body = { length: req.body.length }; - } else { - body = undefined; - } - - logger.info('Incoming job request', { - method: req.method, - path: req.originalUrl || req.url, - headers, - body - }); - } catch { - // best-effort logging; never block the request - } - next(); - }); - - // Echo job headers back on responses for debugging/traceability. - app.use((req: any, res: any, next: any) => { - res.set({ - 'Content-Type': 'application/json', - 'X-Worker-Id': req.get('X-Worker-Id'), - 'X-Database-Id': req.get('X-Database-Id'), - 'X-Job-Id': req.get('X-Job-Id') - }); - next(); - }); - - // Attach per-request context and a finish hook to send success callbacks. - app.use((req: any, res: any, next: any) => { - const ctx: JobContext = { - callbackUrl: req.get('X-Callback-Url'), - workerId: req.get('X-Worker-Id'), - jobId: req.get('X-Job-Id'), - databaseId: req.get('X-Database-Id') - }; - - // Store on res.locals so the error middleware can also mark callbacks as sent. - res.locals = res.locals || {}; - res.locals.jobContext = ctx; - res.locals.jobCallbackSent = false; - - if (ctx.callbackUrl && ctx.workerId && ctx.jobId) { - res.on('finish', () => { - // If an error handler already sent a callback, skip. - if (res.locals.jobCallbackSent) return; - res.locals.jobCallbackSent = true; - - // Treat 4xx/5xx status codes as errors - const isError = res.statusCode >= 400; - - logger.info('Function completed', { - workerId: ctx.workerId, - jobId: ctx.jobId, - databaseId: ctx.databaseId, - statusCode: res.statusCode - }); - - if (isError) { - void sendJobCallback(ctx, 'error', `HTTP ${res.statusCode}`); - } else { - void sendJobCallback(ctx, 'success'); - } - }); - } - - next(); - }); - - return { - post: function (...args: any[]) { - return app.post.apply(app, args as any); - }, - listen: ( - port: any, - hostOrCb?: string | (() => void), - cb: () => void = () => {} - ): HttpServer => { - // NOTE Remember that Express middleware executes in order. - // You should define error handlers last, after all other middleware. - // Otherwise, your error handler won't get called - // eslint-disable-next-line no-unused-vars - app.use(async (error: any, req: any, res: any, next: any) => { - res.set({ - 'Content-Type': 'application/json', - 'X-Job-Error': true - }); - - // Mark job as having errored via callback, if available. - try { - const ctx: JobContext | undefined = res.locals?.jobContext; - if (ctx && !res.locals.jobCallbackSent) { - res.locals.jobCallbackSent = true; - await sendJobCallback(ctx, 'error', error?.message); - } - } catch (err) { - logger.error('Failed to send error callback', err); - } - - // Log the full error context for debugging. - try { - const headers = getHeaders(req); - - // Some error types (e.g. GraphQL ClientError) expose response info. - const errorDetails: any = { - message: error?.message, - name: error?.name, - stack: error?.stack - }; - - if (error?.response) { - errorDetails.response = { - status: error.response.status, - statusText: error.response.statusText, - errors: error.response.errors, - data: error.response.data - }; - } - - logger.error('Function error', { - headers, - path: req.originalUrl || req.url, - error: errorDetails - }); - } catch { - // never throw from the error logger - } - - res.status(200).json({ message: error.message }); - }); - - const host = typeof hostOrCb === 'string' ? hostOrCb : undefined; - const callback = typeof hostOrCb === 'function' ? hostOrCb : cb; - const onListen = () => { - callback(); - }; - const server = host - ? app.listen(port, host, onListen) - : app.listen(port, onListen); - - return server; - } - }; -}; - -const defaultApp = createJobApp(); - -export { createJobApp }; -export default defaultApp; diff --git a/jobs/knative-job-fn/tsconfig.esm.json b/jobs/knative-job-fn/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/knative-job-fn/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/knative-job-fn/tsconfig.json b/jobs/knative-job-fn/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/knative-job-fn/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/knative-job-server/CHANGELOG.md b/jobs/knative-job-server/CHANGELOG.md deleted file mode 100644 index 5fc59624f6..0000000000 --- a/jobs/knative-job-server/CHANGELOG.md +++ /dev/null @@ -1,268 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.16.1...@constructive-io/knative-job-server@2.16.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.16.0...@constructive-io/knative-job-server@2.16.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.15.0...@constructive-io/knative-job-server@2.16.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.6...@constructive-io/knative-job-server@2.15.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.14.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.5...@constructive-io/knative-job-server@2.14.6) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.14.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.4...@constructive-io/knative-job-server@2.14.5) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.14.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.3...@constructive-io/knative-job-server@2.14.4) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.2...@constructive-io/knative-job-server@2.14.3) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.1...@constructive-io/knative-job-server@2.14.2) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.14.0...@constructive-io/knative-job-server@2.14.1) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.13.1...@constructive-io/knative-job-server@2.14.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.13.0...@constructive-io/knative-job-server@2.13.1) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.12.1...@constructive-io/knative-job-server@2.13.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.12.0...@constructive-io/knative-job-server@2.12.1) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.11.1...@constructive-io/knative-job-server@2.12.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.11.0...@constructive-io/knative-job-server@2.11.1) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.10.1...@constructive-io/knative-job-server@2.11.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.10.0...@constructive-io/knative-job-server@2.10.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.9.0...@constructive-io/knative-job-server@2.10.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.8.0...@constructive-io/knative-job-server@2.9.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.7.0...@constructive-io/knative-job-server@2.8.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.6.0...@constructive-io/knative-job-server@2.7.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.5.4...@constructive-io/knative-job-server@2.6.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.5.3...@constructive-io/knative-job-server@2.5.4) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.5.2...@constructive-io/knative-job-server@2.5.3) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.5.1...@constructive-io/knative-job-server@2.5.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.5.0...@constructive-io/knative-job-server@2.5.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.4.4...@constructive-io/knative-job-server@2.5.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.4.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.4.3...@constructive-io/knative-job-server@2.4.4) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.4.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.4.2...@constructive-io/knative-job-server@2.4.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.4.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.4.1...@constructive-io/knative-job-server@2.4.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.3.0...@constructive-io/knative-job-server@2.4.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.3.0...@constructive-io/knative-job-server@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.2.2...@constructive-io/knative-job-server@2.3.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.2.1...@constructive-io/knative-job-server@2.2.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.2.0...@constructive-io/knative-job-server@2.2.1) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.1.0...@constructive-io/knative-job-server@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.0.1...@constructive-io/knative-job-server@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [2.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@2.0.0...@constructive-io/knative-job-server@2.0.1) (2026-02-15) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@1.1.0...@constructive-io/knative-job-server@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@1.0.0...@constructive-io/knative-job-server@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.5.1...@constructive-io/knative-job-server@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.5.0...@constructive-io/knative-job-server@0.5.1) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [0.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.4.1...@constructive-io/knative-job-server@0.5.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.4.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.4.0...@constructive-io/knative-job-server@0.4.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -# [0.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.25...@constructive-io/knative-job-server@0.4.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.25](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.24...@constructive-io/knative-job-server@0.3.25) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.24](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.23...@constructive-io/knative-job-server@0.3.24) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.23](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.22...@constructive-io/knative-job-server@0.3.23) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.22](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.21...@constructive-io/knative-job-server@0.3.22) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.21](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.20...@constructive-io/knative-job-server@0.3.21) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.20](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.19...@constructive-io/knative-job-server@0.3.20) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.19](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.18...@constructive-io/knative-job-server@0.3.19) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.18](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.17...@constructive-io/knative-job-server@0.3.18) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.17](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.16...@constructive-io/knative-job-server@0.3.17) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.16](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.15...@constructive-io/knative-job-server@0.3.16) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.15](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.14...@constructive-io/knative-job-server@0.3.15) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.14](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.13...@constructive-io/knative-job-server@0.3.14) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.12...@constructive-io/knative-job-server@0.3.13) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.11...@constructive-io/knative-job-server@0.3.12) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.10...@constructive-io/knative-job-server@0.3.11) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.9...@constructive-io/knative-job-server@0.3.10) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.8...@constructive-io/knative-job-server@0.3.9) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.7...@constructive-io/knative-job-server@0.3.8) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## 0.3.7 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/knative-job-server - -## [0.3.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-server@0.3.5...@constructive-io/knative-job-server@0.3.6) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/knative-job-server diff --git a/jobs/knative-job-server/README.md b/jobs/knative-job-server/README.md deleted file mode 100644 index 1b9077aacd..0000000000 --- a/jobs/knative-job-server/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# knative-job-server - -

- -

- -

- - - - - -

- diff --git a/jobs/knative-job-server/jest.config.js b/jobs/knative-job-server/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/knative-job-server/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/knative-job-server/package.json b/jobs/knative-job-server/package.json deleted file mode 100644 index 2fa20b3def..0000000000 --- a/jobs/knative-job-server/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "@constructive-io/knative-job-server", - "version": "2.16.2", - "description": "knative job server", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/knative-job-server#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "bin": { - "faas-job-server": "run.js" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest --passWithNoTests", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "makage": "^0.3.0" - }, - "dependencies": { - "@constructive-io/job-pg": "workspace:^", - "@constructive-io/job-utils": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "express": "5.2.1", - "pg": "8.21.0" - } -} diff --git a/jobs/knative-job-server/src/index.ts b/jobs/knative-job-server/src/index.ts deleted file mode 100644 index 2701605989..0000000000 --- a/jobs/knative-job-server/src/index.ts +++ /dev/null @@ -1,129 +0,0 @@ -import express from 'express'; -import type { Pool, PoolClient } from 'pg'; -import * as jobs from '@constructive-io/job-utils'; -import poolManager from '@constructive-io/job-pg'; -import { createLogger } from '@pgpmjs/logger'; - -type JobRequestBody = { - message?: string; - error?: string; - // allow additional fields without typing everything - [key: string]: unknown; -}; - -type JobRequest = { - get(name: string): string | undefined; - body: JobRequestBody; - url: string; - originalUrl: string; -}; - -type JobResponse = { - set(headers: Record): JobResponse; - status(code: number): JobResponse; - json(body: unknown): JobResponse; - send(body: unknown): JobResponse; -}; - -type NextFn = (err?: unknown) => void; - -type WithClientHandler = ( - client: PoolClient, - req: JobRequest, - res: JobResponse, - next: NextFn -) => Promise; - -const logger = createLogger('knative-job-server'); - -export default (pgPool: Pool = poolManager.getPool()) => { - const app = express(); - app.use(express.json()); - - const withClient = - (cb: WithClientHandler) => - async (req: JobRequest, res: JobResponse, next: NextFn) => { - const client = (await pgPool.connect()) as PoolClient; - try { - await cb(client as PoolClient, req, res, next); - } catch (e) { - next(e); - } finally { - client.release(); - } - }; - - const complete = withClient(async (client, req, res) => { - const workerId = req.get('X-Worker-Id'); - const jobIdHeader = req.get('X-Job-Id'); - - if (!workerId || !jobIdHeader) { - logger.warn('missing worker/job headers on completion callback', - { workerId, jobIdHeader } - ); - res.status(400).json({ error: 'Missing X-Worker-Id or X-Job-Id header' }); - return; - } - - logger.info(`Completed task ${jobIdHeader} with success`); - await jobs.completeJob(client, { workerId, jobId: jobIdHeader }); - - res - .set({ - 'Content-Type': 'application/json' - }) - .status(200) - .send({ workerId, jobId: jobIdHeader }); - }); - - const fail = withClient(async (client, req, res) => { - const workerId = req.get('X-Worker-Id'); - const jobIdHeader = req.get('X-Job-Id'); - - if (!workerId || !jobIdHeader) { - logger.warn('missing worker/job headers on failure callback', - { workerId, jobIdHeader } - ); - res.status(400).json({ error: 'Missing X-Worker-Id or X-Job-Id header' }); - return; - } - - const errorMessage = req.body.error || req.body.message || 'UNKNOWN_ERROR'; - - logger.error( - `Failed task ${jobIdHeader} with error: \n${errorMessage}\n\n` - ); - - await jobs.failJob(client, { - workerId, - jobId: jobIdHeader, - message: errorMessage - }); - - res.status(200).json({ workerId, jobId: jobIdHeader }); - }); - - app.post('/callback', async (req: JobRequest, res: JobResponse, next: NextFn) => { - const jobId = req.get('X-Job-Id'); - - if (typeof jobId === 'undefined') { - logger.warn('undefined JOB, what is this? healthcheck?'); - logger.debug(req.url); - logger.debug(req.originalUrl); - return res.status(200).json('OK'); - } - - if (req.get('X-Job-Error') === 'true') { - await fail(req, res, next); - } else { - await complete(req, res, next); - } - }); - - app.use((error: unknown, req: JobRequest, res: JobResponse, next: NextFn) => { - // TODO check headers for jobId and call fail? - res.status(500).json({ error }); - }); - - return app; -}; diff --git a/jobs/knative-job-server/src/run.ts b/jobs/knative-job-server/src/run.ts deleted file mode 100755 index d8cd896b32..0000000000 --- a/jobs/knative-job-server/src/run.ts +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env node - -import server from './index'; -import poolManager from '@constructive-io/job-pg'; -import { getJobsCallbackPort } from '@constructive-io/job-utils'; -import { createLogger } from '@pgpmjs/logger'; - -const logger = createLogger('knative-job-server'); -const pgPool = poolManager.getPool(); -const port = getJobsCallbackPort(); - -server(pgPool).listen(port, () => { - logger.info(`listening ON ${port}`); -}); diff --git a/jobs/knative-job-server/tsconfig.esm.json b/jobs/knative-job-server/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/knative-job-server/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/knative-job-server/tsconfig.json b/jobs/knative-job-server/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/knative-job-server/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/knative-job-service/CHANGELOG.md b/jobs/knative-job-service/CHANGELOG.md deleted file mode 100644 index dc824f6e59..0000000000 --- a/jobs/knative-job-service/CHANGELOG.md +++ /dev/null @@ -1,1009 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [3.0.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@3.0.3...@constructive-io/knative-job-service@3.0.4) (2026-07-23) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [3.0.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@3.0.2...@constructive-io/knative-job-service@3.0.3) (2026-07-23) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [3.0.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@3.0.1...@constructive-io/knative-job-service@3.0.2) (2026-07-23) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [3.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@3.0.0...@constructive-io/knative-job-service@3.0.1) (2026-07-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [3.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.7...@constructive-io/knative-job-service@3.0.0) (2026-07-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.6...@constructive-io/knative-job-service@2.27.7) (2026-07-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.5...@constructive-io/knative-job-service@2.27.6) (2026-07-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.4...@constructive-io/knative-job-service@2.27.5) (2026-07-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.3...@constructive-io/knative-job-service@2.27.4) (2026-07-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.2...@constructive-io/knative-job-service@2.27.3) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.1...@constructive-io/knative-job-service@2.27.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.27.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.27.0...@constructive-io/knative-job-service@2.27.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.27.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.26.3...@constructive-io/knative-job-service@2.27.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.26.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.26.2...@constructive-io/knative-job-service@2.26.3) (2026-07-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.26.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.26.1...@constructive-io/knative-job-service@2.26.2) (2026-07-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.26.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.26.0...@constructive-io/knative-job-service@2.26.1) (2026-07-15) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.26.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.25.3...@constructive-io/knative-job-service@2.26.0) (2026-07-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.25.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.25.2...@constructive-io/knative-job-service@2.25.3) (2026-07-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.25.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.25.1...@constructive-io/knative-job-service@2.25.2) (2026-07-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.25.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.25.0...@constructive-io/knative-job-service@2.25.1) (2026-07-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.25.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.9...@constructive-io/knative-job-service@2.25.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.8...@constructive-io/knative-job-service@2.24.9) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.7...@constructive-io/knative-job-service@2.24.8) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.6...@constructive-io/knative-job-service@2.24.7) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.5...@constructive-io/knative-job-service@2.24.6) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.4...@constructive-io/knative-job-service@2.24.5) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.3...@constructive-io/knative-job-service@2.24.4) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.2...@constructive-io/knative-job-service@2.24.3) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.1...@constructive-io/knative-job-service@2.24.2) (2026-07-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.24.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.24.0...@constructive-io/knative-job-service@2.24.1) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.24.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.23.0...@constructive-io/knative-job-service@2.24.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.23.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.22.0...@constructive-io/knative-job-service@2.23.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.22.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.21.0...@constructive-io/knative-job-service@2.22.0) (2026-06-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.21.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.11...@constructive-io/knative-job-service@2.21.0) (2026-06-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.10...@constructive-io/knative-job-service@2.20.11) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.9...@constructive-io/knative-job-service@2.20.10) (2026-06-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.8...@constructive-io/knative-job-service@2.20.9) (2026-06-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.7...@constructive-io/knative-job-service@2.20.8) (2026-06-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.6...@constructive-io/knative-job-service@2.20.7) (2026-06-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.5...@constructive-io/knative-job-service@2.20.6) (2026-06-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.4...@constructive-io/knative-job-service@2.20.5) (2026-06-07) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.3...@constructive-io/knative-job-service@2.20.4) (2026-06-06) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.2...@constructive-io/knative-job-service@2.20.3) (2026-06-06) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.1...@constructive-io/knative-job-service@2.20.2) (2026-06-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.20.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.20.0...@constructive-io/knative-job-service@2.20.1) (2026-05-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.20.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.19.4...@constructive-io/knative-job-service@2.20.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.19.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.19.3...@constructive-io/knative-job-service@2.19.4) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.19.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.19.2...@constructive-io/knative-job-service@2.19.3) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.19.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.19.1...@constructive-io/knative-job-service@2.19.2) (2026-05-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.19.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.19.0...@constructive-io/knative-job-service@2.19.1) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.19.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.7...@constructive-io/knative-job-service@2.19.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.6...@constructive-io/knative-job-service@2.18.7) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.5...@constructive-io/knative-job-service@2.18.6) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.4...@constructive-io/knative-job-service@2.18.5) (2026-05-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.3...@constructive-io/knative-job-service@2.18.4) (2026-05-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.2...@constructive-io/knative-job-service@2.18.3) (2026-05-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.1...@constructive-io/knative-job-service@2.18.2) (2026-05-15) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.18.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.18.0...@constructive-io/knative-job-service@2.18.1) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.18.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.6...@constructive-io/knative-job-service@2.18.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.17.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.5...@constructive-io/knative-job-service@2.17.6) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.17.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.4...@constructive-io/knative-job-service@2.17.5) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.17.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.3...@constructive-io/knative-job-service@2.17.4) (2026-05-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.17.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.2...@constructive-io/knative-job-service@2.17.3) (2026-05-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.17.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.1...@constructive-io/knative-job-service@2.17.2) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.17.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.17.0...@constructive-io/knative-job-service@2.17.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.17.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.6...@constructive-io/knative-job-service@2.17.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.16.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.5...@constructive-io/knative-job-service@2.16.6) (2026-05-10) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.16.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.4...@constructive-io/knative-job-service@2.16.5) (2026-05-10) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.16.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.3...@constructive-io/knative-job-service@2.16.4) (2026-05-09) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.16.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.2...@constructive-io/knative-job-service@2.16.3) (2026-05-09) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.1...@constructive-io/knative-job-service@2.16.2) (2026-05-09) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.16.0...@constructive-io/knative-job-service@2.16.1) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.15.2...@constructive-io/knative-job-service@2.16.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.15.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.15.1...@constructive-io/knative-job-service@2.15.2) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.15.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.15.0...@constructive-io/knative-job-service@2.15.1) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.14.4...@constructive-io/knative-job-service@2.15.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.14.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.14.3...@constructive-io/knative-job-service@2.14.4) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.14.2...@constructive-io/knative-job-service@2.14.3) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.14.1...@constructive-io/knative-job-service@2.14.2) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.14.0...@constructive-io/knative-job-service@2.14.1) (2026-05-07) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.13.4...@constructive-io/knative-job-service@2.14.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.13.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.13.3...@constructive-io/knative-job-service@2.13.4) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.13.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.13.2...@constructive-io/knative-job-service@2.13.3) (2026-05-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.13.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.13.1...@constructive-io/knative-job-service@2.13.2) (2026-05-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.13.0...@constructive-io/knative-job-service@2.13.1) (2026-05-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.12.1...@constructive-io/knative-job-service@2.13.0) (2026-05-04) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.12.0...@constructive-io/knative-job-service@2.12.1) (2026-05-03) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.13...@constructive-io/knative-job-service@2.12.0) (2026-04-30) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.12...@constructive-io/knative-job-service@2.11.13) (2026-04-29) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.11...@constructive-io/knative-job-service@2.11.12) (2026-04-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.10...@constructive-io/knative-job-service@2.11.11) (2026-04-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.9...@constructive-io/knative-job-service@2.11.10) (2026-04-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.8...@constructive-io/knative-job-service@2.11.9) (2026-04-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.7...@constructive-io/knative-job-service@2.11.8) (2026-04-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.6...@constructive-io/knative-job-service@2.11.7) (2026-04-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.5...@constructive-io/knative-job-service@2.11.6) (2026-04-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.4...@constructive-io/knative-job-service@2.11.5) (2026-04-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.3...@constructive-io/knative-job-service@2.11.4) (2026-04-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.2...@constructive-io/knative-job-service@2.11.3) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.1...@constructive-io/knative-job-service@2.11.2) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.11.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.11.0...@constructive-io/knative-job-service@2.11.1) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.10.3...@constructive-io/knative-job-service@2.11.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.10.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.10.2...@constructive-io/knative-job-service@2.10.3) (2026-04-16) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.10.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.10.1...@constructive-io/knative-job-service@2.10.2) (2026-04-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.10.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.10.0...@constructive-io/knative-job-service@2.10.1) (2026-04-11) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.16...@constructive-io/knative-job-service@2.10.0) (2026-04-09) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.16](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.15...@constructive-io/knative-job-service@2.9.16) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.15](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.14...@constructive-io/knative-job-service@2.9.15) (2026-04-03) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.14](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.13...@constructive-io/knative-job-service@2.9.14) (2026-04-02) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.12...@constructive-io/knative-job-service@2.9.13) (2026-04-02) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.11...@constructive-io/knative-job-service@2.9.12) (2026-04-02) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.10...@constructive-io/knative-job-service@2.9.11) (2026-04-01) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.9...@constructive-io/knative-job-service@2.9.10) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.8...@constructive-io/knative-job-service@2.9.9) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.7...@constructive-io/knative-job-service@2.9.8) (2026-03-30) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.6...@constructive-io/knative-job-service@2.9.7) (2026-03-30) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.5...@constructive-io/knative-job-service@2.9.6) (2026-03-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.4...@constructive-io/knative-job-service@2.9.5) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.3...@constructive-io/knative-job-service@2.9.4) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.2...@constructive-io/knative-job-service@2.9.3) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.1...@constructive-io/knative-job-service@2.9.2) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.9.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.9.0...@constructive-io/knative-job-service@2.9.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.7...@constructive-io/knative-job-service@2.9.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.6...@constructive-io/knative-job-service@2.8.7) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.5...@constructive-io/knative-job-service@2.8.6) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.4...@constructive-io/knative-job-service@2.8.5) (2026-03-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.3...@constructive-io/knative-job-service@2.8.4) (2026-03-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.2...@constructive-io/knative-job-service@2.8.3) (2026-03-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.1...@constructive-io/knative-job-service@2.8.2) (2026-03-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.8.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.8.0...@constructive-io/knative-job-service@2.8.1) (2026-03-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.7.2...@constructive-io/knative-job-service@2.8.0) (2026-03-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.7.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.7.1...@constructive-io/knative-job-service@2.7.2) (2026-03-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.7.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.7.0...@constructive-io/knative-job-service@2.7.1) (2026-03-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.9...@constructive-io/knative-job-service@2.7.0) (2026-03-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.8...@constructive-io/knative-job-service@2.6.9) (2026-03-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.7...@constructive-io/knative-job-service@2.6.8) (2026-03-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.6...@constructive-io/knative-job-service@2.6.7) (2026-03-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.5...@constructive-io/knative-job-service@2.6.6) (2026-03-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.4...@constructive-io/knative-job-service@2.6.5) (2026-03-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.3...@constructive-io/knative-job-service@2.6.4) (2026-03-16) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.2...@constructive-io/knative-job-service@2.6.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.1...@constructive-io/knative-job-service@2.6.2) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.6.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.6.0...@constructive-io/knative-job-service@2.6.1) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.5.4...@constructive-io/knative-job-service@2.6.0) (2026-03-14) - -### Bug Fixes - -- migrate remaining condition queries to filter, register filterBy behavior for pgCodecRelation, update schema snapshot with relation filter types ([5207254](https://github.com/constructive-io/jobs/commit/5207254ad96ec30100e93f6268137eaede1e4387)) -- update knative-job-service test query filter→where argument ([8f8c3fe](https://github.com/constructive-io/jobs/commit/8f8c3fe6e326ce95cccb847ed9ab7a5eadabd88e)) - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.5.3...@constructive-io/knative-job-service@2.5.4) (2026-03-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.5.2...@constructive-io/knative-job-service@2.5.3) (2026-03-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.5.1...@constructive-io/knative-job-service@2.5.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.4.0...@constructive-io/knative-job-service@2.5.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.4.0...@constructive-io/knative-job-service@2.5.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.3.5...@constructive-io/knative-job-service@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.3.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.3.4...@constructive-io/knative-job-service@2.3.5) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.3.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.3.3...@constructive-io/knative-job-service@2.3.4) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.3.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.3.2...@constructive-io/knative-job-service@2.3.3) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.3.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.3.1...@constructive-io/knative-job-service@2.3.2) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.3.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.3.0...@constructive-io/knative-job-service@2.3.1) (2026-03-03) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.2.5...@constructive-io/knative-job-service@2.3.0) (2026-03-01) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.2.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.2.4...@constructive-io/knative-job-service@2.2.5) (2026-03-01) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.2.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.2.3...@constructive-io/knative-job-service@2.2.4) (2026-02-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.2.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.2.2...@constructive-io/knative-job-service@2.2.3) (2026-02-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.2.1...@constructive-io/knative-job-service@2.2.2) (2026-02-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.2.0...@constructive-io/knative-job-service@2.2.1) (2026-02-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.1.2...@constructive-io/knative-job-service@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.1.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.1.1...@constructive-io/knative-job-service@2.1.2) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.1.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.1.0...@constructive-io/knative-job-service@2.1.1) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.0.1...@constructive-io/knative-job-service@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [2.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@2.0.0...@constructive-io/knative-job-service@2.0.1) (2026-02-15) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.1.1...@constructive-io/knative-job-service@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.1.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.1.0...@constructive-io/knative-job-service@1.1.1) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.6...@constructive-io/knative-job-service@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.0.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.5...@constructive-io/knative-job-service@1.0.6) (2026-01-28) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.0.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.4...@constructive-io/knative-job-service@1.0.5) (2026-01-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.0.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.3...@constructive-io/knative-job-service@1.0.4) (2026-01-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.0.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.2...@constructive-io/knative-job-service@1.0.3) (2026-01-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.0.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.1...@constructive-io/knative-job-service@1.0.2) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [1.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@1.0.0...@constructive-io/knative-job-service@1.0.1) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.11...@constructive-io/knative-job-service@1.0.0) (2026-01-24) - -### Features - -- modernize postmaster package with TypeScript Mailgun wrapper ([ac93185](https://github.com/constructive-io/jobs/commit/ac93185aadcfa7d2643d0d1736a6fb1a0b826802)) - -## [0.9.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.10...@constructive-io/knative-job-service@0.9.11) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.9...@constructive-io/knative-job-service@0.9.10) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.8...@constructive-io/knative-job-service@0.9.9) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.7...@constructive-io/knative-job-service@0.9.8) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.6...@constructive-io/knative-job-service@0.9.7) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.5...@constructive-io/knative-job-service@0.9.6) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.4...@constructive-io/knative-job-service@0.9.5) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.3...@constructive-io/knative-job-service@0.9.4) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.2...@constructive-io/knative-job-service@0.9.3) (2026-01-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.1...@constructive-io/knative-job-service@0.9.2) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.9.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.9.0...@constructive-io/knative-job-service@0.9.1) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [0.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.8.3...@constructive-io/knative-job-service@0.9.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.8.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.8.2...@constructive-io/knative-job-service@0.8.3) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.8.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.8.1...@constructive-io/knative-job-service@0.8.2) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.8.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.8.0...@constructive-io/knative-job-service@0.8.1) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [0.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.7.0...@constructive-io/knative-job-service@0.8.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [0.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.16...@constructive-io/knative-job-service@0.7.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.16](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.15...@constructive-io/knative-job-service@0.6.16) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.15](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.14...@constructive-io/knative-job-service@0.6.15) (2026-01-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.14](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.13...@constructive-io/knative-job-service@0.6.14) (2026-01-14) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.12...@constructive-io/knative-job-service@0.6.13) (2026-01-10) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.11...@constructive-io/knative-job-service@0.6.12) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.10...@constructive-io/knative-job-service@0.6.11) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.9...@constructive-io/knative-job-service@0.6.10) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.8...@constructive-io/knative-job-service@0.6.9) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.7...@constructive-io/knative-job-service@0.6.8) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.6...@constructive-io/knative-job-service@0.6.7) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.5...@constructive-io/knative-job-service@0.6.6) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.4...@constructive-io/knative-job-service@0.6.5) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.3...@constructive-io/knative-job-service@0.6.4) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.2...@constructive-io/knative-job-service@0.6.3) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.1...@constructive-io/knative-job-service@0.6.2) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.6.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.6.0...@constructive-io/knative-job-service@0.6.1) (2026-01-06) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [0.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.5.0...@constructive-io/knative-job-service@0.6.0) (2026-01-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -# [0.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.46...@constructive-io/knative-job-service@0.5.0) (2026-01-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.46](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.45...@constructive-io/knative-job-service@0.4.46) (2026-01-05) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.45](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.44...@constructive-io/knative-job-service@0.4.45) (2026-01-03) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.44](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.43...@constructive-io/knative-job-service@0.4.44) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.43](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.42...@constructive-io/knative-job-service@0.4.43) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.42](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.41...@constructive-io/knative-job-service@0.4.42) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.41](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.40...@constructive-io/knative-job-service@0.4.41) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.40](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.39...@constructive-io/knative-job-service@0.4.40) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.39](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.38...@constructive-io/knative-job-service@0.4.39) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.38](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.37...@constructive-io/knative-job-service@0.4.38) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.37](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.36...@constructive-io/knative-job-service@0.4.37) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.36](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.35...@constructive-io/knative-job-service@0.4.36) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.35](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.34...@constructive-io/knative-job-service@0.4.35) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.34](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.33...@constructive-io/knative-job-service@0.4.34) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.33](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.32...@constructive-io/knative-job-service@0.4.33) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.32](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.31...@constructive-io/knative-job-service@0.4.32) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.31](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.30...@constructive-io/knative-job-service@0.4.31) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.30](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.29...@constructive-io/knative-job-service@0.4.30) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.29](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.28...@constructive-io/knative-job-service@0.4.29) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.28](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.27...@constructive-io/knative-job-service@0.4.28) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.27](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.26...@constructive-io/knative-job-service@0.4.27) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.26](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.25...@constructive-io/knative-job-service@0.4.26) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.25](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.24...@constructive-io/knative-job-service@0.4.25) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.24](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.23...@constructive-io/knative-job-service@0.4.24) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.23](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.22...@constructive-io/knative-job-service@0.4.23) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.22](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.21...@constructive-io/knative-job-service@0.4.22) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.21](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.20...@constructive-io/knative-job-service@0.4.21) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.20](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.19...@constructive-io/knative-job-service@0.4.20) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.19](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.18...@constructive-io/knative-job-service@0.4.19) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.18](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.17...@constructive-io/knative-job-service@0.4.18) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.17](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.16...@constructive-io/knative-job-service@0.4.17) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.16](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.15...@constructive-io/knative-job-service@0.4.16) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.15](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.14...@constructive-io/knative-job-service@0.4.15) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.14](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.13...@constructive-io/knative-job-service@0.4.14) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.12...@constructive-io/knative-job-service@0.4.13) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.11...@constructive-io/knative-job-service@0.4.12) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.10...@constructive-io/knative-job-service@0.4.11) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.9...@constructive-io/knative-job-service@0.4.10) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## 0.4.9 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/knative-job-service - -## [0.4.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-service@0.4.7...@constructive-io/knative-job-service@0.4.8) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/knative-job-service diff --git a/jobs/knative-job-service/README.md b/jobs/knative-job-service/README.md deleted file mode 100644 index edd9804e60..0000000000 --- a/jobs/knative-job-service/README.md +++ /dev/null @@ -1,14 +0,0 @@ -# knative-job-service - -

- -

- -

- - - - - -

- diff --git a/jobs/knative-job-service/__fixtures__/jobs.seed.sql b/jobs/knative-job-service/__fixtures__/jobs.seed.sql deleted file mode 100644 index 66ffbc05b0..0000000000 --- a/jobs/knative-job-service/__fixtures__/jobs.seed.sql +++ /dev/null @@ -1,33 +0,0 @@ -BEGIN; - -CREATE SCHEMA IF NOT EXISTS app_public; - -CREATE TABLE IF NOT EXISTS app_public.users ( - id uuid PRIMARY KEY, - username text NOT NULL, - display_name text, - profile_picture jsonb -); - -INSERT INTO app_public.users (id, username, display_name, profile_picture) -VALUES ( - '00000000-0000-0000-0000-000000000000', - 'sender', - 'Sender', - '{"url":"https://example.com/avatar.png","mime":"image/png"}'::jsonb -) -ON CONFLICT (id) DO NOTHING; - -INSERT INTO metaschema_public.database (id, name) -VALUES ('0b22e268-16d6-582b-950a-24e108688849', 'jobs-test') -ON CONFLICT (id) DO NOTHING; - --- NOTE: no legacy services_public site/domain/theme/module rows are seeded. --- The send-email / send-verification-link cloud functions have moved to --- constructive-db; the e2e drives inline stand-ins that only validate their --- payloads, so no site-branding data is needed here. - -GRANT USAGE ON SCHEMA app_public TO administrator; -GRANT SELECT, INSERT, UPDATE, DELETE ON app_public.users TO administrator; - -COMMIT; diff --git a/jobs/knative-job-service/__tests__/jobs.e2e.test.ts b/jobs/knative-job-service/__tests__/jobs.e2e.test.ts deleted file mode 100644 index 289b7f1e23..0000000000 --- a/jobs/knative-job-service/__tests__/jobs.e2e.test.ts +++ /dev/null @@ -1,808 +0,0 @@ -import { dirname, join } from 'path'; -import { createServer, type Server as HttpServer } from 'http'; -import type { AddressInfo } from 'net'; -import supertest from 'supertest'; -import { Server as GraphQLServer } from '@constructive-io/graphql-server'; -import type { ConstructiveOptions } from '@constructive-io/graphql-types'; -import { createJobApp } from '@constructive-io/knative-job-fn'; - -import { PgpmInit, PgpmMigrate } from '@pgpmjs/core'; -import { getConnections, seed, type PgTestClient } from 'pgsql-test'; - -import type { KnativeJobsSvc as KnativeJobsSvcType } from '../src'; -import type { KnativeJobsSvcOptions } from '../src/types'; - -jest.setTimeout(120000); - -const delay = (ms: number) => - new Promise((resolve) => setTimeout(resolve, ms)); - -type GraphqlClient = { - http: ReturnType; - path: string; - host?: string; -}; - -const buildGraphqlClient = ( - rawUrl: string, - host?: string -): GraphqlClient => { - const parsed = new URL(rawUrl); - const origin = `${parsed.protocol}//${parsed.host}`; - const path = - parsed.pathname === '/' ? '/graphql' : `${parsed.pathname}${parsed.search}`; - - return { - http: supertest(origin), - path, - host - }; -}; - -const getGraphqlClient = (): GraphqlClient => { - const rawUrl = - process.env.TEST_GRAPHQL_URL || - process.env.GRAPHQL_URL || - 'http://localhost:3000/graphql'; - const host = process.env.TEST_GRAPHQL_HOST || process.env.GRAPHQL_HOST; - - return buildGraphqlClient(rawUrl, host); -}; - -const sendGraphql = async ( - client: GraphqlClient, - query: string, - variables?: Record -) => { - let req = client.http - .post(client.path) - .set('Content-Type', 'application/json'); - if (client.host) { - req = req.set('Host', client.host); - } - return req.send({ query, variables }); -}; - -const addJobMutation = ` - mutation AddJob($input: AddJobInput!) { - addJob(input: $input) { - result { - id - } - } - } -`; - -const jobByIdQuery = ` - query JobById($id: BigInt!) { - jobs(where: { id: { equalTo: $id } }, first: 1) { - nodes { - id - lastError - attempts - maxAttempts - } - } - } -`; - -const unwrapGraphqlData = ( - response: supertest.Response, - label: string -): T => { - if (response.status !== 200) { - throw new Error(`${label} failed: HTTP ${response.status}`); - } - if (response.body?.errors?.length) { - throw new Error( - `${label} failed: ${response.body.errors - .map((err: { message: string }) => err.message) - .join('; ')}` - ); - } - if (!response.body?.data) { - throw new Error(`${label} returned no data`); - } - return response.body.data as T; -}; - -type JobDetails = { - lastError?: string | null; - attempts?: number | null; - maxAttempts?: number | null; -}; - -const getJobById = async ( - client: GraphqlClient, - jobId: string | number -) => { - const response = await sendGraphql(client, jobByIdQuery, { - id: String(jobId) - }); - const data = unwrapGraphqlData<{ - jobs: { nodes: JobDetails[] }; - }>(response, 'Job query'); - const nodes = data.jobs?.nodes ?? []; - return nodes.length > 0 ? nodes[0] : null; -}; - -const waitForJobCompletion = async ( - client: GraphqlClient, - jobId: string | number -) => { - const timeoutMs = 30000; - const started = Date.now(); - - while (Date.now() - started < timeoutMs) { - const job = await getJobById(client, jobId); - - if (!job) return; - - if (job.lastError) { - const attempts = job.attempts ?? 0; - throw new Error(`Job ${jobId} failed after ${attempts} attempt(s): ${job.lastError}`); - } - - await delay(250); - } - - throw new Error(`Job ${jobId} did not complete within ${timeoutMs}ms`); -}; - -const waitForJobFailure = async ( - client: GraphqlClient, - jobId: string | number, - { - minAttempts = 1, - timeoutMs = 30000 - }: { minAttempts?: number; timeoutMs?: number } = {} -) => { - const started = Date.now(); - let lastJob: JobDetails | null = null; - - while (Date.now() - started < timeoutMs) { - const job = await getJobById(client, jobId); - - if (!job) { - throw new Error(`Job ${jobId} disappeared before failure was observed`); - } - - lastJob = job; - const attempts = job.attempts ?? 0; - - if (job.lastError && attempts >= minAttempts) { - return job; - } - - await delay(250); - } - - throw new Error( - `Job ${jobId} did not fail after ${minAttempts} attempt(s) within ${timeoutMs}ms (attempts=${ - lastJob?.attempts ?? 'unknown' - }, maxAttempts=${lastJob?.maxAttempts ?? 'unknown'}, lastError=${ - lastJob?.lastError ?? 'null' - })` - ); -}; - -const closeHttpServer = async (server?: HttpServer | null): Promise => { - if (!server || !server.listening) return; - await new Promise((resolveClose, rejectClose) => { - server.close((err) => { - if (err) { - rejectClose(err); - return; - } - resolveClose(); - }); - }); -}; - -type MailgunFailurePayload = { - to?: string; - subject?: string; - html?: string; - text?: string; - from?: string; - replyTo?: string; -}; - -const createMailgunFailureApp = () => { - const { send: sendPostmaster } = require('@constructive-io/postmaster'); - const app = createJobApp(); - - app.post('/', async (req: any, res: any, next: any) => { - try { - const payload = (req.body || {}) as MailgunFailurePayload; - const to = payload.to ?? 'user@example.com'; - const subject = payload.subject ?? 'Mailgun failure test'; - const html = payload.html ?? '

mailgun failure

'; - const from = payload.from ?? process.env.MAILGUN_FROM; - const replyTo = payload.replyTo ?? process.env.MAILGUN_REPLY; - - await sendPostmaster({ - to, - subject, - ...(html && { html }), - ...(payload.text && { text: payload.text }), - ...(from && { from }), - ...(replyTo && { replyTo }) - }); - - res.status(200).json({ complete: true }); - } catch (err) { - next(err); - } - }); - - return app; -}; - -// Inline stand-ins for the send-email / send-verification-link cloud -// functions, which have been removed from this repo (they now live in -// constructive-db). The jobs worker reaches them over HTTP via -// INTERNAL_GATEWAY_DEVELOPMENT_MAP, so these small apps let the e2e keep -// exercising the worker -> function -> callback pipeline (success + failure -// paths) without depending on the removed implementations. They mirror the -// required-field validation the real functions performed. -const createSendEmailApp = () => { - const app = createJobApp(); - - app.post('/', async (req: any, res: any, next: any) => { - try { - const payload = (req.body || {}) as { - to?: string; - subject?: string; - html?: string; - text?: string; - }; - - const requireField = (name: 'to' | 'subject'): string => { - const value = payload[name]; - if (!value) { - throw new Error(`Missing required field '${name}'`); - } - return value; - }; - - requireField('to'); - requireField('subject'); - - if (!payload.html && !payload.text) { - throw new Error("Either 'html' or 'text' must be provided"); - } - - // Dry-run in tests: validate the payload but do not send. - res.status(200).json({ complete: true }); - } catch (err) { - next(err); - } - }); - - return app; -}; - -const createSendVerificationLinkApp = () => { - const app = createJobApp(); - - app.post('/', async (req: any, res: any, next: any) => { - try { - const payload = (req.body || {}) as { - email_type?: string; - email?: string; - user_id?: string; - reset_token?: string; - }; - - const fail = (missing: string) => - res.status(400).json({ error: `Missing required field: ${missing}` }); - - if (!payload.email_type) return fail('email_type'); - if (!payload.email) return fail('email'); - - if ( - payload.email_type === 'forgot_password' && - (!payload.user_id || !payload.reset_token) - ) { - return fail('user_id_or_reset_token'); - } - - // Dry-run in tests: validate the payload but do not send. - res.status(200).json({ complete: true }); - } catch (err) { - next(err); - } - }); - - return app; -}; - -const seededDatabaseId = '0b22e268-16d6-582b-950a-24e108688849'; -const metaDbExtensions = ['citext', 'uuid-ossp', 'unaccent', 'pgcrypto', 'hstore']; - -// Allocate an ephemeral port by briefly binding to port 0, reading the -// assigned port, then closing the server so the port is free for the -// real listener. There is a small TOCTOU window, but it is sufficient -// for tests running on a single machine. -const getAvailablePort = (): Promise => - new Promise((resolve, reject) => { - const srv = createServer(); - srv.listen(0, '127.0.0.1', () => { - const { port } = srv.address() as AddressInfo; - srv.close((err) => (err ? reject(err) : resolve(port))); - }); - srv.on('error', reject); - }); - -// Ports are allocated dynamically to avoid conflicts with other -// processes that may already be listening on the well-known defaults. -let GRAPHQL_PORT: number; -let CALLBACK_PORT: number; -let SEND_EMAIL_PORT: number; -let SEND_VERIFICATION_LINK_PORT: number; -let MAILGUN_FAILURE_PORT: number; - -const getPgpmModulePath = (pkgName: string): string => - dirname(require.resolve(`${pkgName}/pgpm.plan`)); - -const metaSeedModules = [ - getPgpmModulePath('@pgpm/verify'), - getPgpmModulePath('@pgpm/types'), - getPgpmModulePath('@pgpm/inflection'), - getPgpmModulePath('@pgpm/database-jobs'), - getPgpmModulePath('@pgpm/metaschema-schema'), - getPgpmModulePath('@pgpm/services'), - getPgpmModulePath('@pgpm/metaschema-modules') -]; - -const sql = (f: string) => join(__dirname, '..', '__fixtures__', f); - -type SeededConnections = { - db: PgTestClient; - pg: PgTestClient; - teardown: () => Promise; -}; - -type PgConfigLike = PgTestClient['config']; - -const runMetaMigrations = async (config: PgConfigLike) => { - const migrator = new PgpmMigrate(config); - for (const modulePath of metaSeedModules) { - const result = await migrator.deploy({ modulePath, usePlan: true }); - if (result.failed) { - throw new Error(`Failed to deploy ${modulePath}: ${result.failed}`); - } - } -}; - -const bootstrapAdminUsers = seed.fn(async ({ admin, config, connect }) => { - const roles = connect?.roles; - const connections = connect?.connections; - - if (!roles || !connections) { - throw new Error('Missing pgpm role or connection defaults for admin users.'); - } - - const init = new PgpmInit(config); - try { - await init.bootstrapRoles(roles); - await init.bootstrapTestRoles(roles, connections); - } finally { - await init.close(); - } - - const appUser = connections.app?.user; - if (appUser) { - await admin.grantRole(roles.administrator, appUser, config.database); - } -}); - -const deployMetaModules = seed.fn(async ({ config }) => { - await runMetaMigrations(config); -}); - -const createTestDb = async (): Promise => { - const { db, pg, teardown } = await getConnections( - { db: { extensions: metaDbExtensions } }, - [ - bootstrapAdminUsers, - deployMetaModules, - seed.sqlfile([sql('jobs.seed.sql')]) - ] - ); - - return { db, pg, teardown }; -}; - - - -describe('jobs e2e', () => { - let teardown: () => Promise; - let graphqlClient: GraphqlClient; - let graphqlServer: GraphQLServer | null = null; - let databaseId = ''; - let pg: PgTestClient | undefined; - let knativeJobsSvc: KnativeJobsSvcType | null = null; - let mailgunServer: HttpServer | null = null; - let sendEmailServer: HttpServer | null = null; - let sendVerificationLinkServer: HttpServer | null = null; - const envSnapshot: Record = { - NODE_ENV: process.env.NODE_ENV, - TEST_DB: process.env.TEST_DB, - PGHOST: process.env.PGHOST, - PGPORT: process.env.PGPORT, - PGUSER: process.env.PGUSER, - PGPASSWORD: process.env.PGPASSWORD, - PGDATABASE: process.env.PGDATABASE, - TEST_DATABASE_ID: process.env.TEST_DATABASE_ID, - DEFAULT_DATABASE_ID: process.env.DEFAULT_DATABASE_ID, - TEST_GRAPHQL_URL: process.env.TEST_GRAPHQL_URL, - TEST_GRAPHQL_HOST: process.env.TEST_GRAPHQL_HOST, - GRAPHQL_URL: process.env.GRAPHQL_URL, - META_GRAPHQL_URL: process.env.META_GRAPHQL_URL, - SEND_EMAIL_DRY_RUN: process.env.SEND_EMAIL_DRY_RUN, - SEND_VERIFICATION_LINK_DRY_RUN: process.env.SEND_VERIFICATION_LINK_DRY_RUN, - LOCAL_APP_PORT: process.env.LOCAL_APP_PORT, - MAILGUN_DOMAIN: process.env.MAILGUN_DOMAIN, - MAILGUN_FROM: process.env.MAILGUN_FROM, - MAILGUN_REPLY: process.env.MAILGUN_REPLY, - MAILGUN_API_KEY: process.env.MAILGUN_API_KEY, - MAILGUN_KEY: process.env.MAILGUN_KEY, - JOBS_SUPPORT_ANY: process.env.JOBS_SUPPORT_ANY, - JOBS_SUPPORTED: process.env.JOBS_SUPPORTED, - INTERNAL_GATEWAY_DEVELOPMENT_MAP: - process.env.INTERNAL_GATEWAY_DEVELOPMENT_MAP, - INTERNAL_JOBS_CALLBACK_PORT: process.env.INTERNAL_JOBS_CALLBACK_PORT, - INTERNAL_JOBS_CALLBACK_URL: process.env.INTERNAL_JOBS_CALLBACK_URL, - FEATURES_POSTGIS: process.env.FEATURES_POSTGIS - }; - - beforeAll(async () => { - delete process.env.TEST_DB; - delete process.env.PGDATABASE; - - // Allocate dynamic ports in parallel before anything starts. - [ - GRAPHQL_PORT, - CALLBACK_PORT, - SEND_EMAIL_PORT, - SEND_VERIFICATION_LINK_PORT, - MAILGUN_FAILURE_PORT - ] = await Promise.all([ - getAvailablePort(), - getAvailablePort(), - getAvailablePort(), - getAvailablePort(), - getAvailablePort() - ]); - - ({ teardown, pg } = await createTestDb()); - if (!pg) { - throw new Error('Test database connection is missing'); - } - databaseId = seededDatabaseId; - if (pg?.oneOrNone) { - const row = await pg.oneOrNone<{ id: string }>( - 'SELECT id FROM metaschema_public.database WHERE id = $1', - [databaseId] - ); - if (!row?.id) { - throw new Error(`Seeded database id ${databaseId} was not found`); - } - } - - if (!pg?.config.database) { - throw new Error('Test database config is missing a database name'); - } - - const graphqlUrl = `http://127.0.0.1:${GRAPHQL_PORT}/graphql`; - const callbackUrl = `http://127.0.0.1:${CALLBACK_PORT}/callback`; - - process.env.NODE_ENV = 'test'; - process.env.PGDATABASE = pg.config.database; - process.env.TEST_DATABASE_ID = databaseId; - process.env.DEFAULT_DATABASE_ID = databaseId; - process.env.TEST_GRAPHQL_URL = graphqlUrl; - process.env.GRAPHQL_URL = graphqlUrl; - process.env.META_GRAPHQL_URL = graphqlUrl; - process.env.SEND_EMAIL_DRY_RUN = 'true'; - process.env.SEND_VERIFICATION_LINK_DRY_RUN = 'true'; - process.env.LOCAL_APP_PORT = String(GRAPHQL_PORT); - process.env.MAILGUN_DOMAIN = 'mg.constructive.io'; - process.env.MAILGUN_FROM = 'no-reply@mg.constructive.io'; - process.env.MAILGUN_REPLY = 'info@mg.constructive.io'; - process.env.MAILGUN_API_KEY = 'change-me-mailgun-api-key'; - process.env.MAILGUN_KEY = 'change-me-mailgun-api-key'; - process.env.JOBS_SUPPORT_ANY = 'false'; - process.env.JOBS_SUPPORTED = 'send-email,send-verification-link,mailgun-failure'; - process.env.INTERNAL_GATEWAY_DEVELOPMENT_MAP = JSON.stringify({ - 'send-email': `http://127.0.0.1:${SEND_EMAIL_PORT}`, - 'send-verification-link': `http://127.0.0.1:${SEND_VERIFICATION_LINK_PORT}`, - 'mailgun-failure': `http://127.0.0.1:${MAILGUN_FAILURE_PORT}` - }); - process.env.INTERNAL_JOBS_CALLBACK_PORT = String(CALLBACK_PORT); - process.env.INTERNAL_JOBS_CALLBACK_URL = callbackUrl; - process.env.FEATURES_POSTGIS = 'false'; - - if (pg.config.host) process.env.PGHOST = pg.config.host; - if (pg.config.port) process.env.PGPORT = String(pg.config.port); - if (pg.config.user) process.env.PGUSER = pg.config.user; - if (pg.config.password) process.env.PGPASSWORD = pg.config.password; - - const graphqlOptions: ConstructiveOptions = { - pg: { - host: pg.config.host, - port: pg.config.port, - user: pg.config.user, - password: pg.config.password, - database: pg.config.database - }, - server: { - host: '127.0.0.1', - port: GRAPHQL_PORT - }, - api: { - // Static single-tenant admin server: scoped routing off, so the - // server exposes the configured schemas directly for - // defaultDatabaseId and performs no host route resolution. Nothing - // here reads or exposes the legacy services_public schema. - enableScopedRouting: false, - exposedSchemas: [ - 'app_jobs', - 'app_public', - 'metaschema_modules_public', - 'metaschema_public' - ], - anonRole: 'administrator', - roleName: 'administrator', - defaultDatabaseId: databaseId - }, - features: { - postgis: false - } - }; - - graphqlServer = new GraphQLServer(graphqlOptions); - graphqlServer.addEventListener(); - const graphqlHttpServer = graphqlServer.listen(); - if (!graphqlHttpServer.listening) { - await new Promise((resolveListen) => { - graphqlHttpServer.once('listening', () => resolveListen()); - }); - } - - // Start the inline function stand-ins the worker reaches via the gateway - // dev map (send-email / send-verification-link now live in constructive-db). - sendEmailServer = await new Promise((resolve, reject) => { - const server = createSendEmailApp().listen(SEND_EMAIL_PORT, () => - resolve(server) - ); - server.on('error', reject); - }); - sendVerificationLinkServer = await new Promise( - (resolve, reject) => { - const server = createSendVerificationLinkApp().listen( - SEND_VERIFICATION_LINK_PORT, - () => resolve(server) - ); - server.on('error', reject); - } - ); - - const knativeJobsSvcOptions: KnativeJobsSvcOptions = { - jobs: { enabled: true } - }; - - const { KnativeJobsSvc } = await import('../src'); - knativeJobsSvc = new KnativeJobsSvc(knativeJobsSvcOptions); - await knativeJobsSvc.start(); - - graphqlClient = getGraphqlClient(); - - const mailgunApp = createMailgunFailureApp(); - mailgunServer = await new Promise((resolve, reject) => { - const server = mailgunApp.listen(MAILGUN_FAILURE_PORT, () => resolve(server)); - server.on('error', reject); - }); - }); - - afterAll(async () => { - if (knativeJobsSvc) { - await knativeJobsSvc.stop(); - } - if (graphqlServer) { - await graphqlServer.close({ closeCaches: true }); - graphqlServer = null; - } - await closeHttpServer(mailgunServer); - mailgunServer = null; - await closeHttpServer(sendEmailServer); - sendEmailServer = null; - await closeHttpServer(sendVerificationLinkServer); - sendVerificationLinkServer = null; - if (teardown) { - await teardown(); - } - for (const [key, value] of Object.entries(envSnapshot)) { - if (value === undefined) { - delete process.env[key]; - } else { - process.env[key] = value; - } - } - }); - - it('creates and processes a send-email job', async () => { - const jobInput = { - dbId: databaseId, - identifier: 'send-email', - payload: { - to: 'user@example.com', - subject: 'Jobs e2e', - html: '

jobs test

' - } - }; - - const response = await sendGraphql(graphqlClient, addJobMutation, { - input: jobInput - }); - - expect(response.status).toBe(200); - expect(response.body?.errors).toBeUndefined(); - - const jobId = response.body?.data?.addJob?.result?.id; - - expect(jobId).toBeTruthy(); - - await waitForJobCompletion(graphqlClient, jobId); - }); - - // NOTE: the send-verification-link success cases (invite_email / - // forgot_password / email_verification) previously asserted the full email - // render against site branding. The send-email and send-verification-link - // cloud functions have been removed from this repo (they now live in - // constructive-db), so their full render coverage moves there. Here the - // inline stand-ins keep the worker -> function -> callback pipeline covered: - // the send-email success/throw/retry paths above and the - // send-verification-link required-field validation path below. - it('fails send-verification-link job when required fields are missing', async () => { - const jobInput = { - dbId: databaseId, - identifier: 'send-verification-link', - maxAttempts: 1, - payload: { - email_type: 'forgot_password', - email: 'user@example.com' - // Missing: user_id, reset_token - } - }; - - const response = await sendGraphql(graphqlClient, addJobMutation, { - input: jobInput - }); - - expect(response.status).toBe(200); - expect(response.body?.errors).toBeUndefined(); - - const jobId = response.body?.data?.addJob?.result?.id; - - expect(jobId).toBeTruthy(); - - const job = await waitForJobFailure(graphqlClient, jobId, { - minAttempts: 1, - timeoutMs: 30000 - }); - - expect(job.attempts).toBe(1); - expect(job.maxAttempts).toBe(1); - expect(job.lastError).toBeTruthy(); - }); - - it('records failed jobs when a function throws', async () => { - const jobInput = { - dbId: databaseId, - identifier: 'send-email', - maxAttempts: 1, - payload: { - to: 'user@example.com', - html: '

missing subject

' - } - }; - - const response = await sendGraphql(graphqlClient, addJobMutation, { - input: jobInput - }); - - expect(response.status).toBe(200); - expect(response.body?.errors).toBeUndefined(); - - const jobId = response.body?.data?.addJob?.result?.id; - - expect(jobId).toBeTruthy(); - - const job = await waitForJobFailure(graphqlClient, jobId, { - minAttempts: 1, - timeoutMs: 30000 - }); - - expect(job.attempts).toBe(1); - expect(job.maxAttempts).toBe(1); - expect(job.lastError).toContain('Missing required field'); - }); - - it('retries failed jobs until max attempts is reached', async () => { - const jobInput = { - dbId: databaseId, - identifier: 'send-email', - maxAttempts: 2, - payload: { - to: 'user@example.com', - html: '

missing subject

' - } - }; - - const response = await sendGraphql(graphqlClient, addJobMutation, { - input: jobInput - }); - - expect(response.status).toBe(200); - expect(response.body?.errors).toBeUndefined(); - - const jobId = response.body?.data?.addJob?.result?.id; - - expect(jobId).toBeTruthy(); - - const firstFailure = await waitForJobFailure(graphqlClient, jobId, { - minAttempts: 1, - timeoutMs: 30000 - }); - - expect(firstFailure.attempts).toBe(1); - - const retried = await waitForJobFailure(graphqlClient, jobId, { - minAttempts: 2, - timeoutMs: 60000 - }); - - expect(retried.attempts).toBe(2); - expect(retried.maxAttempts).toBe(2); - expect(retried.lastError).toContain('Missing required field'); - }); - - it('records mailgun failures when dry run is disabled', async () => { - process.env.MAILGUN_API_KEY = 'invalid-mailgun-api-key'; - process.env.MAILGUN_KEY = 'invalid-mailgun-api-key'; - - const jobInput = { - dbId: databaseId, - identifier: 'mailgun-failure', - maxAttempts: 1, - payload: { - to: 'user@example.com', - subject: 'Mailgun failure test', - html: '

mailgun should reject this

' - } - }; - - const response = await sendGraphql(graphqlClient, addJobMutation, { - input: jobInput - }); - - expect(response.status).toBe(200); - expect(response.body?.errors).toBeUndefined(); - - const jobId = response.body?.data?.addJob?.result?.id; - - expect(jobId).toBeTruthy(); - - const job = await waitForJobFailure(graphqlClient, jobId, { - minAttempts: 1, - timeoutMs: 60000 - }); - - expect(job.attempts).toBe(1); - expect(job.maxAttempts).toBe(1); - expect(job.lastError).toBeTruthy(); - }); -}); diff --git a/jobs/knative-job-service/jest.config.js b/jobs/knative-job-service/jest.config.js deleted file mode 100644 index 3f680def20..0000000000 --- a/jobs/knative-job-service/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.[tj]sx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.jest.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/knative-job-service/package.json b/jobs/knative-job-service/package.json deleted file mode 100644 index 90dc565e1f..0000000000 --- a/jobs/knative-job-service/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@constructive-io/knative-job-service", - "version": "3.0.4", - "description": "knative job service", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/knative-job-service#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "bin": { - "faas-job-service": "run.js" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev", - "start": "node dist/run.js", - "dev": "ts-node --transpile-only src/run.ts", - "test": "jest", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "devDependencies": { - "@constructive-io/graphql-server": "workspace:^", - "@constructive-io/graphql-types": "workspace:^", - "@constructive-io/postmaster": "workspace:^", - "@pgpm/database-jobs": "^0.18.0", - "@pgpm/inflection": "^0.18.0", - "@pgpm/metaschema-modules": "^0.21.1", - "@pgpm/metaschema-schema": "^0.18.0", - "@pgpm/services": "^0.18.0", - "@pgpm/types": "^0.18.0", - "@pgpm/verify": "^0.18.0", - "@pgpmjs/core": "workspace:^", - "@types/supertest": "^7.2.0", - "makage": "^0.3.0", - "pgsql-test": "workspace:^", - "supertest": "^7.2.2", - "ts-node": "^10.9.2" - }, - "dependencies": { - "@constructive-io/job-pg": "workspace:^", - "@constructive-io/job-scheduler": "workspace:^", - "@constructive-io/job-utils": "workspace:^", - "@constructive-io/knative-job-fn": "workspace:^", - "@constructive-io/knative-job-server": "workspace:^", - "@constructive-io/knative-job-worker": "workspace:^", - "@pgpmjs/env": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "async-retry": "1.3.3", - "pg": "8.21.0" - } -} diff --git a/jobs/knative-job-service/src/index.ts b/jobs/knative-job-service/src/index.ts deleted file mode 100644 index b2a218c811..0000000000 --- a/jobs/knative-job-service/src/index.ts +++ /dev/null @@ -1,252 +0,0 @@ -import poolManager from '@constructive-io/job-pg'; -import Scheduler from '@constructive-io/job-scheduler'; -import { - getJobPgConfig, - getJobsCallbackPort, - getJobSchema, - getJobSupported, - getSchedulerHostname, - getWorkerHostname -} from '@constructive-io/job-utils'; -import jobServerFactory from '@constructive-io/knative-job-server'; -import Worker from '@constructive-io/knative-job-worker'; -import { parseEnvBoolean } from '@pgpmjs/env'; -import { Logger } from '@pgpmjs/logger'; -import retry from 'async-retry'; -import type { Server as HttpServer } from 'http'; -import { Client } from 'pg'; - -import { - KnativeJobsSvcOptions, - KnativeJobsSvcResult -} from './types'; - -const log = new Logger('knative-job-service'); - -type JobRunner = { - listen: () => void; - stop?: () => Promise | void; -}; - -const listenApp = async ( - app: { listen: (port: number, host?: string) => HttpServer }, - port: number, - host?: string -): Promise => - new Promise((resolveListen, rejectListen) => { - const server = host ? app.listen(port, host) : app.listen(port); - - const cleanup = () => { - server.off('listening', handleListen); - server.off('error', handleError); - }; - - const handleListen = () => { - cleanup(); - resolveListen(server); - }; - - const handleError = (err: Error) => { - cleanup(); - rejectListen(err); - }; - - server.once('listening', handleListen); - server.once('error', handleError); - }); - -const closeServer = async (server?: HttpServer | null): Promise => { - if (!server || !server.listening) return; - await new Promise((resolveClose, rejectClose) => { - server.close((err) => { - if (err) { - rejectClose(err); - return; - } - resolveClose(); - }); - }); -}; - -export class KnativeJobsSvc { - private options: KnativeJobsSvcOptions; - private started = false; - private result: KnativeJobsSvcResult = { - jobs: false - }; - private jobsHttpServer?: HttpServer; - private worker?: JobRunner; - private scheduler?: JobRunner; - private jobsPoolManager?: { close: () => Promise }; - - constructor(options: KnativeJobsSvcOptions = {}) { - this.options = options; - } - - async start(): Promise { - if (this.started) return this.result; - this.started = true; - this.result = { - jobs: false - }; - - if (this.options.jobs?.enabled) { - log.info('starting jobs service'); - await this.startJobs(); - this.result.jobs = true; - } - - return this.result; - } - - async stop(): Promise { - if (!this.started) return; - this.started = false; - - if (this.worker?.stop) { - await this.worker.stop(); - } - if (this.scheduler?.stop) { - await this.scheduler.stop(); - } - this.worker = undefined; - this.scheduler = undefined; - - await closeServer(this.jobsHttpServer); - this.jobsHttpServer = undefined; - - if (this.jobsPoolManager) { - await this.jobsPoolManager.close(); - this.jobsPoolManager = undefined; - } - } - - private async startJobs(): Promise { - const pgPool = poolManager.getPool(); - const jobsApp = jobServerFactory(pgPool); - const callbackPort = getJobsCallbackPort(); - this.jobsHttpServer = await listenApp(jobsApp, callbackPort); - - const tasks = getJobSupported(); - this.worker = new Worker({ - pgPool, - tasks, - workerId: getWorkerHostname() - }); - this.scheduler = new Scheduler({ - pgPool, - tasks, - workerId: getSchedulerHostname() - }); - - this.jobsPoolManager = poolManager; - - this.worker.listen(); - this.scheduler.listen(); - } -} - -export const buildKnativeJobsSvcOptionsFromEnv = (): KnativeJobsSvcOptions => ({ - jobs: { - enabled: parseEnvBoolean(process.env.CONSTRUCTIVE_JOBS_ENABLED) ?? true - } -}); - -export const startKnativeJobsSvcFromEnv = async (): Promise => { - const server = new KnativeJobsSvc(buildKnativeJobsSvcOptionsFromEnv()); - return server.start(); -}; - -export const startJobsServices = () => { - log.info('starting jobs services...'); - const pgPool = poolManager.getPool(); - const app = jobServerFactory(pgPool); - - const callbackPort = getJobsCallbackPort(); - const httpServer = app.listen(callbackPort, () => { - log.info(`listening ON ${callbackPort}`); - - const tasks = getJobSupported(); - - const worker = new Worker({ - pgPool, - workerId: getWorkerHostname(), - tasks - }); - - const scheduler = new Scheduler({ - pgPool, - workerId: getSchedulerHostname(), - tasks - }); - - worker.listen(); - scheduler.listen(); - }); - - return { pgPool, httpServer }; -}; - -export const waitForJobsPrereqs = async (): Promise => { - log.info('waiting for jobs prereqs'); - let client: Client | null = null; - try { - const cfg = getJobPgConfig(); - client = new Client({ - host: cfg.host, - port: cfg.port, - user: cfg.user, - password: cfg.password, - database: cfg.database - }); - await client.connect(); - const schema = getJobSchema(); - await client.query(`SELECT * FROM "${schema}".jobs LIMIT 1;`); - } catch (error) { - log.error(error); - throw new Error('jobs server boot failed...'); - } finally { - if (client) { - void client.end(); - } - } -}; - -export const bootJobs = async (): Promise => { - log.info('attempting to boot jobs'); - await retry( - async () => { - await waitForJobsPrereqs(); - }, - { - retries: 10, - factor: 2 - } - ); - - const options = buildKnativeJobsSvcOptionsFromEnv(); - - // Log startup configuration (non-sensitive values only) - const pgConfig = getJobPgConfig(); - log.info('[knative-job-service] Starting with config:', { - database: pgConfig.database, - host: pgConfig.host, - port: pgConfig.port, - schema: getJobSchema(), - callbackPort: getJobsCallbackPort(), - workerHostname: getWorkerHostname(), - schedulerHostname: getSchedulerHostname(), - supportedTasks: getJobSupported(), - jobsEnabled: options.jobs?.enabled ?? true - }); - - if (options.jobs?.enabled === false) { - log.info('jobs disabled; skipping startup'); - return; - } - - const server = new KnativeJobsSvc(options); - await server.start(); -}; - -export * from './types'; diff --git a/jobs/knative-job-service/src/run.ts b/jobs/knative-job-service/src/run.ts deleted file mode 100755 index d1b9a526da..0000000000 --- a/jobs/knative-job-service/src/run.ts +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env node - -export { bootJobs, startJobsServices, waitForJobsPrereqs } from './index'; - -import { bootJobs } from './index'; - -if (require.main === module) { - void bootJobs(); -} diff --git a/jobs/knative-job-service/src/types.ts b/jobs/knative-job-service/src/types.ts deleted file mode 100644 index a46a521789..0000000000 --- a/jobs/knative-job-service/src/types.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type JobsOptions = { - enabled?: boolean; -}; - -export type KnativeJobsSvcOptions = { - jobs?: JobsOptions; -}; - -export type KnativeJobsSvcResult = { - jobs: boolean; -}; diff --git a/jobs/knative-job-service/tsconfig.esm.json b/jobs/knative-job-service/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/knative-job-service/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/knative-job-service/tsconfig.jest.json b/jobs/knative-job-service/tsconfig.jest.json deleted file mode 100644 index 74ce50738b..0000000000 --- a/jobs/knative-job-service/tsconfig.jest.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "allowJs": true, - "isolatedModules": true - } -} diff --git a/jobs/knative-job-service/tsconfig.json b/jobs/knative-job-service/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/knative-job-service/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/jobs/knative-job-worker/CHANGELOG.md b/jobs/knative-job-worker/CHANGELOG.md deleted file mode 100644 index 992c76dced..0000000000 --- a/jobs/knative-job-worker/CHANGELOG.md +++ /dev/null @@ -1,632 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [3.0.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@3.0.3...@constructive-io/knative-job-worker@3.0.4) (2026-07-23) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [3.0.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@3.0.2...@constructive-io/knative-job-worker@3.0.3) (2026-07-23) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [3.0.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@3.0.1...@constructive-io/knative-job-worker@3.0.2) (2026-07-23) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [3.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@3.0.0...@constructive-io/knative-job-worker@3.0.1) (2026-07-22) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [3.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.20.5...@constructive-io/knative-job-worker@3.0.0) (2026-07-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.20.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.20.4...@constructive-io/knative-job-worker@2.20.5) (2026-07-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.20.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.20.3...@constructive-io/knative-job-worker@2.20.4) (2026-07-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.20.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.20.2...@constructive-io/knative-job-worker@2.20.3) (2026-07-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.20.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.20.1...@constructive-io/knative-job-worker@2.20.2) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.20.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.20.0...@constructive-io/knative-job-worker@2.20.1) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.20.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.19.3...@constructive-io/knative-job-worker@2.20.0) (2026-07-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.19.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.19.2...@constructive-io/knative-job-worker@2.19.3) (2026-07-17) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.19.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.19.1...@constructive-io/knative-job-worker@2.19.2) (2026-07-13) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.19.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.19.0...@constructive-io/knative-job-worker@2.19.1) (2026-07-13) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.19.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.8...@constructive-io/knative-job-worker@2.19.0) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.7...@constructive-io/knative-job-worker@2.18.8) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.6...@constructive-io/knative-job-worker@2.18.7) (2026-07-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.5...@constructive-io/knative-job-worker@2.18.6) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.4...@constructive-io/knative-job-worker@2.18.5) (2026-07-11) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.3...@constructive-io/knative-job-worker@2.18.4) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.2...@constructive-io/knative-job-worker@2.18.3) (2026-07-10) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.1...@constructive-io/knative-job-worker@2.18.2) (2026-07-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.18.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.18.0...@constructive-io/knative-job-worker@2.18.1) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.18.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.17.0...@constructive-io/knative-job-worker@2.18.0) (2026-06-28) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.17.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.16.5...@constructive-io/knative-job-worker@2.17.0) (2026-06-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.16.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.16.4...@constructive-io/knative-job-worker@2.16.5) (2026-06-22) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.16.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.16.3...@constructive-io/knative-job-worker@2.16.4) (2026-06-07) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.16.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.16.2...@constructive-io/knative-job-worker@2.16.3) (2026-06-06) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.16.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.16.1...@constructive-io/knative-job-worker@2.16.2) (2026-06-06) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.16.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.16.0...@constructive-io/knative-job-worker@2.16.1) (2026-06-05) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.16.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.15.2...@constructive-io/knative-job-worker@2.16.0) (2026-05-30) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.15.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.15.1...@constructive-io/knative-job-worker@2.15.2) (2026-05-29) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.15.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.15.0...@constructive-io/knative-job-worker@2.15.1) (2026-05-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.15.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.14.3...@constructive-io/knative-job-worker@2.15.0) (2026-05-23) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.14.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.14.2...@constructive-io/knative-job-worker@2.14.3) (2026-05-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.14.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.14.1...@constructive-io/knative-job-worker@2.14.2) (2026-05-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.14.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.14.0...@constructive-io/knative-job-worker@2.14.1) (2026-05-17) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.14.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.13.2...@constructive-io/knative-job-worker@2.14.0) (2026-05-14) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.13.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.13.1...@constructive-io/knative-job-worker@2.13.2) (2026-05-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.13.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.13.0...@constructive-io/knative-job-worker@2.13.1) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.13.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.12.1...@constructive-io/knative-job-worker@2.13.0) (2026-05-11) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.12.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.12.0...@constructive-io/knative-job-worker@2.12.1) (2026-05-09) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.12.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.11.0...@constructive-io/knative-job-worker@2.12.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.11.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.10.0...@constructive-io/knative-job-worker@2.11.0) (2026-05-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.10.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.9.5...@constructive-io/knative-job-worker@2.10.0) (2026-05-06) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.9.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.9.4...@constructive-io/knative-job-worker@2.9.5) (2026-05-05) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.9.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.9.3...@constructive-io/knative-job-worker@2.9.4) (2026-04-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.9.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.9.2...@constructive-io/knative-job-worker@2.9.3) (2026-04-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.9.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.9.1...@constructive-io/knative-job-worker@2.9.2) (2026-04-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.9.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.9.0...@constructive-io/knative-job-worker@2.9.1) (2026-04-19) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.8.1...@constructive-io/knative-job-worker@2.9.0) (2026-04-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.8.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.8.0...@constructive-io/knative-job-worker@2.8.1) (2026-04-11) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.8...@constructive-io/knative-job-worker@2.8.0) (2026-04-09) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.7...@constructive-io/knative-job-worker@2.7.8) (2026-04-04) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.6...@constructive-io/knative-job-worker@2.7.7) (2026-04-02) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.5...@constructive-io/knative-job-worker@2.7.6) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.4...@constructive-io/knative-job-worker@2.7.5) (2026-03-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.3...@constructive-io/knative-job-worker@2.7.4) (2026-03-28) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.2...@constructive-io/knative-job-worker@2.7.3) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.1...@constructive-io/knative-job-worker@2.7.2) (2026-03-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.7.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.7.0...@constructive-io/knative-job-worker@2.7.1) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.6.3...@constructive-io/knative-job-worker@2.7.0) (2026-03-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.6.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.6.2...@constructive-io/knative-job-worker@2.6.3) (2026-03-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.6.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.6.1...@constructive-io/knative-job-worker@2.6.2) (2026-03-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.6.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.6.0...@constructive-io/knative-job-worker@2.6.1) (2026-03-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.10...@constructive-io/knative-job-worker@2.6.0) (2026-03-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.9...@constructive-io/knative-job-worker@2.5.10) (2026-03-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.8...@constructive-io/knative-job-worker@2.5.9) (2026-03-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.7...@constructive-io/knative-job-worker@2.5.8) (2026-03-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.6...@constructive-io/knative-job-worker@2.5.7) (2026-03-17) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.5...@constructive-io/knative-job-worker@2.5.6) (2026-03-17) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.4...@constructive-io/knative-job-worker@2.5.5) (2026-03-16) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.3...@constructive-io/knative-job-worker@2.5.4) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.2...@constructive-io/knative-job-worker@2.5.3) (2026-03-15) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.5.1...@constructive-io/knative-job-worker@2.5.2) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.5.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.4.0...@constructive-io/knative-job-worker@2.5.1) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.5.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.4.0...@constructive-io/knative-job-worker@2.5.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.4.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.3.3...@constructive-io/knative-job-worker@2.4.0) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.3.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.3.2...@constructive-io/knative-job-worker@2.3.3) (2026-03-12) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.3.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.3.1...@constructive-io/knative-job-worker@2.3.2) (2026-03-04) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.3.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.3.0...@constructive-io/knative-job-worker@2.3.1) (2026-03-03) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.3.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.2.3...@constructive-io/knative-job-worker@2.3.0) (2026-03-01) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.2.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.2.2...@constructive-io/knative-job-worker@2.2.3) (2026-02-28) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.2.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.2.1...@constructive-io/knative-job-worker@2.2.2) (2026-02-28) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.2.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.2.0...@constructive-io/knative-job-worker@2.2.1) (2026-02-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.2.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.1.0...@constructive-io/knative-job-worker@2.2.0) (2026-02-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.0.1...@constructive-io/knative-job-worker@2.1.0) (2026-02-19) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [2.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@2.0.0...@constructive-io/knative-job-worker@2.0.1) (2026-02-15) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [2.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.1.1...@constructive-io/knative-job-worker@2.0.0) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [1.1.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.1.0...@constructive-io/knative-job-worker@1.1.1) (2026-02-13) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [1.1.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.0.4...@constructive-io/knative-job-worker@1.1.0) (2026-02-09) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [1.0.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.0.3...@constructive-io/knative-job-worker@1.0.4) (2026-01-28) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [1.0.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.0.2...@constructive-io/knative-job-worker@1.0.3) (2026-01-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [1.0.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.0.1...@constructive-io/knative-job-worker@1.0.2) (2026-01-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [1.0.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@1.0.0...@constructive-io/knative-job-worker@1.0.1) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [1.0.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.9.1...@constructive-io/knative-job-worker@1.0.0) (2026-01-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.9.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.9.0...@constructive-io/knative-job-worker@0.9.1) (2026-01-22) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [0.9.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.8.1...@constructive-io/knative-job-worker@0.9.0) (2026-01-20) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.8.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.8.0...@constructive-io/knative-job-worker@0.8.1) (2026-01-19) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [0.8.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.16...@constructive-io/knative-job-worker@0.8.0) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.16](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.15...@constructive-io/knative-job-worker@0.7.16) (2026-01-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.15](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.14...@constructive-io/knative-job-worker@0.7.15) (2026-01-14) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.14](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.13...@constructive-io/knative-job-worker@0.7.14) (2026-01-14) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.12...@constructive-io/knative-job-worker@0.7.13) (2026-01-10) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.11...@constructive-io/knative-job-worker@0.7.12) (2026-01-09) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.10...@constructive-io/knative-job-worker@0.7.11) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.9...@constructive-io/knative-job-worker@0.7.10) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.9](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.8...@constructive-io/knative-job-worker@0.7.9) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.7...@constructive-io/knative-job-worker@0.7.8) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.7](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.6...@constructive-io/knative-job-worker@0.7.7) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.6](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.5...@constructive-io/knative-job-worker@0.7.6) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.5](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.4...@constructive-io/knative-job-worker@0.7.5) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.4](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.3...@constructive-io/knative-job-worker@0.7.4) (2026-01-08) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.3](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.2...@constructive-io/knative-job-worker@0.7.3) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.2](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.1...@constructive-io/knative-job-worker@0.7.2) (2026-01-07) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.7.1](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.7.0...@constructive-io/knative-job-worker@0.7.1) (2026-01-06) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [0.7.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.6.0...@constructive-io/knative-job-worker@0.7.0) (2026-01-05) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -# [0.6.0](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.46...@constructive-io/knative-job-worker@0.6.0) (2026-01-05) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.46](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.45...@constructive-io/knative-job-worker@0.5.46) (2026-01-05) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.45](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.44...@constructive-io/knative-job-worker@0.5.45) (2026-01-03) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.44](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.43...@constructive-io/knative-job-worker@0.5.44) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.43](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.42...@constructive-io/knative-job-worker@0.5.43) (2026-01-02) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.42](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.41...@constructive-io/knative-job-worker@0.5.42) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.41](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.40...@constructive-io/knative-job-worker@0.5.41) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.40](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.39...@constructive-io/knative-job-worker@0.5.40) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.39](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.38...@constructive-io/knative-job-worker@0.5.39) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.38](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.37...@constructive-io/knative-job-worker@0.5.38) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.37](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.36...@constructive-io/knative-job-worker@0.5.37) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.36](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.35...@constructive-io/knative-job-worker@0.5.36) (2025-12-31) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.35](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.34...@constructive-io/knative-job-worker@0.5.35) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.34](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.33...@constructive-io/knative-job-worker@0.5.34) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.33](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.32...@constructive-io/knative-job-worker@0.5.33) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.32](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.31...@constructive-io/knative-job-worker@0.5.32) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.31](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.30...@constructive-io/knative-job-worker@0.5.31) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.30](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.29...@constructive-io/knative-job-worker@0.5.30) (2025-12-27) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.29](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.28...@constructive-io/knative-job-worker@0.5.29) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.28](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.27...@constructive-io/knative-job-worker@0.5.28) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.27](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.26...@constructive-io/knative-job-worker@0.5.27) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.26](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.25...@constructive-io/knative-job-worker@0.5.26) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.25](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.24...@constructive-io/knative-job-worker@0.5.25) (2025-12-26) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.24](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.23...@constructive-io/knative-job-worker@0.5.24) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.23](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.22...@constructive-io/knative-job-worker@0.5.23) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.22](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.21...@constructive-io/knative-job-worker@0.5.22) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.21](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.20...@constructive-io/knative-job-worker@0.5.21) (2025-12-25) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.20](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.19...@constructive-io/knative-job-worker@0.5.20) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.19](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.18...@constructive-io/knative-job-worker@0.5.19) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.18](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.17...@constructive-io/knative-job-worker@0.5.18) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.17](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.16...@constructive-io/knative-job-worker@0.5.17) (2025-12-24) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.16](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.15...@constructive-io/knative-job-worker@0.5.16) (2025-12-23) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.15](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.14...@constructive-io/knative-job-worker@0.5.15) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.14](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.13...@constructive-io/knative-job-worker@0.5.14) (2025-12-22) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.13](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.12...@constructive-io/knative-job-worker@0.5.13) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.12](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.11...@constructive-io/knative-job-worker@0.5.12) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.11](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.10...@constructive-io/knative-job-worker@0.5.11) (2025-12-21) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.10](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.9...@constructive-io/knative-job-worker@0.5.10) (2025-12-19) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## 0.5.9 (2025-12-18) - -**Note:** Version bump only for package @constructive-io/knative-job-worker - -## [0.5.8](https://github.com/constructive-io/jobs/compare/@constructive-io/knative-job-worker@0.5.7...@constructive-io/knative-job-worker@0.5.8) (2025-12-17) - -**Note:** Version bump only for package @constructive-io/knative-job-worker diff --git a/jobs/knative-job-worker/README.md b/jobs/knative-job-worker/README.md deleted file mode 100644 index 51c6f506ee..0000000000 --- a/jobs/knative-job-worker/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# knative-job-worker - -

- -

- -

- - - - - -

- -Knative-compatible job worker that uses the existing Constructive PostgreSQL job queue and job utilities, invoking HTTP functions via `KNATIVE_SERVICE_URL` (or `INTERNAL_GATEWAY_URL` as a fallback) while preserving the same headers and payload shape as the OpenFaaS worker. diff --git a/jobs/knative-job-worker/__tests__/req.test.ts b/jobs/knative-job-worker/__tests__/req.test.ts deleted file mode 100644 index a15cfbbf36..0000000000 --- a/jobs/knative-job-worker/__tests__/req.test.ts +++ /dev/null @@ -1,125 +0,0 @@ -const postMock = jest.fn(); - -jest.mock('request', () => ({ - __esModule: true, - default: { post: postMock }, - post: postMock -})); - -describe('knative request wrapper', () => { - beforeEach(() => { - jest.resetModules(); - postMock.mockReset(); - - process.env.PGUSER = 'postgres'; - process.env.PGHOST = 'localhost'; - process.env.PGPASSWORD = 'password'; - process.env.PGPORT = '5432'; - process.env.PGDATABASE = 'jobs'; - process.env.JOBS_SCHEMA = 'app_jobs'; - process.env.INTERNAL_JOBS_CALLBACK_URL = - 'http://callback.internal/jobs-complete'; - process.env.NODE_ENV = 'test'; - delete process.env.INTERNAL_GATEWAY_URL; - delete process.env.INTERNAL_GATEWAY_DEVELOPMENT_MAP; - }); - - it('uses INTERNAL_GATEWAY_URL as base and preserves headers and body', async () => { - process.env.INTERNAL_GATEWAY_URL = - 'http://gateway.internal/async-function'; - - postMock.mockImplementation( - (options: any, callback: (err: any) => void) => callback(null) - ); - - const { request } = await import('../src/req'); - - await request('example-fn', { - body: { value: 1 }, - databaseId: 'db-123', - workerId: 'worker-1', - jobId: 42 - }); - - expect(postMock).toHaveBeenCalledTimes(1); - const [options] = postMock.mock.calls[0]; - - expect(options.url).toBe( - 'http://gateway.internal/async-function/example-fn' - ); - expect(options.headers['Content-Type']).toBe('application/json'); - expect(options.headers['X-Worker-Id']).toBe('worker-1'); - expect(options.headers['X-Job-Id']).toBe(42); - expect(options.headers['X-Database-Id']).toBe('db-123'); - expect(options.headers['X-Callback-Url']).toBe( - 'http://callback.internal/jobs-complete' - ); - expect(options.body).toEqual({ value: 1 }); - }); - - it('uses default gateway URL when INTERNAL_GATEWAY_URL is not set', async () => { - - postMock.mockImplementation( - (options: any, callback: (err: any) => void) => callback(null) - ); - - const { request } = await import('../src/req'); - - await request('example-fn', { - body: { value: 2 }, - databaseId: 'db-456', - workerId: 'worker-2', - jobId: 43 - }); - - const [options] = postMock.mock.calls[0]; - expect(options.url).toBe('http://gateway:8080/example-fn'); - }); - - it('uses development map override when provided', async () => { - process.env.INTERNAL_GATEWAY_URL = - 'http://gateway.internal/async-function'; - process.env.INTERNAL_GATEWAY_DEVELOPMENT_MAP = JSON.stringify({ - 'example-fn': 'http://localhost:3000/dev-fn' - }); - process.env.NODE_ENV = 'development'; - - postMock.mockImplementation( - (options: any, callback: (err: any) => void) => callback(null) - ); - - const { request } = await import('../src/req'); - - await request('example-fn', { - body: {}, - databaseId: 'db-789', - workerId: 'worker-3', - jobId: 44 - }); - - const [options] = postMock.mock.calls[0]; - expect(options.url).toBe('http://localhost:3000/dev-fn'); - }); - - it('rejects when HTTP request errors', async () => { - process.env.INTERNAL_GATEWAY_URL = - 'http://gateway.internal/async-function'; - - postMock.mockImplementation( - (options: any, callback: (err: any) => void) => - callback(new Error('network failure')) - ); - - const { request } = await import('../src/req'); - - await expect( - request('example-fn', { - body: {}, - databaseId: 'db-000', - workerId: 'worker-4', - jobId: 45 - }) - ).rejects.toThrow('network failure'); - }); - -}); diff --git a/jobs/knative-job-worker/__tests__/worker.integration.test.ts b/jobs/knative-job-worker/__tests__/worker.integration.test.ts deleted file mode 100644 index 39c71739c1..0000000000 --- a/jobs/knative-job-worker/__tests__/worker.integration.test.ts +++ /dev/null @@ -1,170 +0,0 @@ -process.env.KNATIVE_SERVICE_URL = - process.env.KNATIVE_SERVICE_URL || 'http://knative.internal'; -process.env.INTERNAL_JOBS_CALLBACK_URL = - process.env.INTERNAL_JOBS_CALLBACK_URL || - 'http://callback.internal/jobs-complete'; - -const postMock = jest.fn(); - -jest.mock('request', () => ({ - __esModule: true, - default: { post: postMock }, - post: postMock -})); - -jest.mock('@constructive-io/job-pg', () => ({ - __esModule: true, - default: { - getPool: jest.fn(), - onClose: jest.fn(), - close: jest.fn() - } -})); - -import path from 'path'; -import { PgpmInit, PgpmMigrate } from '@pgpmjs/core'; -import { getConnections, seed, type PgTestClient } from 'pgsql-test'; -import * as jobUtils from '@constructive-io/job-utils'; -import Worker from '../src'; - -let db: PgTestClient; -let teardown: () => Promise; - -const metaDbExtensions = ['pgcrypto']; - -const getPgpmModulePath = (pkgName: string): string => - path.dirname(require.resolve(`${pkgName}/pgpm.plan`)); - -const metaSeedModules = [ - getPgpmModulePath('@pgpm/verify'), - getPgpmModulePath('@pgpm/database-jobs') -]; - -type PgConfigLike = PgTestClient['config']; - -const runMetaMigrations = async (config: PgConfigLike) => { - const migrator = new PgpmMigrate(config); - for (const modulePath of metaSeedModules) { - const result = await migrator.deploy({ modulePath, usePlan: true }); - if (result.failed) { - throw new Error(`Failed to deploy ${modulePath}: ${result.failed}`); - } - } -}; - -const bootstrapAdminUsers = seed.fn(async ({ admin, config, connect }) => { - const roles = connect?.roles; - const connections = connect?.connections; - - if (!roles || !connections) { - throw new Error('Missing pgpm role or connection defaults for admin users.'); - } - - const init = new PgpmInit(config); - try { - await init.bootstrapRoles(roles); - await init.bootstrapTestRoles(roles, connections); - } finally { - await init.close(); - } - - const appUser = connections.app?.user; - if (appUser) { - await admin.grantRole(roles.administrator, appUser, config.database); - } -}); - -const deployMetaModules = seed.fn(async ({ config }) => { - await runMetaMigrations(config); -}); - -const createTestDb = async () => { - const { db, teardown } = await getConnections( - { db: { extensions: metaDbExtensions } }, - [bootstrapAdminUsers, deployMetaModules] - ); - - return { db, teardown }; -}; - -beforeAll(async () => { - ({ db, teardown } = await createTestDb()); - db.setContext({ role: 'administrator' }); -}); - -afterAll(async () => { - await teardown(); -}); - -beforeEach(async () => { - await db.beforeEach(); - postMock.mockReset(); -}); - -afterEach(async () => { - await db.afterEach(); -}); - -describe('knative worker integration with job queue', () => { - const databaseId = '5b720132-17d5-424d-9bcb-ee7b17c13d43'; - - it('pulls a job from the queue and posts to Knative service', async () => { - const insertedJob = await db.one( - 'SELECT * FROM app_jobs.add_job($1::uuid, $2::text, $3::json);', - [databaseId, 'example-fn', { hello: 'world' }] - ); - - const worker = new Worker({ - tasks: ['example-fn'], - pgPool: {} as any, - workerId: 'worker-integration-1' - }); - - const job = await jobUtils.getJob(db as any, { - workerId: 'worker-integration-1', - supportedTaskNames: null - }); - - expect(job).toBeTruthy(); - expect(job.id).toBe(insertedJob.id); - - postMock.mockImplementation( - (options: any, callback: (err: any) => void) => callback(null) - ); - - await (worker as any).doWork(job); - - expect(postMock).toHaveBeenCalledTimes(1); - const [options] = postMock.mock.calls[0]; - expect(options.url).toBe('http://knative.internal/example-fn'); - expect(options.headers['X-Job-Id']).toBe(job.id); - expect(options.headers['X-Database-Id']).toBe(databaseId); - }); - - it('propagates errors from failed Knative calls while keeping job queue interactions intact', async () => { - await db.one( - 'SELECT * FROM app_jobs.add_job($1::uuid, $2::text, $3::json);', - [databaseId, 'example-fn', { hello: 'world' }] - ); - - const worker = new Worker({ - tasks: ['example-fn'], - pgPool: {} as any, - workerId: 'worker-integration-2' - }); - - const job = await jobUtils.getJob(db as any, { - workerId: 'worker-integration-2', - supportedTaskNames: null - }); - - postMock.mockImplementation( - (options: any, callback: (err: any) => void) => - callback(new Error('knative failure')) - ); - - await expect((worker as any).doWork(job)).rejects.toThrow( - 'knative failure' - ); - }); -}); diff --git a/jobs/knative-job-worker/jest.config.js b/jobs/knative-job-worker/jest.config.js deleted file mode 100644 index f4c0ce0475..0000000000 --- a/jobs/knative-job-worker/jest.config.js +++ /dev/null @@ -1,18 +0,0 @@ -/** @type {import('ts-jest').JestConfigWithTsJest} */ -module.exports = { - preset: 'ts-jest', - testEnvironment: 'node', - transform: { - '^.+\\.tsx?$': [ - 'ts-jest', - { - babelConfig: false, - tsconfig: 'tsconfig.json', - }, - ], - }, - transformIgnorePatterns: [`/node_modules/*`], - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - modulePathIgnorePatterns: ['dist/*'], -}; diff --git a/jobs/knative-job-worker/package.json b/jobs/knative-job-worker/package.json deleted file mode 100644 index 9edf566644..0000000000 --- a/jobs/knative-job-worker/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "@constructive-io/knative-job-worker", - "version": "3.0.4", - "description": "knative job worker", - "author": "Constructive ", - "homepage": "https://github.com/constructive-io/jobs/tree/master/packages/knative-job-worker#readme", - "license": "SEE LICENSE IN LICENSE", - "main": "index.js", - "module": "esm/index.js", - "types": "index.d.ts", - "directories": { - "lib": "src", - "test": "__tests__" - }, - "bin": { - "faas-jobs": "run.js", - "knative-jobs": "run.js" - }, - "publishConfig": { - "access": "public", - "directory": "dist" - }, - "repository": { - "type": "git", - "url": "https://github.com/constructive-io/jobs" - }, - "scripts": { - "test": "jest", - "test:watch": "jest --watch", - "test:debug": "node --inspect node_modules/.bin/jest --runInBand", - "clean": "makage clean", - "prepack": "npm run build", - "build": "makage build", - "build:dev": "makage build --dev" - }, - "bugs": { - "url": "https://github.com/constructive-io/jobs/issues" - }, - "dependencies": { - "@constructive-io/job-pg": "workspace:^", - "@constructive-io/job-utils": "workspace:^", - "@pgpmjs/logger": "workspace:^", - "pg": "8.21.0" - }, - "devDependencies": { - "@pgpm/database-jobs": "^0.18.0", - "@pgpm/verify": "^0.18.0", - "@pgpmjs/core": "workspace:^", - "makage": "^0.3.0", - "pgsql-test": "workspace:^" - } -} diff --git a/jobs/knative-job-worker/src/index.ts b/jobs/knative-job-worker/src/index.ts deleted file mode 100644 index 0089ea087c..0000000000 --- a/jobs/knative-job-worker/src/index.ts +++ /dev/null @@ -1,258 +0,0 @@ -import poolManager from '@constructive-io/job-pg'; -import * as jobs from '@constructive-io/job-utils'; -import type { PgClientLike } from '@constructive-io/job-utils'; -import type { Pool, PoolClient } from 'pg'; -import { Logger } from '@pgpmjs/logger'; -import { request as req } from './req'; - -export interface JobRow { - id: number | string; - task_identifier: string; - payload?: unknown; - database_id?: string; -} - -const log = new Logger('jobs:worker'); - -export default class Worker { - idleDelay: number; - supportedTaskNames: string[]; - workerId: string; - doNextTimer?: NodeJS.Timeout; - pgPool: Pool; - _initialized?: boolean; - listenClient?: PoolClient; - listenRelease?: () => void; - stopped?: boolean; - - constructor({ - tasks, - idleDelay = 15000, - pgPool = poolManager.getPool(), - workerId = 'worker-0' - }: { - tasks: string[]; - idleDelay?: number; - pgPool?: Pool; - workerId?: string; - }) { - /* - * idleDelay: This is how long to wait between polling for jobs. - * - * Note: this does NOT need to be short, because we use LISTEN/NOTIFY to be - * notified when new jobs are added - this is just used in the case where - * LISTEN/NOTIFY fails for whatever reason. - */ - - this.idleDelay = idleDelay; - this.supportedTaskNames = tasks; - this.workerId = workerId; - this.doNextTimer = undefined; - this.pgPool = pgPool; - poolManager.onClose(async () => { - await jobs.releaseJobs(pgPool, { workerId: this.workerId }); - }); - } - async initialize(client: PgClientLike) { - if (this._initialized === true) return; - - // release any jobs not finished from before if fatal error prevented cleanup - await jobs.releaseJobs(client, { workerId: this.workerId }); - - this._initialized = true; - await this.doNext(client); - } - async handleFatalError( - client: PgClientLike, - { - err, - fatalError, - jobId - }: { err?: Error; fatalError: unknown; jobId: JobRow['id'] } - ) { - const when = err ? `after failure '${err.message}'` : 'after success'; - log.error(`Failed to release job '${jobId}' ${when}; committing seppuku`); - await poolManager.close(); - log.error(String(fatalError)); - process.exit(1); - } - async handleError( - client: PgClientLike, - { err, job, duration }: { err: Error; job: JobRow; duration: string } - ) { - log.error( - `Failed task ${job.id} (${job.task_identifier}) with error ${err.message} (${duration}ms)` - ); - if (err.stack) { - log.debug(err.stack); - } - await jobs.failJob(client, { - workerId: this.workerId, - jobId: job.id, - message: err.message - }); - } - async handleSuccess( - client: PgClientLike, - { job, duration }: { job: JobRow; duration: string } - ) { - log.info( - `Async task ${job.id} (${job.task_identifier}) to be processed` - ); - } - async doWork(job: JobRow) { - const { payload, task_identifier } = job; - log.debug('starting work on job', { - id: job.id, - task: task_identifier, - databaseId: job.database_id - }); - if ( - !jobs.getJobSupportAny() && - !this.supportedTaskNames.includes(task_identifier) - ) { - throw new Error('Unsupported task'); - } - await req(task_identifier, { - body: payload, - databaseId: job.database_id, - workerId: this.workerId, - jobId: job.id - }); - } - async doNext(client: PgClientLike): Promise { - if (this.stopped) return; - if (!this._initialized) { - return await this.initialize(client); - } - - log.debug('checking for jobs...'); - if (this.doNextTimer) { - clearTimeout(this.doNextTimer); - this.doNextTimer = undefined; - } - try { - const job = (await jobs.getJob(client, { - workerId: this.workerId, - supportedTaskNames: jobs.getJobSupportAny() - ? null - : this.supportedTaskNames - })) as JobRow | undefined; - - if (!job || !job.id) { - if (!this.stopped) { - this.doNextTimer = setTimeout( - () => this.doNext(client), - this.idleDelay - ); - } - return; - } - const start = process.hrtime(); - - let err: Error | null = null; - try { - await this.doWork(job); - } catch (error) { - err = error as Error; - } - const durationRaw = process.hrtime(start); - const duration = ((durationRaw[0] * 1e9 + durationRaw[1]) / 1e6).toFixed( - 2 - ); - const jobId = job.id; - try { - if (err) { - await this.handleError(client, { err, job, duration }); - } else { - await this.handleSuccess(client, { job, duration }); - } - } catch (fatalError: unknown) { - await this.handleFatalError(client, { err, fatalError, jobId }); - } - if (!this.stopped) { - return this.doNext(client); - } - return; - } catch (err: unknown) { - if (!this.stopped) { - this.doNextTimer = setTimeout( - () => this.doNext(client), - this.idleDelay - ); - } - } - } - async listen(): Promise { - if (this.stopped) return; - let client: PoolClient; - let release: () => void; - try { - client = await this.pgPool.connect(); - release = () => client.release(); - } catch (err) { - log.error('Error connecting with notify listener', err); - if (err instanceof Error && err.stack) { - log.debug(err.stack); - } - if (!this.stopped) { - setTimeout(() => this.listen(), 5000); - } - return; - } - if (this.stopped) { - release(); - return; - } - this.listenClient = client; - this.listenRelease = release; - client.on('notification', () => { - if (this.doNextTimer) { - // Must be idle, do something! - this.doNext(client); - } - }); - client.query('LISTEN "jobs:insert"'); - client.on('error', (e: unknown) => { - if (this.stopped) { - release(); - return; - } - log.error('Error with database notify listener', e); - if (e instanceof Error && e.stack) { - log.debug(e.stack); - } - release(); - if (!this.stopped) { - this.listen(); - } - }); - log.info(`${this.workerId} connected and looking for jobs...`); - this.doNext(client); - } - - async stop(): Promise { - this.stopped = true; - if (this.doNextTimer) { - clearTimeout(this.doNextTimer); - this.doNextTimer = undefined; - } - const client = this.listenClient; - const release = this.listenRelease; - this.listenClient = undefined; - this.listenRelease = undefined; - - if (client && release) { - client.removeAllListeners('notification'); - client.removeAllListeners('error'); - try { - await client.query('UNLISTEN "jobs:insert"'); - } catch { - // Ignore listener cleanup errors during shutdown. - } - release(); - } - } -} - -export { Worker }; diff --git a/jobs/knative-job-worker/src/req.ts b/jobs/knative-job-worker/src/req.ts deleted file mode 100644 index 7d66ec5a0e..0000000000 --- a/jobs/knative-job-worker/src/req.ts +++ /dev/null @@ -1,104 +0,0 @@ -import http from 'node:http'; -import https from 'node:https'; -import { URL } from 'node:url'; -import { - getCallbackBaseUrl, - getJobGatewayConfig, - getJobGatewayDevMap, - getNodeEnvironment -} from '@constructive-io/job-utils'; -import { Logger } from '@pgpmjs/logger'; - -const log = new Logger('jobs:req'); - -// callback URL for job completion -const completeUrl = getCallbackBaseUrl(); - -// Development override map (e.g. point a function name at localhost) -const nodeEnv = getNodeEnvironment(); -const DEV_MAP = nodeEnv !== 'production' ? getJobGatewayDevMap() : null; - -const getFunctionUrl = (fn: string): string => { - if (DEV_MAP && DEV_MAP[fn]) { - return DEV_MAP[fn] || completeUrl; - } - - const { gatewayUrl } = getJobGatewayConfig(); - const base = gatewayUrl.replace(/\/$/, ''); - return `${base}/${fn}`; -}; - -interface RequestOptions { - body: unknown; - databaseId: string; - workerId: string; - jobId: string | number; -} - -const request = ( - fn: string, - { body, databaseId, workerId, jobId }: RequestOptions -) => { - const url = getFunctionUrl(fn); - log.info(`dispatching job`, { - fn, - url, - callbackUrl: completeUrl, - workerId, - jobId, - databaseId - }); - return new Promise((resolve, reject) => { - let parsed: URL; - try { - parsed = new URL(url); - } catch (e) { - return reject(e); - } - - const isHttps = parsed.protocol === 'https:'; - const client = isHttps ? https : http; - const payload = JSON.stringify(body); - - const req = client.request( - { - hostname: parsed.hostname, - port: parsed.port || (isHttps ? 443 : 80), - path: parsed.pathname + parsed.search, - method: 'POST', - headers: { - 'Content-Type': 'application/json', - 'Content-Length': Buffer.byteLength(payload), - - // these are used by job-worker/job-fn - 'X-Worker-Id': workerId, - 'X-Job-Id': String(jobId), - 'X-Database-Id': databaseId, - - // async HTTP completion callback - 'X-Callback-Url': completeUrl - } - }, - (res) => { - res.on('data', () => {}); - res.on('end', () => { - log.debug(`request success for job[${jobId}] fn[${fn}]`); - resolve(true); - }); - } - ); - - req.on('error', (error) => { - log.error(`request error for job[${jobId}] fn[${fn}]`, error); - if (error.stack) { - log.debug(error.stack); - } - reject(error); - }); - - req.write(payload); - req.end(); - }); -}; - -export { request }; diff --git a/jobs/knative-job-worker/src/run.ts b/jobs/knative-job-worker/src/run.ts deleted file mode 100755 index 3b2668b29e..0000000000 --- a/jobs/knative-job-worker/src/run.ts +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env node - -import Worker from './index'; -import poolManager from '@constructive-io/job-pg'; -import { - getWorkerHostname, - getJobSupported -} from '@constructive-io/job-utils'; - -const pgPool = poolManager.getPool(); - -const worker = new Worker({ - pgPool, - workerId: getWorkerHostname(), - tasks: getJobSupported() -}); - -worker.listen(); diff --git a/jobs/knative-job-worker/tsconfig.esm.json b/jobs/knative-job-worker/tsconfig.esm.json deleted file mode 100644 index 800d7506d3..0000000000 --- a/jobs/knative-job-worker/tsconfig.esm.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "dist/esm", - "module": "es2022", - "rootDir": "src/", - "declaration": false - } -} diff --git a/jobs/knative-job-worker/tsconfig.json b/jobs/knative-job-worker/tsconfig.json deleted file mode 100644 index ff3d2981b6..0000000000 --- a/jobs/knative-job-worker/tsconfig.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "outDir": "dist", - "rootDir": "src/" - }, - "include": ["src/**/*.ts", "../../types/**/*.d.ts"], - "exclude": ["dist", "node_modules", "**/*.spec.*", "**/*.test.*"] -} diff --git a/packages/cli/package.json b/packages/cli/package.json index c9fa9cee65..b99c5a0267 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -50,7 +50,6 @@ "@constructive-io/graphql-explorer": "workspace:^", "@constructive-io/graphql-server": "workspace:^", "@constructive-io/graphql-types": "workspace:^", - "@constructive-io/knative-job-service": "workspace:^", "@inquirerer/utils": "^3.3.9", "@pgpmjs/core": "workspace:^", "@pgpmjs/logger": "workspace:^", diff --git a/packages/cli/src/commands.ts b/packages/cli/src/commands.ts index 12444bab09..c4cffea298 100644 --- a/packages/cli/src/commands.ts +++ b/packages/cli/src/commands.ts @@ -6,7 +6,6 @@ import codegen from './commands/codegen'; import context from './commands/context'; import execute from './commands/execute'; import explorer from './commands/explorer'; -import jobs from './commands/jobs'; import server from './commands/server'; import { usageText } from './utils'; @@ -15,7 +14,6 @@ const createCommandMap = (): Record => { server, explorer, codegen, - jobs, context, auth, execute, diff --git a/packages/cli/src/commands/jobs.ts b/packages/cli/src/commands/jobs.ts deleted file mode 100644 index 6d112716b7..0000000000 --- a/packages/cli/src/commands/jobs.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { - KnativeJobsSvc, - KnativeJobsSvcOptions -} from '@constructive-io/knative-job-service'; -import { existsSync } from 'fs'; -import { cliExitWithError, CLIOptions, extractFirst,Inquirerer, Question } from 'inquirerer'; -import { resolve } from 'path'; - -const jobsUsageText = ` -Constructive Jobs: - - cnc jobs [OPTIONS] - - Start or manage Constructive jobs services. - -Subcommands: - up Start jobs runtime (worker + scheduler + callback server) - -Options: - --help, -h Show this help message - --cwd Working directory (default: current directory) - --with-jobs-server Enable jobs server (default: disabled; flag-only) - -Examples: - cnc jobs up - cnc jobs up --cwd /path/to/constructive - cnc jobs up --with-jobs-server -`; - -const questions: Question[] = [ - { - name: 'withJobsServer', - alias: 'with-jobs-server', - message: 'Enable jobs server?', - type: 'confirm', - required: false, - default: false, - useDefault: true - } -]; - -const ensureCwd = (cwd: string): string => { - const resolved = resolve(cwd); - if (!existsSync(resolved)) { - throw new Error(`Working directory does not exist: ${resolved}`); - } - process.chdir(resolved); - return resolved; -}; - -const buildKnativeJobsSvcOptions = ( - args: Partial> -): KnativeJobsSvcOptions => ({ - jobs: { enabled: args.withJobsServer === true } -}); - -export default async ( - argv: Partial>, - prompter: Inquirerer, - _options: CLIOptions -) => { - if (argv.help || argv.h) { - console.log(jobsUsageText); - process.exit(0); - } - - const { first: subcommand, newArgv } = extractFirst(argv); - const args = newArgv as Partial>; - - if (!subcommand) { - console.log(jobsUsageText); - await cliExitWithError('No subcommand provided. Use "up".'); - return; - } - - switch (subcommand) { - case 'up': { - try { - ensureCwd((args.cwd as string) || process.cwd()); - const promptAnswers = await prompter.prompt(args, questions); - const server = new KnativeJobsSvc(buildKnativeJobsSvcOptions(promptAnswers)); - await server.start(); - } catch (error) { - await cliExitWithError( - `Failed to start jobs runtime: ${(error as Error).message}` - ); - } - break; - } - - default: - console.log(jobsUsageText); - await cliExitWithError(`Unknown subcommand: ${subcommand}. Use "up".`); - } -}; diff --git a/packages/cli/src/utils/display.ts b/packages/cli/src/utils/display.ts index 83e5f05ee1..9add60e7fd 100644 --- a/packages/cli/src/utils/display.ts +++ b/packages/cli/src/utils/display.ts @@ -11,9 +11,6 @@ export const usageText = ` Code Generation: codegen Generate TypeScript types and SDK from GraphQL schema - Jobs: - jobs up Start combined server (jobs runtime) - Execution Engine: context Manage contexts (create, list, use, current, delete) auth Manage authentication (set-token, status, logout) @@ -34,7 +31,6 @@ export const usageText = ` cnc explorer Launch GraphiQL explorer cnc codegen --schema schema.graphql Generate types from schema cnc codegen --schema-enabled --output ./schemas Export schema SDL - cnc jobs up Start combined server (jobs runtime) # Execution Engine cnc context create my-api --endpoint https://api.example.com/graphql diff --git a/pgpm/env/__tests__/__snapshots__/merge.test.ts.snap b/pgpm/env/__tests__/__snapshots__/merge.test.ts.snap index b8d5da03e9..3d29dc0a79 100644 --- a/pgpm/env/__tests__/__snapshots__/merge.test.ts.snap +++ b/pgpm/env/__tests__/__snapshots__/merge.test.ts.snap @@ -48,38 +48,6 @@ exports[`getEnvOptions merges defaults, config, env, and overrides 1`] = ` "verbose": false, }, "extensionsDir": "extensions", - "jobs": { - "gateway": { - "callbackPort": 12345, - "callbackUrl": "http://callback:12345", - "gatewayUrl": "http://gateway:8080", - }, - "scheduler": { - "gracefulShutdown": true, - "hostname": "scheduler-0", - "pollInterval": 1000, - "schema": "app_jobs", - "supportAny": false, - "supported": [ - "alpha", - "beta", - ], - }, - "schema": { - "schema": "app_jobs", - }, - "worker": { - "gracefulShutdown": true, - "hostname": "worker-0", - "pollInterval": 1000, - "schema": "app_jobs", - "supportAny": false, - "supported": [ - "alpha", - "beta", - ], - }, - }, "migrations": { "codegen": { "useTx": false, diff --git a/pgpm/env/__tests__/assert.test.ts b/pgpm/env/__tests__/assert.test.ts index 7b3e9582c5..e4648f6204 100644 --- a/pgpm/env/__tests__/assert.test.ts +++ b/pgpm/env/__tests__/assert.test.ts @@ -43,8 +43,6 @@ describe('findUnsafeProductionDefaults', () => { expect(joined).toContain('cdn.awsSecretKey'); expect(joined).toContain('db.connections.app.password'); expect(joined).toContain('pg.host'); - expect(joined).toContain('jobs.gateway.gatewayUrl'); - expect(joined).toContain('jobs.gateway.callbackUrl'); // Never leak the value itself (paths mention ".password", but never the // actual secret/host strings baked into pgpmDefaults). expect(joined).not.toContain('app_password'); @@ -52,8 +50,6 @@ describe('findUnsafeProductionDefaults', () => { expect(joined).not.toContain('minioadmin'); expect(joined).not.toContain('localhost'); expect(joined).not.toContain('test-bucket'); - expect(joined).not.toContain('http://gateway'); - expect(joined).not.toContain('http://callback'); }); it('reports no issues when every sensitive field is overridden', () => { diff --git a/pgpm/env/__tests__/merge.test.ts b/pgpm/env/__tests__/merge.test.ts index 333b92e7b5..8924d0b4ec 100644 --- a/pgpm/env/__tests__/merge.test.ts +++ b/pgpm/env/__tests__/merge.test.ts @@ -153,9 +153,7 @@ describe('getEnvOptions', () => { DB_CONNECTIONS_APP_PASSWORD: 'env-app-pass', DB_CONNECTIONS_ADMIN_USER: 'env-admin-user', PORT: '7777', - DEPLOYMENT_FAST: 'false', - JOBS_SUPPORT_ANY: 'false', - JOBS_SUPPORTED: 'alpha,beta' + DEPLOYMENT_FAST: 'false' }; const result = getEnvOptions( @@ -187,34 +185,17 @@ describe('getEnvOptions', () => { db: { extensions: ['uuid', 'postgis'] }, - jobs: { - worker: { - supported: ['alpha', 'beta'] - }, - scheduler: { - supported: ['beta', 'gamma'] - } - }, packages: ['testing/*', 'packages/*'] }); const testEnv: NodeJS.ProcessEnv = { - DB_EXTENSIONS: 'postgis,pgcrypto', - JOBS_SUPPORTED: 'beta,gamma,delta' + DB_EXTENSIONS: 'postgis,pgcrypto' }; const overrides: PgpmOptionsWithPackages = { db: { extensions: ['uuid', 'hstore'] }, - jobs: { - worker: { - supported: ['delta', 'epsilon'] - }, - scheduler: { - supported: ['gamma', 'zeta'] - } - }, packages: ['testing/*', 'extensions/*'] }; @@ -222,8 +203,6 @@ describe('getEnvOptions', () => { // Arrays are replaced, not merged - overrides win completely expect(result.db?.extensions).toEqual(['uuid', 'hstore']); - expect(result.jobs?.worker?.supported).toEqual(['delta', 'epsilon']); - expect(result.jobs?.scheduler?.supported).toEqual(['gamma', 'zeta']); expect(result.packages).toEqual(['testing/*', 'extensions/*']); }); @@ -271,9 +250,7 @@ describe('getEnvOptions', () => { AWS_SECRET_KEY: 'realsecret', CDN_ENDPOINT: 'https://s3.example.com', CDN_PUBLIC_URL_PREFIX: 'https://cdn.example.com', - BUCKET_NAME: 'prod-bucket', - INTERNAL_GATEWAY_URL: 'http://gateway.internal:8080', - INTERNAL_JOBS_CALLBACK_URL: 'http://callback.internal:12345' + BUCKET_NAME: 'prod-bucket' }; expect(() => getEnvOptions({}, emptyCwd(), safeEnv)).not.toThrow(); }); diff --git a/pgpm/env/src/assert.ts b/pgpm/env/src/assert.ts index 77679ff2d6..efdfb4683b 100644 --- a/pgpm/env/src/assert.ts +++ b/pgpm/env/src/assert.ts @@ -42,9 +42,7 @@ const SENSITIVE_FIELDS: SensitiveField[] = [ { path: 'server.host', severity: 'host', envHint: 'SERVER_HOST' }, { path: 'cdn.endpoint', severity: 'host', envHint: 'CDN_ENDPOINT' }, { path: 'cdn.publicUrlPrefix', severity: 'host', envHint: 'CDN_PUBLIC_URL_PREFIX' }, - { path: 'cdn.bucketName', severity: 'host', envHint: 'BUCKET_NAME' }, - { path: 'jobs.gateway.gatewayUrl', severity: 'host', envHint: 'INTERNAL_GATEWAY_URL' }, - { path: 'jobs.gateway.callbackUrl', severity: 'host', envHint: 'INTERNAL_JOBS_CALLBACK_URL' } + { path: 'cdn.bucketName', severity: 'host', envHint: 'BUCKET_NAME' } ]; const getPath = (obj: unknown, path: string): unknown => diff --git a/pgpm/env/src/env.ts b/pgpm/env/src/env.ts index ab8711e82d..9ba7cf2ce8 100644 --- a/pgpm/env/src/env.ts +++ b/pgpm/env/src/env.ts @@ -56,14 +56,6 @@ export const getEnvVars = (env: NodeJS.ProcessEnv = process.env): PgpmOptions => MIGRATIONS_CODEGEN_USE_TX, - // Jobs-related env vars - JOBS_SCHEMA, - JOBS_SUPPORT_ANY, - JOBS_SUPPORTED, - INTERNAL_GATEWAY_URL, - INTERNAL_JOBS_CALLBACK_URL, - INTERNAL_JOBS_CALLBACK_PORT, - // Error output formatting env vars PGPM_ERROR_QUERY_HISTORY_LIMIT, PGPM_ERROR_MAX_LENGTH, @@ -156,46 +148,6 @@ export const getEnvVars = (env: NodeJS.ProcessEnv = process.env): PgpmOptions => } }), }, - jobs: { - ...(JOBS_SCHEMA && { - schema: { - schema: JOBS_SCHEMA - } - }), - ...((JOBS_SUPPORT_ANY || JOBS_SUPPORTED) && { - worker: { - ...(JOBS_SUPPORT_ANY && { - supportAny: parseEnvBoolean(JOBS_SUPPORT_ANY) - }), - ...(JOBS_SUPPORTED && { - supported: parseEnvList(JOBS_SUPPORTED) - }) - }, - scheduler: { - ...(JOBS_SUPPORT_ANY && { - supportAny: parseEnvBoolean(JOBS_SUPPORT_ANY) - }), - ...(JOBS_SUPPORTED && { - supported: parseEnvList(JOBS_SUPPORTED) - }) - } - }), - ...((INTERNAL_GATEWAY_URL || - INTERNAL_JOBS_CALLBACK_URL || - INTERNAL_JOBS_CALLBACK_PORT) && { - gateway: { - ...(INTERNAL_GATEWAY_URL && { - gatewayUrl: INTERNAL_GATEWAY_URL - }), - ...(INTERNAL_JOBS_CALLBACK_URL && { - callbackUrl: INTERNAL_JOBS_CALLBACK_URL - }), - ...(INTERNAL_JOBS_CALLBACK_PORT && { - callbackPort: parseEnvNumber(INTERNAL_JOBS_CALLBACK_PORT) - }) - } - }) - }, errorOutput: { ...(PGPM_ERROR_QUERY_HISTORY_LIMIT && { queryHistoryLimit: parseEnvNumber(PGPM_ERROR_QUERY_HISTORY_LIMIT) }), ...(PGPM_ERROR_MAX_LENGTH && { maxLength: parseEnvNumber(PGPM_ERROR_MAX_LENGTH) }), diff --git a/pgpm/types/src/index.ts b/pgpm/types/src/index.ts index 9b2ae3f529..1774034210 100644 --- a/pgpm/types/src/index.ts +++ b/pgpm/types/src/index.ts @@ -3,5 +3,4 @@ export * from './error'; export * from './error-factory'; export * from './pg-error-format'; export * from './pgpm'; -export * from './jobs'; export * from './update'; diff --git a/pgpm/types/src/jobs.ts b/pgpm/types/src/jobs.ts deleted file mode 100644 index feeb2ca083..0000000000 --- a/pgpm/types/src/jobs.ts +++ /dev/null @@ -1,206 +0,0 @@ -/** - * Job schema configuration - */ -export interface JobSchemaConfig { - /** PostgreSQL schema name for job tables and functions (defaults to 'app_jobs') */ - schema: string; -} - -/** - * Worker/Scheduler hostname configuration - */ -export interface JobHostnameConfig { - /** Unique identifier for the worker or scheduler instance */ - hostname: string; -} - -/** - * Job task support configuration - */ -export interface JobTaskSupportConfig { - /** Whether to support any/all task types (defaults to true) */ - supportAny: boolean; - /** Array of explicitly supported task names */ - supported: string[]; -} - -/** - * Job HTTP gateway configuration - */ -export interface JobGatewayConfig { - /** Internal gateway URL for job HTTP function calls */ - gatewayUrl: string; - /** Callback URL for job completion notifications */ - callbackUrl: string; - /** Port for internal job callback server (defaults to 12345) */ - callbackPort: number; -} - -/** - * Parameters for failing a job - */ -export interface FailJobParams { - /** Worker ID that is failing the job */ - workerId: string; - /** Job ID to fail */ - jobId: number | string; - /** Error message or reason for failure */ - message: string; -} - -/** - * Parameters for completing a job - */ -export interface CompleteJobParams { - /** Worker ID that completed the job */ - workerId: string; - /** Job ID to mark as complete */ - jobId: number | string; -} - -/** - * Parameters for getting a job from the queue - */ -export interface GetJobParams { - /** Worker ID requesting a job */ - workerId: string; - /** - * Array of task names this worker supports. - * When `null`, the job system will consider any task as supported. - */ - supportedTaskNames: string[] | null; -} - -/** - * Parameters for getting a scheduled job - */ -export interface GetScheduledJobParams { - /** Worker ID requesting a scheduled job */ - workerId: string; - /** - * Array of task names this worker supports. - * When `null`, the scheduler will consider any task as supported. - */ - supportedTaskNames: string[] | null; -} - -/** - * Parameters for running a scheduled job - */ -export interface RunScheduledJobParams { - /** Job ID to run */ - jobId: number | string; -} - -/** - * Parameters for releasing scheduled jobs - */ -export interface ReleaseScheduledJobsParams { - /** Worker ID releasing the jobs */ - workerId: string; - /** - * Array of job IDs to release. - * When omitted, all scheduled jobs for the worker may be released. - */ - ids?: Array; -} - -/** - * Parameters for releasing all jobs held by a worker - */ -export interface ReleaseJobsParams { - /** Worker ID releasing all its jobs */ - workerId: string; -} - -/** - * Job record structure from database - */ -export interface Job { - /** Unique job identifier */ - id: number | string; - /** Task name/type for this job */ - task_name: string; - /** JSON payload data for the job */ - payload?: any; - /** Worker ID currently assigned to this job */ - worker_id?: string; - /** Maximum number of retry attempts */ - max_attempts?: number; - /** Current attempt number */ - attempts?: number; - /** Priority level for job execution */ - priority?: number; - /** Timestamp when job was created */ - created_at?: Date | string; - /** Timestamp when job was last updated */ - updated_at?: Date | string; - /** Timestamp when job should run (for scheduled jobs) */ - run_at?: Date | string; - /** Last error message if job failed */ - last_error?: string; -} - -/** - * Worker configuration options - */ -export interface JobWorkerConfig extends JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig { - /** Polling interval in milliseconds */ - pollInterval?: number; - /** Whether to enable graceful shutdown */ - gracefulShutdown?: boolean; -} - -/** - * Scheduler configuration options - */ -export interface JobSchedulerConfig extends JobSchemaConfig, JobHostnameConfig, JobTaskSupportConfig { - /** Polling interval in milliseconds for checking scheduled jobs */ - pollInterval?: number; - /** Whether to enable graceful shutdown */ - gracefulShutdown?: boolean; -} - -/** - * Complete job system configuration - */ -export interface JobsConfig { - /** Job schema configuration */ - schema?: Partial; - /** Worker configuration */ - worker?: Partial; - /** Scheduler configuration */ - scheduler?: Partial; - /** Job HTTP gateway configuration */ - gateway?: Partial; -} - -/** - * Default configuration values for job system - */ -export const jobsDefaults: JobsConfig = { - schema: { - schema: 'app_jobs' - }, - worker: { - schema: 'app_jobs', - hostname: 'worker-0', - supportAny: true, - supported: [], - pollInterval: 1000, - gracefulShutdown: true - }, - scheduler: { - schema: 'app_jobs', - hostname: 'scheduler-0', - supportAny: true, - supported: [], - pollInterval: 1000, - gracefulShutdown: true - }, - gateway: { - gatewayUrl: 'http://gateway:8080', - callbackUrl: 'http://callback:12345', - callbackPort: 12345 - } -}; diff --git a/pgpm/types/src/pgpm.ts b/pgpm/types/src/pgpm.ts index 081b480480..24cee23c4e 100644 --- a/pgpm/types/src/pgpm.ts +++ b/pgpm/types/src/pgpm.ts @@ -2,7 +2,6 @@ import { execSync } from 'child_process'; import { PgConfig } from 'pg-env'; import { PgpmDriverConfig } from './driver'; -import { JobsConfig, jobsDefaults } from './jobs'; /** * Authentication options for test client sessions @@ -279,8 +278,6 @@ export interface PgpmOptions { deployment?: DeploymentOptions; /** Migration and code generation options */ migrations?: MigrationOptions; - /** Job system configuration */ - jobs?: JobsConfig; /** Error output formatting options */ errorOutput?: ErrorOutputOptions; /** SMTP email configuration */ @@ -365,7 +362,6 @@ export const pgpmDefaults: PgpmOptions = { useTx: false } }, - jobs: jobsDefaults, errorOutput: { queryHistoryLimit: 30, maxLength: 10000, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 386b342ad4..3ea178c30b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2077,246 +2077,6 @@ importers: version: 0.3.0 publishDirectory: dist - jobs/job-pg: - dependencies: - '@constructive-io/job-utils': - specifier: workspace:^ - version: link:../job-utils/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - pg: - specifier: 8.21.0 - version: 8.21.0 - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/job-scheduler: - dependencies: - '@constructive-io/job-pg': - specifier: workspace:^ - version: link:../job-pg/dist - '@constructive-io/job-utils': - specifier: workspace:^ - version: link:../job-utils/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - node-schedule: - specifier: ^2.1.1 - version: 2.1.1 - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/job-utils: - dependencies: - '@pgpmjs/env': - specifier: workspace:^ - version: link:../../pgpm/env/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - '@pgpmjs/types': - specifier: workspace:^ - version: link:../../pgpm/types/dist - pg-cache: - specifier: workspace:^ - version: link:../../postgres/pg-cache/dist - pg-env: - specifier: workspace:^ - version: link:../../postgres/pg-env/dist - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/job-worker: - dependencies: - '@constructive-io/job-utils': - specifier: workspace:^ - version: link:../job-utils/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - pg: - specifier: 8.21.0 - version: 8.21.0 - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/knative-job-example: - dependencies: - '@constructive-io/knative-job-fn': - specifier: workspace:^ - version: link:../knative-job-fn/dist - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/knative-job-fn: - dependencies: - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - express: - specifier: 5.2.1 - version: 5.2.1 - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/knative-job-server: - dependencies: - '@constructive-io/job-pg': - specifier: workspace:^ - version: link:../job-pg/dist - '@constructive-io/job-utils': - specifier: workspace:^ - version: link:../job-utils/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - express: - specifier: 5.2.1 - version: 5.2.1 - pg: - specifier: 8.21.0 - version: 8.21.0 - devDependencies: - makage: - specifier: ^0.3.0 - version: 0.3.0 - publishDirectory: dist - - jobs/knative-job-service: - dependencies: - '@constructive-io/job-pg': - specifier: workspace:^ - version: link:../job-pg/dist - '@constructive-io/job-scheduler': - specifier: workspace:^ - version: link:../job-scheduler/dist - '@constructive-io/job-utils': - specifier: workspace:^ - version: link:../job-utils/dist - '@constructive-io/knative-job-fn': - specifier: workspace:^ - version: link:../knative-job-fn/dist - '@constructive-io/knative-job-server': - specifier: workspace:^ - version: link:../knative-job-server/dist - '@constructive-io/knative-job-worker': - specifier: workspace:^ - version: link:../knative-job-worker/dist - '@pgpmjs/env': - specifier: workspace:^ - version: link:../../pgpm/env/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - async-retry: - specifier: 1.3.3 - version: 1.3.3 - pg: - specifier: 8.21.0 - version: 8.21.0 - devDependencies: - '@constructive-io/graphql-server': - specifier: workspace:^ - version: link:../../graphql/server/dist - '@constructive-io/graphql-types': - specifier: workspace:^ - version: link:../../graphql/types/dist - '@constructive-io/postmaster': - specifier: workspace:^ - version: link:../../packages/postmaster/dist - '@pgpm/database-jobs': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpm/inflection': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpm/metaschema-modules': - specifier: ^0.21.1 - version: 0.21.1 - '@pgpm/metaschema-schema': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpm/services': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpm/types': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpm/verify': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpmjs/core': - specifier: workspace:^ - version: link:../../pgpm/core/dist - '@types/supertest': - specifier: ^7.2.0 - version: 7.2.0 - makage: - specifier: ^0.3.0 - version: 0.3.0 - pgsql-test: - specifier: workspace:^ - version: link:../../postgres/pgsql-test/dist - supertest: - specifier: ^7.2.2 - version: 7.2.2 - ts-node: - specifier: ^10.9.2 - version: 10.9.2(@types/node@25.9.1)(typescript@5.9.3) - publishDirectory: dist - - jobs/knative-job-worker: - dependencies: - '@constructive-io/job-pg': - specifier: workspace:^ - version: link:../job-pg/dist - '@constructive-io/job-utils': - specifier: workspace:^ - version: link:../job-utils/dist - '@pgpmjs/logger': - specifier: workspace:^ - version: link:../../pgpm/logger/dist - pg: - specifier: 8.21.0 - version: 8.21.0 - devDependencies: - '@pgpm/database-jobs': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpm/verify': - specifier: ^0.18.0 - version: 0.18.0 - '@pgpmjs/core': - specifier: workspace:^ - version: link:../../pgpm/core/dist - makage: - specifier: ^0.3.0 - version: 0.3.0 - pgsql-test: - specifier: workspace:^ - version: link:../../postgres/pgsql-test/dist - publishDirectory: dist - packages/12factor-env: dependencies: envalid: @@ -2365,9 +2125,6 @@ importers: '@constructive-io/graphql-types': specifier: workspace:^ version: link:../../graphql/types/dist - '@constructive-io/knative-job-service': - specifier: workspace:^ - version: link:../../jobs/knative-job-service/dist '@inquirerer/utils': specifier: ^3.3.9 version: 3.3.9 @@ -5227,42 +4984,6 @@ packages: '@paralleldrive/cuid2@2.3.1': resolution: {integrity: sha512-XO7cAxhnTZl0Yggq6jOgjiOHhbgcO4NqFqwSmQpjK3b6TEE6Uj/jfSk6wzYyemh3+I0sHirKSetjQwn5cZktFw==} - '@pgpm/database-jobs@0.18.0': - resolution: {integrity: sha512-3LX7ZQJQEMHd4POG2I2xPzMFR2X6LwvuxJAMpLhcc/I4P3EbEyEig6rPpsyDr9uabRjgUWfZDz05w6cW8X4KwA==} - - '@pgpm/database-jobs@0.21.0': - resolution: {integrity: sha512-TN6Uddyq5PJMQ7P+dJOCl0xwyIW1Hv8PkJmRshMNljzt0OVu4Mq8YR5gNkTDveGGHdYCDyP0vhCrpty9aQld6g==} - - '@pgpm/inflection@0.18.0': - resolution: {integrity: sha512-gHfxI6l/+cE9zY5ea6BjVjNcb9VKIavqRXGVyw16Fy0n4HgCmxF8ccZFFPq46JXfakNSk3cPTHDYvvWQaAlIPA==} - - '@pgpm/inflection@0.21.0': - resolution: {integrity: sha512-tb1OQCQp1i5SjT04CCN27ptGQcDXidVZrDB8SJsdZZrz6Rcl0WStf4t50z5CSUebg8RJxkpiF4VNpv583RCuhQ==} - - '@pgpm/metaschema-modules@0.21.1': - resolution: {integrity: sha512-6RTHN+PcxmTma7k7uHPZdjtN92P3kkqndXxu2acuSOpXi1sxrN5nNSNgi2r42ovl92B8MKy4r7SyF5DUlQwD1A==} - - '@pgpm/metaschema-schema@0.18.0': - resolution: {integrity: sha512-joIBoYegI4ZQFFPW7w0HhNXMT+sXnmSytX8YBxGgi5XZqjE2aQdtZcWBIiwZa3MjqU7mYN2xlZt5gPmo/IzLMw==} - - '@pgpm/metaschema-schema@0.21.0': - resolution: {integrity: sha512-kRfVyysGOrGcZEElcAJWaX9Xx2f5fMPtI4rmAxI11vJ0axYUcqtI+9fyp7McwqXnIHr0ShR28jvwqUGaZherJw==} - - '@pgpm/services@0.18.0': - resolution: {integrity: sha512-YedLEVdgwkHden55uaZaO8O3HACEiIvblYmPFsQk1ivHwzw1l0KUv6WT5+idwMC/SOsexH/Xq8ckSSM84ErWtQ==} - - '@pgpm/types@0.18.0': - resolution: {integrity: sha512-w6pfcS5HuJ2IGfyn74mGChl0nhNBIbxdu6sarlARGveZFHvBkTIPKEezA524sLKhUHda84YWuExEhCUd6N/AqQ==} - - '@pgpm/types@0.21.0': - resolution: {integrity: sha512-F5ph4z7JWwKVcy/CmAgodEIXqXCwSgv0ESVxIV2spdl01RgNi0SdKuHqVJnjp8rbHHUtlCPRj/UlAopUSpIIOg==} - - '@pgpm/verify@0.18.0': - resolution: {integrity: sha512-7XtY+hj9CbYb0ZhD0LJRp+TErtYS2z0FZbdkMNM7UabEwz05VLlS/lXbdtn5hksbUq6dkIxwxQ2mfFpATPpqDQ==} - - '@pgpm/verify@0.21.0': - resolution: {integrity: sha512-z4iiwEUrUR+aIvxfu4+HefitVPLtypXdbyEkbNJ//EMsnzturo6wzxT1e60w/Xp29AzF6m5OaJ0djc6lzr9hTw==} - '@pgsql/quotes@18.1.0': resolution: {integrity: sha512-wZcMP1QHiQbWWKOw4nfvZ74xUSz/9jqeSUXVnoR1saI5M0D+iYbiuOlfNDyYmziLwgEkCuSJLZK1dZ+eQCwgAA==} @@ -6527,9 +6248,6 @@ packages: asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} - async-retry@1.3.3: - resolution: {integrity: sha512-wfr/jstw9xNi/0teMHrRW7dsz3Lt5ARhYNZ2ewpadnhaIp5mbALhOAP+EAdsC7t4Z6wqsDVv9+W6gm1Dk9mEyw==} - async@3.2.6: resolution: {integrity: sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==} @@ -6929,10 +6647,6 @@ packages: create-require@1.1.1: resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==} - cron-parser@4.9.0: - resolution: {integrity: sha512-p0SaNjrHOnQeR8/VnfGbmg9te2kfyYSQ7Sc/j/6DtPL3JQvKxmjO9TSjNFpujqV3vEYYBvNNvXSxzyksBWAx1Q==} - engines: {node: '>=12.0.0'} - cross-spawn@7.0.6: resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} engines: {node: '>= 8'} @@ -8549,9 +8263,6 @@ packages: resolution: {integrity: sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==} engines: {node: '>=10'} - long-timeout@0.1.1: - resolution: {integrity: sha512-BFRuQUqc7x2NWxfJBCyUrN8iYUYznzL9JROmRz1gZ6KlOIgmoD+njPVbb+VNn2nGMKggMsK79iUNErillsrx7w==} - long@5.3.2: resolution: {integrity: sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==} @@ -8569,10 +8280,6 @@ packages: resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==} engines: {node: '>=10'} - luxon@3.7.2: - resolution: {integrity: sha512-vtEhXh/gNjI9Yg1u4jX/0YVPMvxzHuGgCm6tC5kZyb08yjGWGnqAjGJvcXbqQR2P3MyMEFnRbpcdFS6PBcLqew==} - engines: {node: '>=12'} - lz-string@1.5.0: resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==} hasBin: true @@ -8872,10 +8579,6 @@ packages: node-releases@2.0.27: resolution: {integrity: sha512-nmh3lCkYZ3grZvqcCH+fjmQ7X+H0OeZgP40OierEaAptX4XofMh5kwNbWh7lBduUzCcV/8kZ+NDLCwm2iorIlA==} - node-schedule@2.1.1: - resolution: {integrity: sha512-OXdegQq03OmXEjt2hZP33W2YPs/E5BcFQks46+G2gAxs4gHOIVD1u7EqlYLYSKsaIpyKCK9Gbk0ta1/gjRSMRQ==} - engines: {node: '>=6'} - nodemailer@6.10.1: resolution: {integrity: sha512-Z+iLaBGVaSjbIzQ4pX6XV41HrooLsQ10ZWPUehGmuantvzWoDVBnmsdUcOIDM1t+yPor5pDhVlDESgOMEGxhHA==} engines: {node: '>=6.0.0'} @@ -9632,10 +9335,6 @@ packages: resolution: {integrity: sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==} engines: {node: '>= 4'} - retry@0.13.1: - resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==} - engines: {node: '>= 4'} - reusify@1.1.0: resolution: {integrity: sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==} engines: {iojs: '>=1.0.0', node: '>=0.10.0'} @@ -9849,9 +9548,6 @@ packages: resolution: {integrity: sha512-/dPCrG1s3ePpWm6yBbxZq5Be1dXGLyLn9Z791chDC3NFrpkVbWGzkBwPN1knaciexFXgRJ7hzdnwZ4stHSDmjg==} engines: {node: '>=4'} - sorted-array-functions@1.3.0: - resolution: {integrity: sha512-2sqgzeFlid6N4Z2fUQ1cvFmTOLRi/sEDzSQ0OKYchqgoPmQBVyM3959qYx3fpS6Esef80KjmpgPeEr028dP3OA==} - source-map-js@1.2.1: resolution: {integrity: sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==} engines: {node: '>=0.10.0'} @@ -12533,58 +12229,6 @@ snapshots: dependencies: '@noble/hashes': 1.8.0 - '@pgpm/database-jobs@0.18.0': - dependencies: - '@pgpm/verify': 0.18.0 - - '@pgpm/database-jobs@0.21.0': - dependencies: - '@pgpm/verify': 0.21.0 - - '@pgpm/inflection@0.18.0': - dependencies: - '@pgpm/verify': 0.18.0 - - '@pgpm/inflection@0.21.0': - dependencies: - '@pgpm/verify': 0.21.0 - - '@pgpm/metaschema-modules@0.21.1': - dependencies: - '@pgpm/metaschema-schema': 0.21.0 - '@pgpm/verify': 0.21.0 - - '@pgpm/metaschema-schema@0.18.0': - dependencies: - '@pgpm/database-jobs': 0.18.0 - '@pgpm/inflection': 0.18.0 - '@pgpm/types': 0.18.0 - '@pgpm/verify': 0.18.0 - - '@pgpm/metaschema-schema@0.21.0': - dependencies: - '@pgpm/database-jobs': 0.21.0 - '@pgpm/inflection': 0.21.0 - '@pgpm/types': 0.21.0 - '@pgpm/verify': 0.21.0 - - '@pgpm/services@0.18.0': - dependencies: - '@pgpm/metaschema-schema': 0.18.0 - '@pgpm/verify': 0.18.0 - - '@pgpm/types@0.18.0': - dependencies: - '@pgpm/verify': 0.18.0 - - '@pgpm/types@0.21.0': - dependencies: - '@pgpm/verify': 0.21.0 - - '@pgpm/verify@0.18.0': {} - - '@pgpm/verify@0.21.0': {} - '@pgsql/quotes@18.1.0': {} '@pgsql/traverse@18.1.0': @@ -13826,10 +13470,6 @@ snapshots: asap@2.0.6: {} - async-retry@1.3.3: - dependencies: - retry: 0.13.1 - async@3.2.6: {} asynckit@0.4.0: {} @@ -14279,10 +13919,6 @@ snapshots: create-require@1.1.1: {} - cron-parser@4.9.0: - dependencies: - luxon: 3.7.2 - cross-spawn@7.0.6: dependencies: path-key: 3.1.1 @@ -16396,8 +16032,6 @@ snapshots: chalk: 4.1.2 is-unicode-supported: 0.1.0 - long-timeout@0.1.1: {} - long@5.3.2: {} lru-cache@10.4.3: {} @@ -16412,8 +16046,6 @@ snapshots: dependencies: yallist: 4.0.0 - luxon@3.7.2: {} - lz-string@1.5.0: {} mailgun.js@10.4.0: @@ -16714,12 +16346,6 @@ snapshots: node-releases@2.0.27: {} - node-schedule@2.1.1: - dependencies: - cron-parser: 4.9.0 - long-timeout: 0.1.1 - sorted-array-functions: 1.3.0 - nodemailer@6.10.1: {} nodemailer@8.0.5: {} @@ -17658,8 +17284,6 @@ snapshots: retry@0.12.0: {} - retry@0.13.1: {} - reusify@1.1.0: {} rimraf@3.0.2: @@ -18042,8 +17666,6 @@ snapshots: dependencies: is-plain-obj: 1.1.0 - sorted-array-functions@1.3.0: {} - source-map-js@1.2.1: {} source-map-resolve@0.6.0: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 96a9e38a13..134ded517f 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -7,5 +7,4 @@ packages: - 'uploads/*' - 'postgres/*' - 'graphile/*' - - 'jobs/*' - 'agentic/*' diff --git a/types/external-modules.d.ts b/types/external-modules.d.ts index ee15c26105..40232bda88 100644 --- a/types/external-modules.d.ts +++ b/types/external-modules.d.ts @@ -4,4 +4,3 @@ declare module 'request'; declare module 'express'; declare module 'body-parser'; declare module '@launchql/mjml'; -declare module '@constructive-io/knative-job-fn';