@kollors/deep-json-server 0.7.0 → 0.8.1
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/README.md +19 -16
- package/README.ru.md +20 -17
- package/dist/bin/deep-json-server.d.ts +2 -0
- package/dist/bin/deep-json-server.js +11 -0
- package/dist/bin/deep-json-server.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/src/cli.d.ts +4 -0
- package/dist/src/cli.js +80 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/config.d.ts +54 -0
- package/dist/src/config.js +145 -0
- package/dist/src/config.js.map +1 -0
- package/{src → dist/src}/constants.js +1 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/database.d.ts +20 -0
- package/dist/src/database.js +136 -0
- package/dist/src/database.js.map +1 -0
- package/dist/src/files/contract.d.ts +67 -0
- package/dist/src/files/contract.js +106 -0
- package/dist/src/files/contract.js.map +1 -0
- package/dist/src/files/disk-store.d.ts +5 -0
- package/dist/src/files/disk-store.js +313 -0
- package/dist/src/files/disk-store.js.map +1 -0
- package/dist/src/files/index.d.ts +5 -0
- package/dist/src/files/index.js +6 -0
- package/dist/src/files/index.js.map +1 -0
- package/dist/src/files/memory-store.d.ts +3 -0
- package/dist/src/files/memory-store.js +80 -0
- package/dist/src/files/memory-store.js.map +1 -0
- package/dist/src/files/routes.d.ts +6 -0
- package/dist/src/files/routes.js +77 -0
- package/dist/src/files/routes.js.map +1 -0
- package/dist/src/openapi/config.d.ts +11 -0
- package/dist/src/openapi/config.js +204 -0
- package/dist/src/openapi/config.js.map +1 -0
- package/dist/src/openapi/document.d.ts +9 -0
- package/dist/src/openapi/document.js +338 -0
- package/dist/src/openapi/document.js.map +1 -0
- package/dist/src/openapi/index.d.ts +10 -0
- package/dist/src/openapi/index.js +27 -0
- package/dist/src/openapi/index.js.map +1 -0
- package/dist/src/openapi/inference.d.ts +14 -0
- package/dist/src/openapi/inference.js +145 -0
- package/dist/src/openapi/inference.js.map +1 -0
- package/dist/src/query/filter.d.ts +6 -0
- package/dist/src/query/filter.js +248 -0
- package/dist/src/query/filter.js.map +1 -0
- package/{src → dist/src}/query/index.js +1 -0
- package/dist/src/query/index.js.map +1 -0
- package/dist/src/query/pagination.d.ts +11 -0
- package/dist/src/query/pagination.js +28 -0
- package/dist/src/query/pagination.js.map +1 -0
- package/dist/src/query/sort.d.ts +1 -0
- package/dist/src/query/sort.js +54 -0
- package/dist/src/query/sort.js.map +1 -0
- package/dist/src/relation-metadata.d.ts +10 -0
- package/dist/src/relation-metadata.js +32 -0
- package/dist/src/relation-metadata.js.map +1 -0
- package/dist/src/relations.d.ts +12 -0
- package/dist/src/relations.js +155 -0
- package/dist/src/relations.js.map +1 -0
- package/dist/src/server.d.ts +13 -0
- package/dist/src/server.js +188 -0
- package/dist/src/server.js.map +1 -0
- package/dist/src/types.d.ts +52 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/dist/src/utils.d.ts +20 -0
- package/dist/src/utils.js +63 -0
- package/dist/src/utils.js.map +1 -0
- package/package.json +17 -16
- package/bin/deep-json-server.js +0 -11
- package/index.js +0 -12
- package/src/cli.js +0 -91
- package/src/config.js +0 -203
- package/src/database.js +0 -148
- package/src/files.js +0 -633
- package/src/openapi/config.js +0 -124
- package/src/openapi/document.js +0 -394
- package/src/openapi/index.js +0 -36
- package/src/openapi/inference.js +0 -187
- package/src/query/filter.js +0 -283
- package/src/query/pagination.js +0 -44
- package/src/query/sort.js +0 -63
- package/src/relation-metadata.js +0 -41
- package/src/relations.js +0 -173
- package/src/server.js +0 -250
- package/src/utils.js +0 -84
- package/types/index.d.ts +0 -21
- package/types/src/config.d.ts +0 -73
- package/types/src/database.d.ts +0 -33
- package/types/src/files.d.ts +0 -64
- package/types/src/openapi/config.d.ts +0 -3
- package/types/src/openapi/document.d.ts +0 -11
- package/types/src/openapi/index.d.ts +0 -9
- package/types/src/openapi/inference.d.ts +0 -9
- package/types/src/query/filter.d.ts +0 -3
- package/types/src/query/pagination.d.ts +0 -8
- package/types/src/query/sort.d.ts +0 -1
- package/types/src/relation-metadata.d.ts +0 -9
- package/types/src/relations.d.ts +0 -3
- package/types/src/server.d.ts +0 -14
- package/types/src/utils.d.ts +0 -18
- /package/{types → dist}/src/constants.d.ts +0 -0
- /package/{types → dist}/src/query/index.d.ts +0 -0
package/types/src/files.d.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Readable } from 'node:stream';
|
|
2
|
-
export type StoredFileMetadata = {
|
|
3
|
-
directory: string;
|
|
4
|
-
mimeType: string;
|
|
5
|
-
name: string;
|
|
6
|
-
};
|
|
7
|
-
export type FileRecord = StoredFileMetadata & {
|
|
8
|
-
size: number;
|
|
9
|
-
};
|
|
10
|
-
export type FileMetadata = FileRecord & {
|
|
11
|
-
downloadUrl: string;
|
|
12
|
-
metadataUrl: string;
|
|
13
|
-
url: string;
|
|
14
|
-
};
|
|
15
|
-
export type FileUpload = {
|
|
16
|
-
directory: string;
|
|
17
|
-
maxFileSize: number;
|
|
18
|
-
mimeType: string;
|
|
19
|
-
name: string;
|
|
20
|
-
override: boolean;
|
|
21
|
-
stream: Readable;
|
|
22
|
-
};
|
|
23
|
-
export type FileUpdate = {
|
|
24
|
-
directory?: string;
|
|
25
|
-
name?: string;
|
|
26
|
-
};
|
|
27
|
-
export type FileStore = {
|
|
28
|
-
/**
|
|
29
|
-
* Returns file metadata and contents.
|
|
30
|
-
*/
|
|
31
|
-
get: (path: string) => Promise<{
|
|
32
|
-
file: FileRecord;
|
|
33
|
-
stream: Readable;
|
|
34
|
-
}>;
|
|
35
|
-
/**
|
|
36
|
-
* Returns file metadata.
|
|
37
|
-
*/
|
|
38
|
-
metadata: (path: string) => Promise<FileRecord>;
|
|
39
|
-
/**
|
|
40
|
-
* Deletes a file.
|
|
41
|
-
*/
|
|
42
|
-
remove: (path: string) => Promise<void>;
|
|
43
|
-
/**
|
|
44
|
-
* Renames or moves a file.
|
|
45
|
-
*/
|
|
46
|
-
update: (path: string, update: FileUpdate) => Promise<FileRecord>;
|
|
47
|
-
/**
|
|
48
|
-
* Stores a file.
|
|
49
|
-
*/
|
|
50
|
-
upload: (upload: FileUpload) => Promise<{
|
|
51
|
-
created: boolean;
|
|
52
|
-
file: FileRecord;
|
|
53
|
-
}>;
|
|
54
|
-
};
|
|
55
|
-
/**
|
|
56
|
-
* Creates a disk- or memory-backed file store with serialized operations.
|
|
57
|
-
* @param {import('./config.js').FilesConfig} config File storage configuration.
|
|
58
|
-
* @returns {Promise<FileStore>} File store.
|
|
59
|
-
*/
|
|
60
|
-
export declare const createFileStore: (config: import('./config.js').FilesConfig) => Promise<FileStore>;
|
|
61
|
-
export declare const registerFileRoutes: (fastify: any, { maxFileSize, store }: {
|
|
62
|
-
maxFileSize: any;
|
|
63
|
-
store: any;
|
|
64
|
-
}) => void;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Builds an OpenAPI document without runtime server addresses.
|
|
3
|
-
* @param {{ database: Record<string, Array<Record<string, unknown>>>, files?: boolean, maxPageSize?: number, schema?: Record<string, unknown> }} options Source data and schema settings.
|
|
4
|
-
* @returns {Record<string, unknown>} OpenAPI document.
|
|
5
|
-
*/
|
|
6
|
-
export declare function buildOpenapiDocument(options: {
|
|
7
|
-
database: Record<string, Array<Record<string, unknown>>>;
|
|
8
|
-
files?: boolean;
|
|
9
|
-
maxPageSize?: number;
|
|
10
|
-
schema?: Record<string, unknown>;
|
|
11
|
-
}): Record<string, unknown>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const createOpenapi: ({ database, files, host, maxPageSize, port, schema }: {
|
|
2
|
-
database: any;
|
|
3
|
-
files: any;
|
|
4
|
-
host?: string | undefined;
|
|
5
|
-
maxPageSize: any;
|
|
6
|
-
port?: number | undefined;
|
|
7
|
-
schema: any;
|
|
8
|
-
}) => Record<string, unknown>;
|
|
9
|
-
export declare const writeOpenapi: (document: any, outputPath: any) => Promise<void>;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const mergeSchemas: (schemas: any) => any;
|
|
2
|
-
export declare const mergeSchemaOverrides: (schema: any, overrides: any) => any;
|
|
3
|
-
export declare const applyRequiredFields: (schema: any, path: any, requiredFields: any) => any;
|
|
4
|
-
export declare const inferSchema: (values: any) => any;
|
|
5
|
-
export declare function inferObjectSchema(values: any): any;
|
|
6
|
-
export declare const ensureGeneratedIdSchema: (schema: any) => any;
|
|
7
|
-
export declare const getSchemasAtPath: (schema: any, keys: any) => any;
|
|
8
|
-
export declare const updateSchemasAtPath: (schema: any, keys: any, update: any) => any;
|
|
9
|
-
export declare const omitId: (schema: any, keepRequired: any) => any;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const sortItems: (items: any, sort: any, validationItems?: any) => any[];
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export declare const getRelationKeys: (...names: any[]) => string[];
|
|
2
|
-
export declare const resolveRelationResource: (resourceNames: any, relation: any, sourceResource: any) => any;
|
|
3
|
-
export declare const getRelationMetadata: (key: any, resourceNames: any, sourceResource: any) => {
|
|
4
|
-
isMany: boolean;
|
|
5
|
-
relationName: any;
|
|
6
|
-
reverseRelationName: any;
|
|
7
|
-
sourceResource: any;
|
|
8
|
-
targetResource: any;
|
|
9
|
-
} | undefined;
|
package/types/src/relations.d.ts
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export declare const parseEmbedPaths: (embed: any) => any[];
|
|
2
|
-
export declare const validateEmbedPaths: (database: any, resource: any, items: any, embedPaths: any) => void;
|
|
3
|
-
export declare const embedItem: (database: any, item: any, resource: any, embedPaths: any, indexes?: Map<any, any>) => any;
|
package/types/src/server.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
export type OpenapiDocument = Record<string, unknown>;
|
|
2
|
-
export type ServerFacade = {
|
|
3
|
-
fastify: () => import('fastify').FastifyInstance;
|
|
4
|
-
openapi: () => Promise<OpenapiDocument>;
|
|
5
|
-
};
|
|
6
|
-
/**
|
|
7
|
-
* Creates lazy Fastify and OpenAPI accessors from one configuration.
|
|
8
|
-
* @param {import('./config.js').DeepJsonServerConfig} config Server configuration.
|
|
9
|
-
* @param {{ files?: boolean }} [features] Optional feature switches.
|
|
10
|
-
* @returns {Promise<ServerFacade>} Server facade.
|
|
11
|
-
*/
|
|
12
|
-
export declare function createServer(config: import('./config.js').DeepJsonServerConfig, features?: {
|
|
13
|
-
files?: boolean;
|
|
14
|
-
}): Promise<ServerFacade>;
|
package/types/src/utils.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare const createHttpError: (statusCode: any, message: any) => Error;
|
|
2
|
-
/** @returns {<T>(operation: () => T | Promise<T>) => Promise<T>} Serialized operation scheduler. */
|
|
3
|
-
export declare const createSerialQueue: () => <T>(operation: () => T | Promise<T>) => Promise<T>;
|
|
4
|
-
/**
|
|
5
|
-
* Creates a random ID that is not currently in use.
|
|
6
|
-
* @param {(id: string) => boolean} isUsed Checks whether an ID already exists.
|
|
7
|
-
* @returns {string} Unique ID.
|
|
8
|
-
*/
|
|
9
|
-
export declare const createUniqueId: (isUsed: (id: string) => boolean) => string;
|
|
10
|
-
export declare const getResourceNames: (data: any) => string[];
|
|
11
|
-
export declare const isObject: (value: any) => boolean;
|
|
12
|
-
export declare const isSafeKey: (key: any) => boolean;
|
|
13
|
-
export declare const toArray: (value: any) => any[];
|
|
14
|
-
export declare const isEqual: (left: any, right: any) => any;
|
|
15
|
-
export declare const resolveDatabasePath: (databasePath: any) => any;
|
|
16
|
-
export declare const isIdEqual: (left: any, right: any) => boolean;
|
|
17
|
-
export declare const singularize: (value: any) => any;
|
|
18
|
-
export declare const toPascalCase: (value: any) => any;
|
|
File without changes
|
|
File without changes
|