hackmud-script-manager 0.20.3 → 0.20.4-0dd1d9b
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +9 -1
- package/bin/hsm.js +193 -236
- package/env.d.ts +704 -1294
- package/generateTypeDeclaration.js +2 -1
- package/index.js +1 -0
- package/package.json +6 -2
- package/processScript/index.js +3 -3
- package/processScript/minify.js +18 -21
- package/processScript/postprocess.d.ts +1 -1
- package/processScript/postprocess.js +3 -3
- package/processScript/preprocess.js +5 -3
- package/processScript/transform.js +68 -91
- package/push.d.ts +9 -1
- package/push.js +33 -11
- package/syncMacros.js +1 -1
- package/watch.js +6 -4
package/env.d.ts
CHANGED
@@ -1,118 +1,74 @@
|
|
1
|
-
type Replace<
|
2
|
-
Omit<
|
3
|
-
T,
|
4
|
-
Extract<keyof R, keyof T>
|
5
|
-
> & R
|
6
|
-
|
1
|
+
type Replace<A, B> = Omit<A, keyof B> & B
|
7
2
|
type ScriptSuccess<T = object> = { ok: true } & T
|
8
|
-
|
9
|
-
type ScriptFailure = {
|
10
|
-
ok: false
|
11
|
-
msg?: string
|
12
|
-
}
|
13
|
-
|
3
|
+
type ScriptFailure = { ok: false, msg?: string }
|
14
4
|
type ScriptResponse<T = object> = ScriptSuccess<T> | ScriptFailure
|
15
5
|
type ErrorScripts = Record<string, () => ScriptFailure>
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
trust: ErrorScripts
|
34
|
-
users: ErrorScripts
|
35
|
-
}
|
6
|
+
type Scriptor<TArgs extends any[] = any[]> = { name: string, call: (...args: TArgs) => unknown }
|
7
|
+
|
8
|
+
type Subscripts = Record<string, Record<string, (...args: any) => any>> & {
|
9
|
+
accts: ErrorScripts
|
10
|
+
autos: ErrorScripts
|
11
|
+
bbs: ErrorScripts
|
12
|
+
chats: ErrorScripts
|
13
|
+
corps: ErrorScripts
|
14
|
+
escrow: ErrorScripts
|
15
|
+
gui: ErrorScripts
|
16
|
+
kernel: ErrorScripts
|
17
|
+
market: ErrorScripts
|
18
|
+
scripts: ErrorScripts
|
19
|
+
sys: ErrorScripts
|
20
|
+
trust: ErrorScripts
|
21
|
+
users: ErrorScripts
|
22
|
+
}
|
36
23
|
|
37
24
|
interface PlayerFullsec {}
|
38
|
-
|
39
25
|
interface PlayerHighsec {}
|
40
|
-
|
41
26
|
interface PlayerMidsec {}
|
42
|
-
|
43
27
|
interface PlayerLowsec {}
|
44
|
-
|
45
28
|
interface PlayerNullsec {}
|
46
29
|
|
47
|
-
type
|
30
|
+
type UpgradeRarityString = "`0noob`" | "`1kiddie`" | "`2h4x0r`" | "`3h4rdc0r3`" | "`4|_|b3|2`" | "`531337`"
|
31
|
+
type UpgradeRarityNumber = 0 | 1 | 2 | 3 | 4 | 5;
|
32
|
+
type UpgradeRarity = UpgradeRarityString | UpgradeRarityNumber;
|
33
|
+
|
34
|
+
type UpgradeBase = {
|
48
35
|
name: string
|
49
36
|
type: "lock" | "script_space" | "chat" | "script" | "tool" | "bot_brain" | "glam"
|
50
37
|
up_class?: -1 | 0 | 1 | 2 | 3
|
51
38
|
tier: 1 | 2 | 3 | 4
|
52
|
-
rarity:
|
39
|
+
rarity: UpgradeRarityNumber
|
53
40
|
i: number
|
54
41
|
loaded: boolean
|
55
42
|
sn: string
|
56
43
|
description: string
|
57
44
|
}
|
58
45
|
|
59
|
-
type Upgrade =
|
46
|
+
type Upgrade = UpgradeBase & Record<string, null | boolean | number | string>
|
60
47
|
|
61
|
-
type
|
48
|
+
type CliUpgrade = Omit<UpgradeBase, `rarity`> & {
|
62
49
|
[x: string]: null | boolean | number | string
|
63
|
-
rarity:
|
50
|
+
rarity: UpgradeRarityString
|
64
51
|
}
|
65
52
|
|
66
|
-
type UsersTopItem<R> = {
|
67
|
-
|
68
|
-
name: string
|
69
|
-
last_activity: string
|
70
|
-
balance: string
|
71
|
-
}
|
72
|
-
|
73
|
-
type CorpsTopItem<R> = {
|
74
|
-
rank: R
|
75
|
-
name: string
|
76
|
-
worth: string
|
77
|
-
}
|
53
|
+
type UsersTopItem<R> = { rank: R, name: string, last_activity: string, balance: string }
|
54
|
+
type CorpsTopItem<R> = { rank: R, name: string, worth: string }
|
78
55
|
|
79
56
|
type CorpsTop = [
|
80
|
-
CorpsTopItem<1>,
|
81
|
-
CorpsTopItem<
|
82
|
-
CorpsTopItem<3>,
|
83
|
-
CorpsTopItem<4>,
|
84
|
-
CorpsTopItem<5>,
|
85
|
-
CorpsTopItem<6>,
|
86
|
-
CorpsTopItem<7>,
|
87
|
-
CorpsTopItem<8>,
|
88
|
-
CorpsTopItem<9>,
|
89
|
-
CorpsTopItem<10>
|
57
|
+
CorpsTopItem<1>, CorpsTopItem<2>, CorpsTopItem<3>, CorpsTopItem<4>, CorpsTopItem<5>,
|
58
|
+
CorpsTopItem<6>,CorpsTopItem<7>, CorpsTopItem<8>, CorpsTopItem<9>, CorpsTopItem<10>
|
90
59
|
]
|
91
60
|
|
92
61
|
type Fullsec = Subscripts & PlayerFullsec & {
|
93
62
|
accts: {
|
94
|
-
/**
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
*/
|
99
|
-
balance_of_owner: () => number
|
100
|
-
|
101
|
-
/**
|
102
|
-
* **FULLSEC**
|
103
|
-
*/
|
104
|
-
xfer_gc_to_caller: (args: {
|
105
|
-
amount: number | string
|
106
|
-
memo?: string | undefined
|
107
|
-
}) => ScriptResponse
|
63
|
+
/** **FULLSEC** @returns GC balance of script owner. */ balance_of_owner: () => number
|
64
|
+
|
65
|
+
/** **FULLSEC** */
|
66
|
+
xfer_gc_to_caller: (args: { amount: number | string, memo?: string | undefined }) => ScriptResponse
|
108
67
|
}
|
109
68
|
|
110
69
|
bbs: {
|
111
70
|
read: () => {
|
112
|
-
boards: {
|
113
|
-
title: string
|
114
|
-
slug: string
|
115
|
-
}[]
|
71
|
+
boards: { title: string, slug: string }[]
|
116
72
|
|
117
73
|
posts: {
|
118
74
|
vote_count: number
|
@@ -134,84 +90,43 @@ type Fullsec = Subscripts & PlayerFullsec & {
|
|
134
90
|
}
|
135
91
|
|
136
92
|
chats: {
|
137
|
-
/**
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
* You cannot create a channel that already exists (including any of the default ports from `0000` to `FFFF`).
|
144
|
-
* If you do not supply a password, anyone can join your channel (but the channel name is not displayed anywhere, so they would have to discover it in some way first).
|
145
|
-
*/
|
93
|
+
/** **FULLSEC**
|
94
|
+
* @summary Create a new chat channel.
|
95
|
+
* @description This script lets you create a new chat channel.
|
96
|
+
* You cannot create a channel that already exists (including any of the default ports from `0000` to `FFFF`).
|
97
|
+
* If you do not supply a password, anyone can join your channel (but the channel name is not displayed
|
98
|
+
* anywhere, so they would have to discover it in some way first). */
|
146
99
|
create: ((args: {
|
147
|
-
/**
|
148
|
-
|
149
|
-
*/
|
150
|
-
name: string
|
151
|
-
|
152
|
-
/**
|
153
|
-
* The password to secure the channel with
|
154
|
-
*/
|
155
|
-
password?: string
|
100
|
+
/** The name of the channel to create. */ name: string
|
101
|
+
/** The password to secure the channel with. */ password?: string
|
156
102
|
}) => ScriptResponse) & ((args: {
|
157
|
-
/**
|
158
|
-
|
159
|
-
*/
|
160
|
-
c: string
|
161
|
-
|
162
|
-
/**
|
163
|
-
* The password to secure the channel with
|
164
|
-
*/
|
165
|
-
password?: string
|
103
|
+
/** The name of the channel to create. */ c: string
|
104
|
+
/** The password to secure the channel with. */ password?: string
|
166
105
|
}) => ScriptResponse)
|
167
106
|
|
168
|
-
/**
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
*
|
173
|
-
* @description This script lets you send a message to the specified channel.
|
174
|
-
* You must have joined the channel, and you will see your own message (unlike chats.tell).
|
175
|
-
*/
|
107
|
+
/** **FULLSEC**
|
108
|
+
* @summary Send a chat message to a channel.
|
109
|
+
* @description This script lets you send a message to the specified channel.
|
110
|
+
* You must have joined the channel, and you will see your own message (unlike chats.tell). */
|
176
111
|
send: (args: {
|
177
|
-
/**
|
178
|
-
|
179
|
-
*/
|
180
|
-
channel: string
|
181
|
-
|
182
|
-
/**
|
183
|
-
* The message to send
|
184
|
-
*/
|
185
|
-
msg: string
|
112
|
+
/** The channel to send the message to. */ channel: string
|
113
|
+
/** The message to send. */ msg: string
|
186
114
|
}) => ScriptResponse
|
187
115
|
|
188
|
-
/**
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
* You can message any user, you only need their username.
|
195
|
-
* Note that you will not be able to see your message after it is sent (though many chat scripts based on chats.tell also send the message to you to work around this limitation).
|
196
|
-
*/
|
116
|
+
/** **FULLSEC**
|
117
|
+
* @summary Send a chat message to a specific user.
|
118
|
+
* @description This script lets you send a message to the specified user directly.
|
119
|
+
* You can message any user, you only need their username.
|
120
|
+
* Note that you will not be able to see your message after it is sent (though many chat scripts based on
|
121
|
+
* chats.tell also send the message to you to work around this limitation). */
|
197
122
|
tell: (args: {
|
198
|
-
/**
|
199
|
-
|
200
|
-
*/
|
201
|
-
to: string
|
202
|
-
|
203
|
-
/**
|
204
|
-
* The message to send
|
205
|
-
*/
|
206
|
-
msg: string
|
123
|
+
/** The username to send the message to. */ to: string
|
124
|
+
/** The message to send. */ msg: string
|
207
125
|
}) => ScriptResponse
|
208
126
|
}
|
209
127
|
|
210
128
|
escrow: {
|
211
|
-
/**
|
212
|
-
* **FULLSEC**
|
213
|
-
*/
|
214
|
-
charge: (args: {
|
129
|
+
/** **FULLSEC** */ charge: (args: {
|
215
130
|
cost: number | string
|
216
131
|
is_unlim?: boolean
|
217
132
|
}) => null | ScriptFailure
|
@@ -228,405 +143,266 @@ type Fullsec = Subscripts & PlayerFullsec & {
|
|
228
143
|
}
|
229
144
|
|
230
145
|
market: {
|
231
|
-
/**
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
cost: number
|
244
|
-
|
245
|
-
i: I
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
146
|
+
/** **FULLSEC** */ browse: {
|
147
|
+
(args:
|
148
|
+
Partial<{
|
149
|
+
seller: string | MongoQuerySelector<string>,
|
150
|
+
listed_before: number | MongoQuerySelector<number>,
|
151
|
+
listed_after: number,
|
152
|
+
cost: number | MongoQuerySelector<number> | string,
|
153
|
+
rarity: UpgradeRarityNumber | MongoQuerySelector<UpgradeRarityNumber>,
|
154
|
+
name: string | MongoQuerySelector<string>
|
155
|
+
} & Omit<{
|
156
|
+
[k in keyof CliUpgrade]: CliUpgrade[k] | MongoQuerySelector<CliUpgrade[k]>
|
157
|
+
}, "rarity">>
|
158
|
+
): { i: string, name: string, rarity: Upgrade["rarity"], cost: number }[] | ScriptFailure
|
159
|
+
|
160
|
+
<I extends string>(args: { i: I }): {
|
161
|
+
i: I
|
162
|
+
seller: string
|
163
|
+
cost: number
|
164
|
+
count: number
|
165
|
+
description: string
|
166
|
+
upgrade: Upgrade
|
167
|
+
no_notify: boolean
|
168
|
+
} | ScriptFailure
|
169
|
+
|
170
|
+
<I extends string[]>(args: { i: I }): {
|
171
|
+
i: I
|
172
|
+
seller: string
|
173
|
+
cost: number
|
174
|
+
count: number
|
175
|
+
description: string
|
176
|
+
upgrade: Upgrade
|
177
|
+
no_notify: boolean
|
178
|
+
}[] | ScriptFailure
|
179
|
+
}
|
261
180
|
}
|
262
181
|
|
263
182
|
scripts: {
|
264
|
-
/**
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
/**
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
/**
|
279
|
-
* **FULLSEC**
|
280
|
-
*/
|
281
|
-
get_level: (args: { name: string }) => 0 | 1 | 2 | 3 | 4 | ScriptFailure
|
282
|
-
|
283
|
-
/**
|
284
|
-
* **FULLSEC**
|
285
|
-
*/
|
286
|
-
highsec: ((args?: object) => string[]) & ((args: { sector: string }) => string[] | ScriptFailure)
|
287
|
-
|
288
|
-
/**
|
289
|
-
* **FULLSEC**
|
290
|
-
*/
|
291
|
-
lowsec: ((args?: object) => string[]) & ((args: { sector: string }) => string[] | ScriptFailure)
|
292
|
-
|
293
|
-
/**
|
294
|
-
* **FULLSEC**
|
295
|
-
*/
|
296
|
-
midsec: ((args?: object) => string[]) & ((args: { sector: string }) => string[] | ScriptFailure)
|
297
|
-
|
298
|
-
/**
|
299
|
-
* **FULLSEC**
|
300
|
-
*/
|
301
|
-
nullsec: ((args?: object) => string[]) & ((args: { sector: string }) => string[] | ScriptFailure)
|
302
|
-
|
303
|
-
/**
|
304
|
-
* **FULLSEC**
|
305
|
-
*/
|
306
|
-
trust: () => string[]
|
307
|
-
|
308
|
-
/**
|
309
|
-
* FULLSEC
|
310
|
-
*
|
311
|
-
* @returns a code library containing useful helper functions you can use in your scripts.
|
312
|
-
*/
|
183
|
+
/** **FULLSEC** */ get_access_level: (args: { name: string }) =>
|
184
|
+
{ public: boolean, hidden: boolean, trust: boolean } | ScriptFailure
|
185
|
+
|
186
|
+
/** **FULLSEC** */ get_level: (args: { name: string }) => 0 | 1 | 2 | 3 | 4 | ScriptFailure
|
187
|
+
/** **FULLSEC** */ fullsec: { (): string[], (args: { sector: string }): string[] | ScriptFailure }
|
188
|
+
/** **FULLSEC** */ highsec: Fullsec["scripts"]["fullsec"]
|
189
|
+
/** **FULLSEC** */ lowsec: Fullsec["scripts"]["fullsec"]
|
190
|
+
/** **FULLSEC** */ midsec: Fullsec["scripts"]["fullsec"]
|
191
|
+
/** **FULLSEC** */ nullsec: Fullsec["scripts"]["fullsec"]
|
192
|
+
/** **FULLSEC** */ trust: () => string[]
|
193
|
+
|
194
|
+
/** FULLSEC
|
195
|
+
* @returns A code library containing useful helper functions you can use in your scripts. */
|
313
196
|
lib: () => {
|
314
197
|
ok: () => ScriptSuccess
|
198
|
+
not_impl: () => { ok: false, msg: "Not Implemented." }
|
199
|
+
/** Append `message` to the current script run's log. */ log: (message: any) => void
|
200
|
+
/** @returns All messages added using `scripts.lib().log` during this script run. */ get_log: () => string[]
|
315
201
|
|
316
|
-
|
317
|
-
ok: false
|
318
|
-
msg: "Not Implemented."
|
319
|
-
}
|
320
|
-
/**
|
321
|
-
* Append `message` to the current script run's log.
|
322
|
-
*/
|
323
|
-
log: (message: any) => void
|
324
|
-
/**
|
325
|
-
* @returns all messages added using `scripts.lib().log` during this script run
|
326
|
-
*/
|
327
|
-
get_log: () => string[]
|
328
|
-
/**
|
329
|
-
* @returns a random integer in the range [min, max) generated using `rng` (defaults to `Math.random`)
|
330
|
-
*/
|
202
|
+
/** @returns A random integer in the range [min, max) generated using `rng` (defaults to `Math.random`). */
|
331
203
|
rand_int: (min: number, max: number, rng?:()=>number) => number
|
332
|
-
|
333
|
-
|
334
|
-
|
204
|
+
|
205
|
+
/** @returns `floor` if `value` is less than `floor`, `ceil` if `value` is more than `ceil`, otherwise
|
206
|
+
* `value`. */
|
335
207
|
clamp: (value: number, floor: number, ceil: number) => number
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
*/
|
208
|
+
|
209
|
+
/** Linear interpolation function.
|
210
|
+
* @returns A number between `start` and `stop` using `amount` as a percent. */
|
340
211
|
lerp: (amount: number, start: number, stop: number) => number
|
341
|
-
|
342
|
-
|
343
|
-
|
212
|
+
|
213
|
+
/** @returns A random element from `array`, selected with a random number generated using `rng`
|
214
|
+
* (defaults to `Math.random`). */
|
344
215
|
sample: (array: any[], rng?: ()=>number) => any
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
/**
|
350
|
-
* Convert a MongoDB ObjectId to a string
|
351
|
-
*/
|
352
|
-
id_to_str: (id: string | {$oid: string}) => any
|
353
|
-
/**
|
354
|
-
* @returns whether `value` is a boolean primitive
|
355
|
-
*/
|
356
|
-
is_bool: (value: any) => value is boolean
|
357
|
-
/**
|
358
|
-
* @returns whether `value` is an object or `null`
|
359
|
-
*/
|
216
|
+
|
217
|
+
/** @returns Whether two MongoDB `ObjectId`s are equivalent. */ are_ids_eq: (id1: any, id2: any) => boolean
|
218
|
+
/** Convert a MongoDB `ObjectId` to a string. */ id_to_str: (id: string | {$oid: string}) => any
|
219
|
+
/** @returns Whether `value` is a boolean primitive. */ is_bool: (value: any) => value is boolean
|
220
|
+
/** @returns Whether `value` is an object or `null`. */
|
360
221
|
is_obj: (value: any) => value is Record<string, unknown> | null
|
361
|
-
/**
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
/**
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
/**
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
/**
|
374
|
-
* @returns whether `value` is a negative number
|
375
|
-
*/
|
376
|
-
is_neg: (value: any) => value is number
|
377
|
-
/**
|
378
|
-
* @returns whether `value` is an array
|
379
|
-
*/
|
380
|
-
is_arr: (value: any) => value is unknown[]
|
381
|
-
/**
|
382
|
-
* @returns whether `value` is a function
|
383
|
-
*/
|
384
|
-
is_func: (value: any) => value is (...args: any[]) => unknown
|
385
|
-
/**
|
386
|
-
* @returns whether `value` is not `undefined`
|
387
|
-
*/
|
388
|
-
is_def: (value: any) => boolean
|
389
|
-
/**
|
390
|
-
* @returns whether `name` is a valid in-game username
|
391
|
-
*/
|
392
|
-
is_valid_name: (name: string) => boolean
|
393
|
-
/**
|
394
|
-
* @returns the string representation of `value`
|
395
|
-
*/
|
396
|
-
dump: (value: { toString: () => string }) => string
|
397
|
-
/**
|
398
|
-
* @returns a deep clone of `object`
|
399
|
-
*/
|
400
|
-
clone: <T extends object>(object: T) => T
|
401
|
-
/**
|
402
|
-
* Applies all key-value pairs from `obj2` to `obj1`, overwriting if necessary.
|
403
|
-
*/
|
222
|
+
/** @returns Whether `value` is a string. */ is_str: (value: any) => value is string
|
223
|
+
/** @returns Whether `value` is a number. */ is_num: (value: any) => value is number
|
224
|
+
/** @returns Whether `value` is an integer. */ is_int: (value: any) => value is number
|
225
|
+
/** @returns Whether `value` is a negative number. */ is_neg: (value: any) => value is number
|
226
|
+
/** @returns Whether `value` is an array. */ is_arr: (value: any) => value is unknown[]
|
227
|
+
/** @returns Whether `value` is a function. */ is_func: (value: any) => value is (...args: any[]) => unknown
|
228
|
+
/** @returns Whether `value` is not `undefined`. */ is_def: (value: any) => boolean
|
229
|
+
/** @returns Whether `name` is a valid in-game username. */ is_valid_name: (name: string) => boolean
|
230
|
+
/** @returns The string representation of `value`. */ dump: (value: { toString: () => string }) => string
|
231
|
+
/** @returns A deep clone of `object`. */ clone: <T extends object>(object: T) => T
|
232
|
+
|
233
|
+
/** Applies all key-value pairs from `obj2` to `obj1`, overwriting if necessary. */
|
404
234
|
merge: <F extends object, S extends object>(obj1: F, obj2: S) => F & S
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
/**
|
410
|
-
|
411
|
-
|
412
|
-
hash_code: (string: string) => number
|
413
|
-
/**
|
414
|
-
* @returns a numeric hash of `string`
|
415
|
-
*/
|
416
|
-
xmur3: (string: string) => number
|
417
|
-
/**
|
418
|
-
* @returns function that generates random floats in the range [0,1] based on the numerical seeds
|
419
|
-
*/
|
235
|
+
|
236
|
+
/** @returns An array of `object`'s values */ get_values: (object: object) => any[]
|
237
|
+
/** @returns A numeric hash of `string`. */ hash_code: (string: string) => number
|
238
|
+
|
239
|
+
/** @returns A numeric hash of `string`. */ xmur3: (string: string) => number
|
240
|
+
|
241
|
+
/** @returns Function that generates random floats in the range 0-1 based on the numerical seeds. */
|
420
242
|
sfc32: (seed1: number, seed2: number, seed3: number, seed4: number) => () => number
|
421
|
-
|
422
|
-
|
423
|
-
*/
|
243
|
+
|
244
|
+
/** @returns Function that generates random floats in the range 0-1 based on the numerical seed. */
|
424
245
|
mulberry32: (seed: number) => () => number
|
425
|
-
|
426
|
-
|
427
|
-
*/
|
246
|
+
|
247
|
+
/** @returns Function that generates random floats in the range 0-1 based on the numerical seeds. */
|
428
248
|
xoshiro128ss: (seed1: number, seed2: number, seed3: number, seed4: number) => () => number
|
429
|
-
|
430
|
-
|
431
|
-
*/
|
249
|
+
|
250
|
+
/** @returns Function that generates random floats in the range 0-1 based on the numerical seed. */
|
432
251
|
JSF: (seed: number) => () => number
|
433
|
-
|
434
|
-
|
435
|
-
*/
|
252
|
+
|
253
|
+
/** @returns Function that generates random floats in the range 0-1 based on the numerical seed. */
|
436
254
|
LCG: (seed: number) => () => number
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
/**
|
442
|
-
* Converts a string similar to `"1M5K20GC"` to an equivalent numerical representation.
|
443
|
-
*/
|
255
|
+
|
256
|
+
/** Converts a number to a GC string of the form `"1M5K20GC"`. */ to_gc_str: (number: number) => string
|
257
|
+
|
258
|
+
/** Converts a string similar to `"1M5K20GC"` to an equivalent numerical representation. */
|
444
259
|
to_gc_num: (string: string) => number | ScriptFailure
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
to_game_timestr: (date: Date) => string
|
260
|
+
|
261
|
+
/** @returns A string of the form YYMMDD.HHMM derived from `date`. */ to_game_timestr: (date: Date) => string
|
262
|
+
|
449
263
|
corruption_chars: "¡¢Á¤Ã¦§¨©ª"
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
*/
|
264
|
+
|
265
|
+
/** A list of unique color codes to be used with hackmud's color formatting syntax.
|
266
|
+
* Does not include numeric codes, which are duplicates of some alphabetic codes. */
|
454
267
|
colors: "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
455
|
-
|
456
|
-
|
457
|
-
*/
|
268
|
+
|
269
|
+
/** Used by `$fs.scripts.lib().corrupt()` to determine the frequency of corruption. */
|
458
270
|
corruptions: [ 0, 1, 1.5, 2.5, 5 ]
|
459
|
-
|
460
|
-
|
461
|
-
*/
|
271
|
+
|
272
|
+
/** Adds colored corruption characters to `text`, with frequency determined by `amount`. */
|
462
273
|
corrupt: (text: string | string[], amount: 0 | 1 | 2 | 3 | 4) => string
|
463
|
-
|
464
|
-
|
465
|
-
|
274
|
+
|
275
|
+
/** @returns The first `length` characters of `string`, or the original string if it is shorter than
|
276
|
+
* `length`. */
|
466
277
|
cap_str_len: (string: string, length: number) => string
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
/**
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
*/
|
486
|
-
map: <T, U>(array: T[], func: (index: number, value: T) => U) => U[]
|
487
|
-
/**
|
488
|
-
* @returns a new object derived from `obj` with only the keys specified in `keys`
|
489
|
-
*/
|
278
|
+
|
279
|
+
/** Applies `callback` to each element in `array` and returns the original array. */
|
280
|
+
each: <T>(array: T[], callback: (index: number, value: T) => void) => T[]
|
281
|
+
|
282
|
+
/** @returns A new array containing the elments of `array` for which `callback` returns `true`. */
|
283
|
+
select: <T>(array: T[], callback: (index: number, value: T) => boolean) => T[]
|
284
|
+
|
285
|
+
/** @returns The number of elements in `array` for which `callback` returns `true`. */
|
286
|
+
count: <T>(array: T[], callback: (index: number, value: T) => boolean) => number
|
287
|
+
|
288
|
+
/** @returns The first element in `array` for which `callback` returns `true`. */
|
289
|
+
select_one: <T>(array: T[], callback: (index: number, value: T) => boolean) => T
|
290
|
+
|
291
|
+
/** @returns A new array composed of the result of applying `callback` to each element of the original array
|
292
|
+
* in order. */
|
293
|
+
map: <T, U>(array: T[], callback: (index: number, value: T) => U) => U[]
|
294
|
+
|
295
|
+
/** @returns A new object derived from `obj` with only the keys specified in `keys`. */
|
490
296
|
pick: (obj: object, keys: string[]) => any
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
* Comparison function for sorting arbitrary values in ascending order using builtin comparison operators.
|
497
|
-
*/
|
297
|
+
|
298
|
+
/** @returns An array with the elements from `array` in a random order. */ shuffle: <T>(array: T[]) => T[]
|
299
|
+
|
300
|
+
/** Comparison function for sorting arbitrary values in ascending order using builtin comparison operators.
|
301
|
+
*/
|
498
302
|
sort_asc: (one: any, two: any) => 1 | -1 | 0
|
499
|
-
|
500
|
-
|
501
|
-
|
303
|
+
|
304
|
+
/** Comparison function for sorting arbitrary values in descending order using builtin comparison operators.
|
305
|
+
*/
|
502
306
|
sort_desc: (one: any, two: any) => 1 | -1 | 0
|
503
|
-
|
504
|
-
|
505
|
-
*/
|
307
|
+
|
308
|
+
/** Comparison function for sorting numbers in ascending order. */
|
506
309
|
num_sort_asc: (one: number, two: number) => 1 | -1 | 0
|
507
|
-
|
508
|
-
|
509
|
-
*/
|
310
|
+
|
311
|
+
/** Comparison function for sorting numbers in descending order. */
|
510
312
|
num_sort_desc: (one: number, two: number) => 1 | -1 | 0
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
/**
|
516
|
-
* @returns a new `Date` equivalent to `date.getTime() + add_ms`
|
517
|
-
*/
|
313
|
+
|
314
|
+
/** @returns The value and the index of the largest number in `array`. */
|
315
|
+
max_val_index: (array: number[]) => [ largestValue: number, index: number ]
|
316
|
+
|
317
|
+
/** @returns A new `Date` equivalent to `date.getTime() + add_ms`. */
|
518
318
|
add_time: (date: Date, add_ms: number) => Date
|
519
|
-
|
520
|
-
|
521
|
-
*/
|
319
|
+
|
320
|
+
/** Array of strings representing seclevels. */
|
522
321
|
security_level_names: [ "NULLSEC", "LOWSEC", "MIDSEC", "HIGHSEC", "FULLSEC" ]
|
523
|
-
|
524
|
-
|
525
|
-
*/
|
322
|
+
|
323
|
+
/** @returns The string name of a numeric security level. */
|
526
324
|
get_security_level_name: (security_level: number) => any
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
*/
|
325
|
+
|
326
|
+
/** @param result The return value of a call to `$db.i()` or `$db.r()`.
|
327
|
+
* @param nModified The expected value of `result.nModified`.
|
328
|
+
* @returns Whether the database operation failed. */
|
329
|
+
dbu_result_failed: (result: ReturnType<typeof $db.u | typeof $db.u1 | typeof $db.us>, nModified?: number) =>
|
330
|
+
boolean
|
331
|
+
|
332
|
+
/** @param result The return value of a call to `$db.i()` or `$db.r()`.
|
333
|
+
* @param n The expected value of `result.n`.
|
334
|
+
* @returns Whether the database operation failed. */
|
538
335
|
dbir_result_failed: (result: ReturnType<typeof $db.i | typeof $db.r>, n?: number) => boolean
|
539
|
-
|
540
|
-
|
541
|
-
*/
|
336
|
+
|
337
|
+
/** @returns A random string of length `length` using lowercase letters and numbers. */
|
542
338
|
create_rand_string: (length: number) => string
|
543
|
-
|
544
|
-
|
545
|
-
*/
|
339
|
+
|
340
|
+
/** @returns The user half `x` of a fully-qualified script name `x.y`. */
|
546
341
|
get_user_from_script: (script_name: string) => string
|
547
|
-
|
548
|
-
|
549
|
-
*/
|
342
|
+
|
343
|
+
/** @returns The script half `y` of a fully-qualified script name `x.y`. */
|
550
344
|
get_scriptname_from_script: (name: string) => string
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
*/
|
345
|
+
|
346
|
+
/** Determines whether to treat this run as a subscript, based either on the presence of `calling_script` in
|
347
|
+
* `context`, or the explicit passing of `is_script: true` in `args`. */
|
555
348
|
is_script: (context: Context, args: any) => boolean
|
556
|
-
|
557
|
-
|
558
|
-
*/
|
349
|
+
|
350
|
+
/** @returns Whether the script is being called by its owner. */
|
559
351
|
caller_is_owner: (context: Context) => boolean
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
/**
|
571
|
-
* Sorts an array of numbers or number-coercible strings in descending order.
|
572
|
-
*/
|
352
|
+
|
353
|
+
/** Removes consecutive duplicate elements from an array.
|
354
|
+
* @example
|
355
|
+
* const { uniq } = $fs.scripts.lib()
|
356
|
+
* const arr = [ 1, 2, 2, 3, 2 ]
|
357
|
+
*
|
358
|
+
* $D(uniq(arr)) // [ 1, 2, 3, 2 ] */
|
359
|
+
uniq: <T>(array: T[]) => T[]
|
360
|
+
|
361
|
+
/** Sorts an array of numbers or number-coercible strings in descending order. */
|
573
362
|
u_sort_num_arr_desc: <T>(array: T[]) => T[]
|
574
|
-
|
575
|
-
|
576
|
-
*/
|
363
|
+
|
364
|
+
/** BUGGED: Creates a new string of length `length` by repeating `pad_char`. */
|
577
365
|
ljust: (input: string, length: number, pad_char?: string) => string
|
578
|
-
|
579
|
-
|
580
|
-
*/
|
366
|
+
|
367
|
+
/** Add characters from `pad_char` to the left of `input` until it reaches length `length`. */
|
581
368
|
rjust: (input: string, length: number, pad_char?: string) => string
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
*/
|
369
|
+
|
370
|
+
/** @returns A string with the entries from `strings` split into evenly spaced columns, organized donward
|
371
|
+
* and then rightward, to fit the current user's terminal. */
|
586
372
|
columnize: (strings: string[]) => string
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
side_by_side: (str1: string, str2: string, space?:string) => string
|
600
|
-
|
601
|
-
|
602
|
-
*/
|
373
|
+
|
374
|
+
/** Takes two newline-separated strings and formats a new string where they appear in columns, separated by
|
375
|
+
* `space`.
|
376
|
+
* @example
|
377
|
+
* const { side_by_side } = $fs.scripts.lib()
|
378
|
+
* const str1 = "one\ntwo\nthree"
|
379
|
+
* const str2 = "four\nfive\nsix"
|
380
|
+
*
|
381
|
+
* $D(side_by_side(str1, str2, "|"))
|
382
|
+
* // one|four\n
|
383
|
+
* // two|five\n
|
384
|
+
* // three|six */
|
385
|
+
side_by_side: (str1: string, str2: string, space?: string) => string
|
386
|
+
|
387
|
+
/** @returns Whether enough time remains in the script execution window to satisfy `time_left`. */
|
603
388
|
can_continue_execution: (time_left: number) => boolean
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
can_continue_execution_error: (time_left: number, name?:string) => {ok:false, msg: string}
|
608
|
-
|
609
|
-
/**
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
/**
|
614
|
-
* @returns time since the epoch, equivalent to `Date.now()`
|
615
|
-
*/
|
616
|
-
get_date_utcsecs: () => number
|
617
|
-
/**
|
618
|
-
* The amount of milliseconds in a single day.
|
619
|
-
*/
|
620
|
-
one_day_ms: 86_400_000
|
389
|
+
|
390
|
+
/** @returns A human-readable error object when not enough time remains in the script execution window to
|
391
|
+
* satisfy `time_left`. */
|
392
|
+
can_continue_execution_error: (time_left: number, name?: string) => { ok:false, msg: string }
|
393
|
+
|
394
|
+
/** @returns Current date, equivalent to `new Date()`. */ get_date: () => Date
|
395
|
+
/** @returns time since the epoch, equivalent to `Date.now()`. */ get_date_utcsecs: () => number
|
396
|
+
/** The amount of milliseconds in a single day. */ one_day_ms: 86_400_000
|
397
|
+
|
621
398
|
is_not_today: (date: Date) => boolean
|
622
|
-
|
623
|
-
|
624
|
-
*/
|
399
|
+
|
400
|
+
/** @returns The number of days that have passed between `d2` and `d1` */
|
625
401
|
utc_day_diff: (d1: Date, d2: Date) => number
|
626
|
-
|
627
|
-
|
628
|
-
*/
|
402
|
+
|
403
|
+
/** @returns The number of days elapsed since `date` as a string, e.g. "<n> days" */
|
629
404
|
utc_days_ago_str: (date: Date) => string
|
405
|
+
|
630
406
|
math: typeof Math
|
631
407
|
array: typeof Array
|
632
408
|
parse_int: typeof parseInt
|
@@ -634,361 +410,200 @@ type Fullsec = Subscripts & PlayerFullsec & {
|
|
634
410
|
json: typeof JSON
|
635
411
|
number: typeof Number
|
636
412
|
object: typeof Object
|
413
|
+
date: typeof Date
|
637
414
|
}
|
638
415
|
|
639
|
-
/**
|
640
|
-
* **FULLSEC**
|
641
|
-
*/
|
642
|
-
quine: () => string
|
416
|
+
/** **FULLSEC** */ quine: () => string
|
643
417
|
}
|
644
418
|
|
645
419
|
sys: {
|
646
420
|
init: never
|
647
421
|
|
648
|
-
/**
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
/**
|
667
|
-
|
668
|
-
|
669
|
-
xfer_upgrade_to_caller: ((args: {
|
670
|
-
i: number | number[]
|
671
|
-
memo?: string
|
672
|
-
}) => ScriptResponse) & ((args: {
|
673
|
-
sn: string | string[]
|
674
|
-
memo?: string
|
675
|
-
}) => ScriptResponse)
|
422
|
+
/** **FULLSEC** */
|
423
|
+
upgrades_of_owner: {
|
424
|
+
<F extends Partial<Upgrade & { loaded: boolean }> = object>(args?: { filter?: F, full?: false }): (
|
425
|
+
Omit<
|
426
|
+
Pick<UpgradeBase, "tier" | "rarity" | "name" | "type" | "i" | "loaded">,
|
427
|
+
keyof F
|
428
|
+
> & Pick<F, "tier" | "rarity" | "name" | "type" | "i" | "loaded">
|
429
|
+
)[] | ScriptFailure
|
430
|
+
|
431
|
+
<F extends Partial<Upgrade & { loaded: boolean }> = object>(args: { filter?: F, full: true }): (
|
432
|
+
Omit<UpgradeBase, keyof F> & F & Record<string, null | boolean | number | string>
|
433
|
+
)[] | ScriptFailure
|
434
|
+
|
435
|
+
<I extends number>(args: { i: I }): (
|
436
|
+
Omit<UpgradeBase, "i"> & { [x: string]: null | boolean | number | string, i: I }
|
437
|
+
) | ScriptFailure
|
438
|
+
}
|
439
|
+
|
440
|
+
/** **FULLSEC** */
|
441
|
+
xfer_upgrade_to_caller: (args: ({ i: number | number[] } | { sn: string | string[] }) & { memo?: string }) =>
|
442
|
+
ScriptResponse
|
676
443
|
}
|
677
444
|
|
678
445
|
users: {
|
679
|
-
/**
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
/**
|
685
|
-
* **FULLSEC**
|
686
|
-
*/
|
687
|
-
last_action: (args: { name: string | string[] }) => ({
|
688
|
-
n: string
|
689
|
-
t?: Date
|
690
|
-
} | null)[]
|
691
|
-
|
692
|
-
/**
|
693
|
-
* **FULLSEC**
|
694
|
-
*/
|
446
|
+
/** **FULLSEC** */ active: () => number
|
447
|
+
/** **FULLSEC** */ last_action: (args: { name: string | string[] }) => ({ n: string, t?: Date } | null)[]
|
448
|
+
|
449
|
+
/** **FULLSEC** */
|
695
450
|
top: () => [
|
696
|
-
UsersTopItem<1>,
|
697
|
-
UsersTopItem<
|
698
|
-
UsersTopItem<3>,
|
699
|
-
UsersTopItem<4>,
|
700
|
-
UsersTopItem<5>,
|
701
|
-
UsersTopItem<6>,
|
702
|
-
UsersTopItem<7>,
|
703
|
-
UsersTopItem<8>,
|
704
|
-
UsersTopItem<9>,
|
705
|
-
UsersTopItem<10>
|
451
|
+
UsersTopItem<1>, UsersTopItem<2>, UsersTopItem<3>, UsersTopItem<4>, UsersTopItem<5>,
|
452
|
+
UsersTopItem<6>, UsersTopItem<7>, UsersTopItem<8>, UsersTopItem<9>, UsersTopItem<10>
|
706
453
|
]
|
707
454
|
}
|
708
455
|
}
|
709
456
|
|
710
457
|
type Highsec = Fullsec & PlayerHighsec & {
|
711
458
|
accts: {
|
712
|
-
/**
|
713
|
-
|
714
|
-
|
715
|
-
* @returns GC balance as number if `is_script` is true (default)
|
716
|
-
* @returns GC balance as string if `is_script` is false
|
717
|
-
*/
|
459
|
+
/** **HIGHSEC**
|
460
|
+
* @returns GC balance as number if `is_script` is true (default).
|
461
|
+
* @returns GC balance as string if `is_script` is false. */
|
718
462
|
balance: ((args?: { is_script?: true }) => number) & ((args: { is_script: false }) => string)
|
719
463
|
|
720
|
-
/**
|
721
|
-
*
|
722
|
-
*
|
723
|
-
* @returns
|
724
|
-
*
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
to?: string
|
730
|
-
from?: string
|
731
|
-
script?: string
|
732
|
-
is_script?: true
|
733
|
-
}) => {
|
734
|
-
time: Date
|
735
|
-
amount: number
|
736
|
-
sender: string
|
737
|
-
recipient: string
|
738
|
-
script: string | null
|
739
|
-
memo?: string
|
740
|
-
}[]) & ((args: {
|
741
|
-
count?: number | "all"
|
742
|
-
to?: string
|
743
|
-
from?: string
|
744
|
-
script?: string
|
745
|
-
is_script: false
|
746
|
-
}) => {
|
747
|
-
msg: string
|
748
|
-
transactions: {
|
749
|
-
time: string
|
750
|
-
amount: string
|
464
|
+
/** **HIGHSEC**
|
465
|
+
* @returns Transaction history according to filter.
|
466
|
+
* @returns If `is_script` is true (default), time property as Date object.
|
467
|
+
* @returns Wraps transactions in object with msg, time property as string (game date format e.g. 201028.2147)
|
468
|
+
* if `is_script` is false. */
|
469
|
+
transactions: {
|
470
|
+
(args?: { count?: number | "all", to?: string, from?: string, script?: string, is_script?: true }): {
|
471
|
+
time: Date
|
472
|
+
amount: number
|
751
473
|
sender: string
|
752
474
|
recipient: string
|
753
475
|
script: string | null
|
754
476
|
memo?: string
|
755
477
|
}[]
|
756
|
-
|
478
|
+
|
479
|
+
(args: { count?: number | "all", to?: string, from?: string, script?: string, is_script: false }): {
|
480
|
+
msg: string
|
481
|
+
transactions: {
|
482
|
+
time: string
|
483
|
+
amount: string
|
484
|
+
sender: string
|
485
|
+
recipient: string
|
486
|
+
script: string | null
|
487
|
+
memo?: string
|
488
|
+
}[]
|
489
|
+
}
|
490
|
+
}
|
757
491
|
}
|
758
492
|
|
759
493
|
scripts: {
|
760
|
-
/**
|
761
|
-
* **HIGHSEC**
|
762
|
-
*/
|
763
|
-
sys: () => string | string[]
|
494
|
+
/** **HIGHSEC** */ sys: () => string | string[]
|
764
495
|
}
|
765
496
|
|
766
497
|
sys: {
|
767
|
-
/**
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
tutorial: string
|
778
|
-
breach: boolean
|
498
|
+
/** **HIGHSEC** */ specs: () => string | ScriptFailure
|
499
|
+
/** **HIGHSEC** */ status: () => { hardline: number, tutorial: string, breach: boolean }
|
500
|
+
|
501
|
+
/** **HIGHSEC** */
|
502
|
+
upgrade_log: {
|
503
|
+
(args?: { is_script?: true, user?: string, run_id?: string, count?: number, start?: number }):
|
504
|
+
{ t: Date, u: string, r: string, msg: string }[] | ScriptFailure
|
505
|
+
|
506
|
+
(args: { is_script: false, user?: string, run_id?: string, count?: number, start?: number }):
|
507
|
+
string[] | ScriptFailure
|
779
508
|
}
|
780
509
|
|
781
|
-
/**
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
upgrades: (<I extends number>(args: { i: I }) => (
|
807
|
-
Omit<UpgradeCore, "i"> & { [x: string]: null | boolean | number | string, i: I }
|
808
|
-
) | ScriptFailure) & (<
|
809
|
-
F extends Partial<Upgrade & { loaded: boolean }> = object
|
810
|
-
>(args?: {
|
811
|
-
filter?: F
|
812
|
-
is_script?: true
|
813
|
-
full?: false
|
814
|
-
}) => (
|
815
|
-
Omit<
|
816
|
-
Pick<UpgradeCore, "tier" | "rarity" | "name" | "type" | "i" | "loaded">,
|
817
|
-
keyof F
|
818
|
-
> & F & Record<string, null | boolean | number | string>
|
819
|
-
)[] | ScriptFailure) & (<
|
820
|
-
F extends Partial<Upgrade & { loaded: boolean }> = object
|
821
|
-
>(args?: {
|
822
|
-
filter?: F
|
823
|
-
is_script?: true
|
824
|
-
full: true
|
825
|
-
}) => (
|
826
|
-
Omit<UpgradeCore, keyof F> & F & Record<string, null | boolean | number | string>
|
827
|
-
)[] | ScriptFailure) & ((args?: {
|
828
|
-
filter?: Partial<Upgrade & { loaded: boolean }>
|
829
|
-
is_script: false
|
830
|
-
full?: false
|
831
|
-
}) => {
|
832
|
-
msg: string
|
833
|
-
upgrades: string[]
|
834
|
-
} | ScriptFailure) & (<
|
835
|
-
F extends Partial<Upgrade & { loaded: boolean }> = object
|
836
|
-
>(args?: {
|
837
|
-
filter?: F
|
838
|
-
is_script: false
|
839
|
-
full: true
|
840
|
-
}) => (
|
841
|
-
Omit<UpgradeCore, keyof F | `rarity`> & F & {
|
510
|
+
/** **HIGHSEC** */
|
511
|
+
upgrades: {
|
512
|
+
<I extends number>(args: { i: I }): (
|
513
|
+
Omit<UpgradeBase, "i"> & { [x: string]: null | boolean | number | string, i: I }
|
514
|
+
) | ScriptFailure
|
515
|
+
|
516
|
+
<F extends Partial<Upgrade & { loaded: boolean }> = object>(args?: {
|
517
|
+
filter?: F
|
518
|
+
is_script?: true
|
519
|
+
full?: false
|
520
|
+
}): (
|
521
|
+
Omit<Pick<UpgradeBase, "tier" | "rarity" | "name" | "type" | "i" | "loaded">, keyof F> & F &
|
522
|
+
Record<string, null | boolean | number | string>
|
523
|
+
)[] | ScriptFailure
|
524
|
+
|
525
|
+
<F extends Partial<Upgrade & { loaded: boolean }> = object>(args?:
|
526
|
+
{ filter?: F, is_script?: true, full: true }
|
527
|
+
): (Omit<UpgradeBase, keyof F> & F & Record<string, null | boolean | number | string>)[] | ScriptFailure
|
528
|
+
|
529
|
+
(args?: { filter?: Partial<Upgrade & { loaded: boolean }>, is_script: false, full?: false }):
|
530
|
+
{ msg: string, upgrades: string[] } | ScriptFailure
|
531
|
+
|
532
|
+
<F extends Partial<Upgrade & { loaded: boolean }> = object>(
|
533
|
+
args?: { filter?: F, is_script: false, full: true }
|
534
|
+
): (Omit<UpgradeBase, keyof F | `rarity`> & F & {
|
842
535
|
[x: string]: null | boolean | number | string
|
843
|
-
rarity:
|
844
|
-
}
|
845
|
-
|
536
|
+
rarity: UpgradeRarityString
|
537
|
+
})[] | ScriptFailure
|
538
|
+
}
|
846
539
|
}
|
847
540
|
|
848
541
|
users: {
|
849
|
-
/**
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
name:
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
title?: string
|
868
|
-
is_main: boolean
|
869
|
-
alt_of?: string
|
870
|
-
badges?: string[]
|
871
|
-
} | ScriptFailure) & ((args: {
|
872
|
-
name: string
|
873
|
-
is_script: false
|
874
|
-
}) => string | ScriptFailure)
|
542
|
+
/** **HIGHSEC** */ inspect: {
|
543
|
+
(args: { name: "trust", is_script?: boolean }): number
|
544
|
+
(args: { name: "risk", is_script?: boolean }): string
|
545
|
+
|
546
|
+
(args: { name: string, is_script?: true }): {
|
547
|
+
username: string
|
548
|
+
avatar: string
|
549
|
+
pronouns: string
|
550
|
+
user_age?: Date
|
551
|
+
bio?: string
|
552
|
+
title?: string
|
553
|
+
is_main: boolean
|
554
|
+
alt_of?: string
|
555
|
+
badges?: string[]
|
556
|
+
} | ScriptFailure
|
557
|
+
|
558
|
+
(args: { name: string, is_script: false }): string | ScriptFailure
|
559
|
+
}
|
875
560
|
}
|
876
561
|
}
|
877
562
|
|
878
563
|
type Midsec = Highsec & PlayerMidsec & {
|
879
564
|
accts: {
|
880
|
-
/**
|
881
|
-
* **MIDSEC**
|
882
|
-
*/
|
883
|
-
xfer_gc_to: (args: {
|
884
|
-
to: string
|
885
|
-
amount: number | string
|
886
|
-
memo?: string
|
887
|
-
}) => ScriptResponse
|
565
|
+
/** **MIDSEC** */ xfer_gc_to: (args: { to: string, amount: number | string, memo?: string }) => ScriptResponse
|
888
566
|
}
|
889
567
|
|
890
|
-
autos: {
|
891
|
-
/**
|
892
|
-
* **MIDSEC**
|
893
|
-
*/
|
894
|
-
reset: () => ScriptSuccess
|
895
|
-
}
|
568
|
+
autos: { /** **MIDSEC** */ reset: () => ScriptSuccess }
|
896
569
|
|
897
570
|
chats: {
|
898
|
-
/**
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
/**
|
904
|
-
* **MIDSEC**
|
905
|
-
*/
|
906
|
-
join: (args: {
|
907
|
-
channel: string
|
908
|
-
password?: string
|
909
|
-
}) => ScriptResponse
|
910
|
-
|
911
|
-
/**
|
912
|
-
* **MIDSEC**
|
913
|
-
*/
|
914
|
-
leave: (args: { channel: string }) => ScriptResponse
|
915
|
-
|
916
|
-
/**
|
917
|
-
* **MIDSEC**
|
918
|
-
*/
|
919
|
-
users: (args: { channel: string }) => string[] | ScriptFailure
|
571
|
+
/** **MIDSEC** */ channels: () => string[]
|
572
|
+
/** **MIDSEC** */ join: (args: { channel: string, password?: string }) => ScriptResponse
|
573
|
+
/** **MIDSEC** */ leave: (args: { channel: string }) => ScriptResponse
|
574
|
+
/** **MIDSEC** */ users: (args: { channel: string }) => string[] | ScriptFailure
|
920
575
|
}
|
921
576
|
|
922
577
|
escrow: {
|
923
|
-
/**
|
924
|
-
|
925
|
-
*/
|
926
|
-
stats: () => {
|
927
|
-
scripts: string[]
|
928
|
-
total: string
|
929
|
-
outstanding: string
|
930
|
-
open_escrow_count: number
|
931
|
-
} | ScriptFailure
|
578
|
+
/** **MIDSEC** */ stats: () =>
|
579
|
+
{ scripts: string[], total: string, outstanding: string, open_escrow_count: number } | ScriptFailure
|
932
580
|
}
|
933
581
|
|
934
582
|
market: {
|
935
|
-
/**
|
936
|
-
* **MIDSEC**
|
937
|
-
*/
|
938
|
-
buy: (args: {
|
939
|
-
i: string
|
940
|
-
count: number
|
941
|
-
confirm: true
|
942
|
-
}) => ScriptResponse
|
583
|
+
/** **MIDSEC** */ buy: (args: { i: string, count: number, confirm: true }) => ScriptResponse
|
943
584
|
|
944
|
-
/**
|
945
|
-
|
946
|
-
*/
|
947
|
-
stats: () => ScriptFailure | {
|
948
|
-
total: string
|
949
|
-
outstanding: string
|
950
|
-
listed: number
|
951
|
-
sold: number
|
952
|
-
}
|
585
|
+
/** **MIDSEC** */ stats: () =>
|
586
|
+
ScriptFailure | { total: string, outstanding: string, listed: number, sold: number }
|
953
587
|
}
|
954
588
|
|
955
|
-
scripts: {
|
956
|
-
/**
|
957
|
-
* **MIDSEC**
|
958
|
-
*/
|
959
|
-
user: () => string[]
|
960
|
-
}
|
589
|
+
scripts: { /** **MIDSEC** */ user: () => string[] }
|
961
590
|
|
962
591
|
sys: {
|
963
|
-
/**
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
}
|
970
|
-
from: number
|
971
|
-
to: number
|
972
|
-
})[] | {
|
973
|
-
from: number
|
974
|
-
to: number
|
975
|
-
} }) => string[] | ScriptFailure)
|
592
|
+
/** **MIDSEC** */
|
593
|
+
manage: {
|
594
|
+
(args: { unload?: number | number[], load?: number | number[] }): ScriptResponse
|
595
|
+
|
596
|
+
(args: { reorder?: ([ number, number ] | { from: number, to: number })[] | { from: number, to: number } }):
|
597
|
+
string[] | ScriptFailure
|
598
|
+
}
|
976
599
|
}
|
977
600
|
}
|
978
601
|
|
979
602
|
type Lowsec = Midsec & PlayerLowsec & {
|
980
|
-
kernel: {
|
981
|
-
/**
|
982
|
-
* **LOWSEC**
|
983
|
-
*/
|
984
|
-
hardline: () => ScriptResponse
|
985
|
-
}
|
603
|
+
kernel: { /** **LOWSEC** */ hardline: () => ScriptResponse }
|
986
604
|
|
987
605
|
market: {
|
988
|
-
/**
|
989
|
-
* **LOWSEC**
|
990
|
-
*/
|
991
|
-
sell: (args: {
|
606
|
+
/** **LOWSEC** */ sell: (args: {
|
992
607
|
i: number
|
993
608
|
cost: number | string
|
994
609
|
description?: string
|
@@ -999,502 +614,321 @@ type Lowsec = Midsec & PlayerLowsec & {
|
|
999
614
|
}
|
1000
615
|
|
1001
616
|
sys: {
|
1002
|
-
/**
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
user?: string
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
}
|
1017
|
-
user?: string
|
1018
|
-
run_id?: string
|
1019
|
-
is_script: false
|
1020
|
-
count?: number
|
1021
|
-
start?: number
|
1022
|
-
}) => string[])
|
1023
|
-
|
1024
|
-
/**
|
1025
|
-
* **LOWSEC**
|
1026
|
-
*/
|
1027
|
-
cull: (args: { i: number | number[], confirm: true }) => ScriptResponse
|
1028
|
-
|
1029
|
-
/**
|
1030
|
-
* **LOWSEC**
|
1031
|
-
*/
|
1032
|
-
loc: () => string | ScriptFailure
|
1033
|
-
|
1034
|
-
/**
|
1035
|
-
* **LOWSEC**
|
1036
|
-
*/
|
1037
|
-
xfer_upgrade_to: ((args: {
|
1038
|
-
i: number | number[]
|
1039
|
-
to: string
|
1040
|
-
memo?: string
|
1041
|
-
}) => ScriptResponse) & ((args: {
|
1042
|
-
sn: string | string[]
|
1043
|
-
to: string
|
1044
|
-
memo?: string
|
1045
|
-
}) => ScriptResponse)
|
617
|
+
/** **LOWSEC** */ access_log: {
|
618
|
+
(args?: { user?: string, run_id?: string, is_script?: true, count?: number, start?: number }):
|
619
|
+
{ t: Date, u: string | undefined, r: string | undefined, msg: string }[] | ScriptFailure
|
620
|
+
|
621
|
+
(args: { user?: string, run_id?: string, is_script: false, count?: number, start?: number }): string[]
|
622
|
+
}
|
623
|
+
|
624
|
+
/** **LOWSEC** */ cull: (args: { i: number | number[], confirm: true }) => ScriptResponse
|
625
|
+
|
626
|
+
/** **LOWSEC** */ loc: () => string | ScriptFailure
|
627
|
+
|
628
|
+
/** **LOWSEC** */ xfer_upgrade_to: {
|
629
|
+
(args: { i: number | number[], to: string, memo?: string }): ScriptResponse
|
630
|
+
(args: { sn: string | string[], to: string, memo?: string }): ScriptResponse
|
631
|
+
}
|
1046
632
|
}
|
1047
633
|
}
|
1048
634
|
|
1049
635
|
type Nullsec = Lowsec & PlayerNullsec & {
|
1050
636
|
corps: {
|
1051
|
-
/**
|
1052
|
-
|
1053
|
-
*/
|
1054
|
-
create: (args: {
|
1055
|
-
name: string
|
1056
|
-
confirm: true
|
1057
|
-
}) => ScriptResponse
|
637
|
+
/** **NULLSEC** */ create: (args: { name: string, confirm: true }) => ScriptResponse
|
638
|
+
/** **NULLSEC** */ hire: (args: { name: string }) => ScriptResponse
|
1058
639
|
|
1059
|
-
/**
|
1060
|
-
|
1061
|
-
*/
|
1062
|
-
hire: (args: { name: string }) => ScriptResponse
|
1063
|
-
|
1064
|
-
/**
|
1065
|
-
* **NULLSEC**
|
1066
|
-
*/
|
1067
|
-
manage: ((args: { command: "list" }) => {
|
1068
|
-
name: string
|
1069
|
-
is_admin: boolean
|
1070
|
-
}[] | ScriptFailure) & ((args: {
|
1071
|
-
command: "demote" | "promote"
|
1072
|
-
name: string
|
1073
|
-
} | {
|
1074
|
-
command: "fire"
|
1075
|
-
name: string
|
1076
|
-
confirm: true
|
1077
|
-
}) => ScriptResponse)
|
640
|
+
/** **NULLSEC** */ manage: {
|
641
|
+
(args: { command: "list" }): { name: string, is_admin: boolean }[] | ScriptFailure
|
1078
642
|
|
1079
|
-
|
1080
|
-
|
1081
|
-
*/
|
1082
|
-
offers: (() => {
|
1083
|
-
offers: string[]
|
1084
|
-
msg: string
|
1085
|
-
} | ScriptSuccess<{
|
1086
|
-
msg: string
|
1087
|
-
current_corp: string | null
|
1088
|
-
}>) & ((args: { accept: string }) => ScriptResponse)
|
1089
|
-
|
1090
|
-
/**
|
1091
|
-
* **NULLSEC**
|
1092
|
-
*/
|
1093
|
-
quit: (args: { confirm: true }) => ScriptResponse
|
1094
|
-
|
1095
|
-
/**
|
1096
|
-
* **NULLSEC**
|
1097
|
-
*/
|
1098
|
-
top: () => CorpsTop | {
|
1099
|
-
top: CorpsTop
|
1100
|
-
active: {
|
1101
|
-
name: string
|
1102
|
-
worth: string
|
1103
|
-
}
|
643
|
+
(args: { command: "demote" | "promote", name: string } | { command: "fire", name: string, confirm: true }):
|
644
|
+
ScriptResponse
|
1104
645
|
}
|
1105
|
-
}
|
1106
646
|
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
breach: (args: { confirm: true }) => ScriptResponse
|
1112
|
-
}
|
647
|
+
/** **NULLSEC** */ offers: {
|
648
|
+
(): { offers: string[], msg: string } | ScriptSuccess<{ msg: string, current_corp: string | null }>
|
649
|
+
(args: { accept: string }): ScriptResponse
|
650
|
+
}
|
1113
651
|
|
1114
|
-
|
1115
|
-
/**
|
1116
|
-
* **NULLSEC**
|
1117
|
-
*/
|
1118
|
-
me: () => string
|
652
|
+
/** **NULLSEC** */ quit: (args: { confirm: true }) => ScriptResponse
|
653
|
+
/** **NULLSEC** */ top: () => CorpsTop | { top: CorpsTop, active: { name: string, worth: string } }
|
1119
654
|
}
|
1120
655
|
|
656
|
+
sys: { /** **NULLSEC** */ breach: (args: { confirm: true }) => ScriptResponse }
|
657
|
+
trust: { /** **NULLSEC** */ me: () => string }
|
658
|
+
|
1121
659
|
users: {
|
1122
|
-
/**
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
660
|
+
/** **NULLSEC** */ config: {
|
661
|
+
(args: {
|
662
|
+
list: false
|
663
|
+
is_script?: true | null
|
664
|
+
avatar?: string | null
|
665
|
+
user_age?: boolean | null
|
666
|
+
account_age?: boolean | null
|
667
|
+
bio?: string | null
|
668
|
+
title?: string | null
|
669
|
+
pronouns?: string | null
|
670
|
+
corp?: boolean | null
|
671
|
+
alt_of?: string | null
|
672
|
+
badges?: string[] | null
|
673
|
+
}): ScriptResponse
|
674
|
+
|
675
|
+
(args: {
|
676
|
+
list: true
|
677
|
+
is_script?: true
|
678
|
+
avatar?: string | null
|
679
|
+
user_age?: boolean | null
|
680
|
+
account_age?: boolean | null
|
681
|
+
bio?: string | null
|
682
|
+
title?: string | null
|
683
|
+
pronouns?: string | null
|
684
|
+
corp?: boolean | null
|
685
|
+
alt_of?: string | null
|
686
|
+
badges?: string[] | null
|
687
|
+
}): {
|
688
|
+
avatar: string | null
|
689
|
+
user_age?: boolean
|
690
|
+
account_age?: boolean
|
691
|
+
bio: string | null
|
692
|
+
title: string | null
|
693
|
+
pronouns: string
|
694
|
+
corp?: boolean
|
695
|
+
alt_of: string | null
|
696
|
+
badges: string[]
|
697
|
+
}
|
698
|
+
|
699
|
+
(args: {
|
700
|
+
list: true
|
701
|
+
is_script: false
|
702
|
+
avatar?: string | null
|
703
|
+
user_age?: boolean | null
|
704
|
+
account_age?: boolean | null
|
705
|
+
bio?: string | null
|
706
|
+
title?: string | null
|
707
|
+
pronouns?: string | null
|
708
|
+
corp?: boolean | null
|
709
|
+
alt_of?: string | null
|
710
|
+
badges?: string[] | null
|
711
|
+
}): string
|
712
|
+
}
|
1172
713
|
}
|
1173
714
|
}
|
1174
715
|
|
1175
|
-
type
|
1176
|
-
|
1177
|
-
|
716
|
+
type MongoTypeString = "minKey" | "double" | "string" | "object" | "array" | "binData" | "undefined" | "objectId" |
|
717
|
+
"bool" | "date" | "null" | "regex" | "dbPointer" | "javascript" | "symbol" | "int" | "timestamp" | "long" | "decimal" | "maxKey";
|
718
|
+
type MongoTypeNumber = -1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 16 | 17 | 18 | 19 | 127;
|
1178
719
|
|
1179
|
-
type
|
1180
|
-
[key: string]: MongoCommandValue
|
1181
|
-
} | null | undefined
|
720
|
+
type MongoValue = string | number | boolean | Date | MongoValue[] | { [key: string]: MongoValue } | null
|
1182
721
|
|
1183
|
-
type
|
1184
|
-
|
1185
|
-
} & {
|
1186
|
-
_id?: Id
|
1187
|
-
$in?: MongoValue[]
|
1188
|
-
}
|
722
|
+
type MongoCommandValue = string | number | boolean | Date | MongoCommandValue[] | { [key: string]: MongoCommandValue } |
|
723
|
+
null | undefined
|
1189
724
|
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
$
|
1195
|
-
$
|
1196
|
-
|
725
|
+
/**
|
726
|
+
* Currently unused
|
727
|
+
*/
|
728
|
+
type MongoLogicalSelectors<T extends MongoValue = MongoValue> = {
|
729
|
+
$not: T | MongoComparisonSelectors<T> | MongoLogicalSelectors<T>
|
730
|
+
$nor: T[]
|
731
|
+
$or: T[]
|
732
|
+
$and: T[]
|
733
|
+
}
|
1197
734
|
|
1198
|
-
type
|
735
|
+
type MongoArraySelectors<T extends Array<MongoValue> = Array<MongoValue>> = {
|
736
|
+
$all: T
|
737
|
+
$elemMatch: T
|
738
|
+
$size: number
|
739
|
+
}
|
1199
740
|
|
1200
|
-
type
|
1201
|
-
|
1202
|
-
|
741
|
+
type MongoComparisonSelectors<T extends MongoValue = MongoValue> = {
|
742
|
+
$eq: T
|
743
|
+
$gt: T
|
744
|
+
$gte: T
|
745
|
+
$in: T[]
|
746
|
+
$lt: T
|
747
|
+
$lte: T
|
748
|
+
$ne: T
|
749
|
+
$nin: T[]
|
1203
750
|
}
|
1204
751
|
|
1205
|
-
type
|
1206
|
-
|
752
|
+
type MongoElementSelectors = {
|
753
|
+
$exists: boolean
|
754
|
+
$type: MongoTypeNumber | MongoTypeString
|
1207
755
|
}
|
1208
756
|
|
757
|
+
type MongoQuerySelector<T extends MongoValue = MongoValue> = Partial<T extends MongoValue[] ?
|
758
|
+
(MongoArraySelectors<T> & MongoElementSelectors & MongoComparisonSelectors<T>) :
|
759
|
+
(MongoElementSelectors & MongoComparisonSelectors<T>)>
|
760
|
+
|
761
|
+
type Query = { [key: string]: MongoValue | Query } & { _id?: Id, $in?: MongoValue[] }
|
762
|
+
type Projection = Record<string, boolean | 0 | 1>
|
763
|
+
|
764
|
+
type MongoCommand = MongoCommandValue & Partial<
|
765
|
+
{ $set: Record<string, MongoCommandValue>, $push: Record<string, MongoCommandValue>, $unset: Record<string, ""> }
|
766
|
+
>
|
767
|
+
|
768
|
+
type Id = string | number | boolean | Date | Record<string, MongoValue>
|
769
|
+
type MongoDocument = { [key: string]: MongoValue, _id: Id }
|
770
|
+
type SortOrder = { [key: string]: 1 | -1 | SortOrder }
|
771
|
+
|
1209
772
|
type Cursor = {
|
1210
|
-
/**
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
/**
|
1216
|
-
* Returns an array of documents that satisfy the query.
|
1217
|
-
*/
|
1218
|
-
array: () => MongoDocument[]
|
1219
|
-
|
1220
|
-
/**
|
1221
|
-
* Returns the number of documents that match the query.
|
1222
|
-
*/
|
1223
|
-
count: () => number
|
1224
|
-
|
1225
|
-
/**
|
1226
|
-
* Returns the first document that satisfies the query.
|
1227
|
-
* Also makes cursor unusable.
|
1228
|
-
*/
|
773
|
+
/** Returns the first document that satisfies the query. */ first: () => MongoDocument | null
|
774
|
+
/** Returns an array of documents that satisfy the query. */ array: () => MongoDocument[]
|
775
|
+
/** Returns the number of documents that match the query. */ count: () => number
|
776
|
+
|
777
|
+
/** Returns the first document that satisfies the query. Also makes cursor unusable. */
|
1229
778
|
first_and_close: () => MongoDocument
|
1230
779
|
|
1231
|
-
/**
|
1232
|
-
* Returns an array of documents that satisfy the query.
|
1233
|
-
* Also makes cursor unusable.
|
1234
|
-
*/
|
780
|
+
/** Returns an array of documents that satisfy the query. Also makes cursor unusable. */
|
1235
781
|
array_and_close: () => MongoDocument[]
|
1236
782
|
|
1237
|
-
/**
|
1238
|
-
* Returns the number of documents that match the query.
|
1239
|
-
* Also makes cursor unusable.
|
1240
|
-
*/
|
783
|
+
/** Returns the number of documents that match the query. Also makes cursor unusable. */
|
1241
784
|
count_and_close: () => number
|
1242
785
|
|
1243
|
-
/**
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
/**
|
1251
|
-
* Returns a new cursor with documents sorted as specified.
|
1252
|
-
* A value of 1 sorts the property ascending, and -1 descending.
|
1253
|
-
*
|
1254
|
-
* @param order the way the documents are to be sorted
|
1255
|
-
*/
|
786
|
+
/** Run `callback` on each document that satisfied the query. */
|
787
|
+
each: (callback: (document: MongoDocument) => void) => null
|
788
|
+
|
789
|
+
/** Returns a new cursor with documents sorted as specified.
|
790
|
+
* A value of 1 sorts the property ascending, and -1 descending.
|
791
|
+
* @param order The way the documents are to be sorted. */
|
1256
792
|
sort: (order?: SortOrder) => Cursor
|
1257
793
|
|
1258
|
-
/**
|
1259
|
-
|
1260
|
-
*
|
1261
|
-
* @param count number of documents to skip
|
1262
|
-
*/
|
794
|
+
/** Returns a new cursor without the first number of documents.
|
795
|
+
* @param count Number of documents to skip. */
|
1263
796
|
skip: (count: number) => Cursor
|
1264
797
|
|
1265
|
-
/**
|
1266
|
-
|
1267
|
-
*
|
1268
|
-
* @param count number of documents
|
1269
|
-
*/
|
798
|
+
/** Returns a new cursor limited to a number of documents as specified.
|
799
|
+
* @param count Number of documents. */
|
1270
800
|
limit: (count: number) => Cursor
|
1271
801
|
|
1272
|
-
/**
|
1273
|
-
|
1274
|
-
*/
|
1275
|
-
distinct: ((key: string) => MongoValue[]) & ((key: "_id") => Id[])
|
1276
|
-
|
1277
|
-
/**
|
1278
|
-
* Makes cursor unusable.
|
1279
|
-
*/
|
1280
|
-
close: () => null
|
1281
|
-
|
802
|
+
/** @param key The key of the documents. */ distinct: ((key: string) => MongoValue[]) & ((key: "_id") => Id[])
|
803
|
+
/** Make cursor unusable. */ close: () => null
|
1282
804
|
NumberLong: (number: number) => number
|
1283
805
|
ObjectId: () => any
|
1284
806
|
}
|
1285
807
|
|
1286
|
-
type
|
1287
|
-
/**
|
1288
|
-
|
1289
|
-
|
1290
|
-
caller:
|
1291
|
-
|
1292
|
-
/**
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
/**
|
1298
|
-
* the number of columns in the caller’s terminal, if reported by the client
|
1299
|
-
*/
|
1300
|
-
cols: number
|
1301
|
-
|
1302
|
-
/**
|
1303
|
-
* the number of rows in the caller’s terminal, if reported by the client
|
1304
|
-
*/
|
1305
|
-
rows: number
|
1306
|
-
|
1307
|
-
/**
|
1308
|
-
* The name of the script that directly called this script, or null if called on the command line or as a scriptor
|
1309
|
-
*/
|
1310
|
-
calling_script: null
|
808
|
+
type CliContext = {
|
809
|
+
/** The name of the user who is calling the script. */ caller: string
|
810
|
+
/** The name of this script. */ this_script: string
|
811
|
+
/** The number of columns in the caller’s terminal. */ cols: number
|
812
|
+
/** The number of rows in the caller’s terminal. */ rows: number
|
813
|
+
|
814
|
+
/** The name of the script that directly called this script, or null if called on the command line or as a
|
815
|
+
* scriptor. */ calling_script: null
|
816
|
+
is_scriptor?: undefined
|
817
|
+
is_brain?: undefined
|
1311
818
|
}
|
1312
819
|
|
1313
|
-
type SubscriptContext = Replace<
|
1314
|
-
/**
|
1315
|
-
|
1316
|
-
*/
|
820
|
+
type SubscriptContext = Replace<CliContext, {
|
821
|
+
/** The name of the script that directly called this script, or null if called on the command line or as a scriptor.
|
822
|
+
*/
|
1317
823
|
calling_script: string
|
1318
824
|
}>
|
1319
825
|
|
1320
|
-
type ScriptorContext =
|
1321
|
-
/**
|
1322
|
-
* true if the script is being run as a scriptor, otherwise falsey (not present currently, but I wouldn’t rely on that)
|
1323
|
-
*/
|
1324
|
-
is_scriptor: true
|
1325
|
-
}
|
826
|
+
type ScriptorContext =
|
827
|
+
Replace<CliContext, { /** Whether the script is being run as a scriptor. */ is_scriptor: true }>
|
1326
828
|
|
1327
|
-
type BrainContext =
|
1328
|
-
/**
|
1329
|
-
* true if the script is being run via a bot brain
|
1330
|
-
*/
|
1331
|
-
is_brain: true
|
1332
|
-
}
|
829
|
+
type BrainContext =
|
830
|
+
Replace<CliContext, { /** Whether the script is being run via a bot brain. */ is_brain: true }>
|
1333
831
|
|
1334
|
-
type Context =
|
832
|
+
type Context = CliContext | SubscriptContext | ScriptorContext | BrainContext
|
1335
833
|
|
1336
|
-
/**
|
1337
|
-
* Subscript space that can call FULLSEC scripts.
|
1338
|
-
*/
|
1339
|
-
declare const $fs: Fullsec
|
834
|
+
/** Subscript space that can call FULLSEC scripts. */ declare const $fs: Fullsec
|
1340
835
|
|
1341
|
-
/**
|
1342
|
-
* Subscript space that can call HIGHSEC and above scripts.
|
1343
|
-
* Makes your script HIGHSEC (overrides FULLSEC).
|
1344
|
-
*/
|
836
|
+
/** Subscript space that can call HIGHSEC and above scripts. Makes your script HIGHSEC (overrides FULLSEC). */
|
1345
837
|
declare const $hs: Highsec
|
1346
838
|
|
1347
|
-
/**
|
1348
|
-
|
1349
|
-
* Makes your script MIDSEC (overrides higher security levels).
|
1350
|
-
*/
|
839
|
+
/** Subscript space that can call MIDSEC and above scripts. Makes your script MIDSEC (overrides higher security levels).
|
840
|
+
*/
|
1351
841
|
declare const $ms: Midsec
|
1352
842
|
|
1353
|
-
/**
|
1354
|
-
|
1355
|
-
* Makes your script LOWSEC (overrides higher security levels).
|
1356
|
-
*/
|
843
|
+
/** Subscript space that can call LOWSEC and above scripts. Makes your script LOWSEC (overrides higher security levels).
|
844
|
+
*/
|
1357
845
|
declare const $ls: Lowsec
|
1358
846
|
|
1359
|
-
/**
|
1360
|
-
* Subscript space that can call any script.
|
1361
|
-
* Makes your script NULLSEC (overrides higher security levels).
|
1362
|
-
*/
|
847
|
+
/** Subscript space that can call any script. Makes your script NULLSEC (overrides higher security levels). */
|
1363
848
|
declare const $ns: Nullsec
|
1364
849
|
|
1365
|
-
/**
|
1366
|
-
* Subscript space that can call FULLSEC scripts.
|
1367
|
-
*/
|
1368
|
-
declare const $4s: typeof $fs
|
850
|
+
/** Subscript space that can call FULLSEC scripts. */ declare const $4s: typeof $fs
|
1369
851
|
|
1370
|
-
/**
|
1371
|
-
* Subscript space that can call HIGHSEC and above scripts.
|
1372
|
-
* Makes your script HIGHSEC (overrides FULLSEC).
|
1373
|
-
*/
|
852
|
+
/** Subscript space that can call HIGHSEC and above scripts. Makes your script HIGHSEC (overrides FULLSEC). */
|
1374
853
|
declare const $3s: typeof $hs
|
1375
854
|
|
1376
|
-
/**
|
1377
|
-
|
1378
|
-
* Makes your script MIDSEC (overrides higher security levels).
|
1379
|
-
*/
|
855
|
+
/** Subscript space that can call MIDSEC and above scripts. Makes your script MIDSEC (overrides higher security levels).
|
856
|
+
*/
|
1380
857
|
declare const $2s: typeof $ms
|
1381
858
|
|
1382
|
-
/**
|
1383
|
-
|
1384
|
-
* Makes your script LOWSEC (overrides higher security levels).
|
1385
|
-
*/
|
859
|
+
/** Subscript space that can call LOWSEC and above scripts. Makes your script LOWSEC (overrides higher security levels).
|
860
|
+
*/
|
1386
861
|
declare const $1s: typeof $ls
|
1387
862
|
|
1388
|
-
/**
|
1389
|
-
* Subscript space that can call any script.
|
1390
|
-
* Makes your script NULLSEC (overrides higher security levels).
|
1391
|
-
*/
|
863
|
+
/** Subscript space that can call any script. Makes your script NULLSEC (overrides higher security levels). */
|
1392
864
|
declare const $0s: typeof $ns
|
1393
865
|
|
1394
|
-
/**
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
* $s.foo.bar() // will be converted to #ms.foo.bar()
|
1402
|
-
* }
|
1403
|
-
* ```
|
1404
|
-
*/
|
866
|
+
/** Subscript space that can call any script. Uses seclevel provided in comment before script (defaults to NULLSEC)
|
867
|
+
* @example
|
868
|
+
* // @ seclevel MIDSEC
|
869
|
+
* // remove the space betwen "@" and "s", there's only a space because otherwise vscode breaks
|
870
|
+
* export function script() {
|
871
|
+
* $s.foo.bar() // will be converted to #ms.foo.bar()
|
872
|
+
* } */
|
1405
873
|
declare const $s: Nullsec
|
1406
874
|
|
875
|
+
type ObjectId = { $oid: string }
|
876
|
+
|
1407
877
|
declare const $db: {
|
1408
|
-
/**
|
1409
|
-
|
1410
|
-
*
|
1411
|
-
* Inserts a document or documents into a collection.
|
1412
|
-
* @param documents A document or array of documents to insert into the collection.
|
1413
|
-
*/
|
878
|
+
/** Insert a document or documents into a collection.
|
879
|
+
* @param documents A document or array of documents to insert into the collection. */
|
1414
880
|
i: (documents: object | object[]) => {
|
1415
881
|
ok: 1
|
1416
882
|
n: number
|
1417
|
-
opTime: {
|
1418
|
-
ts: "Undefined Conversion"
|
1419
|
-
t: number
|
1420
|
-
}
|
883
|
+
opTime: { ts: "Undefined Conversion", t: number }
|
1421
884
|
electionId: "Undefined Conversion"
|
1422
885
|
operationTime: "Undefined Conversion"
|
1423
886
|
$clusterTime: {
|
1424
887
|
clusterTime: "Undefined Conversion"
|
1425
|
-
signature: {
|
1426
|
-
hash: "Undefined Conversion"
|
1427
|
-
keyId: "Undefined Conversion"
|
1428
|
-
}
|
888
|
+
signature: { hash: "Undefined Conversion", keyId: "Undefined Conversion" }
|
1429
889
|
}
|
1430
890
|
}
|
1431
891
|
|
1432
|
-
/**
|
1433
|
-
|
1434
|
-
*
|
1435
|
-
* Removes documents from a collection.
|
1436
|
-
* @param query Specifies deletion criteria using query operators.
|
1437
|
-
*/
|
892
|
+
/** Remove documents from a collection.
|
893
|
+
* @param query Specifies deletion criteria using query operators. */
|
1438
894
|
r: (query: Query) => {
|
1439
895
|
ok: 0 | 1
|
1440
896
|
n: number
|
1441
|
-
opTime: {
|
1442
|
-
ts: "Undefined Conversion"
|
1443
|
-
t: number
|
1444
|
-
}
|
897
|
+
opTime: { ts: "Undefined Conversion", t: number }
|
1445
898
|
electionId: "Undefined Conversion"
|
1446
899
|
operationTime: "Undefined Conversion"
|
1447
900
|
$clusterTime: {
|
1448
901
|
clusterTime: "Undefined Conversion"
|
1449
|
-
signature: {
|
1450
|
-
hash: "Undefined Conversion"
|
1451
|
-
keyId: "Undefined Conversion"
|
1452
|
-
}
|
902
|
+
signature: { hash: "Undefined Conversion", keyId: "Undefined Conversion" }
|
1453
903
|
}
|
1454
904
|
}
|
1455
905
|
|
1456
|
-
/**
|
1457
|
-
|
1458
|
-
|
1459
|
-
* Selects documents in a collection or view and returns a cursor to the selected documents.
|
1460
|
-
* @param query Specifies deletion criteria using query operators.
|
1461
|
-
* @param projection Specifies the fields to return in the documents that match the query filter.
|
1462
|
-
*/
|
906
|
+
/** Find documents in a collection or view and returns a cursor to the selected documents.
|
907
|
+
* @param query Specifies deletion criteria using query operators.
|
908
|
+
* @param projection Specifies the fields to return in the documents that match the query filter. */
|
1463
909
|
f: (query?: Query, projection?: Projection) => Cursor
|
1464
910
|
|
1465
|
-
/**
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
* @param query Specifies deletion criteria using query operators.
|
1470
|
-
* @param command The modifications to apply. {@link https://docs.mongodb.com/manual/reference/method/db.collection.update/#parameters}
|
1471
|
-
*/
|
911
|
+
/** Update an existing documents in a collection.
|
912
|
+
* @param query Specifies deletion criteria using query operators.
|
913
|
+
* @param command The modifications to apply.
|
914
|
+
* {@link https://docs.mongodb.com/manual/reference/method/db.collection.update/#parameters} */
|
1472
915
|
u: (query: Query | Query[], command: MongoCommand) => {
|
1473
916
|
ok: 0 | 1
|
1474
917
|
nModified: number
|
1475
918
|
n: number
|
1476
|
-
opTime: {
|
1477
|
-
ts: "Undefined Conversion"
|
1478
|
-
t: number
|
1479
|
-
}
|
919
|
+
opTime: { ts: "Undefined Conversion", t: number }
|
1480
920
|
electionId: "Undefined Conversion"
|
1481
921
|
operationTime: "Undefined Conversion"
|
1482
922
|
$clusterTime: {
|
1483
923
|
clusterTime: "Undefined Conversion"
|
1484
|
-
signature: {
|
1485
|
-
hash: "Undefined Conversion"
|
1486
|
-
keyId: "Undefined Conversion"
|
1487
|
-
}
|
924
|
+
signature: { hash: "Undefined Conversion", keyId: "Undefined Conversion" }
|
1488
925
|
}
|
1489
926
|
}
|
1490
927
|
|
1491
|
-
/**
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
* @param query Specifies deletion criteria using query operators.
|
1496
|
-
* @param command The modifications to apply. {@link https://docs.mongodb.com/manual/reference/method/db.collection.update/#parameters}
|
1497
|
-
*/
|
928
|
+
/** Updates one document within the collection based on the filter.
|
929
|
+
* @param query Specifies deletion criteria using query operators.
|
930
|
+
* @param command The modifications to apply.
|
931
|
+
* {@link https://docs.mongodb.com/manual/reference/method/db.collection.update/#parameters} */
|
1498
932
|
u1: (query: Query | Query[], command: MongoCommand) => {
|
1499
933
|
ok: 0 | 1
|
1500
934
|
nModified: number
|
@@ -1514,144 +948,120 @@ declare const $db: {
|
|
1514
948
|
}
|
1515
949
|
}
|
1516
950
|
|
1517
|
-
/**
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
*/
|
951
|
+
/** Update or insert or insert document.
|
952
|
+
* Same as Update, but if no documents match the query, one document will be inserted based on the properties in
|
953
|
+
* both the query and the command.
|
954
|
+
* The `$setOnInsert` operator is useful to set defaults.
|
955
|
+
* @param query Specifies deletion criteria using query operators.
|
956
|
+
* @param command The modifications to apply.
|
957
|
+
* {@link https://docs.mongodb.com/manual/reference/method/db.collection.update/#parameters} */
|
1525
958
|
us: (query: Query | Query[], command: MongoCommand) => {
|
1526
959
|
ok: 0 | 1
|
1527
960
|
nModified: number
|
1528
961
|
n: number
|
1529
|
-
opTime: {
|
1530
|
-
ts: "Undefined Conversion"
|
1531
|
-
t: number
|
1532
|
-
}
|
962
|
+
opTime: { ts: "Undefined Conversion", t: number }
|
1533
963
|
electionId: "Undefined Conversion"
|
1534
964
|
operationTime: "Undefined Conversion"
|
1535
965
|
$clusterTime: {
|
1536
966
|
clusterTime: "Undefined Conversion"
|
1537
|
-
signature: {
|
1538
|
-
hash: "Undefined Conversion"
|
1539
|
-
keyId: "Undefined Conversion"
|
1540
|
-
}
|
967
|
+
signature: { hash: "Undefined Conversion", keyId: "Undefined Conversion" }
|
1541
968
|
}
|
1542
969
|
}
|
970
|
+
|
971
|
+
ObjectId: () => ObjectId
|
1543
972
|
}
|
1544
973
|
|
1545
|
-
/**
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
*/
|
974
|
+
/** Debug Log.
|
975
|
+
*
|
976
|
+
* If `$D()` is called in a script you own, the `return` value of the top level script is suppressed and instead an
|
977
|
+
* array of every `$D()`’d entry is printed.
|
978
|
+
* This lets you use `$D()` like `console.log()`.
|
979
|
+
*
|
980
|
+
* `$D()` in scripts not owned by you are not shown but the `return` value always is.
|
981
|
+
*
|
982
|
+
* `$D()` returns the first argument so `$D("Hello, World!") evaluates to `"Hello, World!"` as if the `$D` text wasn't
|
983
|
+
* there.
|
984
|
+
*
|
985
|
+
* `$D()`’d items are returned even if the script times out or errors. */
|
1557
986
|
declare function $D<T>(args: T): T
|
1558
987
|
|
1559
|
-
/**
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
* // all code here will only run once
|
1571
|
-
*/
|
988
|
+
/** Function Multi-Call Lock.
|
989
|
+
*
|
990
|
+
* This is used by escrow to ensure that it is only used once in script execution.
|
991
|
+
*
|
992
|
+
* The first time (per-script) `$FMCL` is encountered, it returns `undefined`, every other time it `return`s `true`.
|
993
|
+
*
|
994
|
+
* @example
|
995
|
+
* if ($FMCL)
|
996
|
+
* return { ok: false, msg: "This script can only be used once per script execution." }
|
997
|
+
*
|
998
|
+
* // all code here will only run once */
|
1572
999
|
declare const $FMCL: undefined | true
|
1573
1000
|
|
1574
|
-
/**
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
* This contains a JS timestamp (not Date) set immediately before your code begins running.
|
1588
|
-
*
|
1589
|
-
* @example
|
1590
|
-
* Date.now() - _START // milliseconds left of run time
|
1591
|
-
*/
|
1001
|
+
/** Per-script mutable "global" persistent object that is discarded at the end of top level script execution.
|
1002
|
+
*
|
1003
|
+
* `$G` persists between script calls until the end of the main script run making it useful for caching db entries when
|
1004
|
+
* your script is a subscript.
|
1005
|
+
* @example
|
1006
|
+
* if (!$G.dbCache)
|
1007
|
+
* $G.dbCache = $db.f({ whatever: true }).first() */
|
1008
|
+
declare const $G: Record<string | symbol, any>
|
1009
|
+
|
1010
|
+
/** This contains a JS timestamp (not Date) set immediately before your code begins running.
|
1011
|
+
* @example
|
1012
|
+
* $D(Date.now() - _START) // milliseconds left of run time
|
1013
|
+
*/
|
1592
1014
|
declare const _START: number
|
1593
1015
|
|
1594
|
-
/**
|
1595
|
-
|
1596
|
-
|
1597
|
-
* @example
|
1598
|
-
* Date.now() - _ST // milliseconds left of run time
|
1599
|
-
*/
|
1016
|
+
/** This contains a JS timestamp (not Date) set immediately before your code begins running.
|
1017
|
+
* @example
|
1018
|
+
* $D(Date.now() - _ST) // milliseconds left of run time */
|
1600
1019
|
declare const _ST: typeof _START
|
1601
1020
|
|
1602
|
-
/**
|
1603
|
-
* JavaScript timestamp for the end of the script run (`_START + _TIMEOUT`).
|
1604
|
-
*/
|
1605
|
-
declare const _END: number
|
1021
|
+
/** JavaScript timestamp for the end of the script run (`_START + _TIMEOUT`). */ declare const _END: number
|
1606
1022
|
|
1607
|
-
/**
|
1608
|
-
* The number of milliseconds a script can run for.
|
1609
|
-
* Normally `5000` though it has been known to change.
|
1610
|
-
*/
|
1023
|
+
/** The number of milliseconds a script can run for. Normally `5000` though it has been known to change. */
|
1611
1024
|
declare const _TIMEOUT: number
|
1612
1025
|
|
1613
|
-
/**
|
1614
|
-
* The number of milliseconds a script can run for.
|
1615
|
-
* Normally `5000` though it has been known to change.
|
1616
|
-
*/
|
1026
|
+
/** The number of milliseconds a script can run for. Normally `5000` though it has been known to change. */
|
1617
1027
|
declare const _TO: typeof _TIMEOUT
|
1618
1028
|
|
1619
|
-
/** The source code of this script as a string. */
|
1620
|
-
declare const
|
1621
|
-
|
1622
|
-
/** A unix timestamp of the date this script was built. */
|
1623
|
-
declare const _BUILD_DATE: number
|
1029
|
+
/** The source code of this script as a string. */ declare const _SOURCE: string
|
1030
|
+
/** A unix timestamp of the date this script was built. */ declare const _BUILD_DATE: number
|
1624
1031
|
|
1625
|
-
/**
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
* In rare cases where it's not known at build time, it's `"UNKNOWN"`.
|
1631
|
-
*/
|
1032
|
+
/** The user this script has been uploaded to.
|
1033
|
+
*
|
1034
|
+
* Shorter alternative to `context.this_script.split(".")[0].
|
1035
|
+
*
|
1036
|
+
* In rare cases where it's not known at build time, it's `"UNKNOWN"`. */
|
1632
1037
|
declare const _SCRIPT_USER: string
|
1633
1038
|
|
1634
|
-
/**
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
* In rare cases where it's not known at build time, it's `"UNKNOWN"`.
|
1642
|
-
*/
|
1039
|
+
/** The name of this script excluding the user and `.`.
|
1040
|
+
*
|
1041
|
+
* e.g. in the script `foo.bar`, `_SCRIPT_NAME` is `bar`.
|
1042
|
+
*
|
1043
|
+
* Shorter alternative to `context.this_script.split(".")[1].
|
1044
|
+
*
|
1045
|
+
* In rare cases where it's not known at build time, it's `"UNKNOWN"`. */
|
1643
1046
|
declare const _SCRIPT_NAME: string
|
1644
1047
|
|
1645
|
-
/**
|
1646
|
-
|
1647
|
-
|
1648
|
-
* In rare cases where it's not known at build time, it's `"UNKNOWN"`.
|
1649
|
-
*/
|
1048
|
+
/** The full name of this script equivilent to `context.this_script` but should use less characters.
|
1049
|
+
*
|
1050
|
+
* In rare cases where it's not known at build time, it's `"UNKNOWN"`. */
|
1650
1051
|
declare const _FULL_SCRIPT_NAME: string
|
1651
1052
|
|
1652
|
-
/**
|
1653
|
-
|
1654
|
-
|
1655
|
-
* In rare cases where it's not known at build time, it's `-1`.
|
1656
|
-
*/
|
1053
|
+
/** The seclevel of this script as a number.
|
1054
|
+
*
|
1055
|
+
* In rare cases where it's not known at build time, it's `-1`. */
|
1657
1056
|
declare const _SECLEVEL: -1 | 0 | 1 | 2 | 3 | 4
|
1057
|
+
|
1058
|
+
type DeepFreeze<T> = { readonly [P in keyof T]: DeepFreeze<T[P]> }
|
1059
|
+
|
1060
|
+
/** Recursively
|
1061
|
+
* [`Object.freeze()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze)
|
1062
|
+
* an object and its properties' objects and its properties' objects and so on.
|
1063
|
+
*
|
1064
|
+
* [Official Hackmud Wiki](https://wiki.hackmud.com/scripting/extensions/deep_freeze) */
|
1065
|
+
declare const DEEP_FREEZE: <T>(value: T) => DeepFreeze<T>
|
1066
|
+
|
1067
|
+
declare const _RUN_ID: string
|