Skip to content

Commit e8e2510

Browse files
committed
feat: demo rename slugs
1 parent fb04517 commit e8e2510

File tree

12 files changed

+106
-92
lines changed

12 files changed

+106
-92
lines changed

apps/demo/src/lib/components/CodePanel.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
let isMobile = $state(false);
2828
2929
// Section order for mobile rendering
30-
const SECTION_ORDER = ['flow_config', 'fetch_article', 'summarize', 'extract_keywords', 'publish'];
30+
const SECTION_ORDER = ['flow_config', 'fetchArticle', 'summarize', 'extractKeywords', 'publish'];
3131
3232
// Calculate step blocks (groups of lines) for status icon positioning
3333
const stepBlocks = $derived.by(() => {

apps/demo/src/lib/components/DAGVisualization.svelte

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@
9292
// Shifted up by 30px to center better in viewport
9393
let nodes = $derived([
9494
{
95-
id: 'fetch_article',
95+
id: 'fetchArticle',
9696
type: 'default',
9797
position: { x: 150, y: -30 },
98-
data: { label: 'fetch_article' },
99-
class: getNodeClass('fetch_article'),
98+
data: { label: 'fetchArticle' },
99+
class: getNodeClass('fetchArticle'),
100100
draggable: false
101101
},
102102
{
@@ -108,11 +108,11 @@
108108
draggable: false
109109
},
110110
{
111-
id: 'extract_keywords',
111+
id: 'extractKeywords',
112112
type: 'default',
113113
position: { x: 250, y: 51 },
114-
data: { label: 'extract_keywords' },
115-
class: getNodeClass('extract_keywords'),
114+
data: { label: 'extractKeywords' },
115+
class: getNodeClass('extractKeywords'),
116116
draggable: false
117117
},
118118
{
@@ -128,17 +128,17 @@
128128
let edges = $derived.by(() => [
129129
{
130130
id: 'e1',
131-
source: 'fetch_article',
131+
source: 'fetchArticle',
132132
target: 'summarize',
133-
animated: isEdgeActive('fetch_article', 'summarize'),
134-
class: getEdgeClass('fetch_article', 'summarize')
133+
animated: isEdgeActive('fetchArticle', 'summarize'),
134+
class: getEdgeClass('fetchArticle', 'summarize')
135135
},
136136
{
137137
id: 'e2',
138-
source: 'fetch_article',
139-
target: 'extract_keywords',
140-
animated: isEdgeActive('fetch_article', 'extract_keywords'),
141-
class: getEdgeClass('fetch_article', 'extract_keywords')
138+
source: 'fetchArticle',
139+
target: 'extractKeywords',
140+
animated: isEdgeActive('fetchArticle', 'extractKeywords'),
141+
class: getEdgeClass('fetchArticle', 'extractKeywords')
142142
},
143143
{
144144
id: 'e3',
@@ -149,10 +149,10 @@
149149
},
150150
{
151151
id: 'e4',
152-
source: 'extract_keywords',
152+
source: 'extractKeywords',
153153
target: 'publish',
154-
animated: isEdgeActive('extract_keywords', 'publish'),
155-
class: getEdgeClass('extract_keywords', 'publish')
154+
animated: isEdgeActive('extractKeywords', 'publish'),
155+
class: getEdgeClass('extractKeywords', 'publish')
156156
}
157157
]);
158158

apps/demo/src/lib/components/ExplanationPanel.svelte

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -51,31 +51,31 @@
5151
inputType: `{
5252
url: string
5353
}`,
54-
steps: ['fetch_article', 'summarize', 'extract_keywords', 'publish']
54+
steps: ['fetchArticle', 'summarize', 'extractKeywords', 'publish']
5555
};
5656
5757
// Step-level concept explanations (how pgflow works internally)
5858
const stepConcepts: Record<string, string> = {
59-
fetch_article:
59+
fetchArticle:
6060
"This is a root step with no dependencies. When start_flow() is called, SQL Core immediately " +
6161
"pushes a message to the queue. The Worker polls, gets the message, executes the handler, " +
6262
"and calls complete_task() with the return value. SQL Core acknowledges completion, saves the output, " +
6363
"and checks which dependent steps now have all their dependencies satisfied.",
6464
6565
summarize:
66-
"Depends on fetch_article. After fetch_article completes, SQL Core checks if this step's " +
67-
"dependencies are met. Since fetch_article is the only dependency, this step becomes ready " +
68-
"immediately. SQL Core pushes a message with the input payload (fetch_article's output). " +
66+
"Depends on fetchArticle. After fetchArticle completes, SQL Core checks if this step's " +
67+
"dependencies are met. Since fetchArticle is the only dependency, this step becomes ready " +
68+
"immediately. SQL Core pushes a message with the input payload (fetchArticle's output). " +
6969
"Worker polls, executes the handler, calls complete_task(). SQL Core acknowledges completion and saves output.",
7070
71-
extract_keywords:
72-
"Also depends only on fetch_article, so it becomes ready at the same time as summarize. " +
71+
extractKeywords:
72+
"Also depends only on fetchArticle, so it becomes ready at the same time as summarize. " +
7373
"Both messages hit the queue simultaneously - whichever Worker polls first starts execution. " +
7474
"This is how pgflow achieves parallel execution: SQL Core identifies ready steps and pushes messages, " +
7575
"Workers execute independently.",
7676
7777
publish:
78-
"Depends on both summarize AND extract_keywords. This step remains blocked until both " +
78+
"Depends on both summarize AND extractKeywords. This step remains blocked until both " +
7979
"dependencies complete. After the second one finishes, complete_task() acknowledges completion, " +
8080
"saves output, checks dependencies, and finds publish is now ready. SQL Core pushes the message " +
8181
"with both outputs as input. After publish completes, no dependent steps remain - the run is marked completed."
@@ -94,13 +94,13 @@
9494
returns: string;
9595
}
9696
> = {
97-
fetch_article: {
98-
name: 'fetch_article',
97+
fetchArticle: {
98+
name: 'fetchArticle',
9999
displayName: 'Fetch Article',
100100
whatItDoes:
101101
'Fetches article content from the provided URL using r.jina.ai. Returns both the article text and title for downstream processing.',
102102
dependsOn: [],
103-
dependents: ['summarize', 'extract_keywords'],
103+
dependents: ['summarize', 'extractKeywords'],
104104
inputType: `{
105105
run: {
106106
url: string
@@ -116,25 +116,25 @@
116116
displayName: 'Summarize',
117117
whatItDoes:
118118
'Uses an LLM (Groq) to generate a concise summary of the article content. Runs in parallel with keyword extraction for efficiency.',
119-
dependsOn: ['fetch_article'],
119+
dependsOn: ['fetchArticle'],
120120
dependents: ['publish'],
121121
inputType: `{
122-
fetch_article: {
122+
fetchArticle: {
123123
content: string
124124
title: string
125125
}
126126
}`,
127127
returns: 'string'
128128
},
129-
extract_keywords: {
130-
name: 'extract_keywords',
129+
extractKeywords: {
130+
name: 'extractKeywords',
131131
displayName: 'Extract Keywords',
132132
whatItDoes:
133133
'Uses an LLM (Groq) to extract key terms and topics from the article. Runs in parallel with summarization for efficiency.',
134-
dependsOn: ['fetch_article'],
134+
dependsOn: ['fetchArticle'],
135135
dependents: ['publish'],
136136
inputType: `{
137-
fetch_article: {
137+
fetchArticle: {
138138
content: string
139139
}
140140
}`,
@@ -145,11 +145,11 @@
145145
displayName: 'Publish',
146146
whatItDoes:
147147
'Combines the summary and keywords and publishes the processed article. In this demo, generates a mock article ID—in production, this would save to a database.',
148-
dependsOn: ['summarize', 'extract_keywords'],
148+
dependsOn: ['summarize', 'extractKeywords'],
149149
dependents: [],
150150
inputType: `{
151151
summarize: string
152-
extract_keywords: string[]
152+
extractKeywords: string[]
153153
}`,
154154
returns: 'string'
155155
}

apps/demo/src/lib/components/MiniDAG.svelte

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@
1616
1717
// Define nodes positions (x,y = center of node) - vertical layout
1818
const nodes = [
19-
{ id: 'fetch_article', x: 60, y: 20, label: 'fetch' },
19+
{ id: 'fetchArticle', x: 60, y: 20, label: 'fetch' },
2020
{ id: 'summarize', x: 25, y: 60, label: 'summ' },
21-
{ id: 'extract_keywords', x: 95, y: 60, label: 'kwrds' },
21+
{ id: 'extractKeywords', x: 95, y: 60, label: 'kwrds' },
2222
{ id: 'publish', x: 60, y: 100, label: 'pub' }
2323
];
2424
2525
// Define edges
2626
const edges = [
27-
{ from: 'fetch_article', to: 'summarize' },
28-
{ from: 'fetch_article', to: 'extract_keywords' },
27+
{ from: 'fetchArticle', to: 'summarize' },
28+
{ from: 'fetchArticle', to: 'extractKeywords' },
2929
{ from: 'summarize', to: 'publish' },
30-
{ from: 'extract_keywords', to: 'publish' }
30+
{ from: 'extractKeywords', to: 'publish' }
3131
];
3232
3333
// Helper function to create smooth curved paths for vertical layout

apps/demo/src/lib/components/WelcomeModal.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@
4747
<!-- First-time welcome -->
4848
<div class="space-y-4">
4949
<p class="text-sm text-muted-foreground">
50-
This demo is a 4-step DAG workflow: fetch → (summarize + extract_keywords in parallel) → publish.
50+
This demo is a 4-step DAG workflow: fetch → (summarize + extractKeywords in parallel) → publish.
5151
Watch how pgflow orchestrates execution across three layers.
5252
</p>
5353

@@ -100,7 +100,7 @@
100100
<span class="font-mono text-foreground">start_flow()</span> created state rows for each step
101101
</div>
102102
<div>
103-
SQL Core pushed <span class="font-mono text-foreground">fetch_article</span> message to queue
103+
SQL Core pushed <span class="font-mono text-foreground">fetchArticle</span> message to queue
104104
</div>
105105
<div>
106106
Worker polled queue, executed handler, called <span class="font-mono text-foreground">complete_task()</span>

apps/demo/src/lib/data/flow-code.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,65 +22,65 @@ export const FLOW_SECTIONS: Record<string, CodeSection> = {
2222
maxAttempts: 3
2323
})`
2424
},
25-
fetch_article: {
25+
fetchArticle: {
2626
code: ` .step(
27-
{ slug: 'fetch_article' },
27+
{ slug: 'fetchArticle' },
2828
(input) => scrapeUrl(input.run.url)
2929
)`,
3030
mobileCode: ` .step(
31-
{ slug: 'fetch_article' },
31+
{ slug: 'fetchArticle' },
3232
(input) => scrapeUrl(
3333
input.run.url
3434
)
3535
)`
3636
},
3737
summarize: {
3838
code: ` .step(
39-
{ slug: 'summarize', dependsOn: ['fetch_article'] },
40-
(input) => summarize(schema, input.fetch_article.content)
39+
{ slug: 'summarize', dependsOn: ['fetchArticle'] },
40+
(input) => summarize(schema, input.fetchArticle.content)
4141
)`,
4242
mobileCode: ` .step(
4343
{
4444
slug: 'summarize',
45-
dependsOn: ['fetch_article']
45+
dependsOn: ['fetchArticle']
4646
},
4747
(input) => summarize(
4848
schema,
49-
input.fetch_article.content
49+
input.fetchArticle.content
5050
)
5151
)`
5252
},
53-
extract_keywords: {
53+
extractKeywords: {
5454
code: ` .step(
55-
{ slug: 'extract_keywords', dependsOn: ['fetch_article'] },
56-
(input) => extractKeywords(input.fetch_article.content)
55+
{ slug: 'extractKeywords', dependsOn: ['fetchArticle'] },
56+
(input) => extractKeywords(input.fetchArticle.content)
5757
)`,
5858
mobileCode: ` .step(
5959
{
60-
slug: 'extract_keywords',
61-
dependsOn: ['fetch_article']
60+
slug: 'extractKeywords',
61+
dependsOn: ['fetchArticle']
6262
},
6363
(input) => extractKeywords(
64-
input.fetch_article.content
64+
input.fetchArticle.content
6565
)
6666
)`
6767
},
6868
publish: {
6969
code: ` .step(
70-
{ slug: 'publish', dependsOn: ['summarize', 'extract_keywords'] },
71-
(input) => publishArticle(input.summarize, input.extract_keywords)
70+
{ slug: 'publish', dependsOn: ['summarize', 'extractKeywords'] },
71+
(input) => publishArticle(input.summarize, input.extractKeywords)
7272
);`,
7373
mobileCode: ` .step(
7474
{
7575
slug: 'publish',
7676
dependsOn: [
7777
'summarize',
78-
'extract_keywords'
78+
'extractKeywords'
7979
]
8080
},
8181
(input) => publishArticle(
8282
input.summarize,
83-
input.extract_keywords
83+
input.extractKeywords
8484
)
8585
);`
8686
}
@@ -91,7 +91,7 @@ export const FLOW_SECTIONS: Record<string, CodeSection> = {
9191
*/
9292
function calculateLineRanges() {
9393
let currentLine = 1;
94-
const orderedSlugs = ['flow_config', 'fetch_article', 'summarize', 'extract_keywords', 'publish'];
94+
const orderedSlugs = ['flow_config', 'fetchArticle', 'summarize', 'extractKeywords', 'publish'];
9595

9696
for (const slug of orderedSlugs) {
9797
const section = FLOW_SECTIONS[slug];

apps/demo/src/lib/stores/MIGRATION_GUIDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The improved pattern fixes these key issues:
2020
const pgflowState = createPgflowState<typeof ArticleFlow>(
2121
pgflow,
2222
'article_flow',
23-
['fetch_article', 'summarize', 'extract_keywords', 'publish'] // ❌ Manual list
23+
['fetchArticle', 'summarize', 'extractKeywords', 'publish'] // ❌ Manual list
2424
);
2525
```
2626

@@ -107,9 +107,9 @@ This enables monitoring flows started by:
107107
import type ArticleFlow from './article_flow';
108108
109109
const pgflowState = createPgflowState<typeof ArticleFlow>(pgflow, 'article_flow', [
110-
'fetch_article',
110+
'fetchArticle',
111111
'summarize',
112-
'extract_keywords',
112+
'extractKeywords',
113113
'publish'
114114
]);
115115

apps/demo/src/lib/stores/pgflow-state-improved.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ export function createFlowState<TFlow extends AnyFlow>(
259259
* const flowState = createFlowState<typeof ArticleFlow>(
260260
* pgflow,
261261
* 'article_flow',
262-
* ['fetch_article', 'summarize', 'extract_keywords', 'publish']
262+
* ['fetchArticle', 'summarize', 'extractKeywords', 'publish']
263263
* );
264264
*
265265
* async function start() {

apps/demo/src/lib/stores/pgflow-state.svelte.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ class PgflowState<TFlow extends AnyFlow = AnyFlow> {
161161
* const articleFlowState = createPgflowState<typeof ArticleFlow>(
162162
* pgflowClient,
163163
* 'article_flow',
164-
* ['fetch_article', 'summarize', 'extract_keywords', 'publish']
164+
* ['fetchArticle', 'summarize', 'extractKeywords', 'publish']
165165
* );
166166
*
167167
* // Start the flow

apps/demo/src/routes/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
import type ArticleFlow from '../../supabase/functions/article_flow_worker/article_flow';
1515
1616
const flowState = createFlowState<typeof ArticleFlow>(pgflow, 'article_flow', [
17-
'fetch_article',
17+
'fetchArticle',
1818
'summarize',
19-
'extract_keywords',
19+
'extractKeywords',
2020
'publish'
2121
]);
2222

0 commit comments

Comments
 (0)