-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from elwood-software/main
Version 0.0.3
- Loading branch information
Showing
185 changed files
with
14,126 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { parseArgs } from "jsr:@std/cli/parse-args"; | ||
|
||
import { main } from "../src/cli/main.ts"; | ||
|
||
const { | ||
_, | ||
cwd, | ||
["workspace-dir"]: workspaceDir, | ||
["remote-url"]: remoteUrl, | ||
verbose, | ||
report, | ||
} = parseArgs( | ||
Deno.args, | ||
{ | ||
string: ["workspace-dir", "cwd", "report", "remote-url"], | ||
alias: { | ||
d: "workspace-dir", | ||
r: "report", | ||
c: "cwd", | ||
}, | ||
boolean: ["verbose"], | ||
}, | ||
); | ||
|
||
await main({ | ||
_, | ||
raw: Deno.args, | ||
workflowFile: String(_[0]), | ||
cwd, | ||
workspaceDir, | ||
verbose, | ||
reportFile: report, | ||
remoteUrl, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { parseArgs } from "jsr:@std/cli/parse-args"; | ||
|
||
import { main } from "../src/cli/ffr/main.ts"; | ||
|
||
const { | ||
_, | ||
cwd, | ||
["remote-url"]: remoteUrl, | ||
verbose, | ||
} = parseArgs( | ||
Deno.args, | ||
{ | ||
string: ["cwd", "remote-url"], | ||
alias: { | ||
r: "report", | ||
c: "cwd", | ||
}, | ||
boolean: ["verbose"], | ||
}, | ||
); | ||
|
||
await main({ | ||
_, | ||
raw: Deno.args, | ||
cwd, | ||
verbose, | ||
remoteUrl, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import { basename, join } from "node:path"; | ||
import * as zip from "jsr:@zip-js/zip-js"; | ||
import { increment, parse } from "jsr:@std/semver"; | ||
|
||
const __dirname = new URL(".", import.meta.url).pathname; | ||
|
||
async function compile(src: string, dest: string) { | ||
console.log(`Compiling ${src} to ${dest}`); | ||
|
||
const cmd = new Deno.Command(Deno.execPath(), { | ||
args: [ | ||
"compile", | ||
"-A", | ||
"--unstable-worker-options", | ||
"--include", | ||
join(__dirname, "../src/libs/expression/worker.ts"), | ||
"--output", | ||
dest, | ||
src, | ||
], | ||
stderr: "inherit", | ||
stdout: "inherit", | ||
}); | ||
|
||
const result = await cmd.output(); | ||
|
||
console.log(` > Exit Code: ${result.code}`); | ||
|
||
if (result.code !== 0) { | ||
return; | ||
} | ||
|
||
// output | ||
const output = await Deno.open(`${dest}.zip`, { | ||
create: true, | ||
write: true, | ||
read: true, | ||
}); | ||
|
||
const source = await Deno.open(dest, { read: true }); | ||
|
||
const zipWriter = new zip.ZipWriter(output.writable); | ||
await zipWriter.add(basename(dest), source.readable); | ||
await zipWriter.close(); | ||
|
||
await Deno.remove(dest); | ||
} | ||
|
||
const dest = join(__dirname, "../dist"); | ||
|
||
await Deno.mkdir( | ||
dest, | ||
{ recursive: true }, | ||
); | ||
|
||
await Promise.all([ | ||
compile( | ||
join(__dirname, "../bin/cli.ts"), | ||
join(dest, "elwood-run"), | ||
), | ||
compile( | ||
join(__dirname, "../bin/ffr.ts"), | ||
join(dest, "ffr"), | ||
), | ||
]); | ||
|
||
const currentVersion = | ||
await (await fetch("https://elwood.run/ffremote/release/latest.txt")).text(); | ||
const nextVersion = increment(parse(currentVersion), "patch"); | ||
|
||
console.log(`new_version=${nextVersion}`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
|
||
|
||
CREATE TABLE @[email protected]_workflow ( | ||
instance_id UUID NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::UUID, | ||
id UUID NOT NULL DEFAULT extensions.uuid_generate_v4(), | ||
name TEXT NULL, | ||
configuration JSONB NULL, | ||
metadata JSONB NULL, | ||
version SMALLINT NULL DEFAULT 0, | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), | ||
CONSTRAINT run_workflow_pkey PRIMARY KEY (id), | ||
CONSTRAINT idx_elwood_run_workflow_name UNIQUE (instance_id, name, version) | ||
); | ||
|
||
CREATE TABLE @[email protected] ( | ||
instance_id UUID NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::UUID, | ||
id SERIAL NOT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), | ||
summary TEXT NULL, | ||
short_summary CHARACTER VARYING (255) NULL, | ||
workflow_id UUID NOT NULL, | ||
status TEXT NOT NULL DEFAULT 'queued'::TEXT, | ||
result CHARACTER VARYING NULL DEFAULT 'none'::CHARACTER VARYING, | ||
tracking_id UUID NOT NULL DEFAULT extensions.uuid_generate_v4(), | ||
report JSONB NOT NULL DEFAULT '{}'::JSONB, | ||
num INTEGER NULL DEFAULT 0, | ||
metadata JSONB NULL DEFAULT '{}'::JSONB, | ||
variables JSONB NULL DEFAULT '{}'::JSONB, | ||
started_at TIMESTAMP WITH TIME ZONE NULL, | ||
ended_at TIMESTAMP WITH TIME ZONE NULL, | ||
CONSTRAINT run_pkey PRIMARY KEY (id), | ||
CONSTRAINT idx_elwood_run_tracking_id UNIQUE (tracking_id), | ||
CONSTRAINT elwood_run_workflow_id | ||
FOREIGN KEY (workflow_id) REFERENCES apollo.run_workflow (id) | ||
); | ||
|
||
CREATE TABLE @[email protected]_event ( | ||
instance_id UUID NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'::UUID, | ||
id SERIAL NOT NULL, | ||
created_at TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(), | ||
type TEXT NULL, | ||
tracking_id UUID NOT NULL DEFAULT extensions.uuid_generate_v4(), | ||
data JSONB NOT NULL DEFAULT '{}'::JSONB, | ||
CONSTRAINT run_event_pkey PRIMARY KEY (id) | ||
); | ||
|
||
CREATE VIEW public.elwood_run AS | ||
SELECT | ||
run.instance_id, | ||
run.id, | ||
run.created_at, | ||
run.summary, | ||
run.short_summary, | ||
run.workflow_id, | ||
run.status, | ||
run.result, | ||
run.tracking_id, | ||
run.report, | ||
run.num, | ||
run.metadata, | ||
run.variables, | ||
run.started_at, | ||
run.ended_at, | ||
( | ||
SELECT | ||
run_workflow.configuration | ||
FROM @[email protected]_workflow | ||
WHERE run_workflow.id = run.workflow_id | ||
) AS configuration | ||
FROM @[email protected]; | ||
|
||
CREATE VIEW public.elwood_run_event AS | ||
SELECT | ||
run_event.id, | ||
run_event.created_at, | ||
run_event.type, | ||
run_event.tracking_id, | ||
run_event.data | ||
FROM @[email protected]_event; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# elwood_run_db extension | ||
comment = 'Elwood Run for your Supabase project' | ||
default_version = '0.1.0' | ||
requires = moddatetime | ||
superuser = true | ||
relocatable = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Elwood Run Database Control | ||
|
||
Get more information at [elwood.run/docs/db](https://elwood.run/docs/db). | ||
|
||
This is a [PostgreSQL TLE](https://github.com/aws/pg_tle) (extension) which attempts to provide supabase projects. | ||
|
||
Docs available at [elwood.run/docs/db](https://elwood.run/docs/db). | ||
|
||
## Install or Update | ||
```sql | ||
/* | ||
Requires: | ||
- pg_tle: https://github.com/aws/pg_tle | ||
- pgsql-http: https://github.com/pramsey/pgsql-http | ||
*/ | ||
create extension if not exists http with schema extensions; | ||
create extension if not exists pg_tle; | ||
drop extension if exists "elwood-run-supabase"; | ||
select pgtle.uninstall_extension_if_exists('elwood-run-supabase'); | ||
select | ||
pgtle.install_extension( | ||
'elwood-run-supabase', | ||
resp.contents ->> 'version', | ||
'Elwood Run Database', | ||
resp.contents ->> 'sql' | ||
) | ||
from http( | ||
( | ||
'GET', | ||
'https://elwood.run/db/latest.json', | ||
array[]::http_header[], | ||
null, | ||
null | ||
) | ||
) x, | ||
lateral ( | ||
select | ||
((row_to_json(x) -> 'content') #>> '{}')::json | ||
) resp(contents); | ||
|
||
create extension "elwood-run-supabase"; | ||
``` |
Oops, something went wrong.