Skip to content

Commit

Permalink
convert ParseSession to TS
Browse files Browse the repository at this point in the history
  • Loading branch information
dplewis committed Jul 28, 2023
1 parent 7f7d4fd commit 11e1c76
Show file tree
Hide file tree
Showing 14 changed files with 2,316 additions and 308 deletions.
File renamed without changes.
6 changes: 1 addition & 5 deletions src/ParseSession.js → src/ParseSession.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @flow
*/

import CoreManager from './CoreManager';
import isRevocableSession from './isRevocableSession';
import ParseObject from './ParseObject';
Expand All @@ -22,7 +18,7 @@ class ParseSession extends ParseObject {
/**
* @param {object} attributes The initial set of data to store in the user.
*/
constructor(attributes: ?AttributeMap) {
constructor(attributes?: any) {
super('_Session');
if (attributes && typeof attributes === 'object') {
if (!this.set(attributes || {})) {
Expand Down
6 changes: 4 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
"emitDeclarationOnly": true,
"outDir": "types",
"noImplicitAny": false,
"allowJs": true
"allowJs": false
},
"include": ["src/Parse.ts"]
"files": [
"src/ParseSession.ts"
]
}
1 change: 1 addition & 0 deletions types/ObjectStateMutations.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export function defaultState(): State;
export function setServerData(serverData: AttributeMap, attributes: AttributeMap): void;
export function setPendingOp(pendingOps: Array<OpsMap>, attr: string, op: Op | null): void;
Expand Down
1 change: 1 addition & 0 deletions types/ParseGeoPoint.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export default ParseGeoPoint;
/**
* @flow
Expand Down
1 change: 1 addition & 0 deletions types/ParseObject.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
type Pointer = {
__type: string;
className: string;
Expand Down
1 change: 1 addition & 0 deletions types/ParseOp.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export function opFromJSON(json: {
[key: string]: any;
}): Op | null;
Expand Down
1 change: 1 addition & 0 deletions types/ParseQuery.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
type WhereClause = {
[attr: string]: mixed;
};
Expand Down
1 change: 1 addition & 0 deletions types/ParseRole.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
export default ParseRole;
/**
* Represents a Role on the Parse server. Roles represent groupings of
Expand Down
30 changes: 15 additions & 15 deletions types/ParseSession.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export default ParseSession;
import ParseObject from './ParseObject';
import type { FullOptions } from './RESTController';
/**
* <p>A Parse.Session object is a local representation of a revocable session.
* This class is a subclass of a Parse.Object, and retains the same
Expand All @@ -7,7 +8,17 @@ export default ParseSession;
* @alias Parse.Session
* @augments Parse.Object
*/
declare class ParseSession {
declare class ParseSession extends ParseObject {
/**
* @param {object} attributes The initial set of data to store in the user.
*/
constructor(attributes?: any);
/**
* Returns the session token string.
*
* @returns {string}
*/
getSessionToken(): string;
static readOnlyAttributes(): string[];
/**
* Retrieves the Session object for the currently logged in session.
Expand All @@ -18,7 +29,7 @@ declare class ParseSession {
* object after it has been fetched. If there is no current user, the
* promise will be rejected.
*/
static current(options: FullOptions): Promise<any>;
static current(options: FullOptions): any;
/**
* Determines whether the current session token is revocable.
* This method is useful for migrating Express.js or Node.js web apps to
Expand All @@ -30,16 +41,5 @@ declare class ParseSession {
* @returns {boolean}
*/
static isCurrentSessionRevocable(): boolean;
/**
* @param {object} attributes The initial set of data to store in the user.
*/
constructor(attributes: AttributeMap | null);
/**
* Returns the session token string.
*
* @returns {string}
*/
getSessionToken(): string;
}
import { FullOptions } from './RESTController';
import { AttributeMap } from './ObjectStateMutations';
export default ParseSession;
1 change: 1 addition & 0 deletions types/ParseUser.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @ts-nocheck
type AuthData = {
[key: string]: mixed;
};
Expand Down
2 changes: 1 addition & 1 deletion types/RESTController.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ type FullOptions = {
progress?: any;
usePost?: boolean;
};
export {};
export { RequestOptions, FullOptions };
Loading

0 comments on commit 11e1c76

Please sign in to comment.