https://github.com/pacexy/pire
Pipe Request - make your request like a pipeline.
https://github.com/pacexy/pire
Last synced: over 1 year ago
JSON representation
Pipe Request - make your request like a pipeline.
- Host: GitHub
- URL: https://github.com/pacexy/pire
- Owner: pacexy
- License: mit
- Created: 2020-10-17T16:55:13.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2020-10-22T13:43:18.000Z (over 5 years ago)
- Last Synced: 2025-02-18T02:12:25.985Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pire
**Pi**pe **Re**quest - make your request like a pipeline.
## Example
> You can write the template string in `pir` file.
If you don't want a input, use `void`.
```typescript
import { parsep } from 'pire'
const pir = parsep(`
void -> riot.league {
summonerName
leaguePoints
rank
wins
losses
} -> summonerId
summonerId -> riot.summoner {
profileIconId
summonerLevel
extra {
matchIds
}
} -> extra.playerId
ID -> leaguepedia.player {
ID
Team
Role
}
`)
```
It will be parsed as:
```
[
{
collectionPath: [ 'riot', 'league' ],
projection: { summonerName: 1, leaguePoints: 1, rank: 1, wins: 1, losses: 1 },
outputFieldPath: [ 'summonerId' ]
},
{
inputFieldPath: [ 'summonerId' ],
collectionPath: [ 'riot', 'summoner' ],
projection: { profileIconId: 1, summonerLevel: 1, extra: { matchIds: 1 } },
outputFieldPath: [ 'extra', 'playerId' ]
},
{
inputFieldPath: [ 'ID' ],
collectionPath: [ 'leaguepedia', 'player' ],
projection: { ID: 1, Team: 1, Role: 1 }
}
]
```