pgflow 0.0.0-pre-0.9.0-d9495c23-20251128172753 → 0.0.0-runkey-85f08e51-20251225180003
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 +1 -2
- package/dist/commands/compile/index.d.ts.map +1 -1
- package/dist/commands/compile/index.js +1 -8
- package/dist/commands/install/create-flows-directory.js +2 -2
- package/dist/commands/install/index.d.ts.map +1 -1
- package/dist/commands/install/index.js +2 -8
- package/dist/package.json +6 -1
- package/package.json +7 -2
- package/dist/commands/install/update-env-file.d.ts +0 -12
- package/dist/commands/install/update-env-file.d.ts.map +0 -1
- package/dist/commands/install/update-env-file.js +0 -87
package/README.md
CHANGED
|
@@ -16,7 +16,6 @@ This package provides essential tools for setting up, managing, and deploying pg
|
|
|
16
16
|
## Prerequisites
|
|
17
17
|
|
|
18
18
|
- Supabase CLI v2.50.3 or higher
|
|
19
|
-
- Deno v2.1.x or higher (for flow compilation)
|
|
20
19
|
- Local Supabase project initialized
|
|
21
20
|
|
|
22
21
|
## Installation
|
|
@@ -70,8 +69,8 @@ npx pgflow@latest compile my_flow
|
|
|
70
69
|
|
|
71
70
|
Options:
|
|
72
71
|
|
|
73
|
-
- `--deno-json <path>` - Path to custom deno.json configuration file
|
|
74
72
|
- `--supabase-path <path>` - Path to custom Supabase directory
|
|
73
|
+
- `--control-plane-url <url>` - ControlPlane URL (default: `http://127.0.0.1:54321/functions/v1/pgflow`)
|
|
75
74
|
|
|
76
75
|
The compiler will:
|
|
77
76
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/compile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAMjD;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAsE9C;yBAEe,SAAS,OAAO;AAAhC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/compile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,WAAW,CAAC;AAMjD;;GAEG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAChB,eAAe,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC,CAsE9C;yBAEe,SAAS,OAAO;AAAhC,wBAkIE"}
|
|
@@ -72,16 +72,9 @@ export default (program) => {
|
|
|
72
72
|
.option('--control-plane-url <url>', 'Control plane URL', 'http://127.0.0.1:54321/functions/v1/pgflow')
|
|
73
73
|
.addOption(new Option('--secret-key [key]', 'Supabase anon/service_role key')
|
|
74
74
|
.hideHelp())
|
|
75
|
-
.option('--deno-json <denoJsonPath>', '[DEPRECATED] No longer used. Will be removed in v1.0')
|
|
76
75
|
.action(async (flowSlug, options) => {
|
|
77
76
|
intro('pgflow - Compile Flow to SQL');
|
|
78
77
|
try {
|
|
79
|
-
// Show deprecation warning for --deno-json
|
|
80
|
-
if (options.denoJson) {
|
|
81
|
-
log.warn('The --deno-json flag is deprecated and no longer used.\n' +
|
|
82
|
-
'Flow compilation now happens via HTTP, not local Deno.\n' +
|
|
83
|
-
'This flag will be removed in v1.0');
|
|
84
|
-
}
|
|
85
78
|
// Validate Supabase path
|
|
86
79
|
let supabasePath;
|
|
87
80
|
if (options.supabasePath) {
|
|
@@ -141,7 +134,7 @@ export default (program) => {
|
|
|
141
134
|
log.success(`Migration file created: ${relativeFilePath}`);
|
|
142
135
|
// Display next steps with outro
|
|
143
136
|
outro([
|
|
144
|
-
chalk.bold('Flow compilation completed successfully!'),
|
|
137
|
+
chalk.green.bold('✓ Flow compilation completed successfully!'),
|
|
145
138
|
'',
|
|
146
139
|
`- Run ${chalk.cyan('supabase migration up')} to apply the migration`,
|
|
147
140
|
'',
|
|
@@ -19,11 +19,11 @@ export const GreetUser = new Flow<Input>({
|
|
|
19
19
|
})
|
|
20
20
|
.step(
|
|
21
21
|
{ slug: 'fullName' },
|
|
22
|
-
(
|
|
22
|
+
(flowInput) => \`\${flowInput.firstName} \${flowInput.lastName}\`
|
|
23
23
|
)
|
|
24
24
|
.step(
|
|
25
25
|
{ slug: 'greeting', dependsOn: ['fullName'] },
|
|
26
|
-
(
|
|
26
|
+
(deps) => \`Hello, \${deps.fullName}!\`
|
|
27
27
|
);
|
|
28
28
|
`;
|
|
29
29
|
export async function createFlowsDirectory({ supabasePath, autoConfirm = false, }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/install/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/install/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,WAAW,CAAC;yBAUzB,SAAS,OAAO;AAAhC,wBAuHE"}
|
|
@@ -2,7 +2,6 @@ import { intro, log, confirm, cancel, outro } from '@clack/prompts';
|
|
|
2
2
|
import chalk from 'chalk';
|
|
3
3
|
import { copyMigrations } from './copy-migrations.js';
|
|
4
4
|
import { updateConfigToml } from './update-config-toml.js';
|
|
5
|
-
import { updateEnvFile } from './update-env-file.js';
|
|
6
5
|
import { createEdgeFunction } from './create-edge-function.js';
|
|
7
6
|
import { createFlowsDirectory } from './create-flows-directory.js';
|
|
8
7
|
import { createExampleWorker } from './create-example-worker.js';
|
|
@@ -33,7 +32,6 @@ export default (program) => {
|
|
|
33
32
|
` • Create ${chalk.cyan('supabase/flows/')} ${chalk.dim('(flow definitions with GreetUser example)')}`,
|
|
34
33
|
` • Create Control Plane in ${chalk.cyan('supabase/functions/pgflow/')}`,
|
|
35
34
|
` • Create ${chalk.cyan('supabase/functions/greet-user-worker/')} ${chalk.dim('(example worker)')}`,
|
|
36
|
-
` • Configure ${chalk.cyan('supabase/functions/.env')}`,
|
|
37
35
|
'',
|
|
38
36
|
` ${chalk.green('✓ Safe to re-run - completed steps will be skipped')}`,
|
|
39
37
|
].join('\n');
|
|
@@ -74,13 +72,9 @@ export default (program) => {
|
|
|
74
72
|
supabasePath,
|
|
75
73
|
autoConfirm: true,
|
|
76
74
|
});
|
|
77
|
-
const envFile = await updateEnvFile({
|
|
78
|
-
supabasePath,
|
|
79
|
-
autoConfirm: true,
|
|
80
|
-
});
|
|
81
75
|
// Step 4: Show completion message
|
|
82
76
|
const outroMessages = [];
|
|
83
|
-
if (migrations || configUpdate || flowsDirectory || edgeFunction || exampleWorker
|
|
77
|
+
if (migrations || configUpdate || flowsDirectory || edgeFunction || exampleWorker) {
|
|
84
78
|
outroMessages.push(chalk.green.bold('✓ Installation complete!'));
|
|
85
79
|
}
|
|
86
80
|
else {
|
|
@@ -90,7 +84,7 @@ export default (program) => {
|
|
|
90
84
|
outroMessages.push('');
|
|
91
85
|
outroMessages.push('Next steps:');
|
|
92
86
|
let stepNumber = 1;
|
|
93
|
-
if (configUpdate
|
|
87
|
+
if (configUpdate) {
|
|
94
88
|
outroMessages.push(` ${stepNumber}. Restart Supabase: ${chalk.cyan('supabase stop && supabase start')}`);
|
|
95
89
|
stepNumber++;
|
|
96
90
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgflow",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-runkey-85f08e51-20251225180003",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/pgflow-dev/pgflow",
|
|
8
|
+
"directory": "pkgs/cli"
|
|
9
|
+
},
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"typings": "./dist/index.d.ts",
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgflow",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-runkey-85f08e51-20251225180003",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/pgflow-dev/pgflow",
|
|
8
|
+
"directory": "pkgs/cli"
|
|
9
|
+
},
|
|
5
10
|
"type": "module",
|
|
6
11
|
"main": "./dist/index.js",
|
|
7
12
|
"typings": "./dist/index.d.ts",
|
|
@@ -25,7 +30,7 @@
|
|
|
25
30
|
"@decimalturn/toml-patch": "0.3.7",
|
|
26
31
|
"chalk": "^5.4.1",
|
|
27
32
|
"commander": "^13.1.0",
|
|
28
|
-
"@pgflow/core": "0.0.0-
|
|
33
|
+
"@pgflow/core": "0.0.0-runkey-85f08e51-20251225180003"
|
|
29
34
|
},
|
|
30
35
|
"publishConfig": {
|
|
31
36
|
"access": "public"
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Updates the functions/.env file with required environment variables for pgflow
|
|
3
|
-
*
|
|
4
|
-
* @param options.supabasePath - Path to the supabase directory
|
|
5
|
-
* @param options.autoConfirm - Whether to automatically confirm changes
|
|
6
|
-
* @returns Promise<boolean> - True if changes were made, false otherwise
|
|
7
|
-
*/
|
|
8
|
-
export declare function updateEnvFile({ supabasePath, autoConfirm, }: {
|
|
9
|
-
supabasePath: string;
|
|
10
|
-
autoConfirm?: boolean;
|
|
11
|
-
}): Promise<boolean>;
|
|
12
|
-
//# sourceMappingURL=update-env-file.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-env-file.d.ts","sourceRoot":"","sources":["../../../src/commands/install/update-env-file.ts"],"names":[],"mappings":"AAKA;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,EAClC,YAAY,EACZ,WAAmB,GACpB,EAAE;IACD,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,GAAG,OAAO,CAAC,OAAO,CAAC,CA2FnB"}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { log, confirm } from '@clack/prompts';
|
|
4
|
-
import chalk from 'chalk';
|
|
5
|
-
/**
|
|
6
|
-
* Updates the functions/.env file with required environment variables for pgflow
|
|
7
|
-
*
|
|
8
|
-
* @param options.supabasePath - Path to the supabase directory
|
|
9
|
-
* @param options.autoConfirm - Whether to automatically confirm changes
|
|
10
|
-
* @returns Promise<boolean> - True if changes were made, false otherwise
|
|
11
|
-
*/
|
|
12
|
-
export async function updateEnvFile({ supabasePath, autoConfirm = false, }) {
|
|
13
|
-
// Check environment variables
|
|
14
|
-
const functionsDir = path.join(supabasePath, 'functions');
|
|
15
|
-
const envFilePath = path.join(functionsDir, '.env');
|
|
16
|
-
// Create functions directory if it doesn't exist
|
|
17
|
-
if (!fs.existsSync(functionsDir)) {
|
|
18
|
-
fs.mkdirSync(functionsDir, { recursive: true });
|
|
19
|
-
}
|
|
20
|
-
// Variables to add
|
|
21
|
-
const envVars = {
|
|
22
|
-
EDGE_WORKER_DB_URL: 'postgresql://postgres.pooler-dev:postgres@pooler:6543/postgres',
|
|
23
|
-
EDGE_WORKER_LOG_LEVEL: 'info',
|
|
24
|
-
};
|
|
25
|
-
// Check if file exists and read its content
|
|
26
|
-
let currentContent = '';
|
|
27
|
-
let isNewFile = false;
|
|
28
|
-
if (fs.existsSync(envFilePath)) {
|
|
29
|
-
currentContent = fs.readFileSync(envFilePath, 'utf8');
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
isNewFile = true;
|
|
33
|
-
}
|
|
34
|
-
// Prepare new content
|
|
35
|
-
let newContent = currentContent;
|
|
36
|
-
// Check which variables need to be added
|
|
37
|
-
const missingVars = [];
|
|
38
|
-
for (const [key, value] of Object.entries(envVars)) {
|
|
39
|
-
if (!newContent.includes(`${key}=`)) {
|
|
40
|
-
missingVars.push({ key, value });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// If no changes needed, return early
|
|
44
|
-
if (missingVars.length === 0) {
|
|
45
|
-
log.success('Environment variables already configured');
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
// Show preview and ask for confirmation only when not auto-confirming
|
|
49
|
-
if (!autoConfirm) {
|
|
50
|
-
const summaryParts = [
|
|
51
|
-
isNewFile
|
|
52
|
-
? `Create ${chalk.cyan('functions/.env')} ${chalk.dim('(worker configuration)')}:`
|
|
53
|
-
: `Update ${chalk.cyan('functions/.env')} ${chalk.dim('(worker configuration)')}:`,
|
|
54
|
-
'',
|
|
55
|
-
...missingVars.map(({ key, value }) => ` ${chalk.bold(key)}="${value}"`),
|
|
56
|
-
];
|
|
57
|
-
log.info(summaryParts.join('\n'));
|
|
58
|
-
const confirmResult = await confirm({
|
|
59
|
-
message: isNewFile ? `Create functions/.env?` : `Update functions/.env?`,
|
|
60
|
-
});
|
|
61
|
-
if (confirmResult !== true) {
|
|
62
|
-
log.warn('Environment variable update skipped');
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// Update environment variables
|
|
67
|
-
// Apply changes if confirmed
|
|
68
|
-
for (const { key, value } of missingVars) {
|
|
69
|
-
// Add a newline at the end if the file doesn't end with one and isn't empty
|
|
70
|
-
if (newContent && !newContent.endsWith('\n')) {
|
|
71
|
-
newContent += '\n';
|
|
72
|
-
}
|
|
73
|
-
// Add the new variable
|
|
74
|
-
newContent += `${key}="${value}"\n`;
|
|
75
|
-
}
|
|
76
|
-
// Write the file if changes were made
|
|
77
|
-
try {
|
|
78
|
-
fs.writeFileSync(envFilePath, newContent);
|
|
79
|
-
log.success('Environment variables configured');
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
84
|
-
log.error(`Failed to update environment variables: ${errorMessage}`);
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
}
|