@m1cro/server-sdk 1.0.0-beta.7 → 1.0.0-beta.9

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/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
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-C9FWY5RV.js';
2
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-C9FWY5RV.js';
3
+ import util from 'node:util';
3
4
 
4
5
  declare function entityModel<S extends EntitySchema<any>>(name: string, schemaDef: S, options?: EntityModelOptions<S>): EntityModel<S>;
5
6
  interface EntityModelRegistration {
@@ -26,7 +27,7 @@ declare class EntityModel<S extends EntitySchema<any>> implements EntityModelReg
26
27
  }
27
28
  interface EntityModelOptions<S extends EntitySchema<any>> {
28
29
  indexes?: EntityIndexManifest<S>[];
29
- scoped?: boolean;
30
+ global?: boolean;
30
31
  }
31
32
  interface EntityIndexManifest<S extends EntitySchema<any>> {
32
33
  fields: Array<keyof GeneratedFields | keyof S['definition']>;
@@ -52,7 +53,7 @@ interface ErrorPayload {
52
53
  msg?: string | undefined;
53
54
  }
54
55
  declare class BaseError extends Error {
55
- protected payload: ErrorPayload;
56
+ payload: ErrorPayload;
56
57
  constructor(status: number, code: string, msg?: string);
57
58
  get status(): number;
58
59
  set status(status: number);
@@ -60,6 +61,11 @@ declare class BaseError extends Error {
60
61
  set code(code: string);
61
62
  get msg(): string | undefined;
62
63
  set msg(msg: string | undefined);
64
+ [util.inspect.custom](): {
65
+ status: number;
66
+ code: string;
67
+ msg: string | undefined;
68
+ };
63
69
  }
64
70
  declare class BadRequestError extends BaseError {
65
71
  constructor(msg?: string);
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- function Z(t){return new i(t)}var i=class{constructor(r){this.definition=r;}definition},s=class{constructor(r){}get shape(){return {}}};function $(t,r,o){return new p(t,r,o)}var p=class{constructor(r,o,a){this.name=r;this.schemaDef=o;this.options=a;this.schema=new s(o);}name;schemaDef;options;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 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(r,o,a){super(a),this.payload={status:r,code:o,msg:a};}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;}[Symbol.for("nodejs.util.inspect.custom")](){return {status:this.status,code:this.code,msg:this.msg}}},l=class extends n{constructor(r){super(400,"bad_request",r);}},d=class extends n{constructor(r){super(401,"unauthorized",r);}},y=class extends n{constructor(r){super(402,"payment_required",r);}},u=class extends n{constructor(r){super(403,"forbidden",r);}},m=class extends n{constructor(r){super(404,"not_found",r);}},x=class extends n{constructor(r){super(405,"method_not_allowed",r);}},g=class extends n{constructor(r){super(406,"not_acceptable",r);}},f=class extends n{constructor(r){super(407,"proxy_authentication_required",r);}},h=class extends n{constructor(r){super(408,"request_timeout",r);}},R=class extends n{constructor(r){super(409,"conflict",r);}},b=class extends n{constructor(r){super(410,"gone",r);}},I=class extends n{constructor(r){super(411,"length_required",r);}},T=class extends n{constructor(r){super(412,"precondition_failed",r);}},v=class extends n{constructor(r){super(413,"content_too_large",r);}},_=class extends n{constructor(r){super(414,"uri_too_long",r);}},q=class extends n{constructor(r){super(415,"unsupported_media_type",r);}},P=class extends n{constructor(r){super(416,"range_not_satisfiable",r);}},E=class extends n{constructor(r){super(417,"expectation_failed",r);}},A=class extends n{constructor(r){super(418,"im_a_teapot",r);}},M=class extends n{constructor(r){super(421,"misdirected_request",r);}},O=class extends n{constructor(r){super(422,"unprocessable_entity",r);}},w=class extends n{constructor(r){super(423,"locked",r);}},D=class extends n{constructor(r){super(424,"failed_dependency",r);}},F=class extends n{constructor(r){super(425,"too_early",r);}},U=class extends n{constructor(r){super(426,"upgrade_required",r);}},k=class extends n{constructor(r){super(428,"precondition_required",r);}},H=class extends n{constructor(r){super(429,"too_many_requests",r);}},N=class extends n{constructor(r){super(431,"request_header_fields_too_large",r);}},L=class extends n{constructor(r){super(451,"unavailable_for_legal_reasons",r);}},Q=class extends n{constructor(r){super(500,"internal_server_error",r);}},B=class extends n{constructor(r){super(501,"not_implemented",r);}},j=class extends n{constructor(r){super(502,"bad_gateway",r);}},G=class extends n{constructor(r){super(503,"service_unavailable",r);}},V=class extends n{constructor(r){super(504,"gateway_timeout",r);}},K=class extends n{constructor(r){super(505,"http_version_not_supported",r);}},z=class extends n{constructor(r){super(506,"variant_also_negotiates",r);}},J=class extends n{constructor(r){super(507,"insufficient_storage",r);}},W=class extends n{constructor(r){super(508,"loop_detected",r);}},X=class extends n{constructor(r){super(510,"not_extended",r);}},Y=class extends n{constructor(r){super(511,"network_authentication_required",r);}};var S={parse(t){return Bridge.utils.parseAppId(t)}};export{S as AppId,j as BadGatewayError,l as BadRequestError,n as BaseError,R as ConflictError,v 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,_ as URITooLongError,d as UnauthorizedError,L as UnavailableForLegalReasonsError,O as UnprocessableEntityError,q as UnsupportedMediaTypeError,U as UpgradeRequiredError,z as VariantAlsoNegotiatesError,$ as entityModel,Z as entitySchema};
1
+ import S from'util';function Z(t){return new i(t)}var i=class{constructor(r){this.definition=r;}definition},s=class{constructor(r){}get shape(){return {}}};function $(t,r,o){return new p(t,r,o)}var p=class{constructor(r,o,a){this.name=r;this.schemaDef=o;this.options=a;this.schema=new s(o);}name;schemaDef;options;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 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(r,o,a){super(a||o),this.payload={status:r,code:o,msg:a};}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;}[S.inspect.custom](){return {status:this.status,code:this.code,msg:this.msg}}},l=class extends n{constructor(r){super(400,"bad_request",r);}},d=class extends n{constructor(r){super(401,"unauthorized",r);}},y=class extends n{constructor(r){super(402,"payment_required",r);}},u=class extends n{constructor(r){super(403,"forbidden",r);}},m=class extends n{constructor(r){super(404,"not_found",r);}},x=class extends n{constructor(r){super(405,"method_not_allowed",r);}},g=class extends n{constructor(r){super(406,"not_acceptable",r);}},f=class extends n{constructor(r){super(407,"proxy_authentication_required",r);}},h=class extends n{constructor(r){super(408,"request_timeout",r);}},R=class extends n{constructor(r){super(409,"conflict",r);}},b=class extends n{constructor(r){super(410,"gone",r);}},I=class extends n{constructor(r){super(411,"length_required",r);}},T=class extends n{constructor(r){super(412,"precondition_failed",r);}},v=class extends n{constructor(r){super(413,"content_too_large",r);}},_=class extends n{constructor(r){super(414,"uri_too_long",r);}},q=class extends n{constructor(r){super(415,"unsupported_media_type",r);}},P=class extends n{constructor(r){super(416,"range_not_satisfiable",r);}},E=class extends n{constructor(r){super(417,"expectation_failed",r);}},A=class extends n{constructor(r){super(418,"im_a_teapot",r);}},M=class extends n{constructor(r){super(421,"misdirected_request",r);}},O=class extends n{constructor(r){super(422,"unprocessable_entity",r);}},w=class extends n{constructor(r){super(423,"locked",r);}},D=class extends n{constructor(r){super(424,"failed_dependency",r);}},F=class extends n{constructor(r){super(425,"too_early",r);}},U=class extends n{constructor(r){super(426,"upgrade_required",r);}},k=class extends n{constructor(r){super(428,"precondition_required",r);}},H=class extends n{constructor(r){super(429,"too_many_requests",r);}},N=class extends n{constructor(r){super(431,"request_header_fields_too_large",r);}},L=class extends n{constructor(r){super(451,"unavailable_for_legal_reasons",r);}},Q=class extends n{constructor(r){super(500,"internal_server_error",r);}},B=class extends n{constructor(r){super(501,"not_implemented",r);}},j=class extends n{constructor(r){super(502,"bad_gateway",r);}},G=class extends n{constructor(r){super(503,"service_unavailable",r);}},V=class extends n{constructor(r){super(504,"gateway_timeout",r);}},K=class extends n{constructor(r){super(505,"http_version_not_supported",r);}},z=class extends n{constructor(r){super(506,"variant_also_negotiates",r);}},J=class extends n{constructor(r){super(507,"insufficient_storage",r);}},W=class extends n{constructor(r){super(508,"loop_detected",r);}},X=class extends n{constructor(r){super(510,"not_extended",r);}},Y=class extends n{constructor(r){super(511,"network_authentication_required",r);}};var C={parse(t){return Bridge.utils.parseAppId(t)}};export{C as AppId,j as BadGatewayError,l as BadRequestError,n as BaseError,R as ConflictError,v 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,_ as URITooLongError,d as UnauthorizedError,L as UnavailableForLegalReasonsError,O as UnprocessableEntityError,q as UnsupportedMediaTypeError,U as UpgradeRequiredError,z as VariantAlsoNegotiatesError,$ as entityModel,Z as entitySchema};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m1cro/server-sdk",
3
- "version": "1.0.0-beta.7",
3
+ "version": "1.0.0-beta.9",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -36,7 +36,7 @@
36
36
  "devDependencies": {
37
37
  "@eslint/js": "^9.39.2",
38
38
  "@stylistic/eslint-plugin": "^5.7.1",
39
- "@types/node": "^25.3.0",
39
+ "@types/node": "^25.5.2",
40
40
  "eslint": "^9.39.2",
41
41
  "eslint-config-prettier": "^10.1.8",
42
42
  "eslint-plugin-prettier": "^5.5.5",