-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: feed, graph, username builders
- Loading branch information
1 parent
7fa5f07
commit b4a1b77
Showing
16 changed files
with
316 additions
and
128 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,51 @@ | ||
import { v4 } from 'uuid'; | ||
|
||
import { evaluate } from './ValidationError'; | ||
import { FeedMetadataSchemaId, FeedMetadata, FeedMetadataSchema } from '../feed'; | ||
|
||
export type FeedOptions = { | ||
/** | ||
* A unique identifier that in storages like IPFS ensures the uniqueness of the metadata URI. | ||
* | ||
* @defaultValue a UUID | ||
*/ | ||
id?: string; | ||
/** | ||
* The name of the Feed. | ||
*/ | ||
name: string; | ||
/** | ||
* The human-friendly title for the Feed. | ||
*/ | ||
title: string; | ||
/** | ||
* Optional markdown formatted description of the Feed. | ||
*/ | ||
description?: string | null; | ||
}; | ||
|
||
/** | ||
* Creates a valid FeedMetadata. | ||
* | ||
* ```ts | ||
* const metadata = feed({ | ||
* name: 'XYZ', | ||
* title: 'Not Just Another Feed… or is it?', | ||
* description: 'Bringing you one step closer to achieving absolutely nothing, but in style!', | ||
* }); | ||
* ``` | ||
* | ||
* @category Compose | ||
* @param input - Use your IDE suggestions for an enhanced development experience | ||
*/ | ||
export function feed({ id = v4(), ...others }: FeedOptions): FeedMetadata { | ||
return evaluate( | ||
FeedMetadataSchema.safeParse({ | ||
$schema: FeedMetadataSchemaId.LATEST, | ||
lens: { | ||
id, | ||
...others, | ||
}, | ||
}), | ||
); | ||
} |
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,51 @@ | ||
import { v4 } from 'uuid'; | ||
|
||
import { evaluate } from './ValidationError'; | ||
import { GraphMetadataSchemaId, GraphMetadata, GraphMetadataSchema } from '../graph'; | ||
|
||
export type GraphOptions = { | ||
/** | ||
* A unique identifier that in storages like IPFS ensures the uniqueness of the metadata URI. | ||
* | ||
* @defaultValue a UUID | ||
*/ | ||
id?: string; | ||
/** | ||
* The name of the Graph. | ||
*/ | ||
name: string; | ||
/** | ||
* The human-friendly title for the Graph. | ||
*/ | ||
title: string; | ||
/** | ||
* Optional markdown formatted description of the Graph. | ||
*/ | ||
description?: string | null; | ||
}; | ||
|
||
/** | ||
* Creates a valid GraphMetadata. | ||
* | ||
* ```ts | ||
* const metadata = graph({ | ||
* name: 'XYZ', | ||
* title: 'Not Just Another Graph… or is it?', | ||
* description: 'Bringing you one step closer to achieving absolutely nothing, but in style!', | ||
* }); | ||
* ``` | ||
* | ||
* @category Compose | ||
* @param input - Use your IDE suggestions for an enhanced development experience | ||
*/ | ||
export function graph({ id = v4(), ...others }: GraphOptions): GraphMetadata { | ||
return evaluate( | ||
GraphMetadataSchema.safeParse({ | ||
$schema: GraphMetadataSchemaId.LATEST, | ||
lens: { | ||
id, | ||
...others, | ||
}, | ||
}), | ||
); | ||
} |
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,6 +1,9 @@ | ||
export * from './account.js'; | ||
export * from './app.js'; | ||
export * from './encryption.js'; | ||
export * from './feed.js'; | ||
export * from './graph.js'; | ||
export * from './modules.js'; | ||
export * from './posts.js'; | ||
export * from './username.js'; | ||
export { ValidationError } from './ValidationError.js'; |
Oops, something went wrong.