rxdb-server 15.13.0 → 15.13.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/plugins/server/types.ts"],"sourcesContent":["import type {\n FilledMangoQuery,\n RxDatabase,\n RxReplicationWriteToMasterRow,\n MaybePromise,\n RxCollection\n} from 'rxdb/plugins/core';\nimport { IncomingHttpHeaders } from 'http';\n\nexport type RxServerOptions<ServerAppType, AuthType> = {\n database: RxDatabase;\n adapter: RxServerAdapter<ServerAppType, any, any>;\n serverApp?: ServerAppType;\n authHandler?: RxServerAuthHandler<AuthType>;\n appOptions?: any;\n /**\n * [default=localhost]\n */\n hostname?: 'localhost' | '0.0.0.0' | string;\n port: number;\n /**\n * Set a origin for allowed CORS requests.\n * Can be overwritten by the cors option of the endpoints.\n * [default='*']\n */\n cors?: '*' | string;\n};\n\n\nexport type RxServerRouteHandler<RequestType = any, ResponseType = any> = (req: RequestType, res: ResponseType, next?: any) => MaybePromise<void>;\n\nexport type RxServerAdapter<ServerAppType, RequestType = any, ResponseType = any> = {\n create(): Promise<ServerAppType>;\n\n get(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n post(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n all(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n\n setCors(app: ServerAppType, path: string, cors: string): void;\n\n getRequestBody(req: RequestType): any;\n getRequestHeaders(req: RequestType): { [k: string]: string };\n getRequestQuery(req: RequestType): any;\n onRequestClose(req: RequestType, handler: () => void): void;\n\n setResponseHeader(res: ResponseType, name: string, value: string): void;\n endResponseJson(res: ResponseType, data: any): void;\n endResponse(res: ResponseType): void;\n responseWrite(res: ResponseType, data: string): void;\n setSSEHeaders(res: ResponseType): void;\n closeConnection(res: ResponseType, code: number, message: string): void;\n\n listen(app: ServerAppType, port: number, hostname: string): Promise<void>;\n closeAllConnections(app: ServerAppType): MaybePromise<any>;\n close(app: ServerAppType): Promise<void>;\n\n};\n\nexport type RxServerAuthData<AuthType> = {\n data: AuthType;\n validUntil: number;\n};\n\n/**\n * Returns the auth state by the given request headers.\n * Throws if auth not valid.\n */\nexport type RxServerAuthHandler<AuthType> =\n (headers: IncomingHttpHeaders) => MaybePromise<RxServerAuthData<AuthType>>;\n\n/**\n * Modifies a given query in a way to limit the results\n * to what the authenticated user is allowed to see.\n * For example the query selector\n * input: {\n * selector: {\n * myField: { $gt: 100 }\n * }\n * }\n * could be modified to restrict the results to only return\n * documents that are \"owned\" by the user\n * return: {\n * selector: {\n * myField: { $gt: 100 },\n * userId: { $eq: authData.userId }\n * }\n * }\n * \n * \n */\nexport type RxServerQueryModifier<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n query: FilledMangoQuery<RxDocType>\n) => FilledMangoQuery<RxDocType>;\n\n/**\n * Validates if a given change is allowed to be performed on the server.\n * Returns true if allowed, false if not.\n * If a client tries to make a non-allowed change,\n * the client will be disconnected.\n */\nexport type RxServerChangeValidator<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n change: RxReplicationWriteToMasterRow<RxDocType>\n) => boolean;\n\n\nexport interface RxServerEndpoint<AuthType, RxDocType> {\n collection: RxCollection<RxDocType>;\n name: string;\n type: 'replication' | 'rest' | string;\n urlPath: string;\n queryModifier?: RxServerQueryModifier<AuthType, RxDocType>;\n changeValidator?: RxServerChangeValidator<AuthType, RxDocType>;\n};\n"],"mappings":";;AA+DA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAcC","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/plugins/server/types.ts"],"sourcesContent":["import type {\n FilledMangoQuery,\n RxDatabase,\n RxReplicationWriteToMasterRow,\n MaybePromise,\n RxCollection\n} from 'rxdb/plugins/core';\nimport { IncomingHttpHeaders } from 'http';\n\nexport type RxServerOptions<ServerAppType, AuthType> = {\n database: RxDatabase;\n adapter: RxServerAdapter<ServerAppType, any, any>;\n serverApp?: ServerAppType;\n authHandler?: RxServerAuthHandler<AuthType>;\n appOptions?: any;\n /**\n * [default=localhost]\n */\n hostname?: 'localhost' | '0.0.0.0' | string;\n port: number;\n /**\n * Set a origin for allowed CORS requests.\n * Can be overwritten by the cors option of the endpoints.\n * [default='*']\n */\n cors?: '*' | string;\n};\n\n\nexport type RxServerRouteHandler<RequestType = any, ResponseType = any> = (req: RequestType, res: ResponseType, next?: any) => MaybePromise<void>;\n\nexport type RxServerAdapter<ServerAppType, RequestType = any, ResponseType = any> = {\n create(): Promise<ServerAppType>;\n\n get(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n post(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n all(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n\n setCors(app: ServerAppType, path: string, cors: string): MaybePromise<void>;\n\n getRequestBody(req: RequestType): any;\n getRequestHeaders(req: RequestType): { [k: string]: string };\n getRequestQuery(req: RequestType): any;\n onRequestClose(req: RequestType, handler: () => void): void;\n\n setResponseHeader(res: ResponseType, name: string, value: string): void;\n endResponseJson(res: ResponseType, data: any): void;\n endResponse(res: ResponseType): void;\n responseWrite(res: ResponseType, data: string): void;\n setSSEHeaders(res: ResponseType): void;\n closeConnection(res: ResponseType, code: number, message: string): void;\n\n listen(app: ServerAppType, port: number, hostname: string): Promise<void>;\n closeAllConnections(app: ServerAppType): MaybePromise<any>;\n close(app: ServerAppType): Promise<void>;\n\n};\n\nexport type RxServerAuthData<AuthType> = {\n data: AuthType;\n validUntil: number;\n};\n\n/**\n * Returns the auth state by the given request headers.\n * Throws if auth not valid.\n */\nexport type RxServerAuthHandler<AuthType> =\n (headers: IncomingHttpHeaders) => MaybePromise<RxServerAuthData<AuthType>>;\n\n/**\n * Modifies a given query in a way to limit the results\n * to what the authenticated user is allowed to see.\n * For example the query selector\n * input: {\n * selector: {\n * myField: { $gt: 100 }\n * }\n * }\n * could be modified to restrict the results to only return\n * documents that are \"owned\" by the user\n * return: {\n * selector: {\n * myField: { $gt: 100 },\n * userId: { $eq: authData.userId }\n * }\n * }\n * \n * \n */\nexport type RxServerQueryModifier<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n query: FilledMangoQuery<RxDocType>\n) => FilledMangoQuery<RxDocType>;\n\n/**\n * Validates if a given change is allowed to be performed on the server.\n * Returns true if allowed, false if not.\n * If a client tries to make a non-allowed change,\n * the client will be disconnected.\n */\nexport type RxServerChangeValidator<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n change: RxReplicationWriteToMasterRow<RxDocType>\n) => boolean;\n\n\nexport interface RxServerEndpoint<AuthType, RxDocType> {\n collection: RxCollection<RxDocType>;\n name: string;\n type: 'replication' | 'rest' | string;\n urlPath: string;\n queryModifier?: RxServerQueryModifier<AuthType, RxDocType>;\n changeValidator?: RxServerChangeValidator<AuthType, RxDocType>;\n};\n"],"mappings":";;AA+DA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAcC","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../../../src/plugins/server/types.ts"],"sourcesContent":["import type {\n FilledMangoQuery,\n RxDatabase,\n RxReplicationWriteToMasterRow,\n MaybePromise,\n RxCollection\n} from 'rxdb/plugins/core';\nimport { IncomingHttpHeaders } from 'http';\n\nexport type RxServerOptions<ServerAppType, AuthType> = {\n database: RxDatabase;\n adapter: RxServerAdapter<ServerAppType, any, any>;\n serverApp?: ServerAppType;\n authHandler?: RxServerAuthHandler<AuthType>;\n appOptions?: any;\n /**\n * [default=localhost]\n */\n hostname?: 'localhost' | '0.0.0.0' | string;\n port: number;\n /**\n * Set a origin for allowed CORS requests.\n * Can be overwritten by the cors option of the endpoints.\n * [default='*']\n */\n cors?: '*' | string;\n};\n\n\nexport type RxServerRouteHandler<RequestType = any, ResponseType = any> = (req: RequestType, res: ResponseType, next?: any) => MaybePromise<void>;\n\nexport type RxServerAdapter<ServerAppType, RequestType = any, ResponseType = any> = {\n create(): Promise<ServerAppType>;\n\n get(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n post(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n all(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n\n setCors(app: ServerAppType, path: string, cors: string): void;\n\n getRequestBody(req: RequestType): any;\n getRequestHeaders(req: RequestType): { [k: string]: string };\n getRequestQuery(req: RequestType): any;\n onRequestClose(req: RequestType, handler: () => void): void;\n\n setResponseHeader(res: ResponseType, name: string, value: string): void;\n endResponseJson(res: ResponseType, data: any): void;\n endResponse(res: ResponseType): void;\n responseWrite(res: ResponseType, data: string): void;\n setSSEHeaders(res: ResponseType): void;\n closeConnection(res: ResponseType, code: number, message: string): void;\n\n listen(app: ServerAppType, port: number, hostname: string): Promise<void>;\n closeAllConnections(app: ServerAppType): MaybePromise<any>;\n close(app: ServerAppType): Promise<void>;\n\n};\n\nexport type RxServerAuthData<AuthType> = {\n data: AuthType;\n validUntil: number;\n};\n\n/**\n * Returns the auth state by the given request headers.\n * Throws if auth not valid.\n */\nexport type RxServerAuthHandler<AuthType> =\n (headers: IncomingHttpHeaders) => MaybePromise<RxServerAuthData<AuthType>>;\n\n/**\n * Modifies a given query in a way to limit the results\n * to what the authenticated user is allowed to see.\n * For example the query selector\n * input: {\n * selector: {\n * myField: { $gt: 100 }\n * }\n * }\n * could be modified to restrict the results to only return\n * documents that are \"owned\" by the user\n * return: {\n * selector: {\n * myField: { $gt: 100 },\n * userId: { $eq: authData.userId }\n * }\n * }\n * \n * \n */\nexport type RxServerQueryModifier<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n query: FilledMangoQuery<RxDocType>\n) => FilledMangoQuery<RxDocType>;\n\n/**\n * Validates if a given change is allowed to be performed on the server.\n * Returns true if allowed, false if not.\n * If a client tries to make a non-allowed change,\n * the client will be disconnected.\n */\nexport type RxServerChangeValidator<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n change: RxReplicationWriteToMasterRow<RxDocType>\n) => boolean;\n\n\nexport interface RxServerEndpoint<AuthType, RxDocType> {\n collection: RxCollection<RxDocType>;\n name: string;\n type: 'replication' | 'rest' | string;\n urlPath: string;\n queryModifier?: RxServerQueryModifier<AuthType, RxDocType>;\n changeValidator?: RxServerChangeValidator<AuthType, RxDocType>;\n};\n"],"mappings":"AA+DA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAcC;AAAC;AAAA","ignoreList":[]}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../src/plugins/server/types.ts"],"sourcesContent":["import type {\n FilledMangoQuery,\n RxDatabase,\n RxReplicationWriteToMasterRow,\n MaybePromise,\n RxCollection\n} from 'rxdb/plugins/core';\nimport { IncomingHttpHeaders } from 'http';\n\nexport type RxServerOptions<ServerAppType, AuthType> = {\n database: RxDatabase;\n adapter: RxServerAdapter<ServerAppType, any, any>;\n serverApp?: ServerAppType;\n authHandler?: RxServerAuthHandler<AuthType>;\n appOptions?: any;\n /**\n * [default=localhost]\n */\n hostname?: 'localhost' | '0.0.0.0' | string;\n port: number;\n /**\n * Set a origin for allowed CORS requests.\n * Can be overwritten by the cors option of the endpoints.\n * [default='*']\n */\n cors?: '*' | string;\n};\n\n\nexport type RxServerRouteHandler<RequestType = any, ResponseType = any> = (req: RequestType, res: ResponseType, next?: any) => MaybePromise<void>;\n\nexport type RxServerAdapter<ServerAppType, RequestType = any, ResponseType = any> = {\n create(): Promise<ServerAppType>;\n\n get(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n post(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n all(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;\n\n setCors(app: ServerAppType, path: string, cors: string): MaybePromise<void>;\n\n getRequestBody(req: RequestType): any;\n getRequestHeaders(req: RequestType): { [k: string]: string };\n getRequestQuery(req: RequestType): any;\n onRequestClose(req: RequestType, handler: () => void): void;\n\n setResponseHeader(res: ResponseType, name: string, value: string): void;\n endResponseJson(res: ResponseType, data: any): void;\n endResponse(res: ResponseType): void;\n responseWrite(res: ResponseType, data: string): void;\n setSSEHeaders(res: ResponseType): void;\n closeConnection(res: ResponseType, code: number, message: string): void;\n\n listen(app: ServerAppType, port: number, hostname: string): Promise<void>;\n closeAllConnections(app: ServerAppType): MaybePromise<any>;\n close(app: ServerAppType): Promise<void>;\n\n};\n\nexport type RxServerAuthData<AuthType> = {\n data: AuthType;\n validUntil: number;\n};\n\n/**\n * Returns the auth state by the given request headers.\n * Throws if auth not valid.\n */\nexport type RxServerAuthHandler<AuthType> =\n (headers: IncomingHttpHeaders) => MaybePromise<RxServerAuthData<AuthType>>;\n\n/**\n * Modifies a given query in a way to limit the results\n * to what the authenticated user is allowed to see.\n * For example the query selector\n * input: {\n * selector: {\n * myField: { $gt: 100 }\n * }\n * }\n * could be modified to restrict the results to only return\n * documents that are \"owned\" by the user\n * return: {\n * selector: {\n * myField: { $gt: 100 },\n * userId: { $eq: authData.userId }\n * }\n * }\n * \n * \n */\nexport type RxServerQueryModifier<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n query: FilledMangoQuery<RxDocType>\n) => FilledMangoQuery<RxDocType>;\n\n/**\n * Validates if a given change is allowed to be performed on the server.\n * Returns true if allowed, false if not.\n * If a client tries to make a non-allowed change,\n * the client will be disconnected.\n */\nexport type RxServerChangeValidator<AuthType, RxDocType> = (\n authData: RxServerAuthData<AuthType>,\n change: RxReplicationWriteToMasterRow<RxDocType>\n) => boolean;\n\n\nexport interface RxServerEndpoint<AuthType, RxDocType> {\n collection: RxCollection<RxDocType>;\n name: string;\n type: 'replication' | 'rest' | string;\n urlPath: string;\n queryModifier?: RxServerQueryModifier<AuthType, RxDocType>;\n changeValidator?: RxServerChangeValidator<AuthType, RxDocType>;\n};\n"],"mappings":"AA+DA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA;AACA;AACA;AACA;AACA;AACA;;AAcC;AAAC;AAAA","ignoreList":[]}
@@ -25,7 +25,7 @@ export type RxServerAdapter<ServerAppType, RequestType = any, ResponseType = any
25
25
  get(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;
26
26
  post(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;
27
27
  all(app: ServerAppType, path: string, handler: RxServerRouteHandler<RequestType, ResponseType>): void;
28
- setCors(app: ServerAppType, path: string, cors: string): void;
28
+ setCors(app: ServerAppType, path: string, cors: string): MaybePromise<void>;
29
29
  getRequestBody(req: RequestType): any;
30
30
  getRequestHeaders(req: RequestType): {
31
31
  [k: string]: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rxdb-server",
3
- "version": "15.13.0",
3
+ "version": "15.13.2",
4
4
  "description": "RxDB Server Plugin",
5
5
  "license": "SSPL",
6
6
  "author": "pubkey",
@@ -131,7 +131,7 @@
131
131
  "minify-all-js": "0.1.9",
132
132
  "mocha": "10.3.0",
133
133
  "rimraf": "5.0.5",
134
- "rxdb": "15.13.0",
134
+ "rxdb": "15.13.2",
135
135
  "rxjs": "7.8.1",
136
136
  "ts-loader": "9.5.1",
137
137
  "ts-mocha": "10.0.0",