@sippulse/niva-sdk 0.1.0-rc.9 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -0
- package/chat.d.ts +2 -0
- package/chat.js +1083 -0
- package/chunk-50ad2r7x.js +76 -0
- package/chunk-wx0m9ra5.js +4349 -0
- package/dts/src/chat/client.d.ts +10 -0
- package/dts/src/chat/download.d.ts +19 -0
- package/dts/src/chat/emitter.d.ts +8 -0
- package/dts/src/chat/end.d.ts +9 -0
- package/dts/src/chat/error.d.ts +15 -0
- package/dts/src/chat/index.d.ts +5 -0
- package/dts/src/chat/input.d.ts +12 -0
- package/dts/src/chat/policy.d.ts +14 -0
- package/dts/src/chat/queue.d.ts +24 -0
- package/dts/src/chat/socket.d.ts +12 -0
- package/dts/src/chat/storage.d.ts +18 -0
- package/dts/src/chat/timers.d.ts +12 -0
- package/dts/src/chat/transfer.d.ts +21 -0
- package/dts/src/chat/types.d.ts +236 -0
- package/dts/src/chat/upload.d.ts +48 -0
- package/dts/src/chat/wire.d.ts +46 -0
- package/dts/src/client.d.ts +8 -0
- package/dts/src/entry/chat.d.ts +2 -0
- package/dts/src/generated/client.d.ts +603 -48
- package/dts/src/generated/meta.d.ts +1 -1
- package/dts/src/generated/operations.d.ts +13426 -4370
- package/dts/src/generated/webhooks.d.ts +231 -1
- package/index.bun.js +48 -3385
- package/index.default.js +45 -3349
- package/index.deno.js +48 -3385
- package/index.node.js +47 -3384
- package/package.json +9 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// src/errors.ts
|
|
2
|
+
class NivaError2 extends Error {
|
|
3
|
+
name = "NivaError";
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
class NivaApiError2 extends NivaError2 {
|
|
7
|
+
name = "NivaApiError";
|
|
8
|
+
status;
|
|
9
|
+
code;
|
|
10
|
+
data;
|
|
11
|
+
requestId;
|
|
12
|
+
operation;
|
|
13
|
+
constructor(details) {
|
|
14
|
+
super(details.message);
|
|
15
|
+
this.status = details.status;
|
|
16
|
+
this.code = details.code;
|
|
17
|
+
this.data = details.data;
|
|
18
|
+
this.requestId = details.requestId;
|
|
19
|
+
this.operation = details.operation;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
class NivaConnectionError2 extends NivaError2 {
|
|
24
|
+
name = "NivaConnectionError";
|
|
25
|
+
reason;
|
|
26
|
+
constructor(message, options) {
|
|
27
|
+
super(message, options);
|
|
28
|
+
this.reason = options.reason;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
class NivaConfigurationError2 extends NivaError2 {
|
|
33
|
+
name = "NivaConfigurationError";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
class NivaIncompatibleServerError2 extends NivaError2 {
|
|
37
|
+
name = "NivaIncompatibleServerError";
|
|
38
|
+
serverVersion;
|
|
39
|
+
supported;
|
|
40
|
+
installCommand;
|
|
41
|
+
constructor(message, details) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.serverVersion = details.serverVersion;
|
|
44
|
+
this.supported = details.supported;
|
|
45
|
+
this.installCommand = details.installCommand;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
class NivaUnavailableError2 extends NivaError2 {
|
|
50
|
+
name = "NivaUnavailableError";
|
|
51
|
+
operation;
|
|
52
|
+
reason;
|
|
53
|
+
module;
|
|
54
|
+
constructor(operation, options) {
|
|
55
|
+
super(options.reason === "operation" ? `Operation ${operation} is not served by this NIVA installation` : `Operation ${operation} needs module ${options.module ?? "unknown"}, which is disabled on this installation`);
|
|
56
|
+
this.operation = operation;
|
|
57
|
+
this.reason = options.reason;
|
|
58
|
+
this.module = options.module;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
class NivaWebhookError2 extends NivaError2 {
|
|
63
|
+
name = "NivaWebhookError";
|
|
64
|
+
kind;
|
|
65
|
+
code;
|
|
66
|
+
constructor(kind, code, message) {
|
|
67
|
+
super(message);
|
|
68
|
+
this.kind = kind;
|
|
69
|
+
this.code = code;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function isNivaApiError2(err, code) {
|
|
73
|
+
return err instanceof NivaApiError2 && (code === undefined || err.code === code);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export { NivaError2, NivaApiError2, NivaConnectionError2, NivaConfigurationError2, NivaIncompatibleServerError2, NivaUnavailableError2, NivaWebhookError2, isNivaApiError2 };
|