mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
Merge branch 'next' of github.com:Start9Labs/start-os into rebase/integration/refactors
This commit is contained in:
@@ -8,8 +8,8 @@ edition = "2021"
|
||||
[dependencies]
|
||||
async-trait = "0.1.56"
|
||||
dashmap = "5.3.4"
|
||||
deno_core = "0.195.0"
|
||||
deno_ast = { version = "0.27.2", features = ["transpiling"] }
|
||||
deno_core = "=0.195.0"
|
||||
deno_ast = { version = "=0.27.2", features = ["transpiling"] }
|
||||
embassy_container_init = { path = "../embassy_container_init" }
|
||||
reqwest = { version = "0.11.11" }
|
||||
sha2 = "0.10.2"
|
||||
|
||||
@@ -158,17 +158,17 @@ impl ModuleLoader for ModsLoader {
|
||||
"file:///deno_global.js" => Ok(ModuleSource::new(
|
||||
ModuleType::JavaScript,
|
||||
FastString::Static("const old_deno = Deno; Deno = null; export default old_deno"),
|
||||
&*DENO_GLOBAL_JS,
|
||||
&DENO_GLOBAL_JS,
|
||||
)),
|
||||
"file:///loadModule.js" => Ok(ModuleSource::new(
|
||||
ModuleType::JavaScript,
|
||||
FastString::Static(include_str!("./artifacts/loadModule.js")),
|
||||
&*LOAD_MODULE_JS,
|
||||
&LOAD_MODULE_JS,
|
||||
)),
|
||||
"file:///embassy.js" => Ok(ModuleSource::new(
|
||||
ModuleType::JavaScript,
|
||||
self.code.0.clone().into(),
|
||||
&*EMBASSY_JS,
|
||||
&EMBASSY_JS,
|
||||
)),
|
||||
|
||||
x => Err(anyhow!("Not allowed to import: {}", x)),
|
||||
@@ -368,7 +368,7 @@ impl JsExecutionEnvironment {
|
||||
.ops(Self::declarations())
|
||||
.state(move |state| {
|
||||
state.put(ext_answer_state.clone());
|
||||
state.put(js_ctx.clone());
|
||||
state.put(js_ctx);
|
||||
})
|
||||
.build();
|
||||
let loader = std::rc::Rc::new(self.module_loader.clone());
|
||||
@@ -650,7 +650,7 @@ mod fns {
|
||||
}
|
||||
|
||||
let path_in = path_in.strip_prefix("/").unwrap_or(&path_in);
|
||||
let new_file = volume_path.join(&path_in);
|
||||
let new_file = volume_path.join(path_in);
|
||||
let parent_new_file = new_file
|
||||
.parent()
|
||||
.ok_or_else(|| anyhow!("Expecting that file is not root"))?;
|
||||
@@ -1082,11 +1082,9 @@ mod fns {
|
||||
let volume_path = {
|
||||
let state = state.borrow();
|
||||
let ctx: &JsContext = state.borrow();
|
||||
let volume_path = ctx
|
||||
.volumes
|
||||
ctx.volumes
|
||||
.path_for(&ctx.datadir, &ctx.package_id, &ctx.version, &volume_id)
|
||||
.ok_or_else(|| anyhow!("There is no {} in volumes", volume_id))?;
|
||||
volume_path
|
||||
.ok_or_else(|| anyhow!("There is no {} in volumes", volume_id))?
|
||||
};
|
||||
let path_in = path_in.strip_prefix("/").unwrap_or(&path_in);
|
||||
let new_file = volume_path.join(path_in);
|
||||
@@ -1157,8 +1155,7 @@ mod fns {
|
||||
.stdout,
|
||||
)?
|
||||
.lines()
|
||||
.skip(1)
|
||||
.next()
|
||||
.nth(1)
|
||||
.unwrap_or_default()
|
||||
.parse()?;
|
||||
let used = String::from_utf8(
|
||||
@@ -1188,8 +1185,7 @@ mod fns {
|
||||
.stdout,
|
||||
)?
|
||||
.lines()
|
||||
.skip(1)
|
||||
.next()
|
||||
.nth(1)
|
||||
.unwrap_or_default()
|
||||
.split_ascii_whitespace()
|
||||
.next_tuple()
|
||||
@@ -1310,16 +1306,22 @@ mod fns {
|
||||
}
|
||||
#[op]
|
||||
async fn log_info(state: Rc<RefCell<OpState>>, input: String) -> Result<(), AnyError> {
|
||||
let ctx = {
|
||||
let (container_rpc_client, container_process_gid, package_id, run_function) = {
|
||||
let state = state.borrow();
|
||||
state.borrow::<JsContext>().clone()
|
||||
let ctx: JsContext = state.borrow::<JsContext>().clone();
|
||||
(
|
||||
ctx.container_rpc_client,
|
||||
ctx.container_process_gid,
|
||||
ctx.package_id,
|
||||
ctx.run_function,
|
||||
)
|
||||
};
|
||||
if let Some(rpc_client) = ctx.container_rpc_client {
|
||||
if let Some(rpc_client) = container_rpc_client {
|
||||
return rpc_client
|
||||
.request(
|
||||
embassy_container_init::Log,
|
||||
embassy_container_init::LogParams {
|
||||
gid: Some(ctx.container_process_gid),
|
||||
gid: Some(container_process_gid),
|
||||
level: embassy_container_init::LogLevel::Info(input),
|
||||
},
|
||||
)
|
||||
@@ -1327,8 +1329,8 @@ mod fns {
|
||||
.map_err(|e| anyhow!("{}: {:?}", e.message, e.data));
|
||||
}
|
||||
tracing::info!(
|
||||
package_id = tracing::field::display(&ctx.package_id),
|
||||
run_function = tracing::field::display(&ctx.run_function),
|
||||
package_id = tracing::field::display(&package_id),
|
||||
run_function = tracing::field::display(&run_function),
|
||||
"{}",
|
||||
input
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user