{"id":20168990,"url":"https://github.com/mage/mage-module-staticdata","last_synced_at":"2026-05-15T13:34:20.658Z","repository":{"id":57142328,"uuid":"94845391","full_name":"mage/mage-module-staticdata","owner":"mage","description":"Static data module, including a Google Spreadsheet add-on to manage exports and imports","archived":false,"fork":false,"pushed_at":"2017-08-15T06:30:09.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-20T00:49:19.286Z","etag":null,"topics":["mage","module","nodejs","staticdata"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"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":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-06-20T03:23:15.000Z","updated_at":"2017-06-22T07:55:35.000Z","dependencies_parsed_at":"2022-09-05T10:01:49.016Z","dependency_job_id":null,"html_url":"https://github.com/mage/mage-module-staticdata","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mage/mage-module-staticdata","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-module-staticdata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-module-staticdata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-module-staticdata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-module-staticdata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mage","download_url":"https://codeload.github.com/mage/mage-module-staticdata/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mage%2Fmage-module-staticdata/sbom","scorecard":{"id":611403,"data":{"date":"2025-08-11","repo":{"name":"github.com/mage/mage-module-staticdata","commit":"07041d4c44220212885ea2eaf5926ddca1e865c9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"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":"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":"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":"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":"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":"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":"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":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"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:06.801Z","repository_id":57142328,"created_at":"2025-08-21T02:45:06.801Z","updated_at":"2025-08-21T02:45:06.801Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33068584,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T11:35:32.926Z","status":"ssl_error","status_checked_at":"2026-05-15T11:35:31.362Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["mage","module","nodejs","staticdata"],"created_at":"2024-11-14T01:10:59.114Z","updated_at":"2026-05-15T13:34:20.637Z","avatar_url":"https://github.com/mage.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"mage-module-staticdata\n======================\n\nStatic data module (TypeScript), including a Google Spreadsheet add-on \nto manage exports and imports.\n\nInstallation\n-------------\n\n```shell\nnpm install --save mage-module-staticdata\n```\n\nIf you wish to validate your schema upon import, you will\nalso want to install `class-validator`\n\n```shell\nnpm install --save class-validator\n```\n\nFinally, if you plan to use the \n[MAGE Static Data Manager Add-on for Google Spreadsheets](https://chrome.google.com/webstore/detail/mage-static-data-manager/mkboklnalhmingcobmekbelgafiipioh),\nyou will also want to install `mage-https-devel`. This is needed\nto allow seamless communication over HTTPS between the Google Spreadsheet\nAdd-on and your MAGE local server during development.\n\n```shell\nnpm install --save mage-https-devel\n```\n\nUsage\n-----\n\n### Creating a module instance\n\n\u003e lib/modules/staticData/index.ts\n\n```typescript\n// Load the staticdata external module\nimport { AbstractStaticDataModule } from 'mage-module-staticdata'\nimport StaticData from './types/StaticData'\n\n/**\n * Static Data module class\n *\n * We create an instance of this module, which will\n * be used to import, export, and provide static data.\n *\n * @class StaticDataModule\n * @extends {AbstractStaticDataModule}\n */\nclass StaticDataModule extends AbstractStaticDataModule {\n  public StaticDataClass = StaticData\n  public staticData: StaticData\n}\n\nexport default new StaticDataModule()\n```\n\n### Creating user commands\n\nFor instance if you wish to use this module with the \n[MAGE Static Data Manager Add-on for Google Spreadsheets](https://chrome.google.com/webstore/detail/mage-static-data-manager/mkboklnalhmingcobmekbelgafiipioh),\nyou will need to create at least an `import` and `export` user command.\n\n\u003e lib/modules/staticData/usercommands/export.ts\n\n```typescript\n/**\n *\n * @module staticData\n */\n\n// mage\nimport * as mage from 'mage'\nimport StaticDataModule from '../'\n\n// validation tools\nimport { Acl } from 'mage-validator'\n\n// User command\nexport default class {\n  @Acl('*')\n  public static async execute(state: mage.core.IState) {\n    return StaticDataModule.export(state)\n  }\n}\n\n```\n\n### Creating your static data structure\n\n\u003e lib/modules/staticData/types/StaticData.ts\n\n```typescript\nimport Card from './Card'\n\nimport { StaticData, StaticDataClass } from 'mage-module-staticdata'\n\n/**\n * The StaticData class is the root]\n * class for static data; all static data\n * items must be added here.\n *\n * @export\n * @class\n * @extends {StaticDataClass}\n */\nexport default class extends StaticDataClass {\n  @StaticData('カード', Card)\n  public Cards: Card[]\n}\n```\n\nThe `@StaticData()` decorator takes the following parameters:\n\n  1. **name**: Human-readable name; can be used by content management tools for display\n  2. **options**: \n     - If the attribute is an array or an object, you will need to put the class for this attribute\n     - Otherwise, it can be used to transmit metadata information usable by content management tools\n\n\u003e lib/modules/staticData/types/StaticData.ts\n\n```typescript\nimport {\n  IsAlpha,\n  IsHalfWidth,\n  IsNumber\n} from 'class-validator'\n\nimport { StaticData, StaticDataClass } from 'mage-module-staticdata'\n\n/**\n * Sample card class\n *\n * @export\n * @class\n * @extends {StaticDataClass}\n */\nexport default class extends StaticDataClass {\n  @IsNumber()\n  @StaticData('Item ID')\n  public id: number\n\n  @IsHalfWidth()\n  @StaticData('名前')\n  public name: string\n\n  @IsAlpha()\n  @StaticData('タイプ', {\n    enum: ['a', 'b', 'c']\n  })\n  public type: string\n}\n```\n\nHere we see that we can both add meta-data to our entry\nand validation decorators.\n\n### MAGE Static Data Manager Add-on for Google Spreadsheets\n\nComing soon (with link updates).\n\nStorage \u0026 access to the static data\n------------------------------------\n\n### Location \n\nBy default, your static data will be stored into a `static.dat` file\nat the top level of your project. This behaviours is of course\nconfigurable:\n\n\u003e config/default.yaml\n\n```yaml\nstatic:\n  location: 'lib/modules/staticData/dump.dat'\n```\n\n### Remote storage\n\nAdditionally, you can alter your module class\nby creating your own `load` and `store` methods;\nthis will allow you to distribute the update process\nwhen pushing static data to a full-blown MAGE cluster.\n\n\u003e lib/modules/staticData/index.ts\n\n```typescript\nclass StaticDataModule extends AbstractStaticDataModule {\n  public StaticDataClass = StaticData\n  public staticData: StaticData\n\n  public async load(state: mage.core.IState): Promise\u003cstring\u003e {\n    // Load from database\n  }\n\n  public async store(state: mage.core.IState, data: string): Promise\u003cvoid\u003e {\n    // Store to database\n  }\n}\n```\n\nThis static data module instance will automatically make sure to broadcast\nthe static data update to all MAGE nodes in the cluster.\n\n### Clustering\n\nUnless you define a `load` and a `store` method override, data will automatically\nbe propagated throughout your cluster. If you wish to keep this behavior, simply\nmake sure to add the `notify` method call in your `store` override:\n\n\u003e lib/modules/staticData/index.ts\n\n```typescript\nclass StaticDataModule extends AbstractStaticDataModule {\n  public StaticDataClass = StaticData\n  public staticData: StaticData\n\n  public async load(state: mage.core.IState): Promise\u003cstring\u003e {\n    // Load from database\n  }\n\n  public async store(state: mage.core.IState, data: string): Promise\u003cvoid\u003e {\n    // Store to database, then\n    this.notify(data)\n  }\n}\n```\n\nHowever, doing this will likely pose scalability issues, since now you\nwill be sending static data from a single MAGE node to all other nodes. \nWhat you will likely want to do, instead, is add an `update` method override\nwhich will take care of loading the data from the right location.\n\n\u003e lib/modules/staticData/index.ts\n\n```typescript\nclass StaticDataModule extends AbstractStaticDataModule {\n  public StaticDataClass = StaticData\n  public staticData: StaticData\n\n  public async load(state: mage.core.IState): Promise\u003cstring\u003e {\n    // Load from database\n  }\n\n  public async store(state: mage.core.IState, data: string): Promise\u003cvoid\u003e {\n    // Store to database, then\n    this.notify()\n  }\n\n  public async update() {\n    // here, you can do one of two things: either restart the process\n    // instance by quitting the current one\n    mage.quit()\n    \n    // Or hot-load the data from your static data source\n    const json = await this.load()\n    const data = JSON.parse(json)\n    this.staticData = await this.parse(data)\n  }\n}\n```\n\nLicense\n-------\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmage%2Fmage-module-staticdata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmage%2Fmage-module-staticdata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmage%2Fmage-module-staticdata/lists"}