generated from acttoreact/ts-node-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
93 changed files
with
3,378 additions
and
1,019 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import ts from 'typescript'; | ||
|
||
/** | ||
* For typescript nodes casting as docs container purposes | ||
*/ | ||
export interface JSDocContainer { | ||
/** | ||
* Optional JSDoc array | ||
* @type {ts.JSDoc[]} | ||
* @memberof JSDocContainer | ||
*/ | ||
jsDoc?: ts.JSDoc[]; | ||
} | ||
|
||
/** | ||
* Information regarding the return type of a function extracted using AST | ||
*/ | ||
export interface ReturnTypeInfo { | ||
/** | ||
* Return identifier | ||
* @type {string} | ||
* @memberof CompilerFileInfo | ||
*/ | ||
identifier: string; | ||
/** | ||
* Return type | ||
* @type {string} | ||
* @memberof CompilerFileInfo | ||
*/ | ||
type: string; | ||
/** | ||
* Return type | ||
* @type {string} | ||
* @memberof CompilerFileInfo | ||
*/ | ||
typeNode: ts.TypeNode | null; | ||
} | ||
|
||
/** | ||
* Model imports information | ||
*/ | ||
export interface ModelImport { | ||
/** | ||
* Import clause | ||
*/ | ||
clause: ts.ImportClause; | ||
/** | ||
* Path to import from | ||
*/ | ||
path: string; | ||
/** | ||
* Related source file | ||
*/ | ||
sourceFile?: ts.SourceFile; | ||
} | ||
|
||
/** | ||
* Model imports information | ||
*/ | ||
export interface GroupedModelImports { | ||
/** | ||
* Default import | ||
*/ | ||
def?: string; | ||
/** | ||
* Named imports | ||
*/ | ||
named?: string[]; | ||
/** | ||
* Path to import from | ||
*/ | ||
path: string; | ||
} | ||
|
||
/** | ||
* API module info | ||
*/ | ||
export interface ModuleInfo { | ||
/** | ||
* Main method node | ||
* @memberof ModuleInfo | ||
*/ | ||
mainMethodNode: ts.FunctionDeclaration | ts.ArrowFunction; | ||
/** | ||
* Main method name | ||
* @memberof ModuleInfo | ||
*/ | ||
mainMethodName: string; | ||
/** | ||
* Main method parameters nodes | ||
* @type {ts.ParameterDeclaration[]} | ||
* @memberof ModuleInfo | ||
*/ | ||
mainMethodParamNodes: ts.ParameterDeclaration[]; | ||
/** | ||
* Main method JSDoc node | ||
* @type {JSDocContainer} | ||
* @memberof ModuleInfo | ||
*/ | ||
mainMethodDocs: JSDocContainer; | ||
/** | ||
* Main method return type info | ||
* @type {ReturnTypeInfo} | ||
* @memberof ModuleInfo | ||
*/ | ||
mainMethodReturnTypeInfo: Required<ReturnTypeInfo>; | ||
/** | ||
* Module model imports | ||
*/ | ||
modelImports: ModelImport[]; | ||
/** | ||
* Keys based on file path (for proxy API object) | ||
*/ | ||
keys: string[]; | ||
} | ||
|
||
/** | ||
* API Method in Client API structure | ||
*/ | ||
export interface ApiMethod { | ||
/** | ||
* Property key | ||
* @type {string} | ||
* @memberof ApiMethod | ||
*/ | ||
key: string; | ||
/** | ||
* Method name | ||
* @type {string} | ||
* @memberof ApiMethod | ||
*/ | ||
methodName: string; | ||
} | ||
|
||
/** | ||
* API Namespace in proxy API structure | ||
*/ | ||
export interface ApiNamespace { | ||
/** | ||
* Property key | ||
* @type {string} | ||
* @memberof ApiNamespace | ||
*/ | ||
key: string; | ||
/** | ||
* Namespaces for property (object sub-objects) | ||
* @type {ApiNamespace[]} | ||
* @memberof ApiNamespace | ||
*/ | ||
namespaces: ApiNamespace[]; | ||
/** | ||
* Methods for property (object methods) | ||
* @type {ApiMethod[]} | ||
* @memberof ApiNamespace | ||
*/ | ||
methods: ApiMethod[]; | ||
} | ||
|
||
/** | ||
* API module | ||
*/ | ||
export interface APIModule { | ||
/** | ||
* Module default export. Must be a `function` and return a `Promise`. Should contain a method to be called from client | ||
* @memberof APIModule | ||
*/ | ||
default: (...args: any[]) => Promise<any>; | ||
/** | ||
* Module dispose method. Optional. Will be called when a module is disposed or updated. | ||
* @memberof APIModule | ||
*/ | ||
dispose?: () => Promise<void>; | ||
} | ||
|
||
/** | ||
* API levels structure | ||
*/ | ||
export interface APIStructure { | ||
[id: string]: APIModule; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import io from 'socket.io'; | ||
import { ParsedUrlQuery } from 'querystring'; | ||
|
||
/** | ||
* Socket basic call | ||
*/ | ||
export interface SocketCall { | ||
/** | ||
* Unique ID for socket transmission | ||
* @memberof SocketCall | ||
*/ | ||
id: string; | ||
} | ||
|
||
/** | ||
* Socket method call | ||
*/ | ||
export interface MethodCall extends SocketCall { | ||
/** | ||
* API Method name corresponding to complete key (like 'users.login') | ||
* @memberof MethodCall | ||
*/ | ||
method: string; | ||
/** | ||
* Params for API Method | ||
* @memberof MethodCall | ||
*/ | ||
params: any[]; | ||
}; | ||
|
||
/** | ||
* Socket data provider call | ||
*/ | ||
export interface DataProviderCall extends SocketCall { | ||
/** | ||
* Page pathname (from Next.js router) | ||
* @memberof DataProviderCall | ||
*/ | ||
pathname: string; | ||
/** | ||
* Parsed url query | ||
* @memberof DataProviderCall | ||
*/ | ||
query: ParsedUrlQuery; | ||
} | ||
|
||
/** | ||
* Socket standard response | ||
*/ | ||
export interface SocketMessage { | ||
/** | ||
* Operation was ok (0) or not (1) | ||
* @memberof SocketMessage | ||
*/ | ||
o: number; | ||
/** | ||
* Operation error (if any) | ||
* @memberof SocketMessage | ||
*/ | ||
e?: string; | ||
/** | ||
* Operation stack (if error) | ||
* @memberof SocketMessage | ||
*/ | ||
s?: string; | ||
/** | ||
* Operation return data | ||
* @memberof SocketMessage | ||
*/ | ||
d: any; | ||
}; | ||
|
||
export interface A2RSocket extends io.Socket { | ||
sessionId: string; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.