@m1cro/server-sdk 1.0.0-beta.1 → 1.0.0-beta.3
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-B9tjIUd0.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-B9tjIUd0.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>;
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import*as s from'cbor2';var $={encode(r){return s.encode(r)},decode(r){return s.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,o){return new a(r,t,o)}var a=class{constructor(t,o,
|
|
1
|
+
import*as s from'cbor2';var $={encode(r){return s.encode(r)},decode(r){return s.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,o){return new a(r,t,o)}var a=class{constructor(t,o,te){this.name=t;this.schemaDef=o;this.options=te;this.schema=new p(o);}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{constructor(o){super(o.msg);this.payload=o;}status(o){return this.payload.status=o,this}code(o){return this.payload.code=o,this}msg(o){return this.payload.msg=o,this}},d=class extends n{constructor(t){super({status:400,code:"bad_request",msg:t});}},l=class extends n{constructor(t){super({status:401,code:"unauthorized",msg:t});}},u=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});}},m=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});}},g=class extends n{constructor(t){super({status:406,code:"not_acceptable",msg:t});}},f=class extends n{constructor(t){super({status:407,code:"proxy_authentication_required",msg:t});}},h=class extends n{constructor(t){super({status:408,code:"request_timeout",msg:t});}},R=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});}},I=class extends n{constructor(t){super({status:411,code:"length_required",msg:t});}},T=class extends n{constructor(t){super({status:412,code:"precondition_failed",msg:t});}},_=class extends n{constructor(t){super({status:413,code:"content_too_large",msg:t});}},v=class extends n{constructor(t){super({status:414,code:"uri_too_long",msg:t});}},q=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});}},A=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});}},M=class extends n{constructor(t){super({status:421,code:"misdirected_request",msg:t});}},O=class extends n{constructor(t){super({status:422,code:"unprocessable_entity",msg:t});}},w=class extends n{constructor(t){super({status:423,code:"locked",msg:t});}},k=class extends n{constructor(t){super({status:424,code:"failed_dependency",msg:t});}},D=class extends n{constructor(t){super({status:425,code:"too_early",msg:t});}},F=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});}},H=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});}},Q=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});}},j=class extends n{constructor(t){super({status:502,code:"bad_gateway",msg:t});}},V=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});}},K=class extends n{constructor(t){super({status:505,code:"http_version_not_supported",msg:t});}},z=class extends n{constructor(t){super({status:506,code:"variant_also_negotiates",msg:t});}},J=class extends n{constructor(t){super({status:507,code:"insufficient_storage",msg:t});}},W=class extends n{constructor(t){super({status:508,code:"loop_detected",msg:t});}},X=class extends n{constructor(t){super({status:510,code:"not_extended",msg:t});}},Y=class extends n{constructor(t){super({status:511,code:"network_authentication_required",msg:t});}};var Z={get instance(){return globalThis.__M1CRO__.internals}};var ee={parse(r){return Z.instance.parseAppId(r)}};export{ee as AppId,j as BadGatewayError,d as BadRequestError,n as BaseError,R as ConflictError,_ as ContentTooLargeError,a as EntityModel,i as EntitySchema,A as ExpectationFailedError,k as FailedDependencyError,y as ForbiddenError,G as GatewayTimeoutError,b as GoneError,K as HTTPVersionNotSupportedError,E as ImATeapotError,J as InsufficientStorageError,L 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,u as PaymentRequiredError,T as PreconditionFailedError,U as PreconditionRequiredError,f as ProxyAuthenticationRequiredError,P as RangeNotSatisfiableError,N as RequestHeaderFieldsTooLargeError,h as RequestTimeoutError,V as ServiceUnavailableError,c as StatusCode,D as TooEarlyError,H as TooManyRequestsError,v as URITooLongError,l as UnauthorizedError,Q as UnavailableForLegalReasonsError,O as UnprocessableEntityError,q as UnsupportedMediaTypeError,F as UpgradeRequiredError,z as VariantAlsoNegotiatesError,$ as cbor,C as entityModel,S as entitySchema};
|
|
@@ -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';
|
|
@@ -355,7 +359,7 @@ interface KeyValueStore {
|
|
|
355
359
|
}
|
|
356
360
|
|
|
357
361
|
interface RPC {
|
|
358
|
-
call(
|
|
362
|
+
call(method: Method, url: string): Call;
|
|
359
363
|
get(url: string): Call;
|
|
360
364
|
post(url: string): Call;
|
|
361
365
|
put(url: string): Call;
|
|
@@ -366,22 +370,20 @@ 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[]>;
|
|
374
|
+
createFromId(id: string): Provider;
|
|
370
375
|
}
|
|
371
376
|
interface Provider {
|
|
372
377
|
get app(): AppId;
|
|
373
378
|
get group(): string;
|
|
374
379
|
get id(): string;
|
|
375
|
-
call(
|
|
380
|
+
call(method: Method, path: string): Call;
|
|
376
381
|
get(path: string): Call;
|
|
377
382
|
post(path: string): Call;
|
|
378
383
|
put(path: string): Call;
|
|
379
384
|
patch(path: string): Call;
|
|
380
385
|
delete(path: string): Call;
|
|
381
386
|
}
|
|
382
|
-
declare const Provider: {
|
|
383
|
-
fromId(id: string): Provider;
|
|
384
|
-
};
|
|
385
387
|
|
|
386
388
|
interface SSE {
|
|
387
389
|
push<T>(event: T, targets: string[]): Promise<void>;
|
|
@@ -396,11 +398,11 @@ interface Bridge {
|
|
|
396
398
|
get kv(): KeyValueStore;
|
|
397
399
|
get sse(): SSE;
|
|
398
400
|
get crypto(): Crypto;
|
|
401
|
+
get event(): EventEmitter;
|
|
399
402
|
entity<T extends object>(name: string): Entity<T>;
|
|
400
|
-
publish<T extends object>(event: string, payload: T, visibility?: Visibility[]): void;
|
|
401
403
|
}
|
|
402
404
|
|
|
403
405
|
declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "none"];
|
|
404
406
|
type LogLevel = (typeof logLevels)[number];
|
|
405
407
|
|
|
406
|
-
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 };
|
|
408
|
+
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, type 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 };
|