@meowpanel/api 0.1.0-alpha.10 → 1.0.0-beta.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.
Potentially problematic release.
This version of @meowpanel/api might be problematic. Click here for more details.
- package/LICENSE +1 -1
- package/README.md +40 -0
- package/esm/mod.d.ts +87 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +85 -1
- package/esm/src/client.d.ts +233 -0
- package/esm/src/client.d.ts.map +1 -0
- package/esm/src/client.js +216 -0
- package/esm/src/emitter.d.ts +53 -0
- package/esm/src/emitter.d.ts.map +1 -0
- package/esm/src/emitter.js +55 -0
- package/esm/src/errors.d.ts +42 -0
- package/esm/src/errors.d.ts.map +1 -0
- package/esm/src/errors.js +45 -0
- package/esm/src/http.d.ts +144 -0
- package/esm/src/http.d.ts.map +1 -0
- package/esm/src/http.js +246 -0
- package/esm/src/namespace.d.ts +59 -0
- package/esm/src/namespace.d.ts.map +1 -0
- package/esm/src/namespace.js +79 -0
- package/esm/src/reactive.d.ts +29 -0
- package/esm/src/reactive.d.ts.map +1 -0
- package/esm/src/reactive.js +35 -0
- package/esm/src/resources/account.d.ts +125 -0
- package/esm/src/resources/account.d.ts.map +1 -0
- package/esm/src/resources/account.js +151 -0
- package/esm/src/resources/api-keys.d.ts +116 -0
- package/esm/src/resources/api-keys.d.ts.map +1 -0
- package/esm/src/resources/api-keys.js +105 -0
- package/esm/src/resources/auth.d.ts +39 -0
- package/esm/src/resources/auth.d.ts.map +1 -0
- package/esm/src/resources/auth.js +27 -0
- package/esm/src/resources/eggs.d.ts +238 -0
- package/esm/src/resources/eggs.d.ts.map +1 -0
- package/esm/src/resources/eggs.js +187 -0
- package/esm/src/resources/hosts.d.ts +62 -0
- package/esm/src/resources/hosts.d.ts.map +1 -0
- package/esm/src/resources/hosts.js +62 -0
- package/esm/src/resources/members.d.ts +138 -0
- package/esm/src/resources/members.d.ts.map +1 -0
- package/esm/src/resources/members.js +122 -0
- package/esm/src/resources/nodes.d.ts +397 -0
- package/esm/src/resources/nodes.d.ts.map +1 -0
- package/esm/src/resources/nodes.js +352 -0
- package/esm/src/resources/server-groups.d.ts +150 -0
- package/esm/src/resources/server-groups.d.ts.map +1 -0
- package/esm/src/resources/server-groups.js +111 -0
- package/esm/src/resources/servers/activity.d.ts +120 -0
- package/esm/src/resources/servers/activity.d.ts.map +1 -0
- package/esm/src/resources/servers/activity.js +163 -0
- package/esm/src/resources/servers/allocations.d.ts +125 -0
- package/esm/src/resources/servers/allocations.d.ts.map +1 -0
- package/esm/src/resources/servers/allocations.js +137 -0
- package/esm/src/resources/servers/connection.d.ts +108 -0
- package/esm/src/resources/servers/connection.d.ts.map +1 -0
- package/esm/src/resources/servers/connection.js +169 -0
- package/esm/src/resources/servers/files.d.ts +164 -0
- package/esm/src/resources/servers/files.d.ts.map +1 -0
- package/esm/src/resources/servers/files.js +281 -0
- package/esm/src/resources/servers/index.d.ts +126 -0
- package/esm/src/resources/servers/index.d.ts.map +1 -0
- package/esm/src/resources/servers/index.js +135 -0
- package/esm/src/resources/servers/profiles.d.ts +138 -0
- package/esm/src/resources/servers/profiles.d.ts.map +1 -0
- package/esm/src/resources/servers/profiles.js +177 -0
- package/esm/src/resources/servers/server.d.ts +136 -0
- package/esm/src/resources/servers/server.d.ts.map +1 -0
- package/esm/src/resources/servers/server.js +202 -0
- package/esm/src/resources/servers/sftp.d.ts +147 -0
- package/esm/src/resources/servers/sftp.d.ts.map +1 -0
- package/esm/src/resources/servers/sftp.js +153 -0
- package/esm/src/resources/servers/types.d.ts +199 -0
- package/esm/src/resources/servers/types.d.ts.map +1 -0
- package/esm/src/resources/servers/types.js +1 -0
- package/esm/src/sse.d.ts +51 -0
- package/esm/src/sse.d.ts.map +1 -0
- package/esm/src/sse.js +129 -0
- package/esm/src/types.d.ts +126 -0
- package/esm/src/types.d.ts.map +1 -0
- package/esm/src/types.js +21 -0
- package/package.json +4 -92
- package/script/mod.d.ts +87 -1
- package/script/mod.d.ts.map +1 -1
- package/script/mod.js +132 -3
- package/script/src/client.d.ts +233 -0
- package/script/src/client.d.ts.map +1 -0
- package/script/src/client.js +220 -0
- package/script/src/emitter.d.ts +53 -0
- package/script/src/emitter.d.ts.map +1 -0
- package/script/src/emitter.js +59 -0
- package/script/src/errors.d.ts +42 -0
- package/script/src/errors.d.ts.map +1 -0
- package/script/src/errors.js +49 -0
- package/script/src/http.d.ts +144 -0
- package/script/src/http.d.ts.map +1 -0
- package/script/src/http.js +250 -0
- package/script/src/namespace.d.ts +59 -0
- package/script/src/namespace.d.ts.map +1 -0
- package/script/src/namespace.js +83 -0
- package/script/src/reactive.d.ts +29 -0
- package/script/src/reactive.d.ts.map +1 -0
- package/script/src/reactive.js +39 -0
- package/script/src/resources/account.d.ts +125 -0
- package/script/src/resources/account.d.ts.map +1 -0
- package/script/src/resources/account.js +158 -0
- package/script/src/resources/api-keys.d.ts +116 -0
- package/script/src/resources/api-keys.d.ts.map +1 -0
- package/script/src/resources/api-keys.js +110 -0
- package/script/src/resources/auth.d.ts +39 -0
- package/script/src/resources/auth.d.ts.map +1 -0
- package/script/src/resources/auth.js +31 -0
- package/script/src/resources/eggs.d.ts +238 -0
- package/script/src/resources/eggs.d.ts.map +1 -0
- package/script/src/resources/eggs.js +193 -0
- package/script/src/resources/hosts.d.ts +62 -0
- package/script/src/resources/hosts.d.ts.map +1 -0
- package/script/src/resources/hosts.js +67 -0
- package/script/src/resources/members.d.ts +138 -0
- package/script/src/resources/members.d.ts.map +1 -0
- package/script/src/resources/members.js +127 -0
- package/script/src/resources/nodes.d.ts +397 -0
- package/script/src/resources/nodes.d.ts.map +1 -0
- package/script/src/resources/nodes.js +362 -0
- package/script/src/resources/server-groups.d.ts +150 -0
- package/script/src/resources/server-groups.d.ts.map +1 -0
- package/script/src/resources/server-groups.js +116 -0
- package/script/src/resources/servers/activity.d.ts +120 -0
- package/script/src/resources/servers/activity.d.ts.map +1 -0
- package/script/src/resources/servers/activity.js +170 -0
- package/script/src/resources/servers/allocations.d.ts +125 -0
- package/script/src/resources/servers/allocations.d.ts.map +1 -0
- package/script/src/resources/servers/allocations.js +142 -0
- package/script/src/resources/servers/connection.d.ts +108 -0
- package/script/src/resources/servers/connection.d.ts.map +1 -0
- package/script/src/resources/servers/connection.js +173 -0
- package/script/src/resources/servers/files.d.ts +164 -0
- package/script/src/resources/servers/files.d.ts.map +1 -0
- package/script/src/resources/servers/files.js +286 -0
- package/script/src/resources/servers/index.d.ts +126 -0
- package/script/src/resources/servers/index.d.ts.map +1 -0
- package/script/src/resources/servers/index.js +139 -0
- package/script/src/resources/servers/profiles.d.ts +138 -0
- package/script/src/resources/servers/profiles.d.ts.map +1 -0
- package/script/src/resources/servers/profiles.js +182 -0
- package/script/src/resources/servers/server.d.ts +136 -0
- package/script/src/resources/servers/server.d.ts.map +1 -0
- package/script/src/resources/servers/server.js +206 -0
- package/script/src/resources/servers/sftp.d.ts +147 -0
- package/script/src/resources/servers/sftp.d.ts.map +1 -0
- package/script/src/resources/servers/sftp.js +158 -0
- package/script/src/resources/servers/types.d.ts +199 -0
- package/script/src/resources/servers/types.d.ts.map +1 -0
- package/script/src/resources/servers/types.js +2 -0
- package/script/src/sse.d.ts +51 -0
- package/script/src/sse.d.ts.map +1 -0
- package/script/src/sse.js +133 -0
- package/script/src/types.d.ts +126 -0
- package/script/src/types.d.ts.map +1 -0
- package/script/src/types.js +25 -0
- package/esm/api.d.ts +0 -76
- package/esm/api.d.ts.map +0 -1
- package/esm/api.js +0 -187
- package/esm/components/auth.d.ts +0 -15
- package/esm/components/auth.d.ts.map +0 -1
- package/esm/components/auth.js +0 -13
- package/esm/components/connection/abstract.d.ts +0 -23
- package/esm/components/connection/abstract.d.ts.map +0 -1
- package/esm/components/connection/abstract.js +0 -43
- package/esm/components/connection/sse.d.ts +0 -20
- package/esm/components/connection/sse.d.ts.map +0 -1
- package/esm/components/connection/sse.js +0 -65
- package/esm/components/egg/egg.d.ts +0 -32
- package/esm/components/egg/egg.d.ts.map +0 -1
- package/esm/components/egg/egg.js +0 -70
- package/esm/components/group.d.ts +0 -14
- package/esm/components/group.d.ts.map +0 -1
- package/esm/components/group.js +0 -33
- package/esm/components/member_2.d.ts +0 -69
- package/esm/components/member_2.d.ts.map +0 -1
- package/esm/components/member_2.js +0 -140
- package/esm/components/node.d.ts +0 -78
- package/esm/components/node.d.ts.map +0 -1
- package/esm/components/node.js +0 -342
- package/esm/components/server/activity.d.ts +0 -45
- package/esm/components/server/activity.d.ts.map +0 -1
- package/esm/components/server/activity.js +0 -158
- package/esm/components/server/allocations.d.ts +0 -45
- package/esm/components/server/allocations.d.ts.map +0 -1
- package/esm/components/server/allocations.js +0 -146
- package/esm/components/server/files.d.ts +0 -50
- package/esm/components/server/files.d.ts.map +0 -1
- package/esm/components/server/files.js +0 -90
- package/esm/components/server/power.d.ts +0 -21
- package/esm/components/server/power.d.ts.map +0 -1
- package/esm/components/server/power.js +0 -43
- package/esm/components/server/profiles.d.ts +0 -63
- package/esm/components/server/profiles.d.ts.map +0 -1
- package/esm/components/server/profiles.js +0 -163
- package/esm/components/server/server.d.ts +0 -141
- package/esm/components/server/server.d.ts.map +0 -1
- package/esm/components/server/server.js +0 -358
- package/esm/components/server/sftp.d.ts +0 -31
- package/esm/components/server/sftp.d.ts.map +0 -1
- package/esm/components/server/sftp.js +0 -84
- package/esm/components/server/startup.d.ts +0 -17
- package/esm/components/server/startup.d.ts.map +0 -1
- package/esm/components/server/startup.js +0 -21
- package/esm/components/server/stats.d.ts +0 -19
- package/esm/components/server/stats.d.ts.map +0 -1
- package/esm/components/server/stats.js +0 -46
- package/esm/utils/cache.d.ts +0 -20
- package/esm/utils/cache.d.ts.map +0 -1
- package/esm/utils/cache.js +0 -66
- package/esm/utils/event.d.ts +0 -38
- package/esm/utils/event.d.ts.map +0 -1
- package/esm/utils/event.js +0 -71
- package/esm/utils/object.d.ts +0 -58
- package/esm/utils/object.d.ts.map +0 -1
- package/esm/utils/object.js +0 -86
- package/esm/utils/subscribe.d.ts +0 -37
- package/esm/utils/subscribe.d.ts.map +0 -1
- package/esm/utils/subscribe.js +0 -29
- package/esm/utils/timer.d.ts +0 -13
- package/esm/utils/timer.d.ts.map +0 -1
- package/esm/utils/timer.js +0 -32
- package/esm/utils/units.d.ts +0 -18
- package/esm/utils/units.d.ts.map +0 -1
- package/esm/utils/units.js +0 -82
- package/script/api.d.ts +0 -76
- package/script/api.d.ts.map +0 -1
- package/script/api.js +0 -192
- package/script/components/auth.d.ts +0 -15
- package/script/components/auth.d.ts.map +0 -1
- package/script/components/auth.js +0 -17
- package/script/components/connection/abstract.d.ts +0 -23
- package/script/components/connection/abstract.d.ts.map +0 -1
- package/script/components/connection/abstract.js +0 -47
- package/script/components/connection/sse.d.ts +0 -20
- package/script/components/connection/sse.d.ts.map +0 -1
- package/script/components/connection/sse.js +0 -69
- package/script/components/egg/egg.d.ts +0 -32
- package/script/components/egg/egg.d.ts.map +0 -1
- package/script/components/egg/egg.js +0 -74
- package/script/components/group.d.ts +0 -14
- package/script/components/group.d.ts.map +0 -1
- package/script/components/group.js +0 -37
- package/script/components/member_2.d.ts +0 -69
- package/script/components/member_2.d.ts.map +0 -1
- package/script/components/member_2.js +0 -146
- package/script/components/node.d.ts +0 -78
- package/script/components/node.d.ts.map +0 -1
- package/script/components/node.js +0 -349
- package/script/components/server/activity.d.ts +0 -45
- package/script/components/server/activity.d.ts.map +0 -1
- package/script/components/server/activity.js +0 -164
- package/script/components/server/allocations.d.ts +0 -45
- package/script/components/server/allocations.d.ts.map +0 -1
- package/script/components/server/allocations.js +0 -152
- package/script/components/server/files.d.ts +0 -50
- package/script/components/server/files.d.ts.map +0 -1
- package/script/components/server/files.js +0 -94
- package/script/components/server/power.d.ts +0 -21
- package/script/components/server/power.d.ts.map +0 -1
- package/script/components/server/power.js +0 -47
- package/script/components/server/profiles.d.ts +0 -63
- package/script/components/server/profiles.d.ts.map +0 -1
- package/script/components/server/profiles.js +0 -168
- package/script/components/server/server.d.ts +0 -141
- package/script/components/server/server.d.ts.map +0 -1
- package/script/components/server/server.js +0 -362
- package/script/components/server/sftp.d.ts +0 -31
- package/script/components/server/sftp.d.ts.map +0 -1
- package/script/components/server/sftp.js +0 -88
- package/script/components/server/startup.d.ts +0 -17
- package/script/components/server/startup.d.ts.map +0 -1
- package/script/components/server/startup.js +0 -25
- package/script/components/server/stats.d.ts +0 -19
- package/script/components/server/stats.d.ts.map +0 -1
- package/script/components/server/stats.js +0 -50
- package/script/utils/cache.d.ts +0 -20
- package/script/utils/cache.d.ts.map +0 -1
- package/script/utils/cache.js +0 -70
- package/script/utils/event.d.ts +0 -38
- package/script/utils/event.d.ts.map +0 -1
- package/script/utils/event.js +0 -75
- package/script/utils/object.d.ts +0 -58
- package/script/utils/object.d.ts.map +0 -1
- package/script/utils/object.js +0 -90
- package/script/utils/subscribe.d.ts +0 -37
- package/script/utils/subscribe.d.ts.map +0 -1
- package/script/utils/subscribe.js +0 -32
- package/script/utils/timer.d.ts +0 -13
- package/script/utils/timer.d.ts.map +0 -1
- package/script/utils/timer.js +0 -36
- package/script/utils/units.d.ts +0 -18
- package/script/utils/units.d.ts.map +0 -1
- package/script/utils/units.js +0 -86
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eggs.d.ts","sourceRoot":"","sources":["../../../src/src/resources/eggs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,KAAK,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,aAAa,CAAC;AAEhG,0DAA0D;AAC1D,MAAM,WAAW,WAAW;IAC3B,EAAE,EAAE,MAAM,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OAAO,CAAC,GAAG,CAAC;IA+BxE;;;;OAIG;IACU,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAK9C"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { ResourceNamespace } from '../namespace.js';
|
|
2
|
+
import { ReactiveResource } from '../reactive.js';
|
|
3
|
+
import { joinIncludes, toNanoID } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A category (nest) that groups related eggs.
|
|
6
|
+
*/
|
|
7
|
+
export class EggNest extends ReactiveResource {
|
|
8
|
+
/** Unique NanoID of this nest. */
|
|
9
|
+
id;
|
|
10
|
+
/** Display name of the nest, e.g. `"Minecraft"`. */
|
|
11
|
+
name;
|
|
12
|
+
/** @internal */
|
|
13
|
+
constructor(data) {
|
|
14
|
+
super();
|
|
15
|
+
this.id = toNanoID(data.id);
|
|
16
|
+
this.name = data.name;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* An egg - a game or application configuration template that defines how a server
|
|
21
|
+
* is installed, started, and stopped.
|
|
22
|
+
*
|
|
23
|
+
* Retrieved via {@link EggsNamespace.get} or {@link EggsNamespace.list}.
|
|
24
|
+
*/
|
|
25
|
+
export class Egg extends ReactiveResource {
|
|
26
|
+
/** The egg's unique NanoID. */
|
|
27
|
+
id;
|
|
28
|
+
/** Display name of the egg, e.g. `"Vanilla Minecraft"`. */
|
|
29
|
+
name;
|
|
30
|
+
/** Description of the egg. */
|
|
31
|
+
description;
|
|
32
|
+
/** The nest (category) this egg belongs to. */
|
|
33
|
+
nest;
|
|
34
|
+
/**
|
|
35
|
+
* The startup command template, e.g.
|
|
36
|
+
* `"java -Xms128M -Xmx{{SERVER_MEMORY}}M -jar {{SERVER_JARFILE}}"`.
|
|
37
|
+
*/
|
|
38
|
+
startupCommand;
|
|
39
|
+
/**
|
|
40
|
+
* The stop command sent to the server to shut it down gracefully,
|
|
41
|
+
* e.g. `"stop"` or `"^C"`.
|
|
42
|
+
*/
|
|
43
|
+
stopCommand;
|
|
44
|
+
/** When `true`, the server's outgoing IP is forced to match the allocation IP. */
|
|
45
|
+
forceOutgoingIp;
|
|
46
|
+
/** Installer configuration for this egg. */
|
|
47
|
+
installer;
|
|
48
|
+
/** Process configuration (startup, stop, logging). */
|
|
49
|
+
process;
|
|
50
|
+
/** Docker image variants for this egg. */
|
|
51
|
+
images;
|
|
52
|
+
/** When this egg was created. */
|
|
53
|
+
createdAt;
|
|
54
|
+
/** When this egg was last updated. */
|
|
55
|
+
updatedAt;
|
|
56
|
+
/** @internal */
|
|
57
|
+
constructor(data) {
|
|
58
|
+
super();
|
|
59
|
+
this.id = toNanoID(data.id);
|
|
60
|
+
this.name = data.name;
|
|
61
|
+
this.description = data.description;
|
|
62
|
+
this.nest = data.nest ? new EggNest(data.nest) : data.nest;
|
|
63
|
+
this.startupCommand = data.startup_command;
|
|
64
|
+
this.stopCommand = data.stop_command;
|
|
65
|
+
this.forceOutgoingIp = data.force_outgoing_ip;
|
|
66
|
+
this.installer = data.installer
|
|
67
|
+
? {
|
|
68
|
+
image: data.installer.image,
|
|
69
|
+
entryCommand: data.installer.entry_command,
|
|
70
|
+
script: data.installer.script,
|
|
71
|
+
}
|
|
72
|
+
: data.installer;
|
|
73
|
+
this.process = data.process
|
|
74
|
+
? {
|
|
75
|
+
startup: data.process.startup,
|
|
76
|
+
stop: data.process.stop,
|
|
77
|
+
logs: data.process.logs,
|
|
78
|
+
files: data.process.files,
|
|
79
|
+
fileBlacklistRegex: data.process.file_blacklist_regex,
|
|
80
|
+
}
|
|
81
|
+
: data.process;
|
|
82
|
+
this.images = data.images?.map((img) => ({
|
|
83
|
+
id: toNanoID(img.id),
|
|
84
|
+
name: img.name,
|
|
85
|
+
image: img.image,
|
|
86
|
+
createdAt: new Date(img.created_at),
|
|
87
|
+
updatedAt: new Date(img.updated_at),
|
|
88
|
+
}));
|
|
89
|
+
this.createdAt = new Date(data.created_at);
|
|
90
|
+
this.updatedAt = new Date(data.updated_at);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Namespace for egg management.
|
|
95
|
+
*
|
|
96
|
+
* Access via `api.eggs`.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts ignore
|
|
100
|
+
* const eggs = await api.eggs.list();
|
|
101
|
+
* const egg = await api.eggs.get(id);
|
|
102
|
+
* await api.eggs.update(id, { name: 'Paper Minecraft' });
|
|
103
|
+
* await api.eggs.delete(id);
|
|
104
|
+
* ```
|
|
105
|
+
*/
|
|
106
|
+
export class EggsNamespace extends ResourceNamespace {
|
|
107
|
+
/** @internal */
|
|
108
|
+
constructor(http) {
|
|
109
|
+
super(http);
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Fetch a paginated list of eggs.
|
|
113
|
+
*
|
|
114
|
+
* @param opts Pagination, search, and include options.
|
|
115
|
+
*/
|
|
116
|
+
async list(opts = {}) {
|
|
117
|
+
const extra = {};
|
|
118
|
+
const include = joinIncludes(opts);
|
|
119
|
+
if (include)
|
|
120
|
+
extra['include'] = include;
|
|
121
|
+
const result = await this.http.list('/eggs', opts, extra);
|
|
122
|
+
const eggs = result.data.map((d) => new Egg(d));
|
|
123
|
+
this.setCache(eggs);
|
|
124
|
+
return { ...result, data: eggs };
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Fetch a single egg by ID.
|
|
128
|
+
*
|
|
129
|
+
* @param id The egg's NanoID.
|
|
130
|
+
* @param opts Include options.
|
|
131
|
+
*/
|
|
132
|
+
async get(id, opts = {}) {
|
|
133
|
+
const params = {};
|
|
134
|
+
const include = joinIncludes(opts);
|
|
135
|
+
if (include)
|
|
136
|
+
params['include'] = include;
|
|
137
|
+
const data = await this.http.get(`/eggs/${id}`, { params });
|
|
138
|
+
return new Egg(data);
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Update an egg's configuration.
|
|
142
|
+
*
|
|
143
|
+
* @param id The egg's NanoID.
|
|
144
|
+
* @param payload The fields to update.
|
|
145
|
+
*/
|
|
146
|
+
async update(id, payload) {
|
|
147
|
+
const body = {};
|
|
148
|
+
if (payload.name !== undefined)
|
|
149
|
+
body['name'] = payload.name;
|
|
150
|
+
if (payload.description !== undefined) {
|
|
151
|
+
body['description'] = payload.description;
|
|
152
|
+
}
|
|
153
|
+
if (payload.nestId !== undefined)
|
|
154
|
+
body['nest_id'] = payload.nestId;
|
|
155
|
+
if (payload.startupCommand !== undefined) {
|
|
156
|
+
body['startup_command'] = payload.startupCommand;
|
|
157
|
+
}
|
|
158
|
+
if (payload.stopCommand !== undefined) {
|
|
159
|
+
body['stop_command'] = payload.stopCommand;
|
|
160
|
+
}
|
|
161
|
+
if (payload.forceOutgoingIp !== undefined) {
|
|
162
|
+
body['force_outgoing_ip'] = payload.forceOutgoingIp;
|
|
163
|
+
}
|
|
164
|
+
if (payload.installer) {
|
|
165
|
+
body['installer'] = {
|
|
166
|
+
image: payload.installer.image,
|
|
167
|
+
entry_command: payload.installer.entryCommand,
|
|
168
|
+
script: payload.installer.script,
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
const data = await this.http.patch(`/eggs/${id}`, body);
|
|
172
|
+
const egg = new Egg(data);
|
|
173
|
+
this.upsertCache(egg);
|
|
174
|
+
this.emit('updated', egg);
|
|
175
|
+
return egg;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Delete an egg permanently.
|
|
179
|
+
*
|
|
180
|
+
* @param id The egg's NanoID.
|
|
181
|
+
*/
|
|
182
|
+
async delete(id) {
|
|
183
|
+
await this.http.delete(`/eggs/${id}`);
|
|
184
|
+
this.removeFromCache(id);
|
|
185
|
+
this.emit('deleted', id);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { HttpClient } from '../http.js';
|
|
2
|
+
import { ResourceNamespace } from '../namespace.js';
|
|
3
|
+
import { ReactiveResource } from '../reactive.js';
|
|
4
|
+
import { type ISODate, type NanoID, type Paginated } from '../types.js';
|
|
5
|
+
/** Raw API shape for a physical host. @internal */
|
|
6
|
+
export interface HostData {
|
|
7
|
+
id: string;
|
|
8
|
+
hostname: string;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
color?: string | null;
|
|
11
|
+
notes?: string | null;
|
|
12
|
+
created_at: ISODate;
|
|
13
|
+
updated_at: ISODate;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A physical host machine on which nodes are deployed.
|
|
17
|
+
*
|
|
18
|
+
* Retrieved via {@link HostsNamespace.list}.
|
|
19
|
+
*/
|
|
20
|
+
export declare class Host extends ReactiveResource {
|
|
21
|
+
/** The host's unique NanoID. */
|
|
22
|
+
readonly id: NanoID;
|
|
23
|
+
/** The host's hostname, e.g. `"host.example.com"`. */
|
|
24
|
+
hostname: string;
|
|
25
|
+
/** Optional display name for the host. */
|
|
26
|
+
name: string | null | undefined;
|
|
27
|
+
/** Optional color used in the UI for grouping. */
|
|
28
|
+
color: string | null | undefined;
|
|
29
|
+
/** Internal notes. */
|
|
30
|
+
notes: string | null | undefined;
|
|
31
|
+
/** When this host was registered. */
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
/** When this host was last updated. */
|
|
34
|
+
updatedAt: Date;
|
|
35
|
+
/** @internal */
|
|
36
|
+
constructor(data: HostData);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Namespace for host management.
|
|
40
|
+
*
|
|
41
|
+
* Access via `api.hosts`.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts ignore
|
|
45
|
+
* const hosts = await api.hosts.list();
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class HostsNamespace extends ResourceNamespace<Host> {
|
|
49
|
+
/** @internal */
|
|
50
|
+
constructor(http: HttpClient);
|
|
51
|
+
/**
|
|
52
|
+
* Fetch a paginated list of physical hosts.
|
|
53
|
+
*
|
|
54
|
+
* @param opts Pagination and search options.
|
|
55
|
+
*/
|
|
56
|
+
list(opts?: {
|
|
57
|
+
page?: number;
|
|
58
|
+
perPage?: number;
|
|
59
|
+
search?: string;
|
|
60
|
+
}): Promise<Paginated<Host>>;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=hosts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hosts.d.ts","sourceRoot":"","sources":["../../../src/src/resources/hosts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,aAAa,CAAC;AAElF,mDAAmD;AACnD,MAAM,WAAW,QAAQ;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,qBAAa,IAAK,SAAQ,gBAAgB;IACzC,gCAAgC;IAChC,SAAgB,EAAE,EAAE,MAAM,CAAC;IAC3B,sDAAsD;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACxB,0CAA0C;IACnC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACvC,kDAAkD;IAC3C,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,sBAAsB;IACf,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACxC,qCAAqC;IAC9B,SAAS,EAAE,IAAI,CAAC;IACvB,uCAAuC;IAChC,SAAS,EAAE,IAAI,CAAC;IAEvB,gBAAgB;gBACG,IAAI,EAAE,QAAQ;CAUjC;AAED;;;;;;;;;GASG;AACH,qBAAa,cAAe,SAAQ,iBAAiB,CAAC,IAAI,CAAC;IAC1D,gBAAgB;gBACG,IAAI,EAAE,UAAU;IAInC;;;;OAIG;IACU,IAAI,CAAC,IAAI,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;CAM5G"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ResourceNamespace } from '../namespace.js';
|
|
2
|
+
import { ReactiveResource } from '../reactive.js';
|
|
3
|
+
import { toNanoID } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A physical host machine on which nodes are deployed.
|
|
6
|
+
*
|
|
7
|
+
* Retrieved via {@link HostsNamespace.list}.
|
|
8
|
+
*/
|
|
9
|
+
export class Host extends ReactiveResource {
|
|
10
|
+
/** The host's unique NanoID. */
|
|
11
|
+
id;
|
|
12
|
+
/** The host's hostname, e.g. `"host.example.com"`. */
|
|
13
|
+
hostname;
|
|
14
|
+
/** Optional display name for the host. */
|
|
15
|
+
name;
|
|
16
|
+
/** Optional color used in the UI for grouping. */
|
|
17
|
+
color;
|
|
18
|
+
/** Internal notes. */
|
|
19
|
+
notes;
|
|
20
|
+
/** When this host was registered. */
|
|
21
|
+
createdAt;
|
|
22
|
+
/** When this host was last updated. */
|
|
23
|
+
updatedAt;
|
|
24
|
+
/** @internal */
|
|
25
|
+
constructor(data) {
|
|
26
|
+
super();
|
|
27
|
+
this.id = toNanoID(data.id);
|
|
28
|
+
this.hostname = data.hostname;
|
|
29
|
+
this.name = data.name;
|
|
30
|
+
this.color = data.color;
|
|
31
|
+
this.notes = data.notes;
|
|
32
|
+
this.createdAt = new Date(data.created_at);
|
|
33
|
+
this.updatedAt = new Date(data.updated_at);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Namespace for host management.
|
|
38
|
+
*
|
|
39
|
+
* Access via `api.hosts`.
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts ignore
|
|
43
|
+
* const hosts = await api.hosts.list();
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class HostsNamespace extends ResourceNamespace {
|
|
47
|
+
/** @internal */
|
|
48
|
+
constructor(http) {
|
|
49
|
+
super(http);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Fetch a paginated list of physical hosts.
|
|
53
|
+
*
|
|
54
|
+
* @param opts Pagination and search options.
|
|
55
|
+
*/
|
|
56
|
+
async list(opts = {}) {
|
|
57
|
+
const result = await this.http.list('/hosts', opts);
|
|
58
|
+
const hosts = result.data.map((d) => new Host(d));
|
|
59
|
+
this.setCache(hosts);
|
|
60
|
+
return { ...result, data: hosts };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import type { HttpClient } from '../http.js';
|
|
2
|
+
import { ResourceNamespace } from '../namespace.js';
|
|
3
|
+
import { ReactiveResource } from '../reactive.js';
|
|
4
|
+
import type { IncludeOptions, ResourceWith } from '../types.js';
|
|
5
|
+
import { type ISODate, type NanoID, type Paginated } from '../types.js';
|
|
6
|
+
/** Raw API response shape for a member (user). @internal */
|
|
7
|
+
export interface MemberData {
|
|
8
|
+
id: string;
|
|
9
|
+
issuer_type: 'user';
|
|
10
|
+
email: string;
|
|
11
|
+
nickname: string | null;
|
|
12
|
+
avatar_uri: string | null;
|
|
13
|
+
display?: {
|
|
14
|
+
language: string | null;
|
|
15
|
+
theme: string | null;
|
|
16
|
+
} | null;
|
|
17
|
+
permissions?: string[];
|
|
18
|
+
created_at: ISODate;
|
|
19
|
+
updated_at: ISODate;
|
|
20
|
+
}
|
|
21
|
+
/** Display preferences for a member. */
|
|
22
|
+
export interface MemberDisplay {
|
|
23
|
+
/** The member's preferred UI language code. */
|
|
24
|
+
language: string | null;
|
|
25
|
+
/** The member's preferred UI theme identifier. */
|
|
26
|
+
theme: string | null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A MeowPanel user account (member).
|
|
30
|
+
*
|
|
31
|
+
* Retrieved via {@link MembersNamespace.get} or {@link MembersNamespace.list}.
|
|
32
|
+
*/
|
|
33
|
+
export declare class Member extends ReactiveResource {
|
|
34
|
+
/** The member's unique NanoID. */
|
|
35
|
+
readonly id: NanoID;
|
|
36
|
+
/** Always `'user'` for member accounts. */
|
|
37
|
+
issuerType: 'user';
|
|
38
|
+
/** The member's login email address. */
|
|
39
|
+
email: string;
|
|
40
|
+
/** The member's display nickname. */
|
|
41
|
+
nickname: string | null;
|
|
42
|
+
/** URL of the member's avatar image, or `null` if no avatar is set. */
|
|
43
|
+
avatarUri: string | null;
|
|
44
|
+
/** Display preferences (language and theme). */
|
|
45
|
+
display: MemberDisplay | null | undefined;
|
|
46
|
+
/** The member's assigned permission scopes. */
|
|
47
|
+
permissions: string[] | undefined;
|
|
48
|
+
/** When this member account was created. */
|
|
49
|
+
createdAt: Date;
|
|
50
|
+
/** When this member account was last updated. */
|
|
51
|
+
updatedAt: Date;
|
|
52
|
+
/** @internal */
|
|
53
|
+
constructor(data: MemberData);
|
|
54
|
+
/**
|
|
55
|
+
* Apply raw API data to this member instance, updating all mutable fields.
|
|
56
|
+
*
|
|
57
|
+
* Called by the constructor and by {@link MembersNamespace.update} to update the instance in-place.
|
|
58
|
+
*/
|
|
59
|
+
applyData(data: MemberData): void;
|
|
60
|
+
}
|
|
61
|
+
/** Fields that can be updated on a member. All fields are optional. */
|
|
62
|
+
export interface UpdateMemberPayload {
|
|
63
|
+
/** New email address for the member. */
|
|
64
|
+
email?: string;
|
|
65
|
+
/** New display nickname. */
|
|
66
|
+
nickname?: string;
|
|
67
|
+
/** Display preference updates. */
|
|
68
|
+
display?: {
|
|
69
|
+
/** UI language code, or `null` to clear. */
|
|
70
|
+
language?: string | null;
|
|
71
|
+
/** UI theme identifier, or `null` to clear. */
|
|
72
|
+
theme?: string | null;
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/** Valid include keys for member endpoints. */
|
|
76
|
+
export type MemberInclude = 'display' | 'permissions';
|
|
77
|
+
/** Maps each {@link MemberInclude} key to the field(s) it guarantees on the {@link Member} instance. */
|
|
78
|
+
interface MemberIncludeMap {
|
|
79
|
+
display: {
|
|
80
|
+
display: MemberDisplay | null;
|
|
81
|
+
};
|
|
82
|
+
permissions: {
|
|
83
|
+
permissions: string[];
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
/** A {@link Member} with specific include fields guaranteed to be populated. */
|
|
87
|
+
export type MemberWith<I extends readonly MemberInclude[] = []> = ResourceWith<Member, MemberIncludeMap, I>;
|
|
88
|
+
/** Typed events emitted by {@link MembersNamespace}. */
|
|
89
|
+
export interface MemberEvents {
|
|
90
|
+
/** Fired after a member is successfully updated. */
|
|
91
|
+
updated: Member;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Namespace for member (user) management.
|
|
95
|
+
*
|
|
96
|
+
* Access via `api.members`.
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```ts ignore
|
|
100
|
+
* // Reactive store
|
|
101
|
+
* // {#each $api.members as member} ... {/each}
|
|
102
|
+
*
|
|
103
|
+
* // Imperative
|
|
104
|
+
* const members = await api.members.list();
|
|
105
|
+
* const member = await api.members.get(id);
|
|
106
|
+
* await api.members.update(id, { nickname: 'newname' });
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare class MembersNamespace extends ResourceNamespace<Member, MemberEvents> {
|
|
110
|
+
/** @internal */
|
|
111
|
+
constructor(http: HttpClient);
|
|
112
|
+
/**
|
|
113
|
+
* Fetch a paginated list of all members.
|
|
114
|
+
*
|
|
115
|
+
* @param opts Pagination, search, and include options.
|
|
116
|
+
*/
|
|
117
|
+
list<const I extends readonly MemberInclude[] = []>(opts?: {
|
|
118
|
+
page?: number;
|
|
119
|
+
perPage?: number;
|
|
120
|
+
search?: string;
|
|
121
|
+
} & IncludeOptions<MemberInclude, I>): Promise<Paginated<MemberWith<I>>>;
|
|
122
|
+
/**
|
|
123
|
+
* Fetch a single member by ID.
|
|
124
|
+
*
|
|
125
|
+
* @param id The member's NanoID.
|
|
126
|
+
* @param opts Include options.
|
|
127
|
+
*/
|
|
128
|
+
get<const I extends readonly MemberInclude[] = []>(id: NanoID, opts?: IncludeOptions<MemberInclude, I>): Promise<MemberWith<I>>;
|
|
129
|
+
/**
|
|
130
|
+
* Update a member's profile fields.
|
|
131
|
+
*
|
|
132
|
+
* @param id The member's NanoID.
|
|
133
|
+
* @param payload The fields to update.
|
|
134
|
+
*/
|
|
135
|
+
update(id: NanoID, payload: UpdateMemberPayload): Promise<Member>;
|
|
136
|
+
}
|
|
137
|
+
export {};
|
|
138
|
+
//# sourceMappingURL=members.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"members.d.ts","sourceRoot":"","sources":["../../../src/src/resources/members.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,KAAK,OAAO,EAAgB,KAAK,MAAM,EAAE,KAAK,SAAS,EAAY,MAAM,aAAa,CAAC;AAEhG,4DAA4D;AAC5D,MAAM,WAAW,UAAU;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MA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GAAG,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,aAAa,EAAE,GAAG,EAAE,EAC7D,EAAE,EAAE,MAAM,EACV,IAAI,GAAE,cAAc,CAAC,aAAa,EAAE,CAAC,CAAM,GACzC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAQzB;;;;;OAKG;IACU,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC;CAc9E"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { ResourceNamespace } from '../namespace.js';
|
|
2
|
+
import { ReactiveResource } from '../reactive.js';
|
|
3
|
+
import { joinIncludes, toNanoID } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* A MeowPanel user account (member).
|
|
6
|
+
*
|
|
7
|
+
* Retrieved via {@link MembersNamespace.get} or {@link MembersNamespace.list}.
|
|
8
|
+
*/
|
|
9
|
+
export class Member extends ReactiveResource {
|
|
10
|
+
/** The member's unique NanoID. */
|
|
11
|
+
id;
|
|
12
|
+
/** Always `'user'` for member accounts. */
|
|
13
|
+
issuerType;
|
|
14
|
+
/** The member's login email address. */
|
|
15
|
+
email;
|
|
16
|
+
/** The member's display nickname. */
|
|
17
|
+
nickname;
|
|
18
|
+
/** URL of the member's avatar image, or `null` if no avatar is set. */
|
|
19
|
+
avatarUri;
|
|
20
|
+
/** Display preferences (language and theme). */
|
|
21
|
+
display;
|
|
22
|
+
/** The member's assigned permission scopes. */
|
|
23
|
+
permissions;
|
|
24
|
+
/** When this member account was created. */
|
|
25
|
+
createdAt;
|
|
26
|
+
/** When this member account was last updated. */
|
|
27
|
+
updatedAt;
|
|
28
|
+
/** @internal */
|
|
29
|
+
constructor(data) {
|
|
30
|
+
super();
|
|
31
|
+
this.id = toNanoID(data.id);
|
|
32
|
+
this.issuerType = data.issuer_type;
|
|
33
|
+
this.applyData(data);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Apply raw API data to this member instance, updating all mutable fields.
|
|
37
|
+
*
|
|
38
|
+
* Called by the constructor and by {@link MembersNamespace.update} to update the instance in-place.
|
|
39
|
+
*/
|
|
40
|
+
applyData(data) {
|
|
41
|
+
this.issuerType = data.issuer_type;
|
|
42
|
+
this.email = data.email;
|
|
43
|
+
this.nickname = data.nickname;
|
|
44
|
+
this.avatarUri = data.avatar_uri;
|
|
45
|
+
this.display = data.display ?? undefined;
|
|
46
|
+
this.permissions = data.permissions;
|
|
47
|
+
this.createdAt = new Date(data.created_at);
|
|
48
|
+
this.updatedAt = new Date(data.updated_at);
|
|
49
|
+
this.notify();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Namespace for member (user) management.
|
|
54
|
+
*
|
|
55
|
+
* Access via `api.members`.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts ignore
|
|
59
|
+
* // Reactive store
|
|
60
|
+
* // {#each $api.members as member} ... {/each}
|
|
61
|
+
*
|
|
62
|
+
* // Imperative
|
|
63
|
+
* const members = await api.members.list();
|
|
64
|
+
* const member = await api.members.get(id);
|
|
65
|
+
* await api.members.update(id, { nickname: 'newname' });
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
export class MembersNamespace extends ResourceNamespace {
|
|
69
|
+
/** @internal */
|
|
70
|
+
constructor(http) {
|
|
71
|
+
super(http);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Fetch a paginated list of all members.
|
|
75
|
+
*
|
|
76
|
+
* @param opts Pagination, search, and include options.
|
|
77
|
+
*/
|
|
78
|
+
async list(opts = {}) {
|
|
79
|
+
const extra = {};
|
|
80
|
+
const include = joinIncludes(opts);
|
|
81
|
+
if (include)
|
|
82
|
+
extra['include'] = include;
|
|
83
|
+
const result = await this.http.list('/members', opts, extra);
|
|
84
|
+
const members = result.data.map((d) => new Member(d));
|
|
85
|
+
this.setCache(members);
|
|
86
|
+
return { ...result, data: members };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Fetch a single member by ID.
|
|
90
|
+
*
|
|
91
|
+
* @param id The member's NanoID.
|
|
92
|
+
* @param opts Include options.
|
|
93
|
+
*/
|
|
94
|
+
async get(id, opts = {}) {
|
|
95
|
+
const params = {};
|
|
96
|
+
const include = joinIncludes(opts);
|
|
97
|
+
if (include)
|
|
98
|
+
params['include'] = include;
|
|
99
|
+
const data = await this.http.get(`/members/${id}`, { params });
|
|
100
|
+
return new Member(data);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Update a member's profile fields.
|
|
104
|
+
*
|
|
105
|
+
* @param id The member's NanoID.
|
|
106
|
+
* @param payload The fields to update.
|
|
107
|
+
*/
|
|
108
|
+
async update(id, payload) {
|
|
109
|
+
const data = await this.http.patch(`/members/${id}`, payload);
|
|
110
|
+
const existing = this.cache.find((m) => m.id === id);
|
|
111
|
+
if (existing) {
|
|
112
|
+
existing.applyData(data);
|
|
113
|
+
this.upsertCache(existing);
|
|
114
|
+
this.emit('updated', existing);
|
|
115
|
+
return existing;
|
|
116
|
+
}
|
|
117
|
+
const member = new Member(data);
|
|
118
|
+
this.upsertCache(member);
|
|
119
|
+
this.emit('updated', member);
|
|
120
|
+
return member;
|
|
121
|
+
}
|
|
122
|
+
}
|