Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Setup
description: Checkout, install Python, restore cache, and run bin/setup
description: Checkout, install Python + Node, restore cache, and run bin/setup

inputs:
cache-prefix:
Expand All @@ -13,6 +13,9 @@ runs:
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- uses: actions/setup-node@v4
with:
node-version: "22"
- uses: actions/cache@v4
with:
path: |
Expand Down
129 changes: 129 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@ members = [
"src/ascend_tools/ascend-tools-cli",
]
resolver = "3"

[profile.release]
strip = true
lto = true
codegen-units = 1
1 change: 1 addition & 0 deletions bin/build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.."

bin/build-rs "$@"
bin/build-py
bin/build-js
4 changes: 4 additions & 0 deletions bin/build-js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../src/ascend_tools/ascend-tools-js"
npm run build
1 change: 1 addition & 0 deletions bin/check
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ cd "$(dirname "${BASH_SOURCE[0]}")/.."
bin/check-version
bin/check-rs
bin/check-py
bin/check-js

echo "All checks passed!"
5 changes: 5 additions & 0 deletions bin/check-js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../src/ascend_tools/ascend-tools-js"
npm run build
npm test
20 changes: 20 additions & 0 deletions bin/preview
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/../tests/app"

npm install --silent
node server.js &
SERVER_PID=$!

trap "kill $SERVER_PID 2>/dev/null" EXIT

# wait for server to be ready
for i in {1..20}; do
curl -sf http://localhost:3000 >/dev/null 2>&1 && break
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3000 conflicts w/ other things we use (follow up)

sleep 0.25
done

open http://localhost:3000
echo "Demo app running at http://localhost:3000 (pid $SERVER_PID)"
echo "Press Ctrl-C to stop."
wait $SERVER_PID
7 changes: 7 additions & 0 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,11 @@ if ! command -v uv &>/dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# Install JS dependencies (napi-rs, ava, typescript)
if command -v npm &>/dev/null; then
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use fnm (follow up)

cd "$(dirname "${BASH_SOURCE[0]}")/../src/ascend_tools/ascend-tools-js"
npm install --no-fund --no-audit
cd - >/dev/null
fi

echo "Setup complete!"
5 changes: 5 additions & 0 deletions src/ascend_tools/ascend-tools-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ readme = "README.md"
name = "ascend_tools"
path = "src/lib.rs"

[features]
jsts = ["dep:napi-derive", "dep:napi"]

[dependencies]
ureq = { version = "3", features = ["platform-verifier"] }
serde = { version = "1", features = ["derive"] }
Expand All @@ -23,6 +26,8 @@ base64 = "0.22"
percent-encoding = "2"
thiserror = "2"
zeroize = "1"
napi = { version = "3", default-features = false, features = ["napi9", "serde-json"], optional = true }
napi-derive = { version = "3", features = ["type-def"], optional = true }

[dev-dependencies]
mockito = "1"
6 changes: 5 additions & 1 deletion src/ascend_tools/ascend-tools-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#![forbid(unsafe_code)]
// When jsts feature is enabled, napi-derive macros may generate code with
// #[allow(unsafe_code)] internally, so we use deny instead of forbid.
// No unsafe code exists in this crate; all FFI is isolated to ascend-tools-js.
#![cfg_attr(not(feature = "jsts"), forbid(unsafe_code))]
Comment thread
lostmygithubaccount marked this conversation as resolved.
#![cfg_attr(feature = "jsts", deny(unsafe_code))]

pub mod auth;
pub mod client;
Expand Down
6 changes: 6 additions & 0 deletions src/ascend_tools/ascend-tools-core/src/models.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};

/// The kind of runtime (workspace or deployment).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "jsts", napi_derive::napi(string_enum = "lowercase"))]
#[serde(rename_all = "lowercase")]
pub enum RuntimeKind {
Workspace,
Expand Down Expand Up @@ -47,6 +48,7 @@ pub struct Project {
/// A workspace or deployment. Use the [`Workspace`] or [`Deployment`] type aliases
/// for clarity when the kind is known.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "jsts", napi_derive::napi(object))]
pub struct Runtime {
pub uuid: String,
pub id: String,
Expand Down Expand Up @@ -109,11 +111,13 @@ impl From<Runtime> for Deployment {
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "jsts", napi_derive::napi(object))]
pub struct Flow {
pub name: String,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "jsts", napi_derive::napi(object))]
pub struct FlowRun {
pub name: String,
pub flow: String,
Expand All @@ -126,13 +130,15 @@ pub struct FlowRun {

/// Wrapper returned by the list flow runs endpoint.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "jsts", napi_derive::napi(object))]
pub struct FlowRunList {
pub items: Vec<FlowRun>,
#[serde(default)]
pub truncated: bool,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "jsts", napi_derive::napi(object))]
pub struct FlowRunTrigger {
pub event_uuid: String,
pub event_type: String,
Expand Down
6 changes: 6 additions & 0 deletions src/ascend_tools/ascend-tools-js/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target/
node_modules/
*.node
index.js
index.d.ts
index.d.cts
Loading
Loading