@m1cro/server-sdk 0.1.1-beta.16 → 0.1.1-beta.18

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 CHANGED
@@ -1,4 +1,4 @@
1
- import { B as Bridge, L as LogLevel } from './log-CxYm-dm1.js';
1
+ import { B as Bridge, L as LogLevel } from './log-BiuB_mLm.js';
2
2
  import * as console from 'node:console';
3
3
  import 'cookie';
4
4
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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-CxYm-dm1.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-CxYm-dm1.js';
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
5
  declare function entityModel<S extends EntitySchema<any>>(name: string, schemaDef: S, options?: EntityModelOptions<S>): EntityModel<S>;
@@ -56,218 +56,132 @@ interface ErrorPayload {
56
56
  code: string;
57
57
  msg?: string | undefined;
58
58
  }
59
- declare class Base extends Error {
59
+ declare class BaseError extends Error {
60
60
  protected payload: ErrorPayload;
61
61
  constructor(payload: ErrorPayload);
62
62
  status(status: number): this;
63
63
  code(code: string): this;
64
64
  msg(msg: string): this;
65
65
  }
66
- declare class BadRequest extends Base {
66
+ declare class BadRequestError extends BaseError {
67
67
  constructor(msg?: string);
68
68
  }
69
- declare class Unauthorized extends Base {
69
+ declare class UnauthorizedError extends BaseError {
70
70
  constructor(msg?: string);
71
71
  }
72
- declare class PaymentRequired extends Base {
72
+ declare class PaymentRequiredError extends BaseError {
73
73
  constructor(msg?: string);
74
74
  }
75
- declare class Forbidden extends Base {
75
+ declare class ForbiddenError extends BaseError {
76
76
  constructor(msg?: string);
77
77
  }
78
- declare class NotFound extends Base {
78
+ declare class NotFoundError extends BaseError {
79
79
  constructor(msg?: string);
80
80
  }
81
- declare class MethodNotAllowed extends Base {
81
+ declare class MethodNotAllowedError extends BaseError {
82
82
  constructor(msg?: string);
83
83
  }
84
- declare class NotAcceptable extends Base {
84
+ declare class NotAcceptableError extends BaseError {
85
85
  constructor(msg?: string);
86
86
  }
87
- declare class ProxyAuthenticationRequired extends Base {
87
+ declare class ProxyAuthenticationRequiredError extends BaseError {
88
88
  constructor(msg?: string);
89
89
  }
90
- declare class RequestTimeout extends Base {
90
+ declare class RequestTimeoutError extends BaseError {
91
91
  constructor(msg?: string);
92
92
  }
93
- declare class Conflict extends Base {
93
+ declare class ConflictError extends BaseError {
94
94
  constructor(msg?: string);
95
95
  }
96
- declare class Gone extends Base {
96
+ declare class GoneError extends BaseError {
97
97
  constructor(msg?: string);
98
98
  }
99
- declare class LengthRequired extends Base {
99
+ declare class LengthRequiredError extends BaseError {
100
100
  constructor(msg?: string);
101
101
  }
102
- declare class PreconditionFailed extends Base {
102
+ declare class PreconditionFailedError extends BaseError {
103
103
  constructor(msg?: string);
104
104
  }
105
- declare class ContentTooLarge extends Base {
105
+ declare class ContentTooLargeError extends BaseError {
106
106
  constructor(msg?: string);
107
107
  }
108
- declare class URITooLong extends Base {
108
+ declare class URITooLongError extends BaseError {
109
109
  constructor(msg?: string);
110
110
  }
111
- declare class UnsupportedMediaType extends Base {
111
+ declare class UnsupportedMediaTypeError extends BaseError {
112
112
  constructor(msg?: string);
113
113
  }
114
- declare class RangeNotSatisfiable extends Base {
114
+ declare class RangeNotSatisfiableError extends BaseError {
115
115
  constructor(msg?: string);
116
116
  }
117
- declare class ExpectationFailed extends Base {
117
+ declare class ExpectationFailedError extends BaseError {
118
118
  constructor(msg?: string);
119
119
  }
120
- declare class ImATeapot extends Base {
120
+ declare class ImATeapotError extends BaseError {
121
121
  constructor(msg?: string);
122
122
  }
123
- declare class MisdirectedRequest extends Base {
123
+ declare class MisdirectedRequestError extends BaseError {
124
124
  constructor(msg?: string);
125
125
  }
126
- declare class UnprocessableEntity extends Base {
126
+ declare class UnprocessableEntityError extends BaseError {
127
127
  constructor(msg?: string);
128
128
  }
129
- declare class Locked extends Base {
129
+ declare class LockedError extends BaseError {
130
130
  constructor(msg?: string);
131
131
  }
132
- declare class FailedDependency extends Base {
132
+ declare class FailedDependencyError extends BaseError {
133
133
  constructor(msg?: string);
134
134
  }
135
- declare class TooEarly extends Base {
135
+ declare class TooEarlyError extends BaseError {
136
136
  constructor(msg?: string);
137
137
  }
138
- declare class UpgradeRequired extends Base {
138
+ declare class UpgradeRequiredError extends BaseError {
139
139
  constructor(msg?: string);
140
140
  }
141
- declare class PreconditionRequired extends Base {
141
+ declare class PreconditionRequiredError extends BaseError {
142
142
  constructor(msg?: string);
143
143
  }
144
- declare class TooManyRequests extends Base {
144
+ declare class TooManyRequestsError extends BaseError {
145
145
  constructor(msg?: string);
146
146
  }
147
- declare class RequestHeaderFieldsTooLarge extends Base {
147
+ declare class RequestHeaderFieldsTooLargeError extends BaseError {
148
148
  constructor(msg?: string);
149
149
  }
150
- declare class UnavailableForLegalReasons extends Base {
150
+ declare class UnavailableForLegalReasonsError extends BaseError {
151
151
  constructor(msg?: string);
152
152
  }
153
- declare class InternalServerError extends Base {
153
+ declare class InternalServerError extends BaseError {
154
154
  constructor(msg?: string);
155
155
  }
156
- declare class NotImplemented extends Base {
156
+ declare class NotImplementedError extends BaseError {
157
157
  constructor(msg?: string);
158
158
  }
159
- declare class BadGateway extends Base {
159
+ declare class BadGatewayError extends BaseError {
160
160
  constructor(msg?: string);
161
161
  }
162
- declare class ServiceUnavailable extends Base {
162
+ declare class ServiceUnavailableError extends BaseError {
163
163
  constructor(msg?: string);
164
164
  }
165
- declare class GatewayTimeout extends Base {
165
+ declare class GatewayTimeoutError extends BaseError {
166
166
  constructor(msg?: string);
167
167
  }
168
- declare class HTTPVersionNotSupported extends Base {
168
+ declare class HTTPVersionNotSupportedError extends BaseError {
169
169
  constructor(msg?: string);
170
170
  }
171
- declare class VariantAlsoNegotiates extends Base {
171
+ declare class VariantAlsoNegotiatesError extends BaseError {
172
172
  constructor(msg?: string);
173
173
  }
174
- declare class InsufficientStorage extends Base {
174
+ declare class InsufficientStorageError extends BaseError {
175
175
  constructor(msg?: string);
176
176
  }
177
- declare class LoopDetected extends Base {
177
+ declare class LoopDetectedError extends BaseError {
178
178
  constructor(msg?: string);
179
179
  }
180
- declare class NotExtended extends Base {
180
+ declare class NotExtendedError extends BaseError {
181
181
  constructor(msg?: string);
182
182
  }
183
- declare class NetworkAuthenticationRequired extends Base {
183
+ declare class NetworkAuthenticationRequiredError extends BaseError {
184
184
  constructor(msg?: string);
185
185
  }
186
186
 
187
- type error_BadGateway = BadGateway;
188
- declare const error_BadGateway: typeof BadGateway;
189
- type error_BadRequest = BadRequest;
190
- declare const error_BadRequest: typeof BadRequest;
191
- type error_Base = Base;
192
- declare const error_Base: typeof Base;
193
- type error_Conflict = Conflict;
194
- declare const error_Conflict: typeof Conflict;
195
- type error_ContentTooLarge = ContentTooLarge;
196
- declare const error_ContentTooLarge: typeof ContentTooLarge;
197
- type error_ExpectationFailed = ExpectationFailed;
198
- declare const error_ExpectationFailed: typeof ExpectationFailed;
199
- type error_FailedDependency = FailedDependency;
200
- declare const error_FailedDependency: typeof FailedDependency;
201
- type error_Forbidden = Forbidden;
202
- declare const error_Forbidden: typeof Forbidden;
203
- type error_GatewayTimeout = GatewayTimeout;
204
- declare const error_GatewayTimeout: typeof GatewayTimeout;
205
- type error_Gone = Gone;
206
- declare const error_Gone: typeof Gone;
207
- type error_HTTPVersionNotSupported = HTTPVersionNotSupported;
208
- declare const error_HTTPVersionNotSupported: typeof HTTPVersionNotSupported;
209
- type error_ImATeapot = ImATeapot;
210
- declare const error_ImATeapot: typeof ImATeapot;
211
- type error_InsufficientStorage = InsufficientStorage;
212
- declare const error_InsufficientStorage: typeof InsufficientStorage;
213
- type error_InternalServerError = InternalServerError;
214
- declare const error_InternalServerError: typeof InternalServerError;
215
- type error_LengthRequired = LengthRequired;
216
- declare const error_LengthRequired: typeof LengthRequired;
217
- type error_Locked = Locked;
218
- declare const error_Locked: typeof Locked;
219
- type error_LoopDetected = LoopDetected;
220
- declare const error_LoopDetected: typeof LoopDetected;
221
- type error_MethodNotAllowed = MethodNotAllowed;
222
- declare const error_MethodNotAllowed: typeof MethodNotAllowed;
223
- type error_MisdirectedRequest = MisdirectedRequest;
224
- declare const error_MisdirectedRequest: typeof MisdirectedRequest;
225
- type error_NetworkAuthenticationRequired = NetworkAuthenticationRequired;
226
- declare const error_NetworkAuthenticationRequired: typeof NetworkAuthenticationRequired;
227
- type error_NotAcceptable = NotAcceptable;
228
- declare const error_NotAcceptable: typeof NotAcceptable;
229
- type error_NotExtended = NotExtended;
230
- declare const error_NotExtended: typeof NotExtended;
231
- type error_NotFound = NotFound;
232
- declare const error_NotFound: typeof NotFound;
233
- type error_NotImplemented = NotImplemented;
234
- declare const error_NotImplemented: typeof NotImplemented;
235
- type error_PaymentRequired = PaymentRequired;
236
- declare const error_PaymentRequired: typeof PaymentRequired;
237
- type error_PreconditionFailed = PreconditionFailed;
238
- declare const error_PreconditionFailed: typeof PreconditionFailed;
239
- type error_PreconditionRequired = PreconditionRequired;
240
- declare const error_PreconditionRequired: typeof PreconditionRequired;
241
- type error_ProxyAuthenticationRequired = ProxyAuthenticationRequired;
242
- declare const error_ProxyAuthenticationRequired: typeof ProxyAuthenticationRequired;
243
- type error_RangeNotSatisfiable = RangeNotSatisfiable;
244
- declare const error_RangeNotSatisfiable: typeof RangeNotSatisfiable;
245
- type error_RequestHeaderFieldsTooLarge = RequestHeaderFieldsTooLarge;
246
- declare const error_RequestHeaderFieldsTooLarge: typeof RequestHeaderFieldsTooLarge;
247
- type error_RequestTimeout = RequestTimeout;
248
- declare const error_RequestTimeout: typeof RequestTimeout;
249
- type error_ServiceUnavailable = ServiceUnavailable;
250
- declare const error_ServiceUnavailable: typeof ServiceUnavailable;
251
- type error_TooEarly = TooEarly;
252
- declare const error_TooEarly: typeof TooEarly;
253
- type error_TooManyRequests = TooManyRequests;
254
- declare const error_TooManyRequests: typeof TooManyRequests;
255
- type error_URITooLong = URITooLong;
256
- declare const error_URITooLong: typeof URITooLong;
257
- type error_Unauthorized = Unauthorized;
258
- declare const error_Unauthorized: typeof Unauthorized;
259
- type error_UnavailableForLegalReasons = UnavailableForLegalReasons;
260
- declare const error_UnavailableForLegalReasons: typeof UnavailableForLegalReasons;
261
- type error_UnprocessableEntity = UnprocessableEntity;
262
- declare const error_UnprocessableEntity: typeof UnprocessableEntity;
263
- type error_UnsupportedMediaType = UnsupportedMediaType;
264
- declare const error_UnsupportedMediaType: typeof UnsupportedMediaType;
265
- type error_UpgradeRequired = UpgradeRequired;
266
- declare const error_UpgradeRequired: typeof UpgradeRequired;
267
- type error_VariantAlsoNegotiates = VariantAlsoNegotiates;
268
- declare const error_VariantAlsoNegotiates: typeof VariantAlsoNegotiates;
269
- declare namespace error {
270
- 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
- }
272
-
273
- export { type App, AppRole, type EntityIndexManifest, EntityModel, type EntityModelOptions, EntitySchema, type EntryPoint, EventHandler, Filter, HydratedDocument, InferInterface, InsertDocument, Router, _default as cbor, entityModel, error };
187
+ export { type App, AppRole, BadGatewayError, BadRequestError, BaseError, ConflictError, ContentTooLargeError, type EntityIndexManifest, EntityModel, type EntityModelOptions, EntitySchema, type EntryPoint, EventHandler, ExpectationFailedError, FailedDependencyError, Filter, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, HydratedDocument, ImATeapotError, InferInterface, InsertDocument, InsufficientStorageError, InternalServerError, 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 S=Object.defineProperty;var C=(r,t)=>{for(var s in t)S(r,s,{get:t[s],enumerable:true});};var ee={encode(r){return o.encode(r)},decode(r){return o.decode(r)}};function te(r){return new i(r)}var i=class{constructor(t){this.definition=t;}},p=class{constructor(t){}get shape(){return {}}};function re(r,t,s){return new c(r,t,s)}var c=class{constructor(t,s,oe){this.name=t;this.schemaDef=s;this.options=oe;this.schema=new p(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 $={};C($,{BadGateway:()=>V,BadRequest:()=>l,Base:()=>n,Conflict:()=>I,ContentTooLarge:()=>q,ExpectationFailed:()=>M,FailedDependency:()=>w,Forbidden:()=>y,GatewayTimeout:()=>G,Gone:()=>v,HTTPVersionNotSupported:()=>z,ImATeapot:()=>O,InsufficientStorage:()=>W,InternalServerError:()=>L,LengthRequired:()=>b,Locked:()=>k,LoopDetected:()=>X,MethodNotAllowed:()=>g,MisdirectedRequest:()=>E,NetworkAuthenticationRequired:()=>Z,NotAcceptable:()=>f,NotExtended:()=>Y,NotFound:()=>x,NotImplemented:()=>B,PaymentRequired:()=>m,PreconditionFailed:()=>_,PreconditionRequired:()=>U,ProxyAuthenticationRequired:()=>h,RangeNotSatisfiable:()=>T,RequestHeaderFieldsTooLarge:()=>N,RequestTimeout:()=>R,ServiceUnavailable:()=>K,TooEarly:()=>F,TooManyRequests:()=>Q,URITooLong:()=>A,Unauthorized:()=>u,UnavailableForLegalReasons:()=>j,UnprocessableEntity:()=>D,UnsupportedMediaType:()=>P,UpgradeRequired:()=>H,VariantAlsoNegotiates:()=>J});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});}},x=class extends n{constructor(t){super({status:404,code:"not_found",msg:t});}},g=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});}},v=class extends n{constructor(t){super({status:410,code:"gone",msg:t});}},b=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});}},A=class extends n{constructor(t){super({status:414,code:"uri_too_long",msg:t});}},P=class extends n{constructor(t){super({status:415,code:"unsupported_media_type",msg:t});}},T=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});}},O=class extends n{constructor(t){super({status:418,code:"im_a_teapot",msg:t});}},E=class extends n{constructor(t){super({status:421,code:"misdirected_request",msg:t});}},D=class extends n{constructor(t){super({status:422,code:"unprocessable_entity",msg:t});}},k=class extends n{constructor(t){super({status:423,code:"locked",msg:t});}},w=class extends n{constructor(t){super({status:424,code:"failed_dependency",msg:t});}},F=class extends n{constructor(t){super({status:425,code:"too_early",msg:t});}},H=class extends n{constructor(t){super({status:426,code:"upgrade_required",msg:t});}},U=class extends n{constructor(t){super({status:428,code:"precondition_required",msg:t});}},Q=class extends n{constructor(t){super({status:429,code:"too_many_requests",msg:t});}},N=class extends n{constructor(t){super({status:431,code:"request_header_fields_too_large",msg:t});}},j=class extends n{constructor(t){super({status:451,code:"unavailable_for_legal_reasons",msg:t});}},L=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});}},K=class extends n{constructor(t){super({status:503,code:"service_unavailable",msg:t});}},G=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 a={get instance(){return globalThis.__M1CRO__.internals}};var ne={fromId(r){return a.instance.providerFromId(r)}};var se={parse(r){return a.instance.parseAppId(r)}};export{se as AppId,c as EntityModel,i as EntitySchema,ne as Provider,d as StatusCode,ee as cbor,re as entityModel,te as entitySchema,$ as error};
1
+ import*as o from'cbor2';var $={encode(r){return o.encode(r)},decode(r){return o.decode(r)}};function S(r){return new i(r)}var i=class{constructor(t){this.definition=t;}},p=class{constructor(t){}get shape(){return {}}};function C(r,t,s){return new a(r,t,s)}var a=class{constructor(t,s,re){this.name=t;this.schemaDef=s;this.options=re;this.schema=new p(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 c={get instance(){return globalThis.__M1CRO__.internals}};var ee={fromId(r){return c.instance.providerFromId(r)}};var te={parse(r){return c.instance.parseAppId(r)}};export{te as AppId,V as BadGatewayError,l as BadRequestError,n as BaseError,I as ConflictError,q as ContentTooLargeError,a as EntityModel,i as EntitySchema,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 InternalServerError,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
- } ? false : true;
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];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m1cro/server-sdk",
3
- "version": "0.1.1-beta.16",
3
+ "version": "0.1.1-beta.18",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"