teak-sdk 0.0.0-stage → 1.0.80
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +26 -2
- package/dist/sdk.js +998 -0
- package/dist/types/client/authDiscovery.d.ts +18 -0
- package/dist/types/client/sdk.d.ts +193 -0
- package/dist/types/devUrls.d.ts +15 -0
- package/dist/types/shared/boundedResponse.d.ts +2 -0
- package/dist/types/shared/constants.d.ts +81 -0
- package/dist/types/shared/fileFormats.d.ts +65 -0
- package/dist/types/shared/markdown.d.ts +17 -0
- package/dist/types/shared/workosResources.d.ts +4 -0
- package/package.json +35 -4
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const OAUTH_SURFACES: readonly ["cli", "raycast", "chrome", "firefox", "safari"];
|
|
2
|
+
export type OAuthSurface = (typeof OAUTH_SURFACES)[number];
|
|
3
|
+
export interface AuthDiscovery {
|
|
4
|
+
readonly authorizationEndpoint: string;
|
|
5
|
+
readonly clients: Readonly<Record<OAuthSurface, string>>;
|
|
6
|
+
readonly issuer: string;
|
|
7
|
+
readonly primary: "betterauth" | "workos";
|
|
8
|
+
readonly resource: string;
|
|
9
|
+
readonly revocationEndpoint?: string;
|
|
10
|
+
readonly tokenEndpoint: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const validateOAuthUrl: (raw: unknown, local?: boolean) => URL;
|
|
13
|
+
export declare function discoverAuthServer(siteUrl: string, options?: {
|
|
14
|
+
fetch?: typeof fetch;
|
|
15
|
+
forceRefresh?: boolean;
|
|
16
|
+
localIssuer?: string;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}): Promise<AuthDiscovery>;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
export { type AuthDiscovery, discoverAuthServer, type OAuthSurface, validateOAuthUrl, } from "./authDiscovery.js";
|
|
2
|
+
import { type CardType } from "../shared/constants.js";
|
|
3
|
+
import type { FileKind, FilePreviewFacts } from "../shared/fileFormats.js";
|
|
4
|
+
export type { CardType } from "../shared/constants.js";
|
|
5
|
+
export declare const CARD_TYPES: readonly ["text", "link", "image", "video", "audio", "document", "palette", "quote"];
|
|
6
|
+
export declare const CARD_SORTS: readonly ["newest", "oldest"];
|
|
7
|
+
export declare const ERROR_CODES: readonly ["AUTH_REQUIRED", "BAD_REQUEST", "CONFIG_ERROR", "CONFLICT", "CONTENT_TOO_LARGE", "INTERNAL_ERROR", "INVALID_API_KEY", "INVALID_INPUT", "INVALID_UTF8", "METHOD_NOT_ALLOWED", "NETWORK_ERROR", "NOT_FOUND", "PARSE_ERROR", "RATE_LIMITED", "REQUEST_FAILED", "TIMEOUT", "UNAUTHORIZED"];
|
|
8
|
+
export type CardSort = (typeof CARD_SORTS)[number];
|
|
9
|
+
export type TeakApiErrorCode = (typeof ERROR_CODES)[number];
|
|
10
|
+
export type FetchLike = typeof fetch;
|
|
11
|
+
export interface TokenProvider {
|
|
12
|
+
getAccessToken: () => Promise<string | null> | string | null;
|
|
13
|
+
onUnauthorized?: (rejectedToken: string) => Promise<string | null> | string | null;
|
|
14
|
+
}
|
|
15
|
+
export interface Card {
|
|
16
|
+
aiSummary: string | null;
|
|
17
|
+
aiTags: string[];
|
|
18
|
+
aiTranscript: string | null;
|
|
19
|
+
appUrl: string;
|
|
20
|
+
colors: Array<{
|
|
21
|
+
hex: string;
|
|
22
|
+
name?: string;
|
|
23
|
+
}>;
|
|
24
|
+
compactUrl: string | null;
|
|
25
|
+
content: string;
|
|
26
|
+
createdAt: number;
|
|
27
|
+
detailUrl: string | null;
|
|
28
|
+
fileExtension: string | null;
|
|
29
|
+
fileKind: FileKind | null;
|
|
30
|
+
fileLanguage: string | null;
|
|
31
|
+
fileName: string | null;
|
|
32
|
+
filePreview: FilePreviewFacts | null;
|
|
33
|
+
fileSize: number | null;
|
|
34
|
+
fileUrl: string | null;
|
|
35
|
+
id: string;
|
|
36
|
+
isFavorited: boolean;
|
|
37
|
+
linkAuthor: string | null;
|
|
38
|
+
linkPreviewImageUrl: string | null;
|
|
39
|
+
linkPreviewMedia: Array<{
|
|
40
|
+
type: "image" | "video";
|
|
41
|
+
url: string;
|
|
42
|
+
contentType?: string;
|
|
43
|
+
width?: number;
|
|
44
|
+
height?: number;
|
|
45
|
+
posterUrl?: string;
|
|
46
|
+
posterContentType?: string;
|
|
47
|
+
posterWidth?: number;
|
|
48
|
+
posterHeight?: number;
|
|
49
|
+
}>;
|
|
50
|
+
linkPublishedAt: string | null;
|
|
51
|
+
linkPublisher: string | null;
|
|
52
|
+
linkSiteName: string | null;
|
|
53
|
+
metadataDescription: string | null;
|
|
54
|
+
metadataTitle: string | null;
|
|
55
|
+
mimeType: string | null;
|
|
56
|
+
notes: string | null;
|
|
57
|
+
placeholderUrl: string | null;
|
|
58
|
+
screenshotUrl: string | null;
|
|
59
|
+
tags: string[];
|
|
60
|
+
thumbnailUrl: string | null;
|
|
61
|
+
type: CardType | string;
|
|
62
|
+
updatedAt: number;
|
|
63
|
+
url: string | null;
|
|
64
|
+
}
|
|
65
|
+
export type CardListItem = Partial<Card> & Pick<Card, "aiTags" | "appUrl" | "createdAt" | "id" | "isFavorited" | "tags" | "type" | "updatedAt">;
|
|
66
|
+
export interface PageInfo {
|
|
67
|
+
hasMore: boolean;
|
|
68
|
+
nextCursor: string | null;
|
|
69
|
+
}
|
|
70
|
+
export interface CardsPage {
|
|
71
|
+
items: CardListItem[];
|
|
72
|
+
pageInfo: PageInfo;
|
|
73
|
+
}
|
|
74
|
+
export interface CardChangesResponse {
|
|
75
|
+
deletedIds: string[];
|
|
76
|
+
items: Card[];
|
|
77
|
+
pageInfo: PageInfo;
|
|
78
|
+
}
|
|
79
|
+
export interface TagSummary {
|
|
80
|
+
count: number;
|
|
81
|
+
name: string;
|
|
82
|
+
}
|
|
83
|
+
export interface CreateCardInput {
|
|
84
|
+
cardType?: CardType;
|
|
85
|
+
content?: string;
|
|
86
|
+
fileEtag?: string;
|
|
87
|
+
fileKey?: string;
|
|
88
|
+
fileName?: string;
|
|
89
|
+
fileSize?: number;
|
|
90
|
+
mimeType?: string;
|
|
91
|
+
notes?: string | null;
|
|
92
|
+
source?: string;
|
|
93
|
+
tags?: string[];
|
|
94
|
+
url?: string;
|
|
95
|
+
}
|
|
96
|
+
export interface UpdateCardInput {
|
|
97
|
+
content?: string;
|
|
98
|
+
metadataTitle?: string | null;
|
|
99
|
+
notes?: string | null;
|
|
100
|
+
tags?: string[];
|
|
101
|
+
url?: string;
|
|
102
|
+
}
|
|
103
|
+
export interface CreateUploadInput {
|
|
104
|
+
fileName: string;
|
|
105
|
+
fileSize: number;
|
|
106
|
+
mimeType: string;
|
|
107
|
+
}
|
|
108
|
+
export interface CreateUploadResponse {
|
|
109
|
+
expiresIn: number;
|
|
110
|
+
fileKey: string;
|
|
111
|
+
maxFileSize: number;
|
|
112
|
+
method: "PUT";
|
|
113
|
+
uploadUrl: string;
|
|
114
|
+
}
|
|
115
|
+
export interface CreateCardResponse {
|
|
116
|
+
appUrl: string;
|
|
117
|
+
card?: Card;
|
|
118
|
+
cardId: string;
|
|
119
|
+
status: "created";
|
|
120
|
+
}
|
|
121
|
+
export interface BulkCardsResponse {
|
|
122
|
+
operation: "create" | "update" | "favorite" | "delete";
|
|
123
|
+
results: unknown[];
|
|
124
|
+
summary: {
|
|
125
|
+
failed: number;
|
|
126
|
+
succeeded: number;
|
|
127
|
+
total: number;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
export declare class TeakApiError extends Error {
|
|
131
|
+
code: TeakApiErrorCode;
|
|
132
|
+
requestId?: string;
|
|
133
|
+
retryAt?: number;
|
|
134
|
+
status?: number;
|
|
135
|
+
constructor(code: TeakApiErrorCode, message?: string, init?: {
|
|
136
|
+
requestId?: string;
|
|
137
|
+
retryAt?: number;
|
|
138
|
+
status?: number;
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
export declare const staticTokenProvider: (token: string) => TokenProvider;
|
|
142
|
+
export declare const normalizeLimit: (limit?: number) => number;
|
|
143
|
+
export declare const buildCardsSearchParams: (input: {
|
|
144
|
+
createdAfter?: number;
|
|
145
|
+
createdBefore?: number;
|
|
146
|
+
cursor?: string;
|
|
147
|
+
favorited?: boolean;
|
|
148
|
+
include?: string;
|
|
149
|
+
limit?: number;
|
|
150
|
+
query?: string;
|
|
151
|
+
sort?: CardSort;
|
|
152
|
+
tag?: string;
|
|
153
|
+
type?: CardType | string | readonly (CardType | string)[];
|
|
154
|
+
}) => string;
|
|
155
|
+
export declare const createTeakClient: (options: {
|
|
156
|
+
baseUrl?: string;
|
|
157
|
+
fetch?: FetchLike;
|
|
158
|
+
timeoutMs?: number;
|
|
159
|
+
tokenProvider: TokenProvider;
|
|
160
|
+
userAgent?: string;
|
|
161
|
+
}) => {
|
|
162
|
+
cards: {
|
|
163
|
+
bulk: (operation: BulkCardsResponse["operation"], items: unknown[]) => Promise<BulkCardsResponse>;
|
|
164
|
+
changes: (input: {
|
|
165
|
+
cursor?: string;
|
|
166
|
+
limit?: number;
|
|
167
|
+
since: number;
|
|
168
|
+
}) => Promise<CardChangesResponse>;
|
|
169
|
+
create: (input: CreateCardInput) => Promise<CreateCardResponse>;
|
|
170
|
+
delete: (id: string) => Promise<null>;
|
|
171
|
+
favorites: (input?: Parameters<(params: Parameters<typeof buildCardsSearchParams>[0]) => string>[0]) => Promise<CardsPage>;
|
|
172
|
+
get: (id: string) => Promise<Card>;
|
|
173
|
+
list: (input?: Parameters<(params: Parameters<typeof buildCardsSearchParams>[0]) => string>[0]) => Promise<CardsPage>;
|
|
174
|
+
search: (input?: Parameters<(params: Parameters<typeof buildCardsSearchParams>[0]) => string>[0]) => Promise<CardsPage>;
|
|
175
|
+
setFavorite: (id: string, isFavorited: boolean) => Promise<Card>;
|
|
176
|
+
update: (id: string, input: UpdateCardInput) => Promise<Card>;
|
|
177
|
+
};
|
|
178
|
+
tags: {
|
|
179
|
+
list: () => Promise<{
|
|
180
|
+
items: TagSummary[];
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
uploads: {
|
|
184
|
+
create: (input: CreateUploadInput) => Promise<CreateUploadResponse>;
|
|
185
|
+
putFile: (uploadUrl: string, bytes: BodyInit, mimeType: string) => Promise<{
|
|
186
|
+
fileEtag: string | undefined;
|
|
187
|
+
}>;
|
|
188
|
+
};
|
|
189
|
+
};
|
|
190
|
+
export type TeakClient = ReturnType<typeof createTeakClient>;
|
|
191
|
+
export declare const parseTags: (value: string | undefined) => string[] | undefined;
|
|
192
|
+
export declare const isCardType: (value: string) => value is CardType;
|
|
193
|
+
export declare const isStringList: (value: unknown) => value is string[];
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DEFAULT_TEAK_DEV_APP_URL = "http://localhost:3000";
|
|
2
|
+
export declare const DEFAULT_TEAK_DEV_CONVEX_SITE_URL = "https://reminiscent-kangaroo-59.convex.site";
|
|
3
|
+
export declare const DEFAULT_TEAK_DEV_API_URL = "https://reminiscent-kangaroo-59.convex.site";
|
|
4
|
+
export declare const DEFAULT_TEAK_DEV_DOCS_URL = "http://localhost:3001";
|
|
5
|
+
export interface DevUrlEnv {
|
|
6
|
+
TEAK_DEV_API_URL?: unknown;
|
|
7
|
+
TEAK_DEV_APP_URL?: unknown;
|
|
8
|
+
TEAK_DEV_DOCS_URL?: unknown;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare const resolveTeakDevAppUrl: (env?: DevUrlEnv) => string;
|
|
12
|
+
export declare const resolveTeakDevApiUrl: (env?: DevUrlEnv) => string;
|
|
13
|
+
export declare const resolveTeakDevDocsUrl: (env?: DevUrlEnv) => string;
|
|
14
|
+
export declare const isLocalDevelopmentHostname: (hostname: string) => boolean;
|
|
15
|
+
export declare const isLocalDevelopmentUrl: (value: string) => boolean;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
export declare const SIGNUPS_PAUSED_MESSAGE = "New sign-ups are paused while we upgrade sign-in";
|
|
2
|
+
export declare const cardTypes: readonly ["text", "link", "image", "video", "audio", "document", "palette", "quote"];
|
|
3
|
+
export type CardType = (typeof cardTypes)[number];
|
|
4
|
+
export declare const VISUAL_STYLE_TAXONOMY: readonly ["abstract", "cinematic", "dark", "illustrative", "minimal", "monochrome", "moody", "pastel", "photographic", "retro", "surreal", "vintage", "vibrant"];
|
|
5
|
+
export type VisualStyle = (typeof VISUAL_STYLE_TAXONOMY)[number];
|
|
6
|
+
export declare const VISUAL_STYLE_LABELS: Record<VisualStyle, string>;
|
|
7
|
+
export declare function normalizeVisualStyle(value: string): VisualStyle | null;
|
|
8
|
+
export declare function normalizeVisualStyleFilters(values?: string[]): VisualStyle[];
|
|
9
|
+
export declare function extractVisualStylesFromTags(tags?: string[]): VisualStyle[] | undefined;
|
|
10
|
+
export declare const COLOR_HUE_BUCKETS: readonly ["red", "orange", "yellow", "green", "teal", "cyan", "blue", "purple", "pink", "brown", "neutral"];
|
|
11
|
+
export type ColorHueBucket = (typeof COLOR_HUE_BUCKETS)[number];
|
|
12
|
+
export declare const COLOR_HUE_LABELS: Record<ColorHueBucket, string>;
|
|
13
|
+
export declare function normalizeColorHueBucket(value: string): ColorHueBucket | null;
|
|
14
|
+
export declare function normalizeHueFilters(values?: string[]): ColorHueBucket[];
|
|
15
|
+
/**
|
|
16
|
+
* Maximum number of cards allowed for free tier users
|
|
17
|
+
*/
|
|
18
|
+
export declare const FREE_TIER_LIMIT = 200;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum file size for uploads (100MB in bytes)
|
|
21
|
+
*/
|
|
22
|
+
export { MAX_FILE_SIZE } from "./fileFormats.js";
|
|
23
|
+
/**
|
|
24
|
+
* Maximum number of files that can be uploaded at once
|
|
25
|
+
*/
|
|
26
|
+
export declare const MAX_FILES_PER_UPLOAD = 5;
|
|
27
|
+
export declare const MULTIPART_UPLOAD_THRESHOLD: number;
|
|
28
|
+
export declare const CARD_ERROR_CODES: {
|
|
29
|
+
readonly CARD_LIMIT_REACHED: "CARD_LIMIT_REACHED";
|
|
30
|
+
readonly CONTENT_TOO_LARGE: "CONTENT_TOO_LARGE";
|
|
31
|
+
readonly INVALID_UTF8: "INVALID_UTF8";
|
|
32
|
+
readonly RATE_LIMITED: "RATE_LIMITED";
|
|
33
|
+
readonly FILE_TOO_LARGE: "FILE_TOO_LARGE";
|
|
34
|
+
readonly TOO_MANY_FILES: "TOO_MANY_FILES";
|
|
35
|
+
readonly UNSUPPORTED_TYPE: "UNSUPPORTED_TYPE";
|
|
36
|
+
readonly TYPE_MISMATCH: "TYPE_MISMATCH";
|
|
37
|
+
};
|
|
38
|
+
export type CardErrorCode = (typeof CARD_ERROR_CODES)[keyof typeof CARD_ERROR_CODES];
|
|
39
|
+
export declare const CARD_ERROR_MESSAGES: Record<CardErrorCode, string>;
|
|
40
|
+
/**
|
|
41
|
+
* All card types as readonly array
|
|
42
|
+
*/
|
|
43
|
+
export declare const CARD_TYPES: readonly CardType[];
|
|
44
|
+
/**
|
|
45
|
+
* Card type labels for UI display
|
|
46
|
+
*/
|
|
47
|
+
export declare const CARD_TYPE_LABELS: Record<CardType, string>;
|
|
48
|
+
/**
|
|
49
|
+
* Card type icons mapping (for UI components)
|
|
50
|
+
*/
|
|
51
|
+
export declare const CARD_TYPE_ICONS: Record<CardType, string>;
|
|
52
|
+
/**
|
|
53
|
+
* Card type configuration registry for centralized management
|
|
54
|
+
*/
|
|
55
|
+
export interface CardTypeConfig {
|
|
56
|
+
icon: string;
|
|
57
|
+
label: string;
|
|
58
|
+
searchLabel: string;
|
|
59
|
+
}
|
|
60
|
+
export declare const CARD_TYPE_REGISTRY: Record<CardType, CardTypeConfig>;
|
|
61
|
+
/**
|
|
62
|
+
* Helper functions for card type configuration
|
|
63
|
+
*/
|
|
64
|
+
export declare function getCardTypeConfig(cardType: CardType): CardTypeConfig;
|
|
65
|
+
export declare function getCardTypeIcon(cardType: CardType): string;
|
|
66
|
+
export declare function getCardTypeLabel(cardType: CardType): string;
|
|
67
|
+
/**
|
|
68
|
+
* Typeahead option for search/filter dropdowns
|
|
69
|
+
*/
|
|
70
|
+
export interface TypeaheadOption {
|
|
71
|
+
label: string;
|
|
72
|
+
value: CardType | "favorites" | "trash";
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Reserved keywords for search functionality
|
|
76
|
+
*/
|
|
77
|
+
export declare const RESERVED_KEYWORDS: TypeaheadOption[];
|
|
78
|
+
/**
|
|
79
|
+
* Type guard to check if a value is a valid CardType
|
|
80
|
+
*/
|
|
81
|
+
export declare function isCardType(value: unknown): value is CardType;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { CardType } from "./constants.js";
|
|
2
|
+
export declare const FILE_KINDS: readonly ["archive", "audio", "design", "image", "markdown", "motion", "office", "pdf", "source", "text", "tokens"];
|
|
3
|
+
export type FileKind = (typeof FILE_KINDS)[number];
|
|
4
|
+
export declare const FILE_PREVIEW_KINDS: readonly ["archive", "audio", "facts", "image", "markdown", "motion", "office", "pdf", "source"];
|
|
5
|
+
export type FilePreviewKind = (typeof FILE_PREVIEW_KINDS)[number];
|
|
6
|
+
export interface FileFormat {
|
|
7
|
+
cardType: Extract<CardType, "audio" | "document" | "image" | "text" | "video">;
|
|
8
|
+
extension: string;
|
|
9
|
+
id: string;
|
|
10
|
+
kind: FileKind;
|
|
11
|
+
language?: string;
|
|
12
|
+
mimeType: string;
|
|
13
|
+
mimeTypes: readonly string[];
|
|
14
|
+
preview: FilePreviewKind;
|
|
15
|
+
}
|
|
16
|
+
interface FileFormatDefinition extends FileFormat {
|
|
17
|
+
fileNames?: readonly string[];
|
|
18
|
+
suffixes: readonly string[];
|
|
19
|
+
}
|
|
20
|
+
export interface FilePreviewFacts {
|
|
21
|
+
animated?: boolean;
|
|
22
|
+
archiveDirectoryCount?: number;
|
|
23
|
+
archiveFileCount?: number;
|
|
24
|
+
characterCount?: number;
|
|
25
|
+
colorVariableCount?: number;
|
|
26
|
+
compressedBytes?: number;
|
|
27
|
+
headingCount?: number;
|
|
28
|
+
inspectedEntryCount?: number;
|
|
29
|
+
lineCount?: number;
|
|
30
|
+
slideCount?: number;
|
|
31
|
+
uncompressedBytes?: number;
|
|
32
|
+
wordCount?: number;
|
|
33
|
+
}
|
|
34
|
+
export declare const MAX_FILE_NAME_LENGTH = 240;
|
|
35
|
+
export declare const MAX_FILE_SIZE: number;
|
|
36
|
+
export declare const isGenericMimeType: (mimeType: string | null | undefined) => boolean;
|
|
37
|
+
export declare const FILE_FORMATS: readonly [FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition, FileFormatDefinition];
|
|
38
|
+
export type FileFormatId = (typeof FILE_FORMATS)[number]["id"];
|
|
39
|
+
export declare class FileFormatValidationError extends Error {
|
|
40
|
+
readonly code: "FILE_TOO_LARGE" | "INVALID_FILE_NAME" | "INVALID_FILE_SIZE" | "INVALID_MIME_TYPE" | "MIME_MISMATCH" | "UNSUPPORTED_FILE_TYPE";
|
|
41
|
+
constructor(code: FileFormatValidationError["code"], message: string);
|
|
42
|
+
}
|
|
43
|
+
export type FileUploadErrorCode = "FILE_TOO_LARGE" | "INVALID_INPUT" | "TYPE_MISMATCH";
|
|
44
|
+
export declare const fileUploadErrorCode: (error: FileFormatValidationError) => FileUploadErrorCode;
|
|
45
|
+
export declare const normalizeMimeType: (mimeType: string | null | undefined) => string;
|
|
46
|
+
export declare const validateFileName: (fileName: string) => string;
|
|
47
|
+
export declare const inferFileFormat: (input: {
|
|
48
|
+
fileName: string;
|
|
49
|
+
mimeType?: string | null;
|
|
50
|
+
}) => FileFormat | null;
|
|
51
|
+
export declare const validateFileFormat: (input: {
|
|
52
|
+
fileName: string;
|
|
53
|
+
mimeType?: string | null;
|
|
54
|
+
}) => FileFormat;
|
|
55
|
+
export declare const validateUploadFile: (input: {
|
|
56
|
+
fileName: string;
|
|
57
|
+
fileSize: number;
|
|
58
|
+
mimeType?: string | null;
|
|
59
|
+
}) => {
|
|
60
|
+
fileName: string;
|
|
61
|
+
format: FileFormat;
|
|
62
|
+
mimeType: string;
|
|
63
|
+
};
|
|
64
|
+
export declare const mimeTypeForFileName: (fileName: string) => string;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const MARKDOWN_CONTENT_MAX_BYTES: number;
|
|
2
|
+
export declare const MARKDOWN_CONTENT_TOO_LARGE_MESSAGE = "Text card content must not exceed 512 KiB when encoded as UTF-8.";
|
|
3
|
+
export declare const MARKDOWN_INVALID_UTF8_MESSAGE = "Markdown uploads must contain valid UTF-8 text.";
|
|
4
|
+
export declare const MARKDOWN_ERROR_CODES: {
|
|
5
|
+
readonly CONTENT_TOO_LARGE: "CONTENT_TOO_LARGE";
|
|
6
|
+
readonly INVALID_UTF8: "INVALID_UTF8";
|
|
7
|
+
};
|
|
8
|
+
export type MarkdownErrorCode = (typeof MARKDOWN_ERROR_CODES)[keyof typeof MARKDOWN_ERROR_CODES];
|
|
9
|
+
export declare class MarkdownContentError extends Error {
|
|
10
|
+
readonly code: MarkdownErrorCode;
|
|
11
|
+
constructor(code: MarkdownErrorCode, message: string);
|
|
12
|
+
}
|
|
13
|
+
export declare function isMarkdownFileName(fileName: string): boolean;
|
|
14
|
+
export declare function markdownContentByteLength(content: string): number;
|
|
15
|
+
export declare function validateMarkdownByteLength(byteLength: number): number;
|
|
16
|
+
export declare function validateMarkdownContent(content: string): string;
|
|
17
|
+
export declare function decodeMarkdownUtf8(bytes: Uint8Array): string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "teak-sdk",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.80",
|
|
4
|
+
"description": "Teak API client and OAuth discovery for browser and Node applications.",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/praveenjuge/teak.git",
|
|
8
|
+
"directory": "packages/sdk"
|
|
9
|
+
},
|
|
10
|
+
"license": "MIT",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/types/client/sdk.d.ts",
|
|
15
|
+
"import": "./dist/sdk.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "bun --no-env-file run build.ts",
|
|
24
|
+
"prepack": "bun run build",
|
|
25
|
+
"typecheck": "tsc build.ts ../convex/client/sdk.ts --strict --noEmit --moduleResolution bundler --module esnext --target es2022 --skipLibCheck --types bun,node"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@teak/convex": "workspace:*",
|
|
29
|
+
"@types/bun": "^1.4.0",
|
|
30
|
+
"@types/node": "^26.2.0",
|
|
31
|
+
"typescript": "^6.0.3"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"provenance": true
|
|
36
|
+
}
|
|
37
|
+
}
|