@m1cro/server-sdk 1.0.0-beta.13 → 1.0.0-beta.14
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
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, J as JobHandler, k as JobOptions } from './log-
|
|
2
|
-
export { l as AppId, m as Artifacts, n as Auth, B as Bridge, o as Entity, p as InferSchema, L as LogLevel, M as Method, q as Middleware, N as Namespace, P as Provider, r as Providers, s as Request, t as RequestBuilder, u as RequestHandler, v as Response, w as ResponseBuilder, x as RouteOptions, S as Sorting, y as StatusCode, z as Subject, T as Tenant, V as Visibility, D 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, J as JobHandler, k as JobOptions } from './log-BU4jwbWP.js';
|
|
2
|
+
export { l as AppId, m as Artifacts, n as Auth, B as Bridge, o as Entity, p as InferSchema, L as LogLevel, M as Method, q as Middleware, N as Namespace, P as Provider, r as Providers, s as Request, t as RequestBuilder, u as RequestHandler, v as Response, w as ResponseBuilder, x as RouteOptions, S as Sorting, y as StatusCode, z as Subject, T as Tenant, V as Visibility, D as entitySchema } from './log-BU4jwbWP.js';
|
|
3
3
|
import util from 'node:util';
|
|
4
4
|
import 'node:stream';
|
|
5
5
|
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import S from'util';function Z(
|
|
1
|
+
import S from'util';function Z(r){return new i(r)}var i=class{constructor(t){this.definition=t;}definition},s=class{constructor(t){}get shape(){return {}}};function $(r,t,o){return new p(r,t,o)}var p=class{constructor(t,o,a){this.name=t;this.schemaDef=o;this.options=a;this.schema=new s(o);}name;schemaDef;options;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,o){return this.entity().update(t,o)}updateOne(t,o){return this.entity().updateOne(t,o)}remove(t){return this.entity().remove(t)}removeOne(t){return this.entity().removeOne(t)}};var c=(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))(c||{});var n=class extends Error{payload;constructor(t,o,a){super(a||o),this.payload={status:t,code:o,msg:a};}get status(){return this.payload.status}set status(t){this.payload.status=t;}get code(){return this.payload.code}set code(t){this.payload.code=t;}get msg(){return this.payload.msg}set msg(t){this.payload.msg=t;}[S.inspect.custom](){return {status:this.status,code:this.code,msg:this.msg}}},l=class extends n{constructor(t){super(400,"bad_request",t);}},d=class extends n{constructor(t){super(401,"unauthorized",t);}},y=class extends n{constructor(t){super(402,"payment_required",t);}},u=class extends n{constructor(t){super(403,"forbidden",t);}},m=class extends n{constructor(t){super(404,"not_found",t);}},x=class extends n{constructor(t){super(405,"method_not_allowed",t);}},g=class extends n{constructor(t){super(406,"not_acceptable",t);}},f=class extends n{constructor(t){super(407,"proxy_authentication_required",t);}},h=class extends n{constructor(t){super(408,"request_timeout",t);}},R=class extends n{constructor(t){super(409,"conflict",t);}},b=class extends n{constructor(t){super(410,"gone",t);}},I=class extends n{constructor(t){super(411,"length_required",t);}},T=class extends n{constructor(t){super(412,"precondition_failed",t);}},_=class extends n{constructor(t){super(413,"content_too_large",t);}},q=class extends n{constructor(t){super(414,"uri_too_long",t);}},v=class extends n{constructor(t){super(415,"unsupported_media_type",t);}},P=class extends n{constructor(t){super(416,"range_not_satisfiable",t);}},E=class extends n{constructor(t){super(417,"expectation_failed",t);}},A=class extends n{constructor(t){super(418,"im_a_teapot",t);}},M=class extends n{constructor(t){super(421,"misdirected_request",t);}},O=class extends n{constructor(t){super(422,"unprocessable_entity",t);}},w=class extends n{constructor(t){super(423,"locked",t);}},D=class extends n{constructor(t){super(424,"failed_dependency",t);}},F=class extends n{constructor(t){super(425,"too_early",t);}},U=class extends n{constructor(t){super(426,"upgrade_required",t);}},k=class extends n{constructor(t){super(428,"precondition_required",t);}},H=class extends n{constructor(t){super(429,"too_many_requests",t);}},N=class extends n{constructor(t){super(431,"request_header_fields_too_large",t);}},L=class extends n{constructor(t){super(451,"unavailable_for_legal_reasons",t);}},Q=class extends n{constructor(t){super(500,"internal_server_error",t);}},B=class extends n{constructor(t){super(501,"not_implemented",t);}},j=class extends n{constructor(t){super(502,"bad_gateway",t);}},G=class extends n{constructor(t){super(503,"service_unavailable",t);}},V=class extends n{constructor(t){super(504,"gateway_timeout",t);}},K=class extends n{constructor(t){super(505,"http_version_not_supported",t);}},z=class extends n{constructor(t){super(506,"variant_also_negotiates",t);}},J=class extends n{constructor(t){super(507,"insufficient_storage",t);}},W=class extends n{constructor(t){super(508,"loop_detected",t);}},X=class extends n{constructor(t){super(510,"not_extended",t);}},Y=class extends n{constructor(t){super(511,"network_authentication_required",t);}};var C={parse(r){return Bridge.utils.parseAppId(r)}};export{C as AppId,j as BadGatewayError,l as BadRequestError,n as BaseError,R as ConflictError,_ as ContentTooLargeError,p as EntityModel,i as EntitySchema,E as ExpectationFailedError,D as FailedDependencyError,u as ForbiddenError,V as GatewayTimeoutError,b as GoneError,K as HTTPVersionNotSupportedError,A as ImATeapotError,J as InsufficientStorageError,Q as InternalServerError,I as LengthRequiredError,w as LockedError,W as LoopDetectedError,x as MethodNotAllowedError,M as MisdirectedRequestError,Y as NetworkAuthenticationRequiredError,g as NotAcceptableError,X as NotExtendedError,m as NotFoundError,B as NotImplementedError,y as PaymentRequiredError,T as PreconditionFailedError,k as PreconditionRequiredError,f as ProxyAuthenticationRequiredError,P as RangeNotSatisfiableError,N as RequestHeaderFieldsTooLargeError,h as RequestTimeoutError,G as ServiceUnavailableError,c as StatusCode,F as TooEarlyError,H as TooManyRequestsError,q as URITooLongError,d as UnauthorizedError,L as UnavailableForLegalReasonsError,O as UnprocessableEntityError,v as UnsupportedMediaTypeError,U as UpgradeRequiredError,z as VariantAlsoNegotiatesError,$ as entityModel,Z as entitySchema};
|
|
@@ -180,6 +180,12 @@ interface HookEventMap {
|
|
|
180
180
|
start: [];
|
|
181
181
|
install: [];
|
|
182
182
|
}
|
|
183
|
+
type Source = {
|
|
184
|
+
type: 'external';
|
|
185
|
+
} | {
|
|
186
|
+
type: 'app';
|
|
187
|
+
id: AppId;
|
|
188
|
+
};
|
|
183
189
|
|
|
184
190
|
type EventHandler = (<T>(event: string, data: T) => void | Promise<void>) | ((event: string) => void | Promise<void>);
|
|
185
191
|
interface EventEmitter {
|
|
@@ -287,14 +293,14 @@ interface Request {
|
|
|
287
293
|
get url(): URL;
|
|
288
294
|
get params(): Record<string, string>;
|
|
289
295
|
get headers(): Headers;
|
|
290
|
-
|
|
291
|
-
get bodyStream(): node_stream.Readable;
|
|
296
|
+
get source(): Source;
|
|
292
297
|
cookie(name: string): string | undefined;
|
|
293
298
|
payload<T = any>(): Promise<T>;
|
|
294
299
|
payload<T = any>(type: 'json' | 'cbor'): Promise<T>;
|
|
295
300
|
payload(type: 'bytes'): Promise<Uint8Array>;
|
|
296
301
|
payload(type: 'text'): Promise<string>;
|
|
297
302
|
payload(type?: PayloadType): Promise<unknown>;
|
|
303
|
+
get bodyStream(): node_stream.Readable;
|
|
298
304
|
}
|
|
299
305
|
interface RequestBuilder {
|
|
300
306
|
method(method: Method): this;
|
|
@@ -319,7 +325,6 @@ interface ResponseBuilder {
|
|
|
319
325
|
headers(headers: HeadersInit): this;
|
|
320
326
|
cookie(name: string, cookie?: SetCookie): this;
|
|
321
327
|
payload<T = unknown>(payload: T, type?: PayloadType): this;
|
|
322
|
-
/** Stream a Node.js Readable as the response body. */
|
|
323
328
|
stream(readable: node_stream.Readable): this;
|
|
324
329
|
}
|
|
325
330
|
interface SetCookie {
|