### Local Installation of Community Solid Server (Node.js) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/starting-server Install the Community Solid Server npm package globally. After installation, you can run the server using the `community-solid-server` command. Add parameters as needed for specific configurations, such as persistent storage. ```bash npm install -g @solid/community-server ``` ```bash community-solid-server # add parameters if needed ``` ```bash community-solid-server -c @css:config/file.json -f data/ ``` -------------------------------- ### Run Community Solid Server from Source (Git/Node.js) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/starting-server Clone the Community Solid Server repository, install dependencies, and start the server using npm. This method allows you to run the latest source code or a specific branch. Parameters can be passed using the `--` separator. ```bash git clone https://github.com/CommunitySolidServer/CommunitySolidServer.git cd CommunitySolidServer npm ci npm start -- # add parameters if needed ``` -------------------------------- ### Run Community Solid Server with Docker Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/starting-server Deploy the Community Solid Server using Docker. These examples demonstrate serving local data, using built-in configurations, mounting custom configurations, and setting environment variables for server configuration. Ensure the necessary volumes and ports are mapped correctly. ```bash # Clone the repo to get access to the configs git clone https://github.com/CommunitySolidServer/CommunitySolidServer.git cd CommunitySolidServer # Run the image, serving your `~/Solid` directory on `http://localhost:3000` docker run --rm -v ~/Solid:/data -p 3000:3000 -it solidproject/community-server:latest ``` ```bash # Or use one of the built-in configurations docker run --rm -p 3000:3000 -it solidproject/community-server -c config/default.json ``` ```bash # Or use your own configuration mapped to the right directory docker run --rm -v ~/solid-config:/config -p 3000:3000 -it solidproject/community-server -c /config/my-config.json ``` ```bash # Or use environment variables to configure your css instance docker run --rm -v ~/Solid:/data -p 3000:3000 -it -e CSS_CONFIG=config/file-no-setup.json -e CSS_LOGGING_LEVEL=debug solidproject/community-server ``` -------------------------------- ### Run Community Solid Server Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/index Command to start the Community Solid Server using npx. Ensure Node.js 18.0 or higher is installed. The server will be accessible at http://localhost:3000/. ```bash npx @solid/community-server ``` -------------------------------- ### Deploy Community Solid Server with Helm Chart (Kubernetes) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/starting-server Add the Community Solid Server Helm chart repository and install the chart to deploy the server on a Kubernetes cluster. Refer to the official Helm Chart documentation for detailed installation instructions and customization options. ```bash helm repo add community-solid-server https://communitysolidserver.github.io/css-helm-chart/charts/ helm install my-css community-solid-server/community-solid-server ``` -------------------------------- ### Quickly Spin Up Community Solid Server (Node.js) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/starting-server Execute this command using Node.js to quickly start a Community Solid Server instance. Visit http://localhost:3000/ to access your server. For persistent storage, use the second command to specify a configuration file and data directory. ```bash npx @solid/community-server ``` ```bash npx @solid/community-server -c @css:config/file.json -f data/ ``` -------------------------------- ### Get Listeners for Event - Node.js Example Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/GenericEventEmitter Demonstrates the 'listeners' method, which returns a copy of the array of listeners registered for a specific event. This can be used to inspect which functions are handling a particular event. Requires the 'util' module for inspection. ```javascript const util = require('util'); // Assuming 'server' is an instance of EventEmitter // server.on('connection', (stream) => { // console.log('someone connected!'); // }); // console.log(util.inspect(server.listeners('connection'))); // Prints: [ [Function] ] ``` -------------------------------- ### Start CSS Server Programmatically with AppRunner Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/dev-configuration Initiate and manage the Community Solid Server instance directly within your code or tests. The `AppRunner` class provides `create`, `start`, and `stop` methods for server lifecycle management. Configuration is passed as an object to the `create` function. ```javascript import { AppRunner } from '@solid/community-server'; const runner = new AppRunner(); const server = await runner.create({ // Optional configuration parameters loaderProperties: { mainModulePath: './my-components', logLevel: 'info' }, config: '@css:config/custom.json', variableBindings: { 'urn:solid-server:default:variable:port': 3000 }, shorthand: { port: 3000, 'log-level': 'debug' }, argv: ['--port', '3000', '--log-level', 'debug'] }); await server.start(); // To stop the server: // await server.stop(); ``` -------------------------------- ### GET /:resource Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/example-requests Retrieve a resource. Supports various `Accept` header values for content negotiation. ```APIDOC ## GET /:resource ### Description Retrieve a resource at the specified URL. The `Accept` header can be used to request specific media types, including different serializations of turtle data. ### Method GET ### Endpoint `http://localhost:3000/:resource` ### Parameters #### Path Parameters - **resource** (string) - Required - The name of the resource to retrieve (e.g., `myfile.txt`). #### Query Parameters None #### Request Body None ### Request Example #### Plain Text ```bash curl -H "Accept: text/plain" \ http://localhost:3000/myfile.txt ``` #### Turtle ```bash curl -H "Accept: text/turtle" \ http://localhost:3000/myfile.ttl ``` #### JSON-LD (from Turtle) ```bash curl -H "Accept: application/ld+json" \ http://localhost:3000/myfile.ttl ``` ### Response #### Success Response (200) - **Body** (various types) - The content of the resource, matching the `Accept` header. #### Response Example (Response body will contain the resource content, e.g., 'abc' for `myfile.txt` or RDF triples for `myfile.ttl`.) ``` -------------------------------- ### JavaScript EventEmitter Example Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/MonitoringStore Demonstrates the basic usage of Node.js EventEmitter, which is the underlying mechanism for emitting events in MonitoringStore. It shows how to register multiple listeners for an event and how to emit the event with arguments. ```javascript const EventEmitter = require('events'); const myEmitter = new EventEmitter(); // First listener myEmitter.on('event', function firstListener() { console.log('Helloooo! first listener'); }); // Second listener myEmitter.on('event', function secondListener(arg1, arg2) { console.log(`event with parameters ${arg1}, ${arg2} in second listener`); }); // Third listener myEmitter.on('event', function thirdListener(...args) { const parameters = args.join(', '); console.log(`event with parameters ${parameters} in third listener`); }); console.log(myEmitter.listeners('event')); myEmitter.emit('event', 1, 2, 3, 4, 5); // Prints: // [ // [Function: firstListener], // [Function: secondListener], // [Function: thirdListener] // ] // Helloooo! first listener // event with parameters 1, 2 in second listener // event with parameters 1, 2, 3, 4, 5 in third listener ``` -------------------------------- ### Create Password Store Configuration Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/account/login-method Configuration example for creating a PasswordStore component, which handles storage for login method metadata. It specifies the storage type and relative path. ```json { "@id": "urn:solid-server:default:PasswordStore", "@type": "BasePasswordStore", "storage": { "@id": "urn:solid-server:default:PasswordStorage", "@type": "EncodingPathStorage", "relativePath": "/accounts/logins/password/", "source": { "@id": "urn:solid-server:default:KeyValueStorage" } } } ``` -------------------------------- ### Get Path to Type Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/WrappedIndexedStorage Determines the sequence of virtual keys required to access a specific type starting from the root of the object structure. This aids in navigation and data access logic. ```typescript /** * Returns the sequence of virtual keys to reach the given type, starting from the root. * @param type The target type. * @returns An array of virtual keys representing the path to the type. */ protected getPathToType(type: string): string[] ``` -------------------------------- ### POST / Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/example-requests Create a resource at a generated URL. Supports plain text and turtle file creation. ```APIDOC ## POST / ### Description Create a resource at a generated URL. The server will assign a unique identifier. Supports plain text and turtle file creation. ### Method POST ### Endpoint `http://localhost:3000/` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **data** (string) - Required - The content of the resource. ### Request Example #### Plain Text ```bash curl -X POST -H "Content-Type: text/plain" \ -d "abc" \ http://localhost:3000/ ``` #### Turtle ```bash curl -X POST -H "Content-Type: text/turtle" \ -d " ." \ http://localhost:3000/ ``` ### Response #### Success Response (201) - **Location** (string) - The URL of the created resource. #### Response Example (A `Location` header containing the URL of the created resource will be returned.) ``` -------------------------------- ### Verifying Inbox in Description Resource using GET (cURL) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/metadata This example demonstrates how to verify that an inbox has been successfully added to a resource's description by performing a GET request on the description resource itself. The response body, typically in Turtle or N3 format, will show the added `ldp:inbox` triple. ```curl curl 'http://localhost:3000/foo/.meta' ``` -------------------------------- ### Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BasePasswordStore Initializes a new instance of the BasePasswordStore class. ```APIDOC ## Constructor BasePasswordStore ### Description Initializes a new instance of the BasePasswordStore class. Passwords are hashed and salted. ### Method CONSTRUCTOR ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "storage": "KeyValueStorage object", "saltRounds": 10 } ``` ### Response #### Success Response (200) Returns an instance of `BasePasswordStore`. #### Response Example ```json { "instance": "BasePasswordStore" } ``` ``` -------------------------------- ### ClientIdAdapter Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/ClientIdAdapter Initializes a new instance of the ClientIdAdapter. ```APIDOC ## new ClientIdAdapter(name, source, converter) ### Description Initializes a new instance of the ClientIdAdapter. ### Method CONSTRUCTOR ### Parameters #### Path Parameters * None #### Query Parameters * None #### Request Body * None ### Request Example ```json { "name": "string", "source": "Adapter", "converter": "RepresentationConverter" } ``` ### Response #### Success Response (200) * Type: ClientIdAdapter * Description: An instance of ClientIdAdapter. #### Response Example ```json { "ClientIdAdapter": "instance" } ``` ``` -------------------------------- ### get Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BaseForgotPasswordStore Gets the email associated with the forgot password confirmation record. ```APIDOC ## GET /forgot-password/get/{recordId} ### Description Gets the email associated with the forgot password confirmation record or undefined if it's not present. ### Method GET ### Endpoint `/forgot-password/get/{recordId}` ### Parameters #### Path Parameters - **recordId** (string) - Required - The record id retrieved from the link. #### Query Parameters None #### Request Body None ### Request Example ```http GET /forgot-password/get/some-record-id ``` ### Response #### Success Response (200) - **email** (string | undefined) - The user's email, or undefined if the record is not found. #### Response Example ```json { "email": "user@example.com" } ``` ``` -------------------------------- ### BaseForgotPasswordStore Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BaseForgotPasswordStore Initializes a new instance of the BaseForgotPasswordStore class. ```APIDOC ## Constructor BaseForgotPasswordStore ### Description Initializes a new instance of the `BaseForgotPasswordStore` class. ### Method constructor ### Endpoint N/A (Class Constructor) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```json { "storage": "", "ttl": 15 } ``` ### Response #### Success Response (N/A - Constructor) N/A #### Response Example N/A ``` -------------------------------- ### GET: Retrieve Resources with curl Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/example-requests Retrieve resources from the Solid server using the GET HTTP method. The Accept header can be used to specify the desired representation of the resource. ```curl curl -H "Accept: text/plain" \ http://localhost:3000/myfile.txt ``` ```curl curl -H "Accept: text/turtle" \ http://localhost:3000/myfile.ttl ``` ```curl curl -H "Accept: application/ld+json" \ http://localhost:3000/myfile.ttl ``` -------------------------------- ### StorageDescriptionAdvertiser Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/StorageDescriptionAdvertiser Initializes a new instance of the StorageDescriptionAdvertiser class. This constructor requires a storage strategy and a relative path to construct the storage description resource link. ```APIDOC ## Constructor: StorageDescriptionAdvertiser ### Description Initializes a new instance of the `StorageDescriptionAdvertiser` class. ### Method `new StorageDescriptionAdvertiser(storageStrategy, relativePath): StorageDescriptionAdvertiser` ### Parameters #### Path Parameters - **storageStrategy** (StorageLocationStrategy) - Description of the storage strategy. - **relativePath** (string) - The relative path to the storage description resource. #### Returns - StorageDescriptionAdvertiser - An instance of the StorageDescriptionAdvertiser. ``` -------------------------------- ### get Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BaseLoginAccountStorage Retrieves a specific object by its type and identifier. ```APIDOC ## get ### Description Retrieves the object of the given type with the given identifier. ### Method GET ### Endpoint `/api/data/get` ### Parameters #### Query Parameters - **type** (string) - Required - The type of object to get. - **id** (string) - Required - The identifier of that object. ### Request Example ```json { "type": "Person", "id": "http://example.com/person/1" } ``` ### Response #### Success Response (200) - **object** (object | null) - A representation of the object, or `null` if there is no object of that type with that identifier. #### Response Example ```json { "object": { "id": "http://example.com/person/1", "name": "Alice", "age": 30 } } ``` ``` -------------------------------- ### ExpiringStorage - Get Method (TypeScript) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/ExpiringStorage Implements the get method for the ExpiringStorage interface. This method retrieves the value associated with a specific key. It returns a promise that resolves to the value if found, or undefined if no value is stored for the given key. ```typescript get: ((key: TKey) => Promise) ``` -------------------------------- ### Constructor for PodQuotaStrategy Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/PodQuotaStrategy Initializes a new instance of PodQuotaStrategy. It requires a size limit, a size reporter, an identifier strategy, and a data accessor to manage and enforce storage quotas. ```typescript new PodQuotaStrategy(limit, reporter, identifierStrategy, accessor): PodQuotaStrategy ``` -------------------------------- ### DataAccessorBasedStore - Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/DataAccessorBasedStore Initializes a new instance of the DataAccessorBasedStore class. ```APIDOC ## new DataAccessorBasedStore(accessor, identifierStrategy, auxiliaryStrategy, metadataStrategy) ### Description Initializes a new instance of the DataAccessorBasedStore class. ### Parameters - **accessor** (DataAccessor) - The DataAccessor instance to use for backend access. - **identifierStrategy** (IdentifierStrategy) - The strategy for generating and managing resource identifiers. - **auxiliaryStrategy** (AuxiliaryStrategy) - The strategy for handling auxiliary resources. - **metadataStrategy** (AuxiliaryStrategy) - The strategy for handling resource metadata. ### Returns DataAccessorBasedStore - A new instance of the DataAccessorBasedStore. ``` -------------------------------- ### Get Object by Type and ID (TypeScript) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/IndexedStorage The `get` method retrieves a specific object based on its type and unique identifier. It returns a Promise that resolves to the object's representation or `undefined` if no object with the given type and ID exists. ```typescript get: ((type: TType, id: string) => Promise>) ``` -------------------------------- ### GET /resource/exists/{identifier} Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/DataAccessorBasedStore Checks if a resource exists within this ResourceSet. ```APIDOC ## GET /resource/exists/{identifier} ### Description Checks whether a resource exists in this ResourceSet. ### Method GET ### Endpoint /resource/exists/{identifier} ### Parameters #### Path Parameters - **identifier** (ResourceIdentifier) - Required - Identifier of the resource to check. ### Response #### Success Response (200) - **boolean** - A promise resolving to true if the resource already exists, false otherwise. #### Response Example ```json { "example": "boolean" } ``` ``` -------------------------------- ### BaseAccountStore Methods Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BaseAccountStore Documentation for the methods available in the BaseAccountStore class, including canHandle, create, getSetting, handle, handleSafe, and updateSetting. ```APIDOC ## Methods: BaseAccountStore ### `canHandle` #### Description Checks whether the provided input can be handled by this class. If the input cannot be handled, it rejects with an error explaining the reason. #### Parameters * **input** (`void`): The input data to check for handleability. #### Returns * `Promise`: A promise that resolves if the input can be handled, or rejects with an `Error` if it cannot. ### `create` #### Description Creates a new, empty account. Since this account will not yet have a login method, implementations should restrict what is possible with this account and may need a mechanism for cleaning up unused accounts. #### Returns * `Promise`: A promise that resolves with the identifier of the newly created account. ### `getSetting` #### Description Finds a specific setting for an account identified by its ID. Returns `undefined` if no matching account is found or the setting does not exist. #### Type Parameters * `TKey` (extends "rememberLogin") #### Parameters * **id** (`string`): The identifier of the account. * **setting** (`TKey`): The specific setting key to retrieve (e.g., 'rememberLogin'). #### Returns * `Promise[TKey]>`: A promise resolving to the value of the requested setting, or `undefined` if not found. ### `handle` #### Description Handles the provided input. This method should only be called after `canHandle` has successfully determined that the input is manageable. For a combined check and handling operation, consider using `handleSafe`. #### Returns * `Promise`: A promise that resolves when the handling process is complete. ### `handleSafe` #### Description A helper function that first executes `canHandle` and then, if successful, proceeds to execute `handle`. If `canHandle` rejects, this method throws the same error. Otherwise, it returns the result of `handle`. #### Parameters * **input** (`void`): The input data to be handled. #### Returns * `Promise`: A promise that resolves if the input is successfully handled, or rejects with an `Error` if it cannot be handled. ### `updateSetting` #### Description Updates a specific setting for an account identified by its ID to a new value. #### Type Parameters * `TKey` (extends "rememberLogin") #### Parameters * **id** (`string`): The identifier of the account to update. * **setting** (`TKey`): The specific setting key to update (e.g., 'rememberLogin'). * **value** (`TypeObject[TKey]`): The new value for the specified setting. #### Returns * `Promise`: A promise that resolves when the setting has been successfully updated. ``` -------------------------------- ### GET /representation/{identifier} Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/DataAccessorBasedStore Retrieves a representation of a resource identified by its identifier. ```APIDOC ## GET /representation/{identifier} ### Description Retrieves a representation of a resource identified by its identifier. ### Method GET ### Endpoint /representation/{identifier} ### Parameters #### Path Parameters - **identifier** (ResourceIdentifier) - Required - Identifier of the resource to read. ### Response #### Success Response (200) - **Representation** - A representation corresponding to the identifier. #### Response Example ```json { "example": "Representation" } ``` ``` -------------------------------- ### HEAD /:resource Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/example-requests Retrieve resource headers. ```APIDOC ## HEAD /:resource ### Description Retrieve the headers for a resource without fetching the resource body. Useful for checking metadata like `Content-Type` or `Last-Modified`. ### Method HEAD ### Endpoint `http://localhost:3000/:resource` ### Parameters #### Path Parameters - **resource** (string) - Required - The name of the resource to get headers for (e.g., `myfile.txt`). #### Query Parameters None #### Request Body None ### Request Example ```bash curl -I -H "Accept: text/plain" \ http://localhost:3000/myfile.txt ``` ### Response #### Success Response (200) - **Headers** - The HTTP headers associated with the resource. #### Response Example (Headers will be returned, e.g., `Content-Type`, `Content-Length`, `Last-Modified`.) ``` -------------------------------- ### AccountInitializer Methods Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/AccountInitializer Documentation for the methods available in the AccountInitializer class. ```APIDOC ## Methods ### `canHandle` - **`canHandle(input: void): Promise`** - Checks whether the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why. #### Parameters - **input** (void) - Required - Input that could potentially be handled. #### Returns - **Promise** - A promise resolving if the input can be handled, rejecting with an Error if not. ### `handle` - **`handle(): Promise`** - Handles the given input. This may only be called if canHandle did not reject. When unconditionally calling both in sequence, consider handleSafe instead. #### Returns - **Promise** - A promise resolving when handling is finished. ### `handleSafe` - **`handleSafe(input: void): Promise`** - Helper function that first runs canHandle followed by handle. Throws the error of canHandle if the data cannot be handled, or returns the result of handle otherwise. #### Parameters - **input** (void) - Required - Input data that will be handled if it can be handled. #### Returns - **Promise** - A promise resolving if the input can be handled, rejecting with an Error if not. ``` -------------------------------- ### get Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BasePodStore Retrieves the base URL and account information for a given pod ID. ```APIDOC ## Method get ### Description Returns the base URL and account that created the pod for the given pod ID. ### Method get ### Endpoint N/A (Method of BasePodStore) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **id** (string) - ID of the pod. ### Request Example ```json { "id": "pod-abc-123" } ``` ### Response #### Success Response (200) - **podInfo** (object | undefined) - An object containing `accountId` and `baseUrl` if found, otherwise undefined. - **accountId** (string) - The account ID that created the pod. - **baseUrl** (string) - The base URL of the pod. #### Response Example ```json { "podInfo": { "accountId": "user123", "baseUrl": "http://example.com/user123/my-pod/" } } ``` ```json { "podInfo": null } ``` ``` -------------------------------- ### Initializer Class - Methods Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/Initializer Documentation for the canHandle, handle, and handleSafe methods of the Initializer class. ```APIDOC ## Methods Initializer ### canHandle #### Description Checks whether the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why. #### Method `canHandle(input)` #### Parameters - **input** (void) - Required - Input that could potentially be handled. #### Returns - **Promise** - A promise resolving if the input can be handled, rejecting with an Error if not. ### handle #### Description Handles the given input. This may only be called if canHandle did not reject. When unconditionally calling both in sequence, consider handleSafe instead. #### Method `handle(input)` #### Parameters - **input** (void) - Required - Input that needs to be handled. #### Returns - **Promise** - A promise resolving when handling is finished. ### handleSafe #### Description Helper function that first runs canHandle followed by handle. Throws the error of canHandle if the data cannot be handled, or returns the result of handle otherwise. #### Method `handleSafe(input)` #### Parameters - **input** (void) - Required - Input data that will be handled if it can be handled. #### Returns - **Promise** - A promise resolving if the input can be handled, rejecting with an Error if not. ``` -------------------------------- ### stripExtension Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/SubdomainExtensionBasedMapper Removes a specific internal extension (starting with $.) from a given path, if present. ```APIDOC ## stripExtension ### Description Helper function that removes the internal extension, one starting with $., from the given path. Nothing happens if no such extension is present. ### Method `Protected` ### Endpoint `/stripExtension` (hypothetical, as this is a function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters #### Path Parameters * **path** (string) - Required - The path from which to strip the extension. ### Request Example ```json { "path": "/some/path/file.txt$. } ``` ### Response #### Success Response (200) * **string** - The path with the extension removed, or the original path if no such extension was found. #### Response Example ```json "/some/path/file.txt" ``` ``` -------------------------------- ### Get Client Credentials by ID (TypeScript) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/ClientCredentialsStore Implements the 'get' method for the ClientCredentialsStore. This function retrieves a client credential by its unique ID, returning a Promise that resolves to either the ClientCredentials object or undefined if the ID does not exist. It is used to fetch a specific token's details. ```typescript get: ((id: string) => Promise) ``` -------------------------------- ### Example Component Configuration in JSON Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/architecture/dependency-injection Illustrates a single component's configuration within a JSON file used by Components.js. It specifies the component's type, unique ID, dependencies (source), and specific properties like baseUrl and container. This format allows for external configuration management. ```json { "comment": "Storage used for account management.", "@id": "urn:solid-server:default:AccountStorage", "@type": "JsonResourceStorage", "source": { "@id": "urn:solid-server:default:ResourceStore" }, "baseUrl": { "@id": "urn:solid-server:default:variable:baseUrl" }, "container": "/.internal/accounts/" } ``` -------------------------------- ### WebSocketAdvertiser Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/WebSocketAdvertiser Initializes a new instance of the WebSocketAdvertiser class. ```APIDOC ## Constructor ### new WebSocketAdvertiser(baseUrl: string): WebSocketAdvertiser Initializes a new instance of the WebSocketAdvertiser class. #### Parameters - **baseUrl** (string) - The base URL for the WebSocket. #### Returns - WebSocketAdvertiser - The initialized WebSocketAdvertiser instance. ``` -------------------------------- ### Get Login Information Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BasePasswordStore Retrieves the account and email associated with a given login ID. ```APIDOC ## GET /get ### Description Finds the account and email associated with this login ID. ### Method GET ### Endpoint /get ### Parameters #### Path Parameters None #### Query Parameters - **id** (string) - Required - The ID of the login object. #### Request Body None ### Request Example ```json { "id": "login_abc" } ``` ### Response #### Success Response (200) - **Object** or **undefined**: - **accountId** (string) - The ID of the account. - **email** (string) - The user's email. #### Response Example ```json { "accountId": "account_123", "email": "user@example.com" } ``` *or* ```json null ``` ``` -------------------------------- ### PromptFactory Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/PromptFactory Initializes a new instance of the PromptFactory class. ```APIDOC ## Constructors ### constructor * new PromptFactory(): PromptFactory * #### Returns PromptFactory ``` -------------------------------- ### GlobalQuotaStrategy Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/GlobalQuotaStrategy Initializes a new instance of the GlobalQuotaStrategy class with a specified limit, reporter, and base path. ```APIDOC ## constructor GlobalQuotaStrategy ### Description Initializes a new instance of the `GlobalQuotaStrategy` class. ### Method constructor ### Parameters #### Path Parameters - None #### Query Parameters - None #### Request Body - None ### Request Example ```json { "example": "new GlobalQuotaStrategy(limit, reporter, base)" } ``` ### Response #### Success Response (200) - **GlobalQuotaStrategy** (object) - An instance of the GlobalQuotaStrategy class. #### Response Example ```json { "example": "// Returns a new GlobalQuotaStrategy instance" } ``` ``` -------------------------------- ### Get Account Pods Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/account/json-api Retrieves all pods created by an account. The response includes a mapping of pod resource URLs to their corresponding WebID links. Further GET requests to these resource URLs return base URLs and owner information, while POST requests can add, update, or remove pod owners. ```json { "pods": { "http://localhost:3000/test/": "http://localhost:3000/.account/account/c63c9e6f-48f8-40d0-8fec-238da893a7f2/pod/df2d5a06-3ecd-4eaf-ac8f-b88a8579e100/" } } ``` ```json { "baseUrl": "http://localhost:3000/my-pod/", "owners": [ { "webId": "http://localhost:3000/my-pod/profile/card#me", "visible": false } ] } ``` -------------------------------- ### OPTIONS /:resource Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/example-requests Retrieve resource communication options. ```APIDOC ## OPTIONS /:resource ### Description Retrieve communication options for a resource, typically including allowed HTTP methods (e.g., `GET`, `PUT`, `DELETE`). ### Method OPTIONS ### Endpoint `http://localhost:3000/:resource` ### Parameters #### Path Parameters - **resource** (string) - Required - The name of the resource to get options for (e.g., `myfile.txt`). #### Query Parameters None #### Request Body None ### Request Example ```bash curl -X OPTIONS -i http://localhost:3000/myfile.txt ``` ### Response #### Success Response (200) - **Allow** (string) - A comma-separated list of allowed HTTP methods. #### Response Example (The `Allow` header will list methods like `GET, PUT, DELETE, HEAD, OPTIONS`.) ``` -------------------------------- ### Protected: Get Normalized Metadata Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/DataAccessorBasedStore Retrieves the metadata for a resource, ignoring trailing slash differences in the identifier. ```APIDOC ## GET /metadata/normalized/{identifier} ### Description Retrieves the metadata for a resource, ignoring trailing slash differences in the identifier. It first requests the identifier as provided, and if not found, it requests the identifier with a differing trailing slash. This behavior is based on Solid's URI slash semantics. ### Method GET ### Endpoint /metadata/normalized/{identifier} ### Parameters #### Path Parameters - **identifier** (ResourceIdentifier) - Required - Identifier that needs to be checked. ### Response #### Success Response (200) - **RepresentationMetadata** - The metadata matching the identifier. #### Response Example ```json { "example": "RepresentationMetadata" } ``` ``` -------------------------------- ### GetOperationHandler Class Documentation Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/GetOperationHandler Documentation for the GetOperationHandler class, including its constructor and methods for handling GET operations. ```APIDOC ## Class GetOperationHandler Handles GET Operations. Calls the getRepresentation function from a ResourceStore. ### Constructors #### constructor(store: ResourceStore, eTagHandler: ETagHandler) - **store** (ResourceStore) - The resource store to retrieve data from. - **eTagHandler** (ETagHandler) - Handler for ETag validation. ### Methods #### canHandle(input: OperationHandlerInput): Promise Checks whether the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why. - **input** (OperationHandlerInput) - Input that could potentially be handled. #### handle(input: OperationHandlerInput): Promise Handles the given input. This may only be called if canHandle did not reject. When unconditionally calling both in sequence, consider handleSafe instead. - **input** (OperationHandlerInput) - Input that needs to be handled. #### handleSafe(input: OperationHandlerInput): Promise Helper function that first runs canHandle followed by handle. Throws the error of canHandle if the data cannot be handled, or returns the result of handle otherwise. - **input** (OperationHandlerInput) - Input data that will be handled if it can be handled. #### Returns Promise A promise resolving if the input can be handled, rejecting with an Error if not. ``` -------------------------------- ### StorageDescriptionHandler Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/StorageDescriptionHandler Initializes a new instance of the StorageDescriptionHandler class. ```APIDOC ## new StorageDescriptionHandler(store, path, describer) ### Description Initializes a new instance of the StorageDescriptionHandler class. ### Parameters #### Path Parameters * **store** (ResourceStore) - Description of the store. * **path** (string) - The relative path for storage description resources. * **describer** (StorageDescriber) - The storage describer. ### Returns * StorageDescriptionHandler - A new instance of StorageDescriptionHandler. ``` -------------------------------- ### BaseClientCredentialsStore Constructor Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BaseClientCredentialsStore Initializes a new instance of the BaseClientCredentialsStore. This store needs to be initialized before it can be used. ```APIDOC ## Constructor: new BaseClientCredentialsStore ### Description Initializes a new instance of the BaseClientCredentialsStore. ### Parameters * **storage** (AccountLoginStorage>) - The storage mechanism for tokens. ### Returns * BaseClientCredentialsStore - A new instance of the BaseClientCredentialsStore. ``` -------------------------------- ### getOutputTypes Method Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/TypedRepresentationConverter Gets the output content types this converter can convert the input type to, mapped to a numerical priority. ```APIDOC ## Method: getOutputTypes ### Description Gets the output content types this converter can convert the input type to, mapped to a numerical priority. ### Method getOutputTypes ### Endpoint N/A (Instance method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None #### Parameters - **contentType** (string) - Required - The content type to check. ### Request Example ```json { "contentType": "text/plain" } ``` ### Response #### Success Response (200) - **ValuePreferences** (object) - An object mapping supported output content types to their priority. #### Response Example ```json { "application/json": 100, "text/html": 50 } ``` ``` -------------------------------- ### AccountStore.getSetting Method (TypeScript) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/AccountStore The `getSetting` method retrieves a specific setting for an account identified by its ID. If no account matches the provided identifier, or if the setting does not exist for that account, it returns `undefined`. This method is generic over `TKey` to allow for various setting types. ```typescript getSetting: ((id: string, setting: TKey) => Promise[TKey]>) ``` -------------------------------- ### stripExtension Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/ExtensionBasedMapper A helper function to remove internal extensions (those starting with $.) from a given path. The function does nothing if no such extension is found. ```APIDOC ## stripExtension ### Description Helper function that removes the internal extension, one starting with $., from the given path. Nothing happens if no such extension is present. ### Method POST ### Endpoint /stripExtension ### Parameters #### Request Body - **path** (string) - Required - The path from which to strip the extension. ### Response #### Success Response (200) - **string** - The path with the internal extension removed, if present. #### Response Example ```json { "strippedPath": "/path/to/resource" } ``` ``` -------------------------------- ### Verifying Inbox via Link Header using GET (cURL) Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/metadata This snippet shows how to verify the presence of the inbox notification endpoint by performing a GET request on the subject resource and inspecting the `Link` headers in the response. The `Link` header will include the inbox URL with the `rel="http://www.w3.org/ns/ldp#inbox"` relation. ```curl curl -v 'http://localhost:3000/foo/' ``` -------------------------------- ### Get Account Client Credentials Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/account/json-api Retrieves all client credentials associated with an account. The response maps credential names to their resource URLs. GET requests to these URLs provide token details, and DELETE requests remove the token. POST requests to `controls.account.clientCredentials` create new tokens with optional 'name' and required 'webId' fields. ```json { "clientCredentials": { "token_562cdeb5-d4b2-4905-9e62-8969ac10daaa": "http://localhost:3000/.account/account/c63c9e6f-48f8-40d0-8fec-238da893a7f2/client-credentials/063ee3a7-e80f-4508-9f79-ffddda9df8d4/" } } ``` -------------------------------- ### ContainerInitializer API Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/ContainerInitializer Documentation for the ContainerInitializer class, which sets up a container by copying files and folders. ```APIDOC ## Class ContainerInitializer Initializer that sets up a container. Will copy all the files and folders in the given path to the corresponding documents and containers. ### Hierarchy * Initializer * ContainerInitializer ### Constructors #### constructor * `new ContainerInitializer(args: ContainerInitializerArgs): ContainerInitializer` * **Parameters** * `args` (ContainerInitializerArgs) - * **Returns** ContainerInitializer ## Properties ### `Protected` `Readonly` logger * `logger`: Logger = ... ## Methods ### canHandle * `canHandle(input: void): Promise` * **Description**: Checks whether the input can be handled by this class. If it cannot handle the input, rejects with an error explaining why. * **Parameters** * `input` (void) - Input that could potentially be handled. * **Returns** Promise ### handle * `handle(): Promise` * **Description**: Handles the given input. This may only be called if canHandle did not reject. When unconditionally calling both in sequence, consider handleSafe instead. * **Returns** Promise ### handleSafe * `handleSafe(input: void): Promise` * **Description**: Helper function that first runs canHandle followed by handle. Throws the error of canHandle if the data cannot be handled, or returns the result of handle otherwise. * **Parameters** * `input` (void) - Input data that will be handled if it can be handled. * **Returns** Promise ``` -------------------------------- ### Account Initialization Parameters Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/AccountInitializerArgs This section details the parameters required for the AccountInitializerArgs interface, which is used to initialize new accounts in the Community Solid Server. ```APIDOC ## Account Initializer Arguments ### Description This interface defines the arguments required for initializing an account within the Community Solid Server. ### Properties #### accountStore - **accountStore** (AccountStore) - Required - Creates the accounts. #### email - **email** (string) - Required - Email address for the account login. #### name - **name** (string) - Optional - Name to use for the pod. If undefined the pod will be made in the root of the server. #### password - **password** (string) - Required - Password for the account login. #### passwordStore - **passwordStore** (PasswordStore) - Required - Adds the login methods. #### podCreator - **podCreator** (PodCreator) - Required - Creates the pods. ``` -------------------------------- ### BaseClientCredentialsIdRoute Methods Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/BaseClientCredentialsIdRoute Provides methods for interacting with client credentials routes, including getting the path and matching a given path. ```APIDOC ## Method: getPath ### Description Returns the path that is the result of having the specified values for the dynamic parameters. Will throw an error in case the input `parameters` object is missing one of the expected keys. ### Method `getPath(parameters?): string` ### Parameters #### Path Parameters - **parameters** (Record<"accountId" | "clientCredentialsId", string>) - Optional - Values for the dynamic parameters. ### Returns - **string** - The generated path. ``` ```APIDOC ## Method: matchPath ### Description Checks if the provided path matches the route (pattern). The result will be `undefined` if there is no match. If there is a match the result object will have the corresponding values for all the parameters. ### Method `matchPath(path): undefined | Record<"accountId" | "clientCredentialsId", string>` ### Parameters #### Path Parameters - **path** (string) - Required - The path to verify. ### Returns - **undefined | Record<"accountId" | "clientCredentialsId", string>** - An object with the matched parameter values or undefined if there is no match. ``` -------------------------------- ### Server Factory Options Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/interfaces/BaseServerFactoryOptions Configuration options for creating a Community Solid Server instance. This includes settings for HTTPS such as certificates and keys. ```APIDOC ## Interface BaseServerFactoryOptions ### Description Options to be used when creating the server. Due to Components.js not supporting external types, this has been simplified (for now?). The common https keys here (key/cert/pfx) will be interpreted as file paths that need to be read before passing the options to the `createServer` function. ### Properties #### `Optional` cert - **Type**: string - **Description**: Path to the SSL certificate file. #### `Optional` https - **Type**: boolean - **Description**: If the server should start as an HTTP or HTTPS server. #### `Optional` key - **Type**: string - **Description**: Path to the SSL private key file. #### `Optional` passphrase - **Type**: string - **Description**: Passphrase for the SSL private key. #### `Optional` pfx - **Type**: string - **Description**: Path to the PFX file (certificate and private key). ### Example Request Body (Illustrative) ```json { "https": true, "key": "/path/to/your/private.key", "cert": "/path/to/your/certificate.crt", "passphrase": "your_passphrase", "pfx": "/path/to/your/bundle.pfx" } ``` ### Example Success Response (Illustrative) ```json { "message": "Server configured successfully." } ``` ``` -------------------------------- ### Configure HTML View Handler Templates Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/usage/account/login-method Example configuration for the HtmlViewHandler, demonstrating how to register new HTML templates for specific routes. This allows custom pages, like password creation, to be served by the server. ```json { "@id": "urn:solid-server:default:HtmlViewHandler", "@type": "HtmlViewHandler", "templates": [{ "@id": "urn:solid-server:default:CreatePasswordHtml", "@type": "HtmlViewEntry", "filePath": "@css:templates/identity/password/create.html.ejs", "route": { "@id": "urn:solid-server:default:AccountPasswordRoute" } }] } ``` -------------------------------- ### Get Parent Relation Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/WrappedIndexedStorage Retrieves the index relation where a given type acts as the child. Returns undefined for the root type, as it has no parent. ```typescript /** * Returns the relation where the given type is the child. * @param type The child type. * @returns The IndexRelation where the type is a child, or undefined if it's a root type. */ protected getParentRelation(type: TType): IndexRelation | undefined ``` -------------------------------- ### Protected: Get Safe Normalized Metadata Source: https://communitysolidserver.github.io/CommunitySolidServer/latest/docs/classes/DataAccessorBasedStore Safely retrieves normalized metadata for a resource, returning undefined if a 404 error occurs. ```APIDOC ## GET /metadata/safe/normalized/{identifier} ### Description Safely retrieves normalized metadata for a resource. It returns the result of `getNormalizedMetadata` or `undefined` if a 404 error is thrown during the retrieval. ### Method GET ### Endpoint /metadata/safe/normalized/{identifier} ### Parameters #### Path Parameters - **identifier** (ResourceIdentifier) - Required - The identifier for which to retrieve metadata. ### Response #### Success Response (200) - **RepresentationMetadata | undefined** - The normalized metadata or undefined if not found. #### Response Example ```json { "example": "RepresentationMetadata | undefined" } ``` ```