@m1cro/server-sdk 0.1.0 → 0.1.1-beta.10
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/globals.d.ts +1 -3
- package/dist/globals.js +0 -2
- package/dist/index.d.ts +389 -121
- package/dist/index.js +1 -2
- package/package.json +3 -6
- package/dist/globals.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/globals.d.ts
CHANGED
|
@@ -4,10 +4,8 @@ declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "n
|
|
|
4
4
|
type LogLevel = (typeof logLevels)[number];
|
|
5
5
|
|
|
6
6
|
declare global {
|
|
7
|
+
var Bridge: Bridge;
|
|
7
8
|
interface Console extends console.Console {
|
|
8
9
|
logLevel: LogLevel;
|
|
9
10
|
}
|
|
10
|
-
interface Request {
|
|
11
|
-
artifacts?: any;
|
|
12
|
-
}
|
|
13
11
|
}
|
package/dist/globals.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,41 +1,34 @@
|
|
|
1
1
|
import { JSONSchema4 } from 'json-schema';
|
|
2
|
+
import { SetCookie } from 'cookie';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
deriveKey(seed: string, length: number): Uint8Array;
|
|
5
|
-
aesGcmEncrypt<T>(data: T): Uint8Array;
|
|
6
|
-
aesGcmDecrypt<T>(data: Uint8Array): T;
|
|
7
|
-
argon2Hash(algorithm: Argon2Algorithm, password: string, options?: Argon2Options): string;
|
|
8
|
-
argon2Verify(algorithm: Argon2Algorithm, password: string, hash: string, options?: Argon2Options): boolean;
|
|
9
|
-
}
|
|
10
|
-
type Argon2Algorithm = 'argon2d' | 'argon2i' | 'argon2id';
|
|
11
|
-
interface Argon2Options {
|
|
12
|
-
mCost?: number;
|
|
13
|
-
tCost?: number;
|
|
14
|
-
pCost?: number;
|
|
15
|
-
outputLen?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type Record<K extends string | number | symbol = string, V = any> = {
|
|
4
|
+
type Record$1<K extends string | number | symbol = string, V = any> = {
|
|
19
5
|
[key in K]: V;
|
|
20
6
|
};
|
|
21
7
|
type Variant<K extends PropertyKey, T extends object> = {
|
|
22
|
-
[P in keyof T]:
|
|
8
|
+
[P in keyof T]: {
|
|
23
9
|
[Q in K]: P;
|
|
24
|
-
} & T[P]
|
|
10
|
+
} & T[P] extends infer U ? {
|
|
25
11
|
[Q in keyof U]: U[Q];
|
|
26
12
|
} : never;
|
|
27
13
|
}[keyof T];
|
|
28
|
-
type EventHandler = <T>(
|
|
14
|
+
type EventHandler = <T>(event: string, data: T) => void | Promise<void>;
|
|
29
15
|
type Visibility = 'private' | 'platform' | 'vendor' | 'public';
|
|
30
16
|
interface Tenant {
|
|
31
17
|
id: string;
|
|
32
18
|
host: string;
|
|
33
19
|
}
|
|
34
20
|
interface AppId {
|
|
35
|
-
|
|
36
|
-
|
|
21
|
+
get name(): string;
|
|
22
|
+
get namespace(): Namespace;
|
|
23
|
+
toString(separator?: string): string;
|
|
37
24
|
}
|
|
38
|
-
|
|
25
|
+
declare const AppId: {
|
|
26
|
+
parse(input: string): AppId;
|
|
27
|
+
};
|
|
28
|
+
type Namespace = 'system' | 'platform' | {
|
|
29
|
+
vendor: string;
|
|
30
|
+
};
|
|
31
|
+
type AppRole = Variant<'type', AppRoleData>;
|
|
39
32
|
type AppRoleData = {
|
|
40
33
|
provider: {
|
|
41
34
|
group: string;
|
|
@@ -55,42 +48,38 @@ interface Permissions {
|
|
|
55
48
|
[key: string]: string[];
|
|
56
49
|
}
|
|
57
50
|
interface HookEventMap {
|
|
58
|
-
|
|
59
|
-
|
|
51
|
+
start: [];
|
|
52
|
+
install: [];
|
|
60
53
|
}
|
|
61
54
|
|
|
62
|
-
interface FindQuery<T extends Record = Record> {
|
|
55
|
+
interface FindQuery<T extends Record$1 = Record$1> extends PromiseLike<T[]> {
|
|
63
56
|
limit(limit: number): this;
|
|
64
57
|
offset(offset: number): this;
|
|
65
58
|
sort(sort: Sorting): this;
|
|
66
|
-
exec(): Promise<T[]>;
|
|
67
59
|
}
|
|
68
|
-
interface FindOneQuery<T extends Record = Record> {
|
|
60
|
+
interface FindOneQuery<T extends Record$1 = Record$1> extends PromiseLike<T | undefined> {
|
|
69
61
|
offset(offset: number): this;
|
|
70
62
|
sort(sort: Sorting): this;
|
|
71
|
-
exec(): Promise<T | undefined>;
|
|
72
63
|
}
|
|
73
64
|
|
|
74
65
|
type InsertReturnMode = 'insertedIds' | 'documents';
|
|
75
|
-
type InsertReturnType<T extends Record, R extends InsertReturnMode> = R extends 'insertedIds' ? string[] : R extends 'documents' ? T[] : never;
|
|
76
|
-
interface InsertQuery<T extends Record = Record, R extends InsertReturnMode = 'insertedIds'> {
|
|
66
|
+
type InsertReturnType<T extends Record$1, R extends InsertReturnMode> = R extends 'insertedIds' ? string[] : R extends 'documents' ? T[] : never;
|
|
67
|
+
interface InsertQuery<T extends Record$1 = Record$1, R extends InsertReturnMode = 'insertedIds'> extends PromiseLike<InsertReturnType<T, R>> {
|
|
77
68
|
return(mode: 'insertedIds'): InsertQuery<T, 'insertedIds'>;
|
|
78
69
|
return(mode: 'documents'): InsertQuery<T, 'documents'>;
|
|
79
70
|
return(mode: InsertReturnMode): InsertQuery<T, typeof mode>;
|
|
80
|
-
exec(): Promise<InsertReturnType<T, R>>;
|
|
81
71
|
}
|
|
82
72
|
type InsertOneReturnMode = 'insertedId' | 'document';
|
|
83
|
-
type InsertOneReturnType<T extends Record, R extends InsertOneReturnMode> = R extends 'insertedId' ? string : R extends 'document' ? T : never;
|
|
84
|
-
interface InsertOneQuery<T extends Record = Record, R extends InsertOneReturnMode = 'insertedId'> {
|
|
73
|
+
type InsertOneReturnType<T extends Record$1, R extends InsertOneReturnMode> = R extends 'insertedId' ? string : R extends 'document' ? T : never;
|
|
74
|
+
interface InsertOneQuery<T extends Record$1 = Record$1, R extends InsertOneReturnMode = 'insertedId'> extends PromiseLike<InsertOneReturnType<T, R>> {
|
|
85
75
|
return(mode: 'insertedId'): InsertOneQuery<T, 'insertedId'>;
|
|
86
76
|
return(mode: 'document'): InsertOneQuery<T, 'document'>;
|
|
87
77
|
return(mode: InsertOneReturnMode): InsertOneQuery<T, typeof mode>;
|
|
88
|
-
exec(): Promise<InsertOneReturnType<T, R>>;
|
|
89
78
|
}
|
|
90
79
|
|
|
91
80
|
type UpdateReturnMode = 'affectedRows' | 'oldDocuments' | 'newDocuments';
|
|
92
81
|
type UpdateReturnType<T, R extends UpdateReturnMode> = R extends 'affectedRows' ? bigint : R extends 'oldDocuments' | 'newDocuments' ? T[] : never;
|
|
93
|
-
interface UpdateQuery<T extends Record = Record, R extends UpdateReturnMode = 'affectedRows'> {
|
|
82
|
+
interface UpdateQuery<T extends Record$1 = Record$1, R extends UpdateReturnMode = 'affectedRows'> extends PromiseLike<UpdateReturnType<T, R>> {
|
|
94
83
|
limit(limit: number): this;
|
|
95
84
|
offset(offset: number): this;
|
|
96
85
|
sort(sort: Sorting): this;
|
|
@@ -98,85 +87,132 @@ interface UpdateQuery<T extends Record = Record, R extends UpdateReturnMode = 'a
|
|
|
98
87
|
return(mode: 'oldDocuments'): UpdateQuery<T, 'oldDocuments'>;
|
|
99
88
|
return(mode: 'newDocuments'): UpdateQuery<T, 'newDocuments'>;
|
|
100
89
|
return(mode: UpdateReturnMode): UpdateQuery<T, typeof mode>;
|
|
101
|
-
exec(): Promise<UpdateReturnType<T, R>>;
|
|
102
90
|
}
|
|
103
91
|
type UpdateOneReturnMode = 'success' | 'oldDocument' | 'newDocument';
|
|
104
|
-
type UpdateOneReturnType<T, R extends UpdateOneReturnMode> = R extends 'success' ? boolean : R extends 'oldDocument' | 'newDocument' ?
|
|
105
|
-
interface UpdateOneQuery<T extends Record = Record, R extends UpdateOneReturnMode = 'success'> {
|
|
92
|
+
type UpdateOneReturnType<T, R extends UpdateOneReturnMode> = R extends 'success' ? boolean : R extends 'oldDocument' | 'newDocument' ? T | undefined : never;
|
|
93
|
+
interface UpdateOneQuery<T extends Record$1 = Record$1, R extends UpdateOneReturnMode = 'success'> extends PromiseLike<UpdateOneReturnType<T, R>> {
|
|
106
94
|
offset(offset: number): this;
|
|
107
95
|
sort(sort: Sorting): this;
|
|
96
|
+
upsert(upsert: boolean): this;
|
|
108
97
|
return(mode: 'success'): UpdateOneQuery<T, 'success'>;
|
|
109
98
|
return(mode: 'oldDocument'): UpdateOneQuery<T, 'oldDocument'>;
|
|
110
99
|
return(mode: 'newDocument'): UpdateOneQuery<T, 'newDocument'>;
|
|
111
100
|
return(mode: UpdateOneReturnMode): UpdateOneQuery<T, typeof mode>;
|
|
112
|
-
exec(): Promise<UpdateOneReturnType<T, R>>;
|
|
113
101
|
}
|
|
114
102
|
|
|
115
103
|
type RemoveReturnMode = 'affectedRows' | 'documents';
|
|
116
104
|
type RemoveReturnType<T, R extends RemoveReturnMode> = R extends 'affectedRows' ? bigint : R extends 'documents' ? T[] : never;
|
|
117
|
-
interface RemoveQuery<T extends Record = Record, R extends RemoveReturnMode = 'affectedRows'> {
|
|
105
|
+
interface RemoveQuery<T extends Record$1 = Record$1, R extends RemoveReturnMode = 'affectedRows'> extends PromiseLike<RemoveReturnType<T, R>> {
|
|
118
106
|
limit(limit: number): this;
|
|
119
107
|
offset(offset: number): this;
|
|
120
108
|
sort(sort: Sorting): this;
|
|
121
109
|
return(mode: 'affectedRows'): RemoveQuery<T, 'affectedRows'>;
|
|
122
110
|
return(mode: 'documents'): RemoveQuery<T, 'documents'>;
|
|
123
111
|
return(mode: RemoveReturnMode): RemoveQuery<T, typeof mode>;
|
|
124
|
-
exec(): Promise<RemoveReturnType<T, R>>;
|
|
125
112
|
}
|
|
126
113
|
type RemoveOneReturnMode = 'success' | 'document';
|
|
127
|
-
type RemoveOneReturnType<T, R extends RemoveOneReturnMode> = R extends 'success' ? boolean : R extends 'document' ?
|
|
128
|
-
interface RemoveOneQuery<T extends Record = Record, R extends RemoveOneReturnMode = 'success'> {
|
|
114
|
+
type RemoveOneReturnType<T, R extends RemoveOneReturnMode> = R extends 'success' ? boolean : R extends 'document' ? T | undefined : never;
|
|
115
|
+
interface RemoveOneQuery<T extends Record$1 = Record$1, R extends RemoveOneReturnMode = 'success'> extends PromiseLike<RemoveOneReturnType<T, R>> {
|
|
129
116
|
offset(offset: number): this;
|
|
130
117
|
sort(sort: Sorting): this;
|
|
131
118
|
return(mode: 'success'): RemoveOneQuery<T, 'success'>;
|
|
132
119
|
return(mode: 'document'): RemoveOneQuery<T, 'document'>;
|
|
133
120
|
return(mode: RemoveOneReturnMode): RemoveOneQuery<T, typeof mode>;
|
|
134
|
-
exec(): Promise<RemoveOneReturnType<T, R>>;
|
|
135
121
|
}
|
|
136
122
|
|
|
137
|
-
interface Entity<T extends object = Record<string, unknown>> {
|
|
123
|
+
interface Entity<T extends object = Record$1<string, unknown>> {
|
|
138
124
|
get name(): string;
|
|
139
|
-
find(query
|
|
140
|
-
findOne(query
|
|
125
|
+
find(query?: Record$1): FindQuery<T>;
|
|
126
|
+
findOne(query?: Record$1): FindOneQuery<T>;
|
|
141
127
|
insert(docs: T[]): InsertQuery<T>;
|
|
142
128
|
insertOne(doc: T): InsertOneQuery<T>;
|
|
143
|
-
update(query: Record, update: Record): UpdateQuery<T>;
|
|
144
|
-
updateOne(query: Record, update: Record): UpdateOneQuery<T>;
|
|
145
|
-
remove(query: Record): RemoveQuery<T>;
|
|
146
|
-
removeOne(query: Record): RemoveOneQuery<T>;
|
|
129
|
+
update(query: Record$1, update: Record$1): UpdateQuery<T>;
|
|
130
|
+
updateOne(query: Record$1, update: Record$1): UpdateOneQuery<T>;
|
|
131
|
+
remove(query: Record$1): RemoveQuery<T>;
|
|
132
|
+
removeOne(query: Record$1): RemoveOneQuery<T>;
|
|
147
133
|
}
|
|
148
134
|
interface Sorting {
|
|
149
135
|
[field: string]: 'asc' | 'desc';
|
|
150
136
|
}
|
|
151
137
|
|
|
152
|
-
interface SetOptions {
|
|
153
|
-
ttl?: number;
|
|
154
|
-
existenceCheck?: "nx" | "xx";
|
|
155
|
-
}
|
|
156
|
-
interface KeyValueStore {
|
|
157
|
-
get<T>(key: string): Promise<T>;
|
|
158
|
-
getDel<T>(key: string): Promise<T>;
|
|
159
|
-
set<T>(key: string, value: T, options?: SetOptions): Promise<void>;
|
|
160
|
-
delete(key: string): Promise<void>;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
interface Providers {
|
|
164
|
-
list(group: string): Provider[];
|
|
165
|
-
}
|
|
166
|
-
interface Provider {
|
|
167
|
-
group: string;
|
|
168
|
-
app: AppId;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
138
|
interface Artifacts {
|
|
172
139
|
get<T>(key: string): T | undefined;
|
|
173
140
|
set<T>(key: string, value: T): void;
|
|
174
141
|
delete(key: string): void;
|
|
142
|
+
get auth(): Auth | undefined;
|
|
175
143
|
}
|
|
176
144
|
|
|
145
|
+
type Method = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
146
|
+
declare enum StatusCode {
|
|
147
|
+
Continue = 100,
|
|
148
|
+
SwitchingProtocols = 101,
|
|
149
|
+
Processing = 102,
|
|
150
|
+
EarlyHints = 103,
|
|
151
|
+
OK = 200,
|
|
152
|
+
Created = 201,
|
|
153
|
+
Accepted = 202,
|
|
154
|
+
NonAuthoritativeInformation = 203,
|
|
155
|
+
NoContent = 204,
|
|
156
|
+
ResetContent = 205,
|
|
157
|
+
PartialContent = 206,
|
|
158
|
+
MultiStatus = 207,
|
|
159
|
+
AlreadyReported = 208,
|
|
160
|
+
IMUsed = 226,
|
|
161
|
+
MultipleChoices = 300,
|
|
162
|
+
MovedPermanently = 301,
|
|
163
|
+
Found = 302,
|
|
164
|
+
SeeOther = 303,
|
|
165
|
+
NotModified = 304,
|
|
166
|
+
UseProxy = 305,
|
|
167
|
+
TemporaryRedirect = 307,
|
|
168
|
+
PermanentRedirect = 308,
|
|
169
|
+
BadRequest = 400,
|
|
170
|
+
Unauthorized = 401,
|
|
171
|
+
PaymentRequired = 402,
|
|
172
|
+
Forbidden = 403,
|
|
173
|
+
NotFound = 404,
|
|
174
|
+
MethodNotAllowed = 405,
|
|
175
|
+
NotAcceptable = 406,
|
|
176
|
+
ProxyAuthenticationRequired = 407,
|
|
177
|
+
RequestTimeout = 408,
|
|
178
|
+
Conflict = 409,
|
|
179
|
+
Gone = 410,
|
|
180
|
+
LengthRequired = 411,
|
|
181
|
+
PreconditionFailed = 412,
|
|
182
|
+
ContentTooLarge = 413,
|
|
183
|
+
URITooLong = 414,
|
|
184
|
+
UnsupportedMediaType = 415,
|
|
185
|
+
RangeNotSatisfiable = 416,
|
|
186
|
+
ExpectationFailed = 417,
|
|
187
|
+
ImATeapot = 418,
|
|
188
|
+
MisdirectedRequest = 421,
|
|
189
|
+
UnprocessableEntity = 422,
|
|
190
|
+
Locked = 423,
|
|
191
|
+
FailedDependency = 424,
|
|
192
|
+
TooEarly = 425,
|
|
193
|
+
UpgradeRequired = 426,
|
|
194
|
+
PreconditionRequired = 428,
|
|
195
|
+
TooManyRequests = 429,
|
|
196
|
+
RequestHeaderFieldsTooLarge = 431,
|
|
197
|
+
UnavailableForLegalReasons = 451,
|
|
198
|
+
InternalServerError = 500,
|
|
199
|
+
NotImplemented = 501,
|
|
200
|
+
BadGateway = 502,
|
|
201
|
+
ServiceUnavailable = 503,
|
|
202
|
+
GatewayTimeout = 504,
|
|
203
|
+
HTTPVersionNotSupported = 505,
|
|
204
|
+
VariantAlsoNegotiates = 506,
|
|
205
|
+
InsufficientStorage = 507,
|
|
206
|
+
LoopDetected = 508,
|
|
207
|
+
NotExtended = 510,
|
|
208
|
+
NetworkAuthenticationRequired = 511
|
|
209
|
+
}
|
|
210
|
+
type RequestHandler = (req: Request, res: ResponseBuilder) => void | Promise<void>;
|
|
211
|
+
type Middleware = (req: Request, res: ResponseBuilder, next: () => Promise<void>) => void | Promise<void>;
|
|
177
212
|
interface Router {
|
|
178
213
|
scope(path: string): Router;
|
|
179
214
|
route(method: Method, path: string, handler: RequestHandler, options?: RouteOptions): Router;
|
|
215
|
+
middleware(handler: Middleware, options?: MiddlewareOptions): Router;
|
|
180
216
|
get(path: string, handler: RequestHandler, options?: RouteOptions): Router;
|
|
181
217
|
post(path: string, handler: RequestHandler, options?: RouteOptions): Router;
|
|
182
218
|
put(path: string, handler: RequestHandler, options?: RouteOptions): Router;
|
|
@@ -189,67 +225,93 @@ interface RouteOptions {
|
|
|
189
225
|
authenticated?: boolean;
|
|
190
226
|
visibility?: Visibility;
|
|
191
227
|
}
|
|
192
|
-
|
|
193
|
-
|
|
228
|
+
interface MiddlewareOptions {
|
|
229
|
+
path?: string;
|
|
230
|
+
priority?: number;
|
|
231
|
+
}
|
|
194
232
|
interface Request {
|
|
195
233
|
get artifacts(): Artifacts;
|
|
196
234
|
get method(): Method;
|
|
197
|
-
withMethod(method: Method): Request;
|
|
198
235
|
get url(): URL;
|
|
199
|
-
|
|
200
|
-
header(name: string): string | undefined;
|
|
201
|
-
withHeader(name: string, value: string): Request;
|
|
236
|
+
get params(): Record<string, string>;
|
|
202
237
|
get headers(): Headers;
|
|
203
|
-
|
|
238
|
+
cookie(name: string): string | undefined;
|
|
204
239
|
body(): Promise<Uint8Array>;
|
|
205
|
-
withBody(bytes: Uint8Array): Request;
|
|
206
240
|
text(): Promise<string>;
|
|
207
|
-
withText(text: string): Request;
|
|
208
241
|
json<T>(): Promise<T>;
|
|
209
|
-
|
|
242
|
+
}
|
|
243
|
+
interface RequestBuilder {
|
|
244
|
+
method(method: Method): this;
|
|
245
|
+
url(url: string | URL): this;
|
|
246
|
+
header(name: string, value: string): this;
|
|
247
|
+
headers(headers: HeadersInit): this;
|
|
248
|
+
cookie(name: string, value: string): this;
|
|
249
|
+
body(bytes: Uint8Array): this;
|
|
250
|
+
text(text: string): this;
|
|
251
|
+
json<T>(json: T): this;
|
|
210
252
|
}
|
|
211
253
|
interface Response {
|
|
212
254
|
get status(): number;
|
|
213
|
-
withStatus(status: number): Response;
|
|
214
|
-
header(name: string): string | undefined;
|
|
215
|
-
withHeader(name: string, value: string): Response;
|
|
216
255
|
get headers(): Headers;
|
|
217
|
-
|
|
256
|
+
cookie(name: string): SetCookie | undefined;
|
|
218
257
|
body(): Promise<Uint8Array>;
|
|
219
|
-
withBody(bytes: Uint8Array): Response;
|
|
220
258
|
text(): Promise<string>;
|
|
221
|
-
withText(text: string): Response;
|
|
222
259
|
json<T>(): Promise<T>;
|
|
223
|
-
withJson<T>(json: T): Response;
|
|
224
260
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
261
|
+
interface ResponseBuilder {
|
|
262
|
+
status(status: number): this;
|
|
263
|
+
header(name: string, value: string): this;
|
|
264
|
+
headers(headers: HeadersInit): this;
|
|
265
|
+
cookie(name: string, value?: string, options?: SetCookieOptions): this;
|
|
266
|
+
body(bytes: Uint8Array): this;
|
|
267
|
+
text(text: string): this;
|
|
268
|
+
json<T>(json: T): this;
|
|
269
|
+
}
|
|
270
|
+
interface SetCookieOptions {
|
|
271
|
+
encode?: (s: string) => string;
|
|
272
|
+
maxAge?: number;
|
|
273
|
+
expires?: Date;
|
|
274
|
+
domain?: string;
|
|
275
|
+
path?: string;
|
|
276
|
+
httpOnly?: boolean;
|
|
277
|
+
secure?: boolean;
|
|
278
|
+
partitioned?: boolean;
|
|
279
|
+
priority?: 'low' | 'medium' | 'high';
|
|
280
|
+
sameSite?: boolean | 'lax' | 'strict' | 'none';
|
|
233
281
|
}
|
|
234
|
-
|
|
235
|
-
|
|
282
|
+
|
|
283
|
+
interface Call extends RequestBuilder, PromiseLike<Response> {
|
|
236
284
|
}
|
|
237
285
|
|
|
238
|
-
interface
|
|
239
|
-
|
|
286
|
+
interface Providers {
|
|
287
|
+
list(group: string): Provider[];
|
|
240
288
|
}
|
|
289
|
+
interface Provider {
|
|
290
|
+
get app(): AppId;
|
|
291
|
+
get group(): string;
|
|
292
|
+
get id(): string;
|
|
293
|
+
call(path: string, method: Method): Call;
|
|
294
|
+
get(path: string): Call;
|
|
295
|
+
post(path: string): Call;
|
|
296
|
+
put(path: string): Call;
|
|
297
|
+
patch(path: string): Call;
|
|
298
|
+
delete(path: string): Call;
|
|
299
|
+
}
|
|
300
|
+
declare const Provider: {
|
|
301
|
+
fromId(id: string): Provider;
|
|
302
|
+
};
|
|
241
303
|
|
|
304
|
+
type EntryPoint = (app: App) => unknown;
|
|
242
305
|
interface App {
|
|
243
|
-
get
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
publish<T extends object>(event: string, payload: T, visibility?: Visibility[]): void;
|
|
306
|
+
get router(): Router;
|
|
307
|
+
on<K extends keyof HookEventMap>(type: K, listener: (...args: HookEventMap[K]) => unknown): App;
|
|
308
|
+
role(role: AppRole): App;
|
|
309
|
+
capability(app: string, permissions: string[]): App;
|
|
310
|
+
capabilities(capabilities: {
|
|
311
|
+
[app: string]: string[];
|
|
312
|
+
}): App;
|
|
313
|
+
entity(name: string, schema: JSONSchema4): App;
|
|
314
|
+
subscribe(pattern: string, handler: EventHandler): App;
|
|
253
315
|
}
|
|
254
316
|
|
|
255
317
|
declare const _default: {
|
|
@@ -257,17 +319,223 @@ declare const _default: {
|
|
|
257
319
|
decode<T>(data: Uint8Array): T;
|
|
258
320
|
};
|
|
259
321
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
322
|
+
interface ErrorPayload {
|
|
323
|
+
status: number;
|
|
324
|
+
code: string;
|
|
325
|
+
msg?: string | undefined;
|
|
326
|
+
}
|
|
327
|
+
declare class Base extends Error {
|
|
328
|
+
protected payload: ErrorPayload;
|
|
329
|
+
constructor(payload: ErrorPayload);
|
|
330
|
+
status(status: number): this;
|
|
331
|
+
code(code: string): this;
|
|
332
|
+
msg(msg: string): this;
|
|
333
|
+
}
|
|
334
|
+
declare class BadRequest extends Base {
|
|
335
|
+
constructor(msg?: string);
|
|
336
|
+
}
|
|
337
|
+
declare class Unauthorized extends Base {
|
|
338
|
+
constructor(msg?: string);
|
|
339
|
+
}
|
|
340
|
+
declare class PaymentRequired extends Base {
|
|
341
|
+
constructor(msg?: string);
|
|
342
|
+
}
|
|
343
|
+
declare class Forbidden extends Base {
|
|
344
|
+
constructor(msg?: string);
|
|
345
|
+
}
|
|
346
|
+
declare class NotFound extends Base {
|
|
347
|
+
constructor(msg?: string);
|
|
348
|
+
}
|
|
349
|
+
declare class MethodNotAllowed extends Base {
|
|
350
|
+
constructor(msg?: string);
|
|
351
|
+
}
|
|
352
|
+
declare class NotAcceptable extends Base {
|
|
353
|
+
constructor(msg?: string);
|
|
354
|
+
}
|
|
355
|
+
declare class ProxyAuthenticationRequired extends Base {
|
|
356
|
+
constructor(msg?: string);
|
|
357
|
+
}
|
|
358
|
+
declare class RequestTimeout extends Base {
|
|
359
|
+
constructor(msg?: string);
|
|
360
|
+
}
|
|
361
|
+
declare class Conflict extends Base {
|
|
362
|
+
constructor(msg?: string);
|
|
363
|
+
}
|
|
364
|
+
declare class Gone extends Base {
|
|
365
|
+
constructor(msg?: string);
|
|
366
|
+
}
|
|
367
|
+
declare class LengthRequired extends Base {
|
|
368
|
+
constructor(msg?: string);
|
|
369
|
+
}
|
|
370
|
+
declare class PreconditionFailed extends Base {
|
|
371
|
+
constructor(msg?: string);
|
|
372
|
+
}
|
|
373
|
+
declare class ContentTooLarge extends Base {
|
|
374
|
+
constructor(msg?: string);
|
|
375
|
+
}
|
|
376
|
+
declare class URITooLong extends Base {
|
|
377
|
+
constructor(msg?: string);
|
|
378
|
+
}
|
|
379
|
+
declare class UnsupportedMediaType extends Base {
|
|
380
|
+
constructor(msg?: string);
|
|
381
|
+
}
|
|
382
|
+
declare class RangeNotSatisfiable extends Base {
|
|
383
|
+
constructor(msg?: string);
|
|
384
|
+
}
|
|
385
|
+
declare class ExpectationFailed extends Base {
|
|
386
|
+
constructor(msg?: string);
|
|
387
|
+
}
|
|
388
|
+
declare class ImATeapot extends Base {
|
|
389
|
+
constructor(msg?: string);
|
|
390
|
+
}
|
|
391
|
+
declare class MisdirectedRequest extends Base {
|
|
392
|
+
constructor(msg?: string);
|
|
393
|
+
}
|
|
394
|
+
declare class UnprocessableEntity extends Base {
|
|
395
|
+
constructor(msg?: string);
|
|
396
|
+
}
|
|
397
|
+
declare class Locked extends Base {
|
|
398
|
+
constructor(msg?: string);
|
|
399
|
+
}
|
|
400
|
+
declare class FailedDependency extends Base {
|
|
401
|
+
constructor(msg?: string);
|
|
402
|
+
}
|
|
403
|
+
declare class TooEarly extends Base {
|
|
404
|
+
constructor(msg?: string);
|
|
405
|
+
}
|
|
406
|
+
declare class UpgradeRequired extends Base {
|
|
407
|
+
constructor(msg?: string);
|
|
408
|
+
}
|
|
409
|
+
declare class PreconditionRequired extends Base {
|
|
410
|
+
constructor(msg?: string);
|
|
411
|
+
}
|
|
412
|
+
declare class TooManyRequests extends Base {
|
|
413
|
+
constructor(msg?: string);
|
|
414
|
+
}
|
|
415
|
+
declare class RequestHeaderFieldsTooLarge extends Base {
|
|
416
|
+
constructor(msg?: string);
|
|
417
|
+
}
|
|
418
|
+
declare class UnavailableForLegalReasons extends Base {
|
|
419
|
+
constructor(msg?: string);
|
|
420
|
+
}
|
|
421
|
+
declare class InternalServerError extends Base {
|
|
422
|
+
constructor(msg?: string);
|
|
423
|
+
}
|
|
424
|
+
declare class NotImplemented extends Base {
|
|
425
|
+
constructor(msg?: string);
|
|
426
|
+
}
|
|
427
|
+
declare class BadGateway extends Base {
|
|
428
|
+
constructor(msg?: string);
|
|
429
|
+
}
|
|
430
|
+
declare class ServiceUnavailable extends Base {
|
|
431
|
+
constructor(msg?: string);
|
|
432
|
+
}
|
|
433
|
+
declare class GatewayTimeout extends Base {
|
|
434
|
+
constructor(msg?: string);
|
|
435
|
+
}
|
|
436
|
+
declare class HTTPVersionNotSupported extends Base {
|
|
437
|
+
constructor(msg?: string);
|
|
438
|
+
}
|
|
439
|
+
declare class VariantAlsoNegotiates extends Base {
|
|
440
|
+
constructor(msg?: string);
|
|
441
|
+
}
|
|
442
|
+
declare class InsufficientStorage extends Base {
|
|
443
|
+
constructor(msg?: string);
|
|
444
|
+
}
|
|
445
|
+
declare class LoopDetected extends Base {
|
|
446
|
+
constructor(msg?: string);
|
|
447
|
+
}
|
|
448
|
+
declare class NotExtended extends Base {
|
|
449
|
+
constructor(msg?: string);
|
|
450
|
+
}
|
|
451
|
+
declare class NetworkAuthenticationRequired extends Base {
|
|
452
|
+
constructor(msg?: string);
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
type error_BadGateway = BadGateway;
|
|
456
|
+
declare const error_BadGateway: typeof BadGateway;
|
|
457
|
+
type error_BadRequest = BadRequest;
|
|
458
|
+
declare const error_BadRequest: typeof BadRequest;
|
|
459
|
+
type error_Base = Base;
|
|
460
|
+
declare const error_Base: typeof Base;
|
|
461
|
+
type error_Conflict = Conflict;
|
|
462
|
+
declare const error_Conflict: typeof Conflict;
|
|
463
|
+
type error_ContentTooLarge = ContentTooLarge;
|
|
464
|
+
declare const error_ContentTooLarge: typeof ContentTooLarge;
|
|
465
|
+
type error_ExpectationFailed = ExpectationFailed;
|
|
466
|
+
declare const error_ExpectationFailed: typeof ExpectationFailed;
|
|
467
|
+
type error_FailedDependency = FailedDependency;
|
|
468
|
+
declare const error_FailedDependency: typeof FailedDependency;
|
|
469
|
+
type error_Forbidden = Forbidden;
|
|
470
|
+
declare const error_Forbidden: typeof Forbidden;
|
|
471
|
+
type error_GatewayTimeout = GatewayTimeout;
|
|
472
|
+
declare const error_GatewayTimeout: typeof GatewayTimeout;
|
|
473
|
+
type error_Gone = Gone;
|
|
474
|
+
declare const error_Gone: typeof Gone;
|
|
475
|
+
type error_HTTPVersionNotSupported = HTTPVersionNotSupported;
|
|
476
|
+
declare const error_HTTPVersionNotSupported: typeof HTTPVersionNotSupported;
|
|
477
|
+
type error_ImATeapot = ImATeapot;
|
|
478
|
+
declare const error_ImATeapot: typeof ImATeapot;
|
|
479
|
+
type error_InsufficientStorage = InsufficientStorage;
|
|
480
|
+
declare const error_InsufficientStorage: typeof InsufficientStorage;
|
|
481
|
+
type error_InternalServerError = InternalServerError;
|
|
482
|
+
declare const error_InternalServerError: typeof InternalServerError;
|
|
483
|
+
type error_LengthRequired = LengthRequired;
|
|
484
|
+
declare const error_LengthRequired: typeof LengthRequired;
|
|
485
|
+
type error_Locked = Locked;
|
|
486
|
+
declare const error_Locked: typeof Locked;
|
|
487
|
+
type error_LoopDetected = LoopDetected;
|
|
488
|
+
declare const error_LoopDetected: typeof LoopDetected;
|
|
489
|
+
type error_MethodNotAllowed = MethodNotAllowed;
|
|
490
|
+
declare const error_MethodNotAllowed: typeof MethodNotAllowed;
|
|
491
|
+
type error_MisdirectedRequest = MisdirectedRequest;
|
|
492
|
+
declare const error_MisdirectedRequest: typeof MisdirectedRequest;
|
|
493
|
+
type error_NetworkAuthenticationRequired = NetworkAuthenticationRequired;
|
|
494
|
+
declare const error_NetworkAuthenticationRequired: typeof NetworkAuthenticationRequired;
|
|
495
|
+
type error_NotAcceptable = NotAcceptable;
|
|
496
|
+
declare const error_NotAcceptable: typeof NotAcceptable;
|
|
497
|
+
type error_NotExtended = NotExtended;
|
|
498
|
+
declare const error_NotExtended: typeof NotExtended;
|
|
499
|
+
type error_NotFound = NotFound;
|
|
500
|
+
declare const error_NotFound: typeof NotFound;
|
|
501
|
+
type error_NotImplemented = NotImplemented;
|
|
502
|
+
declare const error_NotImplemented: typeof NotImplemented;
|
|
503
|
+
type error_PaymentRequired = PaymentRequired;
|
|
504
|
+
declare const error_PaymentRequired: typeof PaymentRequired;
|
|
505
|
+
type error_PreconditionFailed = PreconditionFailed;
|
|
506
|
+
declare const error_PreconditionFailed: typeof PreconditionFailed;
|
|
507
|
+
type error_PreconditionRequired = PreconditionRequired;
|
|
508
|
+
declare const error_PreconditionRequired: typeof PreconditionRequired;
|
|
509
|
+
type error_ProxyAuthenticationRequired = ProxyAuthenticationRequired;
|
|
510
|
+
declare const error_ProxyAuthenticationRequired: typeof ProxyAuthenticationRequired;
|
|
511
|
+
type error_RangeNotSatisfiable = RangeNotSatisfiable;
|
|
512
|
+
declare const error_RangeNotSatisfiable: typeof RangeNotSatisfiable;
|
|
513
|
+
type error_RequestHeaderFieldsTooLarge = RequestHeaderFieldsTooLarge;
|
|
514
|
+
declare const error_RequestHeaderFieldsTooLarge: typeof RequestHeaderFieldsTooLarge;
|
|
515
|
+
type error_RequestTimeout = RequestTimeout;
|
|
516
|
+
declare const error_RequestTimeout: typeof RequestTimeout;
|
|
517
|
+
type error_ServiceUnavailable = ServiceUnavailable;
|
|
518
|
+
declare const error_ServiceUnavailable: typeof ServiceUnavailable;
|
|
519
|
+
type error_TooEarly = TooEarly;
|
|
520
|
+
declare const error_TooEarly: typeof TooEarly;
|
|
521
|
+
type error_TooManyRequests = TooManyRequests;
|
|
522
|
+
declare const error_TooManyRequests: typeof TooManyRequests;
|
|
523
|
+
type error_URITooLong = URITooLong;
|
|
524
|
+
declare const error_URITooLong: typeof URITooLong;
|
|
525
|
+
type error_Unauthorized = Unauthorized;
|
|
526
|
+
declare const error_Unauthorized: typeof Unauthorized;
|
|
527
|
+
type error_UnavailableForLegalReasons = UnavailableForLegalReasons;
|
|
528
|
+
declare const error_UnavailableForLegalReasons: typeof UnavailableForLegalReasons;
|
|
529
|
+
type error_UnprocessableEntity = UnprocessableEntity;
|
|
530
|
+
declare const error_UnprocessableEntity: typeof UnprocessableEntity;
|
|
531
|
+
type error_UnsupportedMediaType = UnsupportedMediaType;
|
|
532
|
+
declare const error_UnsupportedMediaType: typeof UnsupportedMediaType;
|
|
533
|
+
type error_UpgradeRequired = UpgradeRequired;
|
|
534
|
+
declare const error_UpgradeRequired: typeof UpgradeRequired;
|
|
535
|
+
type error_VariantAlsoNegotiates = VariantAlsoNegotiates;
|
|
536
|
+
declare const error_VariantAlsoNegotiates: typeof VariantAlsoNegotiates;
|
|
537
|
+
declare namespace error {
|
|
538
|
+
export { error_BadGateway as BadGateway, error_BadRequest as BadRequest, error_Base as Base, error_Conflict as Conflict, error_ContentTooLarge as ContentTooLarge, error_ExpectationFailed as ExpectationFailed, error_FailedDependency as FailedDependency, error_Forbidden as Forbidden, error_GatewayTimeout as GatewayTimeout, error_Gone as Gone, error_HTTPVersionNotSupported as HTTPVersionNotSupported, error_ImATeapot as ImATeapot, error_InsufficientStorage as InsufficientStorage, error_InternalServerError as InternalServerError, error_LengthRequired as LengthRequired, error_Locked as Locked, error_LoopDetected as LoopDetected, error_MethodNotAllowed as MethodNotAllowed, error_MisdirectedRequest as MisdirectedRequest, error_NetworkAuthenticationRequired as NetworkAuthenticationRequired, error_NotAcceptable as NotAcceptable, error_NotExtended as NotExtended, error_NotFound as NotFound, error_NotImplemented as NotImplemented, error_PaymentRequired as PaymentRequired, error_PreconditionFailed as PreconditionFailed, error_PreconditionRequired as PreconditionRequired, error_ProxyAuthenticationRequired as ProxyAuthenticationRequired, error_RangeNotSatisfiable as RangeNotSatisfiable, error_RequestHeaderFieldsTooLarge as RequestHeaderFieldsTooLarge, error_RequestTimeout as RequestTimeout, error_ServiceUnavailable as ServiceUnavailable, error_TooEarly as TooEarly, error_TooManyRequests as TooManyRequests, error_URITooLong as URITooLong, error_Unauthorized as Unauthorized, error_UnavailableForLegalReasons as UnavailableForLegalReasons, error_UnprocessableEntity as UnprocessableEntity, error_UnsupportedMediaType as UnsupportedMediaType, error_UpgradeRequired as UpgradeRequired, error_VariantAlsoNegotiates as VariantAlsoNegotiates };
|
|
271
539
|
}
|
|
272
540
|
|
|
273
|
-
export { type App,
|
|
541
|
+
export { type App, AppId, type AppRole, type Artifacts, type Auth, type Entity, type EntryPoint, type EventHandler, type Method, type Middleware, type Namespace, Provider, type Providers, type Request, type RequestBuilder, type RequestHandler, type Response, type ResponseBuilder, type RouteOptions, type Router, StatusCode, type Subject, type Tenant, type Visibility, _default as cbor, error };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
import*as
|
|
2
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import*as o from'cbor2';var Y=Object.defineProperty;var Z=(t,r)=>{for(var n in r)Y(t,n,{get:r[n],enumerable:true});};var $={encode(t){return o.encode(t)},decode(t){return o.decode(t)}};var X={};Z(X,{BadGateway:()=>V,BadRequest:()=>c,Base:()=>s,Conflict:()=>y,ContentTooLarge:()=>b,ExpectationFailed:()=>A,FailedDependency:()=>U,Forbidden:()=>d,GatewayTimeout:()=>K,Gone:()=>f,HTTPVersionNotSupported:()=>D,ImATeapot:()=>T,InsufficientStorage:()=>Q,InternalServerError:()=>F,LengthRequired:()=>R,Locked:()=>k,LoopDetected:()=>z,MethodNotAllowed:()=>u,MisdirectedRequest:()=>I,NetworkAuthenticationRequired:()=>W,NotAcceptable:()=>x,NotExtended:()=>J,NotFound:()=>g,NotImplemented:()=>L,PaymentRequired:()=>l,PreconditionFailed:()=>_,PreconditionRequired:()=>O,ProxyAuthenticationRequired:()=>m,RangeNotSatisfiable:()=>q,RequestHeaderFieldsTooLarge:()=>E,RequestTimeout:()=>h,ServiceUnavailable:()=>B,TooEarly:()=>H,TooManyRequests:()=>N,URITooLong:()=>v,Unauthorized:()=>a,UnavailableForLegalReasons:()=>j,UnprocessableEntity:()=>M,UnsupportedMediaType:()=>P,UpgradeRequired:()=>w,VariantAlsoNegotiates:()=>G});var p=(e=>(e[e.Continue=100]="Continue",e[e.SwitchingProtocols=101]="SwitchingProtocols",e[e.Processing=102]="Processing",e[e.EarlyHints=103]="EarlyHints",e[e.OK=200]="OK",e[e.Created=201]="Created",e[e.Accepted=202]="Accepted",e[e.NonAuthoritativeInformation=203]="NonAuthoritativeInformation",e[e.NoContent=204]="NoContent",e[e.ResetContent=205]="ResetContent",e[e.PartialContent=206]="PartialContent",e[e.MultiStatus=207]="MultiStatus",e[e.AlreadyReported=208]="AlreadyReported",e[e.IMUsed=226]="IMUsed",e[e.MultipleChoices=300]="MultipleChoices",e[e.MovedPermanently=301]="MovedPermanently",e[e.Found=302]="Found",e[e.SeeOther=303]="SeeOther",e[e.NotModified=304]="NotModified",e[e.UseProxy=305]="UseProxy",e[e.TemporaryRedirect=307]="TemporaryRedirect",e[e.PermanentRedirect=308]="PermanentRedirect",e[e.BadRequest=400]="BadRequest",e[e.Unauthorized=401]="Unauthorized",e[e.PaymentRequired=402]="PaymentRequired",e[e.Forbidden=403]="Forbidden",e[e.NotFound=404]="NotFound",e[e.MethodNotAllowed=405]="MethodNotAllowed",e[e.NotAcceptable=406]="NotAcceptable",e[e.ProxyAuthenticationRequired=407]="ProxyAuthenticationRequired",e[e.RequestTimeout=408]="RequestTimeout",e[e.Conflict=409]="Conflict",e[e.Gone=410]="Gone",e[e.LengthRequired=411]="LengthRequired",e[e.PreconditionFailed=412]="PreconditionFailed",e[e.ContentTooLarge=413]="ContentTooLarge",e[e.URITooLong=414]="URITooLong",e[e.UnsupportedMediaType=415]="UnsupportedMediaType",e[e.RangeNotSatisfiable=416]="RangeNotSatisfiable",e[e.ExpectationFailed=417]="ExpectationFailed",e[e.ImATeapot=418]="ImATeapot",e[e.MisdirectedRequest=421]="MisdirectedRequest",e[e.UnprocessableEntity=422]="UnprocessableEntity",e[e.Locked=423]="Locked",e[e.FailedDependency=424]="FailedDependency",e[e.TooEarly=425]="TooEarly",e[e.UpgradeRequired=426]="UpgradeRequired",e[e.PreconditionRequired=428]="PreconditionRequired",e[e.TooManyRequests=429]="TooManyRequests",e[e.RequestHeaderFieldsTooLarge=431]="RequestHeaderFieldsTooLarge",e[e.UnavailableForLegalReasons=451]="UnavailableForLegalReasons",e[e.InternalServerError=500]="InternalServerError",e[e.NotImplemented=501]="NotImplemented",e[e.BadGateway=502]="BadGateway",e[e.ServiceUnavailable=503]="ServiceUnavailable",e[e.GatewayTimeout=504]="GatewayTimeout",e[e.HTTPVersionNotSupported=505]="HTTPVersionNotSupported",e[e.VariantAlsoNegotiates=506]="VariantAlsoNegotiates",e[e.InsufficientStorage=507]="InsufficientStorage",e[e.LoopDetected=508]="LoopDetected",e[e.NotExtended=510]="NotExtended",e[e.NetworkAuthenticationRequired=511]="NetworkAuthenticationRequired",e))(p||{});var s=class extends Error{constructor(n){super(n.msg);this.payload=n;}status(n){return this.payload.status=n,this}code(n){return this.payload.code=n,this}msg(n){return this.payload.msg=n,this}},c=class extends s{constructor(r){super({status:400,code:"bad_request",msg:r});}},a=class extends s{constructor(r){super({status:401,code:"unauthorized",msg:r});}},l=class extends s{constructor(r){super({status:402,code:"payment_required",msg:r});}},d=class extends s{constructor(r){super({status:403,code:"forbidden",msg:r});}},g=class extends s{constructor(r){super({status:404,code:"not_found",msg:r});}},u=class extends s{constructor(r){super({status:405,code:"method_not_allowed",msg:r});}},x=class extends s{constructor(r){super({status:406,code:"not_acceptable",msg:r});}},m=class extends s{constructor(r){super({status:407,code:"proxy_authentication_required",msg:r});}},h=class extends s{constructor(r){super({status:408,code:"request_timeout",msg:r});}},y=class extends s{constructor(r){super({status:409,code:"conflict",msg:r});}},f=class extends s{constructor(r){super({status:410,code:"gone",msg:r});}},R=class extends s{constructor(r){super({status:411,code:"length_required",msg:r});}},_=class extends s{constructor(r){super({status:412,code:"precondition_failed",msg:r});}},b=class extends s{constructor(r){super({status:413,code:"content_too_large",msg:r});}},v=class extends s{constructor(r){super({status:414,code:"uri_too_long",msg:r});}},P=class extends s{constructor(r){super({status:415,code:"unsupported_media_type",msg:r});}},q=class extends s{constructor(r){super({status:416,code:"range_not_satisfiable",msg:r});}},A=class extends s{constructor(r){super({status:417,code:"expectation_failed",msg:r});}},T=class extends s{constructor(r){super({status:418,code:"im_a_teapot",msg:r});}},I=class extends s{constructor(r){super({status:421,code:"misdirected_request",msg:r});}},M=class extends s{constructor(r){super({status:422,code:"unprocessable_entity",msg:r});}},k=class extends s{constructor(r){super({status:423,code:"locked",msg:r});}},U=class extends s{constructor(r){super({status:424,code:"failed_dependency",msg:r});}},H=class extends s{constructor(r){super({status:425,code:"too_early",msg:r});}},w=class extends s{constructor(r){super({status:426,code:"upgrade_required",msg:r});}},O=class extends s{constructor(r){super({status:428,code:"precondition_required",msg:r});}},N=class extends s{constructor(r){super({status:429,code:"too_many_requests",msg:r});}},E=class extends s{constructor(r){super({status:431,code:"request_header_fields_too_large",msg:r});}},j=class extends s{constructor(r){super({status:451,code:"unavailable_for_legal_reasons",msg:r});}},F=class extends s{constructor(r){super({status:500,code:"internal_server_error",msg:r});}},L=class extends s{constructor(r){super({status:501,code:"not_implemented",msg:r});}},V=class extends s{constructor(r){super({status:502,code:"bad_gateway",msg:r});}},B=class extends s{constructor(r){super({status:503,code:"service_unavailable",msg:r});}},K=class extends s{constructor(r){super({status:504,code:"gateway_timeout",msg:r});}},D=class extends s{constructor(r){super({status:505,code:"http_version_not_supported",msg:r});}},G=class extends s{constructor(r){super({status:506,code:"variant_also_negotiates",msg:r});}},Q=class extends s{constructor(r){super({status:507,code:"insufficient_storage",msg:r});}},z=class extends s{constructor(r){super({status:508,code:"loop_detected",msg:r});}},J=class extends s{constructor(r){super({status:510,code:"not_extended",msg:r});}},W=class extends s{constructor(r){super({status:511,code:"network_authentication_required",msg:r});}};var i={get instance(){return globalThis.__M1CRO__.internals}};var C={fromId(t){return i.instance.providerFromId(t)}};var S={parse(t){return i.instance.parseAppId(t)}};export{S as AppId,C as Provider,p as StatusCode,$ as cbor,X as error};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m1cro/server-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -9,16 +9,13 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
-
},
|
|
13
|
-
"./globals": {
|
|
14
|
-
"types": "./dist/globals.d.ts"
|
|
15
12
|
}
|
|
16
13
|
},
|
|
17
14
|
"publishConfig": {
|
|
18
15
|
"access": "public"
|
|
19
16
|
},
|
|
20
17
|
"scripts": {
|
|
21
|
-
"build": "yarn
|
|
18
|
+
"build": "yarn && yarn typecheck && yarn bundle",
|
|
22
19
|
"typecheck": "tsc --noEmit",
|
|
23
20
|
"bundle": "tsup --minify --treeshake smallest",
|
|
24
21
|
"versioning": "yarn version --new-version",
|
|
@@ -32,4 +29,4 @@
|
|
|
32
29
|
"devDependencies": {
|
|
33
30
|
"tsup": "^8.5.1"
|
|
34
31
|
}
|
|
35
|
-
}
|
|
32
|
+
}
|
package/dist/globals.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"globals.js","sourcesContent":[]}
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cbor.ts"],"names":["cbor_default","data"],"mappings":"wBAEA,IAAOA,CAAAA,CAAQ,CACX,MAAA,CAAUC,CAAAA,CAAqB,CAC3B,OAAa,CAAA,CAAA,MAAA,CAAOA,CAAI,CAC5B,CAAA,CACA,OAAUA,CAAAA,CAAqB,CAC3B,OAAa,CAAA,CAAA,MAAA,CAAOA,CAAI,CAC5B,CACJ","file":"index.js","sourcesContent":["import * as cbor2 from \"cbor2\";\n\nexport default {\n encode<T>(data: T): Uint8Array {\n return cbor2.encode(data);\n },\n decode<T>(data: Uint8Array): T {\n return cbor2.decode(data);\n },\n};\n"]}
|