Skip to content

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
LINYE-MARIANA committed Sep 2, 2023
1 parent 028918f commit b0d0940
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
24 changes: 12 additions & 12 deletions dist/completion-generator.d.ts
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
type LocaleDataItem = {
export type LocaleDataItem = {
text: string;
keywords: string;
};
type MatchedResult = {
export type MatchedResult = {
isMatched: boolean;
data?: MatchedResultData;
};
type MatchedResultData = {
export type MatchedResultData = {
text: string;
keywords: string;
matchedKeywords?: MatchedKeyword[];
};
type MatchedKeyword = {
export type MatchedKeyword = {
text: string;
startAt: number;
endAt: number;
};
type CompletionGeneratorProperties = {
export type CompletionGeneratorProperties = {
keywordSeparator: string;
minKeywordLength: number;
strictMatchLocales: string[];
comparator?: LocaleDataComparator;
filter?: LocaleDateFilter;
};
type LocaleDataComparator = (itemA: LocaleDataItem, itemB: LocaleDataItem, input: string, locale: string) => number;
type LocaleDateFilter = (localeData: LocaleDataItem[], input: string, locale: string) => MatchedResultData[];
interface CompletionGeneratorInter {
export type LocaleDataComparator = (itemA: LocaleDataItem, itemB: LocaleDataItem, input: string, locale: string) => number;
export type LocaleDateFilter = (localeData: LocaleDataItem[], input: string, locale: string) => MatchedResultData[];
export interface CompletionGeneratorInter {
/** キーワードの分割文字 */
keywordSeparator: string;
/** キーワードとして認定する最短長さ */
Expand Down Expand Up @@ -66,15 +66,15 @@ export declare class Generator implements CompletionGeneratorInter {
_match(dataItem: LocaleDataItem, input: string): MatchedResult;
_strictMatch(dataItem: LocaleDataItem, input: string): MatchedResult;
}
type CompletionFetcherProperties = {
export type CompletionFetcherProperties = {
apiKey: string;
apiKeyHeaderName?: string;
getEndpoint?: GetEndpoint;
handleResponse?: HandleResponse;
};
type GetEndpoint = (locale: string) => string;
type HandleResponse = (data: any) => LocaleDataItem[];
interface CompletionFetcherInter {
export type GetEndpoint = (locale: string) => string;
export type HandleResponse = (data: any) => LocaleDataItem[];
export interface CompletionFetcherInter {
apiKey: string;
fetch(locale: string): Promise<LocaleDataItem[]>;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@obot-ai/completion-generator",
"version": "0.0.3",
"version": "0.0.4",
"description": "A completion generator for ObotAI InputCompletion.",
"type": "module",
"files": [
Expand Down
24 changes: 12 additions & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
type LocaleDataItem = {
export type LocaleDataItem = {
text: string;
keywords: string;
}

type MatchedResult = {
export type MatchedResult = {
isMatched: boolean;
data?: MatchedResultData;
}

type MatchedResultData = {
export type MatchedResultData = {
text: string;
keywords: string;
matchedKeywords?: MatchedKeyword[];
}

type MatchedKeyword = {
export type MatchedKeyword = {
text: string;
startAt: number;
endAt: number;
}

type CompletionGeneratorProperties = {
export type CompletionGeneratorProperties = {
keywordSeparator: string;
minKeywordLength: number;
strictMatchLocales: string[];
comparator?: LocaleDataComparator;
filter?: LocaleDateFilter;
}
type LocaleDataComparator = (itemA: LocaleDataItem, itemB: LocaleDataItem, input: string, locale: string) => number
type LocaleDateFilter = (localeData: LocaleDataItem[], input: string, locale: string) => MatchedResultData[]
export type LocaleDataComparator = (itemA: LocaleDataItem, itemB: LocaleDataItem, input: string, locale: string) => number
export type LocaleDateFilter = (localeData: LocaleDataItem[], input: string, locale: string) => MatchedResultData[]

interface CompletionGeneratorInter {
export interface CompletionGeneratorInter {
/** キーワードの分割文字 */
keywordSeparator: string
/** キーワードとして認定する最短長さ */
Expand Down Expand Up @@ -276,16 +276,16 @@ export class Generator implements CompletionGeneratorInter{
}


type CompletionFetcherProperties = {
export type CompletionFetcherProperties = {
apiKey: string;
apiKeyHeaderName?: string;
getEndpoint?: GetEndpoint;
handleResponse?: HandleResponse
}
type GetEndpoint = (locale: string) => string
type HandleResponse = (data: any) => LocaleDataItem[]
export type GetEndpoint = (locale: string) => string
export type HandleResponse = (data: any) => LocaleDataItem[]

interface CompletionFetcherInter {
export interface CompletionFetcherInter {
apiKey: string;

fetch(locale: string): Promise<LocaleDataItem[]>
Expand Down

0 comments on commit b0d0940

Please sign in to comment.