foundation-sdk 0.1.13 → 0.2.0
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 +316 -144
- package/dist/index.cjs +2 -288
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +210 -0
- package/dist/index.d.ts +210 -3
- package/dist/index.js +2 -288
- package/dist/index.js.map +1 -1
- package/package.json +21 -30
- package/dist/client.d.ts +0 -4
- package/dist/client.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -238
- package/dist/types.d.ts.map +0 -1
- package/dist/vue.cjs +0 -90
- package/dist/vue.cjs.map +0 -1
- package/dist/vue.d.ts +0 -34
- package/dist/vue.d.ts.map +0 -1
- package/dist/vue.js +0 -90
- package/dist/vue.js.map +0 -1
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
interface User {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
picture?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface FileMetadata {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
size: number;
|
|
13
|
+
url: string;
|
|
14
|
+
folder?: string;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
}
|
|
18
|
+
interface EntityChangeEvent {
|
|
19
|
+
changeType: string;
|
|
20
|
+
entityId?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
namespace?: string;
|
|
23
|
+
timestamp?: number;
|
|
24
|
+
}
|
|
25
|
+
interface FoundationConfig {
|
|
26
|
+
configUrl: string;
|
|
27
|
+
tenantId?: string;
|
|
28
|
+
appId?: string;
|
|
29
|
+
/** Override API base URL (e.g. '/api' when using a dev proxy) */
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
auth?: AuthClient;
|
|
32
|
+
}
|
|
33
|
+
interface FullConfig {
|
|
34
|
+
readonly app: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
version: string;
|
|
38
|
+
environment: string;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
};
|
|
41
|
+
readonly features: Record<string, unknown>;
|
|
42
|
+
readonly plans: unknown[];
|
|
43
|
+
readonly theme: {
|
|
44
|
+
colors: Record<string, string>;
|
|
45
|
+
dark: Record<string, string>;
|
|
46
|
+
defaultColorScheme?: string;
|
|
47
|
+
};
|
|
48
|
+
readonly connectors: Record<string, unknown>;
|
|
49
|
+
readonly resources: Record<string, string>;
|
|
50
|
+
readonly auth: {
|
|
51
|
+
provider: string;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
readonly raw: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface AuthClient {
|
|
57
|
+
login(options?: Record<string, unknown>): Promise<void>;
|
|
58
|
+
logout(options?: Record<string, unknown>): void | Promise<void>;
|
|
59
|
+
getUser(): Promise<User | undefined>;
|
|
60
|
+
getTokenSilently(options?: Record<string, unknown>): Promise<string>;
|
|
61
|
+
isAuthenticated(): Promise<boolean>;
|
|
62
|
+
signIn?(email: string, password: string): Promise<void>;
|
|
63
|
+
signUp?(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
64
|
+
forgotPassword?(email: string): Promise<void>;
|
|
65
|
+
resetPassword?(code: string, newPassword: string): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
interface AuthService {
|
|
68
|
+
readonly user: User | null;
|
|
69
|
+
readonly isAuthenticated: boolean;
|
|
70
|
+
getToken(): Promise<string>;
|
|
71
|
+
/** Redirect-based login (Auth0 Universal Login / Cognito Hosted UI) */
|
|
72
|
+
login(options?: Record<string, unknown>): Promise<void>;
|
|
73
|
+
logout(options?: Record<string, unknown>): Promise<void>;
|
|
74
|
+
/** Direct sign in with credentials (for custom login forms) */
|
|
75
|
+
signIn(email: string, password: string): Promise<void>;
|
|
76
|
+
/** Direct sign up (for custom registration forms) */
|
|
77
|
+
signUp(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
78
|
+
/** Initiate password reset */
|
|
79
|
+
forgotPassword(email: string): Promise<void>;
|
|
80
|
+
/** Complete password reset with code */
|
|
81
|
+
resetPassword(code: string, newPassword: string): Promise<void>;
|
|
82
|
+
onChange(callback: (user: User | null) => void): () => void;
|
|
83
|
+
}
|
|
84
|
+
interface DbService {
|
|
85
|
+
list<T = unknown>(entity: string, options?: {
|
|
86
|
+
filters?: Record<string, unknown>;
|
|
87
|
+
limit?: number;
|
|
88
|
+
cursor?: string;
|
|
89
|
+
orderBy?: string;
|
|
90
|
+
orderDir?: 'asc' | 'desc';
|
|
91
|
+
}): Promise<{
|
|
92
|
+
items: T[];
|
|
93
|
+
nextCursor?: string;
|
|
94
|
+
}>;
|
|
95
|
+
get<T = unknown>(entity: string, id: string): Promise<T>;
|
|
96
|
+
create<T = unknown>(entity: string, data: Partial<T>): Promise<T>;
|
|
97
|
+
update<T = unknown>(entity: string, id: string, updates: Partial<T>): Promise<T>;
|
|
98
|
+
save<T = unknown>(entity: string, data: Partial<T>): Promise<T>;
|
|
99
|
+
delete(entity: string, id: string): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
interface FilesService {
|
|
102
|
+
initiate(options: {
|
|
103
|
+
name: string;
|
|
104
|
+
contentType: string;
|
|
105
|
+
contentLength: number;
|
|
106
|
+
metadata?: Record<string, unknown>;
|
|
107
|
+
sha256: string;
|
|
108
|
+
}): Promise<{
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
signedUrl: string;
|
|
112
|
+
signedData: Record<string, string>;
|
|
113
|
+
}>;
|
|
114
|
+
upload(options: {
|
|
115
|
+
name: string;
|
|
116
|
+
contentType: string;
|
|
117
|
+
file: ArrayBuffer | Blob | File;
|
|
118
|
+
sha256: string;
|
|
119
|
+
}): Promise<{
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
status: string;
|
|
123
|
+
s3UploadComplete: boolean;
|
|
124
|
+
}>;
|
|
125
|
+
get(fileId: string): Promise<FileMetadata>;
|
|
126
|
+
delete(fileId: string): Promise<void>;
|
|
127
|
+
list(options?: {
|
|
128
|
+
limit?: number;
|
|
129
|
+
cursor?: string;
|
|
130
|
+
}): Promise<{
|
|
131
|
+
items: FileMetadata[];
|
|
132
|
+
nextCursor?: string;
|
|
133
|
+
}>;
|
|
134
|
+
}
|
|
135
|
+
interface AccountService {
|
|
136
|
+
get<TUser = User, TAccount = Record<string, unknown>>(): Promise<{
|
|
137
|
+
user: TUser;
|
|
138
|
+
account: TAccount;
|
|
139
|
+
}>;
|
|
140
|
+
update(data: Record<string, unknown>): Promise<void>;
|
|
141
|
+
usage(): Promise<Record<string, unknown>>;
|
|
142
|
+
resendVerification(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
interface Integration {
|
|
145
|
+
id: string;
|
|
146
|
+
name: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
icon?: string;
|
|
149
|
+
authType?: string;
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
}
|
|
152
|
+
interface IntegrationConnection {
|
|
153
|
+
id: string;
|
|
154
|
+
source: string;
|
|
155
|
+
connected: boolean;
|
|
156
|
+
[key: string]: unknown;
|
|
157
|
+
}
|
|
158
|
+
interface IntegrationDetail extends Integration {
|
|
159
|
+
connections: IntegrationConnection[];
|
|
160
|
+
connected: boolean;
|
|
161
|
+
connectionCount: number;
|
|
162
|
+
}
|
|
163
|
+
interface IntegrationService {
|
|
164
|
+
list(): Promise<Integration[]>;
|
|
165
|
+
connections(): Promise<IntegrationConnection[]>;
|
|
166
|
+
all(): Promise<IntegrationDetail[]>;
|
|
167
|
+
status(source: string): Promise<{
|
|
168
|
+
connected: boolean;
|
|
169
|
+
connections: IntegrationConnection[];
|
|
170
|
+
}>;
|
|
171
|
+
connect(source: string): Promise<{
|
|
172
|
+
success: boolean;
|
|
173
|
+
configuration?: unknown;
|
|
174
|
+
message?: string;
|
|
175
|
+
}>;
|
|
176
|
+
disconnect(source: string, configurationId: string): Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
interface OpenApiService {
|
|
179
|
+
get(): Promise<Record<string, unknown>>;
|
|
180
|
+
}
|
|
181
|
+
interface LogService {
|
|
182
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
183
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
184
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
185
|
+
event(event: string, data?: Record<string, unknown>): void;
|
|
186
|
+
}
|
|
187
|
+
interface Foundation {
|
|
188
|
+
readonly ready: Promise<void>;
|
|
189
|
+
readonly isReady: boolean;
|
|
190
|
+
auth: AuthService;
|
|
191
|
+
db: DbService;
|
|
192
|
+
files: FilesService;
|
|
193
|
+
integration: IntegrationService;
|
|
194
|
+
account: AccountService;
|
|
195
|
+
config: FullConfig;
|
|
196
|
+
openapi: OpenApiService;
|
|
197
|
+
log: LogService;
|
|
198
|
+
on(event: string, callback: (event: EntityChangeEvent) => void): () => void;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Foundation SDK — typed API client for the Foundation platform.
|
|
203
|
+
*
|
|
204
|
+
* One input: a config URL. The SDK fetches it, discovers auth, API URLs,
|
|
205
|
+
* features, plans, theme, connectors — everything. Self-configuring.
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
declare function createFoundation(options: FoundationConfig): Promise<Foundation>;
|
|
209
|
+
|
|
210
|
+
export { type AccountService, type AuthClient, type AuthService, type DbService, type EntityChangeEvent, type FileMetadata, type FilesService, type Foundation, type FoundationConfig, type FullConfig, type Integration, type IntegrationConnection, type IntegrationDetail, type IntegrationService, type LogService, type OpenApiService, type User, createFoundation };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,210 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
interface User {
|
|
2
|
+
id: string;
|
|
3
|
+
email: string;
|
|
4
|
+
name?: string;
|
|
5
|
+
picture?: string;
|
|
6
|
+
[key: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
interface FileMetadata {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
type: string;
|
|
12
|
+
size: number;
|
|
13
|
+
url: string;
|
|
14
|
+
folder?: string;
|
|
15
|
+
metadata?: Record<string, unknown>;
|
|
16
|
+
createdAt: string;
|
|
17
|
+
}
|
|
18
|
+
interface EntityChangeEvent {
|
|
19
|
+
changeType: string;
|
|
20
|
+
entityId?: string;
|
|
21
|
+
id?: string;
|
|
22
|
+
namespace?: string;
|
|
23
|
+
timestamp?: number;
|
|
24
|
+
}
|
|
25
|
+
interface FoundationConfig {
|
|
26
|
+
configUrl: string;
|
|
27
|
+
tenantId?: string;
|
|
28
|
+
appId?: string;
|
|
29
|
+
/** Override API base URL (e.g. '/api' when using a dev proxy) */
|
|
30
|
+
baseUrl?: string;
|
|
31
|
+
auth?: AuthClient;
|
|
32
|
+
}
|
|
33
|
+
interface FullConfig {
|
|
34
|
+
readonly app: {
|
|
35
|
+
id: string;
|
|
36
|
+
name: string;
|
|
37
|
+
version: string;
|
|
38
|
+
environment: string;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
};
|
|
41
|
+
readonly features: Record<string, unknown>;
|
|
42
|
+
readonly plans: unknown[];
|
|
43
|
+
readonly theme: {
|
|
44
|
+
colors: Record<string, string>;
|
|
45
|
+
dark: Record<string, string>;
|
|
46
|
+
defaultColorScheme?: string;
|
|
47
|
+
};
|
|
48
|
+
readonly connectors: Record<string, unknown>;
|
|
49
|
+
readonly resources: Record<string, string>;
|
|
50
|
+
readonly auth: {
|
|
51
|
+
provider: string;
|
|
52
|
+
[key: string]: unknown;
|
|
53
|
+
};
|
|
54
|
+
readonly raw: Record<string, unknown>;
|
|
55
|
+
}
|
|
56
|
+
interface AuthClient {
|
|
57
|
+
login(options?: Record<string, unknown>): Promise<void>;
|
|
58
|
+
logout(options?: Record<string, unknown>): void | Promise<void>;
|
|
59
|
+
getUser(): Promise<User | undefined>;
|
|
60
|
+
getTokenSilently(options?: Record<string, unknown>): Promise<string>;
|
|
61
|
+
isAuthenticated(): Promise<boolean>;
|
|
62
|
+
signIn?(email: string, password: string): Promise<void>;
|
|
63
|
+
signUp?(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
64
|
+
forgotPassword?(email: string): Promise<void>;
|
|
65
|
+
resetPassword?(code: string, newPassword: string): Promise<void>;
|
|
66
|
+
}
|
|
67
|
+
interface AuthService {
|
|
68
|
+
readonly user: User | null;
|
|
69
|
+
readonly isAuthenticated: boolean;
|
|
70
|
+
getToken(): Promise<string>;
|
|
71
|
+
/** Redirect-based login (Auth0 Universal Login / Cognito Hosted UI) */
|
|
72
|
+
login(options?: Record<string, unknown>): Promise<void>;
|
|
73
|
+
logout(options?: Record<string, unknown>): Promise<void>;
|
|
74
|
+
/** Direct sign in with credentials (for custom login forms) */
|
|
75
|
+
signIn(email: string, password: string): Promise<void>;
|
|
76
|
+
/** Direct sign up (for custom registration forms) */
|
|
77
|
+
signUp(email: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
78
|
+
/** Initiate password reset */
|
|
79
|
+
forgotPassword(email: string): Promise<void>;
|
|
80
|
+
/** Complete password reset with code */
|
|
81
|
+
resetPassword(code: string, newPassword: string): Promise<void>;
|
|
82
|
+
onChange(callback: (user: User | null) => void): () => void;
|
|
83
|
+
}
|
|
84
|
+
interface DbService {
|
|
85
|
+
list<T = unknown>(entity: string, options?: {
|
|
86
|
+
filters?: Record<string, unknown>;
|
|
87
|
+
limit?: number;
|
|
88
|
+
cursor?: string;
|
|
89
|
+
orderBy?: string;
|
|
90
|
+
orderDir?: 'asc' | 'desc';
|
|
91
|
+
}): Promise<{
|
|
92
|
+
items: T[];
|
|
93
|
+
nextCursor?: string;
|
|
94
|
+
}>;
|
|
95
|
+
get<T = unknown>(entity: string, id: string): Promise<T>;
|
|
96
|
+
create<T = unknown>(entity: string, data: Partial<T>): Promise<T>;
|
|
97
|
+
update<T = unknown>(entity: string, id: string, updates: Partial<T>): Promise<T>;
|
|
98
|
+
save<T = unknown>(entity: string, data: Partial<T>): Promise<T>;
|
|
99
|
+
delete(entity: string, id: string): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
interface FilesService {
|
|
102
|
+
initiate(options: {
|
|
103
|
+
name: string;
|
|
104
|
+
contentType: string;
|
|
105
|
+
contentLength: number;
|
|
106
|
+
metadata?: Record<string, unknown>;
|
|
107
|
+
sha256: string;
|
|
108
|
+
}): Promise<{
|
|
109
|
+
id: string;
|
|
110
|
+
name: string;
|
|
111
|
+
signedUrl: string;
|
|
112
|
+
signedData: Record<string, string>;
|
|
113
|
+
}>;
|
|
114
|
+
upload(options: {
|
|
115
|
+
name: string;
|
|
116
|
+
contentType: string;
|
|
117
|
+
file: ArrayBuffer | Blob | File;
|
|
118
|
+
sha256: string;
|
|
119
|
+
}): Promise<{
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
status: string;
|
|
123
|
+
s3UploadComplete: boolean;
|
|
124
|
+
}>;
|
|
125
|
+
get(fileId: string): Promise<FileMetadata>;
|
|
126
|
+
delete(fileId: string): Promise<void>;
|
|
127
|
+
list(options?: {
|
|
128
|
+
limit?: number;
|
|
129
|
+
cursor?: string;
|
|
130
|
+
}): Promise<{
|
|
131
|
+
items: FileMetadata[];
|
|
132
|
+
nextCursor?: string;
|
|
133
|
+
}>;
|
|
134
|
+
}
|
|
135
|
+
interface AccountService {
|
|
136
|
+
get<TUser = User, TAccount = Record<string, unknown>>(): Promise<{
|
|
137
|
+
user: TUser;
|
|
138
|
+
account: TAccount;
|
|
139
|
+
}>;
|
|
140
|
+
update(data: Record<string, unknown>): Promise<void>;
|
|
141
|
+
usage(): Promise<Record<string, unknown>>;
|
|
142
|
+
resendVerification(): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
interface Integration {
|
|
145
|
+
id: string;
|
|
146
|
+
name: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
icon?: string;
|
|
149
|
+
authType?: string;
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
}
|
|
152
|
+
interface IntegrationConnection {
|
|
153
|
+
id: string;
|
|
154
|
+
source: string;
|
|
155
|
+
connected: boolean;
|
|
156
|
+
[key: string]: unknown;
|
|
157
|
+
}
|
|
158
|
+
interface IntegrationDetail extends Integration {
|
|
159
|
+
connections: IntegrationConnection[];
|
|
160
|
+
connected: boolean;
|
|
161
|
+
connectionCount: number;
|
|
162
|
+
}
|
|
163
|
+
interface IntegrationService {
|
|
164
|
+
list(): Promise<Integration[]>;
|
|
165
|
+
connections(): Promise<IntegrationConnection[]>;
|
|
166
|
+
all(): Promise<IntegrationDetail[]>;
|
|
167
|
+
status(source: string): Promise<{
|
|
168
|
+
connected: boolean;
|
|
169
|
+
connections: IntegrationConnection[];
|
|
170
|
+
}>;
|
|
171
|
+
connect(source: string): Promise<{
|
|
172
|
+
success: boolean;
|
|
173
|
+
configuration?: unknown;
|
|
174
|
+
message?: string;
|
|
175
|
+
}>;
|
|
176
|
+
disconnect(source: string, configurationId: string): Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
interface OpenApiService {
|
|
179
|
+
get(): Promise<Record<string, unknown>>;
|
|
180
|
+
}
|
|
181
|
+
interface LogService {
|
|
182
|
+
info(message: string, context?: Record<string, unknown>): void;
|
|
183
|
+
warn(message: string, context?: Record<string, unknown>): void;
|
|
184
|
+
error(message: string, context?: Record<string, unknown>): void;
|
|
185
|
+
event(event: string, data?: Record<string, unknown>): void;
|
|
186
|
+
}
|
|
187
|
+
interface Foundation {
|
|
188
|
+
readonly ready: Promise<void>;
|
|
189
|
+
readonly isReady: boolean;
|
|
190
|
+
auth: AuthService;
|
|
191
|
+
db: DbService;
|
|
192
|
+
files: FilesService;
|
|
193
|
+
integration: IntegrationService;
|
|
194
|
+
account: AccountService;
|
|
195
|
+
config: FullConfig;
|
|
196
|
+
openapi: OpenApiService;
|
|
197
|
+
log: LogService;
|
|
198
|
+
on(event: string, callback: (event: EntityChangeEvent) => void): () => void;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Foundation SDK — typed API client for the Foundation platform.
|
|
203
|
+
*
|
|
204
|
+
* One input: a config URL. The SDK fetches it, discovers auth, API URLs,
|
|
205
|
+
* features, plans, theme, connectors — everything. Self-configuring.
|
|
206
|
+
*/
|
|
207
|
+
|
|
208
|
+
declare function createFoundation(options: FoundationConfig): Promise<Foundation>;
|
|
209
|
+
|
|
210
|
+
export { type AccountService, type AuthClient, type AuthService, type DbService, type EntityChangeEvent, type FileMetadata, type FilesService, type Foundation, type FoundationConfig, type FullConfig, type Integration, type IntegrationConnection, type IntegrationDetail, type IntegrationService, type LogService, type OpenApiService, type User, createFoundation };
|