-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
db-tabulator: support readonly API access from JS preprocessing
- Loading branch information
1 parent
af0e5f6
commit bacd913
Showing
2 changed files
with
53 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* eslint-disable no-unused-vars */ | ||
/* global __mwApiGet, __dbQueryResult, preprocess */ | ||
(async function() { | ||
"${JS_CODE}"; | ||
|
||
async function mwApiGet(params) { | ||
const response = await __mwApiGet.applySyncPromise(undefined, [JSON.stringify(params)]); | ||
return JSON.parse(response); | ||
} | ||
|
||
return JSON.stringify(await preprocess(JSON.parse(__dbQueryResult))); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters