@lindle/sharepoint_requests 0.1.18 → 0.1.19

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.
Files changed (47) hide show
  1. package/README.md +121 -116
  2. package/dist/index.d.ts +2 -2
  3. package/dist/root/index.d.ts +104 -29
  4. package/dist/root/internal/context.d.ts +2 -2
  5. package/dist/root/internal/digest.d.ts +1 -1
  6. package/dist/root/internal/emailRequests.d.ts +3 -3
  7. package/dist/root/internal/listRequests/createAttachment.d.ts +2 -2
  8. package/dist/root/internal/listRequests/createListItem.d.ts +2 -2
  9. package/dist/root/internal/listRequests/deleteFile.d.ts +2 -2
  10. package/dist/root/internal/listRequests/deleteItem.d.ts +2 -2
  11. package/dist/root/internal/listRequests/getFiles.d.ts +2 -2
  12. package/dist/root/internal/listRequests/getListItems.d.ts +3 -3
  13. package/dist/root/internal/listRequests/getOnly.d.ts +2 -2
  14. package/dist/root/internal/listRequests/normalizePayload.d.ts +1 -1
  15. package/dist/root/internal/listRequests/updateListItem.d.ts +2 -2
  16. package/dist/root/internal/listRequests/uploadFile.d.ts +3 -3
  17. package/dist/root/internal/odata.d.ts +1 -1
  18. package/dist/root/internal/sharepointUrl.d.ts +2 -0
  19. package/dist/root/internal/userRequests.d.ts +3 -3
  20. package/dist/sharepoint_requests.cjs.development.js +397 -225
  21. package/dist/sharepoint_requests.cjs.development.js.map +1 -1
  22. package/dist/sharepoint_requests.cjs.production.min.js +1 -1
  23. package/dist/sharepoint_requests.cjs.production.min.js.map +1 -1
  24. package/dist/sharepoint_requests.esm.js +397 -225
  25. package/dist/sharepoint_requests.esm.js.map +1 -1
  26. package/dist/types.d.ts +10 -6
  27. package/package.json +1 -1
  28. package/src/index.ts +3 -5
  29. package/src/root/index.ts +260 -145
  30. package/src/root/internal/context.ts +2 -2
  31. package/src/root/internal/digest.ts +4 -3
  32. package/src/root/internal/emailRequests.ts +4 -7
  33. package/src/root/internal/listRequests/createAttachment.ts +14 -3
  34. package/src/root/internal/listRequests/createListItem.ts +18 -12
  35. package/src/root/internal/listRequests/deleteFile.ts +4 -3
  36. package/src/root/internal/listRequests/deleteItem.ts +17 -3
  37. package/src/root/internal/listRequests/getFiles.ts +4 -10
  38. package/src/root/internal/listRequests/getListItems.ts +16 -9
  39. package/src/root/internal/listRequests/getOnly.ts +10 -7
  40. package/src/root/internal/listRequests/normalizePayload.ts +1 -1
  41. package/src/root/internal/listRequests/updateListItem.ts +24 -14
  42. package/src/root/internal/listRequests/uploadFile.ts +5 -8
  43. package/src/root/internal/listRequests/utils.ts +1 -1
  44. package/src/root/internal/odata.ts +2 -4
  45. package/src/root/internal/sharepointUrl.ts +7 -0
  46. package/src/root/internal/userRequests.ts +43 -11
  47. package/src/types.ts +152 -148
@@ -1,10 +1,24 @@
1
- import type { SHAREPOINT_VER } from '../../../types';
2
- import type { RequestContext } from '../context';
1
+ import { SHAREPOINT_VER } from '../../../types';
2
+ import { RequestContext } from '../context';
3
+ import { fetchDigest } from '../digest';
4
+ import { buildListByTitleEndpoint } from '../sharepointUrl';
3
5
 
4
6
  export async function deleteItem<V extends SHAREPOINT_VER = '2013'>(
5
7
  context: RequestContext<V>,
6
8
  id: number | string
7
9
  ) {
8
- const response = await context.instance.delete(`${context.endpoint}(${id})`);
10
+ const requestDigest = await fetchDigest(context.instance, context.baseURL);
11
+ const url =
12
+ context.sharepointVersion === '2013'
13
+ ? `${buildListByTitleEndpoint(context.listName)}/items(${id})`
14
+ : `${context.endpoint}(${id})`;
15
+
16
+ const response = await context.instance.post(url, undefined, {
17
+ headers: {
18
+ 'X-RequestDigest': requestDigest,
19
+ 'IF-MATCH': '*',
20
+ 'X-HTTP-Method': 'DELETE',
21
+ },
22
+ });
9
23
  return response;
10
24
  }
@@ -1,11 +1,8 @@
1
- import type { Folder_Options, SHAREPOINT_VER } from '../../../types';
1
+ import { Folder_Options, SHAREPOINT_VER } from '../../../types';
2
2
  import { appendParamsToUrl, buildODataParams } from '../odata';
3
- import type { RequestContext } from '../context';
3
+ import { RequestContext } from '../context';
4
4
 
5
- export async function getFiles<
6
- T,
7
- V extends SHAREPOINT_VER = '2013'
8
- >(
5
+ export async function getFiles<T, V extends SHAREPOINT_VER = '2013'>(
9
6
  context: RequestContext<V>,
10
7
  options?: Folder_Options<T>
11
8
  ) {
@@ -20,10 +17,7 @@ export async function getFiles<
20
17
  params,
21
18
  });
22
19
 
23
- const data =
24
- options?.limit || !response.data.d.results
25
- ? response.data.d
26
- : response.data.d.results;
20
+ const data = response.data?.d?.results ?? response.data?.d ?? response.data;
27
21
 
28
22
  const meta = { url };
29
23
 
@@ -1,14 +1,14 @@
1
- import type { Options, SPItem, SHAREPOINT_VER } from '../../../types';
1
+ import { Options, SPItem, SHAREPOINT_VER } from '../../../types';
2
2
  import { appendParamsToUrl, buildODataParams } from '../odata';
3
- import type { RequestContext } from '../context';
3
+ import { RequestContext } from '../context';
4
4
 
5
- export async function getListItems<
6
- K,
7
- V extends SHAREPOINT_VER = '2013'
8
- >(
5
+ export async function getListItems<K, V extends SHAREPOINT_VER = '2013'>(
9
6
  context: RequestContext<V>,
10
7
  options?: Options<K, V>
11
- ): Promise<{ data: (K & Partial<SPItem<V>>)[]; meta: { url: URL } }> {
8
+ ): Promise<{
9
+ data: (K & Partial<SPItem<V>>) | (K & Partial<SPItem<V>>)[] | undefined;
10
+ meta: { url: URL };
11
+ }> {
12
12
  const params = buildODataParams(options, ' ');
13
13
 
14
14
  const url = new URL(context.endpoint, context.instance.defaults.baseURL);
@@ -20,7 +20,8 @@ export async function getListItems<
20
20
  params,
21
21
  });
22
22
 
23
- const rawData = response.data?.d?.results ?? response.data?.d ?? response.data;
23
+ const rawData =
24
+ response.data?.d?.results ?? response.data?.d ?? response.data;
24
25
  const cols = options?.cols;
25
26
  const keys = cols
26
27
  ? (Array.isArray(cols) ? cols : [cols]).filter(Boolean)
@@ -46,5 +47,11 @@ export async function getListItems<
46
47
 
47
48
  const meta = { url };
48
49
 
49
- return { data: data as (K & Partial<SPItem<V>>)[], meta };
50
+ return {
51
+ data: data as
52
+ | (K & Partial<SPItem<V>>)
53
+ | (K & Partial<SPItem<V>>)[]
54
+ | undefined,
55
+ meta,
56
+ };
50
57
  }
@@ -1,18 +1,21 @@
1
- import type { AxiosInstance } from 'axios';
2
- import type { Options, SHAREPOINT_VER } from '../../../types';
1
+ import { AxiosInstance } from 'axios';
2
+ import { Options, SHAREPOINT_VER } from '../../../types';
3
3
  import { buildODataParams } from '../odata';
4
4
 
5
- export async function getOnly<
6
- T,
7
- V extends SHAREPOINT_VER = '2013'
8
- >(
5
+ export async function getOnly<T, V extends SHAREPOINT_VER = '2013'>(
9
6
  instance: AxiosInstance,
10
7
  endpoint: string,
11
8
  options?: Options<T, V>
12
9
  ) {
13
10
  const params = buildODataParams(options, ',');
14
11
  const { data } = await instance.get(endpoint, { params });
15
- if (data) {
12
+ if (!data) {
13
+ return undefined;
14
+ }
15
+
16
+ if (data.d) {
16
17
  return data.d.results ? data.d.results : data.d;
17
18
  }
19
+
20
+ return data;
18
21
  }
@@ -1,4 +1,4 @@
1
- import type { ListData } from '../../../types';
1
+ import { ListData } from '../../../types';
2
2
 
3
3
  type AnyRecord = Record<string, unknown>;
4
4
 
@@ -1,7 +1,8 @@
1
- import type { ListData, SHAREPOINT_VER } from '../../../types';
1
+ import { ListData, SHAREPOINT_VER } from '../../../types';
2
2
  import { fetchDigest } from '../digest';
3
- import type { RequestContext } from '../context';
3
+ import { RequestContext } from '../context';
4
4
  import { normalizeListPayload } from './normalizePayload';
5
+ import { buildListByTitleEndpoint } from '../sharepointUrl';
5
6
 
6
7
  async function resolveMetadataType<V extends SHAREPOINT_VER>(
7
8
  context: RequestContext<V>
@@ -29,19 +30,28 @@ export async function updateListItem<
29
30
  const formDigestValue =
30
31
  digest || (await fetchDigest(context.instance, context.baseURL));
31
32
 
32
- const metadataType = await resolveMetadataType(context);
33
33
  const normalizedData = normalizeListPayload(data);
34
- const userMetadata = (data as { __metadata?: Record<string, unknown> })
35
- .__metadata;
36
- const payload = {
37
- ...normalizedData,
38
- __metadata: {
39
- ...(userMetadata && typeof userMetadata === 'object' ? userMetadata : {}),
40
- type: metadataType,
41
- },
42
- };
34
+ let payload: Record<string, unknown> = normalizedData;
35
+
36
+ if (context.sharepointVersion === '2013') {
37
+ const metadataType = await resolveMetadataType(context);
38
+ const userMetadata = (data as { __metadata?: Record<string, unknown> })
39
+ .__metadata;
40
+ payload = {
41
+ ...normalizedData,
42
+ __metadata: {
43
+ ...(userMetadata && typeof userMetadata === 'object'
44
+ ? userMetadata
45
+ : {}),
46
+ type: metadataType,
47
+ },
48
+ };
49
+ }
43
50
 
44
- const url = `_api/lists/getbytitle('${context.listName}')/getItemById('${id}')`;
51
+ const url =
52
+ context.sharepointVersion === '2013'
53
+ ? `${buildListByTitleEndpoint(context.listName)}/items(${id})`
54
+ : `${context.endpoint}(${id})`;
45
55
 
46
56
  const response = await context.instance({
47
57
  url,
@@ -50,7 +60,7 @@ export async function updateListItem<
50
60
  headers: {
51
61
  'X-RequestDigest': formDigestValue,
52
62
  'IF-MATCH': '*',
53
- 'X-Http-Method': 'PATCH',
63
+ 'X-HTTP-Method': 'MERGE',
54
64
  },
55
65
  });
56
66
 
@@ -1,12 +1,9 @@
1
- import type { AxiosResponse } from 'axios';
2
- import type {
3
- ItemID,
4
- SHAREPOINT_VER,
5
- UploadFileProps,
6
- } from '../../../types';
1
+ import { AxiosResponse } from 'axios';
2
+ import { ItemID, SHAREPOINT_VER, UploadFileProps } from '../../../types';
7
3
  import { fetchDigest } from '../digest';
8
- import type { RequestContext } from '../context';
4
+ import { RequestContext } from '../context';
9
5
  import { buildLibraryPath, encodeFileName } from './utils';
6
+ import { buildListByTitleEndpoint } from '../sharepointUrl';
10
7
 
11
8
  const SUPPORTED_VERSION: SHAREPOINT_VER = '2013';
12
9
 
@@ -24,7 +21,7 @@ export async function uploadFile<V extends SHAREPOINT_VER = '2013'>(
24
21
  throw new Error('A file with a valid name must be provided.');
25
22
  }
26
23
 
27
- let requestUrl = `_api/web/lists/getbytitle('${context.listName}')/RootFolder`;
24
+ let requestUrl = `${buildListByTitleEndpoint(context.listName)}/RootFolder`;
28
25
 
29
26
  requestUrl += buildLibraryPath(folderPath);
30
27
 
@@ -11,7 +11,7 @@ export function buildLibraryPath(folderPath?: string | string[]) {
11
11
  return '';
12
12
  }
13
13
 
14
- const escapedSegments = segments.map((segment) => {
14
+ const escapedSegments = segments.map(segment => {
15
15
  if (!segment.trim()) {
16
16
  throw new Error('Folder path segments cannot be empty.');
17
17
  }
@@ -1,4 +1,4 @@
1
- import type { Folder_Options, Options, SHAREPOINT_VER } from '../../types';
1
+ import { Folder_Options, Options, SHAREPOINT_VER } from '../../types';
2
2
 
3
3
  type QueryableOptions<T, V extends SHAREPOINT_VER = '2013'> =
4
4
  | Options<T, V>
@@ -16,9 +16,7 @@ export function buildODataParams<T, V extends SHAREPOINT_VER = '2013'>(
16
16
  $skip: skip,
17
17
  $select: Array.isArray(cols) ? cols.join(',') : cols,
18
18
  $filter: filter,
19
- $orderby: Array.isArray(orderBy)
20
- ? orderBy.join(orderBySeparator)
21
- : orderBy,
19
+ $orderby: Array.isArray(orderBy) ? orderBy.join(orderBySeparator) : orderBy,
22
20
  };
23
21
 
24
22
  return params;
@@ -0,0 +1,7 @@
1
+ export function escapeODataStringLiteral(value: string) {
2
+ return value.replace(/'/g, "''");
3
+ }
4
+
5
+ export function buildListByTitleEndpoint(listName: string) {
6
+ return `_api/web/lists/GetByTitle('${escapeODataStringLiteral(listName)}')`;
7
+ }
@@ -1,10 +1,7 @@
1
- import type { AxiosInstance } from 'axios';
2
- import type {
3
- PersonField,
4
- UserPermision,
5
- UserProfile,
6
- } from '../../types';
7
- import type { RequestContext } from './context';
1
+ import { AxiosInstance } from 'axios';
2
+ import { PersonField, UserPermision, UserProfile } from '../../types';
3
+ import { RequestContext } from './context';
4
+ import { escapeODataStringLiteral } from './sharepointUrl';
8
5
 
9
6
  type RoleDefinition = {
10
7
  BasePermissions: {
@@ -46,7 +43,27 @@ export async function typeAhead(
46
43
  },
47
44
  });
48
45
 
49
- return response.data.d.ClientPeoplePickerSearchUser;
46
+ const searchResults =
47
+ response.data?.d?.ClientPeoplePickerSearchUser ??
48
+ response.data?.ClientPeoplePickerSearchUser;
49
+
50
+ if (typeof searchResults === 'string') {
51
+ const parsed = JSON.parse(searchResults);
52
+ if (Array.isArray(parsed) && parsed.length > 0) {
53
+ return parsed[0] as PersonField;
54
+ }
55
+ throw new Error('People picker returned no results.');
56
+ }
57
+
58
+ if (Array.isArray(searchResults) && searchResults.length > 0) {
59
+ return searchResults[0] as PersonField;
60
+ }
61
+
62
+ if (searchResults && typeof searchResults === 'object') {
63
+ return searchResults as PersonField;
64
+ }
65
+
66
+ throw new Error('Invalid people picker response.');
50
67
  }
51
68
 
52
69
  export async function currentUserProperties(
@@ -77,9 +94,18 @@ export async function currentUserProperties(
77
94
  return profile;
78
95
  }
79
96
 
80
- export async function getSiteUser(instance: AxiosInstance, searchValue: string) {
81
- const requestUrl = `_api/web/siteusers?&$filter=substringof('${searchValue}', Title) or substringof('${searchValue}', LoginName) or substringof('${searchValue}', Email)&$top=50&$expand=Groups`;
82
- const response = await instance.get(requestUrl);
97
+ export async function getSiteUser(
98
+ instance: AxiosInstance,
99
+ searchValue: string
100
+ ) {
101
+ const safeSearchValue = escapeODataStringLiteral(searchValue);
102
+ const response = await instance.get('_api/web/siteusers', {
103
+ params: {
104
+ $filter: `substringof('${safeSearchValue}', Title) or substringof('${safeSearchValue}', LoginName) or substringof('${safeSearchValue}', Email)`,
105
+ $top: 50,
106
+ $expand: 'Groups',
107
+ },
108
+ });
83
109
  return response.data.d;
84
110
  }
85
111
 
@@ -105,5 +131,11 @@ export async function currentUserPermissions(
105
131
  ({ BasePermissions }: RoleDefinition) => BasePermissions.High === High
106
132
  );
107
133
 
134
+ if (!result) {
135
+ throw new Error(
136
+ `Unable to resolve current user permission for BasePermissions.High="${High}".`
137
+ );
138
+ }
139
+
108
140
  return result as UserPermision;
109
141
  }
package/src/types.ts CHANGED
@@ -1,118 +1,119 @@
1
- export type Metadata = {
2
- id?: string;
3
- type?: string;
4
- uri?: string;
5
- etag?: string;
6
- };
7
-
8
- export type SPItem2010 = {
9
- Attachments: string;
10
- ContentType: string;
11
- ContentTypeID: string;
12
- Created: string;
13
- CreatedBy: PersonField & _Deferred;
14
- CreatedById: string;
15
- Modified: string;
16
- ModifiedBy: PersonField & _Deferred;
17
- ModifiedById: string;
18
- Id: number;
19
- Title: string;
20
- Path: string;
21
- Version: string;
22
- Owshiddenversion: number;
23
- __metadata: Metadata;
24
- };
25
-
26
- export type SPItem2013 = {
27
- __metadata: Metadata;
28
- FirstUniqueAncestorSecurableObject: _Deferred;
29
- RoleAssignments: _Deferred;
30
- AttachmentFiles: _Deferred;
31
- ContentType: _Deferred;
32
- GetDlpPolicyTip: _Deferred;
33
- FieldValuesAsHtml: _Deferred;
34
- FieldValuesAsText: _Deferred;
35
- FieldValuesForEdit: _Deferred;
36
- File: _Deferred;
37
- Folder: _Deferred;
38
- ParentList: _Deferred;
39
- FileSystemObjectType: number;
40
- Id: number;
41
- ContentTypeId: string;
42
- Title: string;
43
- PhotoRefId?: number;
44
- ID: number;
45
- Modified: string;
46
- Created: string;
47
- AuthorId: number;
48
- EditorId: number;
49
- OData__UIVersionString?: string;
50
- Attachments: boolean;
51
- GUID: string;
52
- Author?: PersonField & _Deferred;
53
- Editor?: PersonField & _Deferred;
54
- [key: string]: unknown;
55
- };
56
-
57
- export type SPItem<V extends SHAREPOINT_VER = '2013'> = V extends '2010'
58
- ? SPItem2010
59
- : SPItem2013;
60
-
61
- type ListFields<K, V extends SHAREPOINT_VER = '2013'> =
62
- | Extract<keyof K, string>
63
- | Extract<keyof SPItem<V>, string>;
64
-
65
- export interface Options<K = any, V extends SHAREPOINT_VER = '2013'> {
66
- expand?: ListFields<K, V>[] | ListFields<K, V>;
67
- orderBy?: ListFields<K, V> | [ListFields<K, V>, 'asc' | 'desc'];
68
- limit?: number;
69
- filter?: string;
70
- cols?: ListFields<K, V>[] | ListFields<K, V>;
1
+ export type Metadata = {
2
+ id?: string;
3
+ type?: string;
4
+ uri?: string;
5
+ etag?: string;
6
+ };
7
+
8
+ export type SPItem2010 = {
9
+ Attachments: string;
10
+ ContentType: string;
11
+ ContentTypeID: string;
12
+ Created: string;
13
+ CreatedBy: PersonField & _Deferred;
14
+ CreatedById: string;
15
+ Modified: string;
16
+ ModifiedBy: PersonField & _Deferred;
17
+ ModifiedById: string;
18
+ Id: number;
19
+ Title: string;
20
+ Path: string;
21
+ Version: string;
22
+ Owshiddenversion: number;
23
+ __metadata: Metadata;
24
+ };
25
+
26
+ export type SPItem2013 = {
27
+ __metadata: Metadata;
28
+ FirstUniqueAncestorSecurableObject: _Deferred;
29
+ RoleAssignments: _Deferred;
30
+ AttachmentFiles: _Deferred;
31
+ ContentType: _Deferred;
32
+ GetDlpPolicyTip: _Deferred;
33
+ FieldValuesAsHtml: _Deferred;
34
+ FieldValuesAsText: _Deferred;
35
+ FieldValuesForEdit: _Deferred;
36
+ File: _Deferred;
37
+ Folder: _Deferred;
38
+ ParentList: _Deferred;
39
+ FileSystemObjectType: number;
40
+ Id: number;
41
+ ContentTypeId: string;
42
+ Title: string;
43
+ PhotoRefId?: number;
44
+ ID: number;
45
+ Modified: string;
46
+ Created: string;
47
+ AuthorId: number;
48
+ EditorId: number;
49
+ OData__UIVersionString?: string;
50
+ Attachments: boolean;
51
+ GUID: string;
52
+ Author?: PersonField & _Deferred;
53
+ Editor?: PersonField & _Deferred;
54
+ [key: string]: unknown;
55
+ };
56
+
57
+ export type SPItem<V extends SHAREPOINT_VER = '2013'> = V extends '2010'
58
+ ? SPItem2010
59
+ : SPItem2013;
60
+
61
+ type ListFields<K, V extends SHAREPOINT_VER = '2013'> =
62
+ | Extract<keyof K, string>
63
+ | Extract<keyof SPItem<V>, string>;
64
+
65
+ type OrderByDirection = 'asc' | 'desc';
66
+ type OrderByExpression<F extends string> = F | (F | OrderByDirection)[];
67
+
68
+ export interface Options<K = any, V extends SHAREPOINT_VER = '2013'> {
69
+ expand?: ListFields<K, V>[] | ListFields<K, V>;
70
+ orderBy?: OrderByExpression<ListFields<K, V>>;
71
+ limit?: number;
72
+ filter?: string;
73
+ cols?: ListFields<K, V>[] | ListFields<K, V>;
71
74
  skip?: number;
72
75
  }
73
76
  export interface Folder_Options<K = any> {
74
- type: 'Files' | 'Folders';
77
+ type?: 'Files' | 'Folders';
75
78
  expand?: Extract<keyof K, string>[] | Extract<keyof K, string>;
76
- orderBy?:
77
- | Extract<keyof K, string>
78
- | [Extract<keyof K, string>, 'asc' | 'desc'];
79
+ orderBy?: OrderByExpression<Extract<keyof K, string>>;
79
80
  limit?: number;
80
81
  filter?: string;
81
82
  cols?: Extract<keyof K, string>[] | Extract<keyof K, string>;
82
83
  skip?: number;
83
84
  }
84
85
 
85
- export interface Field_Options<
86
- K,
87
- V extends SHAREPOINT_VER = '2013'
88
- > extends Omit<Options<K, V>, 'filter'> {
89
- fieldName?: Extract<keyof K, string>;
90
- }
86
+ export interface Field_Options<K, V extends SHAREPOINT_VER = '2013'>
87
+ extends Omit<Options<K, V>, 'filter'> {
88
+ fieldName?: Extract<keyof K, string>;
89
+ }
91
90
 
92
91
  export type SHAREPOINT_VER = '2010' | '2013';
93
92
 
94
- export type IListName<T> = Extract<keyof T, string>;
93
+ export type IListName<T> = T extends { LISTS: Record<string, unknown> }
94
+ ? Extract<keyof T['LISTS'], string>
95
+ : Extract<keyof T, string>;
95
96
 
96
- export type ItemID = string | number;
97
- export type CreateFileProps = {
98
- file: File;
99
- itemId: ItemID;
100
- };
101
- export type UploadFileProps = {
102
- file: File;
103
- folderPath?: string | string[];
104
- overwrite?: boolean;
105
- };
106
- export type DeleteFileProps = {
107
- fileName: string;
108
- folderPath?: string | string[];
109
- };
97
+ export type ItemID = string | number;
98
+ export type CreateFileProps = {
99
+ file: File;
100
+ itemId: ItemID;
101
+ };
102
+ export type UploadFileProps = {
103
+ file: File;
104
+ folderPath?: string | string[];
105
+ overwrite?: boolean;
106
+ };
107
+ export type DeleteFileProps = {
108
+ fileName: string;
109
+ folderPath?: string | string[];
110
+ };
110
111
 
111
- export type EmailProps = {
112
- From: string;
113
- To: string[] | string;
114
- Subject?: string;
115
- Body: string;
112
+ export type EmailProps = {
113
+ From: string;
114
+ To: string[] | string;
115
+ Subject?: string;
116
+ Body: string;
116
117
  };
117
118
 
118
119
  export type _Deferred = {
@@ -121,54 +122,55 @@ export type _Deferred = {
121
122
  };
122
123
  };
123
124
 
124
- declare const LOOKUP_FIELD_TAG: unique symbol;
125
- type LookupFieldMarker = {
126
- [LOOKUP_FIELD_TAG]?: true;
127
- };
128
-
129
- export type LookupField<T> = _Deferred & T & LookupFieldMarker;
130
- export type ChoiceField<T> = _Deferred & {
131
- Value: T;
132
- __metadata: Metadata;
133
- };
134
-
135
- type MetadataEnvelope = {
136
- __metadata?: {
137
- type: string;
138
- };
139
- };
140
-
141
- type EnsureRecord<T> = T extends Record<string, unknown>
142
- ? T
143
- : Record<string, unknown>;
144
-
145
- type LookupCreateValue =
146
- | number
147
- | string
148
- | null
149
- | {
150
- lookupId: number | string;
151
- }
152
- | {
153
- LookupId: number | string;
154
- }
155
- | {
156
- results: (number | string)[];
157
- };
158
-
159
- type NormalizeField<T> = T extends LookupField<unknown>
160
- ? LookupCreateValue | LookupField<unknown>
161
- : T;
162
-
163
- export type ListData<T = Record<string, unknown>> = Partial<{
164
- [K in keyof EnsureRecord<T>]: NormalizeField<EnsureRecord<T>[K]>;
165
- }> &
166
- MetadataEnvelope;
167
-
168
- export type PersonField = {
169
- AboutMe?: string;
170
- Account: string;
171
- AccountName: string;
125
+ type LookupFieldMarker = {
126
+ __lookupFieldBrand?: true;
127
+ };
128
+
129
+ export type LookupField<T> = _Deferred & T & LookupFieldMarker;
130
+ export type ChoiceField<T> = _Deferred & {
131
+ Value: T;
132
+ __metadata: Metadata;
133
+ };
134
+
135
+ type MetadataEnvelope = {
136
+ __metadata?: {
137
+ type: string;
138
+ };
139
+ };
140
+
141
+ type EnsureRecord<T> = T extends Record<string, unknown>
142
+ ? T
143
+ : Record<string, unknown>;
144
+
145
+ type LookupCreateValue =
146
+ | number
147
+ | string
148
+ | null
149
+ | {
150
+ lookupId: number | string;
151
+ }
152
+ | {
153
+ LookupId: number | string;
154
+ }
155
+ | {
156
+ results: (number | string)[];
157
+ };
158
+
159
+ type NormalizeField<T> = T extends LookupField<unknown>
160
+ ? LookupCreateValue | LookupField<unknown>
161
+ : T;
162
+
163
+ export type ListData<T = Record<string, unknown>> = Partial<
164
+ {
165
+ [K in keyof EnsureRecord<T>]: NormalizeField<EnsureRecord<T>[K]>;
166
+ }
167
+ > &
168
+ MetadataEnvelope;
169
+
170
+ export type PersonField = {
171
+ AboutMe?: string;
172
+ Account: string;
173
+ AccountName: string;
172
174
  AdministrativeSupervisor: string;
173
175
  AskMeAbout?: string;
174
176
  AskMeAbout0?: string;
@@ -253,6 +255,8 @@ export type UserPermision = {
253
255
  __metadata: Metadata;
254
256
  };
255
257
 
258
+ export type UserPermission = UserPermision;
259
+
256
260
  export type CurrentUser = {
257
261
  Email: string;
258
262
  Id: number;