@m1cro/server-sdk 1.0.0-beta.2 → 1.0.0-beta.4
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 } 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-CzatYypO.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-CzatYypO.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>;
|
|
@@ -58,10 +58,13 @@ interface ErrorPayload {
|
|
|
58
58
|
}
|
|
59
59
|
declare class BaseError extends Error {
|
|
60
60
|
protected payload: ErrorPayload;
|
|
61
|
-
constructor(
|
|
62
|
-
status(
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
constructor(status: number, code: string, msg?: string);
|
|
62
|
+
get status(): number;
|
|
63
|
+
set status(status: number);
|
|
64
|
+
get code(): string;
|
|
65
|
+
set code(code: string);
|
|
66
|
+
get msg(): string | undefined;
|
|
67
|
+
set msg(msg: string | undefined);
|
|
65
68
|
}
|
|
66
69
|
declare class BadRequestError extends BaseError {
|
|
67
70
|
constructor(msg?: string);
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as
|
|
1
|
+
import*as i from'cbor2';var S={encode(t){return i.encode(t)},decode(t){return i.decode(t)}};function C(t){return new s(t)}var s=class{constructor(r){this.definition=r;}},p=class{constructor(r){}get shape(){return {}}};function ee(t,r,o){return new a(t,r,o)}var a=class{constructor(r,o,c){this.name=r;this.schemaDef=o;this.options=c;this.schema=new p(o);}schema;entity(){return globalThis.Bridge.entity(this.name)}find(r){return this.entity().find(r)}findOne(r){return this.entity().findOne(r)}insert(r){return this.entity().insert(r)}insertOne(r){return this.entity().insertOne(r)}update(r,o){return this.entity().update(r,o)}updateOne(r,o){return this.entity().updateOne(r,o)}remove(r){return this.entity().remove(r)}removeOne(r){return this.entity().removeOne(r)}};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{payload;constructor(r,o,c){super(c),this.payload={status:r,code:o,msg:c};}get status(){return this.payload.status}set status(r){this.payload.status=r;}get code(){return this.payload.code}set code(r){this.payload.code=r;}get msg(){return this.payload.msg}set msg(r){this.payload.msg=r;}},l=class extends n{constructor(r){super(400,"bad_request",r);}},y=class extends n{constructor(r){super(401,"unauthorized",r);}},u=class extends n{constructor(r){super(402,"payment_required",r);}},m=class extends n{constructor(r){super(403,"forbidden",r);}},x=class extends n{constructor(r){super(404,"not_found",r);}},g=class extends n{constructor(r){super(405,"method_not_allowed",r);}},f=class extends n{constructor(r){super(406,"not_acceptable",r);}},h=class extends n{constructor(r){super(407,"proxy_authentication_required",r);}},R=class extends n{constructor(r){super(408,"request_timeout",r);}},b=class extends n{constructor(r){super(409,"conflict",r);}},I=class extends n{constructor(r){super(410,"gone",r);}},T=class extends n{constructor(r){super(411,"length_required",r);}},_=class extends n{constructor(r){super(412,"precondition_failed",r);}},v=class extends n{constructor(r){super(413,"content_too_large",r);}},q=class extends n{constructor(r){super(414,"uri_too_long",r);}},P=class extends n{constructor(r){super(415,"unsupported_media_type",r);}},A=class extends n{constructor(r){super(416,"range_not_satisfiable",r);}},E=class extends n{constructor(r){super(417,"expectation_failed",r);}},M=class extends n{constructor(r){super(418,"im_a_teapot",r);}},O=class extends n{constructor(r){super(421,"misdirected_request",r);}},w=class extends n{constructor(r){super(422,"unprocessable_entity",r);}},k=class extends n{constructor(r){super(423,"locked",r);}},D=class extends n{constructor(r){super(424,"failed_dependency",r);}},U=class extends n{constructor(r){super(425,"too_early",r);}},F=class extends n{constructor(r){super(426,"upgrade_required",r);}},H=class extends n{constructor(r){super(428,"precondition_required",r);}},N=class extends n{constructor(r){super(429,"too_many_requests",r);}},L=class extends n{constructor(r){super(431,"request_header_fields_too_large",r);}},Q=class extends n{constructor(r){super(451,"unavailable_for_legal_reasons",r);}},B=class extends n{constructor(r){super(500,"internal_server_error",r);}},j=class extends n{constructor(r){super(501,"not_implemented",r);}},G=class extends n{constructor(r){super(502,"bad_gateway",r);}},V=class extends n{constructor(r){super(503,"service_unavailable",r);}},K=class extends n{constructor(r){super(504,"gateway_timeout",r);}},z=class extends n{constructor(r){super(505,"http_version_not_supported",r);}},J=class extends n{constructor(r){super(506,"variant_also_negotiates",r);}},W=class extends n{constructor(r){super(507,"insufficient_storage",r);}},X=class extends n{constructor(r){super(508,"loop_detected",r);}},Y=class extends n{constructor(r){super(510,"not_extended",r);}},Z=class extends n{constructor(r){super(511,"network_authentication_required",r);}};var $={get instance(){return globalThis.__M1CRO__.internals}};var re={parse(t){return $.instance.parseAppId(t)}};export{re as AppId,G as BadGatewayError,l as BadRequestError,n as BaseError,b as ConflictError,v as ContentTooLargeError,a as EntityModel,s as EntitySchema,E as ExpectationFailedError,D as FailedDependencyError,m as ForbiddenError,K as GatewayTimeoutError,I as GoneError,z as HTTPVersionNotSupportedError,M as ImATeapotError,W as InsufficientStorageError,B as InternalServerError,T as LengthRequiredError,k as LockedError,X as LoopDetectedError,g as MethodNotAllowedError,O as MisdirectedRequestError,Z as NetworkAuthenticationRequiredError,f as NotAcceptableError,Y as NotExtendedError,x as NotFoundError,j as NotImplementedError,u as PaymentRequiredError,_ as PreconditionFailedError,H as PreconditionRequiredError,h as ProxyAuthenticationRequiredError,A as RangeNotSatisfiableError,L as RequestHeaderFieldsTooLargeError,R as RequestTimeoutError,V as ServiceUnavailableError,d as StatusCode,U as TooEarlyError,N as TooManyRequestsError,q as URITooLongError,y as UnauthorizedError,Q as UnavailableForLegalReasonsError,w as UnprocessableEntityError,P as UnsupportedMediaTypeError,F as UpgradeRequiredError,J as VariantAlsoNegotiatesError,S as cbor,ee as entityModel,C as entitySchema};
|
|
@@ -189,7 +189,7 @@ interface Artifacts {
|
|
|
189
189
|
get auth(): Auth | undefined;
|
|
190
190
|
}
|
|
191
191
|
|
|
192
|
-
type Method = '
|
|
192
|
+
type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
193
193
|
declare enum StatusCode {
|
|
194
194
|
Continue = 100,
|
|
195
195
|
SwitchingProtocols = 101,
|
|
@@ -343,6 +343,10 @@ interface Argon2Options {
|
|
|
343
343
|
outputLen?: number;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
interface EventEmitter {
|
|
347
|
+
publish<T extends object>(event: string, payload: T, visibility?: Visibility[]): Promise<void>;
|
|
348
|
+
}
|
|
349
|
+
|
|
346
350
|
interface SetOptions {
|
|
347
351
|
ttl?: number;
|
|
348
352
|
existenceCheck?: 'nx' | 'xx';
|
|
@@ -366,7 +370,7 @@ interface Call extends RequestBuilder, PromiseLike<Response> {
|
|
|
366
370
|
}
|
|
367
371
|
|
|
368
372
|
interface Providers {
|
|
369
|
-
list(group: string): Provider[]
|
|
373
|
+
list(group: string): Promise<Provider[]>;
|
|
370
374
|
createFromId(id: string): Provider;
|
|
371
375
|
}
|
|
372
376
|
interface Provider {
|
|
@@ -394,8 +398,8 @@ interface Bridge {
|
|
|
394
398
|
get kv(): KeyValueStore;
|
|
395
399
|
get sse(): SSE;
|
|
396
400
|
get crypto(): Crypto;
|
|
401
|
+
get event(): EventEmitter;
|
|
397
402
|
entity<T extends object>(name: string): Entity<T>;
|
|
398
|
-
publish<T extends object>(event: string, payload: T, visibility?: Visibility[]): void;
|
|
399
403
|
}
|
|
400
404
|
|
|
401
405
|
declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "none"];
|