Security News
JSR Working Group Kicks Off with Ambitious Roadmap and Plans for Open Governance
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
lambdaorm-client-node
Advanced tools
Lambdaorm client node is an http client to consume lambdaorm service
import { orm } from 'lambdaorm-client-node'
import { Orders } from './model'
async function execute() {
try {
orm.init('http://localhost:9291')
console.log(await orm.general.ping())
console.log(await orm.general.health())
} catch (error: any) {
console.error(error)
}
}
execute()
Results:
{message: 'pong', time: '2023-11-19T04:25:36.840Z'}
{uptime: 6124.260961852, message: 'OK', time: '2023-11-19T04:25:36.846Z'}
import { orm } from 'lambdaorm-client-node'
import { Orders } from './model'
async function execute() {
try {
orm.init('http://localhost:9291')
const query = (id: number) =>
Orders.filter(p => p.id == id).include(p => [
p.customer.map(c => c.name),
p.details.include(d =>
d.product.include(pr =>
pr.category.map(cat => cat.name)
).map(pr => pr.name)
).map(d => [d.quantity, d.unitPrice]),
])
const data = { id: 10248 }
const plan = await orm.plan(query, { stage: 'default' })
console.log(JSON.stringify(plan, null, 2))
const result = await orm.execute(query, data, { stage: 'default' })
console.log(JSON.stringify(result, null, 2))
} catch (error: any) {
console.error(error)
}
}
execute()
import { orm } from 'lambdaorm-client-node'
async function execute() {
try {
orm.init('http://localhost:9291')
const query = `Orders.filter(p => p.id == id)
.include(p => [p.customer.map(c => c.name),p.details
.include(d => d.product
.include(pr => pr.category.map(cat => cat.name))
.map(pr => pr.name))
.map(d => [d.quantity, d.unitPrice])])`
const data = { id: 10248 }
const plan = await orm.plan(query, { stage: 'default' })
console.log(JSON.stringify(plan, null, 2))
const result = await orm.execute(query, data, { stage: 'default' })
console.log(JSON.stringify(result, null, 2))
} catch (error: any) {
console.error(error)
}
}
execute()
Result of plan method:
{
"entity": "Orders",
"dialect": "MySQL",
"source": "default",
"sentence": "SELECT o.OrderID AS id, o.CustomerID AS customerId, o.EmployeeID AS employeeId, o.OrderDate AS orderDate, o.RequiredDate AS requiredDate, o.ShippedDate AS shippedDate, o.ShipVia AS shipViaId, o.Freight AS freight, o.ShipName AS name, o.ShipAddress AS address, o.ShipCity AS city, o.ShipRegion AS region, o.ShipPostalCode AS postalCode, o.ShipCountry AS country, o.CustomerID AS `__customerId`, o.OrderID AS `__id` FROM Orders o WHERE o.OrderID = ? ",
"children": [
{
"entity": "Customers",
"dialect": "MySQL",
"source": "default",
"sentence": "SELECT c.CompanyName AS name, c.CustomerID AS LambdaOrmParentId FROM Customers c WHERE c.CustomerID IN (?) ",
"children": []
},
{
"entity": "Orders.details",
"dialect": "MySQL",
"source": "default",
"sentence": "SELECT o1.Quantity AS quantity, o1.UnitPrice AS unitPrice, o1.ProductID AS `__productId`, o1.OrderID AS LambdaOrmParentId FROM `Order Details` o1 WHERE o1.OrderID IN (?) ",
"children": [
{
"entity": "Products",
"dialect": "MySQL",
"source": "default",
"sentence": "SELECT p.ProductName AS name, p.CategoryID AS `__categoryId`, p.ProductID AS LambdaOrmParentId FROM Products p WHERE p.ProductID IN (?) ",
"children": [
{
"entity": "Categories",
"dialect": "MySQL",
"source": "default",
"sentence": "SELECT c1.CategoryName AS name, c1.CategoryID AS LambdaOrmParentId FROM Categories c1 WHERE c1.CategoryID IN (?) ",
"children": []
}
]
}
]
}
]
}
Result of execution method:
[
{
"id": 10248,
"customerId": "VINET",
"employeeId": 5,
"orderDate": "1996-07-04T00:00:00.000Z",
"requiredDate": "1996-08-01T00:00:00.000Z",
"shippedDate": "1996-07-16T00:00:00.000Z",
"shipViaId": 3,
"freight": 32.38,
"name": "Vins et alcools Chevalier",
"address": "59 rue de l-Abbaye",
"city": "Reims",
"region": null,
"postalCode": "51100",
"country": "France",
"customer": {
"name": "Vins et alcools Chevalier"
},
"details": [
{
"quantity": 12,
"unitPrice": 14,
"product": {
"name": "Queso Cabrales",
"category": {
"name": "Dairy Products"
}
}
},
{
"quantity": 10,
"unitPrice": 9.8,
"product": {
"name": "Singaporean Hokkien Fried Mee",
"category": {
"name": "Grains/Cereals"
}
}
},
{
"quantity": 5,
"unitPrice": 34.8,
"product": {
"name": "Mozzarella di Giovanni",
"category": {
"name": "Dairy Products"
}
}
}
]
}
]
You can access various images at flaviorita/lambdaorm-svc
You can access various labs at github.com/lambda-orm/lambdaorm-labs
FAQs
Client form lambda ORM service
The npm package lambdaorm-client-node receives a total of 10 weekly downloads. As such, lambdaorm-client-node popularity was classified as not popular.
We found that lambdaorm-client-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.
Security News
Research
An advanced npm supply chain attack is leveraging Ethereum smart contracts for decentralized, persistent malware control, evading traditional defenses.
Security News
Research
Attackers are impersonating Sindre Sorhus on npm with a fake 'chalk-node' package containing a malicious backdoor to compromise developers' projects.