@baasix/sdk 0.1.0 → 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 +38 -0
- package/dist/client-BHbM3KOy.d.cts +95 -0
- package/dist/client-D67LK80v.d.ts +95 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +99 -3
- package/dist/index.d.ts +99 -3
- package/dist/index.js.map +1 -1
- package/dist/modules/auth.cjs.map +1 -1
- package/dist/modules/auth.d.cts +4 -2
- package/dist/modules/auth.d.ts +4 -2
- package/dist/modules/auth.js.map +1 -1
- package/dist/modules/files.d.cts +4 -2
- package/dist/modules/files.d.ts +4 -2
- package/dist/modules/items.d.cts +4 -3
- package/dist/modules/items.d.ts +4 -3
- package/dist/modules/schemas.d.cts +4 -2
- package/dist/modules/schemas.d.ts +4 -2
- package/package.json +4 -1
- package/dist/client-DeXa-R9w.d.ts +0 -680
- package/dist/client-VT7NckyI.d.cts +0 -680
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HttpClient
|
|
2
|
-
export {
|
|
1
|
+
import { H as HttpClient } from './client-BHbM3KOy.cjs';
|
|
2
|
+
export { a as HttpClientConfig, R as RequestOptions } from './client-BHbM3KOy.cjs';
|
|
3
3
|
import { S as StorageAdapter } from './types-BdjsGANq.cjs';
|
|
4
4
|
export { a as STORAGE_KEYS, b as StorageKey } from './types-BdjsGANq.cjs';
|
|
5
5
|
import { AuthModule } from './modules/auth.cjs';
|
|
@@ -8,8 +8,104 @@ import { ItemsModule } from './modules/items.cjs';
|
|
|
8
8
|
export { ImportResult, QueryBuilder } from './modules/items.cjs';
|
|
9
9
|
import { FilesModule } from './modules/files.cjs';
|
|
10
10
|
import { SchemasModule } from './modules/schemas.cjs';
|
|
11
|
+
import { AuthMode, AuthStateEvent, User as User$1, PaginatedResponse, Notification, SendNotificationData, Permission, CreatePermissionData, Role as Role$1, Settings, ReportConfig, ReportResult, Aggregate, Filter, Workflow, WorkflowExecution, BaseItem } from '@baasix/types';
|
|
12
|
+
export { Accountability, Aggregate, AggregateConfig, AggregateFunction, AnyRecord, AssetQuery, AssetTransformOptions, AssociationDefinition, AssociationType, AuthMode, AuthResponse, AuthState, AuthStateEvent, AuthTokens, BackgroundTask, BaseItem, BulkResponse, CacheConfig, CacheStrategy, CollectionItem, CreatePermissionData, DatePart, DateTruncPrecision, DeepPartial, DefaultValueType, DeleteResponse, ErrorResponse, ExportOptions, ExportResult, FieldDefinition, FieldInfo, FieldType, FieldValidation, FieldValidationRules, FieldValues, FileData, FileMetadata, Filter, FilterCondition, FilterObject, FilterOperator, FilterValue, FlattenedField, GeoJSONGeometry, GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon, Hook, HookContext, HookEvent, HookHandler, HttpMethod, ImportOptions, IncludeConfig, IndexDefinition, InternalUploadedFile, JWTPayload, KeysOfType, LogicalFilter, LoginCredentials, MagicLinkOptions, MailOptions, MutationResponse, Notification, NotificationOptions, NotificationType, OAuth2Tokens, OAuth2UserInfo, PaginatedResponse, PaginationMetadata, PaginationOptions, PasswordResetOptions, Permission, PermissionAction, PermissionData, ProcessedImage, ProcessedInclude, QueryContext, QueryOptions, QueryParams, ReadResult, RegisterData, RelationshipDefinition, RelationshipType, ReportConfig, ReportResult, SchemaDefinition, SchemaInfo, SchemaValidation, SeedData, SeedResult, SendNotificationData, SenderConfig, Session, Settings, SingleResponse, SoftDeletableItem, Sort, SortDirection, SortItem, SortObject, StorageProvider, Tenant, TenantSettings, TimestampedItem, UploadOptions, UploadedFile, User, UserWithPassword, UserWithRolesAndPermissions, ValidationResult, WithOptional, WithRequired, Workflow, WorkflowEdge, WorkflowExecution, WorkflowExecutionLog, WorkflowExecutionStatus, WorkflowFlowData, WorkflowNode, WorkflowNodeData, WorkflowStatus, WorkflowTrigger, WorkflowTriggerType } from '@baasix/types';
|
|
11
13
|
export { AsyncStorageAdapter, LocalStorageAdapter, MemoryStorageAdapter } from './storage/index.cjs';
|
|
12
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Baasix SDK Types
|
|
17
|
+
*
|
|
18
|
+
* This file re-exports shared types from @baasix/types and defines
|
|
19
|
+
* SDK-specific types that are not shared with other packages.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* SDK Configuration options
|
|
24
|
+
*/
|
|
25
|
+
interface BaasixConfig {
|
|
26
|
+
/**
|
|
27
|
+
* The base URL of your Baasix instance
|
|
28
|
+
* @example 'https://api.example.com' or 'http://localhost:8056'
|
|
29
|
+
*/
|
|
30
|
+
url: string;
|
|
31
|
+
/**
|
|
32
|
+
* Authentication mode
|
|
33
|
+
* @default 'jwt'
|
|
34
|
+
*/
|
|
35
|
+
authMode?: AuthMode;
|
|
36
|
+
/**
|
|
37
|
+
* Storage adapter for persisting tokens and user data
|
|
38
|
+
* @default LocalStorageAdapter (web) or MemoryStorageAdapter (SSR)
|
|
39
|
+
*/
|
|
40
|
+
storage?: StorageAdapter;
|
|
41
|
+
/**
|
|
42
|
+
* Static access token (useful for server-side or service accounts)
|
|
43
|
+
* When provided, this token is used instead of stored tokens
|
|
44
|
+
*/
|
|
45
|
+
token?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Custom headers to include in all requests
|
|
48
|
+
*/
|
|
49
|
+
headers?: Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Request timeout in milliseconds
|
|
52
|
+
* @default 30000 (30 seconds)
|
|
53
|
+
*/
|
|
54
|
+
timeout?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to automatically refresh tokens before expiry
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
autoRefresh?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Credentials mode for fetch requests (important for cookies)
|
|
62
|
+
* @default 'include' for cookie mode, 'same-origin' for jwt mode
|
|
63
|
+
*/
|
|
64
|
+
credentials?: RequestCredentials;
|
|
65
|
+
/**
|
|
66
|
+
* Tenant ID for multi-tenant mode
|
|
67
|
+
*/
|
|
68
|
+
tenantId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Global error handler
|
|
71
|
+
*/
|
|
72
|
+
onError?: (error: BaasixError) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Called when authentication state changes
|
|
75
|
+
*/
|
|
76
|
+
onAuthStateChange?: (event: AuthStateEvent, user: User$1 | null) => void;
|
|
77
|
+
/**
|
|
78
|
+
* WebSocket server URL for realtime features
|
|
79
|
+
* @default Same as url
|
|
80
|
+
*/
|
|
81
|
+
socketUrl?: string;
|
|
82
|
+
/**
|
|
83
|
+
* WebSocket path
|
|
84
|
+
* @default '/socket'
|
|
85
|
+
*/
|
|
86
|
+
socketPath?: string;
|
|
87
|
+
}
|
|
88
|
+
interface BaasixErrorDetails {
|
|
89
|
+
code?: string;
|
|
90
|
+
field?: string;
|
|
91
|
+
message?: string;
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
}
|
|
94
|
+
declare class BaasixError extends Error {
|
|
95
|
+
readonly status: number;
|
|
96
|
+
readonly code?: string;
|
|
97
|
+
readonly details?: BaasixErrorDetails[];
|
|
98
|
+
readonly isRetryable: boolean;
|
|
99
|
+
constructor(message: string, status?: number, code?: string, details?: BaasixErrorDetails[]);
|
|
100
|
+
toJSON(): {
|
|
101
|
+
name: string;
|
|
102
|
+
message: string;
|
|
103
|
+
status: number;
|
|
104
|
+
code: string | undefined;
|
|
105
|
+
details: BaasixErrorDetails[] | undefined;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
13
109
|
interface NotificationsModuleConfig {
|
|
14
110
|
client: HttpClient;
|
|
15
111
|
}
|
|
@@ -1785,4 +1881,4 @@ declare class Baasix {
|
|
|
1785
1881
|
*/
|
|
1786
1882
|
declare function createBaasix(config: BaasixConfig): Baasix;
|
|
1787
1883
|
|
|
1788
|
-
export {
|
|
1884
|
+
export { AuthModule, Baasix, type BaasixConfig, BaasixError, type BaasixErrorDetails, type CreateMigrationOptions, type CreateRoleData, type CreateUserData, FilesModule, HttpClient, ItemsModule, type Migration, type MigrationRunOptions, type MigrationRunResult, type MigrationStatus, MigrationsModule, NotificationsModule, type PendingMigration, PermissionsModule, RealtimeChannel, type RealtimeConfig, RealtimeModule, ReportsModule, type Role, RolesModule, type RollbackResult, SchemasModule, SettingsModule, type StatsQuery, type StatsResult, StorageAdapter, type SubscriptionCallback, type SubscriptionEvent, type SubscriptionPayload, type UpdateUserData, type UserQueryOptions, UsersModule, type WorkflowExecutionUpdate, WorkflowsModule, createBaasix };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { H as HttpClient
|
|
2
|
-
export {
|
|
1
|
+
import { H as HttpClient } from './client-D67LK80v.js';
|
|
2
|
+
export { a as HttpClientConfig, R as RequestOptions } from './client-D67LK80v.js';
|
|
3
3
|
import { S as StorageAdapter } from './types-BdjsGANq.js';
|
|
4
4
|
export { a as STORAGE_KEYS, b as StorageKey } from './types-BdjsGANq.js';
|
|
5
5
|
import { AuthModule } from './modules/auth.js';
|
|
@@ -8,8 +8,104 @@ import { ItemsModule } from './modules/items.js';
|
|
|
8
8
|
export { ImportResult, QueryBuilder } from './modules/items.js';
|
|
9
9
|
import { FilesModule } from './modules/files.js';
|
|
10
10
|
import { SchemasModule } from './modules/schemas.js';
|
|
11
|
+
import { AuthMode, AuthStateEvent, User as User$1, PaginatedResponse, Notification, SendNotificationData, Permission, CreatePermissionData, Role as Role$1, Settings, ReportConfig, ReportResult, Aggregate, Filter, Workflow, WorkflowExecution, BaseItem } from '@baasix/types';
|
|
12
|
+
export { Accountability, Aggregate, AggregateConfig, AggregateFunction, AnyRecord, AssetQuery, AssetTransformOptions, AssociationDefinition, AssociationType, AuthMode, AuthResponse, AuthState, AuthStateEvent, AuthTokens, BackgroundTask, BaseItem, BulkResponse, CacheConfig, CacheStrategy, CollectionItem, CreatePermissionData, DatePart, DateTruncPrecision, DeepPartial, DefaultValueType, DeleteResponse, ErrorResponse, ExportOptions, ExportResult, FieldDefinition, FieldInfo, FieldType, FieldValidation, FieldValidationRules, FieldValues, FileData, FileMetadata, Filter, FilterCondition, FilterObject, FilterOperator, FilterValue, FlattenedField, GeoJSONGeometry, GeoJSONLineString, GeoJSONPoint, GeoJSONPolygon, Hook, HookContext, HookEvent, HookHandler, HttpMethod, ImportOptions, IncludeConfig, IndexDefinition, InternalUploadedFile, JWTPayload, KeysOfType, LogicalFilter, LoginCredentials, MagicLinkOptions, MailOptions, MutationResponse, Notification, NotificationOptions, NotificationType, OAuth2Tokens, OAuth2UserInfo, PaginatedResponse, PaginationMetadata, PaginationOptions, PasswordResetOptions, Permission, PermissionAction, PermissionData, ProcessedImage, ProcessedInclude, QueryContext, QueryOptions, QueryParams, ReadResult, RegisterData, RelationshipDefinition, RelationshipType, ReportConfig, ReportResult, SchemaDefinition, SchemaInfo, SchemaValidation, SeedData, SeedResult, SendNotificationData, SenderConfig, Session, Settings, SingleResponse, SoftDeletableItem, Sort, SortDirection, SortItem, SortObject, StorageProvider, Tenant, TenantSettings, TimestampedItem, UploadOptions, UploadedFile, User, UserWithPassword, UserWithRolesAndPermissions, ValidationResult, WithOptional, WithRequired, Workflow, WorkflowEdge, WorkflowExecution, WorkflowExecutionLog, WorkflowExecutionStatus, WorkflowFlowData, WorkflowNode, WorkflowNodeData, WorkflowStatus, WorkflowTrigger, WorkflowTriggerType } from '@baasix/types';
|
|
11
13
|
export { AsyncStorageAdapter, LocalStorageAdapter, MemoryStorageAdapter } from './storage/index.js';
|
|
12
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Baasix SDK Types
|
|
17
|
+
*
|
|
18
|
+
* This file re-exports shared types from @baasix/types and defines
|
|
19
|
+
* SDK-specific types that are not shared with other packages.
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* SDK Configuration options
|
|
24
|
+
*/
|
|
25
|
+
interface BaasixConfig {
|
|
26
|
+
/**
|
|
27
|
+
* The base URL of your Baasix instance
|
|
28
|
+
* @example 'https://api.example.com' or 'http://localhost:8056'
|
|
29
|
+
*/
|
|
30
|
+
url: string;
|
|
31
|
+
/**
|
|
32
|
+
* Authentication mode
|
|
33
|
+
* @default 'jwt'
|
|
34
|
+
*/
|
|
35
|
+
authMode?: AuthMode;
|
|
36
|
+
/**
|
|
37
|
+
* Storage adapter for persisting tokens and user data
|
|
38
|
+
* @default LocalStorageAdapter (web) or MemoryStorageAdapter (SSR)
|
|
39
|
+
*/
|
|
40
|
+
storage?: StorageAdapter;
|
|
41
|
+
/**
|
|
42
|
+
* Static access token (useful for server-side or service accounts)
|
|
43
|
+
* When provided, this token is used instead of stored tokens
|
|
44
|
+
*/
|
|
45
|
+
token?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Custom headers to include in all requests
|
|
48
|
+
*/
|
|
49
|
+
headers?: Record<string, string>;
|
|
50
|
+
/**
|
|
51
|
+
* Request timeout in milliseconds
|
|
52
|
+
* @default 30000 (30 seconds)
|
|
53
|
+
*/
|
|
54
|
+
timeout?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Whether to automatically refresh tokens before expiry
|
|
57
|
+
* @default true
|
|
58
|
+
*/
|
|
59
|
+
autoRefresh?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Credentials mode for fetch requests (important for cookies)
|
|
62
|
+
* @default 'include' for cookie mode, 'same-origin' for jwt mode
|
|
63
|
+
*/
|
|
64
|
+
credentials?: RequestCredentials;
|
|
65
|
+
/**
|
|
66
|
+
* Tenant ID for multi-tenant mode
|
|
67
|
+
*/
|
|
68
|
+
tenantId?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Global error handler
|
|
71
|
+
*/
|
|
72
|
+
onError?: (error: BaasixError) => void;
|
|
73
|
+
/**
|
|
74
|
+
* Called when authentication state changes
|
|
75
|
+
*/
|
|
76
|
+
onAuthStateChange?: (event: AuthStateEvent, user: User$1 | null) => void;
|
|
77
|
+
/**
|
|
78
|
+
* WebSocket server URL for realtime features
|
|
79
|
+
* @default Same as url
|
|
80
|
+
*/
|
|
81
|
+
socketUrl?: string;
|
|
82
|
+
/**
|
|
83
|
+
* WebSocket path
|
|
84
|
+
* @default '/socket'
|
|
85
|
+
*/
|
|
86
|
+
socketPath?: string;
|
|
87
|
+
}
|
|
88
|
+
interface BaasixErrorDetails {
|
|
89
|
+
code?: string;
|
|
90
|
+
field?: string;
|
|
91
|
+
message?: string;
|
|
92
|
+
[key: string]: unknown;
|
|
93
|
+
}
|
|
94
|
+
declare class BaasixError extends Error {
|
|
95
|
+
readonly status: number;
|
|
96
|
+
readonly code?: string;
|
|
97
|
+
readonly details?: BaasixErrorDetails[];
|
|
98
|
+
readonly isRetryable: boolean;
|
|
99
|
+
constructor(message: string, status?: number, code?: string, details?: BaasixErrorDetails[]);
|
|
100
|
+
toJSON(): {
|
|
101
|
+
name: string;
|
|
102
|
+
message: string;
|
|
103
|
+
status: number;
|
|
104
|
+
code: string | undefined;
|
|
105
|
+
details: BaasixErrorDetails[] | undefined;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
|
|
13
109
|
interface NotificationsModuleConfig {
|
|
14
110
|
client: HttpClient;
|
|
15
111
|
}
|
|
@@ -1785,4 +1881,4 @@ declare class Baasix {
|
|
|
1785
1881
|
*/
|
|
1786
1882
|
declare function createBaasix(config: BaasixConfig): Baasix;
|
|
1787
1883
|
|
|
1788
|
-
export {
|
|
1884
|
+
export { AuthModule, Baasix, type BaasixConfig, BaasixError, type BaasixErrorDetails, type CreateMigrationOptions, type CreateRoleData, type CreateUserData, FilesModule, HttpClient, ItemsModule, type Migration, type MigrationRunOptions, type MigrationRunResult, type MigrationStatus, MigrationsModule, NotificationsModule, type PendingMigration, PermissionsModule, RealtimeChannel, type RealtimeConfig, RealtimeModule, ReportsModule, type Role, RolesModule, type RollbackResult, SchemasModule, SettingsModule, type StatsQuery, type StatsResult, StorageAdapter, type SubscriptionCallback, type SubscriptionEvent, type SubscriptionPayload, type UpdateUserData, type UserQueryOptions, UsersModule, type WorkflowExecutionUpdate, WorkflowsModule, createBaasix };
|