@awarevue/api-types 1.0.20 → 1.0.22
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/dist/error.d.ts +37 -0
- package/dist/error.js +11 -0
- package/dist/package.json +1 -1
- package/package.json +1 -1
package/dist/error.d.ts
CHANGED
|
@@ -42,12 +42,15 @@ export declare const sConflictMeta: z.ZodObject<{
|
|
|
42
42
|
subject: z.ZodString;
|
|
43
43
|
blockingSubject: z.ZodOptional<z.ZodString>;
|
|
44
44
|
blockingId: z.ZodOptional<z.ZodString>;
|
|
45
|
+
value: z.ZodOptional<z.ZodString>;
|
|
45
46
|
}, "strip", z.ZodTypeAny, {
|
|
46
47
|
subject: string;
|
|
48
|
+
value?: string | undefined;
|
|
47
49
|
blockingSubject?: string | undefined;
|
|
48
50
|
blockingId?: string | undefined;
|
|
49
51
|
}, {
|
|
50
52
|
subject: string;
|
|
53
|
+
value?: string | undefined;
|
|
51
54
|
blockingSubject?: string | undefined;
|
|
52
55
|
blockingId?: string | undefined;
|
|
53
56
|
}>;
|
|
@@ -60,11 +63,15 @@ export type ConflictMeta = z.infer<typeof sConflictMeta>;
|
|
|
60
63
|
export declare enum AppErrorCode {
|
|
61
64
|
RESOURCE_ALREADY_EXISTS = "RESOURCE_ALREADY_EXISTS",
|
|
62
65
|
RESOURCE_NOT_FOUND = "RESOURCE_NOT_FOUND",
|
|
66
|
+
RESOURCE_FORBIDDEN = "RESOURCE_FORBIDDEN",
|
|
63
67
|
RESOURCE_INVALID = "RESOURCE_INVALID",
|
|
64
68
|
RESOURCE_IN_USE = "RESOURCE_IN_USE",
|
|
65
69
|
RESOURCE_NOT_SUPPORTED = "RESOURCE_NOT_SUPPORTED",
|
|
66
70
|
BAD_REFERENCE = "BAD_REFERENCE",
|
|
67
71
|
UNKNOWN = "UNKNOWN",
|
|
72
|
+
SERVER_INTERNAL_ERROR = "SERVER_INTERNAL_ERROR",
|
|
73
|
+
UNAUTHORIZED = "UNAUTHORIZED",
|
|
74
|
+
BAD_REQUEST = "BAD_REQUEST",
|
|
68
75
|
ACCESS_RULE_NOT_FOUND = "ACCESS_RULE_NOT_FOUND",
|
|
69
76
|
ACCESS_RULE_PERMISSION_CONFLICT = "ACCESS_RULE_PERMISSION_CONFLICT",
|
|
70
77
|
ALARM_NOT_FOUND = "ALARM_NOT_FOUND",
|
|
@@ -78,6 +85,7 @@ export declare enum AppErrorCode {
|
|
|
78
85
|
TOKEN_NOT_SUPPORTED = "TOKEN_NOT_SUPPORTED",
|
|
79
86
|
TOKEN_INVALID_FORMAT = "TOKEN_INVALID_FORMAT",
|
|
80
87
|
TOKEN_LIMIT_EXCEEDED = "TOKEN_LIMIT_EXCEEDED",
|
|
88
|
+
TOKEN_IN_USE = "TOKEN_IN_USE",
|
|
81
89
|
DEVICE_NOT_FOUND = "DEVICE_NOT_FOUND",
|
|
82
90
|
DEVICE_ALREADY_EXISTS = "DEVICE_ALREADY_EXISTS",
|
|
83
91
|
DEVICE_INVALID_ID = "DEVICE_INVALID_ID",
|
|
@@ -150,16 +158,20 @@ export declare const errorMetadataSchemas: {
|
|
|
150
158
|
subject: z.ZodString;
|
|
151
159
|
blockingSubject: z.ZodOptional<z.ZodString>;
|
|
152
160
|
blockingId: z.ZodOptional<z.ZodString>;
|
|
161
|
+
value: z.ZodOptional<z.ZodString>;
|
|
153
162
|
}, "strip", z.ZodTypeAny, {
|
|
154
163
|
subject: string;
|
|
164
|
+
value?: string | undefined;
|
|
155
165
|
blockingSubject?: string | undefined;
|
|
156
166
|
blockingId?: string | undefined;
|
|
157
167
|
}, {
|
|
158
168
|
subject: string;
|
|
169
|
+
value?: string | undefined;
|
|
159
170
|
blockingSubject?: string | undefined;
|
|
160
171
|
blockingId?: string | undefined;
|
|
161
172
|
}>;
|
|
162
173
|
readonly RESOURCE_NOT_SUPPORTED: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
174
|
+
readonly RESOURCE_FORBIDDEN: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
163
175
|
readonly BAD_REFERENCE: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
164
176
|
readonly ACCESS_RULE_NOT_FOUND: z.ZodObject<{
|
|
165
177
|
subject: z.ZodString;
|
|
@@ -270,6 +282,22 @@ export declare const errorMetadataSchemas: {
|
|
|
270
282
|
fieldErrors: Record<string, string>;
|
|
271
283
|
}>;
|
|
272
284
|
readonly TOKEN_LIMIT_EXCEEDED: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
285
|
+
readonly TOKEN_IN_USE: z.ZodObject<{
|
|
286
|
+
subject: z.ZodString;
|
|
287
|
+
blockingSubject: z.ZodOptional<z.ZodString>;
|
|
288
|
+
blockingId: z.ZodOptional<z.ZodString>;
|
|
289
|
+
value: z.ZodOptional<z.ZodString>;
|
|
290
|
+
}, "strip", z.ZodTypeAny, {
|
|
291
|
+
subject: string;
|
|
292
|
+
value?: string | undefined;
|
|
293
|
+
blockingSubject?: string | undefined;
|
|
294
|
+
blockingId?: string | undefined;
|
|
295
|
+
}, {
|
|
296
|
+
subject: string;
|
|
297
|
+
value?: string | undefined;
|
|
298
|
+
blockingSubject?: string | undefined;
|
|
299
|
+
blockingId?: string | undefined;
|
|
300
|
+
}>;
|
|
273
301
|
readonly DEVICE_NOT_FOUND: z.ZodObject<{
|
|
274
302
|
subject: z.ZodString;
|
|
275
303
|
field: z.ZodString;
|
|
@@ -428,12 +456,15 @@ export declare const errorMetadataSchemas: {
|
|
|
428
456
|
subject: z.ZodString;
|
|
429
457
|
blockingSubject: z.ZodOptional<z.ZodString>;
|
|
430
458
|
blockingId: z.ZodOptional<z.ZodString>;
|
|
459
|
+
value: z.ZodOptional<z.ZodString>;
|
|
431
460
|
}, "strip", z.ZodTypeAny, {
|
|
432
461
|
subject: string;
|
|
462
|
+
value?: string | undefined;
|
|
433
463
|
blockingSubject?: string | undefined;
|
|
434
464
|
blockingId?: string | undefined;
|
|
435
465
|
}, {
|
|
436
466
|
subject: string;
|
|
467
|
+
value?: string | undefined;
|
|
437
468
|
blockingSubject?: string | undefined;
|
|
438
469
|
blockingId?: string | undefined;
|
|
439
470
|
}>;
|
|
@@ -470,12 +501,15 @@ export declare const errorMetadataSchemas: {
|
|
|
470
501
|
subject: z.ZodString;
|
|
471
502
|
blockingSubject: z.ZodOptional<z.ZodString>;
|
|
472
503
|
blockingId: z.ZodOptional<z.ZodString>;
|
|
504
|
+
value: z.ZodOptional<z.ZodString>;
|
|
473
505
|
}, "strip", z.ZodTypeAny, {
|
|
474
506
|
subject: string;
|
|
507
|
+
value?: string | undefined;
|
|
475
508
|
blockingSubject?: string | undefined;
|
|
476
509
|
blockingId?: string | undefined;
|
|
477
510
|
}, {
|
|
478
511
|
subject: string;
|
|
512
|
+
value?: string | undefined;
|
|
479
513
|
blockingSubject?: string | undefined;
|
|
480
514
|
blockingId?: string | undefined;
|
|
481
515
|
}>;
|
|
@@ -583,6 +617,9 @@ export declare const errorMetadataSchemas: {
|
|
|
583
617
|
fieldErrors: Record<string, string>;
|
|
584
618
|
}>;
|
|
585
619
|
readonly UNKNOWN: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
620
|
+
readonly SERVER_INTERNAL_ERROR: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
621
|
+
readonly UNAUTHORIZED: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
622
|
+
readonly BAD_REQUEST: z.ZodObject<{}, "strict", z.ZodTypeAny, {}, {}>;
|
|
586
623
|
};
|
|
587
624
|
type AppErrorMetadataSchemaMap = typeof errorMetadataSchemas;
|
|
588
625
|
export type AppErrorMetadataMap = {
|
package/dist/error.js
CHANGED
|
@@ -23,6 +23,7 @@ exports.sConflictMeta = zod_1.z.object({
|
|
|
23
23
|
subject: zod_1.z.string(),
|
|
24
24
|
blockingSubject: zod_1.z.string().optional(),
|
|
25
25
|
blockingId: zod_1.z.string().optional(),
|
|
26
|
+
value: zod_1.z.string().optional(),
|
|
26
27
|
});
|
|
27
28
|
exports.sVoidMeta = zod_1.z.object({}).strict();
|
|
28
29
|
// ERROR CODES
|
|
@@ -31,11 +32,15 @@ var AppErrorCode;
|
|
|
31
32
|
// generic
|
|
32
33
|
AppErrorCode["RESOURCE_ALREADY_EXISTS"] = "RESOURCE_ALREADY_EXISTS";
|
|
33
34
|
AppErrorCode["RESOURCE_NOT_FOUND"] = "RESOURCE_NOT_FOUND";
|
|
35
|
+
AppErrorCode["RESOURCE_FORBIDDEN"] = "RESOURCE_FORBIDDEN";
|
|
34
36
|
AppErrorCode["RESOURCE_INVALID"] = "RESOURCE_INVALID";
|
|
35
37
|
AppErrorCode["RESOURCE_IN_USE"] = "RESOURCE_IN_USE";
|
|
36
38
|
AppErrorCode["RESOURCE_NOT_SUPPORTED"] = "RESOURCE_NOT_SUPPORTED";
|
|
37
39
|
AppErrorCode["BAD_REFERENCE"] = "BAD_REFERENCE";
|
|
38
40
|
AppErrorCode["UNKNOWN"] = "UNKNOWN";
|
|
41
|
+
AppErrorCode["SERVER_INTERNAL_ERROR"] = "SERVER_INTERNAL_ERROR";
|
|
42
|
+
AppErrorCode["UNAUTHORIZED"] = "UNAUTHORIZED";
|
|
43
|
+
AppErrorCode["BAD_REQUEST"] = "BAD_REQUEST";
|
|
39
44
|
// access
|
|
40
45
|
AppErrorCode["ACCESS_RULE_NOT_FOUND"] = "ACCESS_RULE_NOT_FOUND";
|
|
41
46
|
AppErrorCode["ACCESS_RULE_PERMISSION_CONFLICT"] = "ACCESS_RULE_PERMISSION_CONFLICT";
|
|
@@ -53,6 +58,7 @@ var AppErrorCode;
|
|
|
53
58
|
AppErrorCode["TOKEN_NOT_SUPPORTED"] = "TOKEN_NOT_SUPPORTED";
|
|
54
59
|
AppErrorCode["TOKEN_INVALID_FORMAT"] = "TOKEN_INVALID_FORMAT";
|
|
55
60
|
AppErrorCode["TOKEN_LIMIT_EXCEEDED"] = "TOKEN_LIMIT_EXCEEDED";
|
|
61
|
+
AppErrorCode["TOKEN_IN_USE"] = "TOKEN_IN_USE";
|
|
56
62
|
// device
|
|
57
63
|
AppErrorCode["DEVICE_NOT_FOUND"] = "DEVICE_NOT_FOUND";
|
|
58
64
|
AppErrorCode["DEVICE_ALREADY_EXISTS"] = "DEVICE_ALREADY_EXISTS";
|
|
@@ -93,6 +99,7 @@ exports.errorMetadataSchemas = {
|
|
|
93
99
|
[AppErrorCode.RESOURCE_INVALID]: exports.sInvalidMeta,
|
|
94
100
|
[AppErrorCode.RESOURCE_IN_USE]: exports.sConflictMeta,
|
|
95
101
|
[AppErrorCode.RESOURCE_NOT_SUPPORTED]: exports.sVoidMeta,
|
|
102
|
+
[AppErrorCode.RESOURCE_FORBIDDEN]: exports.sVoidMeta,
|
|
96
103
|
[AppErrorCode.BAD_REFERENCE]: exports.sVoidMeta,
|
|
97
104
|
// access
|
|
98
105
|
[AppErrorCode.ACCESS_RULE_NOT_FOUND]: exports.sNotFoundMeta,
|
|
@@ -111,6 +118,7 @@ exports.errorMetadataSchemas = {
|
|
|
111
118
|
[AppErrorCode.TOKEN_NOT_SUPPORTED]: exports.sVoidMeta,
|
|
112
119
|
[AppErrorCode.TOKEN_INVALID_FORMAT]: exports.sInvalidMeta,
|
|
113
120
|
[AppErrorCode.TOKEN_LIMIT_EXCEEDED]: exports.sVoidMeta,
|
|
121
|
+
[AppErrorCode.TOKEN_IN_USE]: exports.sConflictMeta,
|
|
114
122
|
// device
|
|
115
123
|
[AppErrorCode.DEVICE_NOT_FOUND]: exports.sNotFoundMeta,
|
|
116
124
|
[AppErrorCode.DEVICE_ALREADY_EXISTS]: exports.sDuplicateMeta,
|
|
@@ -145,6 +153,9 @@ exports.errorMetadataSchemas = {
|
|
|
145
153
|
// config
|
|
146
154
|
[AppErrorCode.CONFIG_INVALID]: exports.sInvalidMeta,
|
|
147
155
|
[AppErrorCode.UNKNOWN]: exports.sVoidMeta,
|
|
156
|
+
[AppErrorCode.SERVER_INTERNAL_ERROR]: exports.sVoidMeta,
|
|
157
|
+
[AppErrorCode.UNAUTHORIZED]: exports.sVoidMeta,
|
|
158
|
+
[AppErrorCode.BAD_REQUEST]: exports.sVoidMeta,
|
|
148
159
|
};
|
|
149
160
|
function isErrorResponse(err) {
|
|
150
161
|
return (!!err &&
|
package/dist/package.json
CHANGED