@akanjs/server 0.0.39 → 0.0.41

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/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "./src";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akanjs/server",
3
- "version": "0.0.39",
3
+ "version": "0.0.41",
4
4
  "type": "commonjs",
5
5
  "scripts": {
6
6
  "postinstall": "pnpm install @nestjs/mongoose@^10.1.0"
package/src/boot.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { BackendEnv } from "@akanjs/base";
2
+ import { DynamicModule, INestApplication } from "@nestjs/common";
3
+ interface AppCreateForm {
4
+ registerModules: (options: any) => (DynamicModule | null)[];
5
+ serverMode?: "federation" | "batch" | "all" | "none";
6
+ env: BackendEnv;
7
+ log?: boolean;
8
+ }
9
+ export interface BackendApp {
10
+ nestApp: INestApplication;
11
+ close: () => Promise<void>;
12
+ }
13
+ export declare const createNestApp: ({ registerModules, serverMode, env, log }: AppCreateForm) => Promise<{
14
+ nestApp: INestApplication<any>;
15
+ close: () => Promise<void>;
16
+ }>;
17
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Type } from "@akanjs/base";
2
+ export declare const controllerOf: (sigRef: Type, allSrvs: {
3
+ [key: string]: Type;
4
+ }) => {
5
+ new (): {};
6
+ };
package/src/gql.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { BaseObject, Dayjs, Type } from "@akanjs/base";
2
+ import { ConstantFieldMeta, DocumentModel } from "@akanjs/constant";
3
+ import type { Doc } from "@akanjs/document";
4
+ import * as Nest from "@nestjs/graphql";
5
+ import { ValueNode } from "graphql";
6
+ export declare class DateScalar implements Nest.CustomScalar<Date, Dayjs> {
7
+ description: string;
8
+ parseValue(value: number): Dayjs;
9
+ serialize(value: Dayjs): Date;
10
+ parseLiteral(ast: ValueNode): Dayjs;
11
+ }
12
+ export declare const applyNestField: (model: Type, fieldMeta: ConstantFieldMeta, type?: "object" | "input") => void;
13
+ export declare const generateGqlInput: <InputModel>(inputRef: Type<InputModel>) => Type<DocumentModel<InputModel>>;
14
+ export declare const generateGql: <ObjectModel>(objectRef: Type<ObjectModel>) => Type<ObjectModel extends BaseObject ? Doc<ObjectModel> : DocumentModel<ObjectModel>>;
package/src/index.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ export * from "./gql";
2
+ export * from "./resolver";
3
+ export * from "./controller";
4
+ export * from "./processor";
5
+ export * from "./module";
6
+ export * from "./types";
7
+ export * from "./websocket";
8
+ export * from "./boot";
9
+ export * from "./searchDaemon";
10
+ export * from "./schema";
@@ -0,0 +1,79 @@
1
+ import type { Type } from "@akanjs/base";
2
+ import { type ConstantModel } from "@akanjs/constant";
3
+ import { Database } from "@akanjs/document";
4
+ import { DynamicModule } from "@nestjs/common";
5
+ interface DatabaseModuleCreateOptions {
6
+ constant: ConstantModel<string, any, any, any, any, any>;
7
+ database: Database<string, any, any, any, any, any, any, any, any>;
8
+ signal: Type;
9
+ service: Type;
10
+ uses?: {
11
+ [key: string]: any;
12
+ };
13
+ useAsyncs?: {
14
+ [key: string]: () => Promise<any>;
15
+ };
16
+ providers?: Type[];
17
+ extended?: boolean;
18
+ }
19
+ export declare const databaseModuleOf: ({ constant, database, signal, service, uses, useAsyncs, providers, extended, }: DatabaseModuleCreateOptions, allSrvs: {
20
+ [key: string]: Type | undefined;
21
+ }) => DynamicModule | null;
22
+ interface ServiceModuleCreateOptions {
23
+ signal: Type;
24
+ service: Type;
25
+ uses?: {
26
+ [key: string]: any;
27
+ };
28
+ useAsyncs?: {
29
+ [key: string]: () => Promise<any>;
30
+ };
31
+ providers?: Type[];
32
+ }
33
+ export declare const serviceModuleOf: ({ signal, service, uses, useAsyncs, providers }: ServiceModuleCreateOptions, allSrvs: {
34
+ [key: string]: Type | undefined;
35
+ }) => DynamicModule | null;
36
+ interface ScalarModuleCreateOptions {
37
+ signals: Type[];
38
+ uses?: {
39
+ [key: string]: any;
40
+ };
41
+ useAsyncs?: {
42
+ [key: string]: () => Promise<any>;
43
+ };
44
+ providers?: Type[];
45
+ enabled?: boolean;
46
+ }
47
+ export declare const scalarModuleOf: ({ signals, uses, useAsyncs, providers, enabled }: ScalarModuleCreateOptions, allSrvs: {
48
+ [key: string]: Type | undefined;
49
+ }) => DynamicModule | null;
50
+ interface ScalarModulesCreateOptions {
51
+ constants: Type[];
52
+ }
53
+ export declare const scalarModulesOf: ({ constants }: ScalarModulesCreateOptions, allSrvs: {
54
+ [key: string]: Type | undefined;
55
+ }) => DynamicModule | null;
56
+ interface BatchModuleCreateOptions {
57
+ service: Type;
58
+ uses?: {
59
+ [key: string]: any;
60
+ };
61
+ useAsyncs?: {
62
+ [key: string]: () => Promise<any>;
63
+ };
64
+ providers?: Type[];
65
+ }
66
+ export declare const batchModuleOf: ({ service, uses, useAsyncs, providers, }: BatchModuleCreateOptions) => DynamicModule | null;
67
+ interface UseGlobalsCreateOptions {
68
+ uses?: {
69
+ [key: string]: any;
70
+ };
71
+ useAsyncs?: {
72
+ [key: string]: () => Promise<any>;
73
+ };
74
+ injects?: {
75
+ [key: string]: Type;
76
+ };
77
+ }
78
+ export declare const useGlobals: ({ uses, useAsyncs, injects }: UseGlobalsCreateOptions) => DynamicModule;
79
+ export {};
@@ -0,0 +1,8 @@
1
+ import { Type } from "@akanjs/base";
2
+ import type { Queue } from "bull";
3
+ export declare const processorOf: (sigRef: Type, allSrvs: {
4
+ [key: string]: Type;
5
+ }) => {
6
+ new (): {};
7
+ };
8
+ export declare const queueOf: (sigRef: Type, queue: Queue) => Queue<any>;
@@ -0,0 +1,6 @@
1
+ import { Type } from "@akanjs/base";
2
+ export declare const resolverOf: (sigRef: Type, allSrvs: {
3
+ [key: string]: Type;
4
+ }) => {
5
+ new (): {};
6
+ };
@@ -0,0 +1,5 @@
1
+ import { Type } from "@akanjs/base";
2
+ import { BaseMiddleware } from "@akanjs/document";
3
+ import { Schema } from "mongoose";
4
+ export declare const schemaOf: <Mdl, Doc, Middleware extends BaseMiddleware>(modelRef: Type<Mdl>, docRef: Type<Doc>, middleware: Type<Middleware>) => Schema<null, Mdl, Doc, undefined, null, Mdl>;
5
+ export declare const addSchema: <Mdl, Doc, Input, Middleware extends BaseMiddleware>(modelRef: Type<Mdl>, docRef: Type<Doc>, inputRef: Type<Input>, middleware: Type<Middleware>) => Schema<null, Mdl, Doc, undefined, null, Mdl>;
@@ -0,0 +1,7 @@
1
+ import type { Type } from "@akanjs/base";
2
+ import { type TextDoc } from "@akanjs/constant";
3
+ export declare const makeTextFilter: (modelRef: Type) => (data: Record<string, any>, assignObj?: {
4
+ [key: string]: string;
5
+ }) => TextDoc;
6
+ export declare class SearchDaemonModule {
7
+ }
package/src/types.d.ts ADDED
@@ -0,0 +1,15 @@
1
+ import type { ReadStream } from "fs";
2
+ import type { Readable } from "stream";
3
+ export type { DynamicModule as Module } from "@nestjs/common";
4
+ export interface FileStream {
5
+ filename: string;
6
+ mimetype: string;
7
+ encoding: string;
8
+ createReadStream(): ReadStream | Readable;
9
+ }
10
+ export interface LocalFile {
11
+ filename: string;
12
+ mimetype: string;
13
+ encoding: string;
14
+ localPath: string;
15
+ }
@@ -0,0 +1,17 @@
1
+ import { Type } from "@akanjs/base";
2
+ import type { Server } from "socket.io";
3
+ export interface Response<T> {
4
+ data: T;
5
+ }
6
+ export declare const websocketOf: (sigRef: Type, allSrvs: {
7
+ [key: string]: Type;
8
+ }) => {
9
+ new (): {
10
+ __sigRef__: Type;
11
+ };
12
+ };
13
+ export declare const websocketServerOf: (sigRef: Type) => {
14
+ new (): {
15
+ server: Server;
16
+ };
17
+ };