Skip to content

Commit 9549b21

Browse files
committed
Merge branch 'master' of github.com:andrei-markeev/DefinitelyTyped into andrei-markeev-master
Conflicts: camljs/camljs-tests.ts
2 parents 7739056 + 2b5f6ac commit 9549b21

File tree

2 files changed

+80
-60
lines changed

2 files changed

+80
-60
lines changed

camljs/camljs-tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ caml = new CamlBuilder().Where()
3131
)
3232
.ToString();
3333

34-
caml = new CamlBuilder().Where()
35-
.LookupIdField("Category").In([2, 3, 10])
34+
var caml = new CamlBuilder().Where()
35+
.LookupField("Category").Id().In([2, 3, 10])
3636
.And()
3737
.DateField("ExpirationDate").GreaterThan(CamlBuilder.CamlValues.Now)
3838
.OrderBy("ExpirationDate")

camljs/camljs.d.ts

Lines changed: 78 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,48 +4,14 @@
44
// Definitions: https://github.com/borisyankov/DefinitelyTyped
55

66

7-
declare module Sys {
8-
class StringBuilder {
9-
/** Appends a string to the string builder */
10-
public append(s: string): void;
11-
/** Appends a line to the string builder */
12-
public appendLine(s: string): void;
13-
/** Clears the contents of the string builder */
14-
public clear(): void;
15-
/** Indicates wherever the string builder is empty */
16-
public isEmpty(): boolean;
17-
/** Gets the contents of the string builder as a string */
18-
public toString(): string;
19-
}
20-
}
21-
declare module SP {
22-
/** Defines a writer that provides a set of methods to append text in XML format. Use the static SP.XmlWriter.create(sb) Method to create an SP.XmlWriter object with the Sys.StringBuilder object you pass in. */
23-
class XmlWriter {
24-
/** Creates a new instance of the XmlWriter class with the specified string builder. */
25-
static create(sb: Sys.StringBuilder): XmlWriter;
26-
/** Appends a start element tag with the specified name in XML format to the object?s string builder. */
27-
public writeStartElement(tagName: string): void;
28-
/** Appends an element with the specified tag name and value in XML format to the string builder. */
29-
public writeElementString(tagName: string, value: string): void;
30-
/** Appends an end element tag in XML format to the object?s string builder. This method appends the end element tag ?/>? if the start element tag is not closed; otherwise, it appends a full end element tag ?</tagName>? to the string builder. */
31-
public writeEndElement(): void;
32-
/** Appends an attribute with the specified name and value in XML format to the object?s string builder. */
33-
public writeAttributeString(localName: string, value: string): void;
34-
/** This method only appends the name of the attribute. You can append the value of the attribute by calling the SP.XmlWriter.writeString(value) Method, and close the attribute by calling the SP.XmlWriter.writeEndAttribute() Method. */
35-
public writeStartAttribute(localName: string): void;
36-
/** Appends an end of an attribute in XML format to the object?s string builder. */
37-
public writeEndAttribute(): void;
38-
/** Appends the specified value for an element tag or attribute to the object?s string builder. */
39-
public writeString(value: string): void;
40-
/** Appends the specified text to the object?s string builder. */
41-
public writeRaw(xml: string): void;
42-
/** This member is reserved for internal use and is not intended to be used directly from your code. */
43-
public close(): void;
44-
}
45-
}
467
declare class CamlBuilder {
478
constructor();
9+
/** Generate CAML Query, starting from <Where> tag */
4810
public Where(): CamlBuilder.IFieldExpression;
11+
/** Generate <View> tag for SP.CamlQuery
12+
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
13+
Specifying view fields is a good practice, as it decreases traffic between server and client. */
14+
public View(viewFields?: string[]): CamlBuilder.IView;
4915
/** Use for:
5016
1. SPServices CAMLQuery attribute
5117
2. Creating partial expressions
@@ -54,15 +20,49 @@ declare class CamlBuilder {
5420
static Expression(): CamlBuilder.IFieldExpression;
5521
}
5622
declare module CamlBuilder {
57-
interface IView {
23+
interface IView extends IJoinable, IFinalizable {
5824
Query(): IQuery;
25+
RowLimit(limit: number, paged?: boolean): IView;
26+
Scope(scope: ViewScope): IView;
27+
}
28+
interface IJoinable {
29+
/** Join the list you're querying with another list.
30+
Joins are only allowed through a lookup field relation.
31+
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
32+
@alias alias for the joined list */
33+
InnerJoin(lookupFieldInternalName: string, alias: string): IJoin;
34+
/** Join the list you're querying with another list.
35+
Joins are only allowed through a lookup field relation.
36+
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
37+
@alias alias for the joined list */
38+
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
39+
}
40+
interface IJoin extends IJoinable {
41+
/** Select projected field for using in the main Query body
42+
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
43+
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
44+
}
45+
interface IProjectableView extends IView {
46+
/** Select projected field for using in the main Query body
47+
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
48+
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
49+
}
50+
enum ViewScope {
51+
/** */
52+
Recursive = 0,
53+
/** */
54+
RecursiveAll = 1,
55+
/** */
56+
FilesOnly = 2,
5957
}
6058
interface IQuery {
6159
Where(): IFieldExpression;
6260
}
6361
interface IFinalizable {
6462
/** Get the resulting CAML query as string */
6563
ToString(): string;
64+
/** Get the resulting CAML query as SP.CamlQuery object */
65+
ToCamlQuery(): any;
6666
}
6767
interface ISortable extends IFinalizable {
6868
/** Adds OrderBy clause to the query
@@ -81,7 +81,7 @@ declare module CamlBuilder {
8181
interface IGroupable extends ISortable {
8282
/** Adds GroupBy clause to the query.
8383
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
84-
GroupBy(fieldInternalName): IGroupedQuery;
84+
GroupBy(fieldInternalName: any): IGroupedQuery;
8585
}
8686
interface IExpression extends IGroupable {
8787
/** Adds And clause to the query. */
@@ -122,12 +122,10 @@ declare module CamlBuilder {
122122
UserField(internalName: string): IUserFieldExpression;
123123
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Lookup */
124124
LookupField(internalName: string): ILookupFieldExpression;
125-
/** DEPRECATED. Please use LookupField(...).Id() instead */
126-
LookupIdField(internalName: string): INumberFieldExpression;
127125
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is LookupMulti */
128126
LookupMultiField(internalName: string): ILookupMultiFieldExpression;
129127
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is UserMulti */
130-
UserMultiField(internalName: string): ILookupMultiFieldExpression;
128+
UserMultiField(internalName: string): IUserMultiFieldExpression;
131129
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is Date */
132130
DateField(internalName: string): IDateTimeFieldExpression;
133131
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is DateTime */
@@ -289,30 +287,52 @@ declare module CamlBuilder {
289287
ValueAsBoolean(): IBooleanFieldExpression;
290288
}
291289
interface ILookupMultiFieldExpression {
292-
/** Checks whether the value of the field is equal to the specified value */
293-
EqualTo(value: string): IExpression;
294-
/** Checks whether the value of the field is not equal to the specified value */
295-
NotEqualTo(value: string): IExpression;
296-
/** Checks whether the values of the field includes the specified value */
297-
Includes(value): IExpression;
298-
/** Checks whether the values of the field not includes the specified value */
299-
NotIncludes(value): IExpression;
290+
/** Checks a condition against every item in the multi lookup value */
291+
IncludesSuchItemThat(): ILookupFieldExpression;
292+
/** Checks whether the field values collection is empty */
293+
IsNull(): IExpression;
294+
/** Checks whether the field values collection is not empty */
295+
IsNotNull(): IExpression;
296+
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().EqualTo(value)" instead. */
297+
Includes(value: any): IExpression;
298+
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().NotEqualTo(value)" instead. */
299+
NotIncludes(value: any): IExpression;
300+
/** DEPRECATED: "Eq" operation in CAML works exactly the same as "Includes". To avoid confusion, please use Includes. */
301+
EqualTo(value: any): IExpression;
302+
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
303+
NotEqualTo(value: any): IExpression;
304+
}
305+
interface IUserMultiFieldExpression {
306+
/** Checks a condition against every item in the multi lookup value */
307+
IncludesSuchItemThat(): IUserFieldExpression;
308+
/** Checks whether the field values collection is empty */
309+
IsNull(): IExpression;
310+
/** Checks whether the field values collection is not empty */
311+
IsNotNull(): IExpression;
312+
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().EqualTo(value)" instead. */
313+
Includes(value: any): IExpression;
314+
/** DEPRECATED: use "IncludesSuchItemThat().ValueAsText().NotEqualTo(value)" instead. */
315+
NotIncludes(value: any): IExpression;
316+
/** DEPRECATED: "Eq" operation in CAML works exactly the same as "Includes". To avoid confusion, please use Includes. */
317+
EqualTo(value: any): IExpression;
318+
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
319+
NotEqualTo(value: any): IExpression;
300320
}
301321
enum DateRangesOverlapType {
302322
/** Returns events for today */
303-
Now,
323+
Now = 0,
304324
/** Returns events for one day, specified by CalendarDate in QueryOptions */
305-
Day,
325+
Day = 1,
306326
/** Returns events for one week, specified by CalendarDate in QueryOptions */
307-
Week,
327+
Week = 2,
308328
/** Returns events for one month, specified by CalendarDate in QueryOptions.
309329
Caution: usually also returns few days from previous and next months */
310-
Month,
330+
Month = 3,
311331
/** Returns events for one year, specified by CalendarDate in QueryOptions */
312-
Year,
332+
Year = 4,
313333
}
314334
class Internal {
315-
static createView(): IView;
335+
static createView(viewFields?: string[]): IView;
316336
static createWhere(): IFieldExpression;
317337
static createExpression(): IFieldExpression;
318338
}

0 commit comments

Comments
 (0)