@lindle/sharepoint_requests 0.1.13 → 0.1.15
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/README.md +5 -0
- package/dist/index.d.ts +17 -17
- package/dist/root/index.d.ts +85 -81
- package/dist/root/instance.d.ts +3 -3
- package/dist/root/internal/context.d.ts +11 -9
- package/dist/root/internal/digest.d.ts +2 -2
- package/dist/root/internal/emailRequests.d.ts +10 -10
- package/dist/root/internal/listRequests/createAttachment.d.ts +3 -3
- package/dist/root/internal/listRequests/createListItem.d.ts +3 -3
- package/dist/root/internal/listRequests/deleteItem.d.ts +3 -3
- package/dist/root/internal/listRequests/getFiles.d.ts +8 -8
- package/dist/root/internal/listRequests/getListItems.d.ts +8 -8
- package/dist/root/internal/listRequests/getOnly.d.ts +3 -3
- package/dist/root/internal/listRequests/index.d.ts +8 -7
- package/dist/root/internal/listRequests/updateListItem.d.ts +3 -3
- package/dist/root/internal/listRequests/uploadFile.d.ts +3 -0
- package/dist/root/internal/odata.d.ts +5 -5
- package/dist/root/internal/userRequests.d.ts +15 -15
- package/dist/sharepoint_requests.cjs.development.js +232 -52
- package/dist/sharepoint_requests.cjs.development.js.map +1 -1
- package/dist/sharepoint_requests.cjs.production.min.js +1 -1
- package/dist/sharepoint_requests.cjs.production.min.js.map +1 -1
- package/dist/sharepoint_requests.esm.js +232 -52
- package/dist/sharepoint_requests.esm.js.map +1 -1
- package/dist/types.d.ts +237 -232
- package/package.json +6 -3
- package/src/root/index.ts +51 -2
- package/src/root/internal/context.ts +2 -0
- package/src/root/internal/listRequests/createListItem.ts +18 -13
- package/src/root/internal/listRequests/index.ts +1 -0
- package/src/root/internal/listRequests/updateListItem.ts +21 -3
- package/src/root/internal/listRequests/uploadFile.ts +66 -0
- package/src/types.ts +10 -5
package/dist/types.d.ts
CHANGED
|
@@ -1,232 +1,237 @@
|
|
|
1
|
-
export
|
|
2
|
-
id?: string;
|
|
3
|
-
type?: string;
|
|
4
|
-
uri?: string;
|
|
5
|
-
etag?: string;
|
|
6
|
-
};
|
|
7
|
-
export
|
|
8
|
-
Attachments: string;
|
|
9
|
-
ContentType: string;
|
|
10
|
-
ContentTypeID: string;
|
|
11
|
-
Created: string;
|
|
12
|
-
CreatedBy: PersonField & _Deferred;
|
|
13
|
-
CreatedById: string;
|
|
14
|
-
Modified: string;
|
|
15
|
-
ModifiedBy: PersonField & _Deferred;
|
|
16
|
-
ModifiedById: string;
|
|
17
|
-
Id: number;
|
|
18
|
-
Title: string;
|
|
19
|
-
Path: string;
|
|
20
|
-
Version: string;
|
|
21
|
-
Owshiddenversion: number;
|
|
22
|
-
__metadata: Metadata;
|
|
23
|
-
};
|
|
24
|
-
export
|
|
25
|
-
__metadata: Metadata;
|
|
26
|
-
FirstUniqueAncestorSecurableObject: _Deferred;
|
|
27
|
-
RoleAssignments: _Deferred;
|
|
28
|
-
AttachmentFiles: _Deferred;
|
|
29
|
-
ContentType: _Deferred;
|
|
30
|
-
GetDlpPolicyTip: _Deferred;
|
|
31
|
-
FieldValuesAsHtml: _Deferred;
|
|
32
|
-
FieldValuesAsText: _Deferred;
|
|
33
|
-
FieldValuesForEdit: _Deferred;
|
|
34
|
-
File: _Deferred;
|
|
35
|
-
Folder: _Deferred;
|
|
36
|
-
ParentList: _Deferred;
|
|
37
|
-
FileSystemObjectType: number;
|
|
38
|
-
Id: number;
|
|
39
|
-
ContentTypeId: string;
|
|
40
|
-
Title: string;
|
|
41
|
-
PhotoRefId?: number;
|
|
42
|
-
ID: number;
|
|
43
|
-
Modified: string;
|
|
44
|
-
Created: string;
|
|
45
|
-
AuthorId: number;
|
|
46
|
-
EditorId: number;
|
|
47
|
-
OData__UIVersionString?: string;
|
|
48
|
-
Attachments: boolean;
|
|
49
|
-
GUID: string;
|
|
50
|
-
Author?: PersonField & _Deferred;
|
|
51
|
-
Editor?: PersonField & _Deferred;
|
|
52
|
-
[key: string]: unknown;
|
|
53
|
-
};
|
|
54
|
-
export
|
|
55
|
-
|
|
56
|
-
export interface Options<K = any, V extends SHAREPOINT_VER = '2013'> {
|
|
57
|
-
expand?: ListFields<K, V>[] | ListFields<K, V>;
|
|
58
|
-
orderBy?: ListFields<K, V> | [ListFields<K, V>, 'asc' | 'desc'];
|
|
59
|
-
limit?: number;
|
|
60
|
-
filter?: string;
|
|
61
|
-
cols?: ListFields<K, V>[] | ListFields<K, V>;
|
|
62
|
-
skip?: number;
|
|
63
|
-
}
|
|
64
|
-
export interface Folder_Options<K = any> {
|
|
65
|
-
type: 'Files' | 'Folders';
|
|
66
|
-
expand?: Extract<keyof K, string>[] | Extract<keyof K, string>;
|
|
67
|
-
orderBy?: Extract<keyof K, string> | [Extract<keyof K, string>, 'asc' | 'desc'];
|
|
68
|
-
limit?: number;
|
|
69
|
-
filter?: string;
|
|
70
|
-
cols?: Extract<keyof K, string>[] | Extract<keyof K, string>;
|
|
71
|
-
skip?: number;
|
|
72
|
-
}
|
|
73
|
-
export interface Field_Options<K, V extends SHAREPOINT_VER = '2013'> extends Omit<Options<K, V>, 'filter'> {
|
|
74
|
-
fieldName?: Extract<keyof K, string>;
|
|
75
|
-
}
|
|
76
|
-
export
|
|
77
|
-
export
|
|
78
|
-
export
|
|
79
|
-
export
|
|
80
|
-
file: File;
|
|
81
|
-
itemId: ItemID;
|
|
82
|
-
};
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
};
|
|
100
|
-
export
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
};
|
|
105
|
-
export
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
};
|
|
232
|
-
|
|
1
|
+
export type Metadata = {
|
|
2
|
+
id?: string;
|
|
3
|
+
type?: string;
|
|
4
|
+
uri?: string;
|
|
5
|
+
etag?: string;
|
|
6
|
+
};
|
|
7
|
+
export type SPItem2010 = {
|
|
8
|
+
Attachments: string;
|
|
9
|
+
ContentType: string;
|
|
10
|
+
ContentTypeID: string;
|
|
11
|
+
Created: string;
|
|
12
|
+
CreatedBy: PersonField & _Deferred;
|
|
13
|
+
CreatedById: string;
|
|
14
|
+
Modified: string;
|
|
15
|
+
ModifiedBy: PersonField & _Deferred;
|
|
16
|
+
ModifiedById: string;
|
|
17
|
+
Id: number;
|
|
18
|
+
Title: string;
|
|
19
|
+
Path: string;
|
|
20
|
+
Version: string;
|
|
21
|
+
Owshiddenversion: number;
|
|
22
|
+
__metadata: Metadata;
|
|
23
|
+
};
|
|
24
|
+
export type SPItem2013 = {
|
|
25
|
+
__metadata: Metadata;
|
|
26
|
+
FirstUniqueAncestorSecurableObject: _Deferred;
|
|
27
|
+
RoleAssignments: _Deferred;
|
|
28
|
+
AttachmentFiles: _Deferred;
|
|
29
|
+
ContentType: _Deferred;
|
|
30
|
+
GetDlpPolicyTip: _Deferred;
|
|
31
|
+
FieldValuesAsHtml: _Deferred;
|
|
32
|
+
FieldValuesAsText: _Deferred;
|
|
33
|
+
FieldValuesForEdit: _Deferred;
|
|
34
|
+
File: _Deferred;
|
|
35
|
+
Folder: _Deferred;
|
|
36
|
+
ParentList: _Deferred;
|
|
37
|
+
FileSystemObjectType: number;
|
|
38
|
+
Id: number;
|
|
39
|
+
ContentTypeId: string;
|
|
40
|
+
Title: string;
|
|
41
|
+
PhotoRefId?: number;
|
|
42
|
+
ID: number;
|
|
43
|
+
Modified: string;
|
|
44
|
+
Created: string;
|
|
45
|
+
AuthorId: number;
|
|
46
|
+
EditorId: number;
|
|
47
|
+
OData__UIVersionString?: string;
|
|
48
|
+
Attachments: boolean;
|
|
49
|
+
GUID: string;
|
|
50
|
+
Author?: PersonField & _Deferred;
|
|
51
|
+
Editor?: PersonField & _Deferred;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
export type SPItem<V extends SHAREPOINT_VER = '2013'> = V extends '2010' ? SPItem2010 : SPItem2013;
|
|
55
|
+
type ListFields<K, V extends SHAREPOINT_VER = '2013'> = Extract<keyof K, string> | Extract<keyof SPItem<V>, string>;
|
|
56
|
+
export interface Options<K = any, V extends SHAREPOINT_VER = '2013'> {
|
|
57
|
+
expand?: ListFields<K, V>[] | ListFields<K, V>;
|
|
58
|
+
orderBy?: ListFields<K, V> | [ListFields<K, V>, 'asc' | 'desc'];
|
|
59
|
+
limit?: number;
|
|
60
|
+
filter?: string;
|
|
61
|
+
cols?: ListFields<K, V>[] | ListFields<K, V>;
|
|
62
|
+
skip?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface Folder_Options<K = any> {
|
|
65
|
+
type: 'Files' | 'Folders';
|
|
66
|
+
expand?: Extract<keyof K, string>[] | Extract<keyof K, string>;
|
|
67
|
+
orderBy?: Extract<keyof K, string> | [Extract<keyof K, string>, 'asc' | 'desc'];
|
|
68
|
+
limit?: number;
|
|
69
|
+
filter?: string;
|
|
70
|
+
cols?: Extract<keyof K, string>[] | Extract<keyof K, string>;
|
|
71
|
+
skip?: number;
|
|
72
|
+
}
|
|
73
|
+
export interface Field_Options<K, V extends SHAREPOINT_VER = '2013'> extends Omit<Options<K, V>, 'filter'> {
|
|
74
|
+
fieldName?: Extract<keyof K, string>;
|
|
75
|
+
}
|
|
76
|
+
export type SHAREPOINT_VER = '2010' | '2013';
|
|
77
|
+
export type IListName<T> = Extract<keyof T, string>;
|
|
78
|
+
export type ItemID = string | number;
|
|
79
|
+
export type CreateFileProps = {
|
|
80
|
+
file: File;
|
|
81
|
+
itemId: ItemID;
|
|
82
|
+
};
|
|
83
|
+
export type UploadFileProps = {
|
|
84
|
+
file: File;
|
|
85
|
+
folderPath?: string | string[];
|
|
86
|
+
overwrite?: boolean;
|
|
87
|
+
};
|
|
88
|
+
export type ListData = {
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
__metadata?: {
|
|
91
|
+
type: string;
|
|
92
|
+
};
|
|
93
|
+
} | any;
|
|
94
|
+
export type EmailProps = {
|
|
95
|
+
From: string;
|
|
96
|
+
To: string[] | string;
|
|
97
|
+
Subject?: string;
|
|
98
|
+
Body: string;
|
|
99
|
+
};
|
|
100
|
+
export type _Deferred = {
|
|
101
|
+
__deferred: {
|
|
102
|
+
uri: string;
|
|
103
|
+
};
|
|
104
|
+
};
|
|
105
|
+
export type LookupField<T> = _Deferred & T;
|
|
106
|
+
export type ChoiceField<T> = _Deferred & {
|
|
107
|
+
Value: T;
|
|
108
|
+
__metadata: Metadata;
|
|
109
|
+
};
|
|
110
|
+
export type PersonField = {
|
|
111
|
+
AboutMe?: string;
|
|
112
|
+
Account: string;
|
|
113
|
+
AccountName: string;
|
|
114
|
+
AdministrativeSupervisor: string;
|
|
115
|
+
AskMeAbout?: string;
|
|
116
|
+
AskMeAbout0?: string;
|
|
117
|
+
Assistant?: string;
|
|
118
|
+
Attachments: unknown;
|
|
119
|
+
BuildingName: string;
|
|
120
|
+
BusinessLine: string;
|
|
121
|
+
CellPhone?: string;
|
|
122
|
+
City?: string;
|
|
123
|
+
Company: string;
|
|
124
|
+
CompanyCode: string;
|
|
125
|
+
ContentType: string;
|
|
126
|
+
ContentTypeID: string;
|
|
127
|
+
CostCenter: string;
|
|
128
|
+
Country: string;
|
|
129
|
+
Created: string;
|
|
130
|
+
CreatedBy: PersonField;
|
|
131
|
+
CreatedById: number;
|
|
132
|
+
Deleted: boolean;
|
|
133
|
+
Department: string;
|
|
134
|
+
Department0?: string;
|
|
135
|
+
Division: string;
|
|
136
|
+
Fax?: string;
|
|
137
|
+
FirstName: string;
|
|
138
|
+
Hidden: boolean;
|
|
139
|
+
Id?: string;
|
|
140
|
+
Id0: number;
|
|
141
|
+
Interests?: string;
|
|
142
|
+
IsSiteAdmin: boolean;
|
|
143
|
+
JobTitle?: string;
|
|
144
|
+
LANID: string;
|
|
145
|
+
LastName: string;
|
|
146
|
+
Manager: string;
|
|
147
|
+
MobilePhone: string;
|
|
148
|
+
Modified: string;
|
|
149
|
+
ModifiedBy: PersonField;
|
|
150
|
+
ModifiedById: number;
|
|
151
|
+
Name: string;
|
|
152
|
+
Office: string;
|
|
153
|
+
OfficeLocation?: string;
|
|
154
|
+
Owshiddenversion: number;
|
|
155
|
+
Pager?: string;
|
|
156
|
+
Path: string;
|
|
157
|
+
Picture: string;
|
|
158
|
+
PictureExchangeSyncState: number;
|
|
159
|
+
PicturePlaceholderState: number;
|
|
160
|
+
PictureTimestamp: string;
|
|
161
|
+
SIPAddress?: string;
|
|
162
|
+
Schools?: string;
|
|
163
|
+
Skills?: string;
|
|
164
|
+
State: string;
|
|
165
|
+
Title: string;
|
|
166
|
+
UserName: string;
|
|
167
|
+
Version: string;
|
|
168
|
+
WebSite?: string;
|
|
169
|
+
WorkEmail: string;
|
|
170
|
+
WorkHistory?: string;
|
|
171
|
+
WorkPhone?: string;
|
|
172
|
+
__metadata: Metadata;
|
|
173
|
+
};
|
|
174
|
+
export type MultiPersonField = {
|
|
175
|
+
results: PersonField[];
|
|
176
|
+
};
|
|
177
|
+
export type PermissionLabel = 'Full Control' | 'Edit' | 'Contribute' | 'Read';
|
|
178
|
+
export type UserPermision = {
|
|
179
|
+
BasePermissions: {
|
|
180
|
+
High: string;
|
|
181
|
+
Low: string;
|
|
182
|
+
__metadata: {
|
|
183
|
+
type: 'SP.BasePermissions';
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
Description: string;
|
|
187
|
+
Hidden: boolean;
|
|
188
|
+
Id: number;
|
|
189
|
+
Name: PermissionLabel;
|
|
190
|
+
Order: number;
|
|
191
|
+
RoleTypeKind: number;
|
|
192
|
+
__metadata: Metadata;
|
|
193
|
+
};
|
|
194
|
+
export type CurrentUser = {
|
|
195
|
+
Email: string;
|
|
196
|
+
Id: number;
|
|
197
|
+
IsHiddenInUI: boolean;
|
|
198
|
+
LoginName: string;
|
|
199
|
+
PrincipalType: number;
|
|
200
|
+
Title: string;
|
|
201
|
+
__metadata: Metadata;
|
|
202
|
+
};
|
|
203
|
+
export type UserProfilePropKey = 'UserProfile_GUID' | 'SID' | 'FirstName' | 'ADGuid' | 'SPS-PhoneticFirstName' | 'LastName' | 'XOM-LANID' | 'UserName' | 'SPS-PhoneticLastName' | 'AccountName' | 'PictureURL' | 'MiddleName' | 'PreferredName' | 'PhoenticName' | 'SPS-PhoneticDisplayName' | 'SPS-JobTitle' | 'Title' | 'BuildingName' | 'Office' | 'WorkPhone' | 'SPS-SipAddress' | 'CellPhone' | 'HomePhone' | 'Pager' | 'Fax' | 'WorkEmail' | 'SPS-Location' | 'State' | 'Country' | 'Assistant' | 'SPS-RegionalSettings-FollowWeb' | 'SPS-Locale' | 'SPS-CalendarType' | 'SPS-AltCalendarType' | 'SPS-AdjustHijriDays' | 'SPS-ShowWeeks' | 'SPS-WorkDays' | 'SPS-WorkDayStartHour' | 'SPS-WorkDayEndHour' | 'SPS-Time24' | 'SPS-FirstDayOfWeek' | 'SPS-FirstWeekOfYear' | 'SPS-RegionalSettings-Initialized' | 'SPS-TimeZone' | 'Company' | 'Division' | 'BusinessLine' | 'SPS-Department' | 'Department' | 'XOM-CompanyCode' | 'Manager' | 'SPS-Dotted-line' | 'XOM-CostCenter' | 'SPS-HireDate' | 'AboutMe' | 'SPS-Responsibility' | 'SPS-PastProjects' | 'WorkHistory' | 'SPS-Skills' | 'SPS-Interests' | 'SPS-School' | 'SPS-Birthday' | 'WebSite' | 'PersonalSpace' | 'PublicSiteRedirect' | 'QuickLinks' | 'SPS-DataSource' | 'SPS-Memberof' | 'SPS-Peers' | 'SPS-MySiteUpgrade' | 'SPS-DontSuggestList' | 'SPS-ProxyAddresses' | 'SPS-LastColleagueAdded' | 'SPS-OWAUrl' | 'SPS-ResourceSID' | 'SPS-ResourceAccountName' | 'SPS-MasterAccountName' | 'SPS-DistinguishedName' | 'SPS-SourceObjectDN' | 'SPS-LastKeywordAdded' | 'SPS-StatusNotes' | 'SPS-DisplayOrder' | 'SPS-ClaimID' | 'SPS-ClaimProviderID' | 'SPS-ClaimProviderType' | 'SPS-SavedAccountName' | 'SPS-SavedSID' | 'SPS-ObjectExists' | 'SPS-PersonalSiteCapabilities' | 'SPS-UserPrincipalName' | 'SPS-O15FirstRunExperience' | 'SPS-PersonalSiteInstantiationState' | 'SPS-PersonalSiteFirstCreationTime' | 'SPS-PersonalSiteLastCreationTime' | 'SPS-PersonalSiteNumberOfRetries' | 'SPS-PersonalSiteFirstCreationError' | 'SPS-FeedIdentifier' | 'SPS-HashTags' | 'SPS-PrivacyPeople' | 'SPS-EmailOptin' | 'SPS-PrivacyActivity' | 'SPS-PictureTimestamp' | 'SPS-PicturePlaceholderState' | 'SPS-PictureExchangeSyncState' | 'SPS-MUILanguages' | 'SPS-ContentLanguages' | 'OfficeGraphEnabled' | 'SPS-UserType' | 'SPS-HideFromAddressLists' | 'SPS-RecipientTypeDetails' | 'DelveFlags' | 'PulseMRUPeople' | 'msOnline-ObjectId' | 'SPS-PointPublishingUrl' | 'SPS-TenantInstanceId' | 'SPS-SharePointHomeExperienceState' | 'SPS-MultiGeoFlags' | 'PreferredDataLocation' | 'PrivacyNotified' | 'PrivacyNotifiedDate' | 'O365' | 'O365MigrationDate';
|
|
204
|
+
export type UserProfile = {
|
|
205
|
+
AccountName: string;
|
|
206
|
+
Country: string;
|
|
207
|
+
DisplayName: string;
|
|
208
|
+
Email: string;
|
|
209
|
+
ExtendedManagers: {
|
|
210
|
+
results: string[];
|
|
211
|
+
__metadata: Metadata;
|
|
212
|
+
};
|
|
213
|
+
ExtendedReports: {
|
|
214
|
+
results: string[];
|
|
215
|
+
__metadata: Metadata;
|
|
216
|
+
};
|
|
217
|
+
FirstName: string;
|
|
218
|
+
IsFollowed: boolean;
|
|
219
|
+
LastName: string;
|
|
220
|
+
PersonalUrl: string;
|
|
221
|
+
PictureUrl: string;
|
|
222
|
+
Title: string;
|
|
223
|
+
UserName: string;
|
|
224
|
+
UserProfileProperties: {
|
|
225
|
+
results: {
|
|
226
|
+
Key: UserProfilePropKey;
|
|
227
|
+
Value: string;
|
|
228
|
+
ValueType: string;
|
|
229
|
+
__metadata: {
|
|
230
|
+
type: string;
|
|
231
|
+
};
|
|
232
|
+
}[];
|
|
233
|
+
};
|
|
234
|
+
UserUrl: string;
|
|
235
|
+
__metadata: Metadata;
|
|
236
|
+
};
|
|
237
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.15",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
@@ -37,8 +37,11 @@
|
|
|
37
37
|
"husky": "^9.1.4",
|
|
38
38
|
"size-limit": "^11.1.4",
|
|
39
39
|
"tsdx": "^0.14.1",
|
|
40
|
-
"tslib": "^2.
|
|
41
|
-
"typescript": "^
|
|
40
|
+
"tslib": "^2.8.0",
|
|
41
|
+
"typescript": "^5.6.3"
|
|
42
|
+
},
|
|
43
|
+
"overrides": {
|
|
44
|
+
"typescript": "^5.6.3"
|
|
42
45
|
},
|
|
43
46
|
"dependencies": {
|
|
44
47
|
"axios": "^1.7.4",
|
package/src/root/index.ts
CHANGED
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
EmailProps,
|
|
7
7
|
Field_Options,
|
|
8
8
|
Folder_Options,
|
|
9
|
+
UploadFileProps,
|
|
9
10
|
IListName,
|
|
10
11
|
ItemID,
|
|
11
12
|
ListData,
|
|
@@ -24,6 +25,7 @@ import {
|
|
|
24
25
|
getListItems,
|
|
25
26
|
getOnly,
|
|
26
27
|
updateListItem,
|
|
28
|
+
uploadFile,
|
|
27
29
|
} from './internal/listRequests';
|
|
28
30
|
import { sendEmail as sendEmailRequest } from './internal/emailRequests';
|
|
29
31
|
import {
|
|
@@ -32,6 +34,7 @@ import {
|
|
|
32
34
|
getSiteUser as fetchSiteUser,
|
|
33
35
|
typeAhead,
|
|
34
36
|
} from './internal/userRequests';
|
|
37
|
+
import { fetchDigest } from './internal/digest';
|
|
35
38
|
|
|
36
39
|
class HTTPSharePointRequests<
|
|
37
40
|
T extends {
|
|
@@ -44,6 +47,7 @@ class HTTPSharePointRequests<
|
|
|
44
47
|
private listName: string;
|
|
45
48
|
private instance: AxiosInstance;
|
|
46
49
|
private sharepointVersion: SHAREPOINT_VER;
|
|
50
|
+
private listItemEntityTypeFullName?: string;
|
|
47
51
|
|
|
48
52
|
constructor(baseURL: string, config?: AxiosConfig) {
|
|
49
53
|
this.baseURL = baseURL.endsWith('/') ? baseURL : `${baseURL}/`;
|
|
@@ -51,6 +55,7 @@ class HTTPSharePointRequests<
|
|
|
51
55
|
this.listName = '';
|
|
52
56
|
this.instance = instance(this.baseURL, config);
|
|
53
57
|
this.sharepointVersion = '2013';
|
|
58
|
+
this.listItemEntityTypeFullName = undefined;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
private getContext<V extends SHAREPOINT_VER = '2013'>(): RequestContext<V> {
|
|
@@ -60,9 +65,45 @@ class HTTPSharePointRequests<
|
|
|
60
65
|
endpoint: this.endpoint,
|
|
61
66
|
listName: this.listName,
|
|
62
67
|
sharepointVersion: this.sharepointVersion as V,
|
|
68
|
+
listItemEntityTypeFullName: this.listItemEntityTypeFullName,
|
|
69
|
+
resolveListItemEntityType: this.resolveListItemEntityTypeFullName.bind(
|
|
70
|
+
this
|
|
71
|
+
),
|
|
63
72
|
};
|
|
64
73
|
}
|
|
65
74
|
|
|
75
|
+
private async resolveListItemEntityTypeFullName(): Promise<string> {
|
|
76
|
+
if (this.listItemEntityTypeFullName) {
|
|
77
|
+
return this.listItemEntityTypeFullName;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (!this.listName) {
|
|
81
|
+
throw new Error('List name is not set.');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (this.sharepointVersion !== '2013') {
|
|
85
|
+
this.listItemEntityTypeFullName = `SP.Data.${this.listName}ListItem`;
|
|
86
|
+
return this.listItemEntityTypeFullName;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const response = await this.instance.get(
|
|
90
|
+
`_api/web/lists/GetByTitle('${this.listName}')?$select=ListItemEntityTypeFullName`
|
|
91
|
+
);
|
|
92
|
+
|
|
93
|
+
const entityType =
|
|
94
|
+
response.data?.d?.ListItemEntityTypeFullName ??
|
|
95
|
+
response.data?.ListItemEntityTypeFullName;
|
|
96
|
+
|
|
97
|
+
if (!entityType || typeof entityType !== 'string') {
|
|
98
|
+
throw new Error(
|
|
99
|
+
`Unable to resolve ListItemEntityTypeFullName for list "${this.listName}".`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
this.listItemEntityTypeFullName = entityType;
|
|
104
|
+
return this.listItemEntityTypeFullName;
|
|
105
|
+
}
|
|
106
|
+
|
|
66
107
|
/**
|
|
67
108
|
* @deprecated Use `from` instead.
|
|
68
109
|
*/
|
|
@@ -70,6 +111,7 @@ class HTTPSharePointRequests<
|
|
|
70
111
|
this.listName = listName;
|
|
71
112
|
this.endpoint = `_vti_bin/ListData.svc/${listName}`;
|
|
72
113
|
this.sharepointVersion = '2010';
|
|
114
|
+
this.listItemEntityTypeFullName = undefined;
|
|
73
115
|
return this;
|
|
74
116
|
}
|
|
75
117
|
|
|
@@ -81,7 +123,11 @@ class HTTPSharePointRequests<
|
|
|
81
123
|
},
|
|
82
124
|
};
|
|
83
125
|
|
|
84
|
-
|
|
126
|
+
public getDigest() {
|
|
127
|
+
return fetchDigest(this.instance, this.baseURL);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
public from<
|
|
85
131
|
K extends Extract<keyof T['LISTS'], string>,
|
|
86
132
|
V extends SHAREPOINT_VER = '2013'
|
|
87
133
|
>(listName: K, sharepoint_ver?: V) {
|
|
@@ -89,6 +135,7 @@ class HTTPSharePointRequests<
|
|
|
89
135
|
|
|
90
136
|
this.listName = listName;
|
|
91
137
|
this.sharepointVersion = version;
|
|
138
|
+
this.listItemEntityTypeFullName = undefined;
|
|
92
139
|
this.endpoint =
|
|
93
140
|
version === '2013'
|
|
94
141
|
? `_api/web/lists/GetByTitle('${this.listName}')/items`
|
|
@@ -105,12 +152,14 @@ class HTTPSharePointRequests<
|
|
|
105
152
|
delete: (id: ItemID) => deleteItem(getContext(), id),
|
|
106
153
|
createFile: (props: CreateFileProps) =>
|
|
107
154
|
createAttachment(getContext(), props),
|
|
155
|
+
uploadFile: (props: UploadFileProps) => uploadFile(getContext(), props),
|
|
108
156
|
fields: (options?: Field_Options<T['LISTS'][K], V>) => {
|
|
109
157
|
this.endpoint = !options?.fieldName
|
|
110
158
|
? `_api/web/lists/GetByTitle('${this.listName}')/fields`
|
|
111
159
|
: `_api/web/lists/GetByTitle('${this.listName}')/fields/getbytitle('${options.fieldName}')`;
|
|
112
160
|
return {
|
|
113
|
-
get: () =>
|
|
161
|
+
get: () =>
|
|
162
|
+
getOnly<T['LISTS'][K], V>(this.instance, this.endpoint, options),
|
|
114
163
|
};
|
|
115
164
|
},
|
|
116
165
|
};
|