Skip to content

Commit

Permalink
some thought on the package, systems, capabilities, apps etc
Browse files Browse the repository at this point in the history
  • Loading branch information
amitu committed Dec 6, 2024
1 parent 950ddae commit 952ce4c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
4 changes: 4 additions & 0 deletions v0.5/Cargo.lock

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

2 changes: 1 addition & 1 deletion v0.5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
members = [
"fastn",
"fastn-compiler",
"fastn-core",
"fastn-core", "fastn-package",
"fastn-router",
"fastn-section",
"fastn-static",
Expand Down
11 changes: 11 additions & 0 deletions v0.5/fastn-package/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "fastn-package"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
description.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true

[dependencies]
55 changes: 55 additions & 0 deletions v0.5/fastn-package/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#![allow(clippy::derive_partial_eq_without_eq, clippy::get_first)]
#![deny(unused_crate_dependencies)]
#![warn(clippy::used_underscore_binding)]
#![allow(dead_code)]

extern crate self as fastn_package;

pub struct Package {
name: String,
systems: Vec<System>,
dependencies: Vec<Dependency>,
auto_imports: AutoImport,
apps: Vec<App>,
}

pub type AutoImport = Vec<(String, String)>;

// -- system: design-system.com
// via: amitu.com/ds
// alias: some alias ;; if alias is not provided, this is globally passed
pub struct System {
via: String,
sensitive: bool,
alias: Option<SystemAlias>,
}

pub struct SystemAlias(String);

pub struct Dependency {
name: String,
// vector of alias of the systems this dependency and everything downstream
capabilities: Vec<SystemAlias>,
dependencies: Vec<Dependency>,
auto_imports: AutoImport,
}

// -- path: /blog/
// allow: colorful-ds
pub struct CapabilityOverride {
// capabilities for any url prefix can be overridden using this
path: String,
// if this is set, the global capabilities will be merged into .capabilities, else only
// .capabilities will be used.
inherit_global: bool,
capabilities: Vec<SystemAlias>,
}

pub struct App {
// this must already be added as a Dependency (not a system) and is its name
name: String,
mount_point: String,
apps: Vec<App>,
// Dependency.capabilities will be merged with this when serving these routes
capabilities: Vec<SystemAlias>,
}

0 comments on commit 952ce4c

Please sign in to comment.