{"id":20604803,"url":"https://github.com/themost-framework/node","last_synced_at":"2026-02-18T19:30:59.832Z","repository":{"id":89431593,"uuid":"420189639","full_name":"themost-framework/node","owner":"themost-framework","description":"MOST Web Framework client module for node.js","archived":false,"fork":false,"pushed_at":"2025-03-21T07:27:11.000Z","size":192,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T19:22:28.501Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/themost-framework.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":"2021-10-22T17:38:41.000Z","updated_at":"2025-03-21T07:26:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"b6bbc6e2-8ded-4571-a08d-ba79ec632a06","html_url":"https://github.com/themost-framework/node","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/themost-framework/node","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Fnode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Fnode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Fnode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Fnode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/themost-framework","download_url":"https://codeload.github.com/themost-framework/node/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/themost-framework%2Fnode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29591877,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T18:54:29.675Z","status":"ssl_error","status_checked_at":"2026-02-18T18:50:50.517Z","response_time":162,"last_error":"SSL_read: 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":[],"created_at":"2024-11-16T09:24:55.116Z","updated_at":"2026-02-18T19:30:59.793Z","avatar_url":"https://github.com/themost-framework.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![npm](https://img.shields.io/npm/v/@themost%2Fnode.svg)](https://www.npmjs.com/package/@themost%2Fnode)\n![](https://img.shields.io/david/themost-framework/node) ![](https://img.shields.io/david/peer/themost-framework/node)\n![](https://img.shields.io/david/dev/themost-framework/node)\n![GitHub top language](https://img.shields.io/github/languages/top/themost-framework/node)\n[![License](https://img.shields.io/npm/l/@themost/query)](https://github.com/themost-framework/node/blob/master/LICENSE)\n![GitHub last commit](https://img.shields.io/github/last-commit/themost-framework/node)\n![GitHub Release Date](https://img.shields.io/github/release-date/themost-framework/node)\n[![npm](https://img.shields.io/npm/dw/@themost/node)](https://www.npmjs.com/package/@themost%2Fnode)\n[![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/@themost/node)](https://snyk.io/vuln/npm:%40themost%2Fnode)\n\n# @themost/node\n\n![MOST Web Framework Logo](https://www.themost.io/assets/images/most_logo_sw_240.png)\n\n[MOST Web Framework](https://github.com/themost-framework/themost) - NodeJS client module\n\n## Installation\n\n    npm install @themost/node\n\n\n### Usage\n\n    import {NodeDataContext} from '@themost/node/client';\n    const context = new NodeDataContext(\"http://data.example.com\");\n    context.model(\"Order\")\n        .select(\"id\",\"customer\", \"orderDate\", \"orderNumber\")\n        .expand(\"customer\")\n        .where(\"orderStatus/alternateName\")\n        .equal(\"OrderPaymentDue\")\n        .orderBy(\"orderDate\")\n        .take(10)\n        .getItems().then(function(result) {\n            //enumerate items\n        }).catch((err) =\u003e\n            console.log(err);\n        });\n\n### ClientDataContext Class\n\n#### model(name)\n\nGets an instance of ClientDataModel class based on the given name.\n\n    context.model(\"Order\").where(\"orderStatus\").equal(1).getItems().then(function(result) {\n        //\n    }).catch((err) =\u003e\n        console.log(err);\n    });\n\n#### getService()\n\nGets the instance of ClientDataService associated with this data context.\n\n    console.log(context.getService().getBase());\n\n#### setService(service)\n\nAssociates the given ClientDataService instance with this data context.\n\n    context.setService(new MyDataService(\"http://data.example.com\"));\n\n### ClientDataModel Class\n\n#### asQueryable()\n\nReturns an instance of ClientDataQueryable class associated with this model.\n\n    context.model(\"Order\")\n        .asQueryable()\n        .select(\"id\",\"customer/description as customerDescription\", \"orderDate\", \"orderedItem/name as orderedItemName\")\n        .where(\"paymentMethod/alternateName\").equal(\"DirectDebit\")\n        .orderByDescending(\"orderDate\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n            console.log(err);\n    });\n\n#### getName()\n\nGets a string which represents the name of this data model.\n\n#### getService()\n\nGets the instance of ClientDataService associated with this data model.\n\n#### remove(obj)\n\nRemoves the given item or array of items.\n\n    var order = {\n        id:1\n    };\n    context.model(\"Order\").remove(order).then(function(result) {\n        //\n    }).catch((err) =\u003e\n        console.log(err);\n    }\n\n#### save(obj)\n\nCreates or updates the given item or array of items.\n\n    var order = {\n        id:1,\n        orderStatus:7\n    };\n    context.model(\"Order\").save(order).then(function(result) {\n        //\n    }).catch((err) =\u003e\n        console.log(err);\n    }\n\n#### select(...attr)\n\nInitializes and returns an instance of ClientDataQueryable class by selecting an attribute or a collection of attributes.\n\n    context.model(\"Order\")\n        .select(\"id\",\"customer\",\"orderedItem\",\"orderStatus\")\n        .orderBy(\"orderDate\")\n        .take(25)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n            console.log(err);\n    });\n\n#### skip(num)\n\nInitializes and returns an instance of ClientDataQueryable class by specifying the number of records to be skipped.\n\n    context.model(\"Order\")\n        .skip(10)\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n            console.log(err);\n    });\n\n#### take(num)\n\nInitializes and returns an instance of ClientDataQueryable class by specifying the number of records to be taken.\n\n    context.model(\"Order\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n            console.log(err);\n    });\n\n#### where(attr)\n\nInitializes a comparison expression by using the given attribute as left operand\nand returns an instance of ClientDataQueryable class.\n\n    context.model(\"Order\")\n        .where(\"orderedItem/category\").equal(\"Laptops\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n            console.log(err);\n    });\n\n### ClientDataQueryable Class\n\nClientDataQueryable class enables developers to perform simple and extended queries against data models.\nThe ClienDataQueryable class follows [DataQueryable](https://docs.themost.io/most-data/DataQueryable.html)\nwhich is introduced by [MOST Web Framework ORM server-side module](https://github.com/kbarbounakis/most-data).\n\n#### Logical Operators\n\nOr:\n\n    context.model(\"Product\")\n        .where(\"category\").equal(\"Desktops\")\n        .or(\"category\").equal(\"Laptops\")\n        .orderBy(\"price\")\n        .take(5)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nAnd:\n\n    context.model(\"Product\")\n        .where(\"category\").equal(\"Laptops\")\n        .and(\"price\").between(200,750)\n        .orderBy(\"price\")\n        .take(5)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n#### Comparison Operators\n\nEqual:\n\n    context.model(\"Order\")\n            .where(\"id\").equal(10)\n            .getItem()\n            .then((result) =\u003e {\n                //\n            }).catch((err) =\u003e\n                console.log(err);\n        });\n\nNot equal:\n\n    context.model(\"Order\")\n            .where(\"orderStatus/alternateName\").notEqual(\"OrderProblem\")\n            .orderByDescending(\"orderDate\")\n            .take(10)\n            .getItems()\n            .then((result) =\u003e {\n                //\n            }).catch((err) =\u003e\n                console.log(err);\n        });\n\nGreater than:\n\n    context.model(\"Order\")\n        .where(\"orderedItem/price\").greaterThan(968)\n        .and(\"orderedItem/category\").equal(\"Laptops\")\n        .and(\"orderStatus/alternateName\").notEqual(\"OrderCancelled\")\n        .select(\"id\",\n            \"orderStatus/name as orderStatusName\",\n            \"customer/description as customerDescription\",\n            \"orderedItem\")\n        .orderByDescending(\"orderDate\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            return done();\n        }).catch((err) =\u003e\n        console.log(err);\n        return done(err);\n    });\n\nGreater or equal:\n\n    context.model(\"Product\")\n        .where(\"price\").greaterOrEqual(1395.9)\n        .orderByDescending(\"price\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n           //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nLower than:\n\n    context.model(\"Product\")\n        .where(\"price\").lowerThan(263.56)\n        .orderBy(\"price\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nLower or equal:\n\n    context.model(\"Product\")\n        .where(\"price\").lowerOrEqual(263.56)\n        .and(\"price\").greaterOrEqual(224.52)\n        .orderBy(\"price\")\n        .take(5)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nContains:\n\n    context.model(\"Product\")\n        .where(\"name\").contains(\"Book\")\n        .and(\"category\").equal(\"Laptops\")\n        .orderBy(\"price\")\n        .take(5)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nBetween:\n\n    context.model(\"Product\")\n        .where(\"category\").equal(\"Laptops\")\n        .or(\"category\").equal(\"Desktops\")\n        .andAlso(\"price\").between(200,750)\n        .orderBy(\"price\")\n        .take(5)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n#### Aggregate Functions\n\nCount:\n\n    context.model(\"Product\")\n        .select(\"category\", \"count(id) as total\")\n        .groupBy(\"category\")\n        .orderByDescending(\"count(id)\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nMin:\n\n    context.model(\"Product\")\n        .select(\"category\", \"min(price) as minimumPrice\")\n        .where(\"category\").equal(\"Laptops\")\n        .or(\"category\").equal(\"Desktops\")\n        .groupBy(\"category\")\n        .orderByDescending(\"min(price)\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nMax:\n\n    context.model(\"Product\")\n        .select(\"category\", \"max(price) as maximumPrice\")\n        .where(\"category\").equal(\"Laptops\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n### String Functions:\n\nIndex Of:\n\n    context.model(\"Product\")\n        .where(\"name\").indexOf(\"Intel\")\n        .greaterOrEqual(0)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nSubstring:\n\n    context.model(\"Product\")\n        .where(\"name\").substr(6,4)\n        .equal(\"Core\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nStarts with:\n\n    context.model(\"Product\")\n        .where(\"name\").startsWith(\"Intel Core\")\n        .equal(true)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nEnds with:\n\n    context.model(\"Product\")\n        .where(\"name\").endsWith(\"Edition\")\n        .equal(true)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nLower case:\n\n    context.model(\"Product\")\n        .where(\"category\").toLowerCase()\n        .equal(\"laptops\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nUpper case:\n\n    context.model(\"Product\")\n        .where(\"category\").toUpperCase()\n        .equal(\"LAPTOPS\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n#### Date Functions:\n\nDate:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getDate()\n        .equal(\"2015-04-18\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nMonth:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getMonth()\n        .equal(4)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nDay:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getMonth().equal(4)\n        .and(\"orderDate\").getDay().lowerThan(15)\n        .getItems()\n        .then((result) =\u003e {\n           //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nYear:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getMonth().equal(5)\n        .and(\"orderDate\").getDay().lowerOrEqual(10)\n        .and(\"orderDate\").getFullYear().equal(2015)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nHours:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getMonth().equal(5)\n        .and(\"orderDate\").getDay().lowerOrEqual(10)\n        .and(\"orderDate\").getHours().between(10,18)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nMinutes:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getMonth().equal(5)\n        .and(\"orderDate\").getHours().between(9,17)\n        .and(\"orderDate\").getMinutes().between(1,30)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nSeconds:\n\n    context.model(\"Order\")\n        .where(\"orderDate\").getMonth().equal(5)\n        .and(\"orderDate\").getHours().between(9,17)\n        .and(\"orderDate\").getMinutes().between(1,30)\n        .and(\"orderDate\").getSeconds().between(1,45)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n#### Math Functions\n\nRound:\n\n    context.model(\"Product\")\n        .where(\"price\").round().lowerOrEqual(177)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nFloor:\n\n    context.model(\"Product\")\n        .where(\"price\").floor().lowerOrEqual(177)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\nCeiling:\n\n    context.model(\"Product\")\n        .where(\"price\").ceil().greaterOrEqual(177)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n#### Methods\n\n##### and(name)\n\nPrepares a logical AND expression.\n\nParameters:\n- name: The name of field that is going to be used in this expression\n\n##### andAlso(name)\n\nPrepares a logical AND expression.\nIf an expression is already defined, it will be wrapped with the new AND expression\n\nParameters:\n- name: The name of field that is going to be used in this expression\n\n        context.model(\"Product\")\n            .where(\"category\").equal(\"Laptops\")\n            .or(\"category\").equal(\"Desktops\")\n            .andAlso(\"price\").floor().lowerOrEqual(177)\n            .getItems()\n            .then((result) =\u003e {\n                //\n            }).catch((err) =\u003e\n            console.log(err);\n        });\n\n##### expand(...attr)\n\nParameters:\n- attr: A param array of strings which represents the field or the array of fields that are going to be expanded.\nIf attr is missing then all the previously defined expandable fields will be removed\n\nDefines an attribute or an array of attributes to be expanded in the final result. This operation should be used\nwhen a non-expandable attribute is required to be expanded in the final result.\n\n    context.model(\"Order\")\n        .where(\"customer\").equal(337)\n        .orderByDescending(\"orderDate\")\n        .expand(\"customer\")\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n##### first()\n\nExecutes the specified query and returns the first item.\n\n    context.model(\"User\")\n        .where(\"name\").equal(\"alexis.rees@example.com\")\n        .first()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n##### getItem()\n\nExecutes the specified query and returns the first item.\n\n    context.model(\"User\")\n        .where(\"name\").equal(\"alexis.rees@example.com\")\n        .item()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n##### getItems()\n\nExecutes the specified query and returns an array of items.\n\n    context.model(\"Product\")\n        .where(\"category\").equal(\"Laptops\")\n        .take(10)\n        .getItems()\n        .then((result) =\u003e {\n            //\n        }).catch((err) =\u003e\n        console.log(err);\n    });\n\n##### getList()\n\nExecutes the underlying query and returns a result set based on the specified paging parameters. The result set\ncontains the following attributes:\n\n- total (number): The total number of records\n- skip (number): The number of skipped records\n- records (Array): An array of objects which represents the query results.\n\n        context.model(\"Product\")\n            .where(\"category\").equal(\"Laptops\")\n            .skip(10)\n            .take(10)\n            .getList()\n            .then((result) =\u003e {\n                //\n            }).catch((err) =\u003e\n            console.log(err);\n        });\n\n##### skip(val)\n\nPrepares a paging operation by skipping the specified number of records\n\nParameters:\n- val: The number of records to be skipped\n\n         context.model(\"Product\")\n                 .where(\"category\").equal(\"Laptops\")\n                 .skip(10)\n                 .take(10)\n                 .getList()\n                 .then((result) =\u003e {\n                     //\n                 }).catch((err) =\u003e\n                 console.log(err);\n             });\n\n##### take(val)\n\nPrepares a data paging operation by taking the specified number of records\n\nParameters:\n- val: The number of records to take\n\n         context.model(\"Product\")\n                 .where(\"category\").equal(\"Laptops\")\n                 .skip(10)\n                 .take(10)\n                 .getList()\n                 .then((result) =\u003e {\n                     //\n                 }).catch((err) =\u003e\n                 console.log(err);\n             });\n\n##### groupBy(...attr)\n\nPrepares a group by expression\n\n    context.model(\"Order\")\n     .select(\"orderedItem/model as productModel\", \"orderedItem/name as productName\",\"count(id) as orderCount\")\n     .where(\"orderDate').getFullYear().equal(2015)\n     .groupBy(\"orderedItem\")\n     .orderByDescending(\"count(id)\")\n     .take(5).getItems().then(function(result) {\n            //\n        }).catch((err) =\u003e\n           console.log(err);\n        });\n\n##### orderBy(...attr)\n\nPrepares an ascending sorting operation\n\n    context.model(\"Product\")\n         .orderBy(\"category\",\"name\")\n         .take(25).getItems().then(function(result) {\n                //\n            }).catch((err) =\u003e\n               console.log(err);\n            });\n\n##### thenBy(...attr)\n\n Continues a descending sorting operation\n\n     context.model(\"Product\")\n          .orderBy(\"category\")\n          .thenBy(\"name\")\n          .take(25).getItems().then(function(result) {\n                 //\n             }).catch((err) =\u003e\n                console.log(err);\n             });\n\n##### orderByDescending(...attr)\n\n Prepares an descending sorting operation\n\n     context.model(\"Product\")\n          .orderByDescending(\"price\")\n          .take(25).getItems().then(function(result) {\n                 //\n             }).catch((err) =\u003e\n                console.log(err);\n             });\n\n##### thenByDescending(...attr)\n\n Continues a descending sorting operation\n\n     context.model(\"Product\")\n          .orderBy(\"category\")\n          .thenByDescending(\"price\")\n          .take(25).getItems().then(function(result) {\n                 //\n             }).catch((err) =\u003e\n                console.log(err);\n             });\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemost-framework%2Fnode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthemost-framework%2Fnode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthemost-framework%2Fnode/lists"}