From 575851c0071d1b5c4bcf3836d48e9ece18ea40b7 Mon Sep 17 00:00:00 2001 From: Morten Moeller Date: Mon, 29 Apr 2024 09:49:32 -0500 Subject: [PATCH 1/6] Merging local pending Ops when parent property also set in pending Ops --- src/ParseObject.js | 12 ++++- src/ParseOp.js | 50 ++++++++++++++++++++ src/__tests__/ParseObject-test.js | 78 +++++++++++++++++++++++++++++++ 3 files changed, 138 insertions(+), 2 deletions(-) diff --git a/src/ParseObject.js b/src/ParseObject.js index 826a2458e..53b0fc4e7 100644 --- a/src/ParseObject.js +++ b/src/ParseObject.js @@ -24,6 +24,8 @@ import { AddUniqueOp, RemoveOp, RelationOp, + validPendingParentOp, + applyOpToParent, } from './ParseOp'; import ParseQuery from './ParseQuery'; import ParseRelation from './ParseRelation'; @@ -771,8 +773,14 @@ class ParseObject { const last = pendingOps.length - 1; const stateController = CoreManager.getObjectStateController(); for (const attr in newOps) { - const nextOp = newOps[attr].mergeWith(pendingOps[last][attr]); - stateController.setPendingOp(this._getStateIdentifier(), attr, nextOp); + const parentAttr = validPendingParentOp(attr, pendingOps[last]); + if (parentAttr) { + const parentOp = pendingOps[last][parentAttr]; + applyOpToParent(parentAttr, parentOp, attr, newOps[attr]); + } else { + const nextOp = newOps[attr].mergeWith(pendingOps[last][attr]); + stateController.setPendingOp(this._getStateIdentifier(), attr, nextOp); + } } return this; diff --git a/src/ParseOp.js b/src/ParseOp.js index ed00441da..e4617fa73 100644 --- a/src/ParseOp.js +++ b/src/ParseOp.js @@ -54,6 +54,56 @@ export function opFromJSON(json: { [key: string]: any }): ?Op { return null; } +export function validPendingParentOp(attr, pendingOps) { + if (!pendingOps || pendingOps[attr]) { + return null; + } + + const lastDot = attr.lastIndexOf('.'); + if (lastDot === -1) { + return null; + } + + // This is an object with dot notation. So need to also match "parents" + const parentString = attr.substring(0, lastDot); + for (const pendingAttr in pendingOps) { + if (parentString.startsWith(pendingAttr)) { + return pendingAttr; + } + } +} + +export function applyOpToParent(parentAttr: string, parent: Op, attr: string, op: Op) { + const subAttr = attr.substring(parentAttr.length + 1); + + if (!(parent instanceof SetOp) || !subAttr) { + throw new TypeError(`Trying to set sub property on a invalid property (${parentAttr} -> ${subAttr})`); + } + + let object = parent._value; + const fields = subAttr.split('.'); + const last = fields[fields.length - 1]; + for (let i = 0; i < fields.length - 1; i++) { + const key = fields[i]; + if (!(key in object)) { + if (op instanceof UnsetOp) { + // property already doesn't exist, we don't have to do anytihng + return; + } + object[key] = {}; + } + object = object[key]; + } + + if (op instanceof UnsetOp) { + delete object[last]; + } else { + object[last] = op.applyTo(object[last]); + } + + return parent; +} + export class Op { // Empty parent class applyTo(value: mixed): mixed {} /* eslint-disable-line no-unused-vars */ diff --git a/src/__tests__/ParseObject-test.js b/src/__tests__/ParseObject-test.js index 06a7f3c2f..1dde3e364 100644 --- a/src/__tests__/ParseObject-test.js +++ b/src/__tests__/ParseObject-test.js @@ -544,6 +544,84 @@ describe('ParseObject', () => { expect(o2.attributes).toEqual({}); }); + it('can set sub property of a local changed object without creating an op', () => { + const o = new ParseObject('Person'); + o.set('data', { a: 2 }); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + + o.set('datab', {v: 2}); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); + + o.set('data.b', 3); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: 3}); + + o.set({"data.c" : 5, "data.d.a": 4}); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: 3, c: 5, d: { a: 4 }}); + }); + + it('can unset sub property of a local changed object without creating an op', () => { + const o = new ParseObject('Person'); + o.set('data', { a: 2, b: 4 }); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + + o.unset('data.b'); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + + o.unset('data.c'); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + + o.unset('data.c.d'); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + + o.set('data.b.c', 3); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: { c: 3 }}); + + o.unset('data.b.c'); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: {}}); + + o.unset('data.b'); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + }); + + it('can increment sub property of a local changed object without creating an op', () => { + const o = new ParseObject('Person'); + o.set('data', {a: 2, b: 4}); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + + o.increment('data.a', 3); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 5, b: 4}); + }); + + it('collapse sub-property sets with parents as well', () => { + const o = new ParseObject('Person'); + o._finishFetch({ + objectId: 'o12312', + data: { a: 3 } + }); + expect(o.dirty()).toBe(false); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(0); + + o.set('data.b', { c: 1 }); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + + o.set('data.boo', 4); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); + expect(o._getPendingOps()[0]['data.boo']._value).toStrictEqual(4); + + o.set('data.b.c', 2); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); + expect(o._getPendingOps()[0]['data.b']._value).toStrictEqual({ c: 2 }); + }); + it('can clear all fields', () => { const o = new ParseObject('Person'); o._finishFetch({ From ae457dd72b5d4c95ad3977513c2a81b0c642730b Mon Sep 17 00:00:00 2001 From: Morten Moeller Date: Mon, 29 Apr 2024 10:16:16 -0500 Subject: [PATCH 2/6] No test for exception on non-sensical parent --- src/__tests__/ParseObject-test.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/__tests__/ParseObject-test.js b/src/__tests__/ParseObject-test.js index 1dde3e364..5f43fae93 100644 --- a/src/__tests__/ParseObject-test.js +++ b/src/__tests__/ParseObject-test.js @@ -622,6 +622,20 @@ describe('ParseObject', () => { expect(o._getPendingOps()[0]['data.b']._value).toStrictEqual({ c: 2 }); }); + it('throw exception on non-sensical parent (not set)', async () => { + const o = new ParseObject('Person'); + o.increment('data', 2); + expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + + try { + o.set('data.a', 3); + expect(true).toBe(false); + } catch (e) { + expect(e.message).toBe('Trying to set sub property on a invalid property (data -> a)'); + } + + }); + it('can clear all fields', () => { const o = new ParseObject('Person'); o._finishFetch({ From 8e7161393d7927bdcaa9836f68da0981896b9051 Mon Sep 17 00:00:00 2001 From: Morten Moeller Date: Mon, 29 Apr 2024 11:14:27 -0500 Subject: [PATCH 3/6] test value in _getSaveJSON instead of PendingOps --- src/__tests__/ParseObject-test.js | 56 +++++++++++++++---------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/__tests__/ParseObject-test.js b/src/__tests__/ParseObject-test.js index 5f43fae93..9d49f34ff 100644 --- a/src/__tests__/ParseObject-test.js +++ b/src/__tests__/ParseObject-test.js @@ -547,58 +547,58 @@ describe('ParseObject', () => { it('can set sub property of a local changed object without creating an op', () => { const o = new ParseObject('Person'); o.set('data', { a: 2 }); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); o.set('datab', {v: 2}); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); + expect(Object.keys(o._getSaveJSON()).length).toBe(2); o.set('data.b', 3); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: 3}); + expect(Object.keys(o._getSaveJSON()).length).toBe(2); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2, b: 3}); o.set({"data.c" : 5, "data.d.a": 4}); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: 3, c: 5, d: { a: 4 }}); + expect(Object.keys(o._getSaveJSON()).length).toBe(2); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2, b: 3, c: 5, d: { a: 4 }}); }); it('can unset sub property of a local changed object without creating an op', () => { const o = new ParseObject('Person'); o.set('data', { a: 2, b: 4 }); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); o.unset('data.b'); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2}); o.unset('data.c'); expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2}); o.unset('data.c.d'); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2}); o.set('data.b.c', 3); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: { c: 3 }}); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2, b: { c: 3 }}); o.unset('data.b.c'); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2, b: {}}); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2, b: {}}); o.unset('data.b'); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 2}); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 2}); }); it('can increment sub property of a local changed object without creating an op', () => { const o = new ParseObject('Person'); o.set('data', {a: 2, b: 4}); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); o.increment('data.a', 3); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); - expect(o._getPendingOps()[0]['data']._value).toStrictEqual({ a: 5, b: 4}); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); + expect(o._getSaveJSON()['data']).toStrictEqual({ a: 5, b: 4}); }); it('collapse sub-property sets with parents as well', () => { @@ -608,24 +608,24 @@ describe('ParseObject', () => { data: { a: 3 } }); expect(o.dirty()).toBe(false); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(0); + expect(Object.keys(o._getSaveJSON()).length).toBe(0); o.set('data.b', { c: 1 }); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); o.set('data.boo', 4); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); - expect(o._getPendingOps()[0]['data.boo']._value).toStrictEqual(4); + expect(Object.keys(o._getSaveJSON()).length).toBe(2); + expect(o._getSaveJSON()['data.boo']).toStrictEqual(4); o.set('data.b.c', 2); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(2); - expect(o._getPendingOps()[0]['data.b']._value).toStrictEqual({ c: 2 }); + expect(Object.keys(o._getSaveJSON()).length).toBe(2); + expect(o._getSaveJSON()['data.b']).toStrictEqual({ c: 2 }); }); it('throw exception on non-sensical parent (not set)', async () => { const o = new ParseObject('Person'); o.increment('data', 2); - expect(Object.keys(o._getPendingOps()[0]).length).toBe(1); + expect(Object.keys(o._getSaveJSON()).length).toBe(1); try { o.set('data.a', 3); From 494cb81d3299d859e9945bf1d7b80f8f26a61694 Mon Sep 17 00:00:00 2001 From: Morten Moeller Date: Fri, 3 May 2024 09:41:57 -0500 Subject: [PATCH 4/6] integration tests to test changes without save between does the same as if there were a save. --- integration/test/ParseObjectTest.js | 59 +++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/integration/test/ParseObjectTest.js b/integration/test/ParseObjectTest.js index 8657f1f57..bc36442a0 100644 --- a/integration/test/ParseObjectTest.js +++ b/integration/test/ParseObjectTest.js @@ -463,6 +463,44 @@ describe('Parse Object', () => { assert.equal(result.get('objectField').string, 'hello'); }); + it('can set and unset without save', async () => { + const obj = new TestObject({ + objectField: { + number: 5, + string: 'hello', + }, + }); + obj.unset('objectField.number'); + assert.equal(obj.get('objectField').number, undefined); + assert.equal(obj.get('objectField').string, 'hello'); + await obj.save(); + + const query = new Parse.Query(TestObject); + const result = await query.get(obj.id); + assert.equal(result.get('objectField').number, undefined); + assert.equal(result.get('objectField').string, 'hello'); + }); + + it('can set and set sub-property without save', async () => { + const obj = new TestObject({ + objectField: { + number: 5, + string: 'hello', + }, + }); + obj.set('objectField.numberb', 4); + assert.equal(obj.get('objectField').number, 5); + assert.equal(obj.get('objectField').numberb, 4); + assert.equal(obj.get('objectField').string, 'hello'); + await obj.save(); + + const query = new Parse.Query(TestObject); + const result = await query.get(obj.id); + assert.equal(result.get('objectField').number, 5); + assert.equal(result.get('objectField').numberb, 4); + assert.equal(result.get('objectField').string, 'hello'); + }); + it('can unset nested fields two levels', async () => { const obj = new TestObject({ objectField: { @@ -485,6 +523,27 @@ describe('Parse Object', () => { assert.equal(result.get('objectField').string, 'hello'); }); + it('can unset nested fields two levels - without save between', async () => { + const obj = new TestObject({ + objectField: { + foo: { + bar: 5, + }, + string: 'hello', + }, + }); + + obj.unset('objectField.foo.bar'); + assert.equal(obj.get('objectField').foo.bar, undefined); + assert.equal(obj.get('objectField').string, 'hello'); + await obj.save(); + + const query = new Parse.Query(TestObject); + const result = await query.get(obj.id); + assert.equal(result.get('objectField').foo.bar, undefined); + assert.equal(result.get('objectField').string, 'hello'); + }); + it('can unset non existing fields', async () => { const obj = new TestObject(); obj.set('objectField', { number: 5 }); From 25441f9b280e965c5c150187ec59408b080f2fb1 Mon Sep 17 00:00:00 2001 From: Morten Moeller Date: Sat, 4 May 2024 08:15:32 -0500 Subject: [PATCH 5/6] Fixes Typescript Defs based on CoreManager Changes. --- types/ObjectStateMutations.d.ts | 8 ++++---- types/ParseFile.d.ts | 6 +++++- types/ParseHooks.d.ts | 2 ++ types/ParseQuery.d.ts | 4 ++-- types/ParseUser.d.ts | 2 +- types/Push.d.ts | 2 +- types/tsconfig.json | 2 +- 7 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 types/ParseHooks.d.ts diff --git a/types/ObjectStateMutations.d.ts b/types/ObjectStateMutations.d.ts index c82bd0d6c..a8a4b2e70 100644 --- a/types/ObjectStateMutations.d.ts +++ b/types/ObjectStateMutations.d.ts @@ -8,16 +8,16 @@ export function mergeFirstPendingState(pendingOps: Array): void; export function estimateAttribute(serverData: AttributeMap, pendingOps: Array, className: string, id: string | null, attr: string): mixed; export function estimateAttributes(serverData: AttributeMap, pendingOps: Array, className: string, id: string | null): AttributeMap; export function commitServerChanges(serverData: AttributeMap, objectCache: ObjectCache, changes: AttributeMap): void; -type AttributeMap = { +export type AttributeMap = { [attr: string]: any; }; -type OpsMap = { +export type OpsMap = { [attr: string]: Op; }; -type ObjectCache = { +export type ObjectCache = { [attr: string]: string; }; -type State = { +export type State = { serverData: AttributeMap; pendingOps: OpsMap[]; objectCache: ObjectCache; diff --git a/types/ParseFile.d.ts b/types/ParseFile.d.ts index 704384901..232b37faa 100644 --- a/types/ParseFile.d.ts +++ b/types/ParseFile.d.ts @@ -1,5 +1,5 @@ // @ts-nocheck -type FileSource = { +export type FileSource = { format: "file"; file: Blob; type: string; @@ -179,3 +179,7 @@ type Base64 = { type Uri = { uri: string; }; +export type FileSaveOptions = FullOptions & { + metadata?: { [key: string]: any }, + tags?: { [key: string]: any }, +}; diff --git a/types/ParseHooks.d.ts b/types/ParseHooks.d.ts new file mode 100644 index 000000000..f6cdf332e --- /dev/null +++ b/types/ParseHooks.d.ts @@ -0,0 +1,2 @@ +export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string }; +export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string }; diff --git a/types/ParseQuery.d.ts b/types/ParseQuery.d.ts index 60b0bbb5e..86033aa1b 100644 --- a/types/ParseQuery.d.ts +++ b/types/ParseQuery.d.ts @@ -2,7 +2,7 @@ type WhereClause = { [attr: string]: mixed; }; -type QueryJSON = { +export type QueryJSON = { where: WhereClause; watch?: string; include?: string; @@ -918,7 +918,7 @@ declare class ParseQuery { cancel(): ParseQuery; _setRequestTask(options: any): void; /** - * Sets a comment to the query so that the query + * Sets a comment to the query so that the query * can be identified when using a the profiler for MongoDB. * * @param {string} value a comment can make your profile data easier to interpret and trace. diff --git a/types/ParseUser.d.ts b/types/ParseUser.d.ts index 5a425bc55..89c45d308 100644 --- a/types/ParseUser.d.ts +++ b/types/ParseUser.d.ts @@ -1,5 +1,5 @@ // @ts-nocheck -type AuthData = { +export type AuthData = { [key: string]: mixed; }; export default ParseUser; diff --git a/types/Push.d.ts b/types/Push.d.ts index 3108e0d24..367617fdb 100644 --- a/types/Push.d.ts +++ b/types/Push.d.ts @@ -49,7 +49,7 @@ export function send(data: PushData, options?: FullOptions): Promise; * @returns {Parse.Object} Status of Push. */ export function getPushStatus(pushStatusId: string, options?: FullOptions): Promise; -type PushData = { +export type PushData = { where?: WhereClause | ParseQuery; push_time?: string | Date; expiration_time?: string | Date; diff --git a/types/tsconfig.json b/types/tsconfig.json index 2edb2f209..d18d38fbe 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": ["es6", "dom"], "noImplicitAny": true, "noImplicitThis": true, "strictFunctionTypes": true, From 306792cb160f040890a7b0f177f7456c5bfcf539 Mon Sep 17 00:00:00 2001 From: Morten Moeller Date: Sat, 4 May 2024 21:46:01 -0500 Subject: [PATCH 6/6] Revert "Fixes Typescript Defs based on CoreManager Changes." This reverts commit 25441f9b280e965c5c150187ec59408b080f2fb1. --- types/ObjectStateMutations.d.ts | 8 ++++---- types/ParseFile.d.ts | 6 +----- types/ParseHooks.d.ts | 2 -- types/ParseQuery.d.ts | 4 ++-- types/ParseUser.d.ts | 2 +- types/Push.d.ts | 2 +- types/tsconfig.json | 2 +- 7 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 types/ParseHooks.d.ts diff --git a/types/ObjectStateMutations.d.ts b/types/ObjectStateMutations.d.ts index a8a4b2e70..c82bd0d6c 100644 --- a/types/ObjectStateMutations.d.ts +++ b/types/ObjectStateMutations.d.ts @@ -8,16 +8,16 @@ export function mergeFirstPendingState(pendingOps: Array): void; export function estimateAttribute(serverData: AttributeMap, pendingOps: Array, className: string, id: string | null, attr: string): mixed; export function estimateAttributes(serverData: AttributeMap, pendingOps: Array, className: string, id: string | null): AttributeMap; export function commitServerChanges(serverData: AttributeMap, objectCache: ObjectCache, changes: AttributeMap): void; -export type AttributeMap = { +type AttributeMap = { [attr: string]: any; }; -export type OpsMap = { +type OpsMap = { [attr: string]: Op; }; -export type ObjectCache = { +type ObjectCache = { [attr: string]: string; }; -export type State = { +type State = { serverData: AttributeMap; pendingOps: OpsMap[]; objectCache: ObjectCache; diff --git a/types/ParseFile.d.ts b/types/ParseFile.d.ts index 232b37faa..704384901 100644 --- a/types/ParseFile.d.ts +++ b/types/ParseFile.d.ts @@ -1,5 +1,5 @@ // @ts-nocheck -export type FileSource = { +type FileSource = { format: "file"; file: Blob; type: string; @@ -179,7 +179,3 @@ type Base64 = { type Uri = { uri: string; }; -export type FileSaveOptions = FullOptions & { - metadata?: { [key: string]: any }, - tags?: { [key: string]: any }, -}; diff --git a/types/ParseHooks.d.ts b/types/ParseHooks.d.ts deleted file mode 100644 index f6cdf332e..000000000 --- a/types/ParseHooks.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -export type HookDeclaration = { functionName: string, url: string } | { className: string, triggerName: string, url: string }; -export type HookDeleteArg = { functionName: string } | { className: string, triggerName: string }; diff --git a/types/ParseQuery.d.ts b/types/ParseQuery.d.ts index 86033aa1b..60b0bbb5e 100644 --- a/types/ParseQuery.d.ts +++ b/types/ParseQuery.d.ts @@ -2,7 +2,7 @@ type WhereClause = { [attr: string]: mixed; }; -export type QueryJSON = { +type QueryJSON = { where: WhereClause; watch?: string; include?: string; @@ -918,7 +918,7 @@ declare class ParseQuery { cancel(): ParseQuery; _setRequestTask(options: any): void; /** - * Sets a comment to the query so that the query + * Sets a comment to the query so that the query * can be identified when using a the profiler for MongoDB. * * @param {string} value a comment can make your profile data easier to interpret and trace. diff --git a/types/ParseUser.d.ts b/types/ParseUser.d.ts index 89c45d308..5a425bc55 100644 --- a/types/ParseUser.d.ts +++ b/types/ParseUser.d.ts @@ -1,5 +1,5 @@ // @ts-nocheck -export type AuthData = { +type AuthData = { [key: string]: mixed; }; export default ParseUser; diff --git a/types/Push.d.ts b/types/Push.d.ts index 367617fdb..3108e0d24 100644 --- a/types/Push.d.ts +++ b/types/Push.d.ts @@ -49,7 +49,7 @@ export function send(data: PushData, options?: FullOptions): Promise; * @returns {Parse.Object} Status of Push. */ export function getPushStatus(pushStatusId: string, options?: FullOptions): Promise; -export type PushData = { +type PushData = { where?: WhereClause | ParseQuery; push_time?: string | Date; expiration_time?: string | Date; diff --git a/types/tsconfig.json b/types/tsconfig.json index d18d38fbe..2edb2f209 100644 --- a/types/tsconfig.json +++ b/types/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6", "dom"], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictFunctionTypes": true,