@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.
- package/README.md +293 -0
- package/dist/bin/sp-generate-types.js +784 -0
- package/dist/bin/sp-generate-types.js.map +1 -0
- package/dist/chunk-2FU6XS6S.cjs +142 -0
- package/dist/chunk-2FU6XS6S.cjs.map +1 -0
- package/dist/chunk-MLY32NZB.js +131 -0
- package/dist/chunk-MLY32NZB.js.map +1 -0
- package/dist/chunk-V6K5IFVV.cjs +253 -0
- package/dist/chunk-V6K5IFVV.cjs.map +1 -0
- package/dist/chunk-VOGWZXJY.js +246 -0
- package/dist/chunk-VOGWZXJY.js.map +1 -0
- package/dist/cli/index.cjs +516 -0
- package/dist/cli/index.cjs.map +1 -0
- package/dist/cli/index.d.cts +117 -0
- package/dist/cli/index.d.ts +117 -0
- package/dist/cli/index.js +505 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/components/index.cjs +509 -0
- package/dist/components/index.cjs.map +1 -0
- package/dist/components/index.d.cts +118 -0
- package/dist/components/index.d.ts +118 -0
- package/dist/components/index.js +494 -0
- package/dist/components/index.js.map +1 -0
- package/dist/config-loader-Nbidwviq.d.cts +33 -0
- package/dist/config-loader-Nbidwviq.d.ts +33 -0
- package/dist/hooks/index.cjs +45 -0
- package/dist/hooks/index.cjs.map +1 -0
- package/dist/hooks/index.d.cts +51 -0
- package/dist/hooks/index.d.ts +51 -0
- package/dist/hooks/index.js +24 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.cjs +32 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/sp-client-A9dM9oYp.d.ts +31 -0
- package/dist/sp-client-DTChApOB.d.cts +31 -0
- package/dist/types-Dk0jbejG.d.cts +108 -0
- package/dist/types-Dk0jbejG.d.ts +108 -0
- package/package.json +123 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import { c as createSpClient } from '../sp-client-DTChApOB.cjs';
|
|
4
|
+
import { S as SpClientConfig, f as SpListItem } from '../types-Dk0jbejG.cjs';
|
|
5
|
+
import { S as SpLoginConfig } from '../config-loader-Nbidwviq.cjs';
|
|
6
|
+
|
|
7
|
+
type SpClientInstance = ReturnType<typeof createSpClient>;
|
|
8
|
+
interface SpContextValue {
|
|
9
|
+
client: SpClientInstance;
|
|
10
|
+
config: SpClientConfig;
|
|
11
|
+
}
|
|
12
|
+
interface SpProviderProps {
|
|
13
|
+
siteId: string;
|
|
14
|
+
getAccessToken: () => Promise<string>;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
retryOptions?: SpClientConfig['retryOptions'];
|
|
18
|
+
}
|
|
19
|
+
declare function SpProvider({ siteId, getAccessToken, children, baseUrl, retryOptions, }: SpProviderProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare function useSpContext(): SpContextValue;
|
|
21
|
+
|
|
22
|
+
interface SpProviderWithAuthProps extends Omit<SpProviderProps, 'getAccessToken'> {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* SpProvider wrapper that automatically uses SpAuthProvider for authentication.
|
|
26
|
+
* Use this if you want the built-in auth system with login screen.
|
|
27
|
+
*
|
|
28
|
+
* For custom auth systems, use SpProvider directly with your own getAccessToken.
|
|
29
|
+
*/
|
|
30
|
+
declare function SpProviderWithAuth({ siteId, children, baseUrl, retryOptions, }: SpProviderWithAuthProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
interface AuthContextValue {
|
|
33
|
+
token: string | null;
|
|
34
|
+
isAuthenticated: boolean;
|
|
35
|
+
login: (token: string) => void;
|
|
36
|
+
logout: () => void;
|
|
37
|
+
bypass: boolean;
|
|
38
|
+
setBypass: (bypass: boolean) => void;
|
|
39
|
+
}
|
|
40
|
+
interface SpAuthProviderProps {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
/** When set, shows "Sign in with Microsoft" and uses MSAL redirect flow. Can be built from env (e.g. NEXT_PUBLIC_*). */
|
|
43
|
+
loginConfig?: SpLoginConfig;
|
|
44
|
+
bypassEnabled?: boolean;
|
|
45
|
+
onTokenChange?: (token: string | null) => void;
|
|
46
|
+
}
|
|
47
|
+
declare function SpAuthProvider({ children, loginConfig, bypassEnabled, onTokenChange, }: SpAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare function useSpAuth(): AuthContextValue;
|
|
49
|
+
|
|
50
|
+
interface SpListTableColumn<T> {
|
|
51
|
+
key: keyof T & string;
|
|
52
|
+
label: string;
|
|
53
|
+
format?: 'text' | 'number' | 'currency' | 'date' | 'boolean';
|
|
54
|
+
render?: (value: unknown, item: T) => React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
interface SpListTableProps<T extends Record<string, unknown>> {
|
|
57
|
+
listId: string;
|
|
58
|
+
contentTypeName?: string;
|
|
59
|
+
columns: SpListTableColumn<T>[];
|
|
60
|
+
filter?: string;
|
|
61
|
+
orderBy?: string;
|
|
62
|
+
top?: number;
|
|
63
|
+
onRowClick?: (item: T, id: string) => void;
|
|
64
|
+
emptyMessage?: string;
|
|
65
|
+
}
|
|
66
|
+
declare function SpListTable<T extends Record<string, unknown> = Record<string, unknown>>({ listId, contentTypeName, columns, filter, orderBy, top, onRowClick, emptyMessage, }: SpListTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
interface SpFormField {
|
|
69
|
+
key: string;
|
|
70
|
+
label: string;
|
|
71
|
+
type?: 'text' | 'number' | 'date' | 'textarea';
|
|
72
|
+
required?: boolean;
|
|
73
|
+
placeholder?: string;
|
|
74
|
+
defaultValue?: string | number;
|
|
75
|
+
}
|
|
76
|
+
interface SpItemFormProps<T extends Record<string, unknown>> {
|
|
77
|
+
listId: string;
|
|
78
|
+
fields: SpFormField[];
|
|
79
|
+
mode?: 'create' | 'edit';
|
|
80
|
+
itemId?: string;
|
|
81
|
+
initialValues?: Partial<T>;
|
|
82
|
+
onSuccess?: (item: SpListItem<T>) => void;
|
|
83
|
+
onError?: (error: Error) => void;
|
|
84
|
+
submitLabel?: string;
|
|
85
|
+
}
|
|
86
|
+
declare function SpItemForm<T extends Record<string, unknown> = Record<string, unknown>>({ listId, fields, mode, itemId, initialValues, onSuccess, onError, submitLabel, }: SpItemFormProps<T>): react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
interface SpItemCardField {
|
|
89
|
+
key: string;
|
|
90
|
+
label: string;
|
|
91
|
+
format?: 'text' | 'number' | 'currency' | 'date' | 'boolean';
|
|
92
|
+
render?: (value: unknown) => React.ReactNode;
|
|
93
|
+
}
|
|
94
|
+
interface SpItemCardProps<T extends Record<string, unknown>> {
|
|
95
|
+
item: T;
|
|
96
|
+
fields: SpItemCardField[];
|
|
97
|
+
title?: string;
|
|
98
|
+
onClick?: () => void;
|
|
99
|
+
}
|
|
100
|
+
declare function SpItemCard<T extends Record<string, unknown> = Record<string, unknown>>({ item, fields, title, onClick, }: SpItemCardProps<T>): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
102
|
+
interface SpErrorBoundaryProps {
|
|
103
|
+
children: React.ReactNode;
|
|
104
|
+
onAuthError?: () => void;
|
|
105
|
+
fallback?: React.ReactNode;
|
|
106
|
+
}
|
|
107
|
+
interface SpErrorBoundaryState {
|
|
108
|
+
error: Error | null;
|
|
109
|
+
}
|
|
110
|
+
declare class SpErrorBoundary extends Component<SpErrorBoundaryProps, SpErrorBoundaryState> {
|
|
111
|
+
constructor(props: SpErrorBoundaryProps);
|
|
112
|
+
static getDerivedStateFromError(error: Error): SpErrorBoundaryState;
|
|
113
|
+
handleRetry: () => void;
|
|
114
|
+
handleAuthError: () => void;
|
|
115
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { SpAuthProvider, SpErrorBoundary, SpItemCard, SpItemForm, SpListTable, SpLoginConfig, SpProvider, SpProviderWithAuth, useSpAuth, useSpContext };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import React, { Component } from 'react';
|
|
3
|
+
import { c as createSpClient } from '../sp-client-A9dM9oYp.js';
|
|
4
|
+
import { S as SpClientConfig, f as SpListItem } from '../types-Dk0jbejG.js';
|
|
5
|
+
import { S as SpLoginConfig } from '../config-loader-Nbidwviq.js';
|
|
6
|
+
|
|
7
|
+
type SpClientInstance = ReturnType<typeof createSpClient>;
|
|
8
|
+
interface SpContextValue {
|
|
9
|
+
client: SpClientInstance;
|
|
10
|
+
config: SpClientConfig;
|
|
11
|
+
}
|
|
12
|
+
interface SpProviderProps {
|
|
13
|
+
siteId: string;
|
|
14
|
+
getAccessToken: () => Promise<string>;
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
baseUrl?: string;
|
|
17
|
+
retryOptions?: SpClientConfig['retryOptions'];
|
|
18
|
+
}
|
|
19
|
+
declare function SpProvider({ siteId, getAccessToken, children, baseUrl, retryOptions, }: SpProviderProps): react_jsx_runtime.JSX.Element;
|
|
20
|
+
declare function useSpContext(): SpContextValue;
|
|
21
|
+
|
|
22
|
+
interface SpProviderWithAuthProps extends Omit<SpProviderProps, 'getAccessToken'> {
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* SpProvider wrapper that automatically uses SpAuthProvider for authentication.
|
|
26
|
+
* Use this if you want the built-in auth system with login screen.
|
|
27
|
+
*
|
|
28
|
+
* For custom auth systems, use SpProvider directly with your own getAccessToken.
|
|
29
|
+
*/
|
|
30
|
+
declare function SpProviderWithAuth({ siteId, children, baseUrl, retryOptions, }: SpProviderWithAuthProps): react_jsx_runtime.JSX.Element;
|
|
31
|
+
|
|
32
|
+
interface AuthContextValue {
|
|
33
|
+
token: string | null;
|
|
34
|
+
isAuthenticated: boolean;
|
|
35
|
+
login: (token: string) => void;
|
|
36
|
+
logout: () => void;
|
|
37
|
+
bypass: boolean;
|
|
38
|
+
setBypass: (bypass: boolean) => void;
|
|
39
|
+
}
|
|
40
|
+
interface SpAuthProviderProps {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
/** When set, shows "Sign in with Microsoft" and uses MSAL redirect flow. Can be built from env (e.g. NEXT_PUBLIC_*). */
|
|
43
|
+
loginConfig?: SpLoginConfig;
|
|
44
|
+
bypassEnabled?: boolean;
|
|
45
|
+
onTokenChange?: (token: string | null) => void;
|
|
46
|
+
}
|
|
47
|
+
declare function SpAuthProvider({ children, loginConfig, bypassEnabled, onTokenChange, }: SpAuthProviderProps): react_jsx_runtime.JSX.Element;
|
|
48
|
+
declare function useSpAuth(): AuthContextValue;
|
|
49
|
+
|
|
50
|
+
interface SpListTableColumn<T> {
|
|
51
|
+
key: keyof T & string;
|
|
52
|
+
label: string;
|
|
53
|
+
format?: 'text' | 'number' | 'currency' | 'date' | 'boolean';
|
|
54
|
+
render?: (value: unknown, item: T) => React.ReactNode;
|
|
55
|
+
}
|
|
56
|
+
interface SpListTableProps<T extends Record<string, unknown>> {
|
|
57
|
+
listId: string;
|
|
58
|
+
contentTypeName?: string;
|
|
59
|
+
columns: SpListTableColumn<T>[];
|
|
60
|
+
filter?: string;
|
|
61
|
+
orderBy?: string;
|
|
62
|
+
top?: number;
|
|
63
|
+
onRowClick?: (item: T, id: string) => void;
|
|
64
|
+
emptyMessage?: string;
|
|
65
|
+
}
|
|
66
|
+
declare function SpListTable<T extends Record<string, unknown> = Record<string, unknown>>({ listId, contentTypeName, columns, filter, orderBy, top, onRowClick, emptyMessage, }: SpListTableProps<T>): react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
interface SpFormField {
|
|
69
|
+
key: string;
|
|
70
|
+
label: string;
|
|
71
|
+
type?: 'text' | 'number' | 'date' | 'textarea';
|
|
72
|
+
required?: boolean;
|
|
73
|
+
placeholder?: string;
|
|
74
|
+
defaultValue?: string | number;
|
|
75
|
+
}
|
|
76
|
+
interface SpItemFormProps<T extends Record<string, unknown>> {
|
|
77
|
+
listId: string;
|
|
78
|
+
fields: SpFormField[];
|
|
79
|
+
mode?: 'create' | 'edit';
|
|
80
|
+
itemId?: string;
|
|
81
|
+
initialValues?: Partial<T>;
|
|
82
|
+
onSuccess?: (item: SpListItem<T>) => void;
|
|
83
|
+
onError?: (error: Error) => void;
|
|
84
|
+
submitLabel?: string;
|
|
85
|
+
}
|
|
86
|
+
declare function SpItemForm<T extends Record<string, unknown> = Record<string, unknown>>({ listId, fields, mode, itemId, initialValues, onSuccess, onError, submitLabel, }: SpItemFormProps<T>): react_jsx_runtime.JSX.Element;
|
|
87
|
+
|
|
88
|
+
interface SpItemCardField {
|
|
89
|
+
key: string;
|
|
90
|
+
label: string;
|
|
91
|
+
format?: 'text' | 'number' | 'currency' | 'date' | 'boolean';
|
|
92
|
+
render?: (value: unknown) => React.ReactNode;
|
|
93
|
+
}
|
|
94
|
+
interface SpItemCardProps<T extends Record<string, unknown>> {
|
|
95
|
+
item: T;
|
|
96
|
+
fields: SpItemCardField[];
|
|
97
|
+
title?: string;
|
|
98
|
+
onClick?: () => void;
|
|
99
|
+
}
|
|
100
|
+
declare function SpItemCard<T extends Record<string, unknown> = Record<string, unknown>>({ item, fields, title, onClick, }: SpItemCardProps<T>): react_jsx_runtime.JSX.Element;
|
|
101
|
+
|
|
102
|
+
interface SpErrorBoundaryProps {
|
|
103
|
+
children: React.ReactNode;
|
|
104
|
+
onAuthError?: () => void;
|
|
105
|
+
fallback?: React.ReactNode;
|
|
106
|
+
}
|
|
107
|
+
interface SpErrorBoundaryState {
|
|
108
|
+
error: Error | null;
|
|
109
|
+
}
|
|
110
|
+
declare class SpErrorBoundary extends Component<SpErrorBoundaryProps, SpErrorBoundaryState> {
|
|
111
|
+
constructor(props: SpErrorBoundaryProps);
|
|
112
|
+
static getDerivedStateFromError(error: Error): SpErrorBoundaryState;
|
|
113
|
+
handleRetry: () => void;
|
|
114
|
+
handleAuthError: () => void;
|
|
115
|
+
render(): string | number | boolean | Iterable<React.ReactNode> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export { SpAuthProvider, SpErrorBoundary, SpItemCard, SpItemForm, SpListTable, SpLoginConfig, SpProvider, SpProviderWithAuth, useSpAuth, useSpContext };
|