Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement the instill table related sdk and types #1666

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
pnpm lint-staged
npx lint-staged
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,14 @@
"turbo": "latest",
"typescript": "^5.5.4",
"yaml": "^2.5.0"

},
"engines": {
"node": ">=20.0.0"
},
"packageManager": "pnpm@9.1.4",
"pnpm": {
"overrides": {
"vite": "^5.2.14",
"vite": "^5.4.12",
"express": "4.21.1",
"braces": "^3.0.3",
"ws": "8.17.1",
Expand All @@ -58,7 +57,8 @@
"cookie": "^0.7.1",
"markdown-to-jsx": "^7.4.0",
"webpack": "^5.94.0",
"nanoid": "^3.3.8"
"nanoid": "^3.3.8",
"katex": "0.16.21"
}
},
"lint-staged": {
Expand Down
2 changes: 1 addition & 1 deletion packages/design-system/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@instill-ai/design-system",
"version": "0.86.2",
"version": "0.87.0-rc.1",
"description": "Instill AI's design system",
"repository": "https://github.com/instill-ai/design-system.git",
"bugs": "https://github.com/instill-ai/design-system/issues",
Expand Down
1 change: 1 addition & 0 deletions packages/design-system/src/new-ui/Button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const buttonVariants = cva(
sm: "px-2 py-[6px] product-button-button-3",
md: "px-3 py-[9px] product-button-button-2",
lg: "px-4 py-3 product-button-button-1",
icon: "p-2",
},
},
defaultVariants: {
Expand Down
28 changes: 28 additions & 0 deletions packages/design-system/src/new-ui/Icons/CheckVerified02.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"use client";

import * as React from "react";

import { IconBase, IconBaseProps } from "./IconBase";

export const CheckVerified02 = React.forwardRef<
SVGSVGElement,
Omit<IconBaseProps, "viewBox" | "children">
>((props, ref) => {
const { className, ...passThrough } = props;
return (
<IconBase
{...passThrough}
ref={ref}
viewBox="0 0 24 24"
className={className}
>
<path
d="M9 12L11 14L15.5 9.5M17.9012 4.99851C18.1071 5.49653 18.5024 5.8924 19.0001 6.09907L20.7452 6.82198C21.2433 7.02828 21.639 7.42399 21.8453 7.92206C22.0516 8.42012 22.0516 8.97974 21.8453 9.47781L21.1229 11.2218C20.9165 11.7201 20.9162 12.2803 21.1236 12.7783L21.8447 14.5218C21.9469 14.7685 21.9996 15.0329 21.9996 15.2999C21.9997 15.567 21.9471 15.8314 21.8449 16.0781C21.7427 16.3249 21.5929 16.549 21.4041 16.7378C21.2152 16.9266 20.991 17.0764 20.7443 17.1785L19.0004 17.9009C18.5023 18.1068 18.1065 18.5021 17.8998 18.9998L17.1769 20.745C16.9706 21.2431 16.575 21.6388 16.0769 21.8451C15.5789 22.0514 15.0193 22.0514 14.5212 21.8451L12.7773 21.1227C12.2792 20.9169 11.7198 20.9173 11.2221 21.1239L9.47689 21.8458C8.97912 22.0516 8.42001 22.0514 7.92237 21.8453C7.42473 21.6391 7.02925 21.2439 6.82281 20.7464L6.09972 19.0006C5.8938 18.5026 5.49854 18.1067 5.00085 17.9L3.25566 17.1771C2.75783 16.9709 2.36226 16.5754 2.15588 16.0777C1.94951 15.5799 1.94923 15.0205 2.1551 14.5225L2.87746 12.7786C3.08325 12.2805 3.08283 11.7211 2.8763 11.2233L2.15497 9.47678C2.0527 9.2301 2.00004 8.96568 2 8.69863C1.99996 8.43159 2.05253 8.16715 2.15472 7.92043C2.25691 7.67372 2.40671 7.44955 2.59557 7.26075C2.78442 7.07195 3.00862 6.92222 3.25537 6.8201L4.9993 6.09772C5.49687 5.89197 5.89248 5.4972 6.0993 5.00006L6.82218 3.25481C7.02848 2.75674 7.42418 2.36103 7.92222 2.15473C8.42027 1.94842 8.97987 1.94842 9.47792 2.15473L11.2218 2.87712C11.7199 3.08291 12.2793 3.08249 12.7771 2.87595L14.523 2.15585C15.021 1.94966 15.5804 1.9497 16.0784 2.15597C16.5763 2.36223 16.972 2.75783 17.1783 3.25576L17.9014 5.00153L17.9012 4.99851Z"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
/>
</IconBase>
);
});
CheckVerified02.displayName = "IconCheckVerified02";
2 changes: 2 additions & 0 deletions packages/design-system/src/new-ui/Icons/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { CalendarCheck01 } from "./CalendarCheck01";
import { CardRefresh } from "./CardRefresh";
import { Check } from "./Check";
import { CheckCircle } from "./CheckCircle";
import { CheckVerified02 } from "./CheckVerified02";
import { ChevronDown } from "./ChevronDown";
import { ChevronDownDouble } from "./ChevronDownDouble";
import { ChevronLeft } from "./ChevronLeft";
Expand Down Expand Up @@ -201,6 +202,7 @@ export const Icons = {
CardRefresh,
Check,
CheckCircle,
CheckVerified02,
ChevronDown,
ChevronDownDouble,
ChevronLeft,
Expand Down
1 change: 0 additions & 1 deletion packages/design-tokens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"build": "pnpm build-sd && pnpm build-tw && pnpm build-css-variables",
"ts-types": "tsc --emitDeclarationOnly",
"lint": "eslint . --ext .ts,.tsx,.js,.jsx --cache",
"dev": "tsx ./buildStyleDictionary.ts",
"build-sd": "tsx ./src/buildSDTokens.ts",
"build-tw": "tsx ./src/buildTailwindPreset.ts",
"build-css-variables": "tsx ./src/buildCSSVariables.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "instill-sdk",
"version": "0.13.1",
"version": "0.14.0-rc.22",
"description": "Instill AI's Typescript SDK",
"repository": "https://github.com/instill-ai/typescript-sdk.git",
"bugs": "https://github.com/instill-ai/community/issues",
Expand Down
43 changes: 43 additions & 0 deletions packages/sdk/src/helper/cellHelper.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import {
Cell,
NumberCell,
StringCell,
BooleanCell,
FileCell,
DocumentCell,
ImageCell,
VideoCell,
AudioCell,
} from "../table";

export function isStringCell(cell: Cell): cell is StringCell {
return cell.type === "string";
}

export function isNumberCell(cell: Cell): cell is NumberCell {
return cell.type === "number";
}

export function isBooleanCell(cell: Cell): cell is BooleanCell {
return cell.type === "boolean";
}

export function isFileCell(cell: Cell): cell is FileCell {
return cell.type === "file";
}

export function isDocumentCell(cell: Cell): cell is DocumentCell {
return cell.type === "document";
}

export function isImageCell(cell: Cell): cell is ImageCell {
return cell.type === "image";
}

export function isVideoCell(cell: Cell): cell is VideoCell {
return cell.type === "video";
}

export function isAudioCell(cell: Cell): cell is AudioCell {
return cell.type === "audio";
}
16 changes: 15 additions & 1 deletion packages/sdk/src/helper/getQueryString.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const getQueryString = ({
urlExpireDays,
lastModifiedTime,
objectExpireDays,
datetime,
sort,
}: {
baseURL: string;
pageSize?: number;
Expand All @@ -50,6 +52,8 @@ export const getQueryString = ({
urlExpireDays?: number;
lastModifiedTime?: string;
objectExpireDays?: number;
datetime?: string;
sort?: string;
}) => {
let url = baseURL;

Expand All @@ -70,7 +74,9 @@ export const getQueryString = ({
fileUid ||
chunkUids ||
objectName ||
objectUid
objectUid ||
datetime ||
sort
) {
// Check if the baseURL already has a query string
if (baseURL.includes("?")) {
Expand Down Expand Up @@ -170,6 +176,14 @@ export const getQueryString = ({
url += `objectExpireDays=${objectExpireDays}&`;
}

if (datetime) {
url += `datetime=${datetime}&`;
}

if (sort) {
url += `sort=${sort}&`;
}

if (url.endsWith("&")) {
url = url.slice(0, -1);
}
Expand Down
1 change: 1 addition & 0 deletions packages/sdk/src/helper/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ export { readableStreamAsyncIterable } from "./readableStreamAsyncIterable";
export { findDoubleNewlineIndex } from "./findDoubleNewlineIndex";
export * from "./InstillNameInterpreter";
export * from "./UndefinedToNull";
export * from "./cellHelper";
1 change: 1 addition & 0 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ export * from "./helper";
export * from "./application";
export type * from "./catalog";
export type * from "./artifact";
export type * from "./table";

export * from "./vdp/trigger/streamHelpers";
2 changes: 2 additions & 0 deletions packages/sdk/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
SecretClient,
TriggerClient,
} from "../vdp";
import { TableClient } from "../table";

export type RequestOption = {
body?: string | File;
Expand Down Expand Up @@ -153,4 +154,5 @@ export class InstillAPIClient {
application = new ApplicationClient(this);
catalog = new CatalogClient(this);
artifact = new ArtifactClient(this);
table = new TableClient(this);
}
Loading
Loading