Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

types-mediawiki

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

types-mediawiki - npm Package Compare versions

Comparing version 0.4.0 to 0.5.0

api_params/index.d.ts

68

mw/Api.d.ts

@@ -0,2 +1,12 @@

import {
ApiEditPageParams,
ApiParseParams,
ApiQueryAllMessagesParams,
ApiRollbackParams,
ApiUploadParams
} from "../api_params";
type title = string | mw.Title
type ApiParams = Record<string, string | string[] | boolean | number | number[]>
type ApiResponse = Record<string, any> // it will always be a JSON object, the rest is uncertain ...

@@ -9,3 +19,3 @@ interface ApiOptions {

interface ForeignApiOptions extends ApiOptions {
anonymous: boolean
anonymous?: boolean
}

@@ -20,25 +30,26 @@

get(parameters: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any>
get(parameters: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse>
post(parameters: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any>
post(parameters: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse>
preprocessParameters(parameters: any, useUS: boolean): void
preprocessParameters(parameters: ApiParams, useUS: boolean): void
// index.js
ajax(parameters: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any>
ajax(parameters: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse>
postWithToken(tokenType: string, params: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any>
postWithToken(tokenType: string, params: ApiParams, ajaxOptions?: JQuery.AjaxSettings)
: JQuery.Promise<ApiResponse>
getToken(type: string, additionalParams?: any): JQuery.Promise<string>
getToken(type: string, additionalParams?: ApiParams): JQuery.Promise<string>
badToken(type: string): void
getErrorMessage(data: any): JQuery
getErrorMessage(data: ApiResponse): JQuery
// edit.js
postWithEditToken(params: any, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<any>
postWithEditToken(params: ApiParams, ajaxOptions?: JQuery.AjaxSettings): JQuery.Promise<ApiResponse>
getEditToken(): JQuery.Promise<string>
create(title: title, params: any, content: string): JQuery.Promise<any>
create(title: title, params: ApiEditPageParams, content: string): JQuery.Promise<ApiResponse>

@@ -48,5 +59,6 @@ edit(title: title, transform: (data: {

content: string
}) => any): JQuery.Promise<any>
}) => string | ApiEditPageParams): JQuery.Promise<any>
newSection(title: title, header: string, message: string, additionalParams?: any): JQuery.Promise<any>
newSection(title: title, header: string, message: string, additionalParams?: ApiEditPageParams)
: JQuery.Promise<ApiResponse>

@@ -59,3 +71,3 @@ // user.js

assertCurrentUser(query: any): JQuery.Promise<{
assertCurrentUser(query: ApiParams): JQuery.Promise<{
assert: 'anon' | 'user'

@@ -66,5 +78,5 @@ assertUser: string

// options.js
saveOption(name: string, value: string): JQuery.Promise<any>
saveOption(name: string, value: string): JQuery.Promise<ApiResponse>
saveOptions(options: { [optionName: string]: string }): JQuery.Promise<any>
saveOptions(options: { [optionName: string]: string }): JQuery.Promise<ApiResponse>

@@ -81,10 +93,10 @@ // watch.js

// parse.js
parse(content: string | mw.Title, additionalParams?: any): JQuery.Promise<any>
parse(content: string | mw.Title, additionalParams?: ApiParseParams): JQuery.Promise<ApiResponse>
// messages.js
getMessages(messages: string[], options?: any): JQuery.Promise<any>
getMessages(messages: string[], options?: ApiQueryAllMessagesParams): JQuery.Promise<ApiResponse>
loadMessages(messages: string[], options?: any): JQuery.Promise<any>
loadMessages(messages: string[], options?: ApiQueryAllMessagesParams): JQuery.Promise<ApiResponse>
loadMessagesIfMissing(messages: string[], options?: any): JQuery.Promise<any>
loadMessagesIfMissing(messages: string[], options?: ApiQueryAllMessagesParams): JQuery.Promise<ApiResponse>

@@ -99,20 +111,22 @@ // category.js

// rollback.js
rollback(page: title, user: string, params?: any): JQuery.Promise<any>
rollback(page: title, user: string, params?: ApiRollbackParams): JQuery.Promise<any>
// upload.js
chunkedUpload(file: File, data: any, chunkSize?: number, chunkRetries?: number): JQuery.Promise<any>
chunkedUpload(file: File, data: ApiUploadParams, chunkSize?: number, chunkRetries?: number)
: JQuery.Promise<ApiResponse>
chunkedUploadToStash(file: File, data?: any, chunkSize?: number, chunkRetries?: number): JQuery.Promise<any>
chunkedUploadToStash(file: File, data?: ApiUploadParams, chunkSize?: number, chunkRetries?: number)
: JQuery.Promise<ApiResponse>
upload(file: File | Blob | HTMLInputElement, data: any): JQuery.Promise<any>
upload(file: File | Blob | HTMLInputElement, data: ApiUploadParams): JQuery.Promise<ApiResponse>
uploadFromStash(filekey: string, data: any): JQuery.Promise<any>
uploadFromStash(filekey: string, data: ApiUploadParams): JQuery.Promise<ApiResponse>
uploadToStash(file: File | HTMLInputElement, data?: any): JQuery.Promise<any>
uploadToStash(file: File | HTMLInputElement, data?: ApiUploadParams): JQuery.Promise<ApiResponse>
// login.js
login(username: string, password: string): JQuery.Promise<any>
login(username: string, password: string): JQuery.Promise<ApiResponse>
}
class ForeignApi extends mw.Api {
constructor(url: string | mw.Uri, options: ForeignApiOptions)
constructor(url: string | mw.Uri, options?: ForeignApiOptions)

@@ -119,0 +133,0 @@ getOrigin(): string | void

{
"name": "types-mediawiki",
"version": "0.4.0",
"version": "0.5.0",
"description": "TypeScript definitions for MediaWiki JS interface",

@@ -19,3 +19,5 @@ "types": "index.d.ts",

"dependencies": {
"@types/jquery": "^3.5.5",
"@types/jquery": "^3.5.5"
},
"devDependencies": {
"dtslint": "^4.0.6",

@@ -22,0 +24,0 @@ "typescript": "^4.1.3"

@@ -0,1 +1,3 @@

[![NPM version](https://img.shields.io/npm/v/types-mediawiki.svg)](https://www.npmjs.com/package/types-mediawiki)
![Linter](https://github.com/wikimedia-gadgets/types-mediawiki/workflows/Lint/badge.svg)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com)

@@ -18,3 +20,3 @@

Edit your project's `tsconfig.json` file so that it includes
Edit your project's `tsconfig.json` file so that `compilerOptions` includes

@@ -31,2 +33,12 @@ ```

### API parameters
This package also provides typings for API parameters for MediaWiki core APIs and the ones added by a number of extensions (the ones enabled on English Wikipedia). These aren't exported to the global scope, however. For usage, you need to import them. For example:
```ts
import type {ApiEditPageParams, ApiParseParams} from "types-mediawiki/api_params";
```
Since it is just a type import, it doesn't generate any JavaScript. Hence, such imports can also be used in non-modular applications.
----

@@ -33,0 +45,0 @@

{
"extends": "dtslint/dtslint.json",
"linterOptions": {
"exclude": [
"api_params/index.d.ts"
]
},
"rules": {
"semicolon": false,
"indent": [true, "tabs"],
"no-padding": false,
"no-unnecessary-qualifier": false,

@@ -7,0 +13,0 @@ "unified-signatures": false

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc