This repository has been archived by the owner on Mar 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 867
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
1 parent
81d95dd
commit 0e7615f
Showing
2 changed files
with
68 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
interface EntitySchemaOptions { | ||
idAttribute?: string | Function; | ||
} | ||
|
||
interface IterableSchemaOptions { | ||
schemaAttribute?: string | Function; | ||
} | ||
|
||
interface UnionSchemaOptions { | ||
schemaAttribute?: string | Function; | ||
} | ||
|
||
type NormalizeOptions = { | ||
assignEntity?: Function; | ||
mergeIntoEntity?: Function; | ||
} | ||
|
||
type NormalizeInput = Object | Array<Object>; | ||
|
||
type NormalizeOutput = { | ||
result: any; | ||
entities?: any; | ||
} | ||
|
||
class EntitySchema { | ||
constructor (key: string, options?: EntitySchemaOptions); | ||
|
||
define(schema: SchemaMap): this; | ||
mappedBy(attr: string): this; | ||
getKey(): string; | ||
getIdAttribute(): string; | ||
} | ||
|
||
class IterableSchema { | ||
} | ||
|
||
class UnionSchema { | ||
} | ||
|
||
type SchemaValue = EntitySchema | IterableSchema | UnionSchema | SchemaMap; | ||
|
||
interface SchemaMap { | ||
[key: string]: SchemaValue; | ||
} | ||
|
||
export function arrayOf( | ||
schema: SchemaValue, | ||
options?: IterableSchemaOptions | ||
): IterableSchema; | ||
|
||
export function valuesOf( | ||
schema: SchemaValue, | ||
options?: IterableSchemaOptions | ||
): IterableSchema; | ||
|
||
export function unionOf( | ||
schema: SchemaValue, | ||
options?: UnionSchemaOptions | ||
): UnionSchema; | ||
|
||
export function normalize( | ||
input: NormalizeInput, | ||
schema: SchemaValue, | ||
options?: NormalizeOptions | ||
): NormalizeOutput; | ||
|
||
export {EntitySchema as Schema}; |