Skip to content

Commit

Permalink
bump version code
Browse files Browse the repository at this point in the history
  • Loading branch information
tsirysndr committed Apr 4, 2024
1 parent 0e601e3 commit 433639b
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "MPL-2.0"
name = "fluentci-engine"
readme = "../../README.md"
repository = "https://github.com/fluentci-io/fluentci-engine"
version = "0.2.2"
version = "0.2.3"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

Expand All @@ -19,7 +19,7 @@ extism = "1.2.0"
fluentci-core = {path = "../core", version = "0.1.6"}
fluentci-ext = {path = "../ext", version = "0.1.4"}
fluentci-server = {path = "../server", version = "0.1.7"}
fluentci-shared = {path = "../shared", version = "0.1.1"}
fluentci-shared = {path = "../shared", version = "0.1.2"}
get-port = "4.0.0"
md5 = "0.7.0"
regex = "1.10.3"
Expand Down
2 changes: 1 addition & 1 deletion sdk/typescript/deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fluentci/sdk",
"version": "0.2.1",
"version": "0.2.2",
"exports": {
".": "./src/client.gen.ts",
"./plugin": "./src/plugin.ts"
Expand Down
91 changes: 91 additions & 0 deletions sdk/typescript/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ declare const Host: {
http: (ptr: I64) => I64;
md5: (ptr: I64) => I64;
sha256: (ptr: I64) => I64;
get_env: (ptr: I64) => I64;
set_envs: (ptr: I64) => void;
has_env: (ptr: I64) => I64;
remove_env: (ptr: I64) => void;
get_os: () => I64;
get_arch: () => I64;
};
};

Expand Down Expand Up @@ -73,6 +79,12 @@ export const md5: (ptr: I64) => I64 = fn.md5;
export const sha256: (ptr: I64) => I64 = fn.sha256;
export const unzip: (ptr: I64) => I64 = fn.unzip;
export const tar_xzvf: (ptr: I64) => I64 = fn.tar_xzvf;
export const get_env: (ptr: I64) => I64 = fn.get_env;
export const set_envs: (ptr: I64) => void = fn.set_envs;
export const has_env: (ptr: I64) => I64 = fn.has_env;
export const remove_env: (ptr: I64) => void = fn.remove_env;
export const get_os: () => I64 = fn.get_os;
export const get_arch: () => I64 = fn.get_arch;

class BaseClient {
constructor() {}
Expand Down Expand Up @@ -306,6 +318,85 @@ export class Client extends BaseClient {
id: response.id,
});
};

/**
* Get environment variable
* ```ts
* dag.getEnv("ENV_NAME");
* ```
* @param name
* @returns {string}
*/
getEnv = (name: string): string => {
const mem = Memory.fromString(name);
const offset = get_env(mem.offset);
return Memory.find(offset).readString();
};

/**
* Set environment variables
* ```ts
* dag.setEnvs({ ENV_NAME: "value" });
* ```
* @param envs
* @returns {void}
*/
setEnvs = (envs: Record<string, string>): void => {
const mem = Memory.fromJsonObject(envs);
set_envs(mem.offset);
};

/**
* Check if an environment variable exists
* ```ts
* dag.hasEnv("ENV_NAME");
* ```
* @param name
* @returns {boolean}
*/
hasEnv = (name: string): boolean => {
const mem = Memory.fromString(name);
const offset = has_env(mem.offset);
const value = Memory.find(offset).readJsonObject();
return value;
};

/**
* Remove an environment variable
* ```ts
* dag.removeEnv("ENV_NAME");
* ```
* @param name
* @returns {void}
*/
removeEnv = (name: string): void => {
const mem = Memory.fromString(name);
remove_env(mem.offset);
};

/**
* Get the operating system
* ```ts
* dag.getOS();
* ```
* @returns {string}
*/
getOS = (): string => {
const offset = get_os();
return Memory.find(offset).readString();
};

/**
* Get the current cpu architecture
* ```ts
* dag.getArch();
* ```
* @returns {string}
*/
getArch = (): string => {
const offset = get_arch();
return Memory.find(offset).readString();
};
}

/**
Expand Down

0 comments on commit 433639b

Please sign in to comment.