@mustafaaksoy41/sharepoint-kit 0.1.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.
Files changed (42) hide show
  1. package/README.md +293 -0
  2. package/dist/bin/sp-generate-types.js +784 -0
  3. package/dist/bin/sp-generate-types.js.map +1 -0
  4. package/dist/chunk-2FU6XS6S.cjs +142 -0
  5. package/dist/chunk-2FU6XS6S.cjs.map +1 -0
  6. package/dist/chunk-MLY32NZB.js +131 -0
  7. package/dist/chunk-MLY32NZB.js.map +1 -0
  8. package/dist/chunk-V6K5IFVV.cjs +253 -0
  9. package/dist/chunk-V6K5IFVV.cjs.map +1 -0
  10. package/dist/chunk-VOGWZXJY.js +246 -0
  11. package/dist/chunk-VOGWZXJY.js.map +1 -0
  12. package/dist/cli/index.cjs +516 -0
  13. package/dist/cli/index.cjs.map +1 -0
  14. package/dist/cli/index.d.cts +117 -0
  15. package/dist/cli/index.d.ts +117 -0
  16. package/dist/cli/index.js +505 -0
  17. package/dist/cli/index.js.map +1 -0
  18. package/dist/components/index.cjs +509 -0
  19. package/dist/components/index.cjs.map +1 -0
  20. package/dist/components/index.d.cts +118 -0
  21. package/dist/components/index.d.ts +118 -0
  22. package/dist/components/index.js +494 -0
  23. package/dist/components/index.js.map +1 -0
  24. package/dist/config-loader-Nbidwviq.d.cts +33 -0
  25. package/dist/config-loader-Nbidwviq.d.ts +33 -0
  26. package/dist/hooks/index.cjs +45 -0
  27. package/dist/hooks/index.cjs.map +1 -0
  28. package/dist/hooks/index.d.cts +51 -0
  29. package/dist/hooks/index.d.ts +51 -0
  30. package/dist/hooks/index.js +24 -0
  31. package/dist/hooks/index.js.map +1 -0
  32. package/dist/index.cjs +32 -0
  33. package/dist/index.cjs.map +1 -0
  34. package/dist/index.d.cts +32 -0
  35. package/dist/index.d.ts +32 -0
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -0
  38. package/dist/sp-client-A9dM9oYp.d.ts +31 -0
  39. package/dist/sp-client-DTChApOB.d.cts +31 -0
  40. package/dist/types-Dk0jbejG.d.cts +108 -0
  41. package/dist/types-Dk0jbejG.d.ts +108 -0
  42. package/package.json +123 -0
@@ -0,0 +1,45 @@
1
+ 'use strict';
2
+
3
+ var chunk2FU6XS6S_cjs = require('../chunk-2FU6XS6S.cjs');
4
+ require('../chunk-V6K5IFVV.cjs');
5
+ var useSWR = require('swr');
6
+
7
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
8
+
9
+ var useSWR__default = /*#__PURE__*/_interopDefault(useSWR);
10
+
11
+ function useSpItem(options) {
12
+ const { client } = chunk2FU6XS6S_cjs.useSpContext();
13
+ const { enabled = true, ...itemOptions } = options;
14
+ const key = enabled ? ["sp-item", itemOptions.listId, itemOptions.itemId] : null;
15
+ const { data, error, isLoading, mutate } = useSWR__default.default(
16
+ key,
17
+ () => client.getItem(itemOptions)
18
+ );
19
+ return {
20
+ data,
21
+ isLoading,
22
+ error,
23
+ refetch: mutate
24
+ };
25
+ }
26
+
27
+ Object.defineProperty(exports, "useSpCreate", {
28
+ enumerable: true,
29
+ get: function () { return chunk2FU6XS6S_cjs.useSpCreate; }
30
+ });
31
+ Object.defineProperty(exports, "useSpDelete", {
32
+ enumerable: true,
33
+ get: function () { return chunk2FU6XS6S_cjs.useSpDelete; }
34
+ });
35
+ Object.defineProperty(exports, "useSpList", {
36
+ enumerable: true,
37
+ get: function () { return chunk2FU6XS6S_cjs.useSpList; }
38
+ });
39
+ Object.defineProperty(exports, "useSpUpdate", {
40
+ enumerable: true,
41
+ get: function () { return chunk2FU6XS6S_cjs.useSpUpdate; }
42
+ });
43
+ exports.useSpItem = useSpItem;
44
+ //# sourceMappingURL=index.cjs.map
45
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/use-sp-item.ts"],"names":["useSpContext","useSWR"],"mappings":";;;;;;;;;;AAeO,SAAS,UACd,OAAA,EACoB;AACpB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAIA,8BAAA,EAAa;AAChC,EAAA,MAAM,EAAE,OAAA,GAAU,IAAA,EAAM,GAAG,aAAY,GAAI,OAAA;AAE3C,EAAA,MAAM,GAAA,GAAM,UAAU,CAAC,SAAA,EAAW,YAAY,MAAA,EAAQ,WAAA,CAAY,MAAM,CAAA,GAAI,IAAA;AAE5E,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAO,SAAA,EAAW,QAAO,GAAIC,uBAAA;AAAA,IACzC,GAAA;AAAA,IACA,MAAM,MAAA,CAAO,OAAA,CAAW,WAAW;AAAA,GACrC;AAEA,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AACF","file":"index.cjs","sourcesContent":["import useSWR from 'swr';\nimport type { SpListItem, GetItemOptions } from '../client/types.js';\nimport { useSpContext } from '../components/sp-provider.js';\n\nexport interface UseSpItemOptions extends GetItemOptions {\n enabled?: boolean;\n}\n\nexport interface UseSpItemReturn<T extends Record<string, unknown>> {\n data: SpListItem<T> | undefined;\n isLoading: boolean;\n error: Error | undefined;\n refetch: () => Promise<SpListItem<T> | undefined>;\n}\n\nexport function useSpItem<T extends Record<string, unknown> = Record<string, unknown>>(\n options: UseSpItemOptions,\n): UseSpItemReturn<T> {\n const { client } = useSpContext();\n const { enabled = true, ...itemOptions } = options;\n\n const key = enabled ? ['sp-item', itemOptions.listId, itemOptions.itemId] : null;\n\n const { data, error, isLoading, mutate } = useSWR(\n key,\n () => client.getItem<T>(itemOptions),\n );\n\n return {\n data,\n isLoading,\n error,\n refetch: mutate,\n };\n}\n"]}
@@ -0,0 +1,51 @@
1
+ import { a as GetListItemsOptions, f as SpListItem, G as GetItemOptions, C as CreateItemOptions, D as DeleteItemOptions, U as UpdateItemOptions } from '../types-Dk0jbejG.cjs';
2
+
3
+ interface UseSpListOptions extends GetListItemsOptions {
4
+ enabled?: boolean;
5
+ refreshInterval?: number;
6
+ }
7
+ interface UseSpListReturn<T extends Record<string, unknown>> {
8
+ data: SpListItem<T>[] | undefined;
9
+ isLoading: boolean;
10
+ error: Error | undefined;
11
+ refetch: () => Promise<SpListItem<T>[] | undefined>;
12
+ }
13
+ declare function useSpList<T extends Record<string, unknown> = Record<string, unknown>>(options: UseSpListOptions): UseSpListReturn<T>;
14
+
15
+ interface UseSpItemOptions extends GetItemOptions {
16
+ enabled?: boolean;
17
+ }
18
+ interface UseSpItemReturn<T extends Record<string, unknown>> {
19
+ data: SpListItem<T> | undefined;
20
+ isLoading: boolean;
21
+ error: Error | undefined;
22
+ refetch: () => Promise<SpListItem<T> | undefined>;
23
+ }
24
+ declare function useSpItem<T extends Record<string, unknown> = Record<string, unknown>>(options: UseSpItemOptions): UseSpItemReturn<T>;
25
+
26
+ declare function useSpCreate<T extends Record<string, unknown> = Record<string, unknown>>(options: {
27
+ listId: string;
28
+ }): {
29
+ mutate: (createOptions: Omit<CreateItemOptions<T>, "listId">) => Promise<SpListItem<T>>;
30
+ data: SpListItem<T> | undefined;
31
+ error: Error | undefined;
32
+ isLoading: boolean;
33
+ };
34
+ declare function useSpUpdate<T extends Record<string, unknown> = Record<string, unknown>>(options: {
35
+ listId: string;
36
+ }): {
37
+ mutate: (updateOptions: Omit<UpdateItemOptions<T>, "listId">) => Promise<SpListItem<T>>;
38
+ data: SpListItem<T> | undefined;
39
+ error: Error | undefined;
40
+ isLoading: boolean;
41
+ };
42
+ declare function useSpDelete(options: {
43
+ listId: string;
44
+ }): {
45
+ mutate: (deleteOptions: Omit<DeleteItemOptions, "listId">) => Promise<void>;
46
+ data: void | undefined;
47
+ error: Error | undefined;
48
+ isLoading: boolean;
49
+ };
50
+
51
+ export { useSpCreate, useSpDelete, useSpItem, useSpList, useSpUpdate };
@@ -0,0 +1,51 @@
1
+ import { a as GetListItemsOptions, f as SpListItem, G as GetItemOptions, C as CreateItemOptions, D as DeleteItemOptions, U as UpdateItemOptions } from '../types-Dk0jbejG.js';
2
+
3
+ interface UseSpListOptions extends GetListItemsOptions {
4
+ enabled?: boolean;
5
+ refreshInterval?: number;
6
+ }
7
+ interface UseSpListReturn<T extends Record<string, unknown>> {
8
+ data: SpListItem<T>[] | undefined;
9
+ isLoading: boolean;
10
+ error: Error | undefined;
11
+ refetch: () => Promise<SpListItem<T>[] | undefined>;
12
+ }
13
+ declare function useSpList<T extends Record<string, unknown> = Record<string, unknown>>(options: UseSpListOptions): UseSpListReturn<T>;
14
+
15
+ interface UseSpItemOptions extends GetItemOptions {
16
+ enabled?: boolean;
17
+ }
18
+ interface UseSpItemReturn<T extends Record<string, unknown>> {
19
+ data: SpListItem<T> | undefined;
20
+ isLoading: boolean;
21
+ error: Error | undefined;
22
+ refetch: () => Promise<SpListItem<T> | undefined>;
23
+ }
24
+ declare function useSpItem<T extends Record<string, unknown> = Record<string, unknown>>(options: UseSpItemOptions): UseSpItemReturn<T>;
25
+
26
+ declare function useSpCreate<T extends Record<string, unknown> = Record<string, unknown>>(options: {
27
+ listId: string;
28
+ }): {
29
+ mutate: (createOptions: Omit<CreateItemOptions<T>, "listId">) => Promise<SpListItem<T>>;
30
+ data: SpListItem<T> | undefined;
31
+ error: Error | undefined;
32
+ isLoading: boolean;
33
+ };
34
+ declare function useSpUpdate<T extends Record<string, unknown> = Record<string, unknown>>(options: {
35
+ listId: string;
36
+ }): {
37
+ mutate: (updateOptions: Omit<UpdateItemOptions<T>, "listId">) => Promise<SpListItem<T>>;
38
+ data: SpListItem<T> | undefined;
39
+ error: Error | undefined;
40
+ isLoading: boolean;
41
+ };
42
+ declare function useSpDelete(options: {
43
+ listId: string;
44
+ }): {
45
+ mutate: (deleteOptions: Omit<DeleteItemOptions, "listId">) => Promise<void>;
46
+ data: void | undefined;
47
+ error: Error | undefined;
48
+ isLoading: boolean;
49
+ };
50
+
51
+ export { useSpCreate, useSpDelete, useSpItem, useSpList, useSpUpdate };
@@ -0,0 +1,24 @@
1
+ import { useSpContext } from '../chunk-MLY32NZB.js';
2
+ export { useSpCreate, useSpDelete, useSpList, useSpUpdate } from '../chunk-MLY32NZB.js';
3
+ import '../chunk-VOGWZXJY.js';
4
+ import useSWR from 'swr';
5
+
6
+ function useSpItem(options) {
7
+ const { client } = useSpContext();
8
+ const { enabled = true, ...itemOptions } = options;
9
+ const key = enabled ? ["sp-item", itemOptions.listId, itemOptions.itemId] : null;
10
+ const { data, error, isLoading, mutate } = useSWR(
11
+ key,
12
+ () => client.getItem(itemOptions)
13
+ );
14
+ return {
15
+ data,
16
+ isLoading,
17
+ error,
18
+ refetch: mutate
19
+ };
20
+ }
21
+
22
+ export { useSpItem };
23
+ //# sourceMappingURL=index.js.map
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/hooks/use-sp-item.ts"],"names":[],"mappings":";;;;;AAeO,SAAS,UACd,OAAA,EACoB;AACpB,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,YAAA,EAAa;AAChC,EAAA,MAAM,EAAE,OAAA,GAAU,IAAA,EAAM,GAAG,aAAY,GAAI,OAAA;AAE3C,EAAA,MAAM,GAAA,GAAM,UAAU,CAAC,SAAA,EAAW,YAAY,MAAA,EAAQ,WAAA,CAAY,MAAM,CAAA,GAAI,IAAA;AAE5E,EAAA,MAAM,EAAE,IAAA,EAAM,KAAA,EAAO,SAAA,EAAW,QAAO,GAAI,MAAA;AAAA,IACzC,GAAA;AAAA,IACA,MAAM,MAAA,CAAO,OAAA,CAAW,WAAW;AAAA,GACrC;AAEA,EAAA,OAAO;AAAA,IACL,IAAA;AAAA,IACA,SAAA;AAAA,IACA,KAAA;AAAA,IACA,OAAA,EAAS;AAAA,GACX;AACF","file":"index.js","sourcesContent":["import useSWR from 'swr';\nimport type { SpListItem, GetItemOptions } from '../client/types.js';\nimport { useSpContext } from '../components/sp-provider.js';\n\nexport interface UseSpItemOptions extends GetItemOptions {\n enabled?: boolean;\n}\n\nexport interface UseSpItemReturn<T extends Record<string, unknown>> {\n data: SpListItem<T> | undefined;\n isLoading: boolean;\n error: Error | undefined;\n refetch: () => Promise<SpListItem<T> | undefined>;\n}\n\nexport function useSpItem<T extends Record<string, unknown> = Record<string, unknown>>(\n options: UseSpItemOptions,\n): UseSpItemReturn<T> {\n const { client } = useSpContext();\n const { enabled = true, ...itemOptions } = options;\n\n const key = enabled ? ['sp-item', itemOptions.listId, itemOptions.itemId] : null;\n\n const { data, error, isLoading, mutate } = useSWR(\n key,\n () => client.getItem<T>(itemOptions),\n );\n\n return {\n data,\n isLoading,\n error,\n refetch: mutate,\n };\n}\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ var chunkV6K5IFVV_cjs = require('./chunk-V6K5IFVV.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "SpAuthError", {
8
+ enumerable: true,
9
+ get: function () { return chunkV6K5IFVV_cjs.SpAuthError; }
10
+ });
11
+ Object.defineProperty(exports, "SpError", {
12
+ enumerable: true,
13
+ get: function () { return chunkV6K5IFVV_cjs.SpError; }
14
+ });
15
+ Object.defineProperty(exports, "SpNotFoundError", {
16
+ enumerable: true,
17
+ get: function () { return chunkV6K5IFVV_cjs.SpNotFoundError; }
18
+ });
19
+ Object.defineProperty(exports, "SpThrottleError", {
20
+ enumerable: true,
21
+ get: function () { return chunkV6K5IFVV_cjs.SpThrottleError; }
22
+ });
23
+ Object.defineProperty(exports, "SpValidationError", {
24
+ enumerable: true,
25
+ get: function () { return chunkV6K5IFVV_cjs.SpValidationError; }
26
+ });
27
+ Object.defineProperty(exports, "createSpClient", {
28
+ enumerable: true,
29
+ get: function () { return chunkV6K5IFVV_cjs.createSpClient; }
30
+ });
31
+ //# sourceMappingURL=index.cjs.map
32
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,32 @@
1
+ export { c as createSpClient } from './sp-client-DTChApOB.cjs';
2
+ export { C as CreateItemOptions, D as DeleteItemOptions, G as GetItemOptions, a as GetListItemsOptions, S as SpClientConfig, b as SpColumn, c as SpContentType, d as SpField, e as SpList, f as SpListItem, g as SpSite, U as UpdateItemOptions } from './types-Dk0jbejG.cjs';
3
+
4
+ declare class SpError extends Error {
5
+ readonly status: number;
6
+ readonly code: string;
7
+ readonly requestId: string;
8
+ constructor(message: string, status: number, code: string, requestId?: string);
9
+ toJSON(): {
10
+ name: string;
11
+ message: string;
12
+ status: number;
13
+ code: string;
14
+ requestId: string;
15
+ };
16
+ }
17
+ declare class SpAuthError extends SpError {
18
+ constructor(message: string, status?: number, requestId?: string);
19
+ }
20
+ declare class SpNotFoundError extends SpError {
21
+ constructor(message: string, requestId?: string);
22
+ }
23
+ declare class SpThrottleError extends SpError {
24
+ readonly retryAfter: number;
25
+ constructor(message: string, retryAfter?: number, requestId?: string);
26
+ }
27
+ declare class SpValidationError extends SpError {
28
+ readonly fieldErrors: Record<string, string>;
29
+ constructor(message: string, fieldErrors?: Record<string, string>, requestId?: string);
30
+ }
31
+
32
+ export { SpAuthError, SpError, SpNotFoundError, SpThrottleError, SpValidationError };
@@ -0,0 +1,32 @@
1
+ export { c as createSpClient } from './sp-client-A9dM9oYp.js';
2
+ export { C as CreateItemOptions, D as DeleteItemOptions, G as GetItemOptions, a as GetListItemsOptions, S as SpClientConfig, b as SpColumn, c as SpContentType, d as SpField, e as SpList, f as SpListItem, g as SpSite, U as UpdateItemOptions } from './types-Dk0jbejG.js';
3
+
4
+ declare class SpError extends Error {
5
+ readonly status: number;
6
+ readonly code: string;
7
+ readonly requestId: string;
8
+ constructor(message: string, status: number, code: string, requestId?: string);
9
+ toJSON(): {
10
+ name: string;
11
+ message: string;
12
+ status: number;
13
+ code: string;
14
+ requestId: string;
15
+ };
16
+ }
17
+ declare class SpAuthError extends SpError {
18
+ constructor(message: string, status?: number, requestId?: string);
19
+ }
20
+ declare class SpNotFoundError extends SpError {
21
+ constructor(message: string, requestId?: string);
22
+ }
23
+ declare class SpThrottleError extends SpError {
24
+ readonly retryAfter: number;
25
+ constructor(message: string, retryAfter?: number, requestId?: string);
26
+ }
27
+ declare class SpValidationError extends SpError {
28
+ readonly fieldErrors: Record<string, string>;
29
+ constructor(message: string, fieldErrors?: Record<string, string>, requestId?: string);
30
+ }
31
+
32
+ export { SpAuthError, SpError, SpNotFoundError, SpThrottleError, SpValidationError };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { SpAuthError, SpError, SpNotFoundError, SpThrottleError, SpValidationError, createSpClient } from './chunk-VOGWZXJY.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,31 @@
1
+ import { S as SpClientConfig, a as GetListItemsOptions, f as SpListItem, G as GetItemOptions, C as CreateItemOptions, U as UpdateItemOptions, D as DeleteItemOptions, g as SpSite, e as SpList, c as SpContentType, b as SpColumn } from './types-Dk0jbejG.js';
2
+
3
+ interface SpClient {
4
+ getListItems<T extends Record<string, unknown> = Record<string, unknown>>(options: GetListItemsOptions): Promise<SpListItem<T>[]>;
5
+ getItem<T extends Record<string, unknown> = Record<string, unknown>>(options: GetItemOptions): Promise<SpListItem<T>>;
6
+ createItem<T extends Record<string, unknown> = Record<string, unknown>>(options: CreateItemOptions<T>): Promise<SpListItem<T>>;
7
+ updateItem<T extends Record<string, unknown> = Record<string, unknown>>(options: UpdateItemOptions<T>): Promise<SpListItem<T>>;
8
+ deleteItem(options: DeleteItemOptions): Promise<void>;
9
+ getSites(options?: {
10
+ search?: string;
11
+ }): Promise<SpSite[]>;
12
+ getLists(): Promise<SpList[]>;
13
+ getList(options: {
14
+ listId: string;
15
+ }): Promise<SpList>;
16
+ getContentTypes(options?: {
17
+ listId?: string;
18
+ }): Promise<SpContentType[]>;
19
+ getListContentTypes(options: {
20
+ listId: string;
21
+ }): Promise<SpContentType[]>;
22
+ getColumns(options: {
23
+ contentTypeId: string;
24
+ }): Promise<SpColumn[]>;
25
+ getListColumns(options: {
26
+ listId: string;
27
+ }): Promise<SpColumn[]>;
28
+ }
29
+ declare function createSpClient(config: SpClientConfig): SpClient;
30
+
31
+ export { createSpClient as c };
@@ -0,0 +1,31 @@
1
+ import { S as SpClientConfig, a as GetListItemsOptions, f as SpListItem, G as GetItemOptions, C as CreateItemOptions, U as UpdateItemOptions, D as DeleteItemOptions, g as SpSite, e as SpList, c as SpContentType, b as SpColumn } from './types-Dk0jbejG.cjs';
2
+
3
+ interface SpClient {
4
+ getListItems<T extends Record<string, unknown> = Record<string, unknown>>(options: GetListItemsOptions): Promise<SpListItem<T>[]>;
5
+ getItem<T extends Record<string, unknown> = Record<string, unknown>>(options: GetItemOptions): Promise<SpListItem<T>>;
6
+ createItem<T extends Record<string, unknown> = Record<string, unknown>>(options: CreateItemOptions<T>): Promise<SpListItem<T>>;
7
+ updateItem<T extends Record<string, unknown> = Record<string, unknown>>(options: UpdateItemOptions<T>): Promise<SpListItem<T>>;
8
+ deleteItem(options: DeleteItemOptions): Promise<void>;
9
+ getSites(options?: {
10
+ search?: string;
11
+ }): Promise<SpSite[]>;
12
+ getLists(): Promise<SpList[]>;
13
+ getList(options: {
14
+ listId: string;
15
+ }): Promise<SpList>;
16
+ getContentTypes(options?: {
17
+ listId?: string;
18
+ }): Promise<SpContentType[]>;
19
+ getListContentTypes(options: {
20
+ listId: string;
21
+ }): Promise<SpContentType[]>;
22
+ getColumns(options: {
23
+ contentTypeId: string;
24
+ }): Promise<SpColumn[]>;
25
+ getListColumns(options: {
26
+ listId: string;
27
+ }): Promise<SpColumn[]>;
28
+ }
29
+ declare function createSpClient(config: SpClientConfig): SpClient;
30
+
31
+ export { createSpClient as c };
@@ -0,0 +1,108 @@
1
+ interface SpClientConfig {
2
+ siteId: string;
3
+ getAccessToken: () => Promise<string>;
4
+ baseUrl?: string;
5
+ retryOptions?: RetryOptions;
6
+ }
7
+ interface RetryOptions {
8
+ maxRetries?: number;
9
+ baseDelay?: number;
10
+ maxDelay?: number;
11
+ }
12
+ interface SpListItem<T extends Record<string, unknown> = Record<string, unknown>> {
13
+ id: string;
14
+ fields: T;
15
+ contentType?: {
16
+ id: string;
17
+ name: string;
18
+ };
19
+ createdDateTime?: string;
20
+ lastModifiedDateTime?: string;
21
+ createdBy?: SpIdentity;
22
+ lastModifiedBy?: SpIdentity;
23
+ webUrl?: string;
24
+ }
25
+ interface SpIdentity {
26
+ user?: {
27
+ id: string;
28
+ displayName: string;
29
+ email?: string;
30
+ };
31
+ }
32
+ interface SpField {
33
+ name: string;
34
+ displayName: string;
35
+ type: SpFieldType;
36
+ required: boolean;
37
+ readOnly: boolean;
38
+ description?: string;
39
+ defaultValue?: string;
40
+ choices?: string[];
41
+ lookupListId?: string;
42
+ }
43
+ type SpFieldType = 'Text' | 'Note' | 'Number' | 'Currency' | 'DateTime' | 'Boolean' | 'Choice' | 'MultiChoice' | 'Lookup' | 'User' | 'URL' | 'Calculated' | 'Taxonomy' | 'Unknown';
44
+ interface SpList {
45
+ id: string;
46
+ displayName: string;
47
+ name: string;
48
+ description?: string;
49
+ webUrl?: string;
50
+ createdDateTime?: string;
51
+ lastModifiedDateTime?: string;
52
+ }
53
+ interface SpSite {
54
+ id: string;
55
+ displayName: string;
56
+ name: string;
57
+ webUrl: string;
58
+ description?: string;
59
+ }
60
+ interface SpContentType {
61
+ id: string;
62
+ name: string;
63
+ description?: string;
64
+ group?: string;
65
+ isBuiltIn?: boolean;
66
+ }
67
+ interface SpColumn {
68
+ id: string;
69
+ name: string;
70
+ displayName: string;
71
+ type: SpFieldType;
72
+ required: boolean;
73
+ readOnly: boolean;
74
+ description?: string;
75
+ defaultValue?: unknown;
76
+ }
77
+ interface GetListItemsOptions {
78
+ listId: string;
79
+ contentTypeName?: string;
80
+ filter?: string;
81
+ select?: string[];
82
+ expand?: string[];
83
+ orderBy?: string;
84
+ top?: number;
85
+ skip?: number;
86
+ }
87
+ interface GetItemOptions {
88
+ listId: string;
89
+ itemId: string;
90
+ select?: string[];
91
+ expand?: string[];
92
+ }
93
+ interface CreateItemOptions<T extends Record<string, unknown> = Record<string, unknown>> {
94
+ listId: string;
95
+ fields: Partial<T>;
96
+ contentTypeId?: string;
97
+ }
98
+ interface UpdateItemOptions<T extends Record<string, unknown> = Record<string, unknown>> {
99
+ listId: string;
100
+ itemId: string;
101
+ fields: Partial<T>;
102
+ }
103
+ interface DeleteItemOptions {
104
+ listId: string;
105
+ itemId: string;
106
+ }
107
+
108
+ export type { CreateItemOptions as C, DeleteItemOptions as D, GetItemOptions as G, SpClientConfig as S, UpdateItemOptions as U, GetListItemsOptions as a, SpColumn as b, SpContentType as c, SpField as d, SpList as e, SpListItem as f, SpSite as g };
@@ -0,0 +1,108 @@
1
+ interface SpClientConfig {
2
+ siteId: string;
3
+ getAccessToken: () => Promise<string>;
4
+ baseUrl?: string;
5
+ retryOptions?: RetryOptions;
6
+ }
7
+ interface RetryOptions {
8
+ maxRetries?: number;
9
+ baseDelay?: number;
10
+ maxDelay?: number;
11
+ }
12
+ interface SpListItem<T extends Record<string, unknown> = Record<string, unknown>> {
13
+ id: string;
14
+ fields: T;
15
+ contentType?: {
16
+ id: string;
17
+ name: string;
18
+ };
19
+ createdDateTime?: string;
20
+ lastModifiedDateTime?: string;
21
+ createdBy?: SpIdentity;
22
+ lastModifiedBy?: SpIdentity;
23
+ webUrl?: string;
24
+ }
25
+ interface SpIdentity {
26
+ user?: {
27
+ id: string;
28
+ displayName: string;
29
+ email?: string;
30
+ };
31
+ }
32
+ interface SpField {
33
+ name: string;
34
+ displayName: string;
35
+ type: SpFieldType;
36
+ required: boolean;
37
+ readOnly: boolean;
38
+ description?: string;
39
+ defaultValue?: string;
40
+ choices?: string[];
41
+ lookupListId?: string;
42
+ }
43
+ type SpFieldType = 'Text' | 'Note' | 'Number' | 'Currency' | 'DateTime' | 'Boolean' | 'Choice' | 'MultiChoice' | 'Lookup' | 'User' | 'URL' | 'Calculated' | 'Taxonomy' | 'Unknown';
44
+ interface SpList {
45
+ id: string;
46
+ displayName: string;
47
+ name: string;
48
+ description?: string;
49
+ webUrl?: string;
50
+ createdDateTime?: string;
51
+ lastModifiedDateTime?: string;
52
+ }
53
+ interface SpSite {
54
+ id: string;
55
+ displayName: string;
56
+ name: string;
57
+ webUrl: string;
58
+ description?: string;
59
+ }
60
+ interface SpContentType {
61
+ id: string;
62
+ name: string;
63
+ description?: string;
64
+ group?: string;
65
+ isBuiltIn?: boolean;
66
+ }
67
+ interface SpColumn {
68
+ id: string;
69
+ name: string;
70
+ displayName: string;
71
+ type: SpFieldType;
72
+ required: boolean;
73
+ readOnly: boolean;
74
+ description?: string;
75
+ defaultValue?: unknown;
76
+ }
77
+ interface GetListItemsOptions {
78
+ listId: string;
79
+ contentTypeName?: string;
80
+ filter?: string;
81
+ select?: string[];
82
+ expand?: string[];
83
+ orderBy?: string;
84
+ top?: number;
85
+ skip?: number;
86
+ }
87
+ interface GetItemOptions {
88
+ listId: string;
89
+ itemId: string;
90
+ select?: string[];
91
+ expand?: string[];
92
+ }
93
+ interface CreateItemOptions<T extends Record<string, unknown> = Record<string, unknown>> {
94
+ listId: string;
95
+ fields: Partial<T>;
96
+ contentTypeId?: string;
97
+ }
98
+ interface UpdateItemOptions<T extends Record<string, unknown> = Record<string, unknown>> {
99
+ listId: string;
100
+ itemId: string;
101
+ fields: Partial<T>;
102
+ }
103
+ interface DeleteItemOptions {
104
+ listId: string;
105
+ itemId: string;
106
+ }
107
+
108
+ export type { CreateItemOptions as C, DeleteItemOptions as D, GetItemOptions as G, SpClientConfig as S, UpdateItemOptions as U, GetListItemsOptions as a, SpColumn as b, SpContentType as c, SpField as d, SpList as e, SpListItem as f, SpSite as g };