-
Notifications
You must be signed in to change notification settings - Fork 72
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
Michiel de Jong
committed
Sep 14, 2015
1 parent
2775503
commit df1c28a
Showing
9 changed files
with
330 additions
and
70 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
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,22 @@ | ||
"use strict"; | ||
|
||
/** | ||
* Id schema class, providing an interface for generating and validating | ||
* id's. | ||
* | ||
* This class is provided as a base class you should extend to implement your | ||
* own id schemas. | ||
*/ | ||
export default class IdSchema { | ||
get type() { | ||
return "idschema"; | ||
} | ||
|
||
generate() { | ||
throw new Error("Not implemented."); | ||
} | ||
|
||
validate(id) { | ||
throw new Error("Not implemented."); | ||
} | ||
} |
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,25 @@ | ||
"use strict"; | ||
|
||
// import { IdSchema } from "./idschema"; | ||
|
||
import { v4 as uuid4 } from "uuid"; | ||
import { isUUID4 } from "../utils"; | ||
|
||
/** | ||
* The UUID4-based IdSchema used by default for Kinto collections. | ||
*/ | ||
export default class UuidSchema /* extends IdSchema */ { | ||
//// FIXME: inherit this from IdSchema | ||
get type() { | ||
return "idschema"; | ||
} | ||
//// | ||
|
||
generate() { | ||
return uuid4(); | ||
} | ||
|
||
validate(id) { | ||
return isUUID4(id); | ||
} | ||
} |
Oops, something went wrong.