-
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
80 changed files
with
930 additions
and
27 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
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 |
---|---|---|
@@ -1,15 +1,25 @@ | ||
{ | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"noEmit": true, | ||
"esModuleInterop": true, | ||
"moduleResolution": "nodenext", | ||
"target": "ES2022", | ||
"typeRoots": ["node_modules/@types"], | ||
"module": "NodeNext", | ||
"checkJs": true, | ||
"strict": false, // true for making types mandatory | ||
// Tells TypeScript to read JS files, as | ||
// normally they are ignored as source files | ||
"allowJs": true, | ||
"strict": false // true for making types mandatory | ||
// Generate d.ts files | ||
"declaration": true, | ||
// This compiler run should | ||
// only output d.ts files | ||
"emitDeclarationOnly": true, | ||
// Types should go into this directory. | ||
// Removing this would place the .d.ts files | ||
// next to the .js file | ||
"outDir": "types" | ||
}, | ||
"include": ["./**/*.js"] | ||
} |
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,38 @@ | ||
/** | ||
* Return a reducer function deriving local props and nested props | ||
* @param {object} opts - Options | ||
* @param {string} opts.field_alias_path - Current address path of the resource | ||
* @param {Function} opts.extract - Function for handling the extraction of content | ||
* @param {object} opts.table_schema - Table schema/Data model | ||
* @param {object} opts.dareInstance - Instance of Dare which is calling this | ||
* @returns {(fieldsArray: array, field: string | object, index: number, originalArray: array) => array} Fields Reducer function | ||
*/ | ||
export default function fieldReducer({ | ||
field_alias_path, | ||
extract, | ||
table_schema, | ||
dareInstance, | ||
}: { | ||
field_alias_path: string; | ||
extract: Function; | ||
table_schema: object; | ||
dareInstance: object; | ||
}): ( | ||
fieldsArray: any[], | ||
field: string | object, | ||
index: number, | ||
originalArray: any[] | ||
) => any[]; | ||
/** | ||
* Get target path | ||
* Given a model path, such as `picture`, reduce it of the parent path in the request path like `picture.url` | ||
* So the result would be empty path because the target is on the base. | ||
* If model path is `picture` and the request path is `url`, then the target path is just `picture` | ||
* @param {string} modelPath - Model Path | ||
* @param {string} requestPath - Request Path (incl. field) | ||
* @returns {Array<string>} Target path | ||
*/ | ||
export function getTargetPath( | ||
modelPath: string, | ||
requestPath: string | ||
): Array<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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export default function groupbyReducer({ | ||
current_path, | ||
extract, | ||
}: { | ||
current_path: any; | ||
extract: any; | ||
}): (list: any, item: any, index: any) => any; |
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,13 @@ | ||
/** | ||
* Join Handler | ||
* Obtain the table join conditions which says how two tables reference one another | ||
* @param {object} join_object - The object being joined | ||
* @param {object} root_object - The root object, for which we want the join_object too attach | ||
* @param {object} dareInstance - Dare Instance | ||
* @returns {object} An updated join_object with new join_conditions attached | ||
*/ | ||
export default function joinHandler( | ||
join_object: object, | ||
root_object: object, | ||
dareInstance: object | ||
): object; |
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,39 @@ | ||
/** | ||
* @typedef {object} LimitClause | ||
* @property {number} limit - Limit defintion | ||
* @property {number} [start] - Start defintion | ||
* @property {boolean} [single] - Whether this is a single limit | ||
*/ | ||
/** | ||
* Limit Clause | ||
* Set/Check limit and start positions | ||
* @param {object} opts - Options object | ||
* @param {number} opts.limit - Limit defintion | ||
* @param {number} opts.start - Start defintion | ||
* @param {number} MAX_LIMIT - Max limit on instance | ||
* @returns {LimitClause} - Limit Clause | ||
*/ | ||
export default function limitClause( | ||
{ | ||
limit, | ||
start, | ||
}: { | ||
limit: number; | ||
start: number; | ||
}, | ||
MAX_LIMIT: number | ||
): LimitClause; | ||
export type LimitClause = { | ||
/** | ||
* - Limit defintion | ||
*/ | ||
limit: number; | ||
/** | ||
* - Start defintion | ||
*/ | ||
start?: number; | ||
/** | ||
* - Whether this is a single limit | ||
*/ | ||
single?: boolean; | ||
}; |
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,12 @@ | ||
declare function _default({ | ||
current_path, | ||
extract, | ||
table_schema, | ||
dareInstance, | ||
}: { | ||
current_path: any; | ||
extract: any; | ||
table_schema: any; | ||
dareInstance: any; | ||
}): (list: any, item: any, index: any) => any; | ||
export default _default; |
Oops, something went wrong.