
Security News
GitHub Actions Pricing Whiplash: Self-Hosted Actions Billing Change Postponed
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.
npm install linkfetch
{
"$ref": "lazy end point"
}
ex)
{
"name": "my name is linkfetch",
"address": {
"$ref": "https://localhost/user/1/address"
}
}
export type User = {
name: string;
id: string;
address: {
detail: {
first: string;
last: string;
};
zip: string;
}
}
import { User } from './types/User';
import { Fetcher, FetchObjectOrDocType, FetchRequest, linkfetch } from 'linkfetch';
type Req = {
id: string;
queryId: string;
}
const doc: FetchObjectOrDocType<User> = {
$ref: 'http://localhost:3000/users/1',
};
const defaultRequest: FetchRequest<User, Req> = {
$request: {id: '1', queryId: 'q1'},
address: {
$request: {id: '2', queryId: 'q2'},
detail: {
$request: {id: '3', queryId: 'q3'}
}
}
}
const fetcher: Fetcher<Req> = async (doc, config) => {
if (doc) {
const url = new URL(doc.$ref);
url.searchParams.set('queryId', config?.req?.queryId ?? 'none');
const responsePromise = fetch(url, {method: 'GET'});
return responsePromise.then(it => it.json());
} else {
return Promise.resolve(config?.value);
}
}
(async () => {
console.log('lazy fetch------------------');
const root = await linkfetch<User, Req>({data: doc, defaultRequest: defaultRequest}, fetcher, {linkfetchConfig: {cached: true}});
const address = await root.address();
const detail = await root.$$fetch({key: 'address.detail', req: {id: '1', queryId: 'zzzzz'}});
console.log('address', address);
console.log('detail', detail);
console.log('JSON stringify:', JSON.stringify(await root.$$snapshot({allFetch: true})));
console.log('request all fetch------------------');
const requestData = await fetch('http://localhost:3000/users', {method: 'post', headers: {'Accept': 'application/json, text/plain, */*', 'Content-Type': 'application/json'}, body: JSON.stringify(defaultRequest)}).then(it => it.json())
console.log('requestData', requestData);
const request = await linkfetch<User, Req>({data: requestData, defaultRequest: defaultRequest}, fetcher, {linkfetchConfig: {cached: true}});
console.log('JSON stringify:', JSON.stringify(await request.$$snapshot({allFetch: true})));
})();
import express, { Express } from 'express';
import cors from 'cors';
import { FetchProducerDoc, producer, FlatObjectKey } from 'linkfetch';
import { User } from './types/User';
const corsOptions = {
origin: '*',
credentials: true,
optionSuccessStatus: 200,
}
type Reg = { id: string, queryId?: string};
const doc: FetchProducerDoc<User, Reg> = {
$fetch: async (req) => {
return {
name: 'linkfetch',
id: req.id + `(queryId:${req.queryId})`,
address: {
$ref: `http://localhost:3000/users/${req.id}/address`
}
}
},
address: {
$fetch: async (req) => {
return {
zip: '6484' + `(queryId:${req.queryId})`,
detail: {
// first: 'first',
// last: 'last',
$ref: `http://localhost:3000/users/${req.id}/address/detail`
}
}
},
detail: {
$fetch: async (req) => {
return {
first: `first-88 ${req.id}` + `(queryId:${req.queryId})`,
last: `last-64-${req.id}` + `(queryId:${req.queryId})`
}
}
}
}
}
const root = producer(doc);
const app: Express = express();
app.use(cors(corsOptions)) // Use this after the variable declaration
app.use(express.json());
app.get('/', (req, res) => {
res.send('Hello World! linkfetch server');
});
app.post('/users', async (req, res) => {
const data = await root.$$request(req.body);
console.log('user--!! server, body post');
res.json(data);
});
app.get('/users/:id', async (req, res) => {
console.log('request path', req.path, req.params.id);
const data = await root.$$fetch({req: {id: req.params.id, queryId: req.query.queryId as string}});
res.json(data);
});
app.get('/users/:id/*', async (req, res) => {
const paths = req.path.split('/').splice(3).join('.') as keyof FlatObjectKey<User>;
console.log('request path', paths, req.params.id);
const data = await root.$$fetch({key: paths , req: {id: req.params.id, queryId: req.query.queryId as string}})
res.json(data);
});
app.listen(3000, () => {
console.log('Server started at port 3000');
});
FAQs
object field variable fetch system, Supports Lazy fetch with field access.
We found that linkfetch demonstrated a not healthy version release cadence and project activity because the last version was released 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
GitHub postponed a new billing model for self-hosted Actions after developer pushback, but moved forward with hosted runner price cuts on January 1.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.