s3db.js 3.3.2 → 4.0.1
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 +99 -857
- package/dist/s3db.cjs.js +5449 -2028
- package/dist/s3db.cjs.min.js +15 -7
- package/dist/s3db.d.ts +133 -0
- package/dist/s3db.es.js +5453 -2032
- package/dist/s3db.es.min.js +15 -7
- package/dist/s3db.iife.js +5450 -2030
- package/dist/s3db.iife.min.js +15 -7
- package/package.json +36 -16
- package/UNLICENSE +0 -24
- package/docker-compose.yml +0 -18
- package/jest.config.js +0 -22
- package/rollup.config.js +0 -77
- package/scripts/prefix-files-istanbul-ignore.js +0 -18
package/dist/s3db.d.ts
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
declare module 's3db.js' {
|
|
2
|
+
export interface S3dbConfig {
|
|
3
|
+
connectionString?: string;
|
|
4
|
+
region?: string;
|
|
5
|
+
accessKeyId?: string;
|
|
6
|
+
secretAccessKey?: string;
|
|
7
|
+
bucket?: string;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
encryption?: boolean;
|
|
10
|
+
compression?: boolean;
|
|
11
|
+
cache?: boolean;
|
|
12
|
+
cacheTTL?: number;
|
|
13
|
+
maxConcurrency?: number;
|
|
14
|
+
retryAttempts?: number;
|
|
15
|
+
retryDelay?: number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface ResourceConfig {
|
|
19
|
+
name: string;
|
|
20
|
+
schema?: any;
|
|
21
|
+
encryption?: boolean;
|
|
22
|
+
compression?: boolean;
|
|
23
|
+
cache?: boolean;
|
|
24
|
+
cacheTTL?: number;
|
|
25
|
+
maxSize?: number;
|
|
26
|
+
partitions?: string[];
|
|
27
|
+
behaviors?: string[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface QueryOptions {
|
|
31
|
+
limit?: number;
|
|
32
|
+
offset?: number;
|
|
33
|
+
sort?: string;
|
|
34
|
+
order?: 'asc' | 'desc';
|
|
35
|
+
filter?: any;
|
|
36
|
+
select?: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface InsertOptions {
|
|
40
|
+
encryption?: boolean;
|
|
41
|
+
compression?: boolean;
|
|
42
|
+
cache?: boolean;
|
|
43
|
+
cacheTTL?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface UpdateOptions extends InsertOptions {
|
|
47
|
+
upsert?: boolean;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface DeleteOptions {
|
|
51
|
+
cascade?: boolean;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export class S3db {
|
|
55
|
+
constructor(config?: S3dbConfig);
|
|
56
|
+
|
|
57
|
+
// Connection methods
|
|
58
|
+
connect(): Promise<void>;
|
|
59
|
+
disconnect(): Promise<void>;
|
|
60
|
+
isConnected(): boolean;
|
|
61
|
+
|
|
62
|
+
// Resource methods
|
|
63
|
+
resource(name: string, config?: ResourceConfig): Resource;
|
|
64
|
+
getResource(name: string): Resource;
|
|
65
|
+
listResources(): Promise<string[]>;
|
|
66
|
+
deleteResource(name: string, options?: DeleteOptions): Promise<void>;
|
|
67
|
+
|
|
68
|
+
// Utility methods
|
|
69
|
+
getVersion(): string;
|
|
70
|
+
getConfig(): S3dbConfig;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export class Resource {
|
|
74
|
+
constructor(database: S3db, name: string, config?: ResourceConfig);
|
|
75
|
+
|
|
76
|
+
// CRUD operations
|
|
77
|
+
insert(data: any, options?: InsertOptions): Promise<any>;
|
|
78
|
+
insertMany(data: any[], options?: InsertOptions): Promise<any[]>;
|
|
79
|
+
find(query?: any, options?: QueryOptions): Promise<any[]>;
|
|
80
|
+
findOne(query?: any, options?: QueryOptions): Promise<any | null>;
|
|
81
|
+
update(query: any, data: any, options?: UpdateOptions): Promise<number>;
|
|
82
|
+
delete(query: any, options?: DeleteOptions): Promise<number>;
|
|
83
|
+
|
|
84
|
+
// Stream operations
|
|
85
|
+
createReadStream(query?: any, options?: QueryOptions): NodeJS.ReadableStream;
|
|
86
|
+
createWriteStream(options?: InsertOptions): NodeJS.WritableStream;
|
|
87
|
+
|
|
88
|
+
// Schema operations
|
|
89
|
+
getSchema(): any;
|
|
90
|
+
setSchema(schema: any): void;
|
|
91
|
+
validate(data: any): boolean;
|
|
92
|
+
|
|
93
|
+
// Partition operations
|
|
94
|
+
getPartitions(): string[];
|
|
95
|
+
setPartitions(partitions: string[]): void;
|
|
96
|
+
|
|
97
|
+
// Behavior operations
|
|
98
|
+
getBehaviors(): string[];
|
|
99
|
+
setBehaviors(behaviors: string[]): void;
|
|
100
|
+
|
|
101
|
+
// Utility methods
|
|
102
|
+
getName(): string;
|
|
103
|
+
getConfig(): ResourceConfig;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export class ConnectionString {
|
|
107
|
+
constructor(connectionString: string);
|
|
108
|
+
parse(): S3dbConfig;
|
|
109
|
+
toString(): string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export class Validator {
|
|
113
|
+
constructor(schema?: any);
|
|
114
|
+
validate(data: any): boolean;
|
|
115
|
+
getErrors(): string[];
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// Error classes
|
|
119
|
+
export class S3dbError extends Error {
|
|
120
|
+
constructor(message: string, code?: string);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export class ValidationError extends S3dbError {
|
|
124
|
+
constructor(message: string, errors?: string[]);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export class ConnectionError extends S3dbError {
|
|
128
|
+
constructor(message: string);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Default export
|
|
132
|
+
export default S3db;
|
|
133
|
+
}
|