pgflow 0.0.0-gen-worker-98f0546b-20251127220351 → 0.0.0-pre-0.9.0-d9495c23-20251128172753
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.
|
@@ -2,7 +2,7 @@ import { type Command } from 'commander';
|
|
|
2
2
|
/**
|
|
3
3
|
* Fetch flow SQL from ControlPlane HTTP endpoint
|
|
4
4
|
*/
|
|
5
|
-
export declare function fetchFlowSQL(flowSlug: string, controlPlaneUrl: string,
|
|
5
|
+
export declare function fetchFlowSQL(flowSlug: string, controlPlaneUrl: string, secretKey: string): Promise<{
|
|
6
6
|
flowSlug: string;
|
|
7
7
|
sql: string[];
|
|
8
8
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/compile/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,
|
|
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,wBA+IE"}
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
+
import { Option } from 'commander';
|
|
1
2
|
import chalk from 'chalk';
|
|
2
3
|
import { intro, log, outro } from '@clack/prompts';
|
|
3
4
|
import path from 'path';
|
|
4
5
|
import fs from 'fs';
|
|
5
|
-
// Default Supabase local development publishable key (same for all local projects)
|
|
6
|
-
const DEFAULT_PUBLISHABLE_KEY = 'sb_publishable_ACJWlzQHlZjBrEguHvfOxg_3BJgxAaH';
|
|
7
6
|
/**
|
|
8
7
|
* Fetch flow SQL from ControlPlane HTTP endpoint
|
|
9
8
|
*/
|
|
10
|
-
export async function fetchFlowSQL(flowSlug, controlPlaneUrl,
|
|
9
|
+
export async function fetchFlowSQL(flowSlug, controlPlaneUrl, secretKey) {
|
|
11
10
|
const url = `${controlPlaneUrl}/flows/${flowSlug}`;
|
|
12
11
|
try {
|
|
13
12
|
const response = await fetch(url, {
|
|
14
13
|
headers: {
|
|
15
|
-
'Authorization': `Bearer ${
|
|
16
|
-
'apikey':
|
|
14
|
+
'Authorization': `Bearer ${secretKey}`,
|
|
15
|
+
'apikey': secretKey,
|
|
17
16
|
'Content-Type': 'application/json',
|
|
18
17
|
},
|
|
19
18
|
});
|
|
@@ -69,10 +68,11 @@ export default (program) => {
|
|
|
69
68
|
.command('compile')
|
|
70
69
|
.description('Compiles a flow into SQL migration via ControlPlane HTTP')
|
|
71
70
|
.argument('<flowSlug>', 'Flow slug to compile (e.g., my_flow)')
|
|
72
|
-
.option('--deno-json <denoJsonPath>', '[DEPRECATED] No longer used. Will be removed in v1.0')
|
|
73
71
|
.option('--supabase-path <supabasePath>', 'Path to the Supabase folder')
|
|
74
72
|
.option('--control-plane-url <url>', 'Control plane URL', 'http://127.0.0.1:54321/functions/v1/pgflow')
|
|
75
|
-
.
|
|
73
|
+
.addOption(new Option('--secret-key [key]', 'Supabase anon/service_role key')
|
|
74
|
+
.hideHelp())
|
|
75
|
+
.option('--deno-json <denoJsonPath>', '[DEPRECATED] No longer used. Will be removed in v1.0')
|
|
76
76
|
.action(async (flowSlug, options) => {
|
|
77
77
|
intro('pgflow - Compile Flow to SQL');
|
|
78
78
|
try {
|
|
@@ -114,7 +114,7 @@ export default (program) => {
|
|
|
114
114
|
}
|
|
115
115
|
// Fetch flow SQL from ControlPlane
|
|
116
116
|
log.info(`Compiling flow: ${flowSlug}`);
|
|
117
|
-
const result = await fetchFlowSQL(flowSlug, options.controlPlaneUrl, options.
|
|
117
|
+
const result = await fetchFlowSQL(flowSlug, options.controlPlaneUrl, options.secretKey);
|
|
118
118
|
// Validate result
|
|
119
119
|
if (!result.sql || result.sql.length === 0) {
|
|
120
120
|
throw new Error('ControlPlane returned empty SQL');
|
package/dist/index.js
CHANGED
|
@@ -33,18 +33,19 @@ const g = chalk.hex('#9ece6a'); // vibrant green
|
|
|
33
33
|
const l = chalk.hex('#2ac3de'); // bright teal/cyan
|
|
34
34
|
// const o = chalk.hex('#ff9e64'); // orange
|
|
35
35
|
// const w = chalk.hex('#f7768e'); // magenta/pink
|
|
36
|
+
const d = chalk.dim; // dim for secondary text
|
|
36
37
|
const banner = [
|
|
37
|
-
`
|
|
38
|
-
`
|
|
39
|
-
`
|
|
40
|
-
`
|
|
41
|
-
`
|
|
42
|
-
`
|
|
38
|
+
` ${l('__ _')}`,
|
|
39
|
+
` ${g('_ __ __ _')} ${l('/ _| | _____ __')}`,
|
|
40
|
+
` ${g("| '_ \\ / _'")} ${l('| |_| |/ _ \\ \\ /\\ / /')}`,
|
|
41
|
+
` ${g('| |_) | (_|')} ${l('| _| | (_) \\ V V /')}`,
|
|
42
|
+
` ${g('| .__/ \\__,')} ${l('|_| |_|\\___/ \\_/\\_/')}`,
|
|
43
|
+
` ${g('|_| |___/')} ${d('v' + getVersion())}`,
|
|
44
|
+
``,
|
|
45
|
+
` ${l('Workflows in Supabase')} ${d('|')} ${g.underline('pgflow.dev')}`,
|
|
43
46
|
].join('\n');
|
|
44
47
|
console.log(banner);
|
|
45
48
|
console.log();
|
|
46
|
-
console.log();
|
|
47
|
-
console.log();
|
|
48
49
|
// Use a promise-aware approach to parse arguments
|
|
49
50
|
async function main() {
|
|
50
51
|
try {
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pgflow",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-pre-0.9.0-d9495c23-20251128172753",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@decimalturn/toml-patch": "0.3.7",
|
|
26
26
|
"chalk": "^5.4.1",
|
|
27
27
|
"commander": "^13.1.0",
|
|
28
|
-
"@pgflow/core": "0.0.0-
|
|
28
|
+
"@pgflow/core": "0.0.0-pre-0.9.0-d9495c23-20251128172753"
|
|
29
29
|
},
|
|
30
30
|
"publishConfig": {
|
|
31
31
|
"access": "public"
|