parse 8.1.1-alpha.3 → 8.1.1-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/parse.js +1 -1
- package/dist/parse.min.js +1 -1
- package/dist/parse.weapp.js +1 -1
- package/dist/parse.weapp.min.js +1 -1
- package/lib/browser/CoreManager.js +1 -1
- package/lib/browser/ParseObject.js +6 -0
- package/lib/browser/ParseQuery.js +2 -0
- package/lib/browser/Push.js +2 -0
- package/lib/browser/RESTController.js +1 -0
- package/lib/node/CoreManager.js +1 -1
- package/lib/node/ParseObject.js +6 -0
- package/lib/node/ParseQuery.js +2 -0
- package/lib/node/Push.js +2 -0
- package/lib/node/RESTController.js +2 -0
- package/lib/react-native/CoreManager.js +1 -1
- package/lib/react-native/ParseObject.js +14 -14
- package/lib/weapp/CoreManager.js +1 -1
- package/lib/weapp/ParseObject.js +6 -0
- package/lib/weapp/ParseQuery.js +2 -0
- package/lib/weapp/Push.js +2 -0
- package/lib/weapp/RESTController.js +1 -0
- package/package.json +3 -3
- package/types/Cloud.d.ts +4 -3
- package/types/ParseObject.d.ts +67 -16
- package/types/ParseQuery.d.ts +16 -26
- package/types/ParseSchema.d.ts +9 -7
- package/types/ParseUser.d.ts +5 -1
- package/types/Push.d.ts +2 -0
- package/types/RESTController.d.ts +8 -0
- package/types/index.d.ts +47 -2
- package/types/tests.ts +87 -0
package/types/index.d.ts
CHANGED
|
@@ -32,9 +32,15 @@ import Schema from './ParseSchema';
|
|
|
32
32
|
import Session from './ParseSession';
|
|
33
33
|
import Storage from './Storage';
|
|
34
34
|
import User from './ParseUser';
|
|
35
|
+
import LiveQuerySubscription from './LiveQuerySubscription';
|
|
35
36
|
|
|
36
|
-
export type { AuthProvider, AuthData } from './ParseUser';
|
|
37
|
-
export type { Pointer } from './ParseObject';
|
|
37
|
+
export type { AuthProvider, AuthData, SignUpOptions } from './ParseUser';
|
|
38
|
+
export type { Pointer, Attributes, BaseAttributes, JSONBaseAttributes, ObjectStatic, ObjectConstructor, FetchOptions, SaveOptions, SetOptions, DestroyOptions, DestroyAllOptions, SaveAllOptions, FetchAllOptions, Encode, ToJSON } from './ParseObject';
|
|
39
|
+
export type { PushData, SendOptions } from './Push';
|
|
40
|
+
export type { FullOptions, RequestOptions } from './RESTController';
|
|
41
|
+
export type { RestSchema, TYPE } from './ParseSchema';
|
|
42
|
+
export type { FindOptions, QueryOptions, QueryJSON, WhereClause, FullTextOptions, BatchOptions, CountOptions, GetOptions, FirstOptions } from './ParseQuery';
|
|
43
|
+
export { LiveQuerySubscription };
|
|
38
44
|
export {
|
|
39
45
|
ACL,
|
|
40
46
|
Analytics,
|
|
@@ -64,3 +70,42 @@ export {
|
|
|
64
70
|
IndexedDB,
|
|
65
71
|
Hooks,
|
|
66
72
|
};
|
|
73
|
+
|
|
74
|
+
// ============================================================================
|
|
75
|
+
// Namespace re-exports for backward compatibility
|
|
76
|
+
// These enable Parse.Object.FetchOptions, Parse.Query.FindOptions etc.
|
|
77
|
+
// ============================================================================
|
|
78
|
+
|
|
79
|
+
export namespace Object {
|
|
80
|
+
export type DestroyOptions = import('./ParseObject').DestroyOptions;
|
|
81
|
+
export type DestroyAllOptions = import('./ParseObject').DestroyAllOptions;
|
|
82
|
+
export type FetchOptions = import('./ParseObject').FetchOptions;
|
|
83
|
+
export type FetchAllOptions = import('./ParseObject').FetchAllOptions;
|
|
84
|
+
export type SaveOptions = import('./ParseObject').SaveOptions;
|
|
85
|
+
export type SaveAllOptions = import('./ParseObject').SaveAllOptions;
|
|
86
|
+
export type SetOptions = import('./ParseObject').SetOptions;
|
|
87
|
+
export type Encode<T> = import('./ParseObject').Encode<T>;
|
|
88
|
+
export type ToJSON<T> = import('./ParseObject').ToJSON<T>;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export namespace Query {
|
|
92
|
+
export type FindOptions = import('./ParseQuery').FindOptions;
|
|
93
|
+
export type QueryOptions = import('./ParseQuery').QueryOptions;
|
|
94
|
+
export type FullTextOptions = import('./ParseQuery').FullTextOptions;
|
|
95
|
+
export type BatchOptions = import('./ParseQuery').BatchOptions;
|
|
96
|
+
export type CountOptions = import('./ParseQuery').CountOptions;
|
|
97
|
+
export type GetOptions = import('./ParseQuery').GetOptions;
|
|
98
|
+
export type FirstOptions = import('./ParseQuery').FirstOptions;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export namespace Schema {
|
|
102
|
+
export type TYPE = import('./ParseSchema').TYPE;
|
|
103
|
+
export type FieldType = import('./ParseSchema').FieldType;
|
|
104
|
+
export type FieldOptions<
|
|
105
|
+
T extends import('./ParseSchema').SupportedFieldTypes = any
|
|
106
|
+
> = import('./ParseSchema').FieldOptions<T>;
|
|
107
|
+
export type Index = import('./ParseSchema').Index;
|
|
108
|
+
export type CLP = import('./ParseSchema').CLP;
|
|
109
|
+
export type CLPField = import('./ParseSchema').CLPField;
|
|
110
|
+
export type AttrType<T extends import('./ParseObject').default, V> = import('./ParseSchema').AttrType<T, V>;
|
|
111
|
+
}
|
package/types/tests.ts
CHANGED
|
@@ -2370,6 +2370,7 @@ function testEventuallyQueue() {
|
|
|
2370
2370
|
}
|
|
2371
2371
|
}
|
|
2372
2372
|
|
|
2373
|
+
// TODO: Add missing LiveQuery types (LiveQuerySubscription, etc.)
|
|
2373
2374
|
function LiveQueryEvents() {
|
|
2374
2375
|
function testLiveQueryEvents() {
|
|
2375
2376
|
Parse.LiveQuery.on('open', () => {});
|
|
@@ -2398,3 +2399,89 @@ function testInitialize() {
|
|
|
2398
2399
|
// Node - 1 param (should also work since javaScriptKey is optional in node)
|
|
2399
2400
|
ParseNode.initialize('appId');
|
|
2400
2401
|
}
|
|
2402
|
+
// Test Parse.* and namespace type exports
|
|
2403
|
+
async function test_type_exports() {
|
|
2404
|
+
// Parse.Object.* namespace
|
|
2405
|
+
const objDestroyOpts: Parse.Object.DestroyOptions = { useMasterKey: true, sessionToken: 'token' };
|
|
2406
|
+
const objDestroyAllOpts: Parse.Object.DestroyAllOptions = { batchSize: 100, useMasterKey: true };
|
|
2407
|
+
const objFetchOpts: Parse.Object.FetchOptions = { useMasterKey: true, include: ['rel'] };
|
|
2408
|
+
const objFetchAllOpts: Parse.Object.FetchAllOptions = { useMasterKey: true };
|
|
2409
|
+
const objSaveOpts: Parse.Object.SaveOptions = { useMasterKey: true, cascadeSave: false, context: {} };
|
|
2410
|
+
const objSaveAllOpts: Parse.Object.SaveAllOptions = { batchSize: 50, useMasterKey: true };
|
|
2411
|
+
const objSetOpts: Parse.Object.SetOptions = { ignoreValidation: true };
|
|
2412
|
+
type ObjEncode = Parse.Object.Encode<Date>;
|
|
2413
|
+
type ObjToJSON = Parse.Object.ToJSON<{ name: string }>;
|
|
2414
|
+
|
|
2415
|
+
// Parse.Query.* namespace
|
|
2416
|
+
const queryOpts: Parse.Query.QueryOptions = { useMasterKey: true, sessionToken: 'token', json: true };
|
|
2417
|
+
const queryFindOpts: Parse.Query.FindOptions = { useMasterKey: true, context: {} };
|
|
2418
|
+
const queryBatchOpts: Parse.Query.BatchOptions = { batchSize: 100, useMasterKey: true };
|
|
2419
|
+
const queryFullTextOpts: Parse.Query.FullTextOptions = { language: 'en', caseSensitive: false };
|
|
2420
|
+
|
|
2421
|
+
// Parse.Schema.* namespace
|
|
2422
|
+
const schemaTypes: Parse.Schema.TYPE[] = ['String', 'Number', 'Boolean', 'Date', 'File', 'GeoPoint', 'Polygon', 'Array', 'Object', 'Pointer', 'Relation', 'Bytes'];
|
|
2423
|
+
|
|
2424
|
+
// Direct Parse.* exports
|
|
2425
|
+
const destroyOpts: Parse.DestroyOptions = { useMasterKey: true };
|
|
2426
|
+
const fetchOpts: Parse.FetchOptions = { useMasterKey: true, include: ['rel'] };
|
|
2427
|
+
const saveOpts: Parse.SaveOptions = { useMasterKey: true, cascadeSave: true };
|
|
2428
|
+
const setOpts: Parse.SetOptions = { ignoreValidation: false };
|
|
2429
|
+
const destroyAllOpts: Parse.DestroyAllOptions = { batchSize: 100 };
|
|
2430
|
+
const saveAllOpts: Parse.SaveAllOptions = { batchSize: 50 };
|
|
2431
|
+
const fetchAllOpts: Parse.FetchAllOptions = { useMasterKey: true };
|
|
2432
|
+
const findOpts: Parse.FindOptions = { useMasterKey: true, json: true };
|
|
2433
|
+
const batchOpts: Parse.BatchOptions = { batchSize: 100 };
|
|
2434
|
+
const fullTextOpts: Parse.FullTextOptions = { language: 'en' };
|
|
2435
|
+
const typeVal: Parse.TYPE = 'String';
|
|
2436
|
+
type DirectEncode = Parse.Encode<Date>;
|
|
2437
|
+
type DirectToJSON = Parse.ToJSON<{ x: number }>;
|
|
2438
|
+
|
|
2439
|
+
// Core types
|
|
2440
|
+
const pointer: Parse.Pointer = { __type: 'Pointer', className: 'Test', objectId: 'abc' };
|
|
2441
|
+
const attrs: Parse.Attributes = { score: 100 };
|
|
2442
|
+
const baseAttrs: Parse.BaseAttributes = { createdAt: new Date(), updatedAt: new Date(), objectId: 'abc' };
|
|
2443
|
+
const jsonBaseAttrs: Parse.JSONBaseAttributes = { createdAt: '2023-01-01T00:00:00Z', updatedAt: '2023-01-01T00:00:00Z', objectId: 'abc' };
|
|
2444
|
+
const whereClause: Parse.WhereClause = { score: { $gt: 100 } };
|
|
2445
|
+
const queryJson: Parse.QueryJSON = { where: {}, limit: 10 };
|
|
2446
|
+
const fullOpts: Parse.FullOptions = { useMasterKey: true };
|
|
2447
|
+
const reqOpts: Parse.RequestOptions = { useMasterKey: true, batchSize: 50 };
|
|
2448
|
+
const authProvider: Parse.AuthProvider = { authenticate: () => {}, getAuthType: () => 'custom', restoreAuthentication: () => true };
|
|
2449
|
+
const authData: Parse.AuthData = { id: 'user-id' };
|
|
2450
|
+
const signUpOpts: Parse.SignUpOptions = { useMasterKey: true };
|
|
2451
|
+
const restSchema: Parse.RestSchema = { className: 'Test', fields: {}, classLevelPermissions: {} };
|
|
2452
|
+
const pushData: Parse.PushData = { channels: ['news'], data: { alert: 'Hello' } };
|
|
2453
|
+
const sendOpts: Parse.SendOptions = { useMasterKey: true };
|
|
2454
|
+
const cloudRunOpts: Parse.Cloud.RunOptions = { useMasterKey: true, context: {} };
|
|
2455
|
+
const subscription: Parse.LiveQuerySubscription = await new Parse.Query('Test').subscribe();
|
|
2456
|
+
|
|
2457
|
+
class MyClass extends Parse.Object {
|
|
2458
|
+
constructor() {
|
|
2459
|
+
super('MyClass');
|
|
2460
|
+
}
|
|
2461
|
+
}
|
|
2462
|
+
// ObjectStatic with generic subclasses
|
|
2463
|
+
const objectStatic: Parse.ObjectStatic = MyClass;
|
|
2464
|
+
function doCreateWithoutData<T extends Parse.Object>(clz: Parse.ObjectStatic<T>, id: string): T {
|
|
2465
|
+
return clz.createWithoutData(id);
|
|
2466
|
+
}
|
|
2467
|
+
// $ExpectType MyClass
|
|
2468
|
+
const myClsObj = doCreateWithoutData(MyClass, '1');
|
|
2469
|
+
|
|
2470
|
+
// Verify types work with actual methods
|
|
2471
|
+
const obj = new Parse.Object('Test');
|
|
2472
|
+
const query = new Parse.Query('Test');
|
|
2473
|
+
|
|
2474
|
+
await obj.save(null, saveOpts);
|
|
2475
|
+
await obj.fetch(fetchOpts);
|
|
2476
|
+
await obj.destroy(destroyOpts);
|
|
2477
|
+
obj.set('key', 'value', setOpts);
|
|
2478
|
+
await Parse.Object.saveAll([obj], saveAllOpts);
|
|
2479
|
+
await Parse.Object.destroyAll([obj], destroyAllOpts);
|
|
2480
|
+
await Parse.Object.fetchAll([obj], fetchAllOpts);
|
|
2481
|
+
await query.find(findOpts);
|
|
2482
|
+
await query.first(findOpts);
|
|
2483
|
+
await query.count(findOpts);
|
|
2484
|
+
await query.each(() => {}, batchOpts);
|
|
2485
|
+
await query.eachBatch(() => {}, batchOpts);
|
|
2486
|
+
query.fullText('field', 'term', fullTextOpts);
|
|
2487
|
+
}
|