@m1cro/server-sdk 0.1.1-beta.15 → 0.1.1-beta.17
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 -1
- package/dist/index.d.ts +54 -131
- package/dist/index.js +1 -1
- package/dist/{log-DJkb_H5H.d.ts → log-BiuB_mLm.d.ts} +3 -3
- package/package.json +1 -1
package/dist/globals.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { E as EntitySchema, C as CompiledSchema, F as Filter, a as FindQuery, H as HydratedDocument, b as FindOneQuery, I as InsertDocument, c as InsertQuery, d as InsertOneQuery, U as UpdateQuery, e as InferInterface, f as UpdateOneQuery, R as RemoveQuery, g as RemoveOneQuery, h as Router, i as HookEventMap, A as AppRole, j as EventHandler } from './log-
|
|
2
|
-
export { k as AppId, l as Artifacts, m as Auth, B as Bridge, n as Entity, o as InferSchema, L as LogLevel, M as Method, p as Middleware, N as Namespace, P as Provider, q as Providers, r as Request, s as RequestBuilder, t as RequestHandler, u as Response, v as ResponseBuilder, w as RouteOptions, S as Sorting, x as StatusCode, y as Subject, T as Tenant, V as Visibility, z as entitySchema } from './log-
|
|
1
|
+
import { E as EntitySchema, G as GeneratedFields, C as CompiledSchema, F as Filter, a as FindQuery, H as HydratedDocument, b as FindOneQuery, I as InsertDocument, c as InsertQuery, d as InsertOneQuery, U as UpdateQuery, e as InferInterface, f as UpdateOneQuery, R as RemoveQuery, g as RemoveOneQuery, h as Router, i as HookEventMap, A as AppRole, j as EventHandler } from './log-BiuB_mLm.js';
|
|
2
|
+
export { k as AppId, l as Artifacts, m as Auth, B as Bridge, n as Entity, o as InferSchema, L as LogLevel, M as Method, p as Middleware, N as Namespace, P as Provider, q as Providers, r as Request, s as RequestBuilder, t as RequestHandler, u as Response, v as ResponseBuilder, w as RouteOptions, S as Sorting, x as StatusCode, y as Subject, T as Tenant, V as Visibility, z as entitySchema } from './log-BiuB_mLm.js';
|
|
3
3
|
import 'cookie';
|
|
4
4
|
|
|
5
|
+
declare function entityModel<S extends EntitySchema<any>>(name: string, schemaDef: S, options?: EntityModelOptions<S>): EntityModel<S>;
|
|
5
6
|
interface EntityModelRegistration {
|
|
6
7
|
get name(): string;
|
|
7
8
|
get schema(): {
|
|
@@ -11,8 +12,9 @@ interface EntityModelRegistration {
|
|
|
11
12
|
declare class EntityModel<S extends EntitySchema<any>> implements EntityModelRegistration {
|
|
12
13
|
readonly name: string;
|
|
13
14
|
readonly schemaDef: S;
|
|
15
|
+
readonly options?: EntityModelOptions<S> | undefined;
|
|
14
16
|
schema: CompiledSchema;
|
|
15
|
-
constructor(name: string, schemaDef: S);
|
|
17
|
+
constructor(name: string, schemaDef: S, options?: EntityModelOptions<S> | undefined);
|
|
16
18
|
private entity;
|
|
17
19
|
find(filter?: Filter): FindQuery<HydratedDocument<S>>;
|
|
18
20
|
findOne(filter?: Filter): FindOneQuery<HydratedDocument<S>>;
|
|
@@ -23,6 +25,13 @@ declare class EntityModel<S extends EntitySchema<any>> implements EntityModelReg
|
|
|
23
25
|
remove(filter: Filter): RemoveQuery<InferInterface<S>, 'affectedRows'>;
|
|
24
26
|
removeOne(filter: Filter): RemoveOneQuery<InferInterface<S>, 'success'>;
|
|
25
27
|
}
|
|
28
|
+
interface EntityModelOptions<S extends EntitySchema<any>> {
|
|
29
|
+
indexes?: EntityIndexManifest<S>[];
|
|
30
|
+
}
|
|
31
|
+
interface EntityIndexManifest<S extends EntitySchema<any>> {
|
|
32
|
+
fields: Array<keyof GeneratedFields | keyof S['definition']>;
|
|
33
|
+
unique?: boolean | undefined;
|
|
34
|
+
}
|
|
26
35
|
|
|
27
36
|
type EntryPoint = (app: App) => unknown;
|
|
28
37
|
interface App {
|
|
@@ -47,218 +56,132 @@ interface ErrorPayload {
|
|
|
47
56
|
code: string;
|
|
48
57
|
msg?: string | undefined;
|
|
49
58
|
}
|
|
50
|
-
declare class
|
|
59
|
+
declare class BaseError extends Error {
|
|
51
60
|
protected payload: ErrorPayload;
|
|
52
61
|
constructor(payload: ErrorPayload);
|
|
53
62
|
status(status: number): this;
|
|
54
63
|
code(code: string): this;
|
|
55
64
|
msg(msg: string): this;
|
|
56
65
|
}
|
|
57
|
-
declare class
|
|
66
|
+
declare class BadRequestError extends BaseError {
|
|
58
67
|
constructor(msg?: string);
|
|
59
68
|
}
|
|
60
|
-
declare class
|
|
69
|
+
declare class UnauthorizedError extends BaseError {
|
|
61
70
|
constructor(msg?: string);
|
|
62
71
|
}
|
|
63
|
-
declare class
|
|
72
|
+
declare class PaymentRequiredError extends BaseError {
|
|
64
73
|
constructor(msg?: string);
|
|
65
74
|
}
|
|
66
|
-
declare class
|
|
75
|
+
declare class ForbiddenError extends BaseError {
|
|
67
76
|
constructor(msg?: string);
|
|
68
77
|
}
|
|
69
|
-
declare class
|
|
78
|
+
declare class NotFoundError extends BaseError {
|
|
70
79
|
constructor(msg?: string);
|
|
71
80
|
}
|
|
72
|
-
declare class
|
|
81
|
+
declare class MethodNotAllowedError extends BaseError {
|
|
73
82
|
constructor(msg?: string);
|
|
74
83
|
}
|
|
75
|
-
declare class
|
|
84
|
+
declare class NotAcceptableError extends BaseError {
|
|
76
85
|
constructor(msg?: string);
|
|
77
86
|
}
|
|
78
|
-
declare class
|
|
87
|
+
declare class ProxyAuthenticationRequiredError extends BaseError {
|
|
79
88
|
constructor(msg?: string);
|
|
80
89
|
}
|
|
81
|
-
declare class
|
|
90
|
+
declare class RequestTimeoutError extends BaseError {
|
|
82
91
|
constructor(msg?: string);
|
|
83
92
|
}
|
|
84
|
-
declare class
|
|
93
|
+
declare class ConflictError extends BaseError {
|
|
85
94
|
constructor(msg?: string);
|
|
86
95
|
}
|
|
87
|
-
declare class
|
|
96
|
+
declare class GoneError extends BaseError {
|
|
88
97
|
constructor(msg?: string);
|
|
89
98
|
}
|
|
90
|
-
declare class
|
|
99
|
+
declare class LengthRequiredError extends BaseError {
|
|
91
100
|
constructor(msg?: string);
|
|
92
101
|
}
|
|
93
|
-
declare class
|
|
102
|
+
declare class PreconditionFailedError extends BaseError {
|
|
94
103
|
constructor(msg?: string);
|
|
95
104
|
}
|
|
96
|
-
declare class
|
|
105
|
+
declare class ContentTooLargeError extends BaseError {
|
|
97
106
|
constructor(msg?: string);
|
|
98
107
|
}
|
|
99
|
-
declare class
|
|
108
|
+
declare class URITooLongError extends BaseError {
|
|
100
109
|
constructor(msg?: string);
|
|
101
110
|
}
|
|
102
|
-
declare class
|
|
111
|
+
declare class UnsupportedMediaTypeError extends BaseError {
|
|
103
112
|
constructor(msg?: string);
|
|
104
113
|
}
|
|
105
|
-
declare class
|
|
114
|
+
declare class RangeNotSatisfiableError extends BaseError {
|
|
106
115
|
constructor(msg?: string);
|
|
107
116
|
}
|
|
108
|
-
declare class
|
|
117
|
+
declare class ExpectationFailedError extends BaseError {
|
|
109
118
|
constructor(msg?: string);
|
|
110
119
|
}
|
|
111
|
-
declare class
|
|
120
|
+
declare class ImATeapotError extends BaseError {
|
|
112
121
|
constructor(msg?: string);
|
|
113
122
|
}
|
|
114
|
-
declare class
|
|
123
|
+
declare class MisdirectedRequestError extends BaseError {
|
|
115
124
|
constructor(msg?: string);
|
|
116
125
|
}
|
|
117
|
-
declare class
|
|
126
|
+
declare class UnprocessableEntityError extends BaseError {
|
|
118
127
|
constructor(msg?: string);
|
|
119
128
|
}
|
|
120
|
-
declare class
|
|
129
|
+
declare class LockedError extends BaseError {
|
|
121
130
|
constructor(msg?: string);
|
|
122
131
|
}
|
|
123
|
-
declare class
|
|
132
|
+
declare class FailedDependencyError extends BaseError {
|
|
124
133
|
constructor(msg?: string);
|
|
125
134
|
}
|
|
126
|
-
declare class
|
|
135
|
+
declare class TooEarlyError extends BaseError {
|
|
127
136
|
constructor(msg?: string);
|
|
128
137
|
}
|
|
129
|
-
declare class
|
|
138
|
+
declare class UpgradeRequiredError extends BaseError {
|
|
130
139
|
constructor(msg?: string);
|
|
131
140
|
}
|
|
132
|
-
declare class
|
|
141
|
+
declare class PreconditionRequiredError extends BaseError {
|
|
133
142
|
constructor(msg?: string);
|
|
134
143
|
}
|
|
135
|
-
declare class
|
|
144
|
+
declare class TooManyRequestsError extends BaseError {
|
|
136
145
|
constructor(msg?: string);
|
|
137
146
|
}
|
|
138
|
-
declare class
|
|
147
|
+
declare class RequestHeaderFieldsTooLargeError extends BaseError {
|
|
139
148
|
constructor(msg?: string);
|
|
140
149
|
}
|
|
141
|
-
declare class
|
|
150
|
+
declare class UnavailableForLegalReasonsError extends BaseError {
|
|
142
151
|
constructor(msg?: string);
|
|
143
152
|
}
|
|
144
|
-
declare class
|
|
153
|
+
declare class InternalServerErrorError extends BaseError {
|
|
145
154
|
constructor(msg?: string);
|
|
146
155
|
}
|
|
147
|
-
declare class
|
|
156
|
+
declare class NotImplementedError extends BaseError {
|
|
148
157
|
constructor(msg?: string);
|
|
149
158
|
}
|
|
150
|
-
declare class
|
|
159
|
+
declare class BadGatewayError extends BaseError {
|
|
151
160
|
constructor(msg?: string);
|
|
152
161
|
}
|
|
153
|
-
declare class
|
|
162
|
+
declare class ServiceUnavailableError extends BaseError {
|
|
154
163
|
constructor(msg?: string);
|
|
155
164
|
}
|
|
156
|
-
declare class
|
|
165
|
+
declare class GatewayTimeoutError extends BaseError {
|
|
157
166
|
constructor(msg?: string);
|
|
158
167
|
}
|
|
159
|
-
declare class
|
|
168
|
+
declare class HTTPVersionNotSupportedError extends BaseError {
|
|
160
169
|
constructor(msg?: string);
|
|
161
170
|
}
|
|
162
|
-
declare class
|
|
171
|
+
declare class VariantAlsoNegotiatesError extends BaseError {
|
|
163
172
|
constructor(msg?: string);
|
|
164
173
|
}
|
|
165
|
-
declare class
|
|
174
|
+
declare class InsufficientStorageError extends BaseError {
|
|
166
175
|
constructor(msg?: string);
|
|
167
176
|
}
|
|
168
|
-
declare class
|
|
177
|
+
declare class LoopDetectedError extends BaseError {
|
|
169
178
|
constructor(msg?: string);
|
|
170
179
|
}
|
|
171
|
-
declare class
|
|
180
|
+
declare class NotExtendedError extends BaseError {
|
|
172
181
|
constructor(msg?: string);
|
|
173
182
|
}
|
|
174
|
-
declare class
|
|
183
|
+
declare class NetworkAuthenticationRequiredError extends BaseError {
|
|
175
184
|
constructor(msg?: string);
|
|
176
185
|
}
|
|
177
186
|
|
|
178
|
-
type
|
|
179
|
-
declare const error_BadGateway: typeof BadGateway;
|
|
180
|
-
type error_BadRequest = BadRequest;
|
|
181
|
-
declare const error_BadRequest: typeof BadRequest;
|
|
182
|
-
type error_Base = Base;
|
|
183
|
-
declare const error_Base: typeof Base;
|
|
184
|
-
type error_Conflict = Conflict;
|
|
185
|
-
declare const error_Conflict: typeof Conflict;
|
|
186
|
-
type error_ContentTooLarge = ContentTooLarge;
|
|
187
|
-
declare const error_ContentTooLarge: typeof ContentTooLarge;
|
|
188
|
-
type error_ExpectationFailed = ExpectationFailed;
|
|
189
|
-
declare const error_ExpectationFailed: typeof ExpectationFailed;
|
|
190
|
-
type error_FailedDependency = FailedDependency;
|
|
191
|
-
declare const error_FailedDependency: typeof FailedDependency;
|
|
192
|
-
type error_Forbidden = Forbidden;
|
|
193
|
-
declare const error_Forbidden: typeof Forbidden;
|
|
194
|
-
type error_GatewayTimeout = GatewayTimeout;
|
|
195
|
-
declare const error_GatewayTimeout: typeof GatewayTimeout;
|
|
196
|
-
type error_Gone = Gone;
|
|
197
|
-
declare const error_Gone: typeof Gone;
|
|
198
|
-
type error_HTTPVersionNotSupported = HTTPVersionNotSupported;
|
|
199
|
-
declare const error_HTTPVersionNotSupported: typeof HTTPVersionNotSupported;
|
|
200
|
-
type error_ImATeapot = ImATeapot;
|
|
201
|
-
declare const error_ImATeapot: typeof ImATeapot;
|
|
202
|
-
type error_InsufficientStorage = InsufficientStorage;
|
|
203
|
-
declare const error_InsufficientStorage: typeof InsufficientStorage;
|
|
204
|
-
type error_InternalServerError = InternalServerError;
|
|
205
|
-
declare const error_InternalServerError: typeof InternalServerError;
|
|
206
|
-
type error_LengthRequired = LengthRequired;
|
|
207
|
-
declare const error_LengthRequired: typeof LengthRequired;
|
|
208
|
-
type error_Locked = Locked;
|
|
209
|
-
declare const error_Locked: typeof Locked;
|
|
210
|
-
type error_LoopDetected = LoopDetected;
|
|
211
|
-
declare const error_LoopDetected: typeof LoopDetected;
|
|
212
|
-
type error_MethodNotAllowed = MethodNotAllowed;
|
|
213
|
-
declare const error_MethodNotAllowed: typeof MethodNotAllowed;
|
|
214
|
-
type error_MisdirectedRequest = MisdirectedRequest;
|
|
215
|
-
declare const error_MisdirectedRequest: typeof MisdirectedRequest;
|
|
216
|
-
type error_NetworkAuthenticationRequired = NetworkAuthenticationRequired;
|
|
217
|
-
declare const error_NetworkAuthenticationRequired: typeof NetworkAuthenticationRequired;
|
|
218
|
-
type error_NotAcceptable = NotAcceptable;
|
|
219
|
-
declare const error_NotAcceptable: typeof NotAcceptable;
|
|
220
|
-
type error_NotExtended = NotExtended;
|
|
221
|
-
declare const error_NotExtended: typeof NotExtended;
|
|
222
|
-
type error_NotFound = NotFound;
|
|
223
|
-
declare const error_NotFound: typeof NotFound;
|
|
224
|
-
type error_NotImplemented = NotImplemented;
|
|
225
|
-
declare const error_NotImplemented: typeof NotImplemented;
|
|
226
|
-
type error_PaymentRequired = PaymentRequired;
|
|
227
|
-
declare const error_PaymentRequired: typeof PaymentRequired;
|
|
228
|
-
type error_PreconditionFailed = PreconditionFailed;
|
|
229
|
-
declare const error_PreconditionFailed: typeof PreconditionFailed;
|
|
230
|
-
type error_PreconditionRequired = PreconditionRequired;
|
|
231
|
-
declare const error_PreconditionRequired: typeof PreconditionRequired;
|
|
232
|
-
type error_ProxyAuthenticationRequired = ProxyAuthenticationRequired;
|
|
233
|
-
declare const error_ProxyAuthenticationRequired: typeof ProxyAuthenticationRequired;
|
|
234
|
-
type error_RangeNotSatisfiable = RangeNotSatisfiable;
|
|
235
|
-
declare const error_RangeNotSatisfiable: typeof RangeNotSatisfiable;
|
|
236
|
-
type error_RequestHeaderFieldsTooLarge = RequestHeaderFieldsTooLarge;
|
|
237
|
-
declare const error_RequestHeaderFieldsTooLarge: typeof RequestHeaderFieldsTooLarge;
|
|
238
|
-
type error_RequestTimeout = RequestTimeout;
|
|
239
|
-
declare const error_RequestTimeout: typeof RequestTimeout;
|
|
240
|
-
type error_ServiceUnavailable = ServiceUnavailable;
|
|
241
|
-
declare const error_ServiceUnavailable: typeof ServiceUnavailable;
|
|
242
|
-
type error_TooEarly = TooEarly;
|
|
243
|
-
declare const error_TooEarly: typeof TooEarly;
|
|
244
|
-
type error_TooManyRequests = TooManyRequests;
|
|
245
|
-
declare const error_TooManyRequests: typeof TooManyRequests;
|
|
246
|
-
type error_URITooLong = URITooLong;
|
|
247
|
-
declare const error_URITooLong: typeof URITooLong;
|
|
248
|
-
type error_Unauthorized = Unauthorized;
|
|
249
|
-
declare const error_Unauthorized: typeof Unauthorized;
|
|
250
|
-
type error_UnavailableForLegalReasons = UnavailableForLegalReasons;
|
|
251
|
-
declare const error_UnavailableForLegalReasons: typeof UnavailableForLegalReasons;
|
|
252
|
-
type error_UnprocessableEntity = UnprocessableEntity;
|
|
253
|
-
declare const error_UnprocessableEntity: typeof UnprocessableEntity;
|
|
254
|
-
type error_UnsupportedMediaType = UnsupportedMediaType;
|
|
255
|
-
declare const error_UnsupportedMediaType: typeof UnsupportedMediaType;
|
|
256
|
-
type error_UpgradeRequired = UpgradeRequired;
|
|
257
|
-
declare const error_UpgradeRequired: typeof UpgradeRequired;
|
|
258
|
-
type error_VariantAlsoNegotiates = VariantAlsoNegotiates;
|
|
259
|
-
declare const error_VariantAlsoNegotiates: typeof VariantAlsoNegotiates;
|
|
260
|
-
declare namespace error {
|
|
261
|
-
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 };
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
export { type App, AppRole, EntityModel, EntitySchema, type EntryPoint, EventHandler, Filter, HydratedDocument, InferInterface, InsertDocument, Router, _default as cbor, error };
|
|
187
|
+
export { type App, AppRole, BadGatewayError, BadRequestError, BaseError, ConflictError, ContentTooLargeError, type EntityIndexManifest, type EntityModelOptions, type EntryPoint, EventHandler, ExpectationFailedError, FailedDependencyError, Filter, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, HydratedDocument, ImATeapotError, InferInterface, InsertDocument, InsufficientStorageError, InternalServerErrorError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, MisdirectedRequestError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PaymentRequiredError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthenticationRequiredError, RangeNotSatisfiableError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, Router, ServiceUnavailableError, TooEarlyError, TooManyRequestsError, URITooLongError, UnauthorizedError, UnavailableForLegalReasonsError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, VariantAlsoNegotiatesError, _default as cbor, entityModel };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as o from'cbor2';var
|
|
1
|
+
import*as o from'cbor2';var $={encode(r){return o.encode(r)},decode(r){return o.decode(r)}};function S(r){return new a(r)}var a=class{constructor(t){this.definition=t;}},i=class{constructor(t){}get shape(){return {}}};function C(r,t,s){return new c(r,t,s)}var c=class{constructor(t,s,re){this.name=t;this.schemaDef=s;this.options=re;this.schema=new i(s);}schema;entity(){return globalThis.Bridge.entity(this.name)}find(t){return this.entity().find(t)}findOne(t){return this.entity().findOne(t)}insert(t){return this.entity().insert(t)}insertOne(t){return this.entity().insertOne(t)}update(t,s){return this.entity().update(t,s)}updateOne(t,s){return this.entity().updateOne(t,s)}remove(t){return this.entity().remove(t)}removeOne(t){return this.entity().removeOne(t)}};var d=(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))(d||{});var n=class extends Error{constructor(s){super(s.msg);this.payload=s;}status(s){return this.payload.status=s,this}code(s){return this.payload.code=s,this}msg(s){return this.payload.msg=s,this}},l=class extends n{constructor(t){super({status:400,code:"bad_request",msg:t});}},u=class extends n{constructor(t){super({status:401,code:"unauthorized",msg:t});}},m=class extends n{constructor(t){super({status:402,code:"payment_required",msg:t});}},y=class extends n{constructor(t){super({status:403,code:"forbidden",msg:t});}},g=class extends n{constructor(t){super({status:404,code:"not_found",msg:t});}},x=class extends n{constructor(t){super({status:405,code:"method_not_allowed",msg:t});}},f=class extends n{constructor(t){super({status:406,code:"not_acceptable",msg:t});}},h=class extends n{constructor(t){super({status:407,code:"proxy_authentication_required",msg:t});}},R=class extends n{constructor(t){super({status:408,code:"request_timeout",msg:t});}},I=class extends n{constructor(t){super({status:409,code:"conflict",msg:t});}},b=class extends n{constructor(t){super({status:410,code:"gone",msg:t});}},v=class extends n{constructor(t){super({status:411,code:"length_required",msg:t});}},_=class extends n{constructor(t){super({status:412,code:"precondition_failed",msg:t});}},q=class extends n{constructor(t){super({status:413,code:"content_too_large",msg:t});}},T=class extends n{constructor(t){super({status:414,code:"uri_too_long",msg:t});}},A=class extends n{constructor(t){super({status:415,code:"unsupported_media_type",msg:t});}},P=class extends n{constructor(t){super({status:416,code:"range_not_satisfiable",msg:t});}},M=class extends n{constructor(t){super({status:417,code:"expectation_failed",msg:t});}},E=class extends n{constructor(t){super({status:418,code:"im_a_teapot",msg:t});}},O=class extends n{constructor(t){super({status:421,code:"misdirected_request",msg:t});}},F=class extends n{constructor(t){super({status:422,code:"unprocessable_entity",msg:t});}},U=class extends n{constructor(t){super({status:423,code:"locked",msg:t});}},D=class extends n{constructor(t){super({status:424,code:"failed_dependency",msg:t});}},w=class extends n{constructor(t){super({status:425,code:"too_early",msg:t});}},k=class extends n{constructor(t){super({status:426,code:"upgrade_required",msg:t});}},H=class extends n{constructor(t){super({status:428,code:"precondition_required",msg:t});}},N=class extends n{constructor(t){super({status:429,code:"too_many_requests",msg:t});}},Q=class extends n{constructor(t){super({status:431,code:"request_header_fields_too_large",msg:t});}},L=class extends n{constructor(t){super({status:451,code:"unavailable_for_legal_reasons",msg:t});}},j=class extends n{constructor(t){super({status:500,code:"internal_server_error",msg:t});}},B=class extends n{constructor(t){super({status:501,code:"not_implemented",msg:t});}},V=class extends n{constructor(t){super({status:502,code:"bad_gateway",msg:t});}},G=class extends n{constructor(t){super({status:503,code:"service_unavailable",msg:t});}},K=class extends n{constructor(t){super({status:504,code:"gateway_timeout",msg:t});}},z=class extends n{constructor(t){super({status:505,code:"http_version_not_supported",msg:t});}},J=class extends n{constructor(t){super({status:506,code:"variant_also_negotiates",msg:t});}},W=class extends n{constructor(t){super({status:507,code:"insufficient_storage",msg:t});}},X=class extends n{constructor(t){super({status:508,code:"loop_detected",msg:t});}},Y=class extends n{constructor(t){super({status:510,code:"not_extended",msg:t});}},Z=class extends n{constructor(t){super({status:511,code:"network_authentication_required",msg:t});}};var p={get instance(){return globalThis.__M1CRO__.internals}};var ee={fromId(r){return p.instance.providerFromId(r)}};var te={parse(r){return p.instance.parseAppId(r)}};export{te as AppId,V as BadGatewayError,l as BadRequestError,n as BaseError,I as ConflictError,q as ContentTooLargeError,M as ExpectationFailedError,D as FailedDependencyError,y as ForbiddenError,K as GatewayTimeoutError,b as GoneError,z as HTTPVersionNotSupportedError,E as ImATeapotError,W as InsufficientStorageError,j as InternalServerErrorError,v as LengthRequiredError,U as LockedError,X as LoopDetectedError,x as MethodNotAllowedError,O as MisdirectedRequestError,Z as NetworkAuthenticationRequiredError,f as NotAcceptableError,Y as NotExtendedError,g as NotFoundError,B as NotImplementedError,m as PaymentRequiredError,_ as PreconditionFailedError,H as PreconditionRequiredError,ee as Provider,h as ProxyAuthenticationRequiredError,P as RangeNotSatisfiableError,Q as RequestHeaderFieldsTooLargeError,R as RequestTimeoutError,G as ServiceUnavailableError,d as StatusCode,w as TooEarlyError,N as TooManyRequestsError,T as URITooLongError,u as UnauthorizedError,L as UnavailableForLegalReasonsError,F as UnprocessableEntityError,A as UnsupportedMediaTypeError,k as UpgradeRequiredError,J as VariantAlsoNegotiatesError,$ as cbor,C as entityModel,S as entitySchema};
|
|
@@ -23,7 +23,7 @@ interface SchemaDefinition {
|
|
|
23
23
|
type ConstructorToType<T> = T extends StringConstructor ? string : T extends NumberConstructor ? number : T extends BooleanConstructor ? boolean : T extends DateConstructor ? number : T extends ObjectConstructor ? Record<string, unknown> : never;
|
|
24
24
|
type IsOptional<F> = F extends {
|
|
25
25
|
required: false;
|
|
26
|
-
} ?
|
|
26
|
+
} ? true : false;
|
|
27
27
|
type RequiredKeys<Def extends SchemaDefinition> = {
|
|
28
28
|
[K in keyof Def]-?: IsOptional<Def[K]> extends false ? K : never;
|
|
29
29
|
}[keyof Def];
|
|
@@ -41,11 +41,11 @@ type InferSchema<Def extends SchemaDefinition> = {
|
|
|
41
41
|
[K in RequiredKeys<Def>]: InferField<Def[K]>;
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
+
declare function entitySchema<const Def extends SchemaDefinition>(def: AssertNoReservedKeys<Def>): EntitySchema<Def>;
|
|
44
45
|
declare class EntitySchema<Def extends SchemaDefinition = SchemaDefinition> {
|
|
45
46
|
readonly definition: Def;
|
|
46
47
|
constructor(definition: Def);
|
|
47
48
|
}
|
|
48
|
-
declare function entitySchema<const Def extends SchemaDefinition>(def: AssertNoReservedKeys<Def>): EntitySchema<Def>;
|
|
49
49
|
declare class CompiledSchema {
|
|
50
50
|
constructor(schema: EntitySchema);
|
|
51
51
|
get shape(): unknown;
|
|
@@ -402,4 +402,4 @@ interface Bridge {
|
|
|
402
402
|
declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "none"];
|
|
403
403
|
type LogLevel = (typeof logLevels)[number];
|
|
404
404
|
|
|
405
|
-
export { type AppRole as A, type Bridge as B, CompiledSchema as C, EntitySchema as E, type Filter as F, type HydratedDocument as H, type InsertDocument as I, type LogLevel as L, type Method as M, type Namespace as N, Provider as P, type RemoveQuery as R, type Sorting$1 as S, type Tenant as T, type UpdateQuery as U, type Visibility as V, type FindQuery as a, type FindOneQuery as b, type InsertQuery as c, type InsertOneQuery as d, type InferInterface as e, type UpdateOneQuery as f, type RemoveOneQuery as g, type Router as h, type HookEventMap as i, type EventHandler as j, AppId as k, type Artifacts as l, type Auth as m, type Entity as n, type InferSchema as o, type Middleware as p, type Providers as q, type Request as r, type RequestBuilder as s, type RequestHandler as t, type Response as u, type ResponseBuilder as v, type RouteOptions as w, StatusCode as x, type Subject as y, entitySchema as z };
|
|
405
|
+
export { type AppRole as A, type Bridge as B, CompiledSchema as C, EntitySchema as E, type Filter as F, type GeneratedFields as G, type HydratedDocument as H, type InsertDocument as I, type LogLevel as L, type Method as M, type Namespace as N, Provider as P, type RemoveQuery as R, type Sorting$1 as S, type Tenant as T, type UpdateQuery as U, type Visibility as V, type FindQuery as a, type FindOneQuery as b, type InsertQuery as c, type InsertOneQuery as d, type InferInterface as e, type UpdateOneQuery as f, type RemoveOneQuery as g, type Router as h, type HookEventMap as i, type EventHandler as j, AppId as k, type Artifacts as l, type Auth as m, type Entity as n, type InferSchema as o, type Middleware as p, type Providers as q, type Request as r, type RequestBuilder as s, type RequestHandler as t, type Response as u, type ResponseBuilder as v, type RouteOptions as w, StatusCode as x, type Subject as y, entitySchema as z };
|