@inrupt/solid-client
Version:
Make your web apps work with Solid Pods.
137 lines (136 loc) • 7.64 kB
TypeScript
/**
* Copyright 2020 Inrupt Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
* Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
import { Literal, NamedNode } from "rdf-js";
import { Thing, Url, UrlString, ThingPersisted } from "../interfaces";
/**
* Create a new Thing with all values removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing [[Thing]] to remove values from.
* @param property Property for which to remove all values from the Thing.
* @returns A new Thing equal to the input Thing with all values removed for the given Property.
*/
export declare function removeAll<T extends Thing>(thing: T, property: Url | UrlString): T;
/**
* Create a new Thing with the given URL removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove a URL value from.
* @param property Property for which to remove the given URL value.
* @param value URL to remove from `thing` for the given `Property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare const removeUrl: RemoveOfType<Url | UrlString | ThingPersisted>;
/** @hidden Alias of [[removeUrl]] for those who prefer IRI terminology. */
export declare const removeIri: RemoveOfType<string | Url | ThingPersisted>;
/**
* Create a new Thing with the given boolean removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove a boolean value from.
* @param property Property for which to remove the given boolean value.
* @param value Boolean to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare const removeBoolean: RemoveOfType<boolean>;
/**
* Create a new Thing with the given datetime removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove a datetime value from.
* @param property Property for which to remove the given datetime value.
* @param value Datetime to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare const removeDatetime: RemoveOfType<Date>;
/**
* Create a new Thing with the given decimal removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove a decimal value from.
* @param property Property for which to remove the given decimal value.
* @param value Decimal to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare const removeDecimal: RemoveOfType<number>;
/**
* Create a new Thing with the given integer removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove an integer value from.
* @param property Property for which to remove the given integer value.
* @param value Integer to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare const removeInteger: RemoveOfType<number>;
/**
* Create a new Thing with the given localised string removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove a localised string value from.
* @param property Property for which to remove the given localised string value.
* @param value String to remove from `thing` for the given `property`.
* @param locale Locale of the string to remove.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare function removeStringWithLocale<T extends Thing>(thing: T, property: Url | UrlString, value: string, locale: string): T;
/**
* Create a new Thing with the given unlocalised string removed for the given Property.
*
* The original `thing` is not modified; this function returns a cloned Thing with updated values.
*
* @param thing Thing to remove an unlocalised string value from.
* @param property Property for which to remove the given string value.
* @param value String to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare const removeStringNoLocale: RemoveOfType<string>;
/**
* @ignore This should not be needed due to the other remove*() functions. If you do find yourself needing it, please file a feature request for your use case.
* @param thing Thing to remove a NamedNode value from.
* @param property Property for which to remove the given NamedNode value.
* @param value NamedNode to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare function removeNamedNode<T extends Thing>(thing: T, property: Url | UrlString, value: NamedNode): T;
/**
* @ignore This should not be needed due to the other remove*() functions. If you do find yourself needing it, please file a feature request for your use case.
* @param thing Thing to remove a Literal value from.
* @param property Property for which to remove the given Literal value.
* @param value Literal to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
export declare function removeLiteral<T extends Thing>(thing: T, property: Url | UrlString, value: Literal): T;
/**
* @param thing Thing to remove a value from.
* @param property Property for which to remove the given value.
* @param value Value to remove from `thing` for the given `property`.
* @returns A new Thing equal to the input Thing with the given value removed for the given Property.
*/
declare type RemoveOfType<Type> = <T extends Thing>(thing: T, property: Url | UrlString, value: Type) => T;
export {};