Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgraded package versions of most packages to latest TS 3 support #112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
9,865 changes: 5,913 additions & 3,952 deletions package-lock.json

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@
"cheerio": "^1.0.0-rc.2",
"incident": "^3.1.1",
"js-sha256": "^0.9.0",
"kryo": "^0.6.1",
"kryo": "^0.7.0",
"lodash": "^4.17.5",
"request": "^2.83.0",
"tough-cookie": "^2.3.3"
},
"devDependencies": {
"@types/chai": "^4.1.2",
"@types/chai": "^4.1.7",
"@types/minimist": "^1.2.0",
"@types/mocha": "^2.2.48",
"@types/node": "^9.4.6",
"chai": "^4.1.2",
"@types/mocha": "^5.2.5",
"@types/node": "^10.12.10",
"chai": "^4.2.0",
"del": "^3.0.0",
"fs-extra": "^5.0.0",
"glob": "^7.1.2",
"fs-extra": "^7.0.1",
"glob": "^7.1.3",
"gulp": "^4.0.0",
"gulp-cli": "^2.0.1",
"minimist": "^1.2.0",
"mocha": "^5.0.1",
"mocha": "^5.2.0",
"pre-commit": "^1.2.2",
"ts-node": "^4.1.0",
"tslint": "^5.9.1",
"turbo-gulp": "^0.16.2",
"typescript": "2.7.0-rc"
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"turbo-gulp": "^0.17.1",
"typescript": "^3.1.0"
},
"nyc": {
"include": [
Expand Down
2 changes: 1 addition & 1 deletion src/lib/api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import events from "events";
import * as events from "events";
import { acceptContactRequest } from "./api/accept-contact-request";
import { addMemberToConversation } from "./api/add-member";
import { createConversation } from "./api/create-conversation";
Expand Down
8 changes: 7 additions & 1 deletion src/lib/api/get-self-profile.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Incident } from "incident";
import { JsonReader } from "kryo/readers/json";
import toughCookie from "tough-cookie";
import * as apiUri from "../api-uri";
import { UnexpectedHttpStatusError } from "../errors/http";
Expand Down Expand Up @@ -30,9 +31,14 @@ export async function getSelfProfile(
} catch (err) {
throw new Incident(err, "UnexpectedResponseBody", {body: response.body});
}
const reader: JsonReader = new JsonReader();
let result: ApiProfile;
try {
result = $ApiProfile.readJson(parsed);
if ($ApiProfile.read) {
result = $ApiProfile.read(reader, response.body);
} else {
throw Error("read should always be defined");
}
} catch (err) {
throw new Incident(err, "UnexpectedResult", {body: parsed});
}
Expand Down
10 changes: 8 additions & 2 deletions src/lib/contacts/api/get-contacts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Incident } from "incident";
import { JsonReader } from "kryo/readers/json";
import { UnexpectedHttpStatusError } from "../../errors/http";
import { Context } from "../../interfaces/api/context";
import * as io from "../../interfaces/http-io";
Expand Down Expand Up @@ -28,10 +29,15 @@ export async function getContacts(httpIo: io.HttpIo, apiContext: Context): Promi
} catch (err) {
throw new Incident(err, "UnexpectedResponseBody", {body: response.body});
}

const reader: JsonReader = new JsonReader();
let result: GetUserResult;
try {
result = $GetUserResult.readJson(parsed);

if ($GetUserResult.read) {
result = $GetUserResult.read(reader, response.body);
} else {
throw Error("read should always be defined");
}
} catch (err) {
throw new Incident(err, "UnexpectedResult", {body: parsed});
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/contacts/api/get-invites.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export const $GetInvitesResult: DocumentType<GetInvitesResult> = new DocumentTyp
properties: {
inviteList: {type: new ArrayType({itemType: $Invite, maxLength: Infinity})},
},
rename: CaseStyle.SnakeCase,
changeCase: CaseStyle.SnakeCase,
});
6 changes: 3 additions & 3 deletions src/lib/contacts/api/get-user.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CaseStyle } from "kryo/case-style";
import { AnyType } from "kryo/types/any";
import { ArrayType } from "kryo/types/array";
import { DocumentType } from "kryo/types/document";
import { JsonType } from "kryo/types/json";
import { Ucs2StringType } from "kryo/types/ucs2-string";
import { $Contact, Contact } from "../../types/contact";
import { $ContactGroup, ContactGroup } from "../../types/contact-group";
Expand All @@ -27,9 +27,9 @@ export interface GetUserResult {
export const $GetUserResult: DocumentType<GetUserResult> = new DocumentType<GetUserResult>({
properties: {
contacts: {type: new ArrayType({itemType: $Contact, maxLength: Infinity})},
blocklist: {type: new ArrayType({itemType: new JsonType(), maxLength: Infinity})},
blocklist: {type: new ArrayType({itemType: new AnyType(), maxLength: Infinity})},
groups: {type: new ArrayType({itemType: $ContactGroup, maxLength: Infinity})},
scope: {type: new Ucs2StringType({maxLength: Infinity})},
},
rename: CaseStyle.SnakeCase,
changeCase: CaseStyle.SnakeCase,
});
10 changes: 7 additions & 3 deletions src/lib/contacts/contacts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Incident } from "incident";
import { JsonReader } from "kryo/readers/json";
import { UnexpectedHttpStatusError } from "../errors/http";
import { Context } from "../interfaces/api/context";
import * as io from "../interfaces/http-io";
Expand All @@ -8,7 +9,6 @@ import { Url } from "../types/url";
import { getContacts } from "./api/get-contacts";
import { $GetInvitesResult, GetInvitesResult } from "./api/get-invites";
import * as contactsUrl from "./contacts-url";

export interface ContactsInterface {
/**
* Get the pending incoming contact invitations.
Expand Down Expand Up @@ -56,10 +56,14 @@ export class ContactsService {
} catch (err) {
throw new Incident(err, "UnexpectedResponseBody", {body: response.body});
}

const reader: JsonReader = new JsonReader();
let result: GetInvitesResult;
try {
result = $GetInvitesResult.readJson(parsed);
if ($GetInvitesResult.read) {
result = $GetInvitesResult.read(reader, response.body);
} else {
throw Error("read should always be defined");
}
} catch (err) {
throw new Incident(err, "UnexpectedResult", {body: parsed});
}
Expand Down
10 changes: 5 additions & 5 deletions src/lib/types/agent-info.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CaseStyle } from "kryo/case-style";
import { AnyType } from "kryo/types/any";
import { ArrayType } from "kryo/types/array";
import { DocumentType } from "kryo/types/document";
import { JsonType } from "kryo/types/json";
import { Ucs2StringType } from "kryo/types/ucs2-string";

/**
Expand Down Expand Up @@ -33,10 +33,10 @@ export interface AgentInfo {

export const $AgentInfo: DocumentType<AgentInfo> = new DocumentType<AgentInfo>({
properties: {
capabilities: {type: new ArrayType({itemType: new JsonType(), maxLength: Infinity}), optional: true},
trusted: {type: new JsonType()},
capabilities: {type: new ArrayType({itemType: new AnyType(), maxLength: Infinity}), optional: true},
trusted: {type: new AnyType()},
type: {type: new Ucs2StringType({maxLength: Infinity})},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
10 changes: 5 additions & 5 deletions src/lib/types/agent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CaseStyle } from "kryo/case-style";
import { AnyType } from "kryo/types/any";
import { ArrayType } from "kryo/types/array";
import { DocumentType } from "kryo/types/document";
import { JsonType } from "kryo/types/json";
import { Ucs2StringType } from "kryo/types/ucs2-string";
import { $AgentInfo, AgentInfo } from "./agent-info";

Expand Down Expand Up @@ -51,12 +51,12 @@ export interface Agent {

export const $Agent: DocumentType<Agent> = new DocumentType<Agent>({
properties: {
capabilities: {type: new ArrayType({itemType: new JsonType(), maxLength: Infinity}), optional: true},
capabilities: {type: new ArrayType({itemType: new AnyType(), maxLength: Infinity}), optional: true},
type: {type: new Ucs2StringType({maxLength: Infinity})},
trust: {type: new Ucs2StringType({maxLength: Infinity})},
info: {type: $AgentInfo},
stageInfo: {type: new JsonType(), optional: true},
stageInfo: {type: new AnyType(), optional: true},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
43 changes: 22 additions & 21 deletions src/lib/types/api-profile.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { VersionedType } from "kryo/types";
import { AnyType } from "kryo/types/any";
import { ArrayType } from "kryo/types/array";
import { DocumentType } from "kryo/types/document";
import { JsonType } from "kryo/types/json";
import { NullType } from "kryo/types/null";
import { TryUnionType } from "kryo/types/try-union";
import { Ucs2StringType } from "kryo/types/ucs2-string";
import { $Url, Url } from "./url";
/* Codln't figure out how to por this code, mainly how to make TryUnionType work with NullType

import { VersionedType } from "kryo/core";
function nullable(type: VersionedType<any, any, any, any>): VersionedType<any, any, any, any> {
return new TryUnionType({
variants: [
Expand All @@ -15,7 +16,7 @@ function nullable(type: VersionedType<any, any, any, any>): VersionedType<any, a
],
});
}

*/
/**
* Represents a profile returned by the general API (api.skype.com)
*
Expand Down Expand Up @@ -91,31 +92,31 @@ export interface ApiProfile {
phoneOffice: any | null;
mood: any | null;
richMood: any | null;
avatarUrl: Url;
avatarUrl: any | null;
username: string;
}

export const $ApiProfile: DocumentType<ApiProfile> = new DocumentType<ApiProfile>({
properties: {
firstname: {type: new Ucs2StringType({maxLength: Infinity})},
lastname: {type: nullable(new Ucs2StringType({maxLength: Infinity}))},
birthday: {type: new JsonType()},
gender: {type: new JsonType()},
language: {type: new JsonType()},
country: {type: new JsonType()},
province: {type: new JsonType()},
city: {type: new JsonType()},
homepage: {type: new JsonType()},
about: {type: new JsonType()},
lastname: {type: new Ucs2StringType({maxLength: Infinity})},
birthday: {type: new AnyType()},
gender: {type: new AnyType()},
language: {type: new AnyType()},
country: {type: new AnyType()},
province: {type: new AnyType()},
city: {type: new AnyType()},
homepage: {type: new AnyType()},
about: {type: new AnyType()},
emails: {type: new ArrayType({itemType: new Ucs2StringType({maxLength: Infinity}), maxLength: Infinity})},
jobtitle: {type: new JsonType()},
phoneMobile: {type: new JsonType()},
phoneHome: {type: new JsonType()},
phoneOffice: {type: new JsonType()},
mood: {type: new JsonType()},
richMood: {type: new JsonType()},
avatarUrl: {type: nullable($Url)},
jobtitle: {type: new AnyType()},
phoneMobile: {type: new AnyType()},
phoneHome: {type: new AnyType()},
phoneOffice: {type: new AnyType()},
mood: {type: new AnyType()},
richMood: {type: new AnyType()},
avatarUrl: {type: new AnyType()},
username: {type: new Ucs2StringType({maxLength: Infinity})},
},
ignoreExtraKeys: true,
noExtraKeys: true,
});
4 changes: 2 additions & 2 deletions src/lib/types/contact-group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ export const $ContactGroup: DocumentType<ContactGroup> = new DocumentType<Contac
name: {type: new Ucs2StringType({maxLength: Infinity})},
isFavorite: {type: new BooleanType(), optional: true},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
4 changes: 2 additions & 2 deletions src/lib/types/contact-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@ export const $ContactProfile: DocumentType<ContactProfile> = new DocumentType<Co
website: {type: new Ucs2StringType({maxLength: Infinity}), optional: true},
language: {type: new Ucs2StringType({maxLength: Infinity}), optional: true},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
8 changes: 4 additions & 4 deletions src/lib/types/contact.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { CaseStyle } from "kryo/case-style";
import { AnyType } from "kryo/types/any";
import { ArrayType } from "kryo/types/array";
import { BooleanType } from "kryo/types/boolean";
import { DateType } from "kryo/types/date";
import { DocumentType } from "kryo/types/document";
import { JsonType } from "kryo/types/json";
import { Ucs2StringType } from "kryo/types/ucs2-string";
import { $Agent, Agent } from "./agent";
import { $ContactProfile, ContactProfile } from "./contact-profile";
Expand Down Expand Up @@ -67,8 +67,8 @@ export const $Contact: DocumentType<Contact> = new DocumentType<Contact>({
creationTime: {type: new DateType()},
relationshipHistory: {type: $RelationshipHistory, optional: true},
suggested: {type: new BooleanType(), optional: true},
phoneHashes: {type: new ArrayType({itemType: new JsonType(), maxLength: Infinity}), optional: true},
phoneHashes: {type: new ArrayType({itemType: new AnyType(), maxLength: Infinity}), optional: true},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
6 changes: 3 additions & 3 deletions src/lib/types/display-name-source.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CaseStyle } from "kryo/case-style";
import { SimpleEnumType } from "kryo/types/simple-enum";
import { TsEnumType } from "kryo/types/ts-enum";

export enum DisplayNameSource {
Identifier,
Expand All @@ -10,7 +10,7 @@ export enum DisplayNameSource {
UserEdits,
}

export const $DisplayNameSource: SimpleEnumType<DisplayNameSource> = new SimpleEnumType<DisplayNameSource>({
export const $DisplayNameSource: TsEnumType<DisplayNameSource> = new TsEnumType<DisplayNameSource>({
enum: DisplayNameSource,
rename: CaseStyle.SnakeCase,
changeCase: CaseStyle.SnakeCase,
});
2 changes: 1 addition & 1 deletion src/lib/types/invite-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ export const $InviteMessage: DocumentType<InviteMessage> = new DocumentType<Invi
message: {type: new Ucs2StringType({maxLength: Infinity})},
time: {type: new DateType()},
},
ignoreExtraKeys: true,
noExtraKeys: true,
});
4 changes: 2 additions & 2 deletions src/lib/types/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ export const $Invite: DocumentType<Invite> = new DocumentType<Invite>({
avatarUrl: {type: $Url},
invites: {type: new ArrayType({itemType: $InviteMessage, maxLength: Infinity})},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
4 changes: 2 additions & 2 deletions src/lib/types/location.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ export const $Location: DocumentType<Location> = new DocumentType<Location>({
city: {type: new Ucs2StringType({maxLength: Infinity}), optional: true},
state: {type: new Ucs2StringType({maxLength: Infinity}), optional: true},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
4 changes: 2 additions & 2 deletions src/lib/types/name.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ export const $Name: DocumentType<Name> = new DocumentType<Name>({
nickname: {type: new Ucs2StringType({maxLength: Infinity}), optional: true},
company: {type: new Ucs2StringType({maxLength: Infinity}), optional: true},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
4 changes: 2 additions & 2 deletions src/lib/types/phone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ export const $Phone: DocumentType<Phone> = new DocumentType<Phone>({
type: {type: new Ucs2StringType({maxLength: Infinity})},
number: {type: new Ucs2StringType({maxLength: Infinity})},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});
8 changes: 4 additions & 4 deletions src/lib/types/relationship-history.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { CaseStyle } from "kryo/case-style";
import { AnyType } from "kryo/types/any";
import { ArrayType } from "kryo/types/array";
import { DocumentType } from "kryo/types/document";
import { JsonType } from "kryo/types/json";

export interface RelationshipHistory {
/**
Expand Down Expand Up @@ -37,8 +37,8 @@ export interface RelationshipHistory {

export const $RelationshipHistory: DocumentType<RelationshipHistory> = new DocumentType<RelationshipHistory>({
properties: {
sources: {type: new ArrayType({itemType: new JsonType(), maxLength: Infinity})},
sources: {type: new ArrayType({itemType: new AnyType(), maxLength: Infinity})},
},
rename: CaseStyle.SnakeCase,
ignoreExtraKeys: true,
changeCase: CaseStyle.SnakeCase,
noExtraKeys: true,
});