{"id":20168975,"url":"https://github.com/mage/mage-sdk-node","last_synced_at":"2025-10-09T10:11:43.882Z","repository":{"id":82165233,"uuid":"98978708","full_name":"mage/mage-sdk-node","owner":"mage","description":"MAGE SDK for Node.js","archived":false,"fork":false,"pushed_at":"2017-08-01T09:28:11.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-03-23T14:20:15.618Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mage.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-01T08:33:34.000Z","updated_at":"2017-08-01T09:25:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"7b8f53cb-b4f8-473c-9cbc-0d7269c32c77","html_url":"https://github.com/mage/mage-sdk-node","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"4963b4d2017da775a0991d90af6c01effa1222d3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mage/mage-sdk-node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-sdk-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-sdk-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-sdk-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-sdk-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mage","download_url":"https://codeload.github.com/mage/mage-sdk-node/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-sdk-node/sbom","scorecard":{"id":611408,"data":{"date":"2025-08-11","repo":{"name":"github.com/mage/mage-sdk-node","commit":"4963b4d2017da775a0991d90af6c01effa1222d3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/2 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-21T02:45:10.291Z","repository_id":82165233,"created_at":"2025-08-21T02:45:10.291Z","updated_at":"2025-08-21T02:45:10.291Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001323,"owners_count":26083040,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-14T01:10:47.570Z","updated_at":"2025-10-09T10:11:43.866Z","avatar_url":"https://github.com/mage.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Mage Client\n\nThis is a MAGE client written in pure ES6, it should be compatible with Node 5.x and should also\nrun in the browser if built through a tool like Babel.\n\n## Installation\n\n```\nnpm i mage-sdk-node --save\n```\n\n## Requirements\n\nAt least NodeJS 6.x\n\n## Usage\n\n### Promise-based\n\n```javascript\nconst Mage = require('mage-sdk-node')\nconst config = require('./my-mage-config')\n\n\nconst client = new Mage(config)\n\n// mage commands are now promises so they can be chained\nclient.user.register()\n    .then(() =\u003e {\n        // do game/app logic\n    })\n    .catch(error =\u003e {\n        console.error(error);\n        process.exit(1);\n    });\n```\n\n### Async/Await\n\nIf async/await is available, the code above can be rewritten as follow:\n\n```javascript\nconst Mage = require('mage-sdk-node')\nconst config = require('./my-mage-config')\n\ntry {\n    // create the mage client\n    const client = new Mage(config)\n\n    // register a guest user and join a game\n    await client.user.register();\n\n    const game = await client.game.join();\n    doSomething(game);\n} catch (error) {\n    console.error(error);\n}\n```\n\n## Configuration\n\nYou will need to extract your client configuration from your mage project, to do\nso create a javascript file at the root of your project (ie. `config.js`) with\nthe following content:\n\n```js\nconst mage = require('./lib');\nconsole.log(JSON.stringify(mage.getClientConfig('api'), null, 4));\n```\n\nThen run it with node, a JSON object should get output in your console, this is\nyour node config and can be used to instanciate the `Mage` class.\n\nIt could for example be saved in a file called `config/production.js` in your\nclient project using this format:\n\n```js\nmodule.exports = {\n    /* json configuration */\n}\n```\n\nThat way you can easily require it in your project.\n\n## API\n\n### Mage (EventEmitter)\n\nWhen the mage client finish initializing, you should be able to run client.{module}.{command} for each\nuser command set on the server, those calls will return a promise.\n\n**constructor(config: MageClientConfig)**\n\nThe Mage client config can be extracted from your server by running the command\ndescribed above.\n\n*get* **archivist**\n\nThe archivist instance.\n\n*get* **commands**\n\nReturns the Command Center.\n\n*get* **session**\n\nReturns the current session.\n\n*set* **session**\n\nSets the current session, must be a Session object.\n\n*get* **stream**\n\nReturns the message stream.\n\n**close() -\u003e void**\n\nCloses all connections to the server.\n\n**{module}.{command}(any ...params) -\u003e Promise(any)**\n\nWrappers for `CommandCenter.send`.\n\n### Archivist (EventEmitter)\n\n*get* **cache**\n\nReturns the underlying cache (defaults to Memory).\n\n**exists(string topic, Object index[, Object options]) -\u003e Promise(boolean)**\n\nChecks if the given value exists.\n\n**get(string topic, Object index[, Object options]) -\u003e Promise(any)**\n\nRetrieve a value from the server, unless cached locally.\n\n**list(string topic, Object partialIndex[, Object options]) -\u003e Promise(any[])**\n\nList objects on the server using a partial index.\n\n**mget(Object|Object[] queries[, Object options]) -\u003e Promise(Object|any[])**\n\nRun multiple gets on the server in one go.\n\n*event* **{topic}(string operation, Object index[, any value])**\n\nWhenether `set`, `applyDiff` or `del` operations are run, emit an event for the topic.\n\n### CommandCenter\n\n*set* **cookies**\n\nSet a cookie jar for use with the command center.\n\n**registerHook(string name, Function hook)**\n\nRegister a hook with the command center, when hooks are called they should return an object that will then be\nset as a header to the current call.\n\n**unregisterHook(string name)**\n\nRemove a hook.\n\n**send(string cmdName, any[] params) -\u003e Promise(any)**\n\nCall the command center, returns a promise and queue the command, the promise only resolves\nonce the queue goes through.\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmage%2Fmage-sdk-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmage%2Fmage-sdk-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmage%2Fmage-sdk-node/lists"}