{"id":29956645,"url":"https://github.com/vitaliy-art/tarantoolscript","last_synced_at":"2025-08-11T19:10:50.833Z","repository":{"id":204841112,"uuid":"712079291","full_name":"vitaliy-art/tarantoolscript","owner":"vitaliy-art","description":"Create Tarantool Lua scripts using TypeScript","archived":false,"fork":false,"pushed_at":"2025-06-30T15:34:48.000Z","size":800,"stargazers_count":13,"open_issues_count":6,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-01T03:55:48.454Z","etag":null,"topics":["lua","tarantool","typescript","typescript-definitions","typescript-to-lua"],"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/vitaliy-art.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,"zenodo":null}},"created_at":"2023-10-30T18:45:59.000Z","updated_at":"2025-06-06T07:45:03.000Z","dependencies_parsed_at":"2023-11-14T08:26:16.598Z","dependency_job_id":"caf9cdc2-3332-4f32-8ee1-6cf2707c77c3","html_url":"https://github.com/vitaliy-art/tarantoolscript","commit_stats":{"total_commits":236,"total_committers":1,"mean_commits":236.0,"dds":0.0,"last_synced_commit":"a178b37bddf05563cc1ac6c7f4d0a2865a75a704"},"previous_names":["vitaliy-art/tarantoolscript"],"tags_count":121,"template":false,"template_full_name":null,"purl":"pkg:github/vitaliy-art/tarantoolscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-art%2Ftarantoolscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-art%2Ftarantoolscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-art%2Ftarantoolscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-art%2Ftarantoolscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitaliy-art","download_url":"https://codeload.github.com/vitaliy-art/tarantoolscript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitaliy-art%2Ftarantoolscript/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268595791,"owners_count":24275771,"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-08-03T02:00:12.545Z","response_time":2577,"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":["lua","tarantool","typescript","typescript-definitions","typescript-to-lua"],"created_at":"2025-08-03T19:01:19.478Z","updated_at":"2025-08-03T19:04:17.904Z","avatar_url":"https://github.com/vitaliy-art.png","language":"JavaScript","readme":"# TarantoolScript\r\n\r\nTarantoolScript is a tool to help you create [Tarantool](https://www.tarantool.io/ru/) [Lua](https://www.lua.org/) scripts using [TypeScript](https://www.typescriptlang.org/).\r\n\r\n# Getting started\r\n\r\nTo install Tarantoolscript add `tarantoolscript` npm package to your TypeScript project:\r\n\r\n```\r\n$ npm install --save-dev tarantoolscript\r\n```\r\n\r\nAlso to compile your TypeScript program to Lua scripts, you need to install TypeScriptToLua:\r\n\r\n```\r\n$ npm install --save-dev typescript-to-lua\r\n```\r\n\r\n[Here](https://typescripttolua.github.io/docs/getting-started) you can find more information about TypeScriptToLua.\r\n\r\n# Usage\r\n\r\nTarantoolscript provides some type declarations useful to create you own Lua scripts which may be executed by Tarantool. [Here](https://www.tarantool.io/en/doc/latest/overview/) you can find more information about Tarantool.\r\n\r\n## Basic usage\r\n\r\n### Init instance\r\n\r\nInterface `Box` describes all functions and submodules, included into Tarantool global variable `box`. To use it, just declare constant `box` of type `Box`:\r\n\r\n```ts\r\nimport { Box, ConfigOptions } from 'tarantoolscript';\r\n\r\ndeclare const box: Box;\r\n\r\nconst cfg: ConfigOptions = {\r\n    listen: 3301,\r\n};\r\n\r\nbox.cfg(cfg);\r\n```\r\n\r\nTypeScriptToLua will compile this TypeScript code to following Lua code:\r\n\r\n```lua\r\nlocal ____exports = {}\r\nlocal cfg = {listen = 3301}\r\nbox.cfg(cfg)\r\nreturn ____exports\r\n```\r\n\r\n### Create space\r\n\r\n```ts\r\nconst bands = box.schema.space.create('bands');\r\n```\r\n\r\n### Format space\r\n\r\n```ts\r\nbands.format([\r\n    { name: 'id', type: 'unsigned' },\r\n    { name: 'band_name', type: 'string' },\r\n    { name: 'year', type: 'unsigned' },\r\n]);\r\n```\r\n\r\n### Create index\r\n\r\n```ts\r\nbands.create_index('primary', { parts: ['id'] });\r\n```\r\n\r\n### Insert data\r\n\r\n```ts\r\nbands.insert([1, 'Roxette', 1986]);\r\n```\r\n\r\n## Tarantool modules usage\r\n\r\nTo usage some modules, which should be imported into script with Lua keyword `require`, you need first edit your `tsconfig.json` by following algorithm. At example, if you need to import module `log`, add it to tsconfig `compilerOptions.paths`:\r\n\r\n```json\r\n{\r\n    \"compilerOptions\": {\r\n        \"paths\": {\r\n            \"log\": [\"tarantoolscript/src/log.d.ts\"]\r\n        }\r\n    },\r\n    \"tstl\": {\r\n        \"noResolvePaths\": [\r\n            \"log\"\r\n        ]\r\n    }\r\n}\r\n```\r\n\r\nOr for module `luatest.helpers`:\r\n\r\n```json\r\n{\r\n    \"compilerOptions\": {\r\n        \"paths\": {\r\n            \"luatest.helpers\": [\"tarantoolscript/src/luatest.helpers.d.ts\"]\r\n        }\r\n    },\r\n    \"tstl\": {\r\n        \"noResolvePaths\": [\r\n            \"luatest.helpers\"\r\n        ]\r\n    }\r\n}\r\n```\r\n\r\nNow you can import and use these modules:\r\n\r\n```ts\r\nimport * as log from 'log';\r\nimport * as luatest_helpers from 'luatest.helpers';\r\n\r\nlog.info(luatest_helpers.uuid(1, 2, 3));\r\n```\r\n\r\nAfter compilation:\r\n\r\n```lua\r\nlocal ____exports = {}\r\nlocal log = require(\"log\")\r\nlocal luatest_helpers = require(\"luatest.helpers\")\r\nlog.info(luatest_helpers.uuid(1, 2, 3))\r\nreturn ____exports\r\n```\r\n\r\nOf course, to use `luatest` package or other packages which not included into Tarantool default build, you need to install them with [tt rocks](https://www.tarantool.io/en/doc/latest/reference/tooling/tt_cli/rocks/) command.\r\n\r\n## More usage examples\r\n\r\n[This repository](https://github.com/vitaliy-art/tarantoolscript-samples) contains many useful samples, which are examples of using modules taken from the official Tarantool documentation. Every source file contains in its header link to the corresponding documentation page.\r\n\r\n[This repository](https://github.com/vitaliy-art/tarantoolscript-server-example) can help you understanding how to write Tarantool scripts with TarantoolScript.\r\n\r\n# Status\r\n\r\nTarantoolscript is under development and not declares many useful Tarantool modules, which will be added in the near future.\r\n\r\nFeel free to add [Issue](https://github.com/vitaliy-art/tarantoolscript/issues/new) or create [Pull request](https://github.com/vitaliy-art/tarantoolscript/compare).\r\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitaliy-art%2Ftarantoolscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitaliy-art%2Ftarantoolscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitaliy-art%2Ftarantoolscript/lists"}