gd-sprest 7.2.1 → 7.2.2
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/@types/helper/listFormField.d.ts +14 -0
- package/@types/helper/spCfg.d.ts +6 -1
- package/@types/helper/spCfgTypes.d.ts +1 -0
- package/@types/lib/graph.d.ts +10 -10
- package/build/helper/fieldSchemaXML.js +14 -0
- package/build/helper/listFormField.js +47 -0
- package/build/helper/spCfg.js +8 -1
- package/build/helper/spCfgTypes.js +8 -7
- package/build/lib/graph.js +9 -3
- package/build/mapper/def.js +1 -0
- package/build/utils/targetInfo.js +0 -14
- package/dist/gd-sprest.d.ts +31 -11
- package/dist/gd-sprest.js +1 -1
- package/dist/gd-sprest.min.js +1 -1
- package/package.json +2 -2
- package/pnpm-lock.yaml +4 -4
|
@@ -68,6 +68,17 @@ export interface IListFormDateFieldInfo extends IListFormFieldInfo {
|
|
|
68
68
|
showTime?: boolean;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* List Form Image Field Information
|
|
73
|
+
*/
|
|
74
|
+
export interface IListFormImageFieldInfo extends IListFormFieldInfo {
|
|
75
|
+
/** The list id field. */
|
|
76
|
+
listId?: string;
|
|
77
|
+
|
|
78
|
+
/** The web containing the list. */
|
|
79
|
+
webUrl?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
71
82
|
/**
|
|
72
83
|
* List Form Lookup Field Information
|
|
73
84
|
*/
|
|
@@ -183,6 +194,9 @@ export interface IListFormField {
|
|
|
183
194
|
*/
|
|
184
195
|
create(props: IListFormFieldInfo): PromiseLike<IListFormFieldInfo>;
|
|
185
196
|
|
|
197
|
+
/** Method to get or create the associated folder for a list's image field. */
|
|
198
|
+
getOrCreateImageFolder(info: IListFormImageFieldInfo): PromiseLike<SP.Folder>;
|
|
199
|
+
|
|
186
200
|
/** Method to load the lookup data */
|
|
187
201
|
loadLookupData(info: IListFormLookupFieldInfo, queryTop?: number): PromiseLike<Array<IListItemQuery>>;
|
|
188
202
|
|
package/@types/helper/spCfg.d.ts
CHANGED
|
@@ -380,10 +380,15 @@ export interface ISPCfgListInfo {
|
|
|
380
380
|
ViewInformation?: Array<ISPCfgViewInfo>;
|
|
381
381
|
|
|
382
382
|
/**
|
|
383
|
-
* Event triggered after the list is created
|
|
383
|
+
* Event triggered after the list is created and configured.
|
|
384
384
|
*/
|
|
385
385
|
onCreated?: (list: List) => void;
|
|
386
386
|
|
|
387
|
+
/**
|
|
388
|
+
* Event triggered after the list is created.
|
|
389
|
+
*/
|
|
390
|
+
onCreating?: (list: List) => void;
|
|
391
|
+
|
|
387
392
|
/**
|
|
388
393
|
* Event triggered after the list is updated.
|
|
389
394
|
*/
|
package/@types/lib/graph.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IBaseExecution } from "gd-sprest-def/lib/base";
|
|
2
|
-
import {
|
|
2
|
+
import { Graph as GraphCore } from "gd-sprest-def/lib/microsoft";
|
|
3
3
|
import { IGraph as IGraphCore, IGraphToken } from "../intellisense/graph";
|
|
4
4
|
import { ITargetInfo } from "../utils";
|
|
5
5
|
|
|
@@ -35,15 +35,15 @@ export interface IGraphProperties {
|
|
|
35
35
|
* Graph EndPoints
|
|
36
36
|
*/
|
|
37
37
|
export interface IGraphCustom extends IGraphCore {
|
|
38
|
-
me(): IBaseExecution<
|
|
39
|
-
group(id: string): IBaseExecution<
|
|
40
|
-
groups(): IBaseExecution<
|
|
41
|
-
list(siteId: string, id: string): IBaseExecution<
|
|
42
|
-
lists(siteId: string): IBaseExecution<
|
|
43
|
-
site(id: string): IBaseExecution<
|
|
44
|
-
sites(): IBaseExecution<
|
|
45
|
-
user(id: string): IBaseExecution<
|
|
46
|
-
users(): IBaseExecution<
|
|
38
|
+
me(): IBaseExecution<GraphCore.user>;
|
|
39
|
+
group(id: string): IBaseExecution<GraphCore.group>;
|
|
40
|
+
groups(): IBaseExecution<GraphCore.groupCollections>;
|
|
41
|
+
list(siteId: string, id: string): IBaseExecution<GraphCore.list>;
|
|
42
|
+
lists(siteId: string): IBaseExecution<GraphCore.listCollections>;
|
|
43
|
+
site(id: string): IBaseExecution<GraphCore.site>;
|
|
44
|
+
sites(): IBaseExecution<GraphCore.siteCollections>;
|
|
45
|
+
user(id: string): IBaseExecution<GraphCore.user>;
|
|
46
|
+
users(): IBaseExecution<GraphCore.userCollections>;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/**
|
|
@@ -188,6 +188,16 @@ exports.FieldSchemaXML = function (fieldInfo, targetWebUrl) {
|
|
|
188
188
|
// Resolve the request
|
|
189
189
|
_resolve(schemaXml);
|
|
190
190
|
};
|
|
191
|
+
// Returns the schema xml for a image field.
|
|
192
|
+
var createImage = function (fieldInfo, props) {
|
|
193
|
+
var schemaXml = null;
|
|
194
|
+
// Set the field type
|
|
195
|
+
props["Type"] = "Thumbnail";
|
|
196
|
+
// Generate the schema
|
|
197
|
+
schemaXml = "<Field " + toString(props) + " />";
|
|
198
|
+
// Resolve the request
|
|
199
|
+
_resolve(schemaXml);
|
|
200
|
+
};
|
|
191
201
|
// Returns the schema xml for a lookup field.
|
|
192
202
|
var createLookup = function (fieldInfo, props) {
|
|
193
203
|
// Set the field type
|
|
@@ -485,6 +495,10 @@ exports.FieldSchemaXML = function (fieldInfo, targetWebUrl) {
|
|
|
485
495
|
case spCfg_1.SPCfgFieldType.Guid:
|
|
486
496
|
createGuid(fieldInfo, props);
|
|
487
497
|
break;
|
|
498
|
+
// Image
|
|
499
|
+
case spCfg_1.SPCfgFieldType.Image:
|
|
500
|
+
createImage(fieldInfo, props);
|
|
501
|
+
break;
|
|
488
502
|
// Lookup
|
|
489
503
|
case spCfg_1.SPCfgFieldType.Lookup:
|
|
490
504
|
createLookup(fieldInfo, props);
|
|
@@ -127,6 +127,53 @@ exports.ListFormField = {
|
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
129
|
},
|
|
130
|
+
// Method to get the folder to store the image field file in
|
|
131
|
+
getOrCreateImageFolder: function (info) {
|
|
132
|
+
// Return a promise
|
|
133
|
+
return new Promise(function (resolve, reject) {
|
|
134
|
+
// Get the site assets library
|
|
135
|
+
(function () {
|
|
136
|
+
return new Promise(function (resolve) {
|
|
137
|
+
__1.Web(info.webUrl).Lists("Site Assets").execute(
|
|
138
|
+
// Exists
|
|
139
|
+
function (lib) {
|
|
140
|
+
// Resolve the request
|
|
141
|
+
resolve(lib);
|
|
142
|
+
},
|
|
143
|
+
// Doesn't Exist
|
|
144
|
+
function () {
|
|
145
|
+
// Create the list
|
|
146
|
+
__1.Web(info.webUrl).Lists().add({
|
|
147
|
+
Title: "SiteAssets",
|
|
148
|
+
BaseTemplate: __1.SPTypes.ListTemplateType.DocumentLibrary
|
|
149
|
+
}).execute(function (lib) {
|
|
150
|
+
// Update the title
|
|
151
|
+
lib.update({ Title: "Site Assets" }).execute(function () {
|
|
152
|
+
// Resolve the request
|
|
153
|
+
resolve(lib);
|
|
154
|
+
}, reject);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
})().then(function (siteAssets) {
|
|
159
|
+
// Get the list id folder
|
|
160
|
+
siteAssets.RootFolder().Folders(info.listId).execute(
|
|
161
|
+
// Exists
|
|
162
|
+
function (folder) {
|
|
163
|
+
// Resolve the request
|
|
164
|
+
resolve(folder);
|
|
165
|
+
},
|
|
166
|
+
// Doesn't Exist
|
|
167
|
+
function () {
|
|
168
|
+
// Create the folder
|
|
169
|
+
siteAssets.RootFolder().Folders().add(info.listId).execute(function (folder) {
|
|
170
|
+
// Resolve the request
|
|
171
|
+
resolve(folder);
|
|
172
|
+
}, reject);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
},
|
|
130
177
|
// Method to load the lookup data
|
|
131
178
|
loadLookupData: function (info, queryTop) {
|
|
132
179
|
// Return a promise
|
package/build/helper/spCfg.js
CHANGED
|
@@ -344,6 +344,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
344
344
|
lists.add(listInfo)
|
|
345
345
|
// Execute the request
|
|
346
346
|
.execute(function (list) {
|
|
347
|
+
cfgList["_list"] = list;
|
|
347
348
|
// Restore the list name in the configuration
|
|
348
349
|
listInfo.Title = listName;
|
|
349
350
|
// See if the request was successful
|
|
@@ -365,7 +366,7 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
365
366
|
resolve(null);
|
|
366
367
|
}
|
|
367
368
|
// Trigger the event
|
|
368
|
-
cfgList.
|
|
369
|
+
cfgList.onCreating ? cfgList.onCreating(list) : null;
|
|
369
370
|
}
|
|
370
371
|
else {
|
|
371
372
|
// Log
|
|
@@ -379,6 +380,12 @@ exports.SPConfig = function (cfg, webUrl) {
|
|
|
379
380
|
}).then(function () {
|
|
380
381
|
// Update the lists
|
|
381
382
|
updateLists(cfgLists).then(function () {
|
|
383
|
+
// Parse the lists
|
|
384
|
+
for (var i = 0; i < cfgLists.length; i++) {
|
|
385
|
+
var cfgList = cfgLists[i];
|
|
386
|
+
// Trigger the event
|
|
387
|
+
cfgList.onCreated ? cfgList.onCreated(cfgList["_list"]) : null;
|
|
388
|
+
}
|
|
382
389
|
// Resolve the promise
|
|
383
390
|
resolve();
|
|
384
391
|
}, reject);
|
|
@@ -12,13 +12,14 @@ exports.SPCfgFieldType = {
|
|
|
12
12
|
Date: 4,
|
|
13
13
|
Geolocation: 5,
|
|
14
14
|
Guid: 6,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
Image: 7,
|
|
16
|
+
Lookup: 8,
|
|
17
|
+
MMS: 9,
|
|
18
|
+
Note: 10,
|
|
19
|
+
Number: 11,
|
|
20
|
+
Text: 12,
|
|
21
|
+
Url: 13,
|
|
22
|
+
User: 14
|
|
22
23
|
};
|
|
23
24
|
/**
|
|
24
25
|
* SharePoint Configuration Types
|
package/build/lib/graph.js
CHANGED
|
@@ -16,9 +16,15 @@ exports.Graph = (function (props) {
|
|
|
16
16
|
graph.targetInfo.data = props ? props.data : null;
|
|
17
17
|
graph.targetInfo.endpoint = props && props.cloud ? props.cloud : exports.Graph.Cloud || sptypes_1.SPTypes.CloudEnvironment.Default;
|
|
18
18
|
graph.targetInfo.endpoint += "/" + (props && props.version ? props.version : exports.Graph.Version || "v1.0");
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
// See if the url is set
|
|
20
|
+
if (props && props.url) {
|
|
21
|
+
// Set the endpoint
|
|
22
|
+
graph.targetInfo.endpoint += "/" + props.url;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// Add the default methods
|
|
26
|
+
utils_1.Request.addMethods(graph, { __metadata: { type: "graph" } });
|
|
27
|
+
}
|
|
22
28
|
// Return the graph
|
|
23
29
|
return graph;
|
|
24
30
|
});
|
package/build/mapper/def.js
CHANGED
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.TargetInfo = void 0;
|
|
15
4
|
var lib_1 = require("../lib");
|
|
@@ -31,9 +20,6 @@ var TargetInfo = /** @class */ (function () {
|
|
|
31
20
|
if (this.isGraph) {
|
|
32
21
|
// Set the request method
|
|
33
22
|
this.requestMethod = this.props.requestType == _1.RequestType.GraphGet || this.props.requestType == _1.RequestType.GraphGetReplace ? "GET" : "POST";
|
|
34
|
-
// Set the security flag
|
|
35
|
-
var defaultProps = this.requestData || {};
|
|
36
|
-
this.requestData = __assign({ securityEnabledOnly: true }, defaultProps);
|
|
37
23
|
// Set the request url
|
|
38
24
|
this.requestUrl = this.props.endpoint;
|
|
39
25
|
}
|
package/dist/gd-sprest.d.ts
CHANGED
|
@@ -936,7 +936,7 @@ declare module 'gd-sprest/lib/contextInfo' {
|
|
|
936
936
|
|
|
937
937
|
declare module 'gd-sprest/lib/graph' {
|
|
938
938
|
import { IBaseExecution } from "gd-sprest-def/lib/base";
|
|
939
|
-
import {
|
|
939
|
+
import { Graph as GraphCore } from "gd-sprest-def/lib/microsoft";
|
|
940
940
|
import { IGraph as IGraphCore, IGraphToken } from "gd-sprest/intellisense/graph";
|
|
941
941
|
import { ITargetInfo } from "gd-sprest/utils";
|
|
942
942
|
|
|
@@ -972,15 +972,15 @@ declare module 'gd-sprest/lib/graph' {
|
|
|
972
972
|
* Graph EndPoints
|
|
973
973
|
*/
|
|
974
974
|
export interface IGraphCustom extends IGraphCore {
|
|
975
|
-
me(): IBaseExecution<
|
|
976
|
-
group(id: string): IBaseExecution<
|
|
977
|
-
groups(): IBaseExecution<
|
|
978
|
-
list(siteId: string, id: string): IBaseExecution<
|
|
979
|
-
lists(siteId: string): IBaseExecution<
|
|
980
|
-
site(id: string): IBaseExecution<
|
|
981
|
-
sites(): IBaseExecution<
|
|
982
|
-
user(id: string): IBaseExecution<
|
|
983
|
-
users(): IBaseExecution<
|
|
975
|
+
me(): IBaseExecution<GraphCore.user>;
|
|
976
|
+
group(id: string): IBaseExecution<GraphCore.group>;
|
|
977
|
+
groups(): IBaseExecution<GraphCore.groupCollections>;
|
|
978
|
+
list(siteId: string, id: string): IBaseExecution<GraphCore.list>;
|
|
979
|
+
lists(siteId: string): IBaseExecution<GraphCore.listCollections>;
|
|
980
|
+
site(id: string): IBaseExecution<GraphCore.site>;
|
|
981
|
+
sites(): IBaseExecution<GraphCore.siteCollections>;
|
|
982
|
+
user(id: string): IBaseExecution<GraphCore.user>;
|
|
983
|
+
users(): IBaseExecution<GraphCore.userCollections>;
|
|
984
984
|
}
|
|
985
985
|
|
|
986
986
|
/**
|
|
@@ -2308,6 +2308,17 @@ declare module 'gd-sprest/helper/listFormField' {
|
|
|
2308
2308
|
showTime?: boolean;
|
|
2309
2309
|
}
|
|
2310
2310
|
|
|
2311
|
+
/**
|
|
2312
|
+
* List Form Image Field Information
|
|
2313
|
+
*/
|
|
2314
|
+
export interface IListFormImageFieldInfo extends IListFormFieldInfo {
|
|
2315
|
+
/** The list id field. */
|
|
2316
|
+
listId?: string;
|
|
2317
|
+
|
|
2318
|
+
/** The web containing the list. */
|
|
2319
|
+
webUrl?: string;
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2311
2322
|
/**
|
|
2312
2323
|
* List Form Lookup Field Information
|
|
2313
2324
|
*/
|
|
@@ -2423,6 +2434,9 @@ declare module 'gd-sprest/helper/listFormField' {
|
|
|
2423
2434
|
*/
|
|
2424
2435
|
create(props: IListFormFieldInfo): PromiseLike<IListFormFieldInfo>;
|
|
2425
2436
|
|
|
2437
|
+
/** Method to get or create the associated folder for a list's image field. */
|
|
2438
|
+
getOrCreateImageFolder(info: IListFormImageFieldInfo): PromiseLike<SP.Folder>;
|
|
2439
|
+
|
|
2426
2440
|
/** Method to load the lookup data */
|
|
2427
2441
|
loadLookupData(info: IListFormLookupFieldInfo, queryTop?: number): PromiseLike<Array<IListItemQuery>>;
|
|
2428
2442
|
|
|
@@ -3469,10 +3483,15 @@ declare module 'gd-sprest/helper/spCfg' {
|
|
|
3469
3483
|
ViewInformation?: Array<ISPCfgViewInfo>;
|
|
3470
3484
|
|
|
3471
3485
|
/**
|
|
3472
|
-
* Event triggered after the list is created
|
|
3486
|
+
* Event triggered after the list is created and configured.
|
|
3473
3487
|
*/
|
|
3474
3488
|
onCreated?: (list: List) => void;
|
|
3475
3489
|
|
|
3490
|
+
/**
|
|
3491
|
+
* Event triggered after the list is created.
|
|
3492
|
+
*/
|
|
3493
|
+
onCreating?: (list: List) => void;
|
|
3494
|
+
|
|
3476
3495
|
/**
|
|
3477
3496
|
* Event triggered after the list is updated.
|
|
3478
3497
|
*/
|
|
@@ -3619,6 +3638,7 @@ declare module 'gd-sprest/helper/spCfgTypes' {
|
|
|
3619
3638
|
Date: number;
|
|
3620
3639
|
Geolocation: number;
|
|
3621
3640
|
Guid: number;
|
|
3641
|
+
Image: number;
|
|
3622
3642
|
Lookup: number;
|
|
3623
3643
|
MMS: number;
|
|
3624
3644
|
Note: number;
|