Module: devtools-node
Node.js-specific development tools.
Installation
npm install --dev @composedb/devtools-node
Type Aliases
PathInput
Ƭ PathInput: URL | string
Path to a local file. If relative, it will get resolved from the current working directory.
ServeDefinitionParams
Ƭ ServeDefinitionParams: ServeParams & { path: PathInput }
ServeGraphQLParams
Ƭ ServeGraphQLParams: ServeParams & { definition: RuntimeCompositeDefinition ; readonly?: boolean }
ServeParams
Ƭ ServeParams: Object
Type declaration
| Name | Type | Description |
|---|---|---|
ceramicURL | string | URL of the Ceramic node. |
did? | DID | Optional DID instance attached to the Ceramic client. |
graphiql? | boolean | Enable GraphiQL on the server. |
port? | number | number[] | Port to use, if available. |
ServerHandler
Ƭ ServerHandler: Object
Type declaration
| Name | Type | Description |
|---|---|---|
stop | (callback?: (err?: Error) => void) => void | Stop the server. |
url | string | URL of the local GraphQL endpoint. |
Functions
createComposite
▸ createComposite(ceramic, path): Promise<Composite>
Create a Composite from a GraphQL schema path.
Parameters
| Name | Type |
|---|---|
ceramic | CeramicClient |
path | PathInput |
Returns
Promise<Composite>
mergeEncodedComposites
▸ mergeEncodedComposites(ceramic, source, destination): Promise<string>
Merge the encoded source composite(s) to the destination path.
Parameters
| Name | Type |
|---|---|
ceramic | string | CeramicClient |
source | PathInput | PathInput[] |
destination | PathInput |
Returns
Promise<string>
readEncodedComposite
▸ readEncodedComposite(ceramic, path, index?): Promise<Composite>
Create a Composite from a JSON-encoded definition path.
Parameters
| Name | Type |
|---|---|
ceramic | string | CeramicClient |
path | PathInput |
index? | boolean |
Returns
Promise<Composite>
serveEncodedDefinition
▸ serveEncodedDefinition(params): Promise<ServerHandler>
Create a local GraphQL server to interact with an encoded composite definition.
Parameters
| Name | Type |
|---|---|
params | ServeDefinitionParams |
Returns
Promise<ServerHandler>
serveGraphQL
▸ serveGraphQL(params): Promise<ServerHandler>
Create a local GraphQL server to interact with a runtime composite definition.
Parameters
| Name | Type |
|---|---|
params | ServeGraphQLParams |
Returns
Promise<ServerHandler>
writeEncodedComposite
▸ writeEncodedComposite(composite, path): Promise<string>
Write a JSON-encoded definition for the given composite to the given file path.
Parameters
| Name | Type |
|---|---|
composite | Composite |
path | PathInput |
Returns
Promise<string>
writeEncodedCompositeRuntime
▸ writeEncodedCompositeRuntime(ceramic, definitionPath, runtimePath, schemaPath?): Promise<void>
Write the runtime definition based on the encoded definition path.
Parameters
| Name | Type |
|---|---|
ceramic | string | CeramicClient |
definitionPath | PathInput |
runtimePath | PathInput |
schemaPath? | PathInput |
Returns
Promise<void>
writeGraphQLSchema
▸ writeGraphQLSchema(definition, path, readonly?): Promise<string>
Write the runtime GraphQL schema from the runtime composite definition.
Parameters
| Name | Type |
|---|---|
definition | RuntimeCompositeDefinition |
path | PathInput |
readonly? | boolean |
Returns
Promise<string>
writeRuntimeDefinition
▸ writeRuntimeDefinition(definition, path): Promise<string>
Write the runtime definition for a given path, based on the file extension. Supports .json,
.js and .ts extensions.
Parameters
| Name | Type |
|---|---|
definition | RuntimeCompositeDefinition |
path | PathInput |
Returns
Promise<string>