@types/parse
Advanced tools
Comparing version 2.12.2 to 2.12.3
@@ -489,3 +489,3 @@ // Type definitions for parse 2.12 | ||
list: T[], | ||
keys: string | Array<string | string[]>, | ||
keys: keyof T['attributes'] | Array<keyof T['attributes']>, | ||
options?: RequestOptions | ||
@@ -495,3 +495,3 @@ ): Promise<T[]>; | ||
list: T[], | ||
keys: string | Array<string | string[]>, | ||
keys: keyof T['attributes'] | Array<keyof T['attributes']>, | ||
options?: RequestOptions, | ||
@@ -945,3 +945,3 @@ ): Promise<T[]>; | ||
*/ | ||
class Schema { | ||
class Schema<T extends Object = any> { | ||
constructor(className: string); | ||
@@ -957,8 +957,8 @@ | ||
addArray(name: string, options?: Schema.FieldOptions<any[]>): this; | ||
addBoolean(name: string, options?: Schema.FieldOptions<boolean>): this; | ||
addDate(name: string, options?: Schema.FieldOptions<Date>): this; | ||
addArray(key: Schema.AttrType<T, any[]>, options?: Schema.FieldOptions<any[]>): this; | ||
addBoolean(key: Schema.AttrType<T, boolean>, options?: Schema.FieldOptions<boolean>): this; | ||
addDate(key: Schema.AttrType<T, Date>, options?: Schema.FieldOptions<Date>): this; | ||
addField<T extends Schema.TYPE = any>(name: string, type?: T, options?: Schema.FieldOptions): this; | ||
addFile(name: string, options?: Schema.FieldOptions<File>): this; | ||
addGeoPoint(name: string, options?: Schema.FieldOptions<GeoPoint>): this; | ||
addFile(key: Schema.AttrType<T, File>, options?: Schema.FieldOptions<File>): this; | ||
addGeoPoint(key: Schema.AttrType<T, GeoPoint>, options?: Schema.FieldOptions<GeoPoint>): this; | ||
@@ -977,5 +977,6 @@ /** | ||
addNumber(name: string, options?: Schema.FieldOptions<number>): this; | ||
addObject(name: string, options?: Schema.FieldOptions<object>): this; | ||
addNumber(key: Schema.AttrType<T, number>, options?: Schema.FieldOptions<number>): this; | ||
addObject(key: Schema.AttrType<T, object>, options?: Schema.FieldOptions<object>): this; | ||
/** | ||
@@ -987,5 +988,5 @@ * Adding Pointer Field | ||
*/ | ||
addPointer(name: string, targetClass: string, options?: Schema.FieldOptions<Pointer>): this; | ||
addPointer(key: Schema.AttrType<T, Object | Pointer>, targetClass: string, options?: Schema.FieldOptions<Pointer>): this; | ||
addPolygon(name: string, options?: Schema.FieldOptions<Polygon>): this; | ||
addPolygon(key: Schema.AttrType<T, Polygon>, options?: Schema.FieldOptions<Polygon>): this; | ||
@@ -998,5 +999,5 @@ /** | ||
*/ | ||
addRelation(name: string, targetClass: string): this; | ||
addRelation(key: Schema.AttrType<T, Relation>, targetClass: string, options?: Schema.FieldOptions<Relation>): this; | ||
addString(name: string, options?: Schema.FieldOptions<string>): this; | ||
addString(key: Schema.AttrType<T, string>, options?: Schema.FieldOptions<string>): this; | ||
@@ -1030,3 +1031,3 @@ /** | ||
/** | ||
* Removes all objects from a Schema (class) in Parse. EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed | ||
* Removes all objects from a Schema (class) in EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed | ||
*/ | ||
@@ -1042,2 +1043,8 @@ // TODO Fix Promise<any> | ||
/** | ||
* Sets Class Level Permissions when creating / updating a Schema. | ||
* EXERCISE CAUTION, running this may override CLP for this schema and cannot be reversed | ||
*/ | ||
setCLP(clp: Schema.CLP): this; | ||
/** | ||
* Update a Schema on Parse | ||
@@ -1050,2 +1057,4 @@ */ | ||
type TYPE = 'String' | 'Number' | 'Boolean' | 'Date' | 'File' | 'GeoPoint' | 'Polygon' | 'Array' | 'Object' | 'Pointer' | 'Relation'; | ||
type FieldType = string | number | boolean | Date | File | GeoPoint | Polygon | any[] | object | Pointer | Relation; | ||
type AttrType<T extends Object, V> = Extract<{ [K in keyof T['attributes']]: T['attributes'][K] extends V ? K : never }[keyof T['attributes']], string>; | ||
@@ -1061,2 +1070,31 @@ interface FieldOptions | ||
} | ||
/** | ||
* The id of a `_User` object or a role name prefixed by `'role:'`. | ||
* @example | ||
* '*': false, // public | ||
* requiresAuthentication: false, | ||
* 'role:Admin': true, | ||
* 'idOfASpecificUser': true | ||
*/ | ||
interface CLPField { | ||
'*'?: boolean; | ||
requiresAuthentication?: boolean; | ||
/** `role:Admin` */ | ||
[userIdOrRoleName: string]: boolean | undefined; | ||
} | ||
interface CLP { | ||
find?: CLPField; | ||
get?: CLPField; | ||
count?: CLPField; | ||
create?: CLPField; | ||
update?: CLPField; | ||
delete?: CLPField; | ||
addField?: CLPField; | ||
/** Array of fields that point to a `_User` object's ID or a `Role` object's name */ | ||
readUserFields?: string[]; | ||
/** Array of fields that point to a `_User` object's ID or a `Role` object's name */ | ||
writeUserFields?: string[]; | ||
} | ||
} | ||
@@ -1063,0 +1101,0 @@ |
{ | ||
"name": "@types/parse", | ||
"version": "2.12.2", | ||
"version": "2.12.3", | ||
"description": "TypeScript definitions for parse", | ||
@@ -141,4 +141,4 @@ "license": "MIT", | ||
}, | ||
"typesPublisherContentHash": "10ac159b164d0a05556bc0ca932f53db0af19f2b8eb4c26531fb887a799741de", | ||
"typesPublisherContentHash": "d23b20de16bdac7fe316a2a3a4485e188efd432c0791f8e940935236d75edee7", | ||
"typeScriptVersion": "3.5" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Sat, 11 Jul 2020 03:13:04 GMT | ||
* Last updated: Wed, 19 Aug 2020 15:35:11 GMT | ||
* Dependencies: [@types/node](https://npmjs.com/package/@types/node) | ||
@@ -14,0 +14,0 @@ * Global values: none |
@@ -461,3 +461,3 @@ /// <reference types="node" /> | ||
list: T[], | ||
keys: string | Array<string | string[]>, | ||
keys: keyof T['attributes'] | Array<keyof T['attributes']>, | ||
options?: RequestOptions | ||
@@ -467,3 +467,3 @@ ): Promise<T[]>; | ||
list: T[], | ||
keys: string | Array<string | string[]>, | ||
keys: keyof T['attributes'] | Array<keyof T['attributes']>, | ||
options?: RequestOptions, | ||
@@ -916,3 +916,3 @@ ): Promise<T[]>; | ||
*/ | ||
class Schema { | ||
class Schema<T extends Object = any> { | ||
constructor(className: string); | ||
@@ -928,8 +928,8 @@ | ||
addArray(name: string, options?: Schema.FieldOptions<any[]>): this; | ||
addBoolean(name: string, options?: Schema.FieldOptions<boolean>): this; | ||
addDate(name: string, options?: Schema.FieldOptions<Date>): this; | ||
addArray(key: Schema.AttrType<T, any[]>, options?: Schema.FieldOptions<any[]>): this; | ||
addBoolean(key: Schema.AttrType<T, boolean>, options?: Schema.FieldOptions<boolean>): this; | ||
addDate(key: Schema.AttrType<T, Date>, options?: Schema.FieldOptions<Date>): this; | ||
addField<T extends Schema.TYPE = any>(name: string, type?: T, options?: Schema.FieldOptions): this; | ||
addFile(name: string, options?: Schema.FieldOptions<File>): this; | ||
addGeoPoint(name: string, options?: Schema.FieldOptions<GeoPoint>): this; | ||
addFile(key: Schema.AttrType<T, File>, options?: Schema.FieldOptions<File>): this; | ||
addGeoPoint(key: Schema.AttrType<T, GeoPoint>, options?: Schema.FieldOptions<GeoPoint>): this; | ||
@@ -948,5 +948,6 @@ /** | ||
addNumber(name: string, options?: Schema.FieldOptions<number>): this; | ||
addObject(name: string, options?: Schema.FieldOptions<object>): this; | ||
addNumber(key: Schema.AttrType<T, number>, options?: Schema.FieldOptions<number>): this; | ||
addObject(key: Schema.AttrType<T, object>, options?: Schema.FieldOptions<object>): this; | ||
/** | ||
@@ -958,5 +959,5 @@ * Adding Pointer Field | ||
*/ | ||
addPointer(name: string, targetClass: string, options?: Schema.FieldOptions<Pointer>): this; | ||
addPointer(key: Schema.AttrType<T, Object | Pointer>, targetClass: string, options?: Schema.FieldOptions<Pointer>): this; | ||
addPolygon(name: string, options?: Schema.FieldOptions<Polygon>): this; | ||
addPolygon(key: Schema.AttrType<T, Polygon>, options?: Schema.FieldOptions<Polygon>): this; | ||
@@ -969,5 +970,5 @@ /** | ||
*/ | ||
addRelation(name: string, targetClass: string): this; | ||
addRelation(key: Schema.AttrType<T, Relation>, targetClass: string, options?: Schema.FieldOptions<Relation>): this; | ||
addString(name: string, options?: Schema.FieldOptions<string>): this; | ||
addString(key: Schema.AttrType<T, string>, options?: Schema.FieldOptions<string>): this; | ||
@@ -1001,3 +1002,3 @@ /** | ||
/** | ||
* Removes all objects from a Schema (class) in Parse. EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed | ||
* Removes all objects from a Schema (class) in EXERCISE CAUTION, running this will delete all objects for this schema and cannot be reversed | ||
*/ | ||
@@ -1013,2 +1014,8 @@ // TODO Fix Promise<any> | ||
/** | ||
* Sets Class Level Permissions when creating / updating a Schema. | ||
* EXERCISE CAUTION, running this may override CLP for this schema and cannot be reversed | ||
*/ | ||
setCLP(clp: Schema.CLP): this; | ||
/** | ||
* Update a Schema on Parse | ||
@@ -1021,5 +1028,7 @@ */ | ||
type TYPE = 'String' | 'Number' | 'Boolean' | 'Date' | 'File' | 'GeoPoint' | 'Polygon' | 'Array' | 'Object' | 'Pointer' | 'Relation'; | ||
type FieldType = string | number | boolean | Date | File | GeoPoint | Polygon | any[] | object | Pointer | Relation; | ||
type AttrType<T extends Object, V> = Extract<{ [K in keyof T['attributes']]: T['attributes'][K] extends V ? K : never }[keyof T['attributes']], string>; | ||
interface FieldOptions | ||
<T extends string | number | boolean | Date | File | GeoPoint | Polygon | any[] | object | Pointer | Relation = any> { | ||
<T extends FieldType = any> { | ||
required?: boolean; | ||
@@ -1032,2 +1041,31 @@ defaultValue?: T; | ||
} | ||
/** | ||
* The id of a `_User` object or a role name prefixed by `'role:'`. | ||
* @example | ||
* '*': false, // public | ||
* requiresAuthentication: false, | ||
* 'role:Admin': true, | ||
* 'idOfASpecificUser': true | ||
*/ | ||
interface CLPField { | ||
'*'?: boolean; | ||
requiresAuthentication?: boolean; | ||
/** `role:Admin` */ | ||
[userIdOrRoleName: string]: boolean | undefined; | ||
} | ||
interface CLP { | ||
find?: CLPField; | ||
get?: CLPField; | ||
count?: CLPField; | ||
create?: CLPField; | ||
update?: CLPField; | ||
delete?: CLPField; | ||
addField?: CLPField; | ||
/** Array of fields that point to a `_User` object's ID or a `Role` object's name */ | ||
readUserFields?: string[]; | ||
/** Array of fields that point to a `_User` object's ID or a `Role` object's name */ | ||
writeUserFields?: string[]; | ||
} | ||
} | ||
@@ -1034,0 +1072,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
127778
2706