diff --git a/packages/dts-gen/kintone.d.ts b/packages/dts-gen/kintone.d.ts index 62040ac22b..db5e817c3b 100644 --- a/packages/dts-gen/kintone.d.ts +++ b/packages/dts-gen/kintone.d.ts @@ -85,6 +85,43 @@ declare namespace kintone { ): Promise; } + function getUserPreference(): Promise; + function isUsersAndSystemAdministrator(): Promise; + function getAvailableServices(): Promise; + function getDomain(): Promise; + function getAvailableApiTypes(): Promise; + function isAccessWithClientCertificateAuthentication(): Promise; + function isMobileApp(): Promise; + function isMobilePage(): Promise; + function isRevampedUI(): Promise; + function getPageType(): Promise; + function showConfirmDialog( + config: ConfirmDialogConfig, + ): Promise; + function createDialog(config: CreateDialogConfig): Promise; + function showNotification( + type: NotificationType, + message: string, + ): Promise; + function showLoading(state: "VISIBLE" | "HIDDEN"): Promise; + function buildPageUrl( + page: PageType, + params: BuildPageUrlParams, + ): Promise; + function setKeyboardShortcuts( + config: boolean | Partial>, + ): Promise; + function getKeyboardShortcuts(): Promise< + Partial> + >; + + namespace user { + function getOrganizations(code?: string): Promise; + function getGroups(code?: string): Promise; + function getCustomFields(code?: string): Promise; + function getIcons(params: { users: string[] }): Promise; + } + namespace app { function getFieldElements(fieldCode: string): HTMLElement[] | null; function getHeaderMenuSpaceElement(): HTMLElement | null; @@ -95,6 +132,51 @@ declare namespace kintone { function getQueryCondition(): string | null; function getRelatedRecordsTargetAppId(fieldCode: string): string | null; + function get(): Promise; + function getFormFields(): Promise; + function getFormLayout(): Promise; + function isTestEnvironment(): Promise; + function isMaintenanceMode(): Promise; + function showDescription(state: "OPEN" | "CLOSED"): Promise; + function getDescriptionDisplayState(): Promise< + "OPEN" | "CLOSED" | "HIDDEN" + >; + function getIcons(apps: number[]): Promise; + function getView(): Promise; + function getViews(): Promise; + function getReports(): Promise; + function getStatus(): Promise; + function getCategories(): Promise; + function getPermissions(): Promise; + function showAddRecordButton(state: DisplayState): Promise; + function getAddRecordButtonDisplayState(): Promise; + function showAppSettingsButton(state: DisplayState): Promise; + function getAppSettingsButtonDisplayState(): Promise; + function showOptionsButton(state: DisplayState): Promise; + function getOptionsButtonDisplayState(): Promise; + function showFilterButton(state: DisplayState): Promise; + function getFilterButtonDisplayState(): Promise; + function showReportButton(state: DisplayState): Promise; + function getReportButtonDisplayState(): Promise; + function showViewAndReportSelector(state: DisplayState): Promise; + function getViewAndReportSelectorDisplayState(): Promise; + function showViewSelectorItems( + config: Record, + ): Promise; + function getViewSelectorItemsDisplayState(): Promise< + Record + >; + function showReportSelectorItems( + config: Record, + ): Promise; + function getReportSelectorItemsDisplayState(): Promise< + Record + >; + function setRecordListStyle( + config: RecordListStyleConfig | "DEFAULT", + ): Promise; + function getRecordListStyle(): Promise; + namespace record { function getId(): number | null; function get(): any | null; @@ -104,10 +186,65 @@ declare namespace kintone { function getSpaceElement(id: string): HTMLElement | null; function setFieldShown(fieldCode: string, isShown: boolean): void; function setGroupFieldOpen(fieldCode: string, isOpen: boolean): void; + + function isGroupFieldOpen(fieldCode: string): Promise; + function getPermissions(): Promise; + function getFieldPermissions(): Promise< + Record + >; + function getStatusHistory( + offset?: number, + limit?: number, + ): Promise; + function getStatusActions(): Promise; + function getAssignees(): Promise; + function getActions(): Promise>; + function isFieldVisible(fieldCode: string): Promise; + function showEditRecordButton(state: DisplayState): Promise; + function getEditRecordButtonDisplayState(): Promise; + function showDuplicateRecordButton(state: DisplayState): Promise; + function getDuplicateRecordButtonDisplayState(): Promise; + function showPager(state: DisplayState): Promise; + function getPagerDisplayState(): Promise; + function showSideBar(state: SideBarDisplayState): Promise; + function getSideBarDisplayState(): Promise; + function showChangeAssigneeButton(state: DisplayState): Promise; + function getChangeAssigneeButtonDisplayState(): Promise; + function showActionButton( + action: string, + state: DisplayState, + ): Promise; + function getActionButtonDisplayState( + action: string, + ): Promise; + function showStatusActionButton( + action: string, + state: DisplayState, + ): Promise; + function getStatusActionButtonDisplayState( + action: string, + ): Promise; + function setFieldStyle( + fieldCode: string, + config: FieldStyleConfig | "DEFAULT", + ): Promise; + function getFieldStyle(fieldCode: string): Promise; } } namespace mobile { + function showNotification( + type: NotificationType, + message: string, + ): Promise; + function showLoading(state: "VISIBLE" | "HIDDEN"): Promise; + function showConfirmBottomSheet( + config: ConfirmBottomSheetConfig, + ): Promise; + function createBottomSheet( + config: CreateBottomSheetConfig, + ): Promise; + namespace app { function getFieldElements(fieldCode: string): HTMLElement[] | null; function getHeaderSpaceElement(): HTMLElement | null; @@ -117,6 +254,45 @@ declare namespace kintone { function getQueryCondition(): string | null; function getRelatedRecordsTargetAppId(fieldCode: string): string | null; + function get(): Promise; + function getFormFields(): Promise; + function getFormLayout(): Promise; + function isTestEnvironment(): Promise; + function isMaintenanceMode(): Promise; + function getIcons(apps: number[]): Promise; + function getView(): Promise; + function getViews(): Promise; + function getReports(): Promise; + function getStatus(): Promise; + function getCategories(): Promise; + function getPermissions(): Promise; + function showAddRecordButton(state: DisplayState): Promise; + function getAddRecordButtonDisplayState(): Promise; + function showOptionsButton(state: DisplayState): Promise; + function getOptionsButtonDisplayState(): Promise; + function showFilterButton(state: DisplayState): Promise; + function getFilterButtonDisplayState(): Promise; + function showViewSelector(state: DisplayState): Promise; + function getViewSelectorDisplayState(): Promise; + function showViewSelectorItems( + config: Record, + ): Promise; + function getViewSelectorItemsDisplayState(): Promise< + Record + >; + function showReportSelector(state: DisplayState): Promise; + function getReportSelectorDisplayState(): Promise; + function showReportSelectorItems( + config: Record, + ): Promise; + function getReportSelectorItemsDisplayState(): Promise< + Record + >; + function setRecordListStyle( + config: RecordListStyleConfig | "DEFAULT", + ): Promise; + function getRecordListStyle(): Promise; + namespace record { function getId(): number | null; function get(): any | null; @@ -125,6 +301,42 @@ declare namespace kintone { function getSpaceElement(id: string): HTMLElement | null; function setFieldShown(fieldCode: string, isShown: boolean): void; function setGroupFieldOpen(fieldCode: string, isOpen: boolean): void; + + function isGroupFieldOpen(fieldCode: string): Promise; + function getPermissions(): Promise; + function getFieldPermissions(): Promise< + Record + >; + function getStatusHistory( + offset?: number, + limit?: number, + ): Promise; + function getStatusActions(): Promise; + function getAssignees(): Promise; + function isFieldVisible(fieldCode: string): Promise; + function showEditRecordButton(state: DisplayState): Promise; + function getEditRecordButtonDisplayState(): Promise; + function showPager(state: DisplayState): Promise; + function getPagerDisplayState(): Promise; + function showActionButton( + action: string, + state: DisplayState, + ): Promise; + function getActionButtonDisplayState( + action: string, + ): Promise; + function showStatusActionButton( + action: string, + state: DisplayState, + ): Promise; + function getStatusActionButtonDisplayState( + action: string, + ): Promise; + function setFieldStyle( + fieldCode: string, + config: FieldStyleConfig | "DEFAULT", + ): Promise; + function getFieldStyle(fieldCode: string): Promise; } } @@ -199,11 +411,24 @@ declare namespace kintone { } namespace space { + function get(): Promise; + function getPermissions(): Promise; + namespace portal { function getContentSpaceElement(): HTMLElement | null; } } + namespace system { + function getAvailableFeatures(): Promise; + function getPermissions(): Promise; + } + + namespace license { + function isTrial(): Promise; + function getSubscriptionPlan(): Promise; + } + interface LoginUser { id: string; code: string; @@ -224,6 +449,423 @@ declare namespace kintone { const $PLUGIN_ID: string; + // ---- Shared types ---- + + type DisplayState = "VISIBLE" | "HIDDEN"; + type SideBarDisplayState = "CLOSED" | "COMMENTS" | "HISTORY" | "HIDDEN"; + type ConfirmDialogResult = "OK" | "CANCEL" | "CLOSE"; + type NotificationType = "ERROR" | "SUCCESS" | "INFO"; + type SubscriptionPlan = "STANDARD" | "WIDE"; + type KintoneApiType = "CORE" | "WIDE"; + type ShortcutName = + | "SHOW_RECORD" + | "FOCUS_SEARCH_BOX" + | "SHORTCUTS_HELP" + | "CREATE_RECORD" + | "EDIT_RECORD" + | "NEXT_RECORD" + | "PREVIOUS_RECORD" + | "NEXT_PAGE" + | "PREVIOUS_PAGE" + | "CANCEL_EDITING" + | "SHOW_VIEW" + | "SHOW_FILTER" + | "SAVE_RECORD"; + type PageType = + | "APP_INDEX" + | "APP_CREATE" + | "APP_DETAIL" + | "APP_EDIT" + | "APP_PRINT" + | "APP_REPORT" + | "APP_INDEX_MOBILE" + | "APP_CREATE_MOBILE" + | "APP_DETAIL_MOBILE" + | "APP_EDIT_MOBILE" + | "APP_REPORT_MOBILE" + | "PORTAL_TOP" + | "PORTAL_TOP_MOBILE" + | "SPACE_PORTAL" + | "SPACE_THREAD" + | "SPACE_PORTAL_MOBILE" + | "SPACE_THREAD_MOBILE" + | "PEOPLE_TOP" + | "PEOPLE_TOP_MOBILE" + | "MESSAGE_TOP" + | "MESSAGE_TOP_MOBILE" + | "SEARCH_TOP" + | "SEARCH_TOP_MOBILE" + | "NOTIFICATION_TOP" + | "APP_MARKETPLACE_TOP" + | "APP_MARKETPLACE_CATEGORY" + | "APP_MARKETPLACE_SEARCH" + | "APP_MARKETPLACE_DETAIL" + | "APP_SETTINGS_PLUGIN_SETTINGS"; + + // ---- Interfaces ---- + + interface UserPreference { + timeFormat: "TWELVE" | "TWENTY_FOUR"; + desktopNotifications: { + enabled: boolean; + }; + emailNotifications: { + enabled: boolean; + condition: "TO_ME" | "ALL"; + format: "HTML" | "TEXT"; + }; + } + + interface OrganizationMembership { + organization: { + id: string; + code: string; + name: string; + primary: boolean; + }; + title: { + id: string; + code: string; + name: string; + } | null; + } + + interface KintoneGroup { + id: string; + code: string; + name: string; + } + + interface KintoneCustomField { + code: string; + name: string; + type: "SINGLE_LINE_TEXT" | "USER_SELECT"; + value: string | { code: string; name: string }; + visibility: "PUBLIC" | "PRIVATE"; + } + + interface KintoneUserIcon { + user: string; + url: string; + } + + interface AvailableServices { + garoon: boolean; + office: boolean; + mailwise: boolean; + } + + interface KintoneDomain { + subdomain: string; + baseDomain: "cybozu.com" | "cybozu.cn" | "kintone.com"; + } + + interface PageTypeResult { + type: + | "APP" + | "PORTAL" + | "SPACE" + | "PEOPLE" + | "MESSAGE" + | "SEARCH" + | "NOTIFICATION" + | "APP_MARKETPLACE" + | "APP_SETTINGS"; + page: PageType; + } + + interface ConfirmDialogConfig { + title?: string; + body?: string; + showOkButton?: boolean; + okButtonText?: string; + showCancelButton?: boolean; + cancelButtonText?: string; + showCloseButton?: boolean; + } + + interface ConfirmBottomSheetConfig { + title?: string; + body?: string; + showOkButton?: boolean; + okButtonText?: string; + showCancelButton?: boolean; + cancelButtonText?: string; + showCloseButton?: boolean; + } + + type DialogCloseResult = "OK" | "CANCEL" | "CLOSE" | "FUNCTION"; + + interface CreateDialogConfig { + title?: string; + body?: Element; + showOkButton?: boolean; + okButtonText?: string; + showCancelButton?: boolean; + cancelButtonText?: string; + showCloseButton?: boolean; + beforeClose?: ( + action: "OK" | "CANCEL" | "CLOSE", + ) => boolean | void | Promise; + } + + interface Dialog { + show(): Promise; + close(): void; + } + + interface CreateBottomSheetConfig { + title?: string; + body?: Element; + showOkButton?: boolean; + okButtonText?: string; + showCancelButton?: boolean; + cancelButtonText?: string; + showCloseButton?: boolean; + beforeClose?: ( + action: "OK" | "CANCEL" | "CLOSE", + ) => boolean | void | Promise; + } + + interface BottomSheet { + show(): Promise; + close(): void; + } + + interface BuildPageUrlParams { + appId?: string; + recordId?: string; + viewId?: string; + reportId?: string; + spaceId?: string; + threadId?: string; + userCode?: string; + } + + interface AppInfo { + id: string; + name: string; + description: string; + code: string | null; + numberPrecision: { + digits: number; + decimalPlaces: number; + roundingMode: "HALF_EVEN" | "UP" | "DOWN"; + }; + enableComments: boolean; + enableThumbnails: boolean; + enableChangeHistory: boolean; + enableInlineRecordEditing: boolean; + createdAt: string; + creator: { code: string; name: string }; + modifiedAt: string; + modifier: { code: string; name: string }; + spaceId: string | null; + revision: string; + } + + interface AppIcon { + app: number; + url: string; + } + + interface RecordListView { + type: "LIST" | "CALENDAR" | "CUSTOM"; + builtinType?: "ASSIGNEE" | "ALL"; + name: string; + id: string; + fields?: string[]; + date?: string; + title?: string; + html?: string; + pager?: boolean; + device?: "DESKTOP" | "ANY"; + filterCond: string; + sort: string; + } + + interface View { + type: "LIST" | "CALENDAR" | "CUSTOM"; + builtinType?: "ASSIGNEE" | "ALL"; + name: string; + id: string; + } + + interface Report { + name: string; + id: string; + chartType: + | "BAR" + | "COLUMN" + | "PIE" + | "LINE" + | "PIVOT_TABLE" + | "TABLE" + | "AREA" + | "SPLINE" + | "SPLINE_AREA"; + periodicReport: boolean; + } + + interface AppPermissions { + addRecord: boolean; + editApp: boolean; + } + + interface Categories { + enabled: boolean; + categories: Record< + string, + { + name: string; + index: string; + children: Record; + } + >; + } + + interface RecordPermissions { + editRecord: boolean; + deleteRecord: boolean; + } + + interface StatusHistoryEntry { + changedAt: string; + assignees: Array<{ code: string; name: string }>; + status: string; + } + + interface StatusAction { + name: string; + nextStatus: { + name: string; + type: "ONE" | "ALL" | "ANY"; + assignees: Array<{ code: string; name: string }>; + }; + } + + interface Assignee { + assignee: { code: string; name: string }; + action: string | null; + } + + interface FieldStyleConfig { + content?: + | { + backgroundColor?: string; + color?: string; + fontWeight?: "normal" | "bold"; + textDecoration?: "none" | "underline" | "line-through"; + borderColor?: string; + } + | "DEFAULT"; + background?: { backgroundColor?: string } | "DEFAULT"; + label?: + | { + color?: string; + fontWeight?: "normal" | "bold"; + textDecoration?: "none" | "underline" | "line-through"; + } + | "DEFAULT"; + } + + interface FieldStyleResult { + content: { + backgroundColor: string; + color: string; + fontWeight: string; + textDecoration: string; + borderColor: string; + }; + background: { + backgroundColor: string; + }; + label: { + color: string; + fontWeight: string; + textDecoration: string; + }; + } + + interface RecordListStyleConfig { + header?: + | Array<{ + columnType?: "FIELD" | "ACTION"; + column?: string; + content?: + | { color?: string; fontWeight?: string; textDecoration?: string } + | "DEFAULT"; + background?: { backgroundColor?: string } | "DEFAULT"; + }> + | "DEFAULT"; + body?: + | Array<{ + recordId?: string; + style?: + | Array<{ + columnType?: "FIELD" | "ACTION"; + column?: string; + content?: + | { + color?: string; + fontWeight?: string; + textDecoration?: string; + backgroundColor?: string; + borderColor?: string; + } + | "DEFAULT"; + background?: { backgroundColor?: string } | "DEFAULT"; + }> + | "DEFAULT"; + }> + | "DEFAULT"; + } + + interface RecordListStyleResult { + header: Array<{ + columnType: "FIELD" | "ACTION"; + column: string; + content: { color: string; fontWeight: string; textDecoration: string }; + background: { backgroundColor: string }; + }>; + body: Array<{ + recordId: string; + style: Array<{ + columnType: "FIELD" | "ACTION"; + column: string; + content: { + color: string; + fontWeight: string; + textDecoration: string; + backgroundColor: string; + borderColor: string; + }; + background: { backgroundColor: string }; + }>; + }>; + } + + interface SpaceInfo { + id: string; + name: string; + isGuest: boolean; + } + + interface SpacePermissions { + administration: boolean; + } + + interface AvailableFeatures { + space: { enabled: boolean }; + guestSpace: { enabled: boolean }; + people: { enabled: boolean }; + message: { enabled: boolean }; + } + + interface SystemPermissions { + administration: boolean; + } + namespace fieldTypes { interface SingleLineText { type?: "SINGLE_LINE_TEXT";