Giter Site home page Giter Site logo

cyfs-ts-sdk's People

Contributors

glen0125 avatar lurenpluto avatar song0125 avatar tracy101 avatar waterflier avatar weiqiushi avatar zwong91 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

cyfs-ts-sdk's Issues

protoc-21.12 not support protoc-gen-js

protoc.exe --proto_path=./common_base/codec/protos --js_out=import_style=commonjs,binary:./common_base/codec/protos --ts_out=./common_base/codec/protos ./common_base/codec/protos/dec_objects.proto
'protoc-gen-js' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
--js_out: protoc-gen-js: Plugin failed with status code 1.

Suggest cyfs-ts-sdk Description Compatible protoc version range
protoc-3.20.1 can be used normally

Suggestion: When cyfs deploy, add http request retry for meta chain

When running cyfs deploy, if an http request timeout occurs with the meta chain, the code will directly throw an exception. It is recommended to add a retry mechanism, as http request timeouts may be very common.

I re-execute cyfs deploy and it can be released successfully.

[2023-04-14 15:17:38.804344] ERROR [ThreadId(11)] [cyfs_meta_lib::client] http connect error! host=http://nightly.meta.cyfs.com:1423/, err=future has timed out
[2023-04-14 15:17:38.804755] WARN [ThreadId(11)] [cyfs_client::named_data_client] cannot get file desc 5aSixgM3hFBdnefL7W67Gemq8XJzwxJscpTLF17JpdP7
[2023-04-14 15:17:38.805017] ERROR [ThreadId(11)] [cyfs_client::actions] put err: err: (NotFound, , None)
node:internal/errors:857
  const err = new Error(message);
              ^

Error: Command failed: "C:\Users\bucky\AppData\Roaming\cyfs\services\runtime\tools\cyfs-client" put "dist" -f "fid" -o "E:\githubSpace\cyfs-dec-app-test\owner\nightly\people" --use-stack-sn --tcp
    at checkExecSyncError (node:child_process:861:11)
    at Object.execSync (node:child_process:932:15)
    at Object.exec (C:\Users\bucky\AppData\Roaming\npm\node_modules\cyfs-tool-nightly\cyfs.js:3527:29)
    at upload_dec_app (C:\Users\bucky\AppData\Roaming\npm\node_modules\cyfs-tool-nightly\cyfs.js:262:12)
    at deploy_dec_app (C:\Users\bucky\AppData\Roaming\npm\node_modules\cyfs-tool-nightly\cyfs.js:441:5)
    at run (C:\Users\bucky\AppData\Roaming\npm\node_modules\cyfs-tool-nightly\cyfs.js:475:11)
    at Command.<anonymous> (C:\Users\bucky\AppData\Roaming\npm\node_modules\cyfs-tool-nightly\cyfs.js:467:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Command.parseAsync (C:\Users\bucky\AppData\Roaming\npm\node_modules\cyfs-tool-nightly\node_modules\commander\lib\command.js:923:5) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 2356,
  stdout: null,
  stderr: null
}

Change Option<T> to T|undefined

For some historical reasons, many interfaces in the TS SDK still retain the Option signature and return value. Is it possible to change these signatures to the more familiar T|undefined for TypeScript?

OpEnvRequestor printed log of OpEnv type is incorrect

Describe the bug
IsolatePath/OpEnvStubSingleOpEnvStub/PathOpEnvStub all use GlobalStateRequestor to send requests, and the logs printed by GlobalStateRequestor should be controlled by parameters instead of randomly printing OpEnv types

[[cyfs-ts-sdk] https://github.com/buckyos/cyfs-ts-sdk/src/sdk/cyfs-lib/root_state/requestor.ts](https://github.com/buckyos/cyfs-ts-sdk/blob/beta/src/sdk/cyfs-lib/root_state/requestor.ts)

To Reproduce
For example : IsolatePath/PathOpEnvStub can call this function,why the log just print path_op_env ,This is a bad log, which will cause the user to view the log and cannot distinguish the OpEnv type

public async load(req: OpEnvLoadOutputRequest): Promise<BuckyResult<void>> {
        if (this.op_env_type_ !== ObjectMapOpEnvType.Single && this.op_env_type_ !== ObjectMapOpEnvType.IsolatePath) {
            const err_msg = `load method only valid for single_op_env and isolate_path_op_env! sid = ${this.sid_}`;
            console.log(err_msg);
            return Ok(undefined);
        }

        console.info(
            `will load for path_op_env: sid=${this.sid_}, target=${req.target}`
        );

        const http_req = this.encode_load_request(req);
        const r = await this.requestor_.request(http_req);
        if (r.err) {
            console.error(
                `load for path_op_env request failed: sid=${this.sid_}, target=${req.target}, ret=${r}`
            );
            return r;
        }

        const resp = r.unwrap();
        if (http_status_code_ok(resp.status)) {
            console.info(
                `load for path_op_env success: sid=${this.sid_}, target=${req.target}`
            );

            return Ok(undefined);
        } else {
            const e = await RequestorHelper.error_from_resp(resp);
            console.error(
                `load for path_op_env failed: sid=${this.sid_}, target=${req.target}, err=${e}`
            );

            return Err(e);
        }
    }
  • The other functions of the class OpEnvRequestor have the same problem

Expected behavior
OpEnvRequestor can identify the specific OpEnv type through op_env_type_, it is recommended to optimize the log

System information
[[cyfs-ts-sdk] https://github.com/buckyos/cyfs-ts-sdk/src/sdk/cyfs-lib/root_state/requestor.ts](https://github.com/buckyos/cyfs-ts-sdk/blob/beta/src/sdk/cyfs-lib/root_state/requestor.ts)

How to develop CYFS dec_app using Rust?

** General Question**
CYFS SDK cyfs-lib supports two programming languages, Rust and TypeScript. I want to develop a Dec app using Rust, how can I integrate it with app-manager? Is there any documentation for this?

cyfs-ts-sdk/src/sdk/cyfs-base/base/buffer.ts:32:66 - error TS7006: Parameter 'x' implicitly has an 'any' type.

This part of the code may cause compilation errors

Uint8Array.prototype.toHex = function toHex() {
// TODO: nodejs 可优化
return Array.prototype.map.call(new Uint8Array(this.buffer), x => ('00' + x.toString(16)).slice(-2)).join('');
}

Describe the bug

    ../../cyfs-ts-sdk/src/sdk/cyfs-base/base/buffer.ts:32:66 - error TS7006: Parameter 'x' implicitly has an 'any' type.

    32     return Array.prototype.map.call(new Uint8Array(this.buffer), x => ('00' + x.toString(16)).slice(-2)).join('');

There are two ways to solve this problem:

+Set the x parameter type to number

return Array.prototype.map.call(new Uint8Array(this.buffer), (x: number) => ('00' + x.toString(16)).slice(-2)).join('');
  • Modify tsconfig.json
{
    "compilerOptions": {
        "noImplicitAny": false
    }
}

[SDK-TOOL] upload directory specified `-e ood` args, then use get download dir failed

Describe the bug
upload directory specified -e ood args, then use get download dir failed

To Reproduce
1、cyfs upload "[path]" -e ood -t ood
output: cyfs://o/5r4MYfFJGt5gQsdGz3NRL3YrKbgZET2Lv1ru2xfhCuM1/95RvaS5a85pUzbvWXZ39qTBHf44SXud2cGKfgv5iuGQn
2、cyfs get cyfs://o/5r4MYfFJGt5gQsdGz3NRL3YrKbgZET2Lv1ru2xfhCuM1/95RvaS5a85pUzbvWXZ39qTBHf44SXud2cGKfgv5iuGQn -s "[save path]"

Expected behavior
cyfs get cyfs://o/5r4MYfFJGt5gQsdGz3NRL3YrKbgZET2Lv1ru2xfhCuM1/95RvaS5a85pUzbvWXZ39qTBHf44SXud2cGKfgv5iuGQn -s "[save path]" execute success, output data to save path

System information
v0.5.6

Additional context
[error],[2022-06-07 16:55:56.694],<>,get_object_by_path error err: (4, get_by_path but not found! dec=9tGpLNnDpa8deXEk2NaWGccEu4yFQ2DrTZJPLYLT7gj4, path=/upload_map/95RvaS5a85pUzbvWXZ39qTBHf44SXud2cGKfgv5iuGQn, undefined), index.js:72543
[info],[2022-06-07 16:55:56.694],<>,get root state path /upload_map/95RvaS5a85pUzbvWXZ39qTBHf44SXud2cGKfgv5iuGQn err err: (4, get_by_path but not found! dec=9tGpLNnDpa8deXEk2NaWGccEu4yFQ2DrTZJPLYLT7gj4, path=/upload_map/95RvaS5a85pUzbvWXZ39qTBHf44SXud2cGKfgv5iuGQn, undefined), cyfs.js:690
[info],[2022-06-07 16:55:56.695],<>,search not found files, cyfs.js:870

Add dynamic acl related support

We need to add support for the ts-sdk side of this feature buckyos/CYFS#175, mainly including changes related to the cyfs-lib side, involving the following.

  • Router Handler's acl request and response
  • AclAction related definitions
  • rmeta's access new Handler type

cyfs get cyfs://eips/index.html error

[info],[2022-06-20 18:36:16.361],<>,get object from non service success: 5r4MYfFb42i8TFKUiCj9BzuBfbqWXyM86ptCmrQdV2md, index.js:68139     
[info],[2022-06-20 18:36:16.365],<>,upload use owner 5r4MYfFb42i8TFKUiCj9BzuBfbqWXyM86ptCmrQdV2md, cyfs.js:758
[info],[2022-06-20 18:36:16.370],<>,download file C:\Temp\index.html.file object: 7Tk94YfJYEgLdTheh5h1CRXTXfSfwovq7fvfmuQqSA37, on (ObjectId: 5aSixgLjnoGY4ESRXZ7anBjUgrPiB5tF14EJmUoenQzd, obj_type:1), cyfs.js:822
[info],[2022-06-20 18:36:16.371],<>,will start trans task http://127.0.0.1:1322/trans/task [object Object], index.js:71754
[error],[2022-06-20 18:36:16.373],<>,start_task to non stack failed, status=404, err={"code":"4","msg":"noc get object but not found: 7Tk94YfJYEgLdTheh5h1CRXTXfSfwovq7fvfmuQqSA37"}, index.js:71768
[error],[2022-06-20 18:36:16.374],<>,start task on target: (ObjectId: 5aSixgLjnoGY4ESRXZ7anBjUgrPiB5tF14EJmUoenQzd, obj_type:1) err err: (4, noc get object but not found: 7Tk94YfJYEgLdTheh5h1CRXTXfSfwovq7fvfmuQqSA37, undefined), cyfs.js:839

And I can open cyfs://eips/index.html in CYFS Browser~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.