Skip to content

Commit

Permalink
feat: Add ts types for new helpers files
Browse files Browse the repository at this point in the history
  • Loading branch information
zatteo committed Mar 2, 2023
1 parent dff83fb commit 9428736
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/cozy-client/types/helpers/dehydrateHelper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export function dehydrate(document: any): {};
2 changes: 2 additions & 0 deletions packages/cozy-client/types/helpers/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { dehydrate } from "./dehydrateHelper";
export { deconstructCozyWebLinkWithSlug, generateWebLink, ensureFirstSlash, rootCozyUrl, InvalidCozyUrlError, InvalidProtocolError } from "./urlHelper";
23 changes: 23 additions & 0 deletions packages/cozy-client/types/helpers/urlHelper.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export function ensureFirstSlash(path: any): any;
export function generateWebLink({ cozyUrl, searchParams: searchParamsOption, pathname, hash, slug, subDomainType }: {
cozyUrl: string;
searchParams: any[];
pathname: string;
hash: string;
slug: string;
subDomainType: string;
}): string;
export function deconstructCozyWebLinkWithSlug(webLink: string, subDomainType?: SubdomainType): CozyLinkData;
export function deconstructRedirectLink(redirectLink: string): RedirectLinkData;
export class InvalidProtocolError extends Error {
constructor(url: any);
url: any;
}
export class InvalidCozyUrlError extends Error {
constructor(url: any);
url: any;
}
export function rootCozyUrl(url: URL): Promise<URL>;
import { SubdomainType } from "../types";
import { CozyLinkData } from "../types";
import { RedirectLinkData } from "../types";
17 changes: 17 additions & 0 deletions packages/cozy-client/types/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -735,4 +735,21 @@ export type CozyLinkData = {
*/
slug: string;
};
/**
* Represents the different parts of a deconstructed redirect link
*/
export type RedirectLinkData = {
/**
* - The redirect link's slug (i.e. 'drive')
*/
slug: string;
/**
* - The redirect link's path (i.e. 'public')
*/
path: string;
/**
* - The redirect link's path (i.e. '/folder/SOME_FOLDER_ID')
*/
hash: string;
};
import { QueryDefinition } from "./queries/dsl";

0 comments on commit 9428736

Please sign in to comment.