/** * カタカナをひらがなに変換します。 * * @param target - 変換対象の文字列 * @returns カタカナがひらがなに変換された文字列 * * @example * ``` * convertKatakanaToHiragana("カタカナ") // => "かたかな" * convertKatakanaToHiragana("カタカナとひらがな") // => "かたかなとひらがな" * ``` */ declare const convertKatakanaToHiragana: (target: string) => string; /** * 全角英数字を半角英数字に変換します。 * * @param target - 変換対象の文字列 * @returns 全角英数字が半角英数字に変換された文字列 * * @example * ``` * convertFullwidthAlphanumericToHalfwidth("ABC123") // => "ABC123" * convertFullwidthAlphanumericToHalfwidth("全角英数字") // => "全角英数字" * ``` */ declare const convertFullwidthAlphanumericToHalfwidth: (target: string) => string; /** * 半角カタカナを全角カタカナに変換します。 * * @param target - 変換対象の文字列 * @returns 半角カタカナが全角カタカナに変換された文字列 * * @example * ``` * convertHalfwidthKatakanaToFullwidth("カタカナ") // => "カタカナ" * convertHalfwidthKatakanaToFullwidth("半角カタカナ") // => "半角カタカナ" * ``` */ declare const convertHalfwidthKatakanaToFullwidth: (target: string) => string; type GetYuruCharaOptions = { isZenkakuEisujiSensitive: boolean; isCaseSensitive: boolean; isHankakuKatakanaSensitive: boolean; isKatakanaSensitive: boolean; isHebonSensitive: boolean; isHyphenSensitive: boolean; }; /** * 指定された文字列に以下の変換をかけて返却します * * - 全角英数字を半角英数字へ * - アルファベットを大文字から小文字へ * - 半角カナを全角カナへ * - カタカナをひらがなへ * * 各変換はオプションによって制御できます * * @param target - 変換対象の文字列 * @param options - 変換オプション * @param options.isZenkakuEisujiSensitive - 全角英数字を半角に変換するかどうか * @param options.isCaseSensitive - 大文字小文字を区別するかどうか * @param options.isHankakuKatakanaSensitive - 半角カタカナを全角カタカナに変換するかどうか * @param options.isKatakanaSensitive - カタカナをひらがなに変換するかどうか * @param options.isHebonSensitive - ヘボン式ローマ字に変換するかどうか * @param options.isHyphenSensitive - ハイフン、ダッシュ、長音を統一するかどうか * @returns 変換後の文字列 * * @example * ```ts * getYuruChara('アイウエオ') // => 'あいうえお' * getYuruChara('アイウエオ', { isKatakanaSensitive: true }) // => 'アイウエオ' * getYuruChara('アイウエオ', { isHankakuKatakanaSensitive: true }) // => 'アイウエオ' * getYuruChara('ABC123') // => 'abc123' * getYuruChara('ABC123', { isCaseSensitive: true }) // => 'ABC123' * getYuruChara('ABC123', { isZenkakuEisujiSensitive: true }) // => 'abc123' * getYuruChara('ABC123', { isCaseSensitive: true, isZenkakuEisujiSensitive: true }) // => 'ABC123' * ``` */ declare const getYuruChara: (target: string, options?: Partial) => string; declare namespace cx { type Schema = typeof cybozu.data.page.SCHEMA_DATA | typeof cybozu.data.page.FORM_DATA.schema; type Field = (typeof cybozu.data.page.SCHEMA_DATA.table.fieldList)[string]; type Subtable = (typeof cybozu.data.page.SCHEMA_DATA.subTable)[string]; } /** * **この関数は非公式のAPIを使用しています。kintoneのアップデートにより使用できなくなる可能性があります** * * 内部的に使用されている、サブテーブルを除くフィールドのメタデータを取得します * * @returns サブテーブルを除くフィールドのメタデータ一覧、またはnull */ declare const getMetaTable_UNSTABLE: () => cx.Field[] | null; /** * **この関数は非公式のAPIを使用しています。kintoneのアップデートにより使用できなくなる可能性があります** * * 内部的に使用されている、サブテーブルのメタデータを取得します * * @returns サブテーブルのメタデータ一覧、またはnull */ declare const getMetaSubtable_UNSTABLE: () => cx.Subtable[] | null; /** * **この関数は非公式のAPIを使用しています。kintoneのアップデートにより使用できなくなる可能性があります** * * 内部的に使用されている、フィールドのメタデータを取得します * * サブテーブルとそれ以外とで、データの構造が異なります * * @returns フィールドのメタデータ一覧、またはnull */ declare const getMetaFields_UNSTABLE: () => (cx.Field | cx.Subtable)[] | null; /** * **この関数は非公式のAPIを使用しています。kintoneのアップデートにより使用できなくなる可能性があります** * * フィールドコードから、紐づくフィールドの内部的に使用されている一意なフィールドIDを返却します * * @param code フィールドコード * @returns フィールドID、またはnull */ declare const getMetaFieldId_UNSTABLE: (code: keyof T) => string | null; /** * **この関数は非公式のAPIを使用しています。kintoneのアップデートにより使用できなくなる可能性があります** * * @param subtableCode サブテーブルのフィールドコード * @returns サブテーブル内に存在するフィールドのメタデータ一覧、またはnull */ declare const getMetaSubtableFields_UNSTABLE: (subtableCode: string) => cx.Field[] | null; /** * **この関数は非公式のAPIを使用しています。kintoneのアップデートにより使用できなくなる可能性があります** * * URLのクエリパラメータに含まれる一覧の検索条件を取得します * クエリパラメータでは、フィールドのキー情報としてフィールドコードの代わりにフィールドID(f + 数字)が使用されます * * 保険として、URLのクエリパラメータに含まれるqパラメータも取得します * * 取得する手順は以下の通りです * * 1. `cybozu.data.page.QUERY_STRING` * 2. `new URLSearchParams(location.search).get('q')` * 3. 空文字 * * @example * ```ts * // URL: https://example.cybozu.com/k/1/?f100000=1&f200000=2 * getQueryString_UNSTABLE(); // => 'f100000=1&f200000=2' * ``` */ declare const getQueryString_UNSTABLE: () => string; /** * サイボウズのグループ情報を取得します。 * * @returns サイボウズAPIから取得したグループ情報のリストを含むPromise * @throws APIエラーが発生した場合にエラーをスローします * * @example * ```typescript * // グループ情報を取得する * const result = await getCybozuGroups(); * console.log(result.groups); // グループの配列が出力される * * // エラーハンドリングと組み合わせる * try { * const { groups } = await getCybozuGroups(); * groups.forEach(group => { * console.log(`グループ名: ${group.name}, ID: ${group.id}`); * }); * } catch (error) { * console.error('グループ取得に失敗しました:', error); * } * ``` */ declare function getCybozuGroups(): Promise<{ groups: cybozu.api.Group[]; }>; /** * サイボウズのグループに所属するユーザー一覧を取得します。 * * 詳細は、[サイボウズのAPIドキュメント](https://cybozu.dev/ja/common/docs/user-api/groups/get-groups-users/)を参照してください。 * * @param groupCode - 取得対象のグループコード * @returns グループに所属するユーザー一覧を含むPromise * @see {@link getCybozuGroups} グループ情報を取得するための関数 * * @example * ```typescript * // 営業部グループのユーザー一覧を取得 * const result = await getCybozuGroupUsers('sales'); * console.log(result.users); // User[] * * // 開発チームのユーザー一覧を取得 * const devTeam = await getCybozuGroupUsers('dev-team'); * devTeam.users.forEach(user => { * console.log(`${user.name}: ${user.email}`); * }); * ``` */ declare function getCybozuGroupUsers(groupCode: string): Promise<{ users: cybozu.api.User[]; }>; /** * Cybozu組織情報を取得します。 * * @description * このメソッドは、Cybozuのorganizations APIエンドポイントにGETリクエストを送信し、 * 組織の一覧を取得します。 * * @returns {Promise<{ organizations: cybozu.api.Organization[] }>} * 組織情報の配列を含むPromiseオブジェクト * * @example * ```typescript * // 組織情報を取得する例 * const result = await getCybozuOrganizations(); * console.log(result.organizations); // Organization[] * * // エラーハンドリングを含む例 * try { * const { organizations } = await getCybozuOrganizations(); * organizations.forEach(org => { * console.log(`組織名: ${org.name}, ID: ${org.id}`); * }); * } catch (error) { * console.error('組織情報の取得に失敗しました:', error); * } * ``` * * @throws {Error} APIリクエストが失敗した場合 * * @since 1.0.0 */ declare function getCybozuOrganizations(): Promise<{ organizations: cybozu.api.Organization[]; }>; /** * サイボウズ組織のユーザー一覧を取得します。 * * 指定された組織コードに所属するユーザーの情報を取得するためのAPIを呼び出します。 * * @param organizationCode - 取得対象の組織コード * @returns ユーザー一覧を含むPromiseオブジェクト * * @example * ```typescript * // 組織コード "sales" のユーザー一覧を取得 * const result = await getCybozuOrganizationUsers("sales"); * console.log(result.users); // User[] * * // エラーハンドリングを含む使用例 * try { * const { users } = await getCybozuOrganizationUsers("development"); * users.forEach(user => { * console.log(`ユーザー名: ${user.name}, ID: ${user.id}`); * }); * } catch (error) { * console.error("ユーザー取得に失敗しました:", error); * } * ``` */ declare function getCybozuOrganizationUsers(organizationCode: string): Promise<{ users: cybozu.api.User[]; }>; /** * サイボウズのユーザ情報を返却します * @returns サイボウズのユーザ情報 */ declare const getCybozuUsers: () => Promise<{ users: cybozu.api.User[]; }>; /** * ユーザーが所属するグループを返却します * @param code ユーザーコード * @returns ユーザーが所属するグループ */ declare const getCybozuUserGroups: (code: string) => Promise<{ groups: cybozu.api.Group[]; }>; /** * ユーザーが所属する組織を返却します * @param code ユーザーコード * @returns ユーザーが所属する組織 */ declare const getCybozuUserOrganizations: (code: string) => Promise<{ organizations: cybozu.api.Organization[]; }>; declare const getWareki: (date: Date, option?: { era?: "narrow" | "short" | "long"; }) => { gengo: string; year: number; }; /** * 指定された関数にロギング機能を追加するデコレータ関数。 * * ログはグループ化され、関数名、引数、戻り値、処理時間が表示される。 * * @template T - 関数の型。 * @param {T} fn - ロギングを追加する対象の関数。 * @param {string} [name=fn.name] - ログに表示する関数名。デフォルトは関数の名前。 * @returns {(...args: Parameters) => ReturnType} ロギング機能が追加された新しい関数。 * * @example * const add = (a: number, b: number) => a + b; * const addWithLogging = withLogging(add); * addWithLogging(2, 3); // ログが出力される */ declare const withLogging: any>(fn: T, name?: string) => (...args: Parameters) => ReturnType; /** * @see {@link https://github.com/kintone/js-sdk/blob/master/packages/rest-api-client/src/KintoneFields/types/field.ts} */ type FieldWith = { type: T; value: V; }; type Entity = { code: string; name: string; }; type FileInformation = { contentType: string; fileKey: string; name: string; size: string; }; type ID = FieldWith<'__ID__', string>; type Revision = FieldWith<'__REVISION__', string>; type RecordNumber$2 = FieldWith<'RECORD_NUMBER', string>; type Creator$2 = FieldWith<'CREATOR', Entity>; type CreatedTime$2 = FieldWith<'CREATED_TIME', string>; type Modifier$2 = FieldWith<'MODIFIER', Entity>; type UpdatedTime$2 = FieldWith<'UPDATED_TIME', string>; type SingleLineText$2 = FieldWith<'SINGLE_LINE_TEXT', string>; type Number$2 = FieldWith<'NUMBER', string>; type Calc$2 = FieldWith<'CALC', string>; type MultiLineText$2 = FieldWith<'MULTI_LINE_TEXT', string>; type RichText$2 = FieldWith<'RICH_TEXT', string>; type Link$2 = FieldWith<'LINK', string>; type CheckBox$2 = FieldWith<'CHECK_BOX', string[]>; type RadioButton$2 = FieldWith<'RADIO_BUTTON', string>; type Dropdown$2 = FieldWith<'DROP_DOWN', string | null>; type MultiSelect$2 = FieldWith<'MULTI_SELECT', string[]>; type File$3 = FieldWith<'FILE', FileInformation[]>; type Date$3 = FieldWith<'DATE', string | null>; type Time$2 = FieldWith<'TIME', string | null>; type DateTime$2 = FieldWith<'DATETIME', string>; type UserSelect$2 = FieldWith<'USER_SELECT', Entity[]>; type OrganizationSelect$2 = FieldWith<'ORGANIZATION_SELECT', Entity[]>; type GroupSelect$2 = FieldWith<'GROUP_SELECT', Entity[]>; type Category$1 = FieldWith<'CATEGORY', string[]>; type Status$1 = FieldWith<'STATUS', string>; type StatusAssignee$1 = FieldWith<'STATUS_ASSIGNEE', Entity[]>; type InSubtable$2 = SingleLineText$2 | Number$2 | Calc$2 | MultiLineText$2 | RichText$2 | Link$2 | CheckBox$2 | RadioButton$2 | Dropdown$2 | MultiSelect$2 | File$3 | Date$3 | Time$2 | DateTime$2 | UserSelect$2 | OrganizationSelect$2 | GroupSelect$2; type SubtableRow = { id: string; value: T; }; type Subtable$2 = FieldWith<'SUBTABLE', Array>>; type OneOf$2 = ID | Revision | RecordNumber$2 | Creator$2 | CreatedTime$2 | Modifier$2 | UpdatedTime$2 | SingleLineText$2 | Number$2 | Calc$2 | MultiLineText$2 | RichText$2 | Link$2 | CheckBox$2 | RadioButton$2 | Dropdown$2 | MultiSelect$2 | File$3 | Date$3 | Time$2 | DateTime$2 | UserSelect$2 | OrganizationSelect$2 | GroupSelect$2 | Category$1 | Status$1 | StatusAssignee$1 | Subtable$2<{ [fieldCode: string]: InSubtable$2; }>; /** * @see {@link https://github.com/kintone/js-sdk/blob/master/packages/rest-api-client/src/KintoneFields/types/fieldLayout.ts} */ type FieldLayoutWith = { type: T; code: string; size: S; }; type RecordNumber$1 = FieldLayoutWith<'RECORD_NUMBER'>; type Creator$1 = FieldLayoutWith<'CREATOR'>; type CreatedTime$1 = FieldLayoutWith<'CREATED_TIME'>; type Modifier$1 = FieldLayoutWith<'MODIFIER'>; type UpdatedTime$1 = FieldLayoutWith<'UPDATED_TIME'>; type SingleLineText$1 = FieldLayoutWith<'SINGLE_LINE_TEXT'>; type Number$1 = FieldLayoutWith<'NUMBER'>; type Calc$1 = FieldLayoutWith<'CALC'>; type MultiLineText$1 = FieldLayoutWith<'MULTI_LINE_TEXT', { width: string; innerHeight: string; }>; type RichText$1 = FieldLayoutWith<'RICH_TEXT', { width: string; innerHeight: string; }>; type Link$1 = FieldLayoutWith<'LINK'>; type CheckBox$1 = FieldLayoutWith<'CHECK_BOX'>; type RadioButton$1 = FieldLayoutWith<'RADIO_BUTTON'>; type Dropdown$1 = FieldLayoutWith<'DROP_DOWN'>; type MultiSelect$1 = FieldLayoutWith<'MULTI_SELECT'>; type File$2 = FieldLayoutWith<'FILE'>; type Date$2 = FieldLayoutWith<'DATE'>; type Time$1 = FieldLayoutWith<'TIME'>; type DateTime$1 = FieldLayoutWith<'DATETIME'>; type UserSelect$1 = FieldLayoutWith<'USER_SELECT'>; type OrganizationSelect$1 = FieldLayoutWith<'ORGANIZATION_SELECT'>; type GroupSelect$1 = FieldLayoutWith<'GROUP_SELECT'>; type ReferenceTable$1 = { type: 'REFERENCE_TABLE'; code: string; }; type Label = { type: 'LABEL'; label: string; size: { width: string; }; }; type HR = { type: 'HR'; size: { width: string; }; }; type Spacer = { type: 'SPACER'; elementId: string; size: { width: string; height: string; }; }; type OneOf$1 = RecordNumber$1 | Creator$1 | CreatedTime$1 | Modifier$1 | UpdatedTime$1 | SingleLineText$1 | Number$1 | Calc$1 | MultiLineText$1 | RichText$1 | Link$1 | CheckBox$1 | RadioButton$1 | Dropdown$1 | MultiSelect$1 | File$2 | Date$2 | Time$1 | DateTime$1 | UserSelect$1 | OrganizationSelect$1 | GroupSelect$1 | ReferenceTable$1 | Label | HR | Spacer; type InSubtable$1 = Exclude; /** * @see {@link https://github.com/kintone/js-sdk/blob/master/packages/rest-api-client/src/KintoneFields/types/property.ts} */ type RecordNumber = { type: 'RECORD_NUMBER'; code: string; label: string; noLabel: boolean; }; type Creator = { type: 'CREATOR'; code: string; label: string; noLabel: boolean; }; type CreatedTime = { type: 'CREATED_TIME'; code: string; label: string; noLabel: boolean; }; type Modifier = { type: 'MODIFIER'; code: string; label: string; noLabel: boolean; }; type UpdatedTime = { type: 'UPDATED_TIME'; code: string; label: string; noLabel: boolean; }; type Category = { type: 'CATEGORY'; code: string; label: string; enabled: boolean; }; type Status = { type: 'STATUS'; code: string; label: string; enabled: boolean; }; type StatusAssignee = { type: 'STATUS_ASSIGNEE'; code: string; label: string; enabled: boolean; }; type SingleLineText = { type: 'SINGLE_LINE_TEXT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; unique: boolean; minLength: string; maxLength: string; expression: string; hideExpression: boolean; }; type Number = { type: 'NUMBER'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; unique: boolean; minValue: string; maxValue: string; digit: boolean; displayScale: string; unit: string; unitPosition: 'BEFORE' | 'AFTER'; }; type Calc = { type: 'CALC'; code: string; label: string; noLabel: boolean; required: boolean; expression: string; hideExpression: boolean; format: 'NUMBER' | 'NUMBER_DIGIT' | 'DATETIME' | 'DATE' | 'TIME' | 'HOUR_MINUTE' | 'DAY_HOUR_MINUTE'; displayScale: string; unit: string; unitPosition: 'BEFORE' | 'AFTER'; }; type MultiLineText = { type: 'MULTI_LINE_TEXT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; }; type RichText = { type: 'RICH_TEXT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; }; type Link = { type: 'LINK'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; unique: boolean; minLength: string; maxLength: string; protocol: 'WEB' | 'CALL' | 'MAIL'; }; type Options = { [optionName: string]: { label: string; index: string; }; }; type CheckBox = { type: 'CHECK_BOX'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string[]; options: Options; align: 'HORIZONTAL' | 'VERTICAL'; }; type RadioButton = { type: 'RADIO_BUTTON'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; options: Options; align: 'HORIZONTAL' | 'VERTICAL'; }; type Dropdown = { type: 'DROP_DOWN'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; options: Options; }; type MultiSelect = { type: 'MULTI_SELECT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string[]; options: Options; }; type File$1 = { type: 'FILE'; code: string; label: string; noLabel: boolean; required: boolean; thumbnailSize: '50' | '150' | '250' | '500'; }; type Date$1 = { type: 'DATE'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; unique: boolean; defaultNowValue: boolean; }; type Time = { type: 'TIME'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; defaultNowValue: boolean; }; type DateTime = { type: 'DATETIME'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: string; unique: boolean; defaultNowValue: boolean; }; type UserSelect = { type: 'USER_SELECT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: Array<{ code: string; type: 'USER' | 'GROUP' | 'ORGANIZATION'; } | { code: 'LOGINUSER()'; type: 'FUNCTION'; }>; entities: Array<{ code: string; type: 'USER' | 'GROUP' | 'ORGANIZATION'; }>; }; type OrganizationSelect = { type: 'ORGANIZATION_SELECT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: Array<{ code: string; type: 'ORGANIZATION'; } | { code: 'PRIMARY_ORGANIZATION()'; type: 'FUNCTION'; }>; entities: Array<{ code: string; type: 'ORGANIZATION'; }>; }; type GroupSelect = { type: 'GROUP_SELECT'; code: string; label: string; noLabel: boolean; required: boolean; defaultValue: Array<{ code: string; type: 'GROUP'; }>; entities: Array<{ code: string; type: 'GROUP'; }>; }; type Group$1 = { type: 'GROUP'; code: string; label: string; noLabel: boolean; openGroup: boolean; }; type ReferenceTable = { type: 'REFERENCE_TABLE'; code: string; label: string; noLabel: boolean; referenceTable: { relatedApp: { app: string; code: string; }; condition: { field: string; relatedField: string; }; filterCond: string; displayFields: string[]; sort: string; size: '5' | '10' | '20' | '30' | '40' | '50'; }; }; type Lookup = { type: 'NUMBER' | 'SINGLE_LINE_TEXT'; code: string; label: string; noLabel: boolean; required: boolean; lookup: { relatedApp: { app: string; code: string; }; relatedKeyField: string; fieldMappings: Array<{ field: string; relatedField: string; }>; lookupPickerFields: string[]; filterCond: string; sort: string; }; }; type InSubtable = SingleLineText | Number | Calc | MultiLineText | RichText | Link | CheckBox | RadioButton | Dropdown | MultiSelect | File$1 | Date$1 | Time | DateTime | UserSelect | OrganizationSelect | GroupSelect | Lookup; type Subtable$1 = { type: 'SUBTABLE'; code: string; label: string; noLabel: boolean; fields: T; }; type OneOf = RecordNumber | Creator | CreatedTime | Modifier | UpdatedTime | Category | Status | StatusAssignee | SingleLineText | Number | Calc | MultiLineText | RichText | Link | CheckBox | RadioButton | Dropdown | MultiSelect | File$1 | Date$1 | Time | DateTime | UserSelect | OrganizationSelect | GroupSelect | Group$1 | ReferenceTable | Lookup | Subtable$1<{ [fieldCode: string]: InSubtable; }>; /** * @see {@link https://github.com/kintone/js-sdk/blob/master/packages/rest-api-client/src/KintoneFields/types/layout.ts} */ type Row = { type: 'ROW'; fields: T; }; type LayoutRow = Row; type Subtable = { type: 'SUBTABLE'; code: string; fields: T; }; type Group>> = { type: 'GROUP'; code: string; layout: T; }; type Layout = Array | Subtable | Group>>>; type Record$1 = { [fieldCode: string]: OneOf$2; }; type ViewType = 'LIST' | 'CALENDAR' | 'CUSTOM'; type ViewBaseForResponse = { index: string; builtinType?: 'ASSIGNEE'; id: string; name: string; filterCond: string; sort: string; }; type ViewBaseForParameter = { index: string | number; name?: string; filterCond?: string; sort?: string; }; type AdditionalPropertyForResponse = { LIST: { fields: string[]; }; CALENDAR: { date: string; title: string; }; CUSTOM: { html: string; pager: boolean; device: 'DESKTOP' | 'ANY'; }; }; type AdditionalPropertyForParameter = { LIST: { fields?: string[]; }; CALENDAR: { date?: string; title?: string; }; CUSTOM: { html?: string; pager?: boolean; device?: 'DESKTOP' | 'ANY'; }; }; type ViewForResponse = U extends ViewType ? ViewBaseForResponse & { type: U; } & AdditionalPropertyForResponse[U] : never; type ViewForParameter = U extends ViewType ? ViewBaseForParameter & { type: U; } & AdditionalPropertyForParameter[U] : never; declare namespace kintoneAPI { /** * @see {@link https://github.com/kintone/js-sdk/blob/master/packages/rest-api-client/src/client/types/app/index.ts} */ type App = { appId: string; code: string; name: string; description: string; spaceId: string | null; threadId: string | null; createdAt: string; creator: { code: string; name: string; }; modifiedAt: string; modifier: { code: string; name: string; }; }; type RecordData = Record$1; type EntityType = 'USER' | 'GROUP' | 'ORGANIZATION'; type IDToRequest = string | number; namespace view { type Response = ViewForResponse; type Parameter = ViewForParameter; } type Field = OneOf$2; /** JavaScript APIやREST APIから取得できるレコードの各フィールド情報 */ namespace field { type Calc = Calc$2; type Category = Category$1; type CheckBox = CheckBox$2; type CreatedTime = CreatedTime$2; type Creator = Creator$2; type Date = Date$3; type DateTime = DateTime$2; type Dropdown = Dropdown$2; type File = File$3; type GroupSelect = GroupSelect$2; type GroupEntity = GroupSelect['value'][number]; type ID = ID; type InSubtable = InSubtable$2; type Link = Link$2; type Modifier = Modifier$2; type MultiLineText = MultiLineText$2; type MultiSelect = MultiSelect$2; type Number = Number$2; type OneOf = OneOf$2; type OrganizationSelect = OrganizationSelect$2; type OrganizationEntity = OrganizationSelect['value'][number]; type RadioButton = RadioButton$2; type RecordNumber = RecordNumber$2; type Revision = Revision; type RichText = RichText$2; type SingleLineText = SingleLineText$2; type Status = Status$1; type StatusAssignee = StatusAssignee$1; type Subtable = Record> = Subtable$2; type Time = Time$2; type UpdatedTime = UpdatedTime$2; type UserSelect = UserSelect$2; type UserEntity = UserSelect['value'][number]; } type FieldProperty = OneOf; type FieldPropertyType = FieldProperty['type']; type FieldProperties = Record; type FieldEntry = [string, OneOf]; /** REST APIから取得できるアプリの各フィールド情報 */ namespace property { type Calc = Calc; type Category = Category; type CheckBox = CheckBox; type CreatedTime = CreatedTime; type Creator = Creator; type Date = Date$1; type DateTime = DateTime; type Dropdown = Dropdown; type File = File$1; type GroupSelect = GroupSelect; type InSubtable = InSubtable; type Link = Link; type Lookup = Lookup; type Modifier = Modifier; type MultiLineText = MultiLineText; type MultiSelect = MultiSelect; type Number = Number; type OneOf = OneOf; type OrganizationSelect = OrganizationSelect; type RadioButton = RadioButton; type RecordNumber = RecordNumber; type RichText = RichText; type SingleLineText = SingleLineText; type Status = Status; type StatusAssignee = StatusAssignee; type Subtable = Record> = Subtable$1; type Time = Time; type UpdatedTime = UpdatedTime; type UserSelect = UserSelect; } type Layout = Layout; type LayoutField = OneOf$1; namespace layout { type Label = Label; type Row = LayoutRow; type Group = Group; type Spacer = Spacer; type HR = HR; type CheckBox = CheckBox$1; type CreatedTime = CreatedTime$1; type Creator = Creator$1; type Date = Date$2; type DateTime = DateTime$1; type Dropdown = Dropdown$1; type File = File$2; type GroupSelect = GroupSelect$1; type InSubtable = InSubtable$1; type Link = Link$1; type Modifier = Modifier$1; type MultiLineText = MultiLineText$1; type MultiSelect = MultiSelect$1; type Number = Number$1; type OrganizationSelect = OrganizationSelect$1; type RadioButton = RadioButton$1; type RecordNumber = RecordNumber$1; type ReferenceTable = ReferenceTable$1; type RichText = RichText$1; type SingleLineText = SingleLineText$1; type Time = Time$1; type UpdatedTime = UpdatedTime$1; type UserSelect = UserSelect$1; } type AppSettings = { name: string; description: string; icon: { type: 'FILE'; file: { contentType: string; fileKey: string; name: string; size: string; }; } | { type: 'PRESET'; key: string; }; theme: 'WHITE' | 'CLIPBOARD' | 'BINDER' | 'PENCIL' | 'CLIPS' | 'RED' | 'BLUE' | 'GREEN' | 'YELLOW' | 'BLACK'; revision: string; }; type AppStatusAssigneeEntityType = 'USER' | 'GROUP' | 'ORGANIZATION' | 'FIELD_ENTITY' | 'CREATOR' | 'CUSTOM_FIELD'; type AppStatusAssigneeEntity = { entity: { type: AppStatusAssigneeEntityType; code: string | null; }; includeSubs: boolean; }; type AppStatusState = { name: string; index: string; assignee: { type: 'ONE' | 'ALL' | 'ANY'; entities: AppStatusAssigneeEntity[]; }; }; type AppStatusExecutableUserEntityType = 'USER' | 'GROUP' | 'ORGANIZATION' | 'FIELD_ENTITY'; type AppStatusAction = { name: string; from: string; to: string; filterCond: string; type: 'PRIMARY' | 'SECONDARY'; executableUser?: { entities: { entity: { type: AppStatusExecutableUserEntityType; code: string; }; includeSubs: boolean; }[]; }; }; type AppStatus = { enable: boolean; states: Record | null; actions: AppStatusAction[] | null; revision: string; }; namespace response { type App = { readonly app?: kintoneAPI.App; readonly fields?: FieldProperties; }; } /** * @deprecated Use `kintoneAPI.js.EventType` instead. */ type EventType = kintoneAPI.js.EventType; /** * @deprecated Use `kintoneAPI.js.Event` instead. */ type Event = kintoneAPI.js.Event; namespace js { type Event = { appId: number; recordId: number; record: T; error: string; url: string; type: EventType; changes?: { field: { type: string; value: string; }; row: any; }; records?: T[]; /** * 現在表示している一覧のID * app.record.index.show イベントでのみ取得できます */ viewId: number; /** * 現在表示している一覧の種類 * app.record.index.show イベントでのみ取得できます */ viewType?: 'list' | 'calendar' | 'custom'; /** * 現在表示している一覧の名前 * app.record.index.show イベントでのみ取得できます */ viewName?: string; /** * 一覧のレコードのオフセット * app.record.index.show イベントでのみ取得でき、viewTypeがCalendar以外の場合に取得できます */ offset?: number | null; /** * 一覧のレコードの表示件数 * app.record.index.show イベントでのみ取得でき、viewTypeがCalendar以外の場合に取得できます */ size?: number | null; /** * プロセス - 実行されたアクション * app.record.detail.process.proceed イベントで取得できます */ action?: { value: string; }; /** * プロセス - 現在のステータス * app.record.detail.process.proceed イベントで取得できます */ status?: { value: string; }; /** * プロセス - 次のステータス * app.record.detail.process.proceed イベントで取得できます */ nextStatus?: { value: string; }; }; type EventType = 'portal.show' | 'app.record.index.show' | 'app.record.index.edit.show' | 'app.record.index.edit.submit' | 'app.record.index.edit.submit.success' | 'app.record.index.delete.submit' | 'app.record.detail.show' | 'app.record.detail.delete.submit' | 'app.record.detail.process.proceed' | 'app.record.create.show' | 'app.record.create.change' | 'app.record.create.submit' | 'app.record.create.submit.success' | 'app.record.edit.show' | 'app.record.edit.change' | 'app.record.edit.submit' | 'app.record.edit.submit.success' | 'app.record.print.show' | 'mobile.app.record.index.show' | 'mobile.app.record.detail.show' | 'mobile.app.record.detail.delete.submit' | 'mobile.app.record.detail.process.proceed' | 'mobile.app.record.create.show' | 'mobile.app.record.create.change' | 'mobile.app.record.create.submit' | 'mobile.app.record.create.submit.success' | 'mobile.app.record.edit.show' | 'mobile.app.record.edit.change' | 'mobile.app.record.edit.submit' | 'mobile.app.record.edit.submit.success'; } namespace rest { type AppIDToRequest = string | number; type RecordID = string | number; type Revision = string | number; type IDToRequest = string | number; type Frame = Record; type Method = 'GET' | 'PUT' | 'POST' | 'DELETE'; type Lang = 'ja' | 'en' | 'zh' | 'user' | 'default'; type People = { code: string; name: string; }; type WithCommonRequestParams = T & { debug?: boolean; guestSpaceId?: string | number; }; type TypeOmmited> = { [P in keyof T]: Omit; }; type RecordToRequest = Partial>; type RecordGetResponse = { record: T; }; type RecordPostResponse = { id: string; revision: string; }; type RecordPutResponse = { revision: string; }; type RecordsGetResponse = { records: T[]; totalCount?: string | null; }; type RecordsPostResponse = { ids: string[]; revisions: string[]; }; type RecordsPutResponse = { records: { id: string; revision: string; }[]; }; type RecordsDeleteResponse = {}; type CursorCreateRequest = WithCommonRequestParams<{ app: AppIDToRequest; fields?: string[]; query?: string; size?: number | string; }>; type CursorCreateResponse = { id: string; totalCount: string; }; type CursorGetRequest = WithCommonRequestParams<{ id: string; }>; type CursorGetResponse = { records: T[]; next: boolean; }; type CommentsGetRequest = WithCommonRequestParams<{ app: AppIDToRequest; record: RecordID; order?: 'asc' | 'desc'; offset?: number; limit?: number; }>; type CommentsGetResponse = { comments: { id: string; text: string; createdAt: string; creator: People; mentions: People[]; }[]; older: boolean; newer: boolean; }; type CommentPostRequest = WithCommonRequestParams<{ app: AppIDToRequest; record: RecordID; comment: { text: string; mentions?: { code: string; type?: EntityType; }[]; }; }>; type CommentPostResponse = { id: number; }; type CommentDeleteRequest = WithCommonRequestParams<{ app: AppIDToRequest; record: RecordID; comment: string | number; }>; type CommentDeleteResponse = {}; type RecordAssigneesPutResponse = { revision: string; }; type ACLRight = { id: string; record: { viewable: boolean; editable: boolean; deletable: boolean; }; fields: Record; }; type RecordACLEvaluateGetResponse = { rights: ACLRight[]; }; type RecordStatusPutResponse = { revision: string; }; type RecordStatusesPutResponse = { records: { id: string; revision: string; }[]; }; namespace bulkRequest { } type BulkResponse = { results: (RecordsPutResponse | RecordPostResponse | RecordsPostResponse | RecordsPutResponse | RecordsDeleteResponse | RecordAssigneesPutResponse | RecordStatusPutResponse | RecordStatusesPutResponse)[]; }; type ChartType = 'BAR' | 'COLUMN' | 'PIE' | 'LINE' | 'PIVOT_TABLE' | 'TABLE' | 'AREA' | 'SPLINE' | 'SPLINE_AREA'; type ChartMode = 'NORMAL' | 'STACKED' | 'PERCENTAGE'; type ChartPeriod = 'YEAR' | 'QUARTER' | 'MONTH' | 'WEEK' | 'DAY' | 'HOUR' | 'MINUTE'; type ChartAggregationType = 'COUNT' | 'SUM' | 'AVERAGE' | 'MAX' | 'MIN'; type AppReportsGetResponse = { reports: Record; }; namespace space { type SpaceIdToRequest = string | number; type GetSpaceRequest = { id: string | number; }; type GetSpaceResponse = { /** スペースID */ id: string; /** スペース名 */ name: string; /** * スペースが作成されたときに初期作成されたスレッドのスレッド ID * * 1 つのスレッドのみ使用するスペースの場合はこのスレッドのみ存在します。 */ defaultThread: string; /** 公開/非公開の区分 */ isPrivate: boolean; creator: People; modifier: People; memberCount: string; coverType: string; /** スペースのカバー画像のキー文字列 */ coverKey: string; /** スペースのカバー画像の URL */ coverUrl: string; body: string; useMultiThread: boolean; isGuest: boolean; attachedApps: { threadId: string; appId: string; code: string; name: string; description: string; createdAt: string; creator: People; modifiedAt: string; modifier: People; fixedMember: boolean; showAnnouncement: boolean; showThreadList: boolean; showAppList: boolean; showMemberList: boolean; showRelatedLinkList: boolean; }[]; }; type GetSpaceMembersRequest = { id: IDToRequest; }; } } namespace cybozu { type CustomItemValue = { code: string; value: string; }; type CybozuUser = { id: number; code: string; ctime: string; mtime: string; valid: boolean; name: string; surName: string; givenName: string; surNameReading: string; givenNameReading: string; localName: string; localNameLocale: string; timezone: string; locale: string; description: string; phone: string; mobilePhone: string; extensionNumber: string; email: string; callto: string; url: string; employeeNumber: string; birthDate: string; joinDate: string; primaryOrganization: number; sortOrder: number; customItemValues: CustomItemValue[]; }; type GetUsersRequest = { ids?: string[]; codes?: string[]; size?: number; offset?: number; }; type GetUsersResponse = { users: CybozuUser[]; }; type GetUsedServicesRequest = { code: string[]; size?: number; offset?: number; }; type GetUsedServicesResponse = { users: { code: string; services: string[]; }; }; type UpdateUsedServicesRequest = { users: { code: string; services: string[]; }; }; type UpdateUsedServicesResponse = {}; } } type ErrorHandler = (error: any, props: { event: kintoneAPI.js.Event; }) => kintoneAPI.js.Event; type ConstructorProps = Partial<{ errorHandler: ErrorHandler; pluginId: string; logDisabled: boolean; logPrefix: string; }>; type CallbackOption = { pluginId?: string; guestSpaceId: string | null; }; declare class KintoneEventManager { #private; /** * 複数の処理を、各イベントに登録することができます */ constructor(props?: ConstructorProps); /** * **この関数は`kintone.events.on`の代替関数です. 引数に互換性があります.** * * デスクトップ版のイベントを指定することで自動的に対応するモバイル版のイベントが登録されます. * また、インスタンス作成時に指定したエラーハンドラが、コールバック関数のエラー発生時に実行されます * @param events * @param callback */ add: (events: kintoneAPI.js.EventType[], callback: (event: kintoneAPI.js.Event, options: CallbackOption) => kintoneAPI.js.Event | Promise>) => void; /** * Changeイベントを登録します * * ChangeイベントはPromiseオブジェクトを返却することができません * @param events * @param callback */ addChangeEvents: (events: string[], callback: (event: kintoneAPI.js.Event, options: CallbackOption) => kintoneAPI.js.Event) => void; addHeaderButton(params: { id: string; label: string; color?: 'default' | 'blue' | 'red' | 'yellow'; isButtonHidden?: (event: kintoneAPI.js.Event) => boolean | Promise; onClick: () => void | Promise; events: kintoneAPI.js.EventType[]; isTolerantToFailure?: boolean; }): void; private addButtonStyle; private initialize; private tarminate; set logDisabled(value: boolean); set logPrefix(value: string); /** JavaScript中にページを離れようとした場合にアラートを表示します */ private beforeunload; } /** * @deprecated 代わりに`KintoneEventListener`を使用してください */ declare const KintoneEventListener: typeof KintoneEventManager; /** * アプリにプラグインの設定情報を保存します * @param target プラグインの設定情報 * @param callback 保存成功後に実行する処理. 省略すると、アプリ設定のプラグインの一覧画面に遷移し、設定完了メッセージを表示します。指定すると、アプリ設定のプラグインの一覧画面には遷移しません。 * @deprecated 代わりに{@link storePluginConfig}を使用してください */ declare const storeStorage: (target: Record, callback?: () => void) => void; /** * プラグインがアプリ単位で保存している設定情報を返却します * * 設定情報の取得に失敗した場合は、nullを返却します * @param id プラグインID * @returns プラグインの設定情報 */ declare const restorePluginConfig: (id: string, options?: { fallback?: T; debug?: boolean; }) => T | null; /** * アプリにプラグインの設定情報を保存します * @param target プラグインの設定情報 * @param options.flatProperties 分割保存するプロパティ名の配列 * @param options.debug デバッグモードを有効にするかどうか * @returns 保存完了後に解決されるPromise。callbackを指定しない場合、アプリ設定のプラグインの一覧画面に遷移し、設定完了メッセージを表示します。 */ declare const storePluginConfig: = Record>(target: T, options?: { flatProperties?: (keyof T)[]; debug?: boolean; }) => Promise; type PrimitiveSetPluginProxyConfig = typeof kintone.plugin.app.setProxyConfig; type PrimitiveSetPluginProxyConfigArgs = Parameters; /** * `kintone.plugin.app.setProxyConfig`のラッパー関数 * * 引数の`callback`を省略して、Promiseを返すように変更したものです * * @example * ```ts * await setPluginProxyConfig('https://example.com', 'POST', { "Authorization": "Bearer XXXXXXXXX"}, { "provider": "kintone"}); * ``` */ declare function setPluginProxyConfig(url: PrimitiveSetPluginProxyConfigArgs[0], method: PrimitiveSetPluginProxyConfigArgs[1], headers: PrimitiveSetPluginProxyConfigArgs[2], data: PrimitiveSetPluginProxyConfigArgs[3]): Promise; declare class PluginLocalStorage { #private; constructor(key: string); private save; updateVersion: (currentVersion: string) => void; get hasNewVersion(): boolean; } /** デバッグオプションを付与するユーティリティ型 */ type WithDebug = T & { debug?: boolean; }; /** ゲストスペースIDオプションを付与するユーティリティ型 */ type WithGuestSpaceId = T & { guestSpaceId?: number | string; }; /** デバッグ・ゲストスペースIDの共通リクエストパラメータを付与するユーティリティ型 */ type WithCommonRequestParams = WithDebug>; /** * 指定したIDのアプリ情報を1件取得します。 * * @param params.id - 取得対象のアプリID * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns アプリ情報オブジェクト * * @example * ```ts * const app = await getApp({ id: 1 }); * console.log(app.name); // アプリ名 * ``` */ declare const getApp: (params: WithCommonRequestParams<{ id: kintoneAPI.IDToRequest; }>) => Promise; /** * kintone環境内の全アプリ情報を再帰的に取得します。 * * APIの取得件数上限(100件)を超える場合も、全件自動で取得します。 * * @param params.offset - 取得開始位置(デフォルト: `0`) * @param params._apps - 内部用の蓄積配列(外部からの指定不要) * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns 全アプリ情報の配列 * * @example * ```ts * const apps = await getAllApps(); * console.log(`アプリ数: ${apps.length}`); * ``` */ declare const getAllApps: (params?: WithCommonRequestParams<{ offset?: number; _apps?: kintoneAPI.App[]; }>) => Promise; /** * 指定アプリの一覧(ビュー)情報を取得します。 * * @param params.app - アプリID * @param params.lang - 取得する言語(デフォルト: `'default'`) * @param params.preview - プレビュー環境のビューを取得する場合は `true` * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns ビュー情報のオブジェクトとリビジョン番号 * * @example * ```ts * const { views, revision } = await getViews({ app: 1 }); * Object.keys(views).forEach((viewName) => { * console.log(viewName, views[viewName]); * }); * ``` */ declare const getViews: (params: WithCommonRequestParams<{ app: kintoneAPI.IDToRequest; lang?: kintoneAPI.rest.Lang; preview?: boolean; }>) => Promise<{ views: Record; revision: string; }>; /** * 指定アプリの一覧(ビュー)設定を更新します。 * * …※ プレビュー環境に対して更新されます。運用環境への反映には別途デプロイが必要です。 * * @param params.app - アプリID * @param params.views - 更新するビュー情報のオブジェクト * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns 更新後のリビジョン情報 * * @example * ```ts * await updateViews({ * app: 1, * views: { * '一覧': { type: 'LIST', name: '一覧', fields: ['フィールドA'], index: 0 }, * }, * }); * ``` */ declare const updateViews: (params: WithCommonRequestParams<{ app: kintoneAPI.IDToRequest; views: Record; }>) => Promise; /** * 指定アプリのフォームフィールド情報を取得します。 * * @param params.app - アプリID * @param params.preview - プレビュー環境のフィールドを取得する場合は `true` * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns フィールドプロパティとリビジョン番号 * * @example * ```ts * const { properties, revision } = await getFormFields({ app: 1 }); * Object.entries(properties).forEach(([code, field]) => { * console.log(`${code}: ${field.type}`); * }); * ``` */ declare const getFormFields: (params: WithCommonRequestParams<{ app: kintoneAPI.IDToRequest; preview?: boolean; }>) => Promise<{ properties: kintoneAPI.FieldProperties; revision: string; }>; /** * 指定アプリのフォームレイアウト情報を取得します。 * * @param params.app - アプリID * @param params.preview - プレビュー環境のレイアウトを取得する場合は `true` * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns レイアウト情報とリビジョン番号 * * @example * ```ts * const { layout } = await getFormLayout({ app: 1 }); * layout.forEach((row) => console.log(row.type)); * ``` */ declare const getFormLayout: (params: WithCommonRequestParams<{ app: kintoneAPI.IDToRequest; preview?: boolean; }>) => Promise<{ layout: kintoneAPI.Layout; revision: string; }>; /** * 指定アプリのアプリ設定(アイコン、テーマなど)を取得します。 * * @param params.app - アプリID * @param params.preview - プレビュー環境の設定を取得する場合は `true` * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns アプリ設定オブジェクト * * @example * ```ts * const settings = await getAppSettings({ app: 1 }); * console.log(settings.name, settings.icon); * ``` */ declare const getAppSettings: (params: WithCommonRequestParams<{ app: kintoneAPI.IDToRequest; preview?: boolean; }>) => Promise; /** * 指定アプリのプロセス管理設定を取得します。 * * @param params.app - アプリID * @param params.lang - 取得する言語(デフォルト: `'default'`) * @param params.preview - プレビュー環境の設定を取得する場合は `true` * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns プロセス管理設定オブジェクト(有効フラグ、ステータス一覧、アクション一覧) * * @example * ```ts * const status = await getAppStatus({ app: 1 }); * if (status.enable) { * console.log(Object.keys(status.states ?? {})); // ステータス名一覧 * status.actions?.forEach((action) => console.log(action.name)); * } * ``` */ declare const getAppStatus: (params: WithCommonRequestParams<{ app: kintoneAPI.IDToRequest; lang?: kintoneAPI.rest.Lang; preview?: boolean; }>) => Promise; declare const API_LIMIT_POST = 100; type BulkRequestProgressParams = { total: number; done: number; }; type WithBulkRequestCallback = T & { onProgress?: (params: BulkRequestProgressParams) => void; }; /** * バックドア(プロキシ経由)でkintone REST APIを呼び出します。 * * APIトークン認証を使い、`kintone.proxy()` を通じてリクエストを送信します。 * アプリAのカスタマイズからアプリBのレコードを操作するようなケースで使用します。 * * @param params.apiToken - APIトークン * @param params.method - HTTPメソッド * @param params.path - APIエンドポイントのパス * @param params.body - リクエストボディ(省略可) * @returns APIレスポンス(JSONパース済み) * @throws レスポンスのステータスコードが200でない場合 * * @example * ```ts * const record = await backdoor({ * apiToken: 'YOUR_API_TOKEN', * method: 'GET', * path: 'record', * body: { app: 1, id: 100 }, * }); * ``` */ declare const backdoor: (params: { apiToken: string; method: kintoneAPI.rest.Method; path: string; body?: any; }) => Promise; type RecordGetRequest = { app: kintoneAPI.IDToRequest; id: kintoneAPI.IDToRequest; }; type GetRecordParams = WithCommonRequestParams; /** * 指定したIDのレコードを1件取得します。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.id - レコードID * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns レコードデータ * * @example * ```ts * const record = await getRecord({ app: 1, id: 100 }); * console.log(record['フィールドコード'].value); * ``` */ declare const getRecord: (params: GetRecordParams) => Promise; /** * バックドア(APIトークン認証)を使用してレコードを1件取得します。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.id - レコードID * @param params.apiToken - APIトークン * @returns レコードデータ * * @example * ```ts * const record = await backdoorGetRecord({ * app: 1, * id: 100, * apiToken: 'YOUR_API_TOKEN', * }); * ``` */ declare const backdoorGetRecord: (params: RecordGetRequest & { apiToken: string; }) => Promise; /** * 複数のレコードを一度に取得します(最大500件)。 * * クエリでフィルタリングやソートが可能です。500件を超える場合は `getAllRecords` を使用してください。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.query - クエリ文字列(省略可) * @param params.fields - 取得するフィールドコードの配列(省略可) * @param params.totalCount - トータルカウントを取得する場合は `true` * @returns レコード配列とトータルカウント * * @example * ```ts * const { records, totalCount } = await getRecords({ * app: 1, * query: 'ステータス in ("未処理")', * fields: ['$id', 'タイトル'], * totalCount: true, * }); * ``` */ declare const getRecords: (params: GetRecordsParams) => Promise>; type UpdateKey = { field: keyof T; value: string | number; }; type PrimaryKeyToUpdate = { id: kintoneAPI.IDToRequest; } | { updateKey: UpdateKey; }; type RecordPutRequest = { app: kintoneAPI.IDToRequest; record: kintoneAPI.rest.RecordToRequest; revision?: kintoneAPI.rest.Revision; } & PrimaryKeyToUpdate; type UpdateRecordParams = WithCommonRequestParams>; /** * レコードを1件更新します。 * * `id` または `updateKey`(重複禁止フィールド)で更新対象を指定できます。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.id - 更新対象のレコードID(`id` または `updateKey` のどちらか一方を指定) * @param params.updateKey - 重複禁止フィールドによる更新キー * @param params.record - 更新内容 * @param params.revision - リビジョン番号(楽観的排他制御) * @returns 更新後のリビジョン番号 * * @example * ```ts * await updateRecord({ * app: 1, * id: 100, * record: { タイトル: { value: '更新済み' } }, * }); * ``` */ declare const updateRecord: (params: UpdateRecordParams) => Promise; type RecordPostRequest = { app: kintoneAPI.IDToRequest; record: kintoneAPI.rest.RecordToRequest; }; type AddRecordParams = WithCommonRequestParams>; /** * レコードを1件追加します。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.record - 追加するレコードデータ * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns 追加されたレコードのIDとリビジョン * * @example * ```ts * const { id } = await addRecord({ * app: 1, * record: { タイトル: { value: '新規レコード' } }, * }); * console.log(`作成されたレコードID: ${id}`); * ``` */ declare const addRecord: (params: AddRecordParams) => Promise; /** * 複数レコードを一度に追加します(最大100件)。 * * 100件を超える場合は `addAllRecords` を使用してください。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.records - 追加するレコードの配列 * @returns 追加されたレコードのID配列とリビジョン配列 * * @example * ```ts * const { ids } = await addRecords({ * app: 1, * records: [ * { タイトル: { value: 'レコード1' } }, * { タイトル: { value: 'レコード2' } }, * ], * }); * ``` */ declare const addRecords: (params: WithCommonRequestParams>) => Promise; type RecordUpsertRequest = { app: kintoneAPI.IDToRequest; record: kintoneAPI.rest.RecordToRequest; updateKey: UpdateKey; }; type UpsertRecordParams = WithCommonRequestParams>; /** * レコードのアップサート(存在すれば更新、なければ追加)を行います。 * * `updateKey` で指定した重複禁止フィールドの値に基づき、既存レコードを検索して分岐します。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.record - 追加または更新するレコードデータ * @param params.updateKey - 重複禁止フィールドによるキー * @returns 追加または更新されたレコードのIDとリビジョン * * @example * ```ts * const result = await upsertRecord({ * app: 1, * updateKey: { field: '社員番号', value: 'EMP001' }, * record: { 氏名: { value: '山田太郎' } }, * }); * ``` */ declare const upsertRecord: (params: UpsertRecordParams) => Promise; type RecordsPutRequest = { app: kintoneAPI.IDToRequest; records: ({ record: kintoneAPI.rest.RecordToRequest; revision?: kintoneAPI.rest.Revision; } & ({ id: kintoneAPI.IDToRequest; } | { updateKey: { field: keyof T; value: string | number; }; }))[]; }; type UpdateAllRecordsParams = WithBulkRequestCallback>>; /** * 大量のレコードを一括更新します。 * * 内部で `bulkRequest` を使用し、API制限ごとに自動分割してリクエストを送信します。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.records - 更新するレコードの配列(`id` または `updateKey` と `record` を含む) * @param params.onProgress - 進捗コールバック(`{ total, done }` を受け取る) * @returns 更新されたレコードのIDとリビジョンの配列 * * @example * ```ts * await updateAllRecords({ * app: 1, * records: [ * { id: 1, record: { ステータス: { value: '完了' } } }, * { id: 2, record: { ステータス: { value: '完了' } } }, * ], * onProgress: ({ total, done }) => console.log(`${done}/${total}`), * }); * ``` */ declare const updateAllRecords: (params: UpdateAllRecordsParams) => Promise; type RecordsPostRequest = { app: kintoneAPI.IDToRequest; records: kintoneAPI.rest.RecordToRequest[]; limit?: number; }; type AddAllRecordsParams = WithBulkRequestCallback>>; /** * 大量のレコードを一括追加します。 * * 内部で `bulkRequest` を使用し、API制限ごとに自動分割してリクエストを送信します。 * 空配列を渡した場合は何もせず空の結果を返します。 * * @typeParam T - レコードの型 * @param params.app - アプリID * @param params.records - 追加するレコードの配列 * @param params.limit - 1リクエストあたりのレコード数上限(デフォルト: 100) * @param params.onProgress - 進捗コールバック * @returns 追加されたレコードのID配列とリビジョン配列 * * @example * ```ts * const { ids } = await addAllRecords({ * app: 1, * records: Array.from({ length: 500 }, (_, i) => ({ * タイトル: { value: `レコード${i + 1}` }, * })), * }); * console.log(`${ids.length}件追加しました`); * ``` */ declare const addAllRecords: (params: AddAllRecordsParams) => Promise; type RecordsDeleteRequest = { app: kintoneAPI.IDToRequest; ids: number[]; revisions?: number[]; }; type DeleteAllRecordsParams = WithBulkRequestCallback>; /** * 大量のレコードを一括削除します。 * * 内部で `bulkRequest` を使用し、API制限ごとに自動分割して削除リクエストを送信します。 * * @param params.app - アプリID * @param params.ids - 削除対象のレコードIDの配列 * @param params.revisions - リビジョン番号の配列(楽観的排他制御、省略可) * @param params.onProgress - 進捗コールバック * @returns バルクリクエストの結果 * * @example * ```ts * await deleteAllRecords({ * app: 1, * ids: [1, 2, 3, 4, 5], * }); * ``` */ declare const deleteAllRecords: (params: DeleteAllRecordsParams) => Promise<{ results: kintoneAPI.rest.RecordsDeleteResponse[]; }>; /** * クエリに一致する全レコードを削除します。 * * 指定したクエリで全レコードを取得した後、そのIDを使って一括削除を実行します。 * * @param params.app - アプリID * @param params.query - 削除対象をフィルタリングするクエリ文字列 * @param params.onProgress - 進捗コールバック * @returns バルクリクエストの結果 * * @example * ```ts * await deleteAllRecordsByQuery({ * app: 1, * query: 'ステータス in ("削除済み")', * }); * ``` */ declare const deleteAllRecordsByQuery: (params: WithBulkRequestCallback>) => Promise<{ results: kintoneAPI.rest.RecordsDeleteResponse[]; }>; type RecordsGetRequest = { app: kintoneAPI.IDToRequest; query?: string; fields?: string[]; totalCount?: boolean | 'true' | 'false'; }; type GetRecordsParams = WithCommonRequestParams; type GetAllRecordsParams = WithCommonRequestParams; /** * 対象アプリの指定されたクエリに一致するレコードを全件取得します * * クエリを解析し、order byが含まれている場合はカーソルAPIを使ってレコードを取得します * * order byが含まれていない場合は、レコードIDを使ってレコードを取得します * * @returns 取得したレコードの配列 */ declare const getAllRecords: = kintoneAPI.RecordData>(params: GetAllRecordsParams & { onStep?: OnStep; }) => Promise; type WithId = T & { $id: kintoneAPI.field.ID; }; type OnStep = (params: { /** * その時点で取得が完了した全てのレコード */ records: T[]; /** * その時点で取得が完了したレコードのうち、新たに取得されたレコード */ incremental: T[]; }) => void; /** * 対象アプリの指定されたクエリに一致するレコードを、レコードIDをもとに全件取得します * * @param params app: 対象アプリのID, query: 取得するレコードのクエリ, fields: 取得するフィールドコードの配列, onStep: 段階的にレコードを取得する過程で実行される関数 * @returns 取得したレコードの配列 */ declare const getAllRecordsWithId: >(params: WithCommonRequestParams<{ app: kintoneAPI.rest.AppIDToRequest; fields?: string[]; onStep?: OnStep; condition?: string; }>) => Promise[]>; type OnTotalGet = (params: { total: number; }) => void; /** * 対象アプリの指定されたクエリに一致するレコードを、カーソルAPIを使って全件取得します * * @param params app: 対象アプリのID, query: 取得するレコードのクエリ, fields: 取得するフィールドコードの配列, onTotalGet: 取得するレコードの総数を取得した際に実行される関数, onStep: 段階的にレコードを取得する過程で実行される関数 * @returns 取得したレコードの配列 */ declare const getAllRecordsWithCursor: (params: WithCommonRequestParams<{ app: kintoneAPI.rest.AppIDToRequest; fields?: string[]; query?: string; onTotalGet?: OnTotalGet; onStep?: OnStep; }>) => Promise; type RecordAssigneesPutRequest = { app: kintoneAPI.IDToRequest; id: kintoneAPI.IDToRequest; assignees: string[]; revision?: kintoneAPI.IDToRequest; }; type UpdateRecordAssigneesParams = WithCommonRequestParams; /** * レコードの作業者(アサイニー)を更新します。 * * プロセス管理が有効なアプリで、レコードの作業者を変更する際に使用します。 * * @param params.app - アプリID * @param params.id - レコードID * @param params.assignees - 作業者のログイン名の配列 * @param params.revision - リビジョン番号(省略可) * @returns 更新後のリビジョン情報 * * @example * ```ts * await updateRecordAssignees({ * app: 1, * id: 100, * assignees: ['user1', 'user2'], * }); * ``` */ declare const updateRecordAssignees: (params: UpdateRecordAssigneesParams) => Promise; type RecordStatusToPut = { action: string; assignee?: string; id: kintoneAPI.IDToRequest; revision?: kintoneAPI.IDToRequest; }; type RecordStatusPutRequest = { app: kintoneAPI.IDToRequest; } & RecordStatusToPut; type UpdateRecordStatusParams = WithCommonRequestParams; /** * レコードのプロセスステータスを1件更新します。 * * @param params.app - アプリID * @param params.action - 実行するアクション名 * @param params.assignee - 次の作業者のログイン名(省略可) * @param params.id - レコードID * @param params.revision - リビジョン番号(省略可) * @returns 更新後のリビジョン情報 * * @example * ```ts * await updateRecordStatus({ * app: 1, * id: 100, * action: '承認する', * assignee: 'manager1', * }); * ``` */ declare const updateRecordStatus: (params: UpdateRecordStatusParams) => Promise; type RecordStatusesPutRequest = { app: kintoneAPI.IDToRequest; records: RecordStatusToPut[]; }; type UpdateAllRecordStatusesParams = WithBulkRequestCallback>; /** * 複数レコードのプロセスステータスを一括更新します。 * * 内部で `bulkRequest` を使用し、API制限ごとに自動分割してリクエストを送信します。 * * @param params.app - アプリID * @param params.records - 更新対象のレコード配列(`action`, `id` 等を含む) * @param params.onProgress - 進捗コールバック * @returns 更新されたレコードの配列 * * @example * ```ts * await updateAllRecordStatuses({ * app: 1, * records: [ * { id: 1, action: '承認する' }, * { id: 2, action: '承認する' }, * ], * }); * ``` */ declare const updateAllRecordStatuses: (params: UpdateAllRecordStatusesParams) => Promise; type RecordACLEvaluateGetRequest = { app: kintoneAPI.IDToRequest; ids: kintoneAPI.IDToRequest[]; }; type GetRecordACLEvaluateParams = WithCommonRequestParams; /** * レコードのアクセス権を評価します。 * * 指定したレコードIDに対して、現在のユーザーのアクセス権情報を取得します。 * * @param params.app - アプリID * @param params.ids - 評価対象のレコードIDの配列 * @returns 各レコードのアクセス権評価結果 * * @example * ```ts * const result = await getRecordACLEvaluate({ * app: 1, * ids: [1, 2, 3], * }); * ``` */ declare const getRecordACLEvaluate: (params: GetRecordACLEvaluateParams) => Promise; type OneOfBulkRequest = { method: kintoneAPI.rest.Method; api: string; payload: RecordPostRequest | RecordsPostRequest | RecordPutRequest | RecordsPutRequest | RecordsDeleteRequest | RecordAssigneesPutRequest | RecordStatusPutRequest | RecordStatusesPutRequest; }; type BulkRequestParams = WithCommonRequestParams<{ requests: ({ type: 'updateRecord'; params: RecordPutRequest; } | { type: 'addRecord'; params: RecordPostRequest; } | { type: 'updateAllRecords'; params: RecordsPutRequest; } | { type: 'addAllRecords'; params: RecordsPostRequest; } | { type: 'deleteRecords'; params: RecordsDeleteRequest; } | { type: 'updateRecordAssignees'; params: RecordAssigneesPutRequest; } | { type: 'updateRecordStatus'; params: RecordStatusPutRequest; } | { type: 'updateRecordStatuses'; params: RecordStatusesPutRequest; })[]; onProgress?: (params: BulkRequestProgressParams) => void; limit?: number; }>; /** * 複数のAPIリクエストを一括で実行します(バルクリクエスト)。 * * API制限ごとにリクエストを自動分割し、チャンクごとに順次実行します。 * レコードの追加・更新・削除・ステータス更新などの操作を混在させることができます。 * * @typeParam T - レコードの型 * @param params.requests - 実行するリクエストの配列(type と params を持つ) * @param params.onProgress - 進捗コールバック * @param params.limit - 1回のバルクリクエストあたりのリクエスト数上限(デフォルト: 20) * @returns 全リクエストの実行結果 * * @example * ```ts * const result = await bulkRequest({ * requests: [ * { type: 'addAllRecords', params: { app: 1, records: [...] } }, * { type: 'deleteRecords', params: { app: 2, ids: [1, 2, 3] } }, * ], * }); * ``` */ declare const bulkRequest: (params: BulkRequestParams) => Promise; /** * 🧪 実験的な実装 * * APIクライアントをClassではなく、カリー化した関数で実装することで、ユーザーがAPIクライアントを拡張しやすくする。 * * アプリ情報を事前に指定し、レコード操作時にはアプリ情報の指定を省略できます。 * * @typeParam T - レコードの型 * @param props.app - アプリID * @param props.guestsSpaceId - ゲストスペースID(省略可) * @param props.debug - デバッグログを出力する場合は `true` * @returns レコード操作用のメソッドを持つオブジェクト * * @example * ```ts * const client = useApi({ app: 1 }); * const result = await client.records.$post({ * records: [{ タイトル: { value: 'テスト' } }], * }); * console.log(result.ids); * ``` */ declare const useApi: (props: { app: kintoneAPI.IDToRequest; guestsSpaceId?: string; debug?: boolean; }) => { records: { $post: (params: Omit, "app" | "guestSpaceId" | "debug">) => Promise; }; }; /** * kintoneへファイルをアップロードします。 * * `FormData` を使用し、`fetch` APIでファイルをアップロードします。 * アップロード成功後、返された `fileKey` をレコードの添付ファイルフィールドの値として使用できます。 * * @param params.file.name - ファイル名 * @param params.file.data - ファイルデータ(Blob) * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns アップロードされたファイルの `fileKey` * * @example * ```ts * const blob = new Blob(['テスト内容'], { type: 'text/plain' }); * const { fileKey } = await uploadFile({ * file: { name: 'test.txt', data: blob }, * }); * * // レコード更新時に使用 * await updateRecord({ * app: 1, * id: 100, * record: { 添付ファイル: { value: [{ fileKey }] } }, * }); * ``` */ declare const uploadFile: (params: WithCommonRequestParams<{ file: { name: string; data: Blob; }; }>) => Promise<{ fileKey: string; }>; /** * kintoneからファイルをダウンロードします。 * * `fileKey` を指定して、添付ファイルをBlobとして取得します。 * * @param params.fileKey - ダウンロード対象のファイルキー * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns ファイルデータ(Blob) * * @example * ```ts * const blob = await downloadFile({ fileKey: 'xxxx-xxxx-xxxx' }); * const url = URL.createObjectURL(blob); * ``` */ declare const downloadFile: (params: WithCommonRequestParams<{ fileKey: string; }>) => Promise; /** * 指定レコードのコメントを全件取得します。 * * APIの取得件数上限(10件)を超える場合も、全件自動で再帰的に取得します。 * * @param props.app - アプリID * @param props.record - レコードID * @param props.order - ソート順(`'asc'` | `'desc'`) * @returns コメントの配列 * * @example * ```ts * const comments = await getRecordComments({ * app: 1, * record: 100, * order: 'desc', * }); * comments.forEach((c) => console.log(c.text)); * ``` */ declare const getRecordComments: (props: kintoneAPI.rest.CommentsGetRequest) => Promise<{ id: string; text: string; createdAt: string; creator: kintoneAPI.rest.People; mentions: kintoneAPI.rest.People[]; }[]>; /** * レコードにコメントを1件追加します。 * * @param params.app - アプリID * @param params.record - レコードID * @param params.comment - コメント内容(`text`, `mentions` 等) * @returns 追加されたコメントのID * * @example * ```ts * const { id } = await addRecordComment({ * app: 1, * record: 100, * comment: { text: '確認しました' }, * }); * ``` */ declare const addRecordComment: (params: kintoneAPI.rest.CommentPostRequest) => Promise; /** * レコードのコメントを1件削除します。 * * @param params.app - アプリID * @param params.record - レコードID * @param params.comment - 削除するコメントのID * @returns 空オブジェクト * * @example * ```ts * await deleteRecordComment({ * app: 1, * record: 100, * comment: 5, * }); * ``` */ declare const deleteRecordComment: (params: kintoneAPI.rest.CommentDeleteRequest) => Promise; type AppReportsGetRequest = { app: kintoneAPI.IDToRequest; lang?: kintoneAPI.rest.Lang; }; type GetAppChartsParams = WithCommonRequestParams; /** * 指定アプリのグラフ(レポート)設定を取得します。 * * @param params.app - アプリID * @param params.lang - 取得する言語(省略可) * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns グラフ設定情報 * * @example * ```ts * const { reports } = await getAppCharts({ app: 1 }); * Object.keys(reports).forEach((name) => { * console.log(name, reports[name].chartType); * }); * ``` */ declare const getAppCharts: (params: GetAppChartsParams) => Promise; /** * 指定したスペースの情報を取得します。 * * @param params.id - スペースID * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns スペース情報 * * @example * ```ts * const space = await getSpace({ id: 1 }); * console.log(space.name); * ``` */ declare const getSpace: (params: WithCommonRequestParams) => Promise; type CreateSpaceParams = WithCommonRequestParams<{ id: kintoneAPI.IDToRequest; name: string; members: { entity: { type: kintoneAPI.EntityType; code: string; }; isAdmin: boolean; includeSubs?: boolean; }[]; isPrivate?: boolean; isGuest?: boolean; fixedMember?: boolean; }>; type CreateSpaceResponse = { id: string; }; /** * テンプレートからスペースを新規作成します。 * * @param params.id - スペーステンプレートID * @param params.name - スペース名 * @param params.members - メンバー情報の配列 * @param params.isPrivate - 非公開スペースにする場合は `true` * @param params.isGuest - ゲストスペースにする場合は `true` * @param params.fixedMember - メンバーを固定する場合は `true` * @returns 作成されたスペースのID * * @example * ```ts * const { id } = await createSpace({ * id: 10, // テンプレートID * name: '新規プロジェクト', * members: [ * { entity: { type: 'USER', code: 'user1' }, isAdmin: true }, * ], * }); * ``` */ declare const createSpace: (params: CreateSpaceParams) => Promise; type DeleteSpaceParams = WithCommonRequestParams<{ /** 更新するスレッドのスレッドID */ id: kintoneAPI.rest.space.SpaceIdToRequest; }>; type DeleteSpaceResponse = {}; /** * スペースを削除します。 * * @param params.id - 削除対象のスペースID * @param params.guestSpaceId - ゲストスペースID(省略可) * @param params.debug - デバッグログを出力する場合は `true` * @returns 空オブジェクト * * @example * ```ts * await deleteSpace({ id: 1 }); * ``` */ declare const deleteSpace: (params: DeleteSpaceParams) => Promise; type UpdateThreadParams = WithCommonRequestParams<{ /** 更新するスレッドのスレッドID */ id: kintoneAPI.IDToRequest; /** * スレッド名 * * 1文字から128文字まで指定可能。省略した場合は、スレッド名は更新されません。 * * シングルスレッドスペースのスレッドはスレッド名が存在しないため更新できません。 */ name?: string; /** * スレッドの本文 * * 65535文字まで指定可能。省略した場合は、本文は更新されません。 * * 許可されていない属性やタグは自動的に削除されます。 * * アプリ貼り付け、ファイル添付、絵文字は HTML で指定します。 * * 宛先を HTML 内で指定しても、その宛先には通知されません。 */ body?: string; }>; type UpdateThreadResponse = {}; /** * スペース内のスレッド情報を更新します。 * * スレッド名や本文を更新できます。シングルスレッドのスペースではスレッド名の更新はできません。 * * @param params.id - スレッドID * @param params.name - スレッド名(1~128文字、省略時は更新なし) * @param params.body - スレッドの本文(HTML対応、65535文字まで、省略時は更新なし) * @returns 空オブジェクト * * @example * ```ts * await updateThread({ * id: 5, * name: '更新後のスレッド名', * body: '重要なお知らせ', * }); * ``` */ declare const updateThread: (params: UpdateThreadParams) => Promise; /** * APIから取得したフィールド情報から、指定した関数の条件に当てはまるフィールドのみを返却します * * @param properties APIから取得したフィールド情報 * @param callback 絞り込み条件 * @returns 条件に当てはまるフィールド */ declare const filterFieldProperties: (properties: kintoneAPI.FieldProperties, callback: (field: kintoneAPI.FieldProperty) => boolean) => kintoneAPI.FieldProperties; /** * REST APIでアクセスする先のアプリがゲストスペースに存在するものかどうかのつかない時、 * * 一度スペースIDを未指定でアクセスし、エラーが返ってきたらスペースIDを指定して再度アクセスする関数です。 */ declare const withSpaceIdFallback: any>(params: { spaceId?: string; func: T; funcParams: Parameters[0]; }) => Promise>; /** * REST APIでアクセスする先のアプリがゲストスペースに存在するかどうかを判定します。 * * ゲストスペースIDなしでアクセスし、`GAIA_IL23` エラーが返るかどうかで判定します。 * * @param appId - 判定対象のアプリID * @returns ゲストスペースのアプリであれば `true` * * @example * ```ts * const guest = await isGuestSpace('123'); * if (guest) { * console.log('ゲストスペースのアプリです'); * } * ``` */ declare const isGuestSpace: (appId: string) => Promise; type Operator = '=' | '!=' | '>' | '<' | '>=' | '<=' | 'in' | 'not in' | 'like' | 'not like'; type OrderBy = 'asc' | 'desc'; /** * ソート条件を組み立てます. * * ### なぜこの関数が必要? * * kintoneでフィールドコードが変更されることを想定してコードを記述する場合、フィールドコードのチェックと、ソート条件の組み立てを1つずつ定義する必要があります. * * この関数を使用することで、フィールドコードのチェックと、ソート条件の組み立てを同時に行うことができます. */ declare const useSorting: (field: keyof T, orderBy: OrderBy) => string; type QueryCondition = { field: keyof T; operator: Operator; value: string; truth?: 'and' | 'or'; }; /** * APIを使用する際のクエリーを組み立てます. * * ### なぜこの関数が必要? * * kintoneでフィールドコードが変更されることを想定してコードを記述する場合、クエリに使用するフィールドコードを1つずつ定義する必要があります。 * * この関数を使用することで、フィールドコードのチェックと、クエリの組み立てを同時に行うことができます。 */ declare const useQuery: (conditions: QueryCondition[], options?: { debug?: boolean; sort?: { field: keyof T; orderBy: OrderBy; }; }) => string; type KintoneConfig = { baseUrl?: { dev: string; prod: string; }; apps: { dev: number; prod: number; name: string; }[]; kvs?: Record; }; type Locales = { /** 日本語 */ ja: string; /** 英語 */ en: string; /** 簡体字中国語 */ zh: string; }; type Resources = { /** * プラグインのJavaScriptファイル * * URLの配列 */ js: string[]; /** * プラグインのCSSファイル * * URLの配列 */ css: string[]; }; type PluginManifest = { type: 'APP'; manifest_version: 1; version: number | string; /** * プラグインの名前 * * インストール時、プラグイン一覧画面で表示されます */ name: Locales; /** * プラグインの説明 * * インストール時、プラグイン一覧画面で表示されます */ description?: Locales; icon: string; homepage_url?: Partial; desktop?: Partial; mobile?: Partial; config?: Partial & { /** ファイルの種類 (js/css/html) をキーとする設定画面用カスタマイズファイルと設定情報 */ html?: string; /** * 設定画面で設定必須とするパラメータの配列 * * ASCIIで1文字以上64文字以下 */ required_params?: string[]; }; }; /** * 公開しているプラグインテンプレートで使用する設定ファイル * * @see {@link https://github.com/local-bias/kintone-plugin-template | kintone-plugin-template} */ type PluginConfig = { id: string; version?: 1; manifest: { base: PluginManifest; dev?: Partial; prod?: Partial; standalone?: Partial; }; pluginReleasePageUrl?: string; inquiriesPageUrl?: string; promotionPageUrl?: string; bannerPageUrl?: string; config_params?: Record; }; /** kintone.fieldTypes以下のプロパティをすべて参照する */ type SavedFields = kintone.fieldTypes.Calc | kintone.fieldTypes.CheckBox | kintone.fieldTypes.CreatedTime | kintone.fieldTypes.Creator | kintone.fieldTypes.Date | kintone.fieldTypes.DateTime | kintone.fieldTypes.DropDown | kintone.fieldTypes.File | kintone.fieldTypes.GroupSelect | kintone.fieldTypes.Id | kintone.fieldTypes.Link | kintone.fieldTypes.Modifier | kintone.fieldTypes.MultiLineText | kintone.fieldTypes.MultiSelect | kintone.fieldTypes.Number | kintone.fieldTypes.OrganizationSelect | kintone.fieldTypes.RadioButton | kintone.fieldTypes.RecordNumber | kintone.fieldTypes.Revision | kintone.fieldTypes.RichText | kintone.fieldTypes.SingleLineText | kintone.fieldTypes.Time | kintone.fieldTypes.UpdatedTime | kintone.fieldTypes.UserSelect; /** * kintone の数値フィールドの値を指定された形式の文字列として取得します。 * * @param params - 関数のパラメータオブジェクト * @param params.field - 数値フィールドの値を含むオブジェクト * @param params.property - フィールドのプロパティ設定(表示スケール、桁区切り、単位など) * @param params.locales - ロケール情報(オプション、デフォルトは 'ja') * @returns フォーマットされた数値の文字列 * * @example * ```typescript * const params = { * field: { value: "1234.56" }, * property: { * displayScale: "2", * digit: true, * unit: "$", * unitPosition: "BEFORE" * }, * locales: 'en-US', * }; * const result = getNumberFieldValueAsString(params); * // result: "$1,234.56" * ``` */ declare const getNumberFieldValueAsString: (params: { field: kintoneAPI.field.Number; property: kintoneAPI.property.Number; locales?: Intl.LocalesArgument; }) => string; /** * 各フィールドタイプの値を文字列として返却します * * 配列で取得されるような値は区切り文字で連結されます * @param field * @param options * @returns */ declare const getFieldValueAsString: (field: kintoneAPI.Field | SavedFields, options?: { separator?: string; ignoresCalculationError?: boolean; }) => string; /** * 各フィールドのタイプに応じて、ソートを行います * * @param aField ソート対象のフィールド * @param bField ソート対象のフィールド * @returns aFieldがbFieldより小さい場合は負の整数、aFieldがbFieldより大きい場合は正の整数、等しい場合は0 */ declare const sortField: (aField: T, bField: T) => number; /** * 計算フィールドの値と設定情報を基に、画面表示用の値を返却します */ declare const getCalcFieldValueAsString: (params: { field: kintoneAPI.field.Calc; property: kintoneAPI.property.Calc; }) => string; /** * フィールドのタイプに応じて、空の値を返却します * @param field クリア対象のフィールド * @returns クリア後のフィールドの値 */ declare const getEmptyValue: (params: { type: kintoneAPI.Field["type"]; } | { field: kintoneAPI.Field; }) => kintoneAPI.Field["value"]; declare const getDefaultValue: (property: kintoneAPI.FieldProperty) => string | (never[] | { code: string; name: string; })[] | null | undefined; declare const compareField: (field1: kintoneAPI.Field, field2: kintoneAPI.Field, options?: { ignoresType?: boolean; }) => boolean; /** * デスクトップ版のイベントタイプを基に、モバイル版を追加し返却します * @param events デスクトップのイベントタイプ * @returns モバイルを含むイベントタイプ */ declare const withMobileEvents: (events: string[]) => string[]; /** * 現在実行されている環境がゲストスペースかどうかを判定します * * ゲストスペースである場合は、ゲストスペースIDを返却します * * @returns ゲストスペースID */ declare const detectGuestSpaceId: () => string | null; type OnFileLoadOptions = { encoding?: string; }; declare const onFileLoad: (file: File | Blob, options?: OnFileLoadOptions) => Promise>; /** * クエリからソート条件を取得します。 * * kintone.app.getQuery()の結果を想定しています。 * * @param query クエリ文字列 * @returns ソート条件の文字列 * @see {@link https://cybozu.dev/ja/kintone/docs/js-api/app/get-record-list-query-with-order-by-limit-offset/ レコード一覧のクエリ文字列を取得する(オプション付き)} * @example * ```js * const query = kintone.app.getQuery(); // "order by フィールド1 asc, フィールド2 desc limit 100 offset 0" * const sort = getSortFromQuery(query); // [{ field: 'フィールド1', order: 'asc' }, { field: 'フィールド2', order: 'desc' }] * ``` */ declare const getSortFromQuery: (query: string) => { field: string; order: "asc" | "desc"; }[]; /** * kintone javascript APIから実行環境を取得し、モバイル端末である場合はTrueを返却します * * 引数としてイベントタイプを設定することで、より安全なチェックを行います * * 判定の以下の優先順にしたがって実行されます * * 1. イベントタイプに指定がある場合はタイプ名から判定 * 2. グローバル変数が存在する場合はそれに従う * 3. kintone javascript APIから、アプリIDを取得して判定 * * @param eventType イベントタイプ * @returns 実行環境がモバイル端末である場合はtrue */ declare const isMobile: (eventType?: string) => boolean; /** * kintone javascript APIのルートオブジェクトを返却します * * この関数は実行デバイスの影響を受けません * * 引数としてイベントタイプを設定することで、より安全なチェックを行います * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app} デスクトップ用のルートオブジェクト * @see {@link kintone.mobile.app} モバイル用のルートオブジェクト * * @param eventType イベントタイプ * @returns kintone javascript APIのルートオブジェクト */ declare const getAppObject: (eventType?: string) => typeof kintone.mobile.app | typeof kintone.app; /** * kintone javascript APIを使用し、現在のアプリIDを返却します * * アプリIDの取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.getId} デスクトップ版の関数 * @see {@link kintone.mobile.app.getId} モバイル版の関数 * * @returns 現在のアプリID、またはnull */ declare const getAppId: () => number | null; /** * kintone javascript APIを使用し、現在のレコードIDを返却します * * レコードIDの取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.record.getId} デスクトップ版の関数 * @see {@link kintone.mobile.app.record.getId} モバイル版の関数 * * @returns 現在のレコードID、またはnull */ declare const getRecordId: () => number | null; /** * kintone javascript APIを使用し、指定されたIDのスペースフィールドを返却します * * スペースフィールドの取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.record.getSpaceElement} デスクトップ版の関数 * @see {@link kintone.mobile.app.record.getSpaceElement} モバイル版の関数 * * @returns 指定されたIDのスペースフィールド、またはnull */ declare const getSpaceElement: (spaceId: string) => HTMLElement | null; /** * kintone javascript APIを使用し、オプションを含むレコード一覧のクエリ文字列を返却します * * クエリ文字列の取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.getQuery} デスクトップ版の関数 * @see {@link kintone.mobile.app.getQuery} モバイル版の関数 * * @returns オプションを含むレコード一覧のクエリ文字列、またはnull */ declare const getQuery: () => string | null; /** * kintone javascript APIを使用し、レコード一覧のクエリ文字列を返却します * * クエリ文字列の取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.getQueryCondition} デスクトップ版の関数 * @see {@link kintone.mobile.app.getQueryCondition} モバイル版の関数 * * @returns レコード一覧のクエリ文字列、またはnull */ declare const getQueryCondition: () => string | null; /** * kintone javascript APIを使用し、現在開いてるレコードデータをJSON形式で返却します * * レコードデータの取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.record.get} デスクトップ版の関数 * @see {@link kintone.mobile.app.record.get} モバイル版の関数 * * @returns レコードデータ、またはnull */ declare const getCurrentRecord: () => { record: T; }; /** * kintone javascript APIを使用し、現在開いてるレコードに値をセットします * * この関数は実行デバイスの影響を受けません * * {@link https://developer.cybozu.io/hc/ja/articles/201942014#step4} * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.record.set} デスクトップ版の関数 * @see {@link kintone.mobile.app.record.set} モバイル版の関数 */ declare const setCurrentRecord: (record: { record: any; }) => void; /** * kintone javascript APIを使用し、フィールドの表示/非表示を切り替えます * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.record.setFieldShown} デスクトップ版の関数 * @see {@link kintone.mobile.app.record.setFieldShown} モバイル版の関数 * * @param code 対象フィールドのフィールドコード * @param visible true: フィールドを表示、false: フィールドを非表示 */ declare const setFieldShown: >(code: keyof T, visible: boolean) => void; /** * kintone javascript APIを使用し、ツールバー部分を優先してヘッダー要素を返します * * ヘッダー要素の取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * * @param eventType イベントタイプ * @returns レコードデータ、またはnull */ declare const getHeaderSpace: (eventType: string) => HTMLElement | null; /** * kintone javascript APIを使用し、レコードに対応するフィールド要素を返却します * * フィールド要素の取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.record.getFieldElement} デスクトップ版の関数 * @see {@link kintone.mobile.app.record.getFieldElement} モバイル版の関数 * * @param fieldCode 対象フィールドのフィールドコード * @returns フィールド要素、またはnull */ declare const getFieldElement: (fieldCode: string) => HTMLElement | null; /** * kintone javascript APIを使用し、レコード一覧から対応するフィールド要素の配列を返却します * * フィールド要素の取得に失敗した場合はnullを返却します * * この関数は実行デバイスの影響を受けません * * @see {@link isMobile} 実行環境の判定ロジック * @see {@link kintone.app.getFieldElements} デスクトップ版の関数 * @see {@link kintone.mobile.app.getFieldElements} モバイル版の関数 * * @param fieldCode 対象フィールドのフィールドコード * @returns フィールド要素の配列、またはnull */ declare const getFieldElements: (fieldCode: string) => HTMLElement[] | null; /** * kintone javascript APIのルートオブジェクト */ declare const xapp: typeof kintone.mobile.app | typeof kintone.app; export { API_LIMIT_POST, type AddAllRecordsParams, type AddRecordParams, type AppReportsGetRequest, type BulkRequestParams, type CreateSpaceParams, type CreateSpaceResponse, type DeleteAllRecordsParams, type DeleteSpaceParams, type DeleteSpaceResponse, type GetAllRecordsParams, type GetAppChartsParams, type GetRecordACLEvaluateParams, type GetRecordsParams, type GetYuruCharaOptions, type KintoneConfig, KintoneEventListener, KintoneEventManager, type OnFileLoadOptions, type OneOfBulkRequest, type PluginConfig, PluginLocalStorage, type PluginManifest, type PrimaryKeyToUpdate, type QueryCondition, type RecordACLEvaluateGetRequest, type RecordAssigneesPutRequest, type RecordGetRequest, type RecordPostRequest, type RecordPutRequest, type RecordStatusPutRequest, type RecordStatusToPut, type RecordStatusesPutRequest, type RecordUpsertRequest, type RecordsDeleteRequest, type RecordsGetRequest, type RecordsPostRequest, type RecordsPutRequest, type SavedFields, type UpdateAllRecordStatusesParams, type UpdateAllRecordsParams, type UpdateKey, type UpdateRecordAssigneesParams, type UpdateRecordParams, type UpdateRecordStatusParams, type UpdateThreadParams, type UpdateThreadResponse, type UpsertRecordParams, addAllRecords, addRecord, addRecordComment, addRecords, backdoor, backdoorGetRecord, bulkRequest, compareField, convertFullwidthAlphanumericToHalfwidth, convertHalfwidthKatakanaToFullwidth, convertKatakanaToHiragana, createSpace, cx, deleteAllRecords, deleteAllRecordsByQuery, deleteRecordComment, deleteSpace, detectGuestSpaceId, downloadFile, filterFieldProperties, getAllApps, getAllRecords, getAllRecordsWithCursor, getAllRecordsWithId, getApp, getAppCharts, getAppId, getAppObject, getAppSettings, getAppStatus, getCalcFieldValueAsString, getCurrentRecord, getCybozuGroupUsers, getCybozuGroups, getCybozuOrganizationUsers, getCybozuOrganizations, getCybozuUserGroups, getCybozuUserOrganizations, getCybozuUsers, getDefaultValue, getEmptyValue, getFieldElement, getFieldElements, getFieldValueAsString, getFormFields, getFormLayout, getHeaderSpace, getMetaFieldId_UNSTABLE, getMetaFields_UNSTABLE, getMetaSubtableFields_UNSTABLE, getMetaSubtable_UNSTABLE, getMetaTable_UNSTABLE, getNumberFieldValueAsString, getQuery, getQueryCondition, getQueryString_UNSTABLE, getRecord, getRecordACLEvaluate, getRecordComments, getRecordId, getRecords, getSortFromQuery, getSpace, getSpaceElement, getViews, getWareki, getYuruChara, isGuestSpace, isMobile, kintoneAPI, onFileLoad, restorePluginConfig, setCurrentRecord, setFieldShown, setPluginProxyConfig, sortField, storePluginConfig, storeStorage, updateAllRecordStatuses, updateAllRecords, updateRecord, updateRecordAssignees, updateRecordStatus, updateThread, updateViews, uploadFile, upsertRecord, useApi, useQuery, useSorting, withLogging, withMobileEvents, withSpaceIdFallback, xapp };