这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion types/xmpp__base64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"name": "@types/xmpp__base64",
"version": "0.13.9999",
"version": "0.14.9999",
"type": "module",
"projects": [
"https://github.com/xmppjs/xmpp.js/tree/main/packages/base64"
],
Expand Down
1 change: 1 addition & 0 deletions types/xmpp__base64/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": [
"es6"
],
Expand Down
6 changes: 3 additions & 3 deletions types/xmpp__client-core/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import ClientCls = require("./lib/Client");
import xmppXml = require("@xmpp/xml");
import xmppJid = require("@xmpp/jid");
import xmppJid from "@xmpp/jid";
import xmppXml from "@xmpp/xml";
import ClientCls from "./lib/Client.js";

export const Client: typeof ClientCls;
export type Client = ClientCls;
Expand Down
4 changes: 2 additions & 2 deletions types/xmpp__client-core/lib/Client.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Connection = require("@xmpp/connection");
import Connection from "@xmpp/connection";
import { Element } from "@xmpp/xml";

export = Client;
export default Client;

declare class Client extends Connection {
transports: Array<typeof Connection>;
Expand Down
4 changes: 3 additions & 1 deletion types/xmpp__client-core/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"private": true,
"name": "@types/xmpp__client-core",
"version": "0.13.9999",
"version": "0.14.9999",
"type": "module",
"projects": [
"https://github.com/xmppjs/xmpp.js/tree/main/packages/client-core"
],
"dependencies": {
"@types/xmpp__connection": "*",
"@types/xmpp__jid": "*",
"@types/xmpp__sasl2": "*",
"@types/xmpp__xml": "*"
},
"devDependencies": {
Expand Down
15 changes: 15 additions & 0 deletions types/xmpp__client-core/src/bind2/bind2.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Entity } from "@xmpp/connection";
import { SASL2 } from "@xmpp/sasl2";
import { Element } from "@xmpp/xml";

export default function bind2(
params: {
sasl2: SASL2;
entity: Entity;
},
tag: string | (() => Promise<string>),
): Bind2;

export interface Bind2 {
use(ns: string, req: (element: Element) => Element, res: (element: Element) => Promise<void>): void;
}
28 changes: 28 additions & 0 deletions types/xmpp__client-core/src/fast/fast.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { EventEmitter } from "@xmpp/events";
import { SASL2 } from "@xmpp/sasl2";
import SASLFactory from "saslmechanisms";

import { Client } from "../..";

export interface Token {
mechanism: string;
token: string;
expiry: string;
}

export interface FAST extends EventEmitter {
mechanism: null | string;
mechanisms: string[];

saveToken(t: Token): Promise<void>;
fetchToken(): Promise<Token | undefined>;
deleteToken(): Promise<void>;

save(t: Token): Promise<void>;
fetch(): Promise<Token | undefined>;
delete(): Promise<void>;

saslFactory: SASLFactory;
}

export default function fast(options: { sasl2: SASL2; entity: Client }): FAST;
1 change: 1 addition & 0 deletions types/xmpp__client-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": [
"es6"
],
Expand Down
2 changes: 1 addition & 1 deletion types/xmpp__client-core/xmpp__client-core-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Client, jid, xml } from "@xmpp/client-core";
import Connection = require("@xmpp/connection");
import Connection from "@xmpp/connection";
import { Element } from "@xmpp/xml";

// test type exports
Expand Down
1 change: 0 additions & 1 deletion types/xmpp__client/browser.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion types/xmpp__client/dist/xmpp.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export * from "../browser";
export * from "..";

export as namespace XMPP;
4 changes: 4 additions & 0 deletions types/xmpp__client/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Client as ClientCore, jid as xmppJid, xml as xmppXml } from "@xmpp/client-core";
import { Bind2 } from "@xmpp/client-core/src/bind2/bind2.js";
import { FAST } from "@xmpp/client-core/src/fast/fast.js";
import { Options as ConnectionOptions } from "@xmpp/connection";
import { IQCallee } from "@xmpp/iq/callee";
import { IQCaller } from "@xmpp/iq/caller";
Expand Down Expand Up @@ -88,6 +90,8 @@ export interface Client extends ClientCore {
sasl: SASL;
streamManagement: StreamManagement;
mechanisms: Array<{ scramsha1: undefined } | { plain: undefined } | { anonymous: undefined }>;
bind2: Bind2;
fast: FAST;
}

export const jid: typeof xmppJid;
Expand Down
2 changes: 1 addition & 1 deletion types/xmpp__client/lib/getDomain.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export = getDomain;
export default getDomain;

declare function getDomain(service: string): string;
3 changes: 2 additions & 1 deletion types/xmpp__client/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"name": "@types/xmpp__client",
"version": "0.13.9999",
"version": "0.14.9999",
"type": "module",
"projects": [
"https://github.com/xmppjs/xmpp.js/tree/main/packages/client"
],
Expand Down
9 changes: 0 additions & 9 deletions types/xmpp__client/react-native.d.ts

This file was deleted.

2 changes: 1 addition & 1 deletion types/xmpp__client/test/xmpp__client-bundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ c.iqCallee; // $ExpectType IQCallee<Client>
c.starttls; // $ExpectType Middleware<IncomingContext<Client>>
c.sasl; // $ExpectType SASL
c.streamManagement; // $ExpectType StreamManagement
c.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; })[]
c.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; } | { scramsha1: undefined })[]

XMPP.jid("foo");
XMPP.jid(null, "foo", "bar");
Expand Down
28 changes: 5 additions & 23 deletions types/xmpp__client/test/xmpp__client.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
import { Client, client, jid, Options, xml } from "@xmpp/client";
import * as browser from "@xmpp/client/browser";
import * as browserBundle from "@xmpp/client/dist/xmpp";
import * as browserBundleMin from "@xmpp/client/dist/xmpp.min";
import * as rn from "@xmpp/client/react-native";
import getDomain = require("@xmpp/client/lib/getDomain");
import { Client as ClientCore } from "@xmpp/client-core";
import * as browserBundle from "@xmpp/client/dist/xmpp.js";
import * as browserBundleMin from "@xmpp/client/dist/xmpp.min.js";
import getDomain from "@xmpp/client/lib/getDomain.js";
import { Element } from "@xmpp/xml";

// test type exports
type Opts = Options;
type Cl = Client;
type Opts2 = rn.Options;
type Cl2 = rn.Client;
type Opts3 = browser.Options;
type Cl3 = browser.Client;
type Opts4 = browserBundle.Options;
type Cl4 = browserBundle.Client;
type Opts5 = browserBundleMin.Options;
Expand All @@ -32,8 +26,6 @@ client({ domain: "foo" }); // $ExpectType Client
client({ service: "foo.bar" }); // $ExpectType Client
client({ lang: "en" }); // $ExpectType Client

const rnC = rn.client(); // $ExpectType Client
const browserC = browser.client(); // $ExpectType Client
const browserBundleC = browserBundle.client(); // $ExpectType Client
const browserBundleMinC = browserBundleMin.client(); // $ExpectType Client

Expand All @@ -49,30 +41,20 @@ c.sasl; // $ExpectType SASL
c.streamManagement; // $ExpectType StreamManagement
c.mechanisms; // $ExpectType ({ scramsha1: undefined; } | { plain: undefined; } | { anonymous: undefined; })[]

rnC.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; })[]
browserC.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; })[]
browserBundleC.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; })[]
browserBundleMinC.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; })[]
browserBundleC.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; } | { scramsha1: undefined })[]
browserBundleMinC.mechanisms; // $ExpectType ({ plain: undefined; } | { anonymous: undefined; } | { scramsha1: undefined })[]

getDomain("foo.bar"); // $ExpectType string

jid("foo");
jid(null, "foo", "bar");
rn.jid("foo");
rn.jid(null, "foo", "bar");
browser.jid("foo");
browser.jid(null, "foo", "bar");
browserBundle.jid("foo");
browserBundle.jid(null, "foo", "bar");
browserBundleMin.jid("foo");
browserBundleMin.jid(null, "foo", "bar");

xml("foo");
xml("foo", { foo: "bar" }, "bar");
rn.xml("foo");
rn.xml("foo", { foo: "bar" }, "bar");
browser.xml("foo");
browser.xml("foo", { foo: "bar" }, "bar");
browserBundle.xml("foo");
browserBundle.xml("foo", { foo: "bar" }, "bar");
browserBundleMin.xml("foo");
Expand Down
1 change: 1 addition & 0 deletions types/xmpp__client/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [
"es6"
],
Expand Down
9 changes: 5 additions & 4 deletions types/xmpp__component-core/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import ComponentCls = require("./lib/Component");
import xmppXml = require("@xmpp/xml");
import xmppJid = require("@xmpp/jid");
import xmppJid from "@xmpp/jid";
import xmppXml from "@xmpp/xml";
import ComponentCls from "./lib/Component.js";

export { SocketParameters } from "./lib/Component.js";

export const Component: typeof ComponentCls;
export type Component = ComponentCls;
export type SocketParameters = ComponentCls.SocketParameters;
export const xml: typeof xmppXml;
export const jid: typeof xmppJid;
12 changes: 5 additions & 7 deletions types/xmpp__component-core/lib/Component.d.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import ConnectionTCP = require("@xmpp/connection-tcp");
import ConnectionTCP, { SocketParameters as ConnectionTCPSocketParameters } from "@xmpp/connection-tcp";

export = Component;
export default Component;

declare class Component extends ConnectionTCP {
static readonly NS: "jabber:component:accept";

socketParameters(service: string): Component.SocketParameters;
socketParameters(service: string): SocketParameters;
authenticate(id: string, password: string): Promise<void>;
}

declare namespace Component {
interface SocketParameters extends ConnectionTCP.SocketParameters {
port: number;
}
export interface SocketParameters extends ConnectionTCPSocketParameters {
port: number;
}
3 changes: 2 additions & 1 deletion types/xmpp__component-core/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"name": "@types/xmpp__component-core",
"version": "0.13.9999",
"version": "0.14.9999",
"type": "module",
"projects": [
"https://github.com/xmppjs/xmpp.js/tree/main/packages/component-core"
],
Expand Down
1 change: 1 addition & 0 deletions types/xmpp__component-core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": [
"es6"
],
Expand Down
2 changes: 1 addition & 1 deletion types/xmpp__component-core/xmpp__component-core-tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, jid, SocketParameters, xml } from "@xmpp/component-core";
import ConnectionTCP = require("@xmpp/connection-tcp");
import ConnectionTCP from "@xmpp/connection-tcp";

// test type exports
type Comp = Component;
Expand Down
4 changes: 2 additions & 2 deletions types/xmpp__component/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component as ComponentCore, jid as xmppJid, xml as xmppXml } from "@xmpp/component-core";
import { IQCallee } from "@xmpp/iq/callee";
import { IQCaller } from "@xmpp/iq/caller";
import { IQCallee } from "@xmpp/iq/callee.js";
import { IQCaller } from "@xmpp/iq/caller.js";
import { Middleware } from "@xmpp/middleware";
import { Reconnect } from "@xmpp/reconnect";

Expand Down
3 changes: 2 additions & 1 deletion types/xmpp__component/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"name": "@types/xmpp__component",
"version": "0.13.9999",
"version": "0.14.9999",
"type": "module",
"projects": [
"https://github.com/xmppjs/xmpp.js/tree/main/packages/component"
],
Expand Down
1 change: 1 addition & 0 deletions types/xmpp__component/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": [
"es6"
],
Expand Down
7 changes: 7 additions & 0 deletions types/xmpp__connection-tcp/Socket.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Socket as TCPSocket } from "node:net";

export default Socket;

declare class Socket extends TCPSocket {
secure: boolean;
}
24 changes: 11 additions & 13 deletions types/xmpp__connection-tcp/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import Connection = require("@xmpp/connection");
import Connection, { SocketConstructor as ConnectionSocketConstructor } from "@xmpp/connection";
import { Element } from "@xmpp/xml";
import { Socket } from "net";
import { URL } from "url";
import Socket from "./Socket.js";

export = ConnectionTCP;
export default ConnectionTCP;

declare class ConnectionTCP extends Connection {
sendMany(elements: Iterable<Element>): Promise<void>;
socketParameters(service: string | URL): ConnectionTCP.SocketParameters | undefined;
socketParameters(service: string | URL): SocketParameters | undefined;
headerElement(): Element;

Socket: ConnectionTCP.SocketConstructor;
Socket: SocketConstructor;
}

declare namespace ConnectionTCP {
interface SocketParameters {
port: number | null;
host: string;
}
export interface SocketParameters {
port: number | null;
host: string;
}

interface SocketConstructor extends Connection.SocketConstructor {
new(): Socket;
}
export interface SocketConstructor extends ConnectionSocketConstructor {
new(): Socket;
}
3 changes: 2 additions & 1 deletion types/xmpp__connection-tcp/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"private": true,
"name": "@types/xmpp__connection-tcp",
"version": "0.13.9999",
"version": "0.14.9999",
"type": "module",
"projects": [
"https://github.com/xmppjs/xmpp.js/tree/main/packages/connection-tcp"
],
Expand Down
1 change: 1 addition & 0 deletions types/xmpp__connection-tcp/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"compilerOptions": {
"module": "node16",
"target": "es6",
"lib": [
"es6"
],
Expand Down
Loading