node-firebird 0.9.6 → 1.0.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/.github/workflows/node.js.yml +78 -0
- package/README.md +45 -8
- package/lib/gdscodes.d.ts +1524 -0
- package/lib/gdscodes.js +1531 -0
- package/lib/index.d.ts +218 -16
- package/lib/index.js +298 -105
- package/lib/messages.js +1 -1
- package/lib/serialize.js +13 -19
- package/lib/srp.js +281 -0
- package/package.json +2 -1
- package/.github/workflows/npmpublish.yml +0 -47
package/lib/index.d.ts
CHANGED
|
@@ -4,33 +4,51 @@
|
|
|
4
4
|
|
|
5
5
|
declare module 'node-firebird' {
|
|
6
6
|
type DatabaseCallback = (err: any, db: Database) => void;
|
|
7
|
-
|
|
8
|
-
type TransactionCallback = (err: Options, transaction: Transaction) => void;
|
|
7
|
+
type TransactionCallback = (err: any, transaction: Transaction) => void;
|
|
9
8
|
type QueryCallback = (err: any, result: any[]) => void;
|
|
10
9
|
type SimpleCallback = (err: any) => void;
|
|
11
10
|
type SequentialCallback = (row: any, index: number) => void;
|
|
12
11
|
|
|
12
|
+
export const AUTH_PLUGIN_LEGACY: string;
|
|
13
|
+
export const AUTH_PLUGIN_SRP: string;
|
|
14
|
+
export const AUTH_PLUGIN_SRP256: string;
|
|
15
|
+
|
|
16
|
+
export const WIRE_CRYPT_ENABLE: number;
|
|
17
|
+
export const WIRE_CRYPT_DISABLE: number;
|
|
18
|
+
|
|
19
|
+
/** A transaction sees changes done by uncommitted transactions. */
|
|
13
20
|
export const ISOLATION_READ_UNCOMMITTED: number[];
|
|
21
|
+
/** A transaction sees only data committed before the statement has been executed. */
|
|
14
22
|
export const ISOLATION_READ_COMMITED: number[];
|
|
23
|
+
/** A transaction sees during its lifetime only data committed before the transaction has been started. */
|
|
15
24
|
export const ISOLATION_REPEATABLE_READ: number[];
|
|
25
|
+
/**
|
|
26
|
+
* This is the strictest isolation level, which enforces transaction serialization.
|
|
27
|
+
* Data accessed in the context of a serializable transaction cannot be accessed by any other transaction.
|
|
28
|
+
*/
|
|
16
29
|
export const ISOLATION_SERIALIZABLE: number[];
|
|
17
30
|
export const ISOLATION_READ_COMMITED_READ_ONLY: number[];
|
|
18
31
|
|
|
19
32
|
export type Isolation = number[];
|
|
20
33
|
|
|
21
34
|
export interface Database {
|
|
22
|
-
detach(callback?: SimpleCallback):
|
|
23
|
-
transaction(isolation: Isolation, callback: TransactionCallback):
|
|
24
|
-
query(query: string, params: any[], callback: QueryCallback):
|
|
25
|
-
execute(query: string, params: any[], callback: QueryCallback):
|
|
26
|
-
sequentially(query: string, params: any[], rowCallback: SequentialCallback, callback: SimpleCallback):
|
|
35
|
+
detach(callback?: SimpleCallback): Database;
|
|
36
|
+
transaction(isolation: Isolation, callback: TransactionCallback): Database;
|
|
37
|
+
query(query: string, params: any[], callback: QueryCallback): Database;
|
|
38
|
+
execute(query: string, params: any[], callback: QueryCallback): Database;
|
|
39
|
+
sequentially(query: string, params: any[], rowCallback: SequentialCallback, callback: SimpleCallback, asArray?: boolean): Database;
|
|
40
|
+
drop(callback: SimpleCallback): void;
|
|
41
|
+
escape(value: any): string;
|
|
27
42
|
}
|
|
28
43
|
|
|
29
44
|
export interface Transaction {
|
|
30
45
|
query(query: string, params: any[], callback: QueryCallback): void;
|
|
31
46
|
execute(query: string, params: any[], callback: QueryCallback): void;
|
|
47
|
+
sequentially(query: string, params: any[], rowCallback: SequentialCallback, callback: SimpleCallback, asArray?: boolean): Database;
|
|
32
48
|
commit(callback?: SimpleCallback): void;
|
|
33
|
-
|
|
49
|
+
commitRetaining(callback?: SimpleCallback): void;
|
|
50
|
+
rollback(callback?: SimpleCallback): void;
|
|
51
|
+
rollbackRetaining(callback?: SimpleCallback): void;
|
|
34
52
|
}
|
|
35
53
|
|
|
36
54
|
export interface Options {
|
|
@@ -40,18 +58,202 @@ declare module 'node-firebird' {
|
|
|
40
58
|
user?: string;
|
|
41
59
|
password?: string;
|
|
42
60
|
lowercase_keys?: boolean;
|
|
43
|
-
role?: string;
|
|
44
|
-
pageSize?: number;
|
|
61
|
+
role?: string;
|
|
62
|
+
pageSize?: number;
|
|
63
|
+
retryConnectionInterval?: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface SvcMgrOptions extends Options {
|
|
67
|
+
manager: true; // Attach to ServiceManager
|
|
45
68
|
}
|
|
46
69
|
|
|
47
70
|
export interface ConnectionPool {
|
|
48
71
|
get(callback: DatabaseCallback): void;
|
|
49
|
-
destroy(): void;
|
|
72
|
+
destroy(callback?: SimpleCallback): void;
|
|
50
73
|
}
|
|
51
|
-
|
|
52
|
-
export function attach(options: Options, callback: DatabaseCallback): void;
|
|
53
|
-
export function
|
|
54
|
-
export function
|
|
74
|
+
|
|
75
|
+
export function attach(options: Options, callback: DatabaseCallback): void;
|
|
76
|
+
export function attach(options: SvcMgrOptions, callback: ServiceManagerCallback): void;
|
|
77
|
+
export function escape(value: any, protocolVersion?: number /*PROTOCOL_VERSION13*/): string;
|
|
78
|
+
export function create(options: Options, callback: DatabaseCallback): void;
|
|
55
79
|
export function attachOrCreate(options: Options, callback: DatabaseCallback): void;
|
|
56
|
-
export function pool(max: number,options: Options
|
|
80
|
+
export function pool(max: number, options: Options): ConnectionPool;
|
|
81
|
+
export function drop(options: Options, callback: SimpleCallback): void;
|
|
82
|
+
|
|
83
|
+
interface ReadableOptions {
|
|
84
|
+
optread?: 'byline' | 'buffer'; // default 'byline'
|
|
85
|
+
buffersize?: number; // default 'byline': 2048, 'buffer': 8192
|
|
86
|
+
timeout?: number;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface BackupOptions extends ReadableOptions {
|
|
90
|
+
database?: string;
|
|
91
|
+
files: string | { filename: string, sizefile: string }[];
|
|
92
|
+
factor?: number; // If backing up to a physical tape device, this switch lets you specify the tape's blocking factor
|
|
93
|
+
verbose?: boolean;
|
|
94
|
+
ignorechecksums?: boolean;
|
|
95
|
+
ignorelimbo?: boolean;
|
|
96
|
+
metadataonly?: boolean;
|
|
97
|
+
nogarbasecollect?: boolean;
|
|
98
|
+
olddescriptions?: boolean;
|
|
99
|
+
nontransportable?: boolean;
|
|
100
|
+
convert?: boolean;
|
|
101
|
+
expand?: boolean;
|
|
102
|
+
notriggers?: boolean;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export interface NBackupOptions extends ReadableOptions {
|
|
106
|
+
database?: string;
|
|
107
|
+
file: string;
|
|
108
|
+
level?: number; // nb day for incremental
|
|
109
|
+
notriggers?: boolean;
|
|
110
|
+
direct?: 'on' | 'off'; // default 'on'
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface RestoreOptions extends ReadableOptions {
|
|
114
|
+
database?: string;
|
|
115
|
+
files: string | string[];
|
|
116
|
+
verbose?: boolean;
|
|
117
|
+
cachebuffers?: number; // default 2048, gbak -buffers
|
|
118
|
+
pagesize?: boolean; // default 4096
|
|
119
|
+
readonly?: boolean; // default false
|
|
120
|
+
deactivateindexes?: boolean; // default false
|
|
121
|
+
noshadow?: boolean; // default false
|
|
122
|
+
novalidity?: boolean; // default false
|
|
123
|
+
individualcommit?: boolean; // default true
|
|
124
|
+
replace?: boolean; // default false
|
|
125
|
+
create?: boolean; // default true
|
|
126
|
+
useallspace?: boolean; // default false
|
|
127
|
+
metadataonly?: boolean; // default false
|
|
128
|
+
fixfssdata?: string; // default null
|
|
129
|
+
fixfssmetadata?: string; // default null
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface NRestoreOptions extends ReadableOptions {
|
|
133
|
+
database?: string;
|
|
134
|
+
files: string | string[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface ValidateOptions extends ReadableOptions {
|
|
138
|
+
database?: string;
|
|
139
|
+
checkdb?: boolean;
|
|
140
|
+
ignorechecksums?: boolean;
|
|
141
|
+
killshadows?: boolean;
|
|
142
|
+
mend?: boolean;
|
|
143
|
+
validate?: boolean;
|
|
144
|
+
full?: boolean;
|
|
145
|
+
sweep?: boolean;
|
|
146
|
+
listlimbo?: boolean;
|
|
147
|
+
icu?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface StatsOptions extends ReadableOptions {
|
|
151
|
+
database?: string;
|
|
152
|
+
record?: boolean;
|
|
153
|
+
nocreation?: boolean;
|
|
154
|
+
tables?: boolean;
|
|
155
|
+
pages?: boolean;
|
|
156
|
+
header?: boolean;
|
|
157
|
+
indexes?: boolean;
|
|
158
|
+
tablesystem?: boolean;
|
|
159
|
+
encryption?: boolean;
|
|
160
|
+
objects?: string; // space-separated list of object index,table,systemtable
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
interface UserInfo {
|
|
164
|
+
userid: number;
|
|
165
|
+
groupid: number;
|
|
166
|
+
username: string;
|
|
167
|
+
firstname: string;
|
|
168
|
+
middlename: string;
|
|
169
|
+
lastname: string
|
|
170
|
+
admin: number;
|
|
171
|
+
rolename?: string;
|
|
172
|
+
groupname?: string;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
export interface ServerInfo {
|
|
176
|
+
result: number;
|
|
177
|
+
dbinfo?: { database: any[], nbattachment: number, nbdatabase: number };
|
|
178
|
+
fbconfig?: any;
|
|
179
|
+
svcversion?: number;
|
|
180
|
+
fbversion?: string;
|
|
181
|
+
fbimplementation?: string;
|
|
182
|
+
fbcapatibilities: string[];
|
|
183
|
+
pathsecuritydb?: string;
|
|
184
|
+
fbenv?: string;
|
|
185
|
+
fbenvlock?: string;
|
|
186
|
+
fbenvmsg?: string;
|
|
187
|
+
limbotrans?: number[];
|
|
188
|
+
fbusers?: UserInfo[]
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface ServerInfoReq {
|
|
192
|
+
dbinfo?: boolean;
|
|
193
|
+
fbconfig?: boolean;
|
|
194
|
+
svcversion?: boolean;
|
|
195
|
+
fbversion?: boolean;
|
|
196
|
+
fbimplementation?: boolean;
|
|
197
|
+
fbcapatibilities?: boolean;
|
|
198
|
+
pathsecuritydb?: boolean;
|
|
199
|
+
fbenv?: boolean;
|
|
200
|
+
fbenvlock?: boolean;
|
|
201
|
+
fbenvmsg?: boolean;
|
|
202
|
+
limbotrans?: boolean;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface TraceOptions extends ReadableOptions {
|
|
206
|
+
configfile?: string; // startTrace uses it
|
|
207
|
+
tracename?: string; // startTrace uses it
|
|
208
|
+
traceid?: number; // suspendTrace, stopTrace, and resumeTrace use it
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
type ServiceManagerCallback = (err: any, svc: ServiceManager) => void;
|
|
212
|
+
// @ts-ignore
|
|
213
|
+
type ReadableCallback = (err: any, reader: NodeJS.ReadableStream) => void;
|
|
214
|
+
type InfoCallback = (err: any, info: ServerInfo) => void;
|
|
215
|
+
type LineCallback = (err: any, data: { result: number, line: string }) => void;
|
|
216
|
+
|
|
217
|
+
export enum ShutdownMode { NORMAL = 0, MULTI = 1, SINGLE = 2, FULL = 3 }
|
|
218
|
+
export enum ShutdownKind { FORCED = 0, DENY_TRANSACTION = 1, DENY_ATTACHMENT = 2 }
|
|
219
|
+
|
|
220
|
+
export interface ServiceManager {
|
|
221
|
+
detach(callback?: SimpleCallback, force?: boolean): void;
|
|
222
|
+
backup(options: BackupOptions, callback: ReadableCallback): void;
|
|
223
|
+
nbackup(options: BackupOptions, callback: ReadableCallback): void;
|
|
224
|
+
restore(options: NRestoreOptions, callback: ReadableCallback): void;
|
|
225
|
+
nrestore(options: any, callback: Function): void;
|
|
226
|
+
setDialect(db: string, dialect: 1 | 3, callback: ReadableCallback): void;
|
|
227
|
+
setSweepinterval(db: string, interval: number, callback: Function): void; // gfix -h INTERVAL
|
|
228
|
+
setCachebuffer(db: string, nbpages: any, callback: ReadableCallback): void; // gfix -b NBPAGES
|
|
229
|
+
BringOnline(db: string, callback: ReadableCallback): void; // gfix -o
|
|
230
|
+
Shutdown(db: string, kind: ShutdownKind, delay: number, mode: ShutdownMode, callback: ReadableCallback): void; // server version >= 2.0
|
|
231
|
+
Shutdown(db: string, kind: ShutdownKind, delay: number, callback: ReadableCallback): void; // server version < 2.0
|
|
232
|
+
setShadow(db: string, val: boolean, callback: ReadableCallback): void;
|
|
233
|
+
setForcewrite(db: string, val: boolean, callback: ReadableCallback): void; // gfix -write
|
|
234
|
+
setReservespace(db: string, val: boolean, callback: ReadableCallback): void; // true: gfix -use reserve, false: gfix -use full
|
|
235
|
+
setReadonlyMode(db: string, callback: ReadableCallback): void; // gfix -mode read_only
|
|
236
|
+
setReadwriteMode(db: string, callback: ReadableCallback): void; // gfix -mode read_write
|
|
237
|
+
validate(options: ValidateOptions, callback: ReadableCallback): void; // gfix -validate
|
|
238
|
+
commit(db: string, transactid: number, callback: ReadableCallback): void; // gfix -commit
|
|
239
|
+
rollback(db: string, transactid: number, callback: ReadableCallback): void;
|
|
240
|
+
recover(db: string, transactid: number, callback: ReadableCallback): void;
|
|
241
|
+
getStats(options: StatsOptions, callback: ReadableCallback): void;
|
|
242
|
+
getLog(options: ReadableOptions, callback: ReadableCallback): void;
|
|
243
|
+
getUsers(username: string | null, callback: InfoCallback): void;
|
|
244
|
+
addUser(username: string, password: string, info: UserInfo, callback: ReadableCallback): void;
|
|
245
|
+
editUser(username: string, info: UserInfo, callback: ReadableCallback): void;
|
|
246
|
+
removeUser(username: string, rolename: string | null, callback: ReadableCallback): void;
|
|
247
|
+
getFbserverInfos(infos: ServerInfoReq, options: { buffersize?: number, timeout?: number }, callback: InfoCallback): void; // if infos is empty all options are asked to the service
|
|
248
|
+
startTrace(options: TraceOptions, callback: ReadableCallback): void;
|
|
249
|
+
suspendTrace(options: TraceOptions, callback: ReadableCallback): void;
|
|
250
|
+
resumeTrace(options: TraceOptions, callback: ReadableCallback): void;
|
|
251
|
+
stopTrace(options: TraceOptions, callback: ReadableCallback): void;
|
|
252
|
+
getTraceList(options: ReadableOptions, callback: ReadableCallback): void;
|
|
253
|
+
readline(options: ReadableOptions, callback: LineCallback): void;
|
|
254
|
+
readeof(options: ReadableOptions, callback: LineCallback): void;
|
|
255
|
+
hasRunningAction(options: ReadableOptions, callback: ReadableCallback): void;
|
|
256
|
+
readusers(options: ReadableOptions, callback: ReadableCallback): void;
|
|
257
|
+
readlimbo(options: ReadableOptions, callback: ReadableCallback): void;
|
|
258
|
+
}
|
|
57
259
|
}
|