@m1cro/server-sdk 0.1.1-beta.9 → 1.0.0-beta.10
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 +2 -9
- package/dist/index.d.ts +178 -12
- package/dist/index.js +1 -1
- package/dist/{bridge-BD4H31JR.d.ts → log-CAh1biS4.d.ts} +184 -120
- package/package.json +24 -6
package/dist/globals.d.ts
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
|
+
import { B as Bridge, L as LogLevel } from './log-CAh1biS4.js';
|
|
1
2
|
import * as console from 'node:console';
|
|
2
|
-
import { B as Bridge } from './bridge-BD4H31JR.js';
|
|
3
|
-
import 'cookie';
|
|
4
3
|
|
|
5
|
-
declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "none"];
|
|
6
|
-
type LogLevel = (typeof logLevels)[number];
|
|
7
|
-
|
|
8
|
-
interface M1cro {
|
|
9
|
-
bridge: Bridge;
|
|
10
|
-
}
|
|
11
4
|
declare global {
|
|
12
|
-
var
|
|
5
|
+
var Bridge: Bridge;
|
|
13
6
|
interface Console extends console.Console {
|
|
14
7
|
logLevel: LogLevel;
|
|
15
8
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,38 @@
|
|
|
1
|
-
import { R as Router,
|
|
2
|
-
export {
|
|
3
|
-
import
|
|
4
|
-
|
|
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-CAh1biS4.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-CAh1biS4.js';
|
|
3
|
+
import util from 'node:util';
|
|
4
|
+
|
|
5
|
+
declare function entityModel<S extends EntitySchema<any>>(name: string, schemaDef: S, options?: EntityModelOptions<S>): EntityModel<S>;
|
|
6
|
+
interface EntityModelRegistration {
|
|
7
|
+
get name(): string;
|
|
8
|
+
get schema(): {
|
|
9
|
+
get shape(): unknown;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
declare class EntityModel<S extends EntitySchema<any>> implements EntityModelRegistration {
|
|
13
|
+
readonly name: string;
|
|
14
|
+
readonly schemaDef: S;
|
|
15
|
+
readonly options?: EntityModelOptions<S> | undefined;
|
|
16
|
+
schema: CompiledSchema;
|
|
17
|
+
constructor(name: string, schemaDef: S, options?: EntityModelOptions<S> | undefined);
|
|
18
|
+
private entity;
|
|
19
|
+
find(filter?: Filter): FindQuery<HydratedDocument<S>>;
|
|
20
|
+
findOne(filter?: Filter): FindOneQuery<HydratedDocument<S>>;
|
|
21
|
+
insert(docs: InsertDocument<S>[]): InsertQuery<InsertDocument<S>, 'insertedIds'>;
|
|
22
|
+
insertOne(doc: InsertDocument<S>): InsertOneQuery<InsertDocument<S>, 'insertedId'>;
|
|
23
|
+
update(filter: Filter, update: Record<string, unknown>): UpdateQuery<InferInterface<S>, 'affectedRows'>;
|
|
24
|
+
updateOne(filter: Filter, update: Record<string, unknown>): UpdateOneQuery<InferInterface<S>, 'success'>;
|
|
25
|
+
remove(filter: Filter): RemoveQuery<InferInterface<S>, 'affectedRows'>;
|
|
26
|
+
removeOne(filter: Filter): RemoveOneQuery<InferInterface<S>, 'success'>;
|
|
27
|
+
}
|
|
28
|
+
interface EntityModelOptions<S extends EntitySchema<any>> {
|
|
29
|
+
indexes?: EntityIndexManifest<S>[];
|
|
30
|
+
global?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface EntityIndexManifest<S extends EntitySchema<any>> {
|
|
33
|
+
fields: Array<keyof GeneratedFields | keyof S['definition']>;
|
|
34
|
+
unique?: boolean | undefined;
|
|
35
|
+
}
|
|
5
36
|
|
|
6
37
|
type EntryPoint = (app: App) => unknown;
|
|
7
38
|
interface App {
|
|
@@ -12,15 +43,150 @@ interface App {
|
|
|
12
43
|
capabilities(capabilities: {
|
|
13
44
|
[app: string]: string[];
|
|
14
45
|
}): App;
|
|
15
|
-
entity(
|
|
46
|
+
entity(model: EntityModelRegistration): App;
|
|
16
47
|
subscribe(pattern: string, handler: EventHandler): App;
|
|
48
|
+
job(name: string, handler: JobHandler, options?: JobOptions): App;
|
|
17
49
|
}
|
|
18
50
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
declare
|
|
51
|
+
interface ErrorPayload {
|
|
52
|
+
status: number;
|
|
53
|
+
code: string;
|
|
54
|
+
msg?: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
declare class BaseError extends Error {
|
|
57
|
+
payload: ErrorPayload;
|
|
58
|
+
constructor(status: number, code: string, msg?: string);
|
|
59
|
+
get status(): number;
|
|
60
|
+
set status(status: number);
|
|
61
|
+
get code(): string;
|
|
62
|
+
set code(code: string);
|
|
63
|
+
get msg(): string | undefined;
|
|
64
|
+
set msg(msg: string | undefined);
|
|
65
|
+
[util.inspect.custom](): {
|
|
66
|
+
status: number;
|
|
67
|
+
code: string;
|
|
68
|
+
msg: string | undefined;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
declare class BadRequestError extends BaseError {
|
|
72
|
+
constructor(msg?: string);
|
|
73
|
+
}
|
|
74
|
+
declare class UnauthorizedError extends BaseError {
|
|
75
|
+
constructor(msg?: string);
|
|
76
|
+
}
|
|
77
|
+
declare class PaymentRequiredError extends BaseError {
|
|
78
|
+
constructor(msg?: string);
|
|
79
|
+
}
|
|
80
|
+
declare class ForbiddenError extends BaseError {
|
|
81
|
+
constructor(msg?: string);
|
|
82
|
+
}
|
|
83
|
+
declare class NotFoundError extends BaseError {
|
|
84
|
+
constructor(msg?: string);
|
|
85
|
+
}
|
|
86
|
+
declare class MethodNotAllowedError extends BaseError {
|
|
87
|
+
constructor(msg?: string);
|
|
88
|
+
}
|
|
89
|
+
declare class NotAcceptableError extends BaseError {
|
|
90
|
+
constructor(msg?: string);
|
|
91
|
+
}
|
|
92
|
+
declare class ProxyAuthenticationRequiredError extends BaseError {
|
|
93
|
+
constructor(msg?: string);
|
|
94
|
+
}
|
|
95
|
+
declare class RequestTimeoutError extends BaseError {
|
|
96
|
+
constructor(msg?: string);
|
|
97
|
+
}
|
|
98
|
+
declare class ConflictError extends BaseError {
|
|
99
|
+
constructor(msg?: string);
|
|
100
|
+
}
|
|
101
|
+
declare class GoneError extends BaseError {
|
|
102
|
+
constructor(msg?: string);
|
|
103
|
+
}
|
|
104
|
+
declare class LengthRequiredError extends BaseError {
|
|
105
|
+
constructor(msg?: string);
|
|
106
|
+
}
|
|
107
|
+
declare class PreconditionFailedError extends BaseError {
|
|
108
|
+
constructor(msg?: string);
|
|
109
|
+
}
|
|
110
|
+
declare class ContentTooLargeError extends BaseError {
|
|
111
|
+
constructor(msg?: string);
|
|
112
|
+
}
|
|
113
|
+
declare class URITooLongError extends BaseError {
|
|
114
|
+
constructor(msg?: string);
|
|
115
|
+
}
|
|
116
|
+
declare class UnsupportedMediaTypeError extends BaseError {
|
|
117
|
+
constructor(msg?: string);
|
|
118
|
+
}
|
|
119
|
+
declare class RangeNotSatisfiableError extends BaseError {
|
|
120
|
+
constructor(msg?: string);
|
|
121
|
+
}
|
|
122
|
+
declare class ExpectationFailedError extends BaseError {
|
|
123
|
+
constructor(msg?: string);
|
|
124
|
+
}
|
|
125
|
+
declare class ImATeapotError extends BaseError {
|
|
126
|
+
constructor(msg?: string);
|
|
127
|
+
}
|
|
128
|
+
declare class MisdirectedRequestError extends BaseError {
|
|
129
|
+
constructor(msg?: string);
|
|
130
|
+
}
|
|
131
|
+
declare class UnprocessableEntityError extends BaseError {
|
|
132
|
+
constructor(msg?: string);
|
|
133
|
+
}
|
|
134
|
+
declare class LockedError extends BaseError {
|
|
135
|
+
constructor(msg?: string);
|
|
136
|
+
}
|
|
137
|
+
declare class FailedDependencyError extends BaseError {
|
|
138
|
+
constructor(msg?: string);
|
|
139
|
+
}
|
|
140
|
+
declare class TooEarlyError extends BaseError {
|
|
141
|
+
constructor(msg?: string);
|
|
142
|
+
}
|
|
143
|
+
declare class UpgradeRequiredError extends BaseError {
|
|
144
|
+
constructor(msg?: string);
|
|
145
|
+
}
|
|
146
|
+
declare class PreconditionRequiredError extends BaseError {
|
|
147
|
+
constructor(msg?: string);
|
|
148
|
+
}
|
|
149
|
+
declare class TooManyRequestsError extends BaseError {
|
|
150
|
+
constructor(msg?: string);
|
|
151
|
+
}
|
|
152
|
+
declare class RequestHeaderFieldsTooLargeError extends BaseError {
|
|
153
|
+
constructor(msg?: string);
|
|
154
|
+
}
|
|
155
|
+
declare class UnavailableForLegalReasonsError extends BaseError {
|
|
156
|
+
constructor(msg?: string);
|
|
157
|
+
}
|
|
158
|
+
declare class InternalServerError extends BaseError {
|
|
159
|
+
constructor(msg?: string);
|
|
160
|
+
}
|
|
161
|
+
declare class NotImplementedError extends BaseError {
|
|
162
|
+
constructor(msg?: string);
|
|
163
|
+
}
|
|
164
|
+
declare class BadGatewayError extends BaseError {
|
|
165
|
+
constructor(msg?: string);
|
|
166
|
+
}
|
|
167
|
+
declare class ServiceUnavailableError extends BaseError {
|
|
168
|
+
constructor(msg?: string);
|
|
169
|
+
}
|
|
170
|
+
declare class GatewayTimeoutError extends BaseError {
|
|
171
|
+
constructor(msg?: string);
|
|
172
|
+
}
|
|
173
|
+
declare class HTTPVersionNotSupportedError extends BaseError {
|
|
174
|
+
constructor(msg?: string);
|
|
175
|
+
}
|
|
176
|
+
declare class VariantAlsoNegotiatesError extends BaseError {
|
|
177
|
+
constructor(msg?: string);
|
|
178
|
+
}
|
|
179
|
+
declare class InsufficientStorageError extends BaseError {
|
|
180
|
+
constructor(msg?: string);
|
|
181
|
+
}
|
|
182
|
+
declare class LoopDetectedError extends BaseError {
|
|
183
|
+
constructor(msg?: string);
|
|
184
|
+
}
|
|
185
|
+
declare class NotExtendedError extends BaseError {
|
|
186
|
+
constructor(msg?: string);
|
|
187
|
+
}
|
|
188
|
+
declare class NetworkAuthenticationRequiredError extends BaseError {
|
|
189
|
+
constructor(msg?: string);
|
|
190
|
+
}
|
|
25
191
|
|
|
26
|
-
export { type App, AppRole,
|
|
192
|
+
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, JobOptions, 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, entityModel };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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);}},_=class extends n{constructor(r){super(413,"content_too_large",r);}},q=class extends n{constructor(r){super(414,"uri_too_long",r);}},v=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,_ 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};
|
|
@@ -1,91 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
deriveKey(seed: string, length: number): Uint8Array;
|
|
5
|
-
aesGcmEncrypt<T>(data: T): Uint8Array;
|
|
6
|
-
aesGcmDecrypt<T>(data: Uint8Array): T;
|
|
7
|
-
argon2Hash(algorithm: Argon2Algorithm, password: string, options?: Argon2Options): string;
|
|
8
|
-
argon2Verify(algorithm: Argon2Algorithm, password: string, hash: string, options?: Argon2Options): boolean;
|
|
9
|
-
}
|
|
10
|
-
type Argon2Algorithm = 'argon2d' | 'argon2i' | 'argon2id';
|
|
11
|
-
interface Argon2Options {
|
|
12
|
-
mCost?: number;
|
|
13
|
-
tCost?: number;
|
|
14
|
-
pCost?: number;
|
|
15
|
-
outputLen?: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type Record$1<K extends string | number | symbol = string, V = any> = {
|
|
19
|
-
[key in K]: V;
|
|
20
|
-
};
|
|
21
|
-
type Variant<K extends PropertyKey, T extends object> = {
|
|
22
|
-
[P in keyof T]: {
|
|
23
|
-
[Q in K]: P;
|
|
24
|
-
} & T[P] extends infer U ? {
|
|
25
|
-
[Q in keyof U]: U[Q];
|
|
26
|
-
} : never;
|
|
27
|
-
}[keyof T];
|
|
28
|
-
type EventHandler = <T>(event: string, data: T) => void | Promise<void>;
|
|
29
|
-
type Visibility = 'private' | 'platform' | 'vendor' | 'public';
|
|
30
|
-
interface Tenant {
|
|
1
|
+
type Filter = Record<string, unknown>;
|
|
2
|
+
type Sorting$1 = Record<string, 'asc' | 'desc'>;
|
|
3
|
+
type GeneratedFields = {
|
|
31
4
|
id: string;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
interface AppId {
|
|
35
|
-
get name(): string;
|
|
36
|
-
get namespace(): Namespace;
|
|
37
|
-
toString(separator?: string): string;
|
|
38
|
-
}
|
|
39
|
-
declare const AppId: {
|
|
40
|
-
parse(input: string): AppId;
|
|
5
|
+
createdAt: number;
|
|
6
|
+
updatedAt: number;
|
|
41
7
|
};
|
|
42
|
-
type
|
|
43
|
-
|
|
8
|
+
type ReservedKeys = keyof GeneratedFields;
|
|
9
|
+
type HydratedDocument<S extends EntitySchema<any>> = Omit<InferInterface<S>, ReservedKeys> & GeneratedFields;
|
|
10
|
+
type InsertDocument<S extends EntitySchema<any>> = Omit<InferInterface<S>, ReservedKeys> & Partial<GeneratedFields>;
|
|
11
|
+
type ScalarConstructor = StringConstructor | NumberConstructor | BooleanConstructor | DateConstructor | ObjectConstructor;
|
|
12
|
+
type ArraySpec = readonly [FieldSpec];
|
|
13
|
+
type InnerSpec = ScalarConstructor | ArraySpec | SchemaDefinition;
|
|
14
|
+
type FieldSpec = InnerSpec | {
|
|
15
|
+
type: InnerSpec;
|
|
16
|
+
required?: boolean;
|
|
44
17
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
18
|
+
interface SchemaDefinition {
|
|
19
|
+
[key: string]: FieldSpec;
|
|
20
|
+
}
|
|
21
|
+
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;
|
|
22
|
+
type IsOptional<F> = F extends {
|
|
23
|
+
required: false;
|
|
24
|
+
} ? true : false;
|
|
25
|
+
type RequiredKeys<Def extends SchemaDefinition> = {
|
|
26
|
+
[K in keyof Def]-?: IsOptional<Def[K]> extends false ? K : never;
|
|
27
|
+
}[keyof Def];
|
|
28
|
+
type OptionalKeys<Def extends SchemaDefinition> = Exclude<keyof Def, RequiredKeys<Def>>;
|
|
29
|
+
type InferInterface<S extends EntitySchema<any>> = InferSchema<S['definition']>;
|
|
30
|
+
type AssertNoReservedKeys<Def extends SchemaDefinition> = Extract<keyof Def, ReservedKeys> extends never ? Def : never;
|
|
31
|
+
type Unwrap<F> = F extends {
|
|
32
|
+
type: infer I;
|
|
33
|
+
} ? I : F;
|
|
34
|
+
type InferInner<I> = I extends ScalarConstructor ? ConstructorToType<I> : I extends readonly [infer U] ? U extends FieldSpec ? Array<InferField<U>> : never : I extends SchemaDefinition ? InferSchema<I> : never;
|
|
35
|
+
type InferField<F extends FieldSpec> = InferInner<Unwrap<F>>;
|
|
36
|
+
type InferSchema<Def extends SchemaDefinition> = {
|
|
37
|
+
[K in OptionalKeys<Def>]?: InferField<Def[K]> | undefined;
|
|
38
|
+
} & {
|
|
39
|
+
[K in RequiredKeys<Def>]: InferField<Def[K]>;
|
|
51
40
|
};
|
|
52
|
-
interface Auth {
|
|
53
|
-
subject: Subject;
|
|
54
|
-
permissions: Permissions;
|
|
55
|
-
}
|
|
56
|
-
interface Subject {
|
|
57
|
-
id: string;
|
|
58
|
-
email: string;
|
|
59
|
-
roles: string[];
|
|
60
|
-
}
|
|
61
|
-
interface Permissions {
|
|
62
|
-
[key: string]: string[];
|
|
63
|
-
}
|
|
64
|
-
interface HookEventMap {
|
|
65
|
-
start: [];
|
|
66
|
-
install: [];
|
|
67
|
-
}
|
|
68
41
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
42
|
+
declare function entitySchema<const Def extends SchemaDefinition>(def: AssertNoReservedKeys<Def>): EntitySchema<Def>;
|
|
43
|
+
declare class EntitySchema<Def extends SchemaDefinition = SchemaDefinition> {
|
|
44
|
+
readonly definition: Def;
|
|
45
|
+
constructor(definition: Def);
|
|
73
46
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
47
|
+
declare class CompiledSchema {
|
|
48
|
+
constructor(schema: EntitySchema);
|
|
49
|
+
get shape(): unknown;
|
|
77
50
|
}
|
|
78
51
|
|
|
79
52
|
type InsertReturnMode = 'insertedIds' | 'documents';
|
|
80
|
-
type InsertReturnType<T extends Record
|
|
81
|
-
interface InsertQuery<T extends
|
|
53
|
+
type InsertReturnType<T extends object = Record<string, unknown>, R extends InsertReturnMode = 'insertedIds'> = R extends 'insertedIds' ? string[] : R extends 'documents' ? T[] : never;
|
|
54
|
+
interface InsertQuery<T extends object = Record<string, unknown>, R extends InsertReturnMode = 'insertedIds'> extends PromiseLike<InsertReturnType<T, R>> {
|
|
82
55
|
return(mode: 'insertedIds'): InsertQuery<T, 'insertedIds'>;
|
|
83
56
|
return(mode: 'documents'): InsertQuery<T, 'documents'>;
|
|
84
57
|
return(mode: InsertReturnMode): InsertQuery<T, typeof mode>;
|
|
85
58
|
}
|
|
86
59
|
type InsertOneReturnMode = 'insertedId' | 'document';
|
|
87
|
-
type InsertOneReturnType<T extends Record
|
|
88
|
-
interface InsertOneQuery<T extends
|
|
60
|
+
type InsertOneReturnType<T extends object = Record<string, unknown>, R extends InsertOneReturnMode = 'insertedId'> = R extends 'insertedId' ? string : R extends 'document' ? T : never;
|
|
61
|
+
interface InsertOneQuery<T extends object = Record<string, unknown>, R extends InsertOneReturnMode = 'insertedId'> extends PromiseLike<InsertOneReturnType<T, R>> {
|
|
89
62
|
return(mode: 'insertedId'): InsertOneQuery<T, 'insertedId'>;
|
|
90
63
|
return(mode: 'document'): InsertOneQuery<T, 'document'>;
|
|
91
64
|
return(mode: InsertOneReturnMode): InsertOneQuery<T, typeof mode>;
|
|
@@ -93,7 +66,7 @@ interface InsertOneQuery<T extends Record$1 = Record$1, R extends InsertOneRetur
|
|
|
93
66
|
|
|
94
67
|
type UpdateReturnMode = 'affectedRows' | 'oldDocuments' | 'newDocuments';
|
|
95
68
|
type UpdateReturnType<T, R extends UpdateReturnMode> = R extends 'affectedRows' ? bigint : R extends 'oldDocuments' | 'newDocuments' ? T[] : never;
|
|
96
|
-
interface UpdateQuery<T extends
|
|
69
|
+
interface UpdateQuery<T extends object = Record<string, unknown>, R extends UpdateReturnMode = 'affectedRows'> extends PromiseLike<UpdateReturnType<T, R>> {
|
|
97
70
|
limit(limit: number): this;
|
|
98
71
|
offset(offset: number): this;
|
|
99
72
|
sort(sort: Sorting): this;
|
|
@@ -104,7 +77,7 @@ interface UpdateQuery<T extends Record$1 = Record$1, R extends UpdateReturnMode
|
|
|
104
77
|
}
|
|
105
78
|
type UpdateOneReturnMode = 'success' | 'oldDocument' | 'newDocument';
|
|
106
79
|
type UpdateOneReturnType<T, R extends UpdateOneReturnMode> = R extends 'success' ? boolean : R extends 'oldDocument' | 'newDocument' ? T | undefined : never;
|
|
107
|
-
interface UpdateOneQuery<T extends
|
|
80
|
+
interface UpdateOneQuery<T extends object = Record<string, unknown>, R extends UpdateOneReturnMode = 'success'> extends PromiseLike<UpdateOneReturnType<T, R>> {
|
|
108
81
|
offset(offset: number): this;
|
|
109
82
|
sort(sort: Sorting): this;
|
|
110
83
|
upsert(upsert: boolean): this;
|
|
@@ -116,7 +89,7 @@ interface UpdateOneQuery<T extends Record$1 = Record$1, R extends UpdateOneRetur
|
|
|
116
89
|
|
|
117
90
|
type RemoveReturnMode = 'affectedRows' | 'documents';
|
|
118
91
|
type RemoveReturnType<T, R extends RemoveReturnMode> = R extends 'affectedRows' ? bigint : R extends 'documents' ? T[] : never;
|
|
119
|
-
interface RemoveQuery<T extends
|
|
92
|
+
interface RemoveQuery<T extends object = Record<string, unknown>, R extends RemoveReturnMode = 'affectedRows'> extends PromiseLike<RemoveReturnType<T, R>> {
|
|
120
93
|
limit(limit: number): this;
|
|
121
94
|
offset(offset: number): this;
|
|
122
95
|
sort(sort: Sorting): this;
|
|
@@ -126,7 +99,7 @@ interface RemoveQuery<T extends Record$1 = Record$1, R extends RemoveReturnMode
|
|
|
126
99
|
}
|
|
127
100
|
type RemoveOneReturnMode = 'success' | 'document';
|
|
128
101
|
type RemoveOneReturnType<T, R extends RemoveOneReturnMode> = R extends 'success' ? boolean : R extends 'document' ? T | undefined : never;
|
|
129
|
-
interface RemoveOneQuery<T extends
|
|
102
|
+
interface RemoveOneQuery<T extends object = Record<string, unknown>, R extends RemoveOneReturnMode = 'success'> extends PromiseLike<RemoveOneReturnType<T, R>> {
|
|
130
103
|
offset(offset: number): this;
|
|
131
104
|
sort(sort: Sorting): this;
|
|
132
105
|
return(mode: 'success'): RemoveOneQuery<T, 'success'>;
|
|
@@ -134,30 +107,81 @@ interface RemoveOneQuery<T extends Record$1 = Record$1, R extends RemoveOneRetur
|
|
|
134
107
|
return(mode: RemoveOneReturnMode): RemoveOneQuery<T, typeof mode>;
|
|
135
108
|
}
|
|
136
109
|
|
|
137
|
-
interface Entity<T extends object = Record
|
|
110
|
+
interface Entity<T extends object = Record<string, unknown>> {
|
|
138
111
|
get name(): string;
|
|
139
|
-
find(
|
|
140
|
-
findOne(
|
|
112
|
+
find(filter?: Filter): FindQuery<T>;
|
|
113
|
+
findOne(filter?: Filter): FindOneQuery<T>;
|
|
141
114
|
insert(docs: T[]): InsertQuery<T>;
|
|
142
115
|
insertOne(doc: T): InsertOneQuery<T>;
|
|
143
|
-
update(
|
|
144
|
-
updateOne(
|
|
145
|
-
remove(
|
|
146
|
-
removeOne(
|
|
116
|
+
update(filter: Filter, update: Record<string, unknown>): UpdateQuery<T>;
|
|
117
|
+
updateOne(filter: Filter, update: Record<string, unknown>): UpdateOneQuery<T>;
|
|
118
|
+
remove(filter: Filter): RemoveQuery<T>;
|
|
119
|
+
removeOne(filter: Filter): RemoveOneQuery<T>;
|
|
147
120
|
}
|
|
148
121
|
interface Sorting {
|
|
149
122
|
[field: string]: 'asc' | 'desc';
|
|
150
123
|
}
|
|
151
124
|
|
|
152
|
-
interface
|
|
153
|
-
|
|
154
|
-
|
|
125
|
+
interface FindQuery<T extends object = Record<string, unknown>> extends PromiseLike<T[]> {
|
|
126
|
+
limit(limit: number): this;
|
|
127
|
+
offset(offset: number): this;
|
|
128
|
+
sort(sort: Sorting): this;
|
|
155
129
|
}
|
|
156
|
-
interface
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
130
|
+
interface FindOneQuery<T extends object = Record<string, unknown>> extends PromiseLike<T | undefined> {
|
|
131
|
+
offset(offset: number): this;
|
|
132
|
+
sort(sort: Sorting): this;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type Variant<K extends PropertyKey, T extends object> = {
|
|
136
|
+
[P in keyof T]: {
|
|
137
|
+
[Q in K]: P;
|
|
138
|
+
} & T[P] extends infer U ? {
|
|
139
|
+
[Q in keyof U]: U[Q];
|
|
140
|
+
} : never;
|
|
141
|
+
}[keyof T];
|
|
142
|
+
type Visibility = 'private' | 'platform' | 'vendor' | 'public';
|
|
143
|
+
interface Tenant {
|
|
144
|
+
id: string;
|
|
145
|
+
host: string;
|
|
146
|
+
}
|
|
147
|
+
interface AppId {
|
|
148
|
+
get name(): string;
|
|
149
|
+
get namespace(): Namespace;
|
|
150
|
+
toString(separator?: string): string;
|
|
151
|
+
}
|
|
152
|
+
declare const AppId: {
|
|
153
|
+
parse(input: string): AppId;
|
|
154
|
+
};
|
|
155
|
+
type Namespace = 'system' | 'platform' | {
|
|
156
|
+
vendor: string;
|
|
157
|
+
};
|
|
158
|
+
type AppRole = Variant<'type', AppRoleData>;
|
|
159
|
+
type AppRoleData = {
|
|
160
|
+
provider: {
|
|
161
|
+
group: string;
|
|
162
|
+
};
|
|
163
|
+
test: void;
|
|
164
|
+
};
|
|
165
|
+
interface Auth {
|
|
166
|
+
subject: Subject;
|
|
167
|
+
permissions: Permissions;
|
|
168
|
+
}
|
|
169
|
+
interface Subject {
|
|
170
|
+
id: string;
|
|
171
|
+
email: string;
|
|
172
|
+
roles: string[];
|
|
173
|
+
}
|
|
174
|
+
interface Permissions {
|
|
175
|
+
[key: string]: string[];
|
|
176
|
+
}
|
|
177
|
+
interface HookEventMap {
|
|
178
|
+
start: [];
|
|
179
|
+
install: [];
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
type EventHandler = <T>(event: string, data: T) => void | Promise<void>;
|
|
183
|
+
interface EventEmitter {
|
|
184
|
+
publish<T extends object>(event: string, payload: T, visibility?: Visibility[]): Promise<void>;
|
|
161
185
|
}
|
|
162
186
|
|
|
163
187
|
interface Artifacts {
|
|
@@ -167,7 +191,7 @@ interface Artifacts {
|
|
|
167
191
|
get auth(): Auth | undefined;
|
|
168
192
|
}
|
|
169
193
|
|
|
170
|
-
type Method = '
|
|
194
|
+
type Method = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE';
|
|
171
195
|
declare enum StatusCode {
|
|
172
196
|
Continue = 100,
|
|
173
197
|
SwitchingProtocols = 101,
|
|
@@ -233,7 +257,7 @@ declare enum StatusCode {
|
|
|
233
257
|
NetworkAuthenticationRequired = 511
|
|
234
258
|
}
|
|
235
259
|
type RequestHandler = (req: Request, res: ResponseBuilder) => void | Promise<void>;
|
|
236
|
-
type Middleware = (req: Request, res: ResponseBuilder, next: () => Promise<void>) =>
|
|
260
|
+
type Middleware = (req: Request, res: ResponseBuilder, next: () => Promise<void>) => Promise<void>;
|
|
237
261
|
interface Router {
|
|
238
262
|
scope(path: string): Router;
|
|
239
263
|
route(method: Method, path: string, handler: RequestHandler, options?: RouteOptions): Router;
|
|
@@ -254,6 +278,7 @@ interface MiddlewareOptions {
|
|
|
254
278
|
path?: string;
|
|
255
279
|
priority?: number;
|
|
256
280
|
}
|
|
281
|
+
type PayloadType = 'bytes' | 'json' | 'cbor' | 'text';
|
|
257
282
|
interface Request {
|
|
258
283
|
get artifacts(): Artifacts;
|
|
259
284
|
get method(): Method;
|
|
@@ -261,9 +286,11 @@ interface Request {
|
|
|
261
286
|
get params(): Record<string, string>;
|
|
262
287
|
get headers(): Headers;
|
|
263
288
|
cookie(name: string): string | undefined;
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
289
|
+
payload<T = any>(): Promise<T>;
|
|
290
|
+
payload<T = any>(type: 'json' | 'cbor'): Promise<T>;
|
|
291
|
+
payload(type: 'bytes'): Promise<Uint8Array>;
|
|
292
|
+
payload(type: 'text'): Promise<string>;
|
|
293
|
+
payload(type?: PayloadType): Promise<unknown>;
|
|
267
294
|
}
|
|
268
295
|
interface RequestBuilder {
|
|
269
296
|
method(method: Method): this;
|
|
@@ -271,29 +298,26 @@ interface RequestBuilder {
|
|
|
271
298
|
header(name: string, value: string): this;
|
|
272
299
|
headers(headers: HeadersInit): this;
|
|
273
300
|
cookie(name: string, value: string): this;
|
|
274
|
-
|
|
275
|
-
text(text: string): this;
|
|
276
|
-
json<T>(json: T): this;
|
|
301
|
+
payload<T = unknown>(payload: T, type?: PayloadType): this;
|
|
277
302
|
}
|
|
278
303
|
interface Response {
|
|
279
304
|
get status(): number;
|
|
280
305
|
get headers(): Headers;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
306
|
+
payload<T = any>(): Promise<T>;
|
|
307
|
+
payload<T = any>(type: 'json' | 'cbor'): Promise<T>;
|
|
308
|
+
payload(type: 'bytes'): Promise<Uint8Array>;
|
|
309
|
+
payload(type: 'text'): Promise<string>;
|
|
310
|
+
payload(type?: PayloadType): Promise<unknown>;
|
|
285
311
|
}
|
|
286
312
|
interface ResponseBuilder {
|
|
287
313
|
status(status: number): this;
|
|
288
314
|
header(name: string, value: string): this;
|
|
289
315
|
headers(headers: HeadersInit): this;
|
|
290
|
-
cookie(name: string,
|
|
291
|
-
|
|
292
|
-
text(text: string): this;
|
|
293
|
-
json<T>(json: T): this;
|
|
316
|
+
cookie(name: string, cookie?: SetCookie): this;
|
|
317
|
+
payload<T = unknown>(payload: T, type?: PayloadType): this;
|
|
294
318
|
}
|
|
295
|
-
interface
|
|
296
|
-
|
|
319
|
+
interface SetCookie {
|
|
320
|
+
value?: string;
|
|
297
321
|
maxAge?: number;
|
|
298
322
|
expires?: Date;
|
|
299
323
|
domain?: string;
|
|
@@ -305,8 +329,43 @@ interface SetCookieOptions {
|
|
|
305
329
|
sameSite?: boolean | 'lax' | 'strict' | 'none';
|
|
306
330
|
}
|
|
307
331
|
|
|
332
|
+
interface Jobs {
|
|
333
|
+
schedule(name: string, when?: Date): void;
|
|
334
|
+
}
|
|
335
|
+
type JobHandler = (data?: unknown) => void | Promise<void>;
|
|
336
|
+
interface JobOptions {
|
|
337
|
+
schedule?: string;
|
|
338
|
+
timeoutMs?: number;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
interface Crypto {
|
|
342
|
+
deriveKey(seed: string, length: number): Uint8Array;
|
|
343
|
+
aesGcmEncrypt<T>(data: T): Uint8Array;
|
|
344
|
+
aesGcmDecrypt<T>(data: Uint8Array): T;
|
|
345
|
+
argon2Hash(algorithm: Argon2Algorithm, password: string, options?: Argon2Options): string;
|
|
346
|
+
argon2Verify(algorithm: Argon2Algorithm, password: string, hash: string, options?: Argon2Options): boolean;
|
|
347
|
+
}
|
|
348
|
+
type Argon2Algorithm = 'argon2d' | 'argon2i' | 'argon2id';
|
|
349
|
+
interface Argon2Options {
|
|
350
|
+
mCost?: number;
|
|
351
|
+
tCost?: number;
|
|
352
|
+
pCost?: number;
|
|
353
|
+
outputLen?: number;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
interface SetOptions {
|
|
357
|
+
ttl?: number;
|
|
358
|
+
existenceCheck?: 'nx' | 'xx';
|
|
359
|
+
}
|
|
360
|
+
interface KeyValueStore {
|
|
361
|
+
get<T>(key: string): Promise<T | undefined>;
|
|
362
|
+
getDel<T>(key: string): Promise<T | undefined>;
|
|
363
|
+
set<T>(key: string, value: T, options?: SetOptions): Promise<void>;
|
|
364
|
+
delete(key: string): Promise<void>;
|
|
365
|
+
}
|
|
366
|
+
|
|
308
367
|
interface RPC {
|
|
309
|
-
call(
|
|
368
|
+
call(method: Method, url: string): Call;
|
|
310
369
|
get(url: string): Call;
|
|
311
370
|
post(url: string): Call;
|
|
312
371
|
put(url: string): Call;
|
|
@@ -317,38 +376,43 @@ interface Call extends RequestBuilder, PromiseLike<Response> {
|
|
|
317
376
|
}
|
|
318
377
|
|
|
319
378
|
interface Providers {
|
|
320
|
-
list(group: string): Provider[]
|
|
379
|
+
list(group: string): Promise<Provider[]>;
|
|
380
|
+
createFromId(id: string): Provider;
|
|
321
381
|
}
|
|
322
382
|
interface Provider {
|
|
323
383
|
get app(): AppId;
|
|
324
384
|
get group(): string;
|
|
325
385
|
get id(): string;
|
|
326
|
-
call(
|
|
386
|
+
call(method: Method, path: string): Call;
|
|
327
387
|
get(path: string): Call;
|
|
328
388
|
post(path: string): Call;
|
|
329
389
|
put(path: string): Call;
|
|
330
390
|
patch(path: string): Call;
|
|
331
391
|
delete(path: string): Call;
|
|
332
392
|
}
|
|
333
|
-
declare const Provider: {
|
|
334
|
-
fromId(id: string): Provider;
|
|
335
|
-
};
|
|
336
393
|
|
|
337
394
|
interface SSE {
|
|
338
395
|
push<T>(event: T, targets: string[]): Promise<void>;
|
|
339
396
|
}
|
|
340
397
|
|
|
341
398
|
interface Bridge {
|
|
399
|
+
get utils(): Utils;
|
|
342
400
|
get tenant(): Tenant;
|
|
343
401
|
get providers(): Providers;
|
|
402
|
+
get jobs(): Jobs;
|
|
344
403
|
settings<T>(): T | undefined;
|
|
345
|
-
crd<T>(key: string): T | undefined;
|
|
346
404
|
get rpc(): RPC;
|
|
347
405
|
get kv(): KeyValueStore;
|
|
348
406
|
get sse(): SSE;
|
|
349
407
|
get crypto(): Crypto;
|
|
408
|
+
get event(): EventEmitter;
|
|
350
409
|
entity<T extends object>(name: string): Entity<T>;
|
|
351
|
-
publish<T extends object>(event: string, payload: T, visibility?: Visibility[]): void;
|
|
352
410
|
}
|
|
411
|
+
interface Utils {
|
|
412
|
+
parseAppId(input: string): AppId;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
declare const logLevels: readonly ["trace", "debug", "info", "warn", "error", "none"];
|
|
416
|
+
type LogLevel = (typeof logLevels)[number];
|
|
353
417
|
|
|
354
|
-
export { type AppRole as A, type Bridge as B,
|
|
418
|
+
export { type AppRole as A, type Bridge as B, CompiledSchema as C, entitySchema as D, EntitySchema as E, type Filter as F, type GeneratedFields as G, type HydratedDocument as H, type InsertDocument as I, type JobHandler as J, 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, type JobOptions as k, AppId as l, type Artifacts as m, type Auth as n, type Entity as o, type InferSchema as p, type Middleware as q, type Providers as r, type Request as s, type RequestBuilder as t, type RequestHandler as u, type Response as v, type ResponseBuilder as w, type RouteOptions as x, StatusCode as y, type Subject as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m1cro/server-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-beta.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -9,24 +9,42 @@
|
|
|
9
9
|
".": {
|
|
10
10
|
"types": "./dist/index.d.ts",
|
|
11
11
|
"import": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./globals": {
|
|
14
|
+
"types": "./dist/globals.d.ts"
|
|
12
15
|
}
|
|
13
16
|
},
|
|
14
17
|
"publishConfig": {
|
|
15
18
|
"access": "public"
|
|
16
19
|
},
|
|
17
20
|
"scripts": {
|
|
18
|
-
"build": "yarn && yarn typecheck && yarn bundle",
|
|
21
|
+
"build": "yarn && yarn run typecheck && yarn run bundle",
|
|
19
22
|
"typecheck": "tsc --noEmit",
|
|
20
23
|
"bundle": "tsup --minify --treeshake smallest",
|
|
21
|
-
"
|
|
22
|
-
"
|
|
24
|
+
"deploy": "yarn publish --non-interactive",
|
|
25
|
+
"lint": "eslint",
|
|
26
|
+
"lint:fix": "eslint --fix",
|
|
27
|
+
"prettier": "prettier --check \"src/**/*.ts\"",
|
|
28
|
+
"prettier:fix": "prettier --write \"src/**/*.ts\""
|
|
23
29
|
},
|
|
24
30
|
"dependencies": {
|
|
25
31
|
"@types/json-schema": "^7.0.15",
|
|
26
32
|
"cbor2": "^2.2.1",
|
|
33
|
+
"cookie": "^1.1.1",
|
|
27
34
|
"json-schema": "^0.4.0"
|
|
28
35
|
},
|
|
29
36
|
"devDependencies": {
|
|
30
|
-
"
|
|
37
|
+
"@eslint/js": "^9.39.2",
|
|
38
|
+
"@stylistic/eslint-plugin": "^5.7.1",
|
|
39
|
+
"@types/node": "^25.5.2",
|
|
40
|
+
"eslint": "^9.39.2",
|
|
41
|
+
"eslint-config-prettier": "^10.1.8",
|
|
42
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
43
|
+
"globals": "^17.3.0",
|
|
44
|
+
"jiti": "^2.6.1",
|
|
45
|
+
"prettier": "^3.8.1",
|
|
46
|
+
"tsup": "^8.5.1",
|
|
47
|
+
"typescript": "^5.9.3",
|
|
48
|
+
"typescript-eslint": "^8.54.0"
|
|
31
49
|
}
|
|
32
|
-
}
|
|
50
|
+
}
|