@pgflow/core 0.0.0-worker-compilation-b0fe6186-20251201124606 → 0.0.0-worker-management-a4f969d1-20251208095931

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -5,10 +5,6 @@ PostgreSQL-native workflow engine for defining, managing, and tracking DAG-based
5
5
  > [!NOTE]
6
6
  > This project and all its components are licensed under [Apache 2.0](./LICENSE) license.
7
7
 
8
- > [!WARNING]
9
- > This project uses [Atlas](https://atlasgo.io/docs) to manage the schemas and migrations.
10
- > See [ATLAS.md](ATLAS.md) for more details.
11
-
12
8
  ## Table of Contents
13
9
 
14
10
  - [Overview](#overview)
@@ -49,8 +45,7 @@ The actual execution of workflow tasks is handled by the [Edge Worker](../edge-w
49
45
 
50
46
  ## Requirements
51
47
 
52
- > [!IMPORTANT]
53
- > **pgmq Version Requirement** (since v0.8.0)
48
+ > [!IMPORTANT] > **pgmq Version Requirement** (since v0.8.0)
54
49
  >
55
50
  > pgflow v0.8.0 and later requires **pgmq 1.5.0 or higher**. This version of pgflow will NOT work with pgmq 1.4.x or earlier.
56
51
  >
package/dist/CHANGELOG.md CHANGED
@@ -1,14 +1,23 @@
1
1
  # @pgflow/core
2
2
 
3
- ## 0.0.0-worker-compilation-b0fe6186-20251201124606
3
+ ## 0.0.0-worker-management-a4f969d1-20251208095931
4
4
 
5
5
  ### Minor Changes
6
6
 
7
- - Worker auto compilation
7
+ - 90276ce: Add automatic worker restart via `ensure_workers()` cron job that keeps edge functions running. Add `worker_functions` table for tracking registered edge functions and their health status. Add `stopped_at` column to workers table for graceful shutdown detection. Integrate `trackWorkerFunction` and `markWorkerStopped` into edge worker lifecycle for automatic registration and shutdown signaling.
8
8
 
9
9
  ### Patch Changes
10
10
 
11
- - @pgflow/dsl@0.0.0-worker-compilation-b0fe6186-20251201124606
11
+ - 0b84bb0: Add automatic flow compilation at worker startup. Workers now call ensure_flow_compiled to verify flows are up-to-date. In development, mismatched flows are recompiled automatically. In production, mismatches cause errors. Use ensureCompiledOnStartup: false to opt-out.
12
+ - Updated dependencies [0b84bb0]
13
+ - @pgflow/dsl@0.0.0-worker-management-a4f969d1-20251208095931
14
+
15
+ ## 0.9.1
16
+
17
+ ### Patch Changes
18
+
19
+ - Updated dependencies [992a86b]
20
+ - @pgflow/dsl@0.9.1
12
21
 
13
22
  ## 0.9.0
14
23
 
package/dist/README.md CHANGED
@@ -5,10 +5,6 @@ PostgreSQL-native workflow engine for defining, managing, and tracking DAG-based
5
5
  > [!NOTE]
6
6
  > This project and all its components are licensed under [Apache 2.0](./LICENSE) license.
7
7
 
8
- > [!WARNING]
9
- > This project uses [Atlas](https://atlasgo.io/docs) to manage the schemas and migrations.
10
- > See [ATLAS.md](ATLAS.md) for more details.
11
-
12
8
  ## Table of Contents
13
9
 
14
10
  - [Overview](#overview)
@@ -49,8 +45,7 @@ The actual execution of workflow tasks is handled by the [Edge Worker](../edge-w
49
45
 
50
46
  ## Requirements
51
47
 
52
- > [!IMPORTANT]
53
- > **pgmq Version Requirement** (since v0.8.0)
48
+ > [!IMPORTANT] > **pgmq Version Requirement** (since v0.8.0)
54
49
  >
55
50
  > pgflow v0.8.0 and later requires **pgmq 1.5.0 or higher**. This version of pgflow will NOT work with pgmq 1.4.x or earlier.
56
51
  >
@@ -309,6 +309,33 @@ export type Database = {
309
309
  }
310
310
  ];
311
311
  };
312
+ worker_functions: {
313
+ Row: {
314
+ created_at: string;
315
+ enabled: boolean;
316
+ function_name: string;
317
+ heartbeat_timeout_seconds: number;
318
+ last_invoked_at: string | null;
319
+ updated_at: string;
320
+ };
321
+ Insert: {
322
+ created_at?: string;
323
+ enabled?: boolean;
324
+ function_name: string;
325
+ heartbeat_timeout_seconds?: number;
326
+ last_invoked_at?: string | null;
327
+ updated_at?: string;
328
+ };
329
+ Update: {
330
+ created_at?: string;
331
+ enabled?: boolean;
332
+ function_name?: string;
333
+ heartbeat_timeout_seconds?: number;
334
+ last_invoked_at?: string | null;
335
+ updated_at?: string;
336
+ };
337
+ Relationships: [];
338
+ };
312
339
  workers: {
313
340
  Row: {
314
341
  deprecated_at: string | null;
@@ -316,6 +343,7 @@ export type Database = {
316
343
  last_heartbeat_at: string;
317
344
  queue_name: string;
318
345
  started_at: string;
346
+ stopped_at: string | null;
319
347
  worker_id: string;
320
348
  };
321
349
  Insert: {
@@ -324,6 +352,7 @@ export type Database = {
324
352
  last_heartbeat_at?: string;
325
353
  queue_name: string;
326
354
  started_at?: string;
355
+ stopped_at?: string | null;
327
356
  worker_id: string;
328
357
  };
329
358
  Update: {
@@ -332,6 +361,7 @@ export type Database = {
332
361
  last_heartbeat_at?: string;
333
362
  queue_name?: string;
334
363
  started_at?: string;
364
+ stopped_at?: string | null;
335
365
  worker_id?: string;
336
366
  };
337
367
  Relationships: [];
@@ -404,6 +434,14 @@ export type Database = {
404
434
  };
405
435
  Returns: number;
406
436
  };
437
+ cleanup_ensure_workers_logs: {
438
+ Args: {
439
+ retention_hours?: number;
440
+ };
441
+ Returns: {
442
+ cron_deleted: number;
443
+ }[];
444
+ };
407
445
  complete_task: {
408
446
  Args: {
409
447
  output: Json;
@@ -463,12 +501,19 @@ export type Database = {
463
501
  };
464
502
  ensure_flow_compiled: {
465
503
  Args: {
466
- p_flow_slug: string;
467
- p_mode?: string;
468
- p_shape: Json;
504
+ flow_slug: string;
505
+ shape: Json;
469
506
  };
470
507
  Returns: Json;
471
508
  };
509
+ ensure_workers: {
510
+ Args: never;
511
+ Returns: {
512
+ function_name: string;
513
+ invoked: boolean;
514
+ request_id: number;
515
+ }[];
516
+ };
472
517
  fail_task: {
473
518
  Args: {
474
519
  error_message: string;
@@ -505,12 +550,22 @@ export type Database = {
505
550
  };
506
551
  Returns: Json;
507
552
  };
553
+ is_local: {
554
+ Args: never;
555
+ Returns: boolean;
556
+ };
508
557
  is_valid_slug: {
509
558
  Args: {
510
559
  slug: string;
511
560
  };
512
561
  Returns: boolean;
513
562
  };
563
+ mark_worker_stopped: {
564
+ Args: {
565
+ worker_id: string;
566
+ };
567
+ Returns: undefined;
568
+ };
514
569
  maybe_complete_run: {
515
570
  Args: {
516
571
  run_id: string;
@@ -548,6 +603,12 @@ export type Database = {
548
603
  vt: string;
549
604
  }[];
550
605
  };
606
+ setup_ensure_workers_cron: {
607
+ Args: {
608
+ cron_interval?: string;
609
+ };
610
+ Returns: string;
611
+ };
551
612
  start_flow: {
552
613
  Args: {
553
614
  flow_slug: string;
@@ -600,6 +661,12 @@ export type Database = {
600
661
  isSetofReturn: true;
601
662
  };
602
663
  };
664
+ track_worker_function: {
665
+ Args: {
666
+ function_name: string;
667
+ };
668
+ Returns: undefined;
669
+ };
603
670
  };
604
671
  Enums: {
605
672
  [_ in never]: never;
@@ -1 +1 @@
1
- {"version":3,"file":"database-types.d.ts","sourceRoot":"","sources":["../src/database-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,IAAI,GACZ,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE,GACnC,IAAI,EAAE,CAAA;AAEV,MAAM,MAAM,QAAQ,GAAG;IACrB,MAAM,EAAE;QACN,MAAM,EAAE;YACN,IAAI,EAAE;gBACJ,GAAG,EAAE;oBACH,UAAU,EAAE,MAAM,CAAA;oBAClB,QAAQ,EAAE,MAAM,CAAA;oBAChB,SAAS,EAAE,MAAM,CAAA;oBACjB,SAAS,EAAE,MAAM,CAAA;iBAClB,CAAA;gBACD,MAAM,EAAE;oBACN,UAAU,CAAC,EAAE,MAAM,CAAA;oBACnB,QAAQ,EAAE,MAAM,CAAA;oBAChB,SAAS,EAAE,MAAM,CAAA;oBACjB,SAAS,EAAE,MAAM,CAAA;iBAClB,CAAA;gBACD,MAAM,EAAE;oBACN,UAAU,CAAC,EAAE,MAAM,CAAA;oBACnB,QAAQ,CAAC,EAAE,MAAM,CAAA;oBACjB,SAAS,CAAC,EAAE,MAAM,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CAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,GAC5F,KAAK,GAAG,KAAK,IACf,gCAAgC,SAAS;IAC3C,MAAM,EAAE,MAAM,wBAAwB,CAAA;CACvC,GACG,wBAAwB,CAAC,gCAAgC,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,iBAAiB,CAAC,GACzG,gCAAgC,SAAS,MAAM,aAAa,CAAC,gBAAgB,CAAC,GAC5E,aAAa,CAAC,gBAAgB,CAAC,CAAC,gCAAgC,CAAC,GACjE,KAAK,CAAA;AAEX,eAAO,MAAM,SAAS;;;;;;;CAOZ,CAAA"}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgflow/core",
3
- "version": "0.0.0-worker-compilation-b0fe6186-20251201124606",
3
+ "version": "0.0.0-worker-management-a4f969d1-20251208095931",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,268 @@
1
+ -- Modify "create_flow" function
2
+ CREATE OR REPLACE FUNCTION "pgflow"."create_flow" ("flow_slug" text, "max_attempts" integer DEFAULT NULL::integer, "base_delay" integer DEFAULT NULL::integer, "timeout" integer DEFAULT NULL::integer) RETURNS "pgflow"."flows" LANGUAGE sql SET "search_path" = '' AS $$
3
+ WITH
4
+ defaults AS (
5
+ SELECT 3 AS def_max_attempts, 5 AS def_base_delay, 60 AS def_timeout
6
+ ),
7
+ flow_upsert AS (
8
+ INSERT INTO pgflow.flows (flow_slug, opt_max_attempts, opt_base_delay, opt_timeout)
9
+ SELECT
10
+ flow_slug,
11
+ COALESCE(max_attempts, defaults.def_max_attempts),
12
+ COALESCE(base_delay, defaults.def_base_delay),
13
+ COALESCE(timeout, defaults.def_timeout)
14
+ FROM defaults
15
+ ON CONFLICT (flow_slug) DO UPDATE
16
+ SET flow_slug = pgflow.flows.flow_slug -- Dummy update
17
+ RETURNING *
18
+ ),
19
+ ensure_queue AS (
20
+ SELECT pgmq.create(flow_slug)
21
+ WHERE NOT EXISTS (
22
+ SELECT 1 FROM pgmq.list_queues() WHERE queue_name = flow_slug
23
+ )
24
+ )
25
+ SELECT f.*
26
+ FROM flow_upsert f
27
+ LEFT JOIN (SELECT 1 FROM ensure_queue) _dummy ON true; -- Left join ensures flow is returned
28
+ $$;
29
+ -- Create "_compare_flow_shapes" function
30
+ CREATE FUNCTION "pgflow"."_compare_flow_shapes" ("p_local" jsonb, "p_db" jsonb) RETURNS text[] LANGUAGE plpgsql STABLE SET "search_path" = '' AS $BODY$
31
+ DECLARE
32
+ v_differences text[] := '{}';
33
+ v_local_steps jsonb;
34
+ v_db_steps jsonb;
35
+ v_local_count int;
36
+ v_db_count int;
37
+ v_max_count int;
38
+ v_idx int;
39
+ v_local_step jsonb;
40
+ v_db_step jsonb;
41
+ v_local_deps text;
42
+ v_db_deps text;
43
+ BEGIN
44
+ v_local_steps := p_local->'steps';
45
+ v_db_steps := p_db->'steps';
46
+ v_local_count := jsonb_array_length(COALESCE(v_local_steps, '[]'::jsonb));
47
+ v_db_count := jsonb_array_length(COALESCE(v_db_steps, '[]'::jsonb));
48
+
49
+ -- Compare step counts
50
+ IF v_local_count != v_db_count THEN
51
+ v_differences := array_append(
52
+ v_differences,
53
+ format('Step count differs: %s vs %s', v_local_count, v_db_count)
54
+ );
55
+ END IF;
56
+
57
+ -- Compare steps by index
58
+ v_max_count := GREATEST(v_local_count, v_db_count);
59
+
60
+ FOR v_idx IN 0..(v_max_count - 1) LOOP
61
+ v_local_step := v_local_steps->v_idx;
62
+ v_db_step := v_db_steps->v_idx;
63
+
64
+ IF v_local_step IS NULL THEN
65
+ v_differences := array_append(
66
+ v_differences,
67
+ format(
68
+ $$Step at index %s: missing in first shape (second has '%s')$$,
69
+ v_idx,
70
+ v_db_step->>'slug'
71
+ )
72
+ );
73
+ ELSIF v_db_step IS NULL THEN
74
+ v_differences := array_append(
75
+ v_differences,
76
+ format(
77
+ $$Step at index %s: missing in second shape (first has '%s')$$,
78
+ v_idx,
79
+ v_local_step->>'slug'
80
+ )
81
+ );
82
+ ELSE
83
+ -- Compare slug
84
+ IF v_local_step->>'slug' != v_db_step->>'slug' THEN
85
+ v_differences := array_append(
86
+ v_differences,
87
+ format(
88
+ $$Step at index %s: slug differs '%s' vs '%s'$$,
89
+ v_idx,
90
+ v_local_step->>'slug',
91
+ v_db_step->>'slug'
92
+ )
93
+ );
94
+ END IF;
95
+
96
+ -- Compare step type
97
+ IF v_local_step->>'stepType' != v_db_step->>'stepType' THEN
98
+ v_differences := array_append(
99
+ v_differences,
100
+ format(
101
+ $$Step at index %s: type differs '%s' vs '%s'$$,
102
+ v_idx,
103
+ v_local_step->>'stepType',
104
+ v_db_step->>'stepType'
105
+ )
106
+ );
107
+ END IF;
108
+
109
+ -- Compare dependencies (convert arrays to comma-separated strings)
110
+ SELECT string_agg(dep, ', ' ORDER BY dep)
111
+ INTO v_local_deps
112
+ FROM jsonb_array_elements_text(COALESCE(v_local_step->'dependencies', '[]'::jsonb)) AS dep;
113
+
114
+ SELECT string_agg(dep, ', ' ORDER BY dep)
115
+ INTO v_db_deps
116
+ FROM jsonb_array_elements_text(COALESCE(v_db_step->'dependencies', '[]'::jsonb)) AS dep;
117
+
118
+ IF COALESCE(v_local_deps, '') != COALESCE(v_db_deps, '') THEN
119
+ v_differences := array_append(
120
+ v_differences,
121
+ format(
122
+ $$Step at index %s: dependencies differ [%s] vs [%s]$$,
123
+ v_idx,
124
+ COALESCE(v_local_deps, ''),
125
+ COALESCE(v_db_deps, '')
126
+ )
127
+ );
128
+ END IF;
129
+ END IF;
130
+ END LOOP;
131
+
132
+ RETURN v_differences;
133
+ END;
134
+ $BODY$;
135
+ -- Create "_create_flow_from_shape" function
136
+ CREATE FUNCTION "pgflow"."_create_flow_from_shape" ("p_flow_slug" text, "p_shape" jsonb) RETURNS void LANGUAGE plpgsql SET "search_path" = '' AS $$
137
+ DECLARE
138
+ v_step jsonb;
139
+ v_deps text[];
140
+ v_flow_options jsonb;
141
+ v_step_options jsonb;
142
+ BEGIN
143
+ -- Extract flow-level options (may be null)
144
+ v_flow_options := p_shape->'options';
145
+
146
+ -- Create the flow with options (NULL = use default)
147
+ PERFORM pgflow.create_flow(
148
+ p_flow_slug,
149
+ (v_flow_options->>'maxAttempts')::int,
150
+ (v_flow_options->>'baseDelay')::int,
151
+ (v_flow_options->>'timeout')::int
152
+ );
153
+
154
+ -- Iterate over steps in order and add each one
155
+ FOR v_step IN SELECT * FROM jsonb_array_elements(p_shape->'steps')
156
+ LOOP
157
+ -- Convert dependencies jsonb array to text array
158
+ SELECT COALESCE(array_agg(dep), '{}')
159
+ INTO v_deps
160
+ FROM jsonb_array_elements_text(COALESCE(v_step->'dependencies', '[]'::jsonb)) AS dep;
161
+
162
+ -- Extract step options (may be null)
163
+ v_step_options := v_step->'options';
164
+
165
+ -- Add the step with options (NULL = use default/inherit)
166
+ PERFORM pgflow.add_step(
167
+ flow_slug => p_flow_slug,
168
+ step_slug => v_step->>'slug',
169
+ deps_slugs => v_deps,
170
+ max_attempts => (v_step_options->>'maxAttempts')::int,
171
+ base_delay => (v_step_options->>'baseDelay')::int,
172
+ timeout => (v_step_options->>'timeout')::int,
173
+ start_delay => (v_step_options->>'startDelay')::int,
174
+ step_type => v_step->>'stepType'
175
+ );
176
+ END LOOP;
177
+ END;
178
+ $$;
179
+ -- Create "_get_flow_shape" function
180
+ CREATE FUNCTION "pgflow"."_get_flow_shape" ("p_flow_slug" text) RETURNS jsonb LANGUAGE sql STABLE SET "search_path" = '' AS $$
181
+ SELECT jsonb_build_object(
182
+ 'steps',
183
+ COALESCE(
184
+ jsonb_agg(
185
+ jsonb_build_object(
186
+ 'slug', step.step_slug,
187
+ 'stepType', step.step_type,
188
+ 'dependencies', COALESCE(
189
+ (
190
+ SELECT jsonb_agg(dep.dep_slug ORDER BY dep.dep_slug)
191
+ FROM pgflow.deps AS dep
192
+ WHERE dep.flow_slug = step.flow_slug
193
+ AND dep.step_slug = step.step_slug
194
+ ),
195
+ '[]'::jsonb
196
+ )
197
+ )
198
+ ORDER BY step.step_index
199
+ ),
200
+ '[]'::jsonb
201
+ )
202
+ )
203
+ FROM pgflow.steps AS step
204
+ WHERE step.flow_slug = p_flow_slug;
205
+ $$;
206
+ -- Create "delete_flow_and_data" function
207
+ CREATE FUNCTION "pgflow"."delete_flow_and_data" ("p_flow_slug" text) RETURNS void LANGUAGE plpgsql SET "search_path" = '' AS $$
208
+ BEGIN
209
+ -- Drop queue and archive table (pgmq)
210
+ PERFORM pgmq.drop_queue(p_flow_slug);
211
+
212
+ -- Delete all associated data in the correct order (respecting FK constraints)
213
+ DELETE FROM pgflow.step_tasks AS task WHERE task.flow_slug = p_flow_slug;
214
+ DELETE FROM pgflow.step_states AS state WHERE state.flow_slug = p_flow_slug;
215
+ DELETE FROM pgflow.runs AS run WHERE run.flow_slug = p_flow_slug;
216
+ DELETE FROM pgflow.deps AS dep WHERE dep.flow_slug = p_flow_slug;
217
+ DELETE FROM pgflow.steps AS step WHERE step.flow_slug = p_flow_slug;
218
+ DELETE FROM pgflow.flows AS flow WHERE flow.flow_slug = p_flow_slug;
219
+ END;
220
+ $$;
221
+ -- Create "ensure_flow_compiled" function
222
+ CREATE FUNCTION "pgflow"."ensure_flow_compiled" ("p_flow_slug" text, "p_shape" jsonb, "p_mode" text DEFAULT 'production') RETURNS jsonb LANGUAGE plpgsql SET "search_path" = '' AS $$
223
+ DECLARE
224
+ v_lock_key int;
225
+ v_flow_exists boolean;
226
+ v_db_shape jsonb;
227
+ v_differences text[];
228
+ BEGIN
229
+ -- Generate lock key from flow_slug (deterministic hash)
230
+ v_lock_key := hashtext(p_flow_slug);
231
+
232
+ -- Acquire transaction-level advisory lock
233
+ -- Serializes concurrent compilation attempts for same flow
234
+ PERFORM pg_advisory_xact_lock(1, v_lock_key);
235
+
236
+ -- 1. Check if flow exists
237
+ SELECT EXISTS(SELECT 1 FROM pgflow.flows AS flow WHERE flow.flow_slug = p_flow_slug)
238
+ INTO v_flow_exists;
239
+
240
+ -- 2. If flow missing: compile (both modes)
241
+ IF NOT v_flow_exists THEN
242
+ PERFORM pgflow._create_flow_from_shape(p_flow_slug, p_shape);
243
+ RETURN jsonb_build_object('status', 'compiled', 'differences', '[]'::jsonb);
244
+ END IF;
245
+
246
+ -- 3. Get current shape from DB
247
+ v_db_shape := pgflow._get_flow_shape(p_flow_slug);
248
+
249
+ -- 4. Compare shapes
250
+ v_differences := pgflow._compare_flow_shapes(p_shape, v_db_shape);
251
+
252
+ -- 5. If shapes match: return verified
253
+ IF array_length(v_differences, 1) IS NULL THEN
254
+ RETURN jsonb_build_object('status', 'verified', 'differences', '[]'::jsonb);
255
+ END IF;
256
+
257
+ -- 6. Shapes differ - handle by mode
258
+ IF p_mode = 'development' THEN
259
+ -- Recompile in dev mode: full deletion + fresh compile
260
+ PERFORM pgflow.delete_flow_and_data(p_flow_slug);
261
+ PERFORM pgflow._create_flow_from_shape(p_flow_slug, p_shape);
262
+ RETURN jsonb_build_object('status', 'recompiled', 'differences', to_jsonb(v_differences));
263
+ ELSE
264
+ -- Fail in production mode
265
+ RETURN jsonb_build_object('status', 'mismatch', 'differences', to_jsonb(v_differences));
266
+ END IF;
267
+ END;
268
+ $$;
@@ -0,0 +1,264 @@
1
+ -- Create extension "pg_net" if not exists (already present in Supabase)
2
+ CREATE EXTENSION IF NOT EXISTS "pg_net" WITH SCHEMA "public";
3
+ -- Create extension "pg_cron" if not exists (already present in Supabase)
4
+ CREATE EXTENSION IF NOT EXISTS "pg_cron";
5
+ -- Modify "workers" table
6
+ ALTER TABLE "pgflow"."workers" ADD COLUMN "stopped_at" timestamptz NULL;
7
+ -- Create "worker_functions" table
8
+ CREATE TABLE "pgflow"."worker_functions" (
9
+ "function_name" text NOT NULL,
10
+ "enabled" boolean NOT NULL DEFAULT true,
11
+ "heartbeat_timeout_seconds" integer NOT NULL DEFAULT 6,
12
+ "last_invoked_at" timestamptz NULL,
13
+ "created_at" timestamptz NOT NULL DEFAULT now(),
14
+ "updated_at" timestamptz NOT NULL DEFAULT now(),
15
+ PRIMARY KEY ("function_name")
16
+ );
17
+ -- Set comment to table: "worker_functions"
18
+ COMMENT ON TABLE "pgflow"."worker_functions" IS 'Registry of edge functions that run pgflow workers, used by ensure_workers() cron';
19
+ -- Set comment to column: "function_name" on table: "worker_functions"
20
+ COMMENT ON COLUMN "pgflow"."worker_functions"."function_name" IS 'Name of the Supabase Edge Function';
21
+ -- Set comment to column: "enabled" on table: "worker_functions"
22
+ COMMENT ON COLUMN "pgflow"."worker_functions"."enabled" IS 'Whether ensure_workers() should ping this function';
23
+ -- Set comment to column: "heartbeat_timeout_seconds" on table: "worker_functions"
24
+ COMMENT ON COLUMN "pgflow"."worker_functions"."heartbeat_timeout_seconds" IS 'How long before considering a worker dead (no heartbeat)';
25
+ -- Set comment to column: "last_invoked_at" on table: "worker_functions"
26
+ COMMENT ON COLUMN "pgflow"."worker_functions"."last_invoked_at" IS 'When ensure_workers() last pinged this function (used for debouncing)';
27
+ -- Create "cleanup_ensure_workers_logs" function
28
+ CREATE FUNCTION "pgflow"."cleanup_ensure_workers_logs" ("retention_hours" integer DEFAULT 24) RETURNS TABLE ("cron_deleted" bigint) LANGUAGE sql SECURITY DEFINER SET "search_path" = pgflow, cron, pg_temp AS $$
29
+ with deleted as (
30
+ delete from cron.job_run_details
31
+ where job_run_details.end_time < now() - (cleanup_ensure_workers_logs.retention_hours || ' hours')::interval
32
+ returning 1
33
+ )
34
+ select count(*)::bigint as cron_deleted from deleted
35
+ $$;
36
+ -- Set comment to function: "cleanup_ensure_workers_logs"
37
+ COMMENT ON FUNCTION "pgflow"."cleanup_ensure_workers_logs" IS 'Cleans up old cron job run details to prevent table growth.
38
+ Default retention is 24 hours. HTTP response logs (net._http_response) are
39
+ automatically cleaned by pg_net with a 6-hour TTL, so they are not cleaned here.
40
+ This function follows the standard pg_cron maintenance pattern recommended by
41
+ AWS RDS, Neon, and Supabase documentation.';
42
+ -- Create "is_local" function
43
+ CREATE FUNCTION "pgflow"."is_local" () RETURNS boolean LANGUAGE sql STABLE PARALLEL SAFE SET "search_path" = '' AS $$
44
+ select coalesce(
45
+ current_setting('app.settings.jwt_secret', true)
46
+ = 'super-secret-jwt-token-with-at-least-32-characters-long',
47
+ false
48
+ )
49
+ $$;
50
+ -- Create "ensure_flow_compiled" function
51
+ CREATE FUNCTION "pgflow"."ensure_flow_compiled" ("flow_slug" text, "shape" jsonb) RETURNS jsonb LANGUAGE plpgsql SET "search_path" = '' AS $$
52
+ DECLARE
53
+ v_lock_key int;
54
+ v_flow_exists boolean;
55
+ v_db_shape jsonb;
56
+ v_differences text[];
57
+ v_is_local boolean;
58
+ BEGIN
59
+ -- Generate lock key from flow_slug (deterministic hash)
60
+ v_lock_key := hashtext(ensure_flow_compiled.flow_slug);
61
+
62
+ -- Acquire transaction-level advisory lock
63
+ -- Serializes concurrent compilation attempts for same flow
64
+ PERFORM pg_advisory_xact_lock(1, v_lock_key);
65
+
66
+ -- 1. Check if flow exists
67
+ SELECT EXISTS(SELECT 1 FROM pgflow.flows AS flow WHERE flow.flow_slug = ensure_flow_compiled.flow_slug)
68
+ INTO v_flow_exists;
69
+
70
+ -- 2. If flow missing: compile (both environments)
71
+ IF NOT v_flow_exists THEN
72
+ PERFORM pgflow._create_flow_from_shape(ensure_flow_compiled.flow_slug, ensure_flow_compiled.shape);
73
+ RETURN jsonb_build_object('status', 'compiled', 'differences', '[]'::jsonb);
74
+ END IF;
75
+
76
+ -- 3. Get current shape from DB
77
+ v_db_shape := pgflow._get_flow_shape(ensure_flow_compiled.flow_slug);
78
+
79
+ -- 4. Compare shapes
80
+ v_differences := pgflow._compare_flow_shapes(ensure_flow_compiled.shape, v_db_shape);
81
+
82
+ -- 5. If shapes match: return verified
83
+ IF array_length(v_differences, 1) IS NULL THEN
84
+ RETURN jsonb_build_object('status', 'verified', 'differences', '[]'::jsonb);
85
+ END IF;
86
+
87
+ -- 6. Shapes differ - auto-detect environment via is_local()
88
+ v_is_local := pgflow.is_local();
89
+
90
+ IF v_is_local THEN
91
+ -- Recompile in local/dev: full deletion + fresh compile
92
+ PERFORM pgflow.delete_flow_and_data(ensure_flow_compiled.flow_slug);
93
+ PERFORM pgflow._create_flow_from_shape(ensure_flow_compiled.flow_slug, ensure_flow_compiled.shape);
94
+ RETURN jsonb_build_object('status', 'recompiled', 'differences', to_jsonb(v_differences));
95
+ ELSE
96
+ -- Fail in production
97
+ RETURN jsonb_build_object('status', 'mismatch', 'differences', to_jsonb(v_differences));
98
+ END IF;
99
+ END;
100
+ $$;
101
+ -- Create "ensure_workers" function
102
+ CREATE FUNCTION "pgflow"."ensure_workers" () RETURNS TABLE ("function_name" text, "invoked" boolean, "request_id" bigint) LANGUAGE sql AS $$
103
+ with
104
+ -- Detect environment
105
+ env as (
106
+ select pgflow.is_local() as is_local
107
+ ),
108
+
109
+ -- Get credentials: Local mode uses hardcoded URL, production uses vault secrets
110
+ -- Empty strings are treated as NULL using nullif()
111
+ credentials as (
112
+ select
113
+ case
114
+ when (select is_local from env) then null
115
+ else nullif((select decrypted_secret from vault.decrypted_secrets where name = 'supabase_service_role_key'), '')
116
+ end as service_role_key,
117
+ case
118
+ when (select is_local from env) then 'http://kong:8000/functions/v1'
119
+ else (select 'https://' || nullif(decrypted_secret, '') || '.supabase.co/functions/v1' from vault.decrypted_secrets where name = 'supabase_project_id')
120
+ end as base_url
121
+ ),
122
+
123
+ -- Find functions that pass the debounce check
124
+ debounce_passed as (
125
+ select wf.function_name, wf.heartbeat_timeout_seconds
126
+ from pgflow.worker_functions as wf
127
+ where wf.enabled = true
128
+ and (
129
+ wf.last_invoked_at is null
130
+ or wf.last_invoked_at < now() - (wf.heartbeat_timeout_seconds || ' seconds')::interval
131
+ )
132
+ ),
133
+
134
+ -- Find functions that have at least one alive worker
135
+ functions_with_alive_workers as (
136
+ select distinct w.function_name
137
+ from pgflow.workers as w
138
+ inner join debounce_passed as dp on w.function_name = dp.function_name
139
+ where w.stopped_at is null
140
+ and w.deprecated_at is null
141
+ and w.last_heartbeat_at > now() - (dp.heartbeat_timeout_seconds || ' seconds')::interval
142
+ ),
143
+
144
+ -- Determine which functions should be invoked
145
+ functions_to_invoke as (
146
+ select dp.function_name
147
+ from debounce_passed as dp
148
+ where
149
+ pgflow.is_local() = true
150
+ or dp.function_name not in (select faw.function_name from functions_with_alive_workers as faw)
151
+ ),
152
+
153
+ -- Make HTTP requests and capture request_ids
154
+ http_requests as (
155
+ select
156
+ fti.function_name,
157
+ net.http_post(
158
+ url => c.base_url || '/' || fti.function_name,
159
+ headers => case
160
+ when e.is_local then '{}'::jsonb
161
+ else jsonb_build_object(
162
+ 'Content-Type', 'application/json',
163
+ 'Authorization', 'Bearer ' || c.service_role_key
164
+ )
165
+ end,
166
+ body => '{}'::jsonb
167
+ ) as request_id
168
+ from functions_to_invoke as fti
169
+ cross join credentials as c
170
+ cross join env as e
171
+ where c.base_url is not null
172
+ and (e.is_local or c.service_role_key is not null)
173
+ ),
174
+
175
+ -- Update last_invoked_at for invoked functions
176
+ updated as (
177
+ update pgflow.worker_functions as wf
178
+ set last_invoked_at = clock_timestamp()
179
+ from http_requests as hr
180
+ where wf.function_name = hr.function_name
181
+ returning wf.function_name
182
+ )
183
+
184
+ select u.function_name, true as invoked, hr.request_id
185
+ from updated as u
186
+ inner join http_requests as hr on u.function_name = hr.function_name
187
+ $$;
188
+ -- Set comment to function: "ensure_workers"
189
+ COMMENT ON FUNCTION "pgflow"."ensure_workers" IS 'Ensures worker functions are running by pinging them via HTTP when needed.
190
+ In local mode: always pings all enabled functions (for fast restart after code changes).
191
+ In production mode: only pings functions that have no alive workers.
192
+ Respects debounce: skips functions pinged within their heartbeat_timeout_seconds window.
193
+ Credentials: Uses Vault secrets (supabase_service_role_key, supabase_project_id) or local fallbacks.
194
+ URL is built from project_id: https://{project_id}.supabase.co/functions/v1
195
+ Returns request_id from pg_net for each HTTP request made.';
196
+ -- Create "mark_worker_stopped" function
197
+ CREATE FUNCTION "pgflow"."mark_worker_stopped" ("worker_id" uuid) RETURNS void LANGUAGE sql AS $$
198
+ update pgflow.workers
199
+ set stopped_at = clock_timestamp()
200
+ where workers.worker_id = mark_worker_stopped.worker_id;
201
+ $$;
202
+ -- Set comment to function: "mark_worker_stopped"
203
+ COMMENT ON FUNCTION "pgflow"."mark_worker_stopped" IS 'Marks a worker as stopped for graceful shutdown. Called by workers on beforeunload.';
204
+ -- Create "setup_ensure_workers_cron" function
205
+ CREATE FUNCTION "pgflow"."setup_ensure_workers_cron" ("cron_interval" text DEFAULT '1 second') RETURNS text LANGUAGE plpgsql SECURITY DEFINER SET "search_path" = pgflow, cron, pg_temp AS $$
206
+ declare
207
+ ensure_workers_job_id bigint;
208
+ cleanup_job_id bigint;
209
+ begin
210
+ -- Remove existing jobs if they exist (ignore errors if not found)
211
+ begin
212
+ perform cron.unschedule('pgflow_ensure_workers');
213
+ exception when others then
214
+ -- Job doesn't exist, continue
215
+ end;
216
+
217
+ begin
218
+ perform cron.unschedule('pgflow_cleanup_logs');
219
+ exception when others then
220
+ -- Job doesn't exist, continue
221
+ end;
222
+
223
+ -- Schedule ensure_workers job with the specified interval
224
+ ensure_workers_job_id := cron.schedule(
225
+ job_name => 'pgflow_ensure_workers',
226
+ schedule => setup_ensure_workers_cron.cron_interval,
227
+ command => 'select pgflow.ensure_workers()'
228
+ );
229
+
230
+ -- Schedule cleanup job to run hourly
231
+ cleanup_job_id := cron.schedule(
232
+ job_name => 'pgflow_cleanup_logs',
233
+ schedule => '0 * * * *',
234
+ command => 'select pgflow.cleanup_ensure_workers_logs()'
235
+ );
236
+
237
+ return format(
238
+ 'Scheduled pgflow_ensure_workers (every %s, job_id=%s) and pgflow_cleanup_logs (hourly, job_id=%s)',
239
+ setup_ensure_workers_cron.cron_interval,
240
+ ensure_workers_job_id,
241
+ cleanup_job_id
242
+ );
243
+ end;
244
+ $$;
245
+ -- Set comment to function: "setup_ensure_workers_cron"
246
+ COMMENT ON FUNCTION "pgflow"."setup_ensure_workers_cron" IS 'Sets up cron jobs for worker management.
247
+ Schedules pgflow_ensure_workers at the specified cron_interval (default: 1 second) to keep workers running.
248
+ Schedules pgflow_cleanup_logs hourly to clean up old cron job logs.
249
+ Replaces existing jobs if they exist (idempotent).
250
+ Returns a confirmation message with job IDs.';
251
+ -- Create "track_worker_function" function
252
+ CREATE FUNCTION "pgflow"."track_worker_function" ("function_name" text) RETURNS void LANGUAGE sql AS $$
253
+ insert into pgflow.worker_functions (function_name, updated_at)
254
+ values (track_worker_function.function_name, clock_timestamp())
255
+ on conflict (function_name)
256
+ do update set
257
+ updated_at = clock_timestamp();
258
+ $$;
259
+ -- Set comment to function: "track_worker_function"
260
+ COMMENT ON FUNCTION "pgflow"."track_worker_function" IS 'Registers an edge function for monitoring. Called by workers on startup.';
261
+ -- Drop "ensure_flow_compiled" function
262
+ DROP FUNCTION "pgflow"."ensure_flow_compiled" (text, jsonb, text);
263
+ -- Auto-install ensure_workers cron job (1 second interval)
264
+ SELECT pgflow.setup_ensure_workers_cron('1 second');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgflow/core",
3
- "version": "0.0.0-worker-compilation-b0fe6186-20251201124606",
3
+ "version": "0.0.0-worker-management-a4f969d1-20251208095931",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "dependencies": {
25
25
  "postgres": "^3.4.5",
26
- "@pgflow/dsl": "0.0.0-worker-compilation-b0fe6186-20251201124606"
26
+ "@pgflow/dsl": "0.0.0-worker-management-a4f969d1-20251208095931"
27
27
  },
28
28
  "publishConfig": {
29
29
  "access": "public"
package/dist/ATLAS.md DELETED
@@ -1,32 +0,0 @@
1
- # Atlas setup
2
-
3
- We use [Atlas](https://atlasgo.io/docs) to generate migrations from the declarative schemas stored in `./schemas/` folder.
4
-
5
- ## Configuration
6
-
7
- The setup is configured in `atlas.hcl`.
8
-
9
- It is set to compare `schemas/` to what is in `supabase/migrations/`.
10
-
11
- ### Docker dev image
12
-
13
- Atlas requires a dev database to be available for computing diffs.
14
- The database must be empty, but contain everything needed for the schemas to apply.
15
-
16
- We need a configured [PGMQ](https://github.com/tembo-io/pgmq) extension, which Atlas does not support
17
- in their dev images.
18
-
19
- That's why this setup relies on a custom built image `jumski/postgres-17-pgmq:latest`.
20
-
21
- Inspect `Dockerfile.atlas` to see how it is built.
22
-
23
- See also `./scripts/build-atlas-postgres-image` and `./scripts/push-atlas-postgres-image` scripts for building and pushing the image.
24
-
25
- ## Workflow
26
-
27
- 1. Make sure you start with a clean database (`pnpm supabase db reset`).
28
- 1. Modify the schemas in `schemas/` to a desired state.
29
- 1. Run `./scripts/atlas-migrate-diff <migration-name>` to create a new migration based on the diff.
30
- 1. Run `pnpm supabase migration up` to apply the migration.
31
- 1. In case of any errors, remove the generated migration file, make changes in `schemas/` and repeat the process.
32
- 1. After the migration is applied, verify it does not break tests with `nx test:pgtap`
@@ -1,133 +0,0 @@
1
- -- Create "_compare_flow_shapes" function
2
- CREATE FUNCTION "pgflow"."_compare_flow_shapes" ("p_local" jsonb, "p_db" jsonb) RETURNS text[] LANGUAGE plpgsql STABLE SET "search_path" = '' AS $BODY$
3
- DECLARE
4
- v_differences text[] := '{}';
5
- v_local_steps jsonb;
6
- v_db_steps jsonb;
7
- v_local_count int;
8
- v_db_count int;
9
- v_max_count int;
10
- v_idx int;
11
- v_local_step jsonb;
12
- v_db_step jsonb;
13
- v_local_deps text;
14
- v_db_deps text;
15
- BEGIN
16
- v_local_steps := p_local->'steps';
17
- v_db_steps := p_db->'steps';
18
- v_local_count := jsonb_array_length(COALESCE(v_local_steps, '[]'::jsonb));
19
- v_db_count := jsonb_array_length(COALESCE(v_db_steps, '[]'::jsonb));
20
-
21
- -- Compare step counts
22
- IF v_local_count != v_db_count THEN
23
- v_differences := array_append(
24
- v_differences,
25
- format('Step count differs: %s vs %s', v_local_count, v_db_count)
26
- );
27
- END IF;
28
-
29
- -- Compare steps by index
30
- v_max_count := GREATEST(v_local_count, v_db_count);
31
-
32
- FOR v_idx IN 0..(v_max_count - 1) LOOP
33
- v_local_step := v_local_steps->v_idx;
34
- v_db_step := v_db_steps->v_idx;
35
-
36
- IF v_local_step IS NULL THEN
37
- v_differences := array_append(
38
- v_differences,
39
- format(
40
- $$Step at index %s: missing in first shape (second has '%s')$$,
41
- v_idx,
42
- v_db_step->>'slug'
43
- )
44
- );
45
- ELSIF v_db_step IS NULL THEN
46
- v_differences := array_append(
47
- v_differences,
48
- format(
49
- $$Step at index %s: missing in second shape (first has '%s')$$,
50
- v_idx,
51
- v_local_step->>'slug'
52
- )
53
- );
54
- ELSE
55
- -- Compare slug
56
- IF v_local_step->>'slug' != v_db_step->>'slug' THEN
57
- v_differences := array_append(
58
- v_differences,
59
- format(
60
- $$Step at index %s: slug differs '%s' vs '%s'$$,
61
- v_idx,
62
- v_local_step->>'slug',
63
- v_db_step->>'slug'
64
- )
65
- );
66
- END IF;
67
-
68
- -- Compare step type
69
- IF v_local_step->>'stepType' != v_db_step->>'stepType' THEN
70
- v_differences := array_append(
71
- v_differences,
72
- format(
73
- $$Step at index %s: type differs '%s' vs '%s'$$,
74
- v_idx,
75
- v_local_step->>'stepType',
76
- v_db_step->>'stepType'
77
- )
78
- );
79
- END IF;
80
-
81
- -- Compare dependencies (convert arrays to comma-separated strings)
82
- SELECT string_agg(dep, ', ' ORDER BY dep)
83
- INTO v_local_deps
84
- FROM jsonb_array_elements_text(COALESCE(v_local_step->'dependencies', '[]'::jsonb)) AS dep;
85
-
86
- SELECT string_agg(dep, ', ' ORDER BY dep)
87
- INTO v_db_deps
88
- FROM jsonb_array_elements_text(COALESCE(v_db_step->'dependencies', '[]'::jsonb)) AS dep;
89
-
90
- IF COALESCE(v_local_deps, '') != COALESCE(v_db_deps, '') THEN
91
- v_differences := array_append(
92
- v_differences,
93
- format(
94
- $$Step at index %s: dependencies differ [%s] vs [%s]$$,
95
- v_idx,
96
- COALESCE(v_local_deps, ''),
97
- COALESCE(v_db_deps, '')
98
- )
99
- );
100
- END IF;
101
- END IF;
102
- END LOOP;
103
-
104
- RETURN v_differences;
105
- END;
106
- $BODY$;
107
- -- Create "_get_flow_shape" function
108
- CREATE FUNCTION "pgflow"."_get_flow_shape" ("p_flow_slug" text) RETURNS jsonb LANGUAGE sql STABLE SET "search_path" = '' AS $$
109
- SELECT jsonb_build_object(
110
- 'steps',
111
- COALESCE(
112
- jsonb_agg(
113
- jsonb_build_object(
114
- 'slug', step.step_slug,
115
- 'stepType', step.step_type,
116
- 'dependencies', COALESCE(
117
- (
118
- SELECT jsonb_agg(dep.dep_slug ORDER BY dep.dep_slug)
119
- FROM pgflow.deps AS dep
120
- WHERE dep.flow_slug = step.flow_slug
121
- AND dep.step_slug = step.step_slug
122
- ),
123
- '[]'::jsonb
124
- )
125
- )
126
- ORDER BY step.step_index
127
- ),
128
- '[]'::jsonb
129
- )
130
- )
131
- FROM pgflow.steps AS step
132
- WHERE step.flow_slug = p_flow_slug;
133
- $$;
@@ -1,42 +0,0 @@
1
- -- Create "_create_flow_from_shape" function
2
- CREATE FUNCTION "pgflow"."_create_flow_from_shape" ("p_flow_slug" text, "p_shape" jsonb) RETURNS void LANGUAGE plpgsql SET "search_path" = '' AS $$
3
- DECLARE
4
- v_step jsonb;
5
- v_deps text[];
6
- BEGIN
7
- -- Create the flow with defaults
8
- PERFORM pgflow.create_flow(p_flow_slug);
9
-
10
- -- Iterate over steps in order and add each one
11
- FOR v_step IN SELECT * FROM jsonb_array_elements(p_shape->'steps')
12
- LOOP
13
- -- Convert dependencies jsonb array to text array
14
- SELECT COALESCE(array_agg(dep), '{}')
15
- INTO v_deps
16
- FROM jsonb_array_elements_text(COALESCE(v_step->'dependencies', '[]'::jsonb)) AS dep;
17
-
18
- -- Add the step
19
- PERFORM pgflow.add_step(
20
- flow_slug => p_flow_slug,
21
- step_slug => v_step->>'slug',
22
- deps_slugs => v_deps,
23
- step_type => v_step->>'stepType'
24
- );
25
- END LOOP;
26
- END;
27
- $$;
28
- -- Create "delete_flow_and_data" function
29
- CREATE FUNCTION "pgflow"."delete_flow_and_data" ("p_flow_slug" text) RETURNS void LANGUAGE plpgsql SET "search_path" = '' AS $$
30
- BEGIN
31
- -- Drop queue and archive table (pgmq)
32
- PERFORM pgmq.drop_queue(p_flow_slug);
33
-
34
- -- Delete all associated data in the correct order (respecting FK constraints)
35
- DELETE FROM pgflow.step_tasks AS task WHERE task.flow_slug = p_flow_slug;
36
- DELETE FROM pgflow.step_states AS state WHERE state.flow_slug = p_flow_slug;
37
- DELETE FROM pgflow.runs AS run WHERE run.flow_slug = p_flow_slug;
38
- DELETE FROM pgflow.deps AS dep WHERE dep.flow_slug = p_flow_slug;
39
- DELETE FROM pgflow.steps AS step WHERE step.flow_slug = p_flow_slug;
40
- DELETE FROM pgflow.flows AS flow WHERE flow.flow_slug = p_flow_slug;
41
- END;
42
- $$;
@@ -1,40 +0,0 @@
1
- -- Create "ensure_flow_compiled" function
2
- CREATE FUNCTION "pgflow"."ensure_flow_compiled" ("p_flow_slug" text, "p_shape" jsonb, "p_mode" text DEFAULT 'production') RETURNS jsonb LANGUAGE plpgsql SET "search_path" = '' AS $$
3
- DECLARE
4
- v_flow_exists boolean;
5
- v_db_shape jsonb;
6
- v_differences text[];
7
- BEGIN
8
- -- 1. Check if flow exists
9
- SELECT EXISTS(SELECT 1 FROM pgflow.flows AS flow WHERE flow.flow_slug = p_flow_slug)
10
- INTO v_flow_exists;
11
-
12
- -- 2. If flow missing: compile (both modes)
13
- IF NOT v_flow_exists THEN
14
- PERFORM pgflow._create_flow_from_shape(p_flow_slug, p_shape);
15
- RETURN jsonb_build_object('status', 'compiled', 'differences', '[]'::jsonb);
16
- END IF;
17
-
18
- -- 3. Get current shape from DB
19
- v_db_shape := pgflow._get_flow_shape(p_flow_slug);
20
-
21
- -- 4. Compare shapes
22
- v_differences := pgflow._compare_flow_shapes(p_shape, v_db_shape);
23
-
24
- -- 5. If shapes match: return verified
25
- IF array_length(v_differences, 1) IS NULL THEN
26
- RETURN jsonb_build_object('status', 'verified', 'differences', '[]'::jsonb);
27
- END IF;
28
-
29
- -- 6. Shapes differ - handle by mode
30
- IF p_mode = 'development' THEN
31
- -- Recompile in dev mode: full deletion + fresh compile
32
- PERFORM pgflow.delete_flow_and_data(p_flow_slug);
33
- PERFORM pgflow._create_flow_from_shape(p_flow_slug, p_shape);
34
- RETURN jsonb_build_object('status', 'recompiled', 'differences', to_jsonb(v_differences));
35
- ELSE
36
- -- Fail in production mode
37
- RETURN jsonb_build_object('status', 'mismatch', 'differences', to_jsonb(v_differences));
38
- END IF;
39
- END;
40
- $$;
@@ -1,72 +0,0 @@
1
- -- Modify "create_flow" function
2
- CREATE OR REPLACE FUNCTION "pgflow"."create_flow" ("flow_slug" text, "max_attempts" integer DEFAULT NULL::integer, "base_delay" integer DEFAULT NULL::integer, "timeout" integer DEFAULT NULL::integer) RETURNS "pgflow"."flows" LANGUAGE sql SET "search_path" = '' AS $$
3
- WITH
4
- defaults AS (
5
- SELECT 3 AS def_max_attempts, 5 AS def_base_delay, 60 AS def_timeout
6
- ),
7
- flow_upsert AS (
8
- INSERT INTO pgflow.flows (flow_slug, opt_max_attempts, opt_base_delay, opt_timeout)
9
- SELECT
10
- flow_slug,
11
- COALESCE(max_attempts, defaults.def_max_attempts),
12
- COALESCE(base_delay, defaults.def_base_delay),
13
- COALESCE(timeout, defaults.def_timeout)
14
- FROM defaults
15
- ON CONFLICT (flow_slug) DO UPDATE
16
- SET flow_slug = pgflow.flows.flow_slug -- Dummy update
17
- RETURNING *
18
- ),
19
- ensure_queue AS (
20
- SELECT pgmq.create(flow_slug)
21
- WHERE NOT EXISTS (
22
- SELECT 1 FROM pgmq.list_queues() WHERE queue_name = flow_slug
23
- )
24
- )
25
- SELECT f.*
26
- FROM flow_upsert f
27
- LEFT JOIN (SELECT 1 FROM ensure_queue) _dummy ON true; -- Left join ensures flow is returned
28
- $$;
29
- -- Modify "_create_flow_from_shape" function
30
- CREATE OR REPLACE FUNCTION "pgflow"."_create_flow_from_shape" ("p_flow_slug" text, "p_shape" jsonb) RETURNS void LANGUAGE plpgsql SET "search_path" = '' AS $$
31
- DECLARE
32
- v_step jsonb;
33
- v_deps text[];
34
- v_flow_options jsonb;
35
- v_step_options jsonb;
36
- BEGIN
37
- -- Extract flow-level options (may be null)
38
- v_flow_options := p_shape->'options';
39
-
40
- -- Create the flow with options (NULL = use default)
41
- PERFORM pgflow.create_flow(
42
- p_flow_slug,
43
- (v_flow_options->>'maxAttempts')::int,
44
- (v_flow_options->>'baseDelay')::int,
45
- (v_flow_options->>'timeout')::int
46
- );
47
-
48
- -- Iterate over steps in order and add each one
49
- FOR v_step IN SELECT * FROM jsonb_array_elements(p_shape->'steps')
50
- LOOP
51
- -- Convert dependencies jsonb array to text array
52
- SELECT COALESCE(array_agg(dep), '{}')
53
- INTO v_deps
54
- FROM jsonb_array_elements_text(COALESCE(v_step->'dependencies', '[]'::jsonb)) AS dep;
55
-
56
- -- Extract step options (may be null)
57
- v_step_options := v_step->'options';
58
-
59
- -- Add the step with options (NULL = use default/inherit)
60
- PERFORM pgflow.add_step(
61
- flow_slug => p_flow_slug,
62
- step_slug => v_step->>'slug',
63
- deps_slugs => v_deps,
64
- max_attempts => (v_step_options->>'maxAttempts')::int,
65
- base_delay => (v_step_options->>'baseDelay')::int,
66
- timeout => (v_step_options->>'timeout')::int,
67
- start_delay => (v_step_options->>'startDelay')::int,
68
- step_type => v_step->>'stepType'
69
- );
70
- END LOOP;
71
- END;
72
- $$;
@@ -1,48 +0,0 @@
1
- -- Modify "ensure_flow_compiled" function
2
- CREATE OR REPLACE FUNCTION "pgflow"."ensure_flow_compiled" ("p_flow_slug" text, "p_shape" jsonb, "p_mode" text DEFAULT 'production') RETURNS jsonb LANGUAGE plpgsql SET "search_path" = '' AS $$
3
- DECLARE
4
- v_lock_key int;
5
- v_flow_exists boolean;
6
- v_db_shape jsonb;
7
- v_differences text[];
8
- BEGIN
9
- -- Generate lock key from flow_slug (deterministic hash)
10
- v_lock_key := hashtext(p_flow_slug);
11
-
12
- -- Acquire transaction-level advisory lock
13
- -- Serializes concurrent compilation attempts for same flow
14
- PERFORM pg_advisory_xact_lock(1, v_lock_key);
15
-
16
- -- 1. Check if flow exists
17
- SELECT EXISTS(SELECT 1 FROM pgflow.flows AS flow WHERE flow.flow_slug = p_flow_slug)
18
- INTO v_flow_exists;
19
-
20
- -- 2. If flow missing: compile (both modes)
21
- IF NOT v_flow_exists THEN
22
- PERFORM pgflow._create_flow_from_shape(p_flow_slug, p_shape);
23
- RETURN jsonb_build_object('status', 'compiled', 'differences', '[]'::jsonb);
24
- END IF;
25
-
26
- -- 3. Get current shape from DB
27
- v_db_shape := pgflow._get_flow_shape(p_flow_slug);
28
-
29
- -- 4. Compare shapes
30
- v_differences := pgflow._compare_flow_shapes(p_shape, v_db_shape);
31
-
32
- -- 5. If shapes match: return verified
33
- IF array_length(v_differences, 1) IS NULL THEN
34
- RETURN jsonb_build_object('status', 'verified', 'differences', '[]'::jsonb);
35
- END IF;
36
-
37
- -- 6. Shapes differ - handle by mode
38
- IF p_mode = 'development' THEN
39
- -- Recompile in dev mode: full deletion + fresh compile
40
- PERFORM pgflow.delete_flow_and_data(p_flow_slug);
41
- PERFORM pgflow._create_flow_from_shape(p_flow_slug, p_shape);
42
- RETURN jsonb_build_object('status', 'recompiled', 'differences', to_jsonb(v_differences));
43
- ELSE
44
- -- Fail in production mode
45
- RETURN jsonb_build_object('status', 'mismatch', 'differences', to_jsonb(v_differences));
46
- END IF;
47
- END;
48
- $$;