@pgflow/core 0.0.0-logger-improvements-0b909bce-20251209215048 → 0.0.0-pgflow-installer-45a8ec76-20251211182851
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/dist/CHANGELOG.md +8 -2
- package/dist/migrations/_generated/m_20250429164909.d.ts +3 -0
- package/dist/migrations/_generated/m_20250429164909.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250429164909.js +584 -0
- package/dist/migrations/_generated/m_20250517072017.d.ts +3 -0
- package/dist/migrations/_generated/m_20250517072017.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250517072017.js +106 -0
- package/dist/migrations/_generated/m_20250609105135.d.ts +3 -0
- package/dist/migrations/_generated/m_20250609105135.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250609105135.js +376 -0
- package/dist/migrations/_generated/m_20250610180554.d.ts +3 -0
- package/dist/migrations/_generated/m_20250610180554.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250610180554.js +132 -0
- package/dist/migrations/_generated/m_20250614124241.d.ts +3 -0
- package/dist/migrations/_generated/m_20250614124241.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250614124241.js +506 -0
- package/dist/migrations/_generated/m_20250619195327.d.ts +3 -0
- package/dist/migrations/_generated/m_20250619195327.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250619195327.js +190 -0
- package/dist/migrations/_generated/m_20250627090700.d.ts +3 -0
- package/dist/migrations/_generated/m_20250627090700.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250627090700.js +11 -0
- package/dist/migrations/_generated/m_20250707210212.d.ts +3 -0
- package/dist/migrations/_generated/m_20250707210212.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250707210212.js +108 -0
- package/dist/migrations/_generated/m_20250719205006.d.ts +3 -0
- package/dist/migrations/_generated/m_20250719205006.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20250719205006.js +7 -0
- package/dist/migrations/_generated/m_20251006073122.d.ts +3 -0
- package/dist/migrations/_generated/m_20251006073122.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20251006073122.js +1249 -0
- package/dist/migrations/_generated/m_20251103222045.d.ts +3 -0
- package/dist/migrations/_generated/m_20251103222045.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20251103222045.js +627 -0
- package/dist/migrations/_generated/m_20251104080523.d.ts +3 -0
- package/dist/migrations/_generated/m_20251104080523.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20251104080523.js +98 -0
- package/dist/migrations/_generated/m_20251130000000.d.ts +3 -0
- package/dist/migrations/_generated/m_20251130000000.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20251130000000.js +273 -0
- package/dist/migrations/_generated/m_20251209074533.d.ts +3 -0
- package/dist/migrations/_generated/m_20251209074533.d.ts.map +1 -0
- package/dist/migrations/_generated/m_20251209074533.js +278 -0
- package/dist/migrations/index.d.ts +11 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +39 -0
- package/dist/migrations/types.d.ts +12 -0
- package/dist/migrations/types.d.ts.map +1 -0
- package/dist/migrations/types.js +1 -0
- package/dist/package.json +10 -1
- package/package.json +11 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m_20250627090700.d.ts","sourceRoot":"","sources":["../../../src/migrations/_generated/m_20250627090700.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,SAAS,EAAE,SAUvB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export const migration = {
|
|
2
|
+
timestamp: '20250627090700',
|
|
3
|
+
filename: '20250627090700_pgflow_fix_function_search_paths.sql',
|
|
4
|
+
content: `-- Add "calculate_retry_delay" function configuration parameter
|
|
5
|
+
ALTER FUNCTION "pgflow"."calculate_retry_delay" SET "search_path" = '';
|
|
6
|
+
-- Add "is_valid_slug" function configuration parameter
|
|
7
|
+
ALTER FUNCTION "pgflow"."is_valid_slug" SET "search_path" = '';
|
|
8
|
+
-- Add "read_with_poll" function configuration parameter
|
|
9
|
+
ALTER FUNCTION "pgflow"."read_with_poll" SET "search_path" = '';
|
|
10
|
+
`,
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m_20250707210212.d.ts","sourceRoot":"","sources":["../../../src/migrations/_generated/m_20250707210212.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,SAAS,EAAE,SA2GvB,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export const migration = {
|
|
2
|
+
timestamp: '20250707210212',
|
|
3
|
+
filename: '20250707210212_pgflow_add_opt_start_delay.sql',
|
|
4
|
+
content: `-- Modify "steps" table
|
|
5
|
+
ALTER TABLE "pgflow"."steps" ADD CONSTRAINT "opt_start_delay_is_nonnegative" CHECK ((opt_start_delay IS NULL) OR (opt_start_delay >= 0)), ADD COLUMN "opt_start_delay" integer NULL;
|
|
6
|
+
-- Modify "start_ready_steps" function
|
|
7
|
+
CREATE OR REPLACE FUNCTION "pgflow"."start_ready_steps" ("run_id" uuid) RETURNS void LANGUAGE sql SET "search_path" = '' AS $$
|
|
8
|
+
WITH ready_steps AS (
|
|
9
|
+
SELECT *
|
|
10
|
+
FROM pgflow.step_states AS step_state
|
|
11
|
+
WHERE step_state.run_id = start_ready_steps.run_id
|
|
12
|
+
AND step_state.status = 'created'
|
|
13
|
+
AND step_state.remaining_deps = 0
|
|
14
|
+
ORDER BY step_state.step_slug
|
|
15
|
+
FOR UPDATE
|
|
16
|
+
),
|
|
17
|
+
started_step_states AS (
|
|
18
|
+
UPDATE pgflow.step_states
|
|
19
|
+
SET status = 'started',
|
|
20
|
+
started_at = now()
|
|
21
|
+
FROM ready_steps
|
|
22
|
+
WHERE pgflow.step_states.run_id = start_ready_steps.run_id
|
|
23
|
+
AND pgflow.step_states.step_slug = ready_steps.step_slug
|
|
24
|
+
RETURNING pgflow.step_states.*
|
|
25
|
+
),
|
|
26
|
+
sent_messages AS (
|
|
27
|
+
SELECT
|
|
28
|
+
started_step.flow_slug,
|
|
29
|
+
started_step.run_id,
|
|
30
|
+
started_step.step_slug,
|
|
31
|
+
pgmq.send(
|
|
32
|
+
started_step.flow_slug,
|
|
33
|
+
jsonb_build_object(
|
|
34
|
+
'flow_slug', started_step.flow_slug,
|
|
35
|
+
'run_id', started_step.run_id,
|
|
36
|
+
'step_slug', started_step.step_slug,
|
|
37
|
+
'task_index', 0
|
|
38
|
+
),
|
|
39
|
+
COALESCE(step.opt_start_delay, 0)
|
|
40
|
+
) AS msg_id
|
|
41
|
+
FROM started_step_states AS started_step
|
|
42
|
+
JOIN pgflow.steps AS step
|
|
43
|
+
ON step.flow_slug = started_step.flow_slug
|
|
44
|
+
AND step.step_slug = started_step.step_slug
|
|
45
|
+
),
|
|
46
|
+
broadcast_events AS (
|
|
47
|
+
SELECT
|
|
48
|
+
realtime.send(
|
|
49
|
+
jsonb_build_object(
|
|
50
|
+
'event_type', 'step:started',
|
|
51
|
+
'run_id', started_step.run_id,
|
|
52
|
+
'step_slug', started_step.step_slug,
|
|
53
|
+
'status', 'started',
|
|
54
|
+
'started_at', started_step.started_at,
|
|
55
|
+
'remaining_tasks', 1,
|
|
56
|
+
'remaining_deps', started_step.remaining_deps
|
|
57
|
+
),
|
|
58
|
+
concat('step:', started_step.step_slug, ':started'),
|
|
59
|
+
concat('pgflow:run:', started_step.run_id),
|
|
60
|
+
false
|
|
61
|
+
)
|
|
62
|
+
FROM started_step_states AS started_step
|
|
63
|
+
)
|
|
64
|
+
INSERT INTO pgflow.step_tasks (flow_slug, run_id, step_slug, message_id)
|
|
65
|
+
SELECT
|
|
66
|
+
sent_messages.flow_slug,
|
|
67
|
+
sent_messages.run_id,
|
|
68
|
+
sent_messages.step_slug,
|
|
69
|
+
sent_messages.msg_id
|
|
70
|
+
FROM sent_messages;
|
|
71
|
+
$$;
|
|
72
|
+
-- Create "add_step" function
|
|
73
|
+
CREATE FUNCTION "pgflow"."add_step" ("flow_slug" text, "step_slug" text, "deps_slugs" text[], "max_attempts" integer DEFAULT NULL::integer, "base_delay" integer DEFAULT NULL::integer, "timeout" integer DEFAULT NULL::integer, "start_delay" integer DEFAULT NULL::integer) RETURNS "pgflow"."steps" LANGUAGE sql SET "search_path" = '' AS $$
|
|
74
|
+
WITH
|
|
75
|
+
next_index AS (
|
|
76
|
+
SELECT COALESCE(MAX(step_index) + 1, 0) as idx
|
|
77
|
+
FROM pgflow.steps
|
|
78
|
+
WHERE flow_slug = add_step.flow_slug
|
|
79
|
+
),
|
|
80
|
+
create_step AS (
|
|
81
|
+
INSERT INTO pgflow.steps (flow_slug, step_slug, step_index, deps_count, opt_max_attempts, opt_base_delay, opt_timeout, opt_start_delay)
|
|
82
|
+
SELECT add_step.flow_slug, add_step.step_slug, idx, COALESCE(array_length(deps_slugs, 1), 0), max_attempts, base_delay, timeout, start_delay
|
|
83
|
+
FROM next_index
|
|
84
|
+
ON CONFLICT (flow_slug, step_slug)
|
|
85
|
+
DO UPDATE SET step_slug = pgflow.steps.step_slug
|
|
86
|
+
RETURNING *
|
|
87
|
+
),
|
|
88
|
+
insert_deps AS (
|
|
89
|
+
INSERT INTO pgflow.deps (flow_slug, dep_slug, step_slug)
|
|
90
|
+
SELECT add_step.flow_slug, d.dep_slug, add_step.step_slug
|
|
91
|
+
FROM unnest(deps_slugs) AS d(dep_slug)
|
|
92
|
+
ON CONFLICT (flow_slug, dep_slug, step_slug) DO NOTHING
|
|
93
|
+
RETURNING 1
|
|
94
|
+
)
|
|
95
|
+
-- Return the created step
|
|
96
|
+
SELECT * FROM create_step;
|
|
97
|
+
$$;
|
|
98
|
+
-- Drop "add_step" function
|
|
99
|
+
DROP FUNCTION "pgflow"."add_step" (text, text, integer, integer, integer);
|
|
100
|
+
-- Drop "add_step" function
|
|
101
|
+
DROP FUNCTION "pgflow"."add_step" (text, text, text[], integer, integer, integer);
|
|
102
|
+
-- Create "add_step" function
|
|
103
|
+
CREATE FUNCTION "pgflow"."add_step" ("flow_slug" text, "step_slug" text, "max_attempts" integer DEFAULT NULL::integer, "base_delay" integer DEFAULT NULL::integer, "timeout" integer DEFAULT NULL::integer, "start_delay" integer DEFAULT NULL::integer) RETURNS "pgflow"."steps" LANGUAGE sql SET "search_path" = '' AS $$
|
|
104
|
+
-- Call the original function with an empty array
|
|
105
|
+
SELECT * FROM pgflow.add_step(flow_slug, step_slug, ARRAY[]::text[], max_attempts, base_delay, timeout, start_delay);
|
|
106
|
+
$$;
|
|
107
|
+
`,
|
|
108
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m_20250719205006.d.ts","sourceRoot":"","sources":["../../../src/migrations/_generated/m_20250719205006.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,SAAS,EAAE,SAMvB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export const migration = {
|
|
2
|
+
timestamp: '20250719205006',
|
|
3
|
+
filename: '20250719205006_pgflow_worker_deprecation.sql',
|
|
4
|
+
content: `-- Rename a column from "stopped_at" to "deprecated_at"
|
|
5
|
+
ALTER TABLE "pgflow"."workers" RENAME COLUMN "stopped_at" TO "deprecated_at";
|
|
6
|
+
`,
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"m_20251006073122.d.ts","sourceRoot":"","sources":["../../../src/migrations/_generated/m_20251006073122.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,eAAO,MAAM,SAAS,EAAE,SAguCvB,CAAC"}
|