Skip to main content
Version: 0.2.x

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

NameTypeDescription
ceramicURLstringURL of the Ceramic node.
did?DIDOptional DID instance attached to the Ceramic client.
graphiql?booleanEnable GraphiQL on the server.
port?number | number[]Port to use, if available.

ServerHandler

Ƭ ServerHandler: Object

Type declaration

NameTypeDescription
stop(callback?: (err?: Error) => void) => voidStop the server.
urlstringURL of the local GraphQL endpoint.

Functions

createComposite

createComposite(ceramic, path): Promise<Composite>

Create a Composite from a GraphQL schema path.

Parameters

NameType
ceramicstring | CeramicClient
pathPathInput

Returns

Promise<Composite>


mergeEncodedComposites

mergeEncodedComposites(ceramic, source, destination): Promise<string>

Merge the encoded source composite(s) to the destination path.

Parameters

NameType
ceramicstring | CeramicClient
sourcePathInput | PathInput[]
destinationPathInput

Returns

Promise<string>


readEncodedComposite

readEncodedComposite(ceramic, path): Promise<Composite>

Create a Composite from a JSON-encoded definition path.

Parameters

NameType
ceramicstring | CeramicClient
pathPathInput

Returns

Promise<Composite>


serveEncodedDefinition

serveEncodedDefinition(params): Promise<ServerHandler>

Create a local GraphQL server to interact with an encoded composite definition.

Parameters

NameType
paramsServeDefinitionParams

Returns

Promise<ServerHandler>


serveGraphQL

serveGraphQL(params): Promise<ServerHandler>

Create a local GraphQL server to interact with a runtime composite definition.

Parameters

NameType
paramsServeGraphQLParams

Returns

Promise<ServerHandler>


writeEncodedComposite

writeEncodedComposite(composite, path): Promise<string>

Write a JSON-encoded definition for the given composite to the given file path.

Parameters

NameType
compositeComposite
pathPathInput

Returns

Promise<string>


writeEncodedCompositeRuntime

writeEncodedCompositeRuntime(ceramic, definitionPath, runtimePath, schemaPath?): Promise<void>

Write the runtime definition based on the encoded definition path.

Parameters

NameType
ceramicstring | CeramicClient
definitionPathPathInput
runtimePathPathInput
schemaPath?PathInput

Returns

Promise<void>


writeGraphQLSchema

writeGraphQLSchema(definition, path, readonly?): Promise<string>

Write the runtime GraphQL schema from the runtime composite definition.

Parameters

NameType
definitionRuntimeCompositeDefinition
pathPathInput
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

NameType
definitionRuntimeCompositeDefinition
pathPathInput

Returns

Promise<string>