@konomi-app/kintone-utilities 5.17.1 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2076 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2291 -0
- package/dist/index.d.ts +2291 -14
- package/dist/index.js +1977 -11
- package/dist/index.js.map +1 -1
- package/package.json +22 -4
- package/cybozu.d.ts +0 -232
- package/dist/character-hebon.d.ts +0 -4
- package/dist/character-hebon.js +0 -196
- package/dist/character-hebon.js.map +0 -1
- package/dist/character-width-conversion.d.ts +0 -79
- package/dist/character-width-conversion.js +0 -198
- package/dist/character-width-conversion.js.map +0 -1
- package/dist/character-width-conversion.test.d.ts +0 -1
- package/dist/character-width-conversion.test.js +0 -65
- package/dist/character-width-conversion.test.js.map +0 -1
- package/dist/cybozu-api/common.d.ts +0 -21
- package/dist/cybozu-api/common.js +0 -48
- package/dist/cybozu-api/common.js.map +0 -1
- package/dist/cybozu-api/group.d.ts +0 -51
- package/dist/cybozu-api/group.js +0 -53
- package/dist/cybozu-api/group.js.map +0 -1
- package/dist/cybozu-api/index.d.ts +0 -3
- package/dist/cybozu-api/index.js +0 -4
- package/dist/cybozu-api/index.js.map +0 -1
- package/dist/cybozu-api/organization.d.ts +0 -62
- package/dist/cybozu-api/organization.js +0 -68
- package/dist/cybozu-api/organization.js.map +0 -1
- package/dist/cybozu-api/user.d.ts +0 -23
- package/dist/cybozu-api/user.js +0 -25
- package/dist/cybozu-api/user.js.map +0 -1
- package/dist/cybozu.d.ts +0 -68
- package/dist/cybozu.js +0 -112
- package/dist/cybozu.js.map +0 -1
- package/dist/date.d.ts +0 -6
- package/dist/date.js +0 -12
- package/dist/date.js.map +0 -1
- package/dist/decorator.d.ts +0 -16
- package/dist/decorator.js +0 -32
- package/dist/decorator.js.map +0 -1
- package/dist/event-manager.d.ts +0 -59
- package/dist/event-manager.js +0 -224
- package/dist/event-manager.js.map +0 -1
- package/dist/logger.d.ts +0 -0
- package/dist/logger.js +0 -2
- package/dist/logger.js.map +0 -1
- package/dist/plugin/config.d.ts +0 -37
- package/dist/plugin/config.js +0 -118
- package/dist/plugin/config.js.map +0 -1
- package/dist/plugin/index.d.ts +0 -2
- package/dist/plugin/index.js +0 -3
- package/dist/plugin/index.js.map +0 -1
- package/dist/plugin/local-storage.d.ts +0 -7
- package/dist/plugin/local-storage.js +0 -25
- package/dist/plugin/local-storage.js.map +0 -1
- package/dist/rest-api/app.d.ts +0 -39
- package/dist/rest-api/app.js +0 -92
- package/dist/rest-api/app.js.map +0 -1
- package/dist/rest-api/client.d.ts +0 -16
- package/dist/rest-api/client.js +0 -26
- package/dist/rest-api/client.js.map +0 -1
- package/dist/rest-api/common.d.ts +0 -28
- package/dist/rest-api/common.js +0 -51
- package/dist/rest-api/common.js.map +0 -1
- package/dist/rest-api/cybozu-user.d.ts +0 -10
- package/dist/rest-api/cybozu-user.js +0 -63
- package/dist/rest-api/cybozu-user.js.map +0 -1
- package/dist/rest-api/file.d.ts +0 -18
- package/dist/rest-api/file.js +0 -28
- package/dist/rest-api/file.js.map +0 -1
- package/dist/rest-api/index.d.ts +0 -8
- package/dist/rest-api/index.js +0 -9
- package/dist/rest-api/index.js.map +0 -1
- package/dist/rest-api/record-comment.d.ts +0 -10
- package/dist/rest-api/record-comment.js +0 -42
- package/dist/rest-api/record-comment.js.map +0 -1
- package/dist/rest-api/record.d.ts +0 -222
- package/dist/rest-api/record.js +0 -415
- package/dist/rest-api/record.js.map +0 -1
- package/dist/rest-api/report.d.ts +0 -8
- package/dist/rest-api/report.js +0 -13
- package/dist/rest-api/report.js.map +0 -1
- package/dist/rest-api/space.d.ts +0 -54
- package/dist/rest-api/space.js +0 -44
- package/dist/rest-api/space.js.map +0 -1
- package/dist/rest-api/utility.d.ts +0 -66
- package/dist/rest-api/utility.js +0 -93
- package/dist/rest-api/utility.js.map +0 -1
- package/dist/types/api/field.d.ts +0 -58
- package/dist/types/api/field.js +0 -5
- package/dist/types/api/field.js.map +0 -1
- package/dist/types/api/fieldLayout.d.ts +0 -66
- package/dist/types/api/fieldLayout.js +0 -5
- package/dist/types/api/fieldLayout.js.map +0 -1
- package/dist/types/api/form.d.ts +0 -6
- package/dist/types/api/form.js +0 -2
- package/dist/types/api/form.js.map +0 -1
- package/dist/types/api/index.d.ts +0 -523
- package/dist/types/api/index.js +0 -2
- package/dist/types/api/index.js.map +0 -1
- package/dist/types/api/js.d.ts +0 -94
- package/dist/types/api/js.js +0 -2
- package/dist/types/api/js.js.map +0 -1
- package/dist/types/api/layout.d.ts +0 -20
- package/dist/types/api/layout.js +0 -6
- package/dist/types/api/layout.js.map +0 -1
- package/dist/types/api/property.d.ts +0 -314
- package/dist/types/api/property.js +0 -5
- package/dist/types/api/property.js.map +0 -1
- package/dist/types/api/record.d.ts +0 -23
- package/dist/types/api/record.js +0 -2
- package/dist/types/api/record.js.map +0 -1
- package/dist/types/api/view.d.ts +0 -50
- package/dist/types/api/view.js +0 -2
- package/dist/types/api/view.js.map +0 -1
- package/dist/types/kintone-config.d.ts +0 -15
- package/dist/types/kintone-config.js +0 -2
- package/dist/types/kintone-config.js.map +0 -1
- package/dist/types/plugin-config.d.ts +0 -74
- package/dist/types/plugin-config.js +0 -2
- package/dist/types/plugin-config.js.map +0 -1
- package/dist/utilities.d.ts +0 -112
- package/dist/utilities.js +0 -495
- package/dist/utilities.js.map +0 -1
- package/dist/utility-types.d.ts +0 -2
- package/dist/utility-types.js +0 -2
- package/dist/utility-types.js.map +0 -1
- package/dist/xapp/index.d.ts +0 -2
- package/dist/xapp/index.js +0 -3
- package/dist/xapp/index.js.map +0 -1
- package/dist/xapp/singleton.d.ts +0 -4
- package/dist/xapp/singleton.js +0 -6
- package/dist/xapp/singleton.js.map +0 -1
- package/dist/xapp/xapp.d.ts +0 -187
- package/dist/xapp/xapp.js +0 -200
- package/dist/xapp/xapp.js.map +0 -1
- package/kintone-initial-data.ts +0 -191
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2076 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/character-hebon.ts
|
|
4
|
+
var hebonMap = {
|
|
5
|
+
\u3042: "A",
|
|
6
|
+
\u3044: "I",
|
|
7
|
+
\u3046: "U",
|
|
8
|
+
\u3048: "E",
|
|
9
|
+
\u304A: "O",
|
|
10
|
+
\u304B: "KA",
|
|
11
|
+
\u304D: "KI",
|
|
12
|
+
\u304F: "KU",
|
|
13
|
+
\u3051: "KE",
|
|
14
|
+
\u3053: "KO",
|
|
15
|
+
\u3055: "SA",
|
|
16
|
+
\u3057: "SHI",
|
|
17
|
+
\u3059: "SU",
|
|
18
|
+
\u305B: "SE",
|
|
19
|
+
\u305D: "SO",
|
|
20
|
+
\u305F: "TA",
|
|
21
|
+
\u3061: "CHI",
|
|
22
|
+
\u3064: "TSU",
|
|
23
|
+
\u3066: "TE",
|
|
24
|
+
\u3068: "TO",
|
|
25
|
+
\u306A: "NA",
|
|
26
|
+
\u306B: "NI",
|
|
27
|
+
\u306C: "NU",
|
|
28
|
+
\u306D: "NE",
|
|
29
|
+
\u306E: "NO",
|
|
30
|
+
\u306F: "HA",
|
|
31
|
+
\u3072: "HI",
|
|
32
|
+
\u3075: "FU",
|
|
33
|
+
\u3078: "HE",
|
|
34
|
+
\u307B: "HO",
|
|
35
|
+
\u307E: "MA",
|
|
36
|
+
\u307F: "MI",
|
|
37
|
+
\u3080: "MU",
|
|
38
|
+
\u3081: "ME",
|
|
39
|
+
\u3082: "MO",
|
|
40
|
+
\u3084: "YA",
|
|
41
|
+
\u3086: "YU",
|
|
42
|
+
\u3088: "YO",
|
|
43
|
+
\u3089: "RA",
|
|
44
|
+
\u308A: "RI",
|
|
45
|
+
\u308B: "RU",
|
|
46
|
+
\u308C: "RE",
|
|
47
|
+
\u308D: "RO",
|
|
48
|
+
\u308F: "WA",
|
|
49
|
+
\u3090: "I",
|
|
50
|
+
\u3091: "E",
|
|
51
|
+
\u3092: "O",
|
|
52
|
+
\u3041: "A",
|
|
53
|
+
\u3043: "I",
|
|
54
|
+
\u3045: "U",
|
|
55
|
+
\u3047: "E",
|
|
56
|
+
\u3049: "O",
|
|
57
|
+
\u304C: "GA",
|
|
58
|
+
\u304E: "GI",
|
|
59
|
+
\u3050: "GU",
|
|
60
|
+
\u3052: "GE",
|
|
61
|
+
\u3054: "GO",
|
|
62
|
+
\u3056: "ZA",
|
|
63
|
+
\u3058: "JI",
|
|
64
|
+
\u305A: "ZU",
|
|
65
|
+
\u305C: "ZE",
|
|
66
|
+
\u305E: "ZO",
|
|
67
|
+
\u3060: "DA",
|
|
68
|
+
\u3062: "JI",
|
|
69
|
+
\u3065: "ZU",
|
|
70
|
+
\u3067: "DE",
|
|
71
|
+
\u3069: "DO",
|
|
72
|
+
\u3070: "BA",
|
|
73
|
+
\u3073: "BI",
|
|
74
|
+
\u3076: "BU",
|
|
75
|
+
\u3079: "BE",
|
|
76
|
+
\u307C: "BO",
|
|
77
|
+
\u3071: "PA",
|
|
78
|
+
\u3074: "PI",
|
|
79
|
+
\u3077: "PU",
|
|
80
|
+
\u307A: "PE",
|
|
81
|
+
\u307D: "PO",
|
|
82
|
+
\u304D\u3083: "KYA",
|
|
83
|
+
\u304D\u3085: "KYU",
|
|
84
|
+
\u304D\u3087: "KYO",
|
|
85
|
+
\u3057\u3083: "SHA",
|
|
86
|
+
\u3057\u3085: "SHU",
|
|
87
|
+
\u3057\u3087: "SHO",
|
|
88
|
+
\u3061\u3083: "CHA",
|
|
89
|
+
\u3061\u3085: "CHU",
|
|
90
|
+
\u3061\u3087: "CHO",
|
|
91
|
+
\u3061\u3047: "CHE",
|
|
92
|
+
\u306B\u3083: "NYA",
|
|
93
|
+
\u306B\u3085: "NYU",
|
|
94
|
+
\u306B\u3087: "NYO",
|
|
95
|
+
\u3072\u3083: "HYA",
|
|
96
|
+
\u3072\u3085: "HYU",
|
|
97
|
+
\u3072\u3087: "HYO",
|
|
98
|
+
\u307F\u3083: "MYA",
|
|
99
|
+
\u307F\u3085: "MYU",
|
|
100
|
+
\u307F\u3087: "MYO",
|
|
101
|
+
\u308A\u3083: "RYA",
|
|
102
|
+
\u308A\u3085: "RYU",
|
|
103
|
+
\u308A\u3087: "RYO",
|
|
104
|
+
\u304E\u3083: "GYA",
|
|
105
|
+
\u304E\u3085: "GYU",
|
|
106
|
+
\u304E\u3087: "GYO",
|
|
107
|
+
\u3058\u3083: "JA",
|
|
108
|
+
\u3058\u3085: "JU",
|
|
109
|
+
\u3058\u3087: "JO",
|
|
110
|
+
\u3073\u3083: "BYA",
|
|
111
|
+
\u3073\u3085: "BYU",
|
|
112
|
+
\u3073\u3087: "BYO",
|
|
113
|
+
\u3074\u3083: "PYA",
|
|
114
|
+
\u3074\u3085: "PYU",
|
|
115
|
+
\u3074\u3087: "PYO"
|
|
116
|
+
};
|
|
117
|
+
var aaSet = {
|
|
118
|
+
AA: true,
|
|
119
|
+
EE: true,
|
|
120
|
+
II: false,
|
|
121
|
+
// I は連続しても省略しない
|
|
122
|
+
OO: true,
|
|
123
|
+
OU: true,
|
|
124
|
+
UU: true
|
|
125
|
+
};
|
|
126
|
+
var getHebon = (s, index) => {
|
|
127
|
+
let h = null;
|
|
128
|
+
let c = null;
|
|
129
|
+
if (index + 1 < s.length) {
|
|
130
|
+
c = s.substring(index, index + 2);
|
|
131
|
+
h = hebonMap[c];
|
|
132
|
+
}
|
|
133
|
+
if (!h && index < s.length) {
|
|
134
|
+
c = s.substring(index, index + 1);
|
|
135
|
+
h = hebonMap[c];
|
|
136
|
+
}
|
|
137
|
+
return { c: c ?? "", h: h ?? null };
|
|
138
|
+
};
|
|
139
|
+
function toHebon(s) {
|
|
140
|
+
let hebon = "";
|
|
141
|
+
let lastHebon = "";
|
|
142
|
+
let i = 0;
|
|
143
|
+
while (i < s.length) {
|
|
144
|
+
const hr = getHebon(s, i);
|
|
145
|
+
if (hr.c === "\u3063") {
|
|
146
|
+
const nextHr = getHebon(s, i + 1);
|
|
147
|
+
if (nextHr.h !== null) {
|
|
148
|
+
if (nextHr.h.startsWith("CH")) {
|
|
149
|
+
hr.h = "T";
|
|
150
|
+
} else {
|
|
151
|
+
hr.h = nextHr.h.substring(0, 1);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
} else if (hr.c === "\u3093") {
|
|
155
|
+
const nextHr = getHebon(s, i + 1);
|
|
156
|
+
if (nextHr.h !== null && "BMP".indexOf(nextHr.h.charAt(0)) !== -1) {
|
|
157
|
+
hr.h = "M";
|
|
158
|
+
} else {
|
|
159
|
+
hr.h = "N";
|
|
160
|
+
}
|
|
161
|
+
} else if (hr.c === "\u30FC") {
|
|
162
|
+
hr.h = "";
|
|
163
|
+
}
|
|
164
|
+
if (hr.h !== null) {
|
|
165
|
+
if (lastHebon !== null) {
|
|
166
|
+
let htest = lastHebon + hr.h;
|
|
167
|
+
if (htest.length > 2) {
|
|
168
|
+
htest = htest.substring(htest.length - 2);
|
|
169
|
+
}
|
|
170
|
+
if (aaSet[htest]) {
|
|
171
|
+
hr.h = "";
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
hebon += hr.h;
|
|
175
|
+
} else {
|
|
176
|
+
hebon += hr.c;
|
|
177
|
+
}
|
|
178
|
+
lastHebon = hr.h;
|
|
179
|
+
i += hr.c.length;
|
|
180
|
+
}
|
|
181
|
+
return hebon;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// src/character-width-conversion.ts
|
|
185
|
+
var convertKatakanaToHiragana = (target) => {
|
|
186
|
+
return target.replace(
|
|
187
|
+
/[\u30a1-\u30f6]/g,
|
|
188
|
+
(match) => String.fromCharCode(match.charCodeAt(0) - 96)
|
|
189
|
+
);
|
|
190
|
+
};
|
|
191
|
+
var convertFullwidthAlphanumericToHalfwidth = (target) => {
|
|
192
|
+
return target.replace(/[A-Za-z0-9]/g, (s) => String.fromCharCode(s.charCodeAt(0) - 65248));
|
|
193
|
+
};
|
|
194
|
+
var convertHalfwidthKatakanaToFullwidth = (target) => {
|
|
195
|
+
const KANA_CONVERTION_MAP = {
|
|
196
|
+
\uFF76\uFF9E: "\u30AC",
|
|
197
|
+
\uFF77\uFF9E: "\u30AE",
|
|
198
|
+
\uFF78\uFF9E: "\u30B0",
|
|
199
|
+
\uFF79\uFF9E: "\u30B2",
|
|
200
|
+
\uFF7A\uFF9E: "\u30B4",
|
|
201
|
+
\uFF7B\uFF9E: "\u30B6",
|
|
202
|
+
\uFF7C\uFF9E: "\u30B8",
|
|
203
|
+
\uFF7D\uFF9E: "\u30BA",
|
|
204
|
+
\uFF7E\uFF9E: "\u30BC",
|
|
205
|
+
\uFF7F\uFF9E: "\u30BE",
|
|
206
|
+
\uFF80\uFF9E: "\u30C0",
|
|
207
|
+
\uFF81\uFF9E: "\u30C2",
|
|
208
|
+
\uFF82\uFF9E: "\u30C5",
|
|
209
|
+
\uFF83\uFF9E: "\u30C7",
|
|
210
|
+
\uFF84\uFF9E: "\u30C9",
|
|
211
|
+
\uFF8A\uFF9E: "\u30D0",
|
|
212
|
+
\uFF8B\uFF9E: "\u30D3",
|
|
213
|
+
\uFF8C\uFF9E: "\u30D6",
|
|
214
|
+
\uFF8D\uFF9E: "\u30D9",
|
|
215
|
+
\uFF8E\uFF9E: "\u30DC",
|
|
216
|
+
\uFF8A\uFF9F: "\u30D1",
|
|
217
|
+
\uFF8B\uFF9F: "\u30D4",
|
|
218
|
+
\uFF8C\uFF9F: "\u30D7",
|
|
219
|
+
\uFF8D\uFF9F: "\u30DA",
|
|
220
|
+
\uFF8E\uFF9F: "\u30DD",
|
|
221
|
+
\uFF73\uFF9E: "\u30F4",
|
|
222
|
+
\uFF9C\uFF9E: "\u30F7",
|
|
223
|
+
\uFF66\uFF9E: "\u30FA",
|
|
224
|
+
\uFF71: "\u30A2",
|
|
225
|
+
\uFF72: "\u30A4",
|
|
226
|
+
\uFF73: "\u30A6",
|
|
227
|
+
\uFF74: "\u30A8",
|
|
228
|
+
\uFF75: "\u30AA",
|
|
229
|
+
\uFF76: "\u30AB",
|
|
230
|
+
\uFF77: "\u30AD",
|
|
231
|
+
\uFF78: "\u30AF",
|
|
232
|
+
\uFF79: "\u30B1",
|
|
233
|
+
\uFF7A: "\u30B3",
|
|
234
|
+
\uFF7B: "\u30B5",
|
|
235
|
+
\uFF7C: "\u30B7",
|
|
236
|
+
\uFF7D: "\u30B9",
|
|
237
|
+
\uFF7E: "\u30BB",
|
|
238
|
+
\uFF7F: "\u30BD",
|
|
239
|
+
\uFF80: "\u30BF",
|
|
240
|
+
\uFF81: "\u30C1",
|
|
241
|
+
\uFF82: "\u30C4",
|
|
242
|
+
\uFF83: "\u30C6",
|
|
243
|
+
\uFF84: "\u30C8",
|
|
244
|
+
\uFF85: "\u30CA",
|
|
245
|
+
\uFF86: "\u30CB",
|
|
246
|
+
\uFF87: "\u30CC",
|
|
247
|
+
\uFF88: "\u30CD",
|
|
248
|
+
\uFF89: "\u30CE",
|
|
249
|
+
\uFF8A: "\u30CF",
|
|
250
|
+
\uFF8B: "\u30D2",
|
|
251
|
+
\uFF8C: "\u30D5",
|
|
252
|
+
\uFF8D: "\u30D8",
|
|
253
|
+
\uFF8E: "\u30DB",
|
|
254
|
+
\uFF8F: "\u30DE",
|
|
255
|
+
\uFF90: "\u30DF",
|
|
256
|
+
\uFF91: "\u30E0",
|
|
257
|
+
\uFF92: "\u30E1",
|
|
258
|
+
\uFF93: "\u30E2",
|
|
259
|
+
\uFF94: "\u30E4",
|
|
260
|
+
\uFF95: "\u30E6",
|
|
261
|
+
\uFF96: "\u30E8",
|
|
262
|
+
\uFF97: "\u30E9",
|
|
263
|
+
\uFF98: "\u30EA",
|
|
264
|
+
\uFF99: "\u30EB",
|
|
265
|
+
\uFF9A: "\u30EC",
|
|
266
|
+
\uFF9B: "\u30ED",
|
|
267
|
+
\uFF9C: "\u30EF",
|
|
268
|
+
\uFF66: "\u30F2",
|
|
269
|
+
\uFF9D: "\u30F3",
|
|
270
|
+
\uFF67: "\u30A1",
|
|
271
|
+
\uFF68: "\u30A3",
|
|
272
|
+
\uFF69: "\u30A5",
|
|
273
|
+
\uFF6A: "\u30A7",
|
|
274
|
+
\uFF6B: "\u30A9",
|
|
275
|
+
\uFF6F: "\u30C3",
|
|
276
|
+
\uFF6C: "\u30E3",
|
|
277
|
+
\uFF6D: "\u30E5",
|
|
278
|
+
\uFF6E: "\u30E7",
|
|
279
|
+
"\uFF61": "\u3002",
|
|
280
|
+
"\uFF64": "\u3001",
|
|
281
|
+
\uFF70: "\u30FC",
|
|
282
|
+
"\uFF62": "\u300C",
|
|
283
|
+
"\uFF63": "\u300D",
|
|
284
|
+
"\uFF65": "\u30FB"
|
|
285
|
+
};
|
|
286
|
+
const regexp = new RegExp(`(${Object.keys(KANA_CONVERTION_MAP).join("|")})`, "g");
|
|
287
|
+
return target.replace(regexp, (s) => KANA_CONVERTION_MAP[s]).replace(/゙/g, "\u309B").replace(/゚/g, "\u309C");
|
|
288
|
+
};
|
|
289
|
+
var getYuruChara = (target, options) => {
|
|
290
|
+
const {
|
|
291
|
+
isZenkakuEisujiSensitive = false,
|
|
292
|
+
isCaseSensitive = false,
|
|
293
|
+
isHankakuKatakanaSensitive = false,
|
|
294
|
+
isKatakanaSensitive = false,
|
|
295
|
+
isHebonSensitive = false,
|
|
296
|
+
isHyphenSensitive = false
|
|
297
|
+
} = options || {};
|
|
298
|
+
let converted = target;
|
|
299
|
+
if (!isZenkakuEisujiSensitive) {
|
|
300
|
+
converted = convertFullwidthAlphanumericToHalfwidth(converted);
|
|
301
|
+
}
|
|
302
|
+
if (!isHankakuKatakanaSensitive) {
|
|
303
|
+
converted = convertHalfwidthKatakanaToFullwidth(converted);
|
|
304
|
+
}
|
|
305
|
+
if (!isKatakanaSensitive) {
|
|
306
|
+
converted = convertKatakanaToHiragana(converted);
|
|
307
|
+
}
|
|
308
|
+
if (!isHebonSensitive) {
|
|
309
|
+
converted = toHebon(converted);
|
|
310
|
+
}
|
|
311
|
+
if (!isCaseSensitive) {
|
|
312
|
+
converted = converted.toLowerCase();
|
|
313
|
+
}
|
|
314
|
+
if (!isHyphenSensitive) {
|
|
315
|
+
converted = converted.replace(
|
|
316
|
+
/[\u002D\u2010-\u2015\u2212\u301C\u30FC\uFF0D\u005F\uFF3F\uFF5E]+/g,
|
|
317
|
+
"-"
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
return converted;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
// src/cybozu.ts
|
|
324
|
+
var getSchema = () => cybozu?.data?.page?.SCHEMA_DATA || cybozu?.data?.page?.FORM_DATA?.schema || null;
|
|
325
|
+
var getMetaTable_UNSTABLE = () => {
|
|
326
|
+
const schema = getSchema();
|
|
327
|
+
const fieldList = schema?.table?.fieldList;
|
|
328
|
+
if (!fieldList) {
|
|
329
|
+
return null;
|
|
330
|
+
}
|
|
331
|
+
return Object.values(fieldList);
|
|
332
|
+
};
|
|
333
|
+
var getMetaSubtable_UNSTABLE = () => {
|
|
334
|
+
const schema = getSchema();
|
|
335
|
+
const subtable = schema?.subTable;
|
|
336
|
+
if (!subtable) {
|
|
337
|
+
return null;
|
|
338
|
+
}
|
|
339
|
+
const subtableList = Object.values(subtable);
|
|
340
|
+
return subtableList;
|
|
341
|
+
};
|
|
342
|
+
var getMetaFields_UNSTABLE = () => {
|
|
343
|
+
return [...getMetaTable_UNSTABLE() || [], ...getMetaSubtable_UNSTABLE() || []];
|
|
344
|
+
};
|
|
345
|
+
var getMetaFieldId_UNSTABLE = (code) => {
|
|
346
|
+
const fields = getMetaFields_UNSTABLE();
|
|
347
|
+
if (!fields) {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
for (const field2 of fields) {
|
|
351
|
+
if (field2?.var === code) {
|
|
352
|
+
return field2?.id || null;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return null;
|
|
356
|
+
};
|
|
357
|
+
var getMetaSubtableFields_UNSTABLE = (subtableCode) => {
|
|
358
|
+
const schema = getSchema();
|
|
359
|
+
const subtable = schema?.subTable;
|
|
360
|
+
if (!subtable) {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
const subtableList = Object.values(subtable);
|
|
364
|
+
for (const subtable2 of subtableList) {
|
|
365
|
+
const fieldList = subtable2?.fieldList;
|
|
366
|
+
if (!fieldList) {
|
|
367
|
+
continue;
|
|
368
|
+
}
|
|
369
|
+
if (subtable2?.var === subtableCode) {
|
|
370
|
+
return Object.values(fieldList);
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return null;
|
|
374
|
+
};
|
|
375
|
+
var getQueryString_UNSTABLE = () => {
|
|
376
|
+
return cybozu?.data?.page?.QUERY_STRING ?? new URLSearchParams(location.search).get("q") ?? "";
|
|
377
|
+
};
|
|
378
|
+
|
|
379
|
+
// src/cybozu-api/common.ts
|
|
380
|
+
var buildPath = (endpointName) => {
|
|
381
|
+
return kintone.api.url(`/v1/${endpointName}`);
|
|
382
|
+
};
|
|
383
|
+
var api = async (params) => {
|
|
384
|
+
const { endpointName, method, body, debug } = params;
|
|
385
|
+
try {
|
|
386
|
+
checkBrowser();
|
|
387
|
+
const path = buildPath(endpointName);
|
|
388
|
+
if (debug) {
|
|
389
|
+
console.groupCollapsed(
|
|
390
|
+
`%ckintone REST API %c(${endpointName})`,
|
|
391
|
+
"color: #1e40af;",
|
|
392
|
+
"color: #aaa"
|
|
393
|
+
);
|
|
394
|
+
console.log(`path: ${path}`);
|
|
395
|
+
console.log(`method: ${method}`);
|
|
396
|
+
console.log("body", body);
|
|
397
|
+
}
|
|
398
|
+
const response = await kintone.api(path, method, body);
|
|
399
|
+
if (debug) {
|
|
400
|
+
console.log("response", response);
|
|
401
|
+
}
|
|
402
|
+
return response;
|
|
403
|
+
} catch (error) {
|
|
404
|
+
if (debug) {
|
|
405
|
+
console.error(error);
|
|
406
|
+
}
|
|
407
|
+
throw error;
|
|
408
|
+
} finally {
|
|
409
|
+
if (debug) {
|
|
410
|
+
console.groupEnd();
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
var checkBrowser = () => {
|
|
415
|
+
if (typeof window === "undefined") {
|
|
416
|
+
throw new Error("\u3053\u306E\u95A2\u6570\u306F\u30D6\u30E9\u30A6\u30B6\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059");
|
|
417
|
+
}
|
|
418
|
+
if (typeof kintone === "undefined") {
|
|
419
|
+
throw new Error("kintone\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093");
|
|
420
|
+
}
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
// src/cybozu-api/group.ts
|
|
424
|
+
function getCybozuGroups() {
|
|
425
|
+
return api({ endpointName: "groups", method: "GET", body: {} });
|
|
426
|
+
}
|
|
427
|
+
function getCybozuGroupUsers(groupCode) {
|
|
428
|
+
return api({ endpointName: "group/users", method: "GET", body: { code: groupCode } });
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// src/cybozu-api/organization.ts
|
|
432
|
+
function getCybozuOrganizations() {
|
|
433
|
+
return api({ endpointName: "organizations", method: "GET", body: {} });
|
|
434
|
+
}
|
|
435
|
+
function getCybozuOrganizationUsers(organizationCode) {
|
|
436
|
+
return api({
|
|
437
|
+
endpointName: "organization/users",
|
|
438
|
+
method: "GET",
|
|
439
|
+
body: { code: organizationCode }
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// src/cybozu-api/user.ts
|
|
444
|
+
var getCybozuUsers = () => {
|
|
445
|
+
return api({ endpointName: "users", method: "GET", body: {} });
|
|
446
|
+
};
|
|
447
|
+
var getCybozuUserGroups = (code) => {
|
|
448
|
+
return api({ endpointName: `user/groups`, method: "GET", body: { code } });
|
|
449
|
+
};
|
|
450
|
+
var getCybozuUserOrganizations = (code) => {
|
|
451
|
+
return api({ endpointName: `user/organizations`, method: "GET", body: { code } });
|
|
452
|
+
};
|
|
453
|
+
|
|
454
|
+
// src/date.ts
|
|
455
|
+
var getWareki = (date, option) => {
|
|
456
|
+
const { era = "narrow" } = option || {};
|
|
457
|
+
const formatter = new Intl.DateTimeFormat("ja-JP-u-ca-japanese", { era });
|
|
458
|
+
const formatted = formatter.format(date);
|
|
459
|
+
const matched = formatted.match(/^(.*?)(\d+).*/);
|
|
460
|
+
if (!matched) {
|
|
461
|
+
throw new Error("\u548C\u66A6\u60C5\u5831\u306E\u30B3\u30F3\u30D0\u30FC\u30C8\u306B\u5931\u6557\u3057\u307E\u3057\u305F");
|
|
462
|
+
}
|
|
463
|
+
const [_, gengo, year] = matched;
|
|
464
|
+
return { gengo, year: Number(year) };
|
|
465
|
+
};
|
|
466
|
+
|
|
467
|
+
// src/decorator.ts
|
|
468
|
+
var withLogging = (fn, name = fn.name) => {
|
|
469
|
+
return (...args) => {
|
|
470
|
+
try {
|
|
471
|
+
console.groupCollapsed(`\u{1F527} ${name}`);
|
|
472
|
+
console.log("\u{1F527} args", args);
|
|
473
|
+
const now = performance.now();
|
|
474
|
+
const result = fn(...args);
|
|
475
|
+
console.log("\u2728 result", result);
|
|
476
|
+
console.log(`\u{1F552} took ${performance.now() - now}ms`);
|
|
477
|
+
return result;
|
|
478
|
+
} finally {
|
|
479
|
+
console.groupEnd();
|
|
480
|
+
}
|
|
481
|
+
};
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
// src/xapp/xapp.ts
|
|
485
|
+
var isMobile = (eventType) => {
|
|
486
|
+
if (eventType) {
|
|
487
|
+
return /^mobile\./.test(eventType);
|
|
488
|
+
}
|
|
489
|
+
return kintone.app.getId() === null;
|
|
490
|
+
};
|
|
491
|
+
var getAppObject = (eventType) => isMobile(eventType) ? kintone.mobile.app : kintone.app;
|
|
492
|
+
var getAppId = () => getAppObject().getId();
|
|
493
|
+
var getRecordId = () => getAppObject().record.getId();
|
|
494
|
+
var getSpaceElement = (spaceId) => getAppObject().record.getSpaceElement(spaceId);
|
|
495
|
+
var getQuery = () => getAppObject().getQuery();
|
|
496
|
+
var getQueryCondition = () => getAppObject().getQueryCondition();
|
|
497
|
+
var getCurrentRecord = () => getAppObject().record.get();
|
|
498
|
+
var setCurrentRecord = (record) => getAppObject().record.set(record);
|
|
499
|
+
var setFieldShown = (code, visible) => getAppObject().record.setFieldShown(String(code), visible);
|
|
500
|
+
var getHeaderSpace = (eventType) => {
|
|
501
|
+
if (isMobile(eventType)) {
|
|
502
|
+
kintone.mobile.app.getHeaderSpaceElement();
|
|
503
|
+
} else if (!~eventType.indexOf("index")) {
|
|
504
|
+
return kintone.app.record.getHeaderMenuSpaceElement();
|
|
505
|
+
}
|
|
506
|
+
return kintone.app.getHeaderMenuSpaceElement();
|
|
507
|
+
};
|
|
508
|
+
var getFieldElement = (fieldCode) => {
|
|
509
|
+
return getAppObject().record.getFieldElement(fieldCode);
|
|
510
|
+
};
|
|
511
|
+
var getFieldElements = (fieldCode) => {
|
|
512
|
+
return getAppObject().getFieldElements(fieldCode);
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
// src/xapp/singleton.ts
|
|
516
|
+
var xapp = getAppObject();
|
|
517
|
+
|
|
518
|
+
// src/utilities.ts
|
|
519
|
+
var getNumberFieldValueAsString = (params) => {
|
|
520
|
+
const { field: field2, property, locales = "ja" } = params;
|
|
521
|
+
const casted = Number(field2.value);
|
|
522
|
+
if (isNaN(casted)) {
|
|
523
|
+
return field2.value;
|
|
524
|
+
}
|
|
525
|
+
const displayScale = property?.displayScale ? Number(property.displayScale) : null;
|
|
526
|
+
const scaled = displayScale ? Math.round(casted * Math.pow(10, Number(displayScale))) / Math.pow(10, Number(displayScale)) : casted;
|
|
527
|
+
const separated = property?.digit ? Number(scaled).toLocaleString(locales, {
|
|
528
|
+
maximumFractionDigits: displayScale ?? void 0,
|
|
529
|
+
minimumFractionDigits: displayScale ?? void 0
|
|
530
|
+
}) : displayScale ? Number(scaled).toFixed(displayScale) : scaled;
|
|
531
|
+
if (property?.unit) {
|
|
532
|
+
if (property.unitPosition === "BEFORE") {
|
|
533
|
+
return `${property.unit}${separated}`;
|
|
534
|
+
} else {
|
|
535
|
+
return `${separated}${property.unit}`;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
return String(separated);
|
|
539
|
+
};
|
|
540
|
+
var getFieldValueAsString = (field2, options) => {
|
|
541
|
+
const { separator = ", ", ignoresCalculationError = false } = options ?? {};
|
|
542
|
+
if (field2.type === "MULTI_LINE_TEXT" || field2.type === "RICH_TEXT" || field2.type === "CREATED_TIME" || field2.type === "DATE" || field2.type === "DATETIME" || field2.type === "DROP_DOWN" || field2.type === "LINK" || field2.type === "RECORD_NUMBER" || field2.type === "STATUS" || field2.type === "RADIO_BUTTON" || field2.type === "TIME" || field2.type === "UPDATED_TIME" || field2.type === "__ID__" || field2.type === "__REVISION__") {
|
|
543
|
+
return field2.value ?? "";
|
|
544
|
+
} else if (field2.type === "SINGLE_LINE_TEXT" || field2.type === "NUMBER" || field2.type === "CALC") {
|
|
545
|
+
const value = field2.value ?? "";
|
|
546
|
+
if (ignoresCalculationError) {
|
|
547
|
+
return /^#.*!$/.test(value) ? "" : value;
|
|
548
|
+
}
|
|
549
|
+
return value;
|
|
550
|
+
} else if (field2.type === "CATEGORY" || field2.type === "CHECK_BOX" || field2.type === "MULTI_SELECT") {
|
|
551
|
+
return field2.value.join(separator);
|
|
552
|
+
} else if (field2.type === "CREATOR" || field2.type === "MODIFIER") {
|
|
553
|
+
return field2.value.name;
|
|
554
|
+
} else if (field2.type === "GROUP_SELECT" || field2.type === "ORGANIZATION_SELECT" || field2.type === "USER_SELECT" || field2.type === "STATUS_ASSIGNEE") {
|
|
555
|
+
return field2.value.map((value) => value.name).join(separator);
|
|
556
|
+
} else if (field2.type === "FILE") {
|
|
557
|
+
return field2.value.map((value) => value.name).join(separator);
|
|
558
|
+
} else if (field2.type === "SUBTABLE") {
|
|
559
|
+
return field2.value.map(
|
|
560
|
+
(row) => Object.values(row.value).map((cell) => getFieldValueAsString(cell, { separator })).join(separator)
|
|
561
|
+
).join(separator);
|
|
562
|
+
}
|
|
563
|
+
return "";
|
|
564
|
+
};
|
|
565
|
+
var isStringField = (field2) => {
|
|
566
|
+
return field2.type === "SINGLE_LINE_TEXT" || field2.type === "MULTI_LINE_TEXT" || field2.type === "RICH_TEXT" || field2.type === "DROP_DOWN" || field2.type === "LINK" || field2.type === "RECORD_NUMBER" || field2.type === "STATUS" || field2.type === "RADIO_BUTTON" || field2.type === "__ID__" || field2.type === "__REVISION__";
|
|
567
|
+
};
|
|
568
|
+
var isNumberField = (field2) => {
|
|
569
|
+
return field2.type === "NUMBER" || field2.type === "CALC";
|
|
570
|
+
};
|
|
571
|
+
var isDateField = (field2) => {
|
|
572
|
+
return field2.type === "CREATED_TIME" || field2.type === "UPDATED_TIME" || field2.type === "DATE" || field2.type === "DATETIME";
|
|
573
|
+
};
|
|
574
|
+
var isTimeField = (field2) => {
|
|
575
|
+
return field2.type === "TIME";
|
|
576
|
+
};
|
|
577
|
+
var sortField = (aField, bField) => {
|
|
578
|
+
const aFieldType = aField.type;
|
|
579
|
+
const bFieldType = bField.type;
|
|
580
|
+
if (aField.value === null && bField.value === null) {
|
|
581
|
+
return 0;
|
|
582
|
+
}
|
|
583
|
+
if (aField.value === null) {
|
|
584
|
+
return 1;
|
|
585
|
+
}
|
|
586
|
+
if (bField.value === null) {
|
|
587
|
+
return -1;
|
|
588
|
+
}
|
|
589
|
+
if (aFieldType === "RECORD_NUMBER" && bFieldType === "RECORD_NUMBER") {
|
|
590
|
+
const regex = /.*?(\d+)$/;
|
|
591
|
+
const aMatch = aField.value.match(regex);
|
|
592
|
+
const bMatch = bField.value.match(regex);
|
|
593
|
+
if (aMatch && bMatch) {
|
|
594
|
+
const aNumber = Number(aMatch[1]);
|
|
595
|
+
const bNumber = Number(bMatch[1]);
|
|
596
|
+
if (isNaN(aNumber) && isNaN(bNumber)) {
|
|
597
|
+
return 0;
|
|
598
|
+
}
|
|
599
|
+
return Number(aMatch[1]) - Number(bMatch[1]);
|
|
600
|
+
}
|
|
601
|
+
return aField.value.localeCompare(bField.value);
|
|
602
|
+
} else if (isStringField(aField) && isStringField(bField)) {
|
|
603
|
+
return aField.value?.localeCompare(bField.value ?? "") ?? 0;
|
|
604
|
+
} else if (isNumberField(aField) && isNumberField(bField)) {
|
|
605
|
+
const aNum = Number(aField.value);
|
|
606
|
+
const bNum = Number(bField.value);
|
|
607
|
+
if (isNaN(aNum) && isNaN(bNum)) {
|
|
608
|
+
return 0;
|
|
609
|
+
}
|
|
610
|
+
if (isNaN(aNum)) {
|
|
611
|
+
return 1;
|
|
612
|
+
}
|
|
613
|
+
if (isNaN(bNum)) {
|
|
614
|
+
return -1;
|
|
615
|
+
}
|
|
616
|
+
return aNum - bNum;
|
|
617
|
+
} else if (isDateField(aField) && isDateField(bField)) {
|
|
618
|
+
const aDate = new Date(aField.value);
|
|
619
|
+
const bDate = new Date(bField.value);
|
|
620
|
+
if (isNaN(aDate.getTime()) && isNaN(bDate.getTime())) {
|
|
621
|
+
return 0;
|
|
622
|
+
}
|
|
623
|
+
if (isNaN(aDate.getTime())) {
|
|
624
|
+
return 1;
|
|
625
|
+
}
|
|
626
|
+
if (isNaN(bDate.getTime())) {
|
|
627
|
+
return -1;
|
|
628
|
+
}
|
|
629
|
+
return aDate.getTime() - bDate.getTime();
|
|
630
|
+
} else if (isTimeField(aField) && isTimeField(bField)) {
|
|
631
|
+
const parseTime = (value) => {
|
|
632
|
+
const [hours, minutes] = value.split(":").map(Number);
|
|
633
|
+
if (isNaN(hours) || isNaN(minutes)) {
|
|
634
|
+
return NaN;
|
|
635
|
+
}
|
|
636
|
+
return hours * 60 + minutes;
|
|
637
|
+
};
|
|
638
|
+
const aTime = parseTime(aField.value);
|
|
639
|
+
const bTime = parseTime(bField.value);
|
|
640
|
+
if (isNaN(aTime) && isNaN(bTime)) {
|
|
641
|
+
return 0;
|
|
642
|
+
}
|
|
643
|
+
if (isNaN(aTime)) {
|
|
644
|
+
return 1;
|
|
645
|
+
}
|
|
646
|
+
if (isNaN(bTime)) {
|
|
647
|
+
return -1;
|
|
648
|
+
}
|
|
649
|
+
return aTime - bTime;
|
|
650
|
+
} else if ((aFieldType === "CATEGORY" || aFieldType === "CHECK_BOX" || aFieldType === "MULTI_SELECT") && (bFieldType === "CATEGORY" || bFieldType === "CHECK_BOX" || bFieldType === "MULTI_SELECT")) {
|
|
651
|
+
return getFieldValueAsString(aField).localeCompare(getFieldValueAsString(bField));
|
|
652
|
+
} else if ((aFieldType === "CREATOR" || aFieldType === "MODIFIER") && (bFieldType === "CREATOR" || bFieldType === "MODIFIER")) {
|
|
653
|
+
return aField.value.name.localeCompare(bField.value.name);
|
|
654
|
+
} else if ((aFieldType === "GROUP_SELECT" || aFieldType === "ORGANIZATION_SELECT" || aFieldType === "USER_SELECT" || aFieldType === "STATUS_ASSIGNEE") && (bFieldType === "GROUP_SELECT" || bFieldType === "ORGANIZATION_SELECT" || bFieldType === "USER_SELECT" || bFieldType === "STATUS_ASSIGNEE")) {
|
|
655
|
+
return getFieldValueAsString(aField).localeCompare(getFieldValueAsString(bField));
|
|
656
|
+
} else if (aFieldType === "FILE" && bFieldType === "FILE") {
|
|
657
|
+
return getFieldValueAsString(aField).localeCompare(getFieldValueAsString(bField));
|
|
658
|
+
} else if (aFieldType === "SUBTABLE" && bFieldType === "SUBTABLE") {
|
|
659
|
+
return getFieldValueAsString(aField).localeCompare(getFieldValueAsString(bField));
|
|
660
|
+
}
|
|
661
|
+
return 0;
|
|
662
|
+
};
|
|
663
|
+
var getCalcFieldValueAsString = (params) => {
|
|
664
|
+
const { field: field2, property } = params;
|
|
665
|
+
const { unit, unitPosition, format } = property;
|
|
666
|
+
let fieldValue = "";
|
|
667
|
+
switch (format) {
|
|
668
|
+
case "NUMBER_DIGIT":
|
|
669
|
+
if (property.displayScale) {
|
|
670
|
+
const displayScale = Number(property.displayScale || 0);
|
|
671
|
+
const scaled = Math.round(Number(field2.value) * 10 ** displayScale) / 10 ** displayScale;
|
|
672
|
+
fieldValue = scaled.toLocaleString();
|
|
673
|
+
} else {
|
|
674
|
+
fieldValue = Number(field2.value).toLocaleString();
|
|
675
|
+
}
|
|
676
|
+
break;
|
|
677
|
+
case "DATE":
|
|
678
|
+
fieldValue = new Date(field2.value).toLocaleDateString();
|
|
679
|
+
break;
|
|
680
|
+
case "TIME":
|
|
681
|
+
fieldValue = new Date(field2.value).toLocaleTimeString();
|
|
682
|
+
break;
|
|
683
|
+
case "DATETIME":
|
|
684
|
+
fieldValue = new Date(field2.value).toLocaleString();
|
|
685
|
+
break;
|
|
686
|
+
case "HOUR_MINUTE":
|
|
687
|
+
const [h, m] = field2.value.split(":");
|
|
688
|
+
fieldValue = `${h}\u6642\u9593${m}\u5206`;
|
|
689
|
+
break;
|
|
690
|
+
case "DAY_HOUR_MINUTE":
|
|
691
|
+
const [hourString, minute] = field2.value.split(":");
|
|
692
|
+
const hour = Number(hourString);
|
|
693
|
+
const day = Math.floor(hour / 24);
|
|
694
|
+
const hourInDay = hour % 24;
|
|
695
|
+
fieldValue = `${day}\u65E5${hourInDay}\u6642\u9593${minute}\u5206`;
|
|
696
|
+
break;
|
|
697
|
+
default:
|
|
698
|
+
fieldValue = field2.value;
|
|
699
|
+
}
|
|
700
|
+
if (unit) {
|
|
701
|
+
if (unitPosition === "BEFORE") {
|
|
702
|
+
fieldValue = unit + fieldValue;
|
|
703
|
+
} else {
|
|
704
|
+
fieldValue += unit;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
return fieldValue;
|
|
708
|
+
};
|
|
709
|
+
var getEmptyValue = (params) => {
|
|
710
|
+
let type;
|
|
711
|
+
if ("type" in params) {
|
|
712
|
+
type = params.type;
|
|
713
|
+
} else {
|
|
714
|
+
type = params.field.type;
|
|
715
|
+
}
|
|
716
|
+
switch (type) {
|
|
717
|
+
case "__ID__":
|
|
718
|
+
case "__REVISION__":
|
|
719
|
+
case "CALC":
|
|
720
|
+
case "CREATED_TIME":
|
|
721
|
+
case "UPDATED_TIME":
|
|
722
|
+
case "CREATOR":
|
|
723
|
+
case "MODIFIER":
|
|
724
|
+
if ("field" in params) {
|
|
725
|
+
console.warn(
|
|
726
|
+
`[kintone-utilities]: ${params.field.type}\u306F\u30AF\u30EA\u30A2\u3067\u304D\u306A\u3044\u305F\u3081\u3001\u51E6\u7406\u3092\u30B9\u30AD\u30C3\u30D7\u3057\u307E\u3057\u305F`
|
|
727
|
+
);
|
|
728
|
+
return params.field.value;
|
|
729
|
+
}
|
|
730
|
+
return null;
|
|
731
|
+
case "SINGLE_LINE_TEXT":
|
|
732
|
+
case "NUMBER":
|
|
733
|
+
case "MULTI_LINE_TEXT":
|
|
734
|
+
case "RICH_TEXT":
|
|
735
|
+
case "DATE":
|
|
736
|
+
case "TIME":
|
|
737
|
+
case "DATETIME":
|
|
738
|
+
case "DROP_DOWN":
|
|
739
|
+
case "LINK":
|
|
740
|
+
case "RECORD_NUMBER":
|
|
741
|
+
case "STATUS":
|
|
742
|
+
case "RADIO_BUTTON":
|
|
743
|
+
return "";
|
|
744
|
+
case "CATEGORY":
|
|
745
|
+
case "CHECK_BOX":
|
|
746
|
+
case "MULTI_SELECT":
|
|
747
|
+
case "USER_SELECT":
|
|
748
|
+
case "GROUP_SELECT":
|
|
749
|
+
case "ORGANIZATION_SELECT":
|
|
750
|
+
case "STATUS_ASSIGNEE":
|
|
751
|
+
case "FILE":
|
|
752
|
+
return [];
|
|
753
|
+
case "SUBTABLE":
|
|
754
|
+
if ("field" in params) {
|
|
755
|
+
return params.field.value.map((row) => ({
|
|
756
|
+
...row,
|
|
757
|
+
value: Object.entries(row.value).reduce(
|
|
758
|
+
(acc, [key, cell]) => ({ ...acc, [key]: getEmptyValue(cell) }),
|
|
759
|
+
{}
|
|
760
|
+
)
|
|
761
|
+
}));
|
|
762
|
+
}
|
|
763
|
+
default:
|
|
764
|
+
throw new Error(`\u672A\u5BFE\u5FDC\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u30BF\u30A4\u30D7\u3067\u3059: ${field.type}`);
|
|
765
|
+
}
|
|
766
|
+
};
|
|
767
|
+
var getDefaultValue = (property) => {
|
|
768
|
+
switch (property.type) {
|
|
769
|
+
case "SINGLE_LINE_TEXT":
|
|
770
|
+
case "NUMBER":
|
|
771
|
+
case "MULTI_LINE_TEXT":
|
|
772
|
+
case "RICH_TEXT":
|
|
773
|
+
case "DROP_DOWN":
|
|
774
|
+
case "RADIO_BUTTON":
|
|
775
|
+
case "LINK":
|
|
776
|
+
return "defaultValue" in property ? property.defaultValue ?? "" : "";
|
|
777
|
+
case "DATE":
|
|
778
|
+
const { defaultValue, defaultNowValue } = property;
|
|
779
|
+
if (defaultValue) {
|
|
780
|
+
return defaultValue;
|
|
781
|
+
}
|
|
782
|
+
return defaultNowValue ? (/* @__PURE__ */ new Date()).toISOString().split("T")[0] : "";
|
|
783
|
+
case "TIME":
|
|
784
|
+
const { defaultNowValue: n, defaultValue: v } = property;
|
|
785
|
+
if (v) {
|
|
786
|
+
return v;
|
|
787
|
+
}
|
|
788
|
+
return n ? (/* @__PURE__ */ new Date()).toISOString().split("T")[1].split(".")[0] : "";
|
|
789
|
+
case "DATETIME":
|
|
790
|
+
const { defaultNowValue: now, defaultValue: value } = property;
|
|
791
|
+
if (value) {
|
|
792
|
+
return value;
|
|
793
|
+
}
|
|
794
|
+
return now ? (/* @__PURE__ */ new Date()).toISOString() : "";
|
|
795
|
+
case "CHECK_BOX":
|
|
796
|
+
case "MULTI_SELECT":
|
|
797
|
+
case "USER_SELECT":
|
|
798
|
+
case "GROUP_SELECT":
|
|
799
|
+
case "ORGANIZATION_SELECT":
|
|
800
|
+
if (!("defaultValue" in property)) {
|
|
801
|
+
return [];
|
|
802
|
+
}
|
|
803
|
+
const { defaultValue: d } = property;
|
|
804
|
+
return d.map((v2) => {
|
|
805
|
+
if (typeof v2 === "string") {
|
|
806
|
+
return { code: v2, name: v2 };
|
|
807
|
+
}
|
|
808
|
+
switch (v2.type) {
|
|
809
|
+
case "USER":
|
|
810
|
+
case "GROUP":
|
|
811
|
+
case "ORGANIZATION":
|
|
812
|
+
return { code: v2.code, name: v2.code };
|
|
813
|
+
case "FUNCTION":
|
|
814
|
+
if (v2.code === "LOGINUSER()") {
|
|
815
|
+
const loginUser = kintone.getLoginUser();
|
|
816
|
+
return { code: loginUser.code, name: loginUser.name };
|
|
817
|
+
}
|
|
818
|
+
return [];
|
|
819
|
+
default:
|
|
820
|
+
return [];
|
|
821
|
+
}
|
|
822
|
+
});
|
|
823
|
+
case "STATUS":
|
|
824
|
+
case "CATEGORY":
|
|
825
|
+
case "RECORD_NUMBER":
|
|
826
|
+
return null;
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
var compareField = (field1, field2, options) => {
|
|
830
|
+
const { ignoresType = false } = options ?? {};
|
|
831
|
+
if (!ignoresType && field1.type !== field2.type) {
|
|
832
|
+
return false;
|
|
833
|
+
}
|
|
834
|
+
const separator = "$";
|
|
835
|
+
return getFieldValueAsString(field1, { separator }) === getFieldValueAsString(field2, { separator });
|
|
836
|
+
};
|
|
837
|
+
var withMobileEvents = (events) => {
|
|
838
|
+
const mobileEvents = events.filter((e) => !/^mobile/.test(e)).map((type) => "mobile." + type);
|
|
839
|
+
return [.../* @__PURE__ */ new Set([...events, ...mobileEvents])];
|
|
840
|
+
};
|
|
841
|
+
var detectGuestSpaceId = () => {
|
|
842
|
+
const match = location.pathname.match(/^\/k\/guest\/(\d+)\//);
|
|
843
|
+
return match ? match[1] : null;
|
|
844
|
+
};
|
|
845
|
+
var onFileLoad = (file, options) => {
|
|
846
|
+
const { encoding = "utf-8" } = options ?? {};
|
|
847
|
+
return new Promise((resolve, reject) => {
|
|
848
|
+
try {
|
|
849
|
+
const reader = new FileReader();
|
|
850
|
+
reader.readAsText(file, encoding);
|
|
851
|
+
reader.onload = (event) => resolve(event);
|
|
852
|
+
reader.onerror = (event) => reject(event);
|
|
853
|
+
} catch (error) {
|
|
854
|
+
reject(error);
|
|
855
|
+
}
|
|
856
|
+
});
|
|
857
|
+
};
|
|
858
|
+
var getSortFromQuery = (query) => {
|
|
859
|
+
const sort = query.match(/order by (.*)?(?=( limit | offset|$))/)?.[1];
|
|
860
|
+
if (!sort) {
|
|
861
|
+
return [];
|
|
862
|
+
}
|
|
863
|
+
return sort.split(",").map((s) => {
|
|
864
|
+
const [field2, order] = s.trim().split(" ");
|
|
865
|
+
return { field: field2, order };
|
|
866
|
+
});
|
|
867
|
+
};
|
|
868
|
+
|
|
869
|
+
// src/event-manager.ts
|
|
870
|
+
var KintoneEventManager = class {
|
|
871
|
+
#uid = Math.random().toString(36).slice(2);
|
|
872
|
+
#pluginId;
|
|
873
|
+
#commonErrorHandler;
|
|
874
|
+
#guestSpaceId;
|
|
875
|
+
#logDisabled;
|
|
876
|
+
#logPrefix;
|
|
877
|
+
/**
|
|
878
|
+
* 複数の処理を、各イベントに登録することができます
|
|
879
|
+
*/
|
|
880
|
+
constructor(props) {
|
|
881
|
+
const {
|
|
882
|
+
errorHandler = (error) => {
|
|
883
|
+
throw error;
|
|
884
|
+
},
|
|
885
|
+
pluginId,
|
|
886
|
+
logDisabled = false,
|
|
887
|
+
logPrefix = ""
|
|
888
|
+
} = props ?? {};
|
|
889
|
+
const guestSpaceId = detectGuestSpaceId();
|
|
890
|
+
this.#commonErrorHandler = errorHandler;
|
|
891
|
+
this.#pluginId = pluginId;
|
|
892
|
+
this.#guestSpaceId = guestSpaceId;
|
|
893
|
+
this.#logDisabled = logDisabled;
|
|
894
|
+
this.#logPrefix = logPrefix;
|
|
895
|
+
}
|
|
896
|
+
/**
|
|
897
|
+
* **この関数は`kintone.events.on`の代替関数です. 引数に互換性があります.**
|
|
898
|
+
*
|
|
899
|
+
* デスクトップ版のイベントを指定することで自動的に対応するモバイル版のイベントが登録されます.
|
|
900
|
+
* また、インスタンス作成時に指定したエラーハンドラが、コールバック関数のエラー発生時に実行されます
|
|
901
|
+
* @param events
|
|
902
|
+
* @param callback
|
|
903
|
+
*/
|
|
904
|
+
add = (events, callback) => {
|
|
905
|
+
kintone.events.on(withMobileEvents(events), async (event) => {
|
|
906
|
+
try {
|
|
907
|
+
this.initialize(event);
|
|
908
|
+
return await callback(event, {
|
|
909
|
+
pluginId: this.#pluginId,
|
|
910
|
+
guestSpaceId: this.#guestSpaceId
|
|
911
|
+
});
|
|
912
|
+
} catch (error) {
|
|
913
|
+
return await this.#commonErrorHandler(error, { event });
|
|
914
|
+
} finally {
|
|
915
|
+
this.tarminate();
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
};
|
|
919
|
+
/**
|
|
920
|
+
* Changeイベントを登録します
|
|
921
|
+
*
|
|
922
|
+
* ChangeイベントはPromiseオブジェクトを返却することができません
|
|
923
|
+
* @param events
|
|
924
|
+
* @param callback
|
|
925
|
+
*/
|
|
926
|
+
addChangeEvents = (events, callback) => {
|
|
927
|
+
kintone.events.on(withMobileEvents(events), (event) => {
|
|
928
|
+
try {
|
|
929
|
+
this.initialize(event);
|
|
930
|
+
return callback(event, { pluginId: this.#pluginId, guestSpaceId: this.#guestSpaceId });
|
|
931
|
+
} catch (error) {
|
|
932
|
+
return this.#commonErrorHandler(error, { event });
|
|
933
|
+
} finally {
|
|
934
|
+
this.tarminate();
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
};
|
|
938
|
+
addHeaderButton(params) {
|
|
939
|
+
const {
|
|
940
|
+
id,
|
|
941
|
+
label,
|
|
942
|
+
color = "default",
|
|
943
|
+
onClick,
|
|
944
|
+
isButtonHidden,
|
|
945
|
+
events,
|
|
946
|
+
isTolerantToFailure = false
|
|
947
|
+
} = params;
|
|
948
|
+
this.addButtonStyle();
|
|
949
|
+
this.add(events, async (event) => {
|
|
950
|
+
if (isButtonHidden && await isButtonHidden(event)) {
|
|
951
|
+
return event;
|
|
952
|
+
}
|
|
953
|
+
if (document.getElementById(id)) {
|
|
954
|
+
return event;
|
|
955
|
+
}
|
|
956
|
+
const headerSpace = getHeaderSpace(event.type);
|
|
957
|
+
if (!headerSpace) {
|
|
958
|
+
const message = `\u30D8\u30C3\u30C0\u30FC\u306B\u30DC\u30BF\u30F3\u3092\u8FFD\u52A0\u3059\u308B\u3053\u3068\u304C\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002${event.type}\u30A4\u30D9\u30F3\u30C8\u304C\u767A\u751F\u3057\u305F\u30BF\u30A4\u30DF\u30F3\u30B0\u306B\u306F\u3001\u5BFE\u8C61\u8981\u7D20\u304C\u5B58\u5728\u3057\u306A\u3044\u53EF\u80FD\u6027\u304C\u3042\u308A\u307E\u3059`;
|
|
959
|
+
if (!isTolerantToFailure) {
|
|
960
|
+
throw new Error(message);
|
|
961
|
+
}
|
|
962
|
+
console.error(message);
|
|
963
|
+
return event;
|
|
964
|
+
}
|
|
965
|
+
const root = document.createElement("button");
|
|
966
|
+
root.id = id;
|
|
967
|
+
root.textContent = label;
|
|
968
|
+
root.className = "rkemb";
|
|
969
|
+
root.dataset.color = color;
|
|
970
|
+
root.addEventListener("click", onClick);
|
|
971
|
+
headerSpace.append(root);
|
|
972
|
+
return event;
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
addButtonStyle = () => {
|
|
976
|
+
if (document.querySelector("style[data-rkem]")) {
|
|
977
|
+
return;
|
|
978
|
+
}
|
|
979
|
+
const style = document.createElement("style");
|
|
980
|
+
style.dataset.rkem = "";
|
|
981
|
+
document.head.append(style);
|
|
982
|
+
style.textContent = `
|
|
983
|
+
|
|
984
|
+
:root {
|
|
985
|
+
--rkemb-color-blue-lighter: #57aae1;
|
|
986
|
+
--rkemb-color-blue-light: #4ba4df;
|
|
987
|
+
--rkemb-color-blue: #3498db;
|
|
988
|
+
--rkemb-color-blue-dark: #258bcf;
|
|
989
|
+
--rkemb-color-blue-darker: #2383c4;
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
.rkemb {
|
|
993
|
+
font-size: 16px;
|
|
994
|
+
font-family: Yu Gothic Meduim, "\u6E38\u30B4\u30B7\u30C3\u30AF Medium", "\u6E38\u30B4\u30B7\u30C3\u30AF\u4F53", YuGothic, "\u6E38\u30B4\u30B7\u30C3\u30AF", "\u30E1\u30A4\u30EA\u30AA", sans-serif;
|
|
995
|
+
display: inline-flex;
|
|
996
|
+
justify-content: center;
|
|
997
|
+
margin: 0 4px;
|
|
998
|
+
padding: 0 16px;
|
|
999
|
+
min-width: 160px;
|
|
1000
|
+
height: 48px;
|
|
1001
|
+
outline: none;
|
|
1002
|
+
color: #3498db;
|
|
1003
|
+
border-radius: 4px;
|
|
1004
|
+
text-align: center;
|
|
1005
|
+
line-height: 48px;
|
|
1006
|
+
transition: all 250ms ease;
|
|
1007
|
+
border: 0;
|
|
1008
|
+
border: 1px solid;
|
|
1009
|
+
}
|
|
1010
|
+
.rkemb[data-color="default"] {
|
|
1011
|
+
background-color: #f9fafb;
|
|
1012
|
+
color: var(--rkemb-color-blue);
|
|
1013
|
+
border-color: #e5e7eb;
|
|
1014
|
+
}
|
|
1015
|
+
.rkemb[data-color="default"]:hover {
|
|
1016
|
+
background-color: #f3f4f6;
|
|
1017
|
+
}
|
|
1018
|
+
.rkemb[data-color="default"]:active {
|
|
1019
|
+
background-color: #e5e7eb;
|
|
1020
|
+
color: var(--rkemb-color-blue-darker);
|
|
1021
|
+
}
|
|
1022
|
+
.rkemb[data-color="default"]:focus {
|
|
1023
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 3px #d1d5db;
|
|
1024
|
+
}
|
|
1025
|
+
.rkemb[data-color="blue"] {
|
|
1026
|
+
background-color: #eff6ff;
|
|
1027
|
+
color: var(--rkemb-color-blue);
|
|
1028
|
+
border-color: #bfdbfe;
|
|
1029
|
+
}
|
|
1030
|
+
.rkemb[data-color="blue"]:hover {
|
|
1031
|
+
background-color: #dbeafe;
|
|
1032
|
+
}
|
|
1033
|
+
.rkemb[data-color="blue"]:active {
|
|
1034
|
+
background-color: #bfdbfe;
|
|
1035
|
+
color: var(--rkemb-color-blue-darker);
|
|
1036
|
+
}
|
|
1037
|
+
.rkemb[data-color="blue"]:focus {
|
|
1038
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 3px #93c5fd;
|
|
1039
|
+
}
|
|
1040
|
+
.rkemb[data-color="red"] {
|
|
1041
|
+
background-color: #fef2f2;
|
|
1042
|
+
color: #ef4444;
|
|
1043
|
+
border-color: #fecaca;
|
|
1044
|
+
}
|
|
1045
|
+
.rkemb[data-color="red"]:hover {
|
|
1046
|
+
background-color: #fee2e2;
|
|
1047
|
+
}
|
|
1048
|
+
.rkemb[data-color="red"]:active {
|
|
1049
|
+
background-color: #fecaca;
|
|
1050
|
+
color: #dc2626;
|
|
1051
|
+
}
|
|
1052
|
+
.rkemb[data-color="red"]:focus {
|
|
1053
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 3px #fca5a5;
|
|
1054
|
+
}
|
|
1055
|
+
.rkemb[data-color="yellow"] {
|
|
1056
|
+
background-color: #fffbeb;
|
|
1057
|
+
color: #f59e0b;
|
|
1058
|
+
border-color: #fde68a;
|
|
1059
|
+
}
|
|
1060
|
+
.rkemb[data-color="yellow"]:hover {
|
|
1061
|
+
background-color: #fef3c7;
|
|
1062
|
+
}
|
|
1063
|
+
.rkemb[data-color="yellow"]:active {
|
|
1064
|
+
background-color: #fde68a;
|
|
1065
|
+
color: #d97706;
|
|
1066
|
+
}
|
|
1067
|
+
.rkemb[data-color="yellow"]:focus {
|
|
1068
|
+
box-shadow: 0 0 0 2px #fff, 0 0 0 3px #fcd34d;
|
|
1069
|
+
}
|
|
1070
|
+
`;
|
|
1071
|
+
};
|
|
1072
|
+
initialize = (event) => {
|
|
1073
|
+
window.addEventListener("beforeunload", this.beforeunload);
|
|
1074
|
+
if (!this.#logDisabled) {
|
|
1075
|
+
console.group(
|
|
1076
|
+
`${this.#logPrefix}%c${event.type} %c(${this.#uid})`,
|
|
1077
|
+
"color: #1e40af;",
|
|
1078
|
+
"color: #aaa"
|
|
1079
|
+
);
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
tarminate = () => {
|
|
1083
|
+
window.removeEventListener("beforeunload", this.beforeunload);
|
|
1084
|
+
if (!this.#logDisabled) {
|
|
1085
|
+
console.groupEnd();
|
|
1086
|
+
}
|
|
1087
|
+
};
|
|
1088
|
+
set logDisabled(value) {
|
|
1089
|
+
this.#logDisabled = value;
|
|
1090
|
+
}
|
|
1091
|
+
set logPrefix(value) {
|
|
1092
|
+
this.#logPrefix = value;
|
|
1093
|
+
}
|
|
1094
|
+
/** JavaScript中にページを離れようとした場合にアラートを表示します */
|
|
1095
|
+
beforeunload(event) {
|
|
1096
|
+
event.preventDefault();
|
|
1097
|
+
event.returnValue = "";
|
|
1098
|
+
}
|
|
1099
|
+
};
|
|
1100
|
+
var KintoneEventListener = KintoneEventManager;
|
|
1101
|
+
|
|
1102
|
+
// src/plugin/config.ts
|
|
1103
|
+
var META_PROPERTY_KEY = "$meta";
|
|
1104
|
+
var restoreStorage = (id) => {
|
|
1105
|
+
const config = kintone.plugin.app.getConfig(id);
|
|
1106
|
+
if (!Object.keys(config).length) {
|
|
1107
|
+
return null;
|
|
1108
|
+
}
|
|
1109
|
+
return Object.entries(config).reduce(
|
|
1110
|
+
(acc, [key, value]) => ({ ...acc, [key]: JSON.parse(value) }),
|
|
1111
|
+
{}
|
|
1112
|
+
);
|
|
1113
|
+
};
|
|
1114
|
+
var storeStorage = (target, callback) => {
|
|
1115
|
+
const converted = Object.entries(target).filter(([_, v]) => v !== void 0).reduce((acc, [key, value]) => ({ ...acc, [key]: JSON.stringify(value) }), {});
|
|
1116
|
+
kintone.plugin.app.setConfig(converted, callback);
|
|
1117
|
+
};
|
|
1118
|
+
var createFlatPropertyKey = (property, id) => `${property}$${id}`;
|
|
1119
|
+
var restorePluginConfig = (id, options = {}) => {
|
|
1120
|
+
const { fallback, debug = false } = options;
|
|
1121
|
+
const config = kintone.plugin.app.getConfig(id);
|
|
1122
|
+
debug && console.log("[config] \u{1F4E6} stored", config);
|
|
1123
|
+
if (!Object.keys(config).length) {
|
|
1124
|
+
return fallback ?? null;
|
|
1125
|
+
}
|
|
1126
|
+
if (!(META_PROPERTY_KEY in config)) {
|
|
1127
|
+
debug && console.warn("[config] Meta property is not found. Fallback to normal config.");
|
|
1128
|
+
return Object.entries(config).reduce(
|
|
1129
|
+
(acc, [key, value]) => ({ ...acc, [key]: JSON.parse(value) }),
|
|
1130
|
+
{}
|
|
1131
|
+
);
|
|
1132
|
+
}
|
|
1133
|
+
const meta = JSON.parse(config[META_PROPERTY_KEY]);
|
|
1134
|
+
let composed = {};
|
|
1135
|
+
const flatKeys = meta.flat.flatMap(
|
|
1136
|
+
({ ids, property }) => ids.map((id2) => createFlatPropertyKey(property, id2))
|
|
1137
|
+
);
|
|
1138
|
+
for (const { property, ids } of meta.flat) {
|
|
1139
|
+
const properties = ids.map((id2) => ({ id: id2, key: createFlatPropertyKey(property, id2) })).filter(({ key }) => {
|
|
1140
|
+
if (!(key in config)) {
|
|
1141
|
+
console.warn(`[config] Property "${key}" is not found.`);
|
|
1142
|
+
return false;
|
|
1143
|
+
}
|
|
1144
|
+
return true;
|
|
1145
|
+
}).map(({ id: id2, key }) => {
|
|
1146
|
+
return { id: id2, ...JSON.parse(config[key]) };
|
|
1147
|
+
});
|
|
1148
|
+
composed = { ...composed, [property]: properties };
|
|
1149
|
+
}
|
|
1150
|
+
const rest = Object.entries(config).reduce((acc, [key, value]) => {
|
|
1151
|
+
if (![META_PROPERTY_KEY, ...flatKeys].includes(key)) {
|
|
1152
|
+
return { ...acc, [key]: JSON.parse(value) };
|
|
1153
|
+
}
|
|
1154
|
+
return acc;
|
|
1155
|
+
}, {});
|
|
1156
|
+
debug && console.log("[config] \u{1F4E6} Composed:", { ...rest, ...composed });
|
|
1157
|
+
return { ...rest, ...composed };
|
|
1158
|
+
};
|
|
1159
|
+
var storePluginConfig = (target, options) => {
|
|
1160
|
+
const { flatProperties = [], debug = false } = options || {};
|
|
1161
|
+
const meta = {
|
|
1162
|
+
v: 1,
|
|
1163
|
+
flat: []
|
|
1164
|
+
};
|
|
1165
|
+
let decomposed = {};
|
|
1166
|
+
let appliedProperties = [];
|
|
1167
|
+
for (const property of flatProperties) {
|
|
1168
|
+
if (typeof property !== "string") {
|
|
1169
|
+
debug && console.warn("[config] Property name should be a string.");
|
|
1170
|
+
continue;
|
|
1171
|
+
}
|
|
1172
|
+
if (!(property in target) || !Array.isArray(target[property])) {
|
|
1173
|
+
debug && console.warn(`[config] Property "${property}" is not found or not an array.`);
|
|
1174
|
+
continue;
|
|
1175
|
+
}
|
|
1176
|
+
if (target[property].some((item) => !("id" in item))) {
|
|
1177
|
+
debug && console.warn(`[config] Property "${property}" has an item without "id" property.`);
|
|
1178
|
+
continue;
|
|
1179
|
+
}
|
|
1180
|
+
const ids = target[property].map((item) => item.id);
|
|
1181
|
+
const decomposedProperties = target[property].reduce((acc, item) => {
|
|
1182
|
+
const { id, ...rest } = item;
|
|
1183
|
+
const key = createFlatPropertyKey(property, id);
|
|
1184
|
+
return { ...acc, [key]: JSON.stringify(rest) };
|
|
1185
|
+
}, {});
|
|
1186
|
+
meta.flat.push({ property, ids });
|
|
1187
|
+
decomposed = { ...decomposed, ...decomposedProperties };
|
|
1188
|
+
appliedProperties.push(property);
|
|
1189
|
+
}
|
|
1190
|
+
const converted = Object.entries(target).filter(([key]) => !appliedProperties.includes(key)).reduce((acc, [key, value]) => ({ ...acc, [key]: JSON.stringify(value) }), {});
|
|
1191
|
+
const result = { [META_PROPERTY_KEY]: JSON.stringify(meta), ...converted, ...decomposed };
|
|
1192
|
+
debug && console.log("[config] \u{1F4E6} Converted:", result);
|
|
1193
|
+
return new Promise((resolve) => {
|
|
1194
|
+
kintone.plugin.app.setConfig(result, () => {
|
|
1195
|
+
resolve();
|
|
1196
|
+
});
|
|
1197
|
+
});
|
|
1198
|
+
};
|
|
1199
|
+
function setPluginProxyConfig(url, method, headers, data) {
|
|
1200
|
+
return new Promise((resolve) => {
|
|
1201
|
+
kintone.plugin.app.setProxyConfig(url, method, headers, data, () => {
|
|
1202
|
+
resolve();
|
|
1203
|
+
});
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
|
|
1207
|
+
// src/plugin/local-storage.ts
|
|
1208
|
+
var PluginLocalStorage = class {
|
|
1209
|
+
#key;
|
|
1210
|
+
#storage;
|
|
1211
|
+
constructor(key) {
|
|
1212
|
+
this.#key = key;
|
|
1213
|
+
const stored = localStorage.getItem(this.#key) ?? "{}";
|
|
1214
|
+
this.#storage = JSON.parse(stored);
|
|
1215
|
+
}
|
|
1216
|
+
save() {
|
|
1217
|
+
localStorage.setItem(this.#key, JSON.stringify(this.#storage));
|
|
1218
|
+
}
|
|
1219
|
+
updateVersion = (currentVersion) => {
|
|
1220
|
+
const latestVersion = this.#storage.latestVersion ?? currentVersion;
|
|
1221
|
+
this.#storage.version = currentVersion;
|
|
1222
|
+
const [latestMajor, latestMinor] = latestVersion.split(".").map((v) => parseInt(v, 10));
|
|
1223
|
+
const [currentMajor, currentMinor] = currentVersion.split(".").map((v) => parseInt(v, 10));
|
|
1224
|
+
this.#storage.hasNewVersion = latestMajor > currentMajor || latestMajor === currentMajor && latestMinor > currentMinor;
|
|
1225
|
+
this.save();
|
|
1226
|
+
};
|
|
1227
|
+
get hasNewVersion() {
|
|
1228
|
+
return this.#storage.hasNewVersion ?? false;
|
|
1229
|
+
}
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
// src/rest-api/common.ts
|
|
1233
|
+
var buildPath2 = (params) => {
|
|
1234
|
+
const { endpointName, guestSpaceId, preview } = params;
|
|
1235
|
+
const guestPath = guestSpaceId !== void 0 ? `/guest/${guestSpaceId}` : "";
|
|
1236
|
+
const previewPath = preview ? "/preview" : "";
|
|
1237
|
+
return `/k${guestPath}/v1${previewPath}/${endpointName}.json`;
|
|
1238
|
+
};
|
|
1239
|
+
var api2 = async (params) => {
|
|
1240
|
+
const { endpointName, method, body, guestSpaceId, preview, debug } = params;
|
|
1241
|
+
try {
|
|
1242
|
+
checkBrowser2();
|
|
1243
|
+
const path = buildPath2({ endpointName, guestSpaceId, preview });
|
|
1244
|
+
if (debug) {
|
|
1245
|
+
console.log(`%ckintone REST API %c(${endpointName})`, "color: #1e40af;", "color: #aaa", {
|
|
1246
|
+
path,
|
|
1247
|
+
method,
|
|
1248
|
+
body
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
const response = await kintone.api(path, method, body);
|
|
1252
|
+
if (debug) {
|
|
1253
|
+
console.log("response", response);
|
|
1254
|
+
}
|
|
1255
|
+
return response;
|
|
1256
|
+
} catch (error) {
|
|
1257
|
+
if (debug) {
|
|
1258
|
+
console.error(error);
|
|
1259
|
+
}
|
|
1260
|
+
throw error;
|
|
1261
|
+
} finally {
|
|
1262
|
+
if (debug) {
|
|
1263
|
+
console.groupEnd();
|
|
1264
|
+
}
|
|
1265
|
+
}
|
|
1266
|
+
};
|
|
1267
|
+
var checkBrowser2 = () => {
|
|
1268
|
+
if (typeof window === "undefined") {
|
|
1269
|
+
throw new Error("\u3053\u306E\u95A2\u6570\u306F\u30D6\u30E9\u30A6\u30B6\u3067\u306E\u307F\u4F7F\u7528\u3067\u304D\u307E\u3059");
|
|
1270
|
+
}
|
|
1271
|
+
if (typeof kintone === "undefined") {
|
|
1272
|
+
throw new Error("kintone\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093");
|
|
1273
|
+
}
|
|
1274
|
+
};
|
|
1275
|
+
var sliceIntoChunks = (array, size) => {
|
|
1276
|
+
const result = [];
|
|
1277
|
+
for (let i = 0, j = array.length; i < j; i += size) {
|
|
1278
|
+
result.push(array.slice(i, i + size));
|
|
1279
|
+
}
|
|
1280
|
+
return result;
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
// src/rest-api/app.ts
|
|
1284
|
+
var API_LIMIT_APP = 100;
|
|
1285
|
+
var API_ENDPOINT_APP = `app`;
|
|
1286
|
+
var API_ENDPOINT_APPS = `apps`;
|
|
1287
|
+
var API_ENDPOINT_VIEWS = "app/views";
|
|
1288
|
+
var API_ENDPOINT_FORM_FIELDS = "app/form/fields";
|
|
1289
|
+
var API_ENDPOINT_FORM_LAYOUT = "app/form/layout";
|
|
1290
|
+
var API_ENDPOINT_APP_SETTINGS = "app/settings";
|
|
1291
|
+
var getApp = async (params) => {
|
|
1292
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1293
|
+
return api2({
|
|
1294
|
+
endpointName: API_ENDPOINT_APP,
|
|
1295
|
+
method: "GET",
|
|
1296
|
+
body: requestParams,
|
|
1297
|
+
debug,
|
|
1298
|
+
guestSpaceId
|
|
1299
|
+
});
|
|
1300
|
+
};
|
|
1301
|
+
var getApps = async (params) => {
|
|
1302
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1303
|
+
return api2({
|
|
1304
|
+
endpointName: API_ENDPOINT_APPS,
|
|
1305
|
+
method: "GET",
|
|
1306
|
+
body: requestParams,
|
|
1307
|
+
debug,
|
|
1308
|
+
guestSpaceId
|
|
1309
|
+
});
|
|
1310
|
+
};
|
|
1311
|
+
var getAllApps = async (params = {}) => {
|
|
1312
|
+
const { offset = 0, _apps = [], debug, guestSpaceId } = params;
|
|
1313
|
+
const { apps } = await getApps({ limit: API_LIMIT_APP, offset, debug, guestSpaceId });
|
|
1314
|
+
const allApps = [..._apps, ...apps];
|
|
1315
|
+
return apps.length === API_LIMIT_APP ? getAllApps({ offset: offset + API_LIMIT_APP, _apps: allApps, debug, guestSpaceId }) : allApps;
|
|
1316
|
+
};
|
|
1317
|
+
var getViews = async (params) => {
|
|
1318
|
+
const { app, preview = false, lang = "default", debug, guestSpaceId } = params;
|
|
1319
|
+
return api2({
|
|
1320
|
+
endpointName: API_ENDPOINT_VIEWS,
|
|
1321
|
+
method: "GET",
|
|
1322
|
+
body: { app, lang },
|
|
1323
|
+
preview,
|
|
1324
|
+
debug,
|
|
1325
|
+
guestSpaceId
|
|
1326
|
+
});
|
|
1327
|
+
};
|
|
1328
|
+
var updateViews = async (params) => {
|
|
1329
|
+
const { app, views, debug, guestSpaceId } = params;
|
|
1330
|
+
return api2({
|
|
1331
|
+
endpointName: API_ENDPOINT_VIEWS,
|
|
1332
|
+
method: "PUT",
|
|
1333
|
+
body: { app, views },
|
|
1334
|
+
preview: true,
|
|
1335
|
+
debug,
|
|
1336
|
+
guestSpaceId
|
|
1337
|
+
});
|
|
1338
|
+
};
|
|
1339
|
+
var getFormFields = async (params) => {
|
|
1340
|
+
const { app, preview = false, debug, guestSpaceId } = params;
|
|
1341
|
+
return api2({
|
|
1342
|
+
endpointName: API_ENDPOINT_FORM_FIELDS,
|
|
1343
|
+
method: "GET",
|
|
1344
|
+
body: { app },
|
|
1345
|
+
preview,
|
|
1346
|
+
debug,
|
|
1347
|
+
guestSpaceId
|
|
1348
|
+
});
|
|
1349
|
+
};
|
|
1350
|
+
var getFormLayout = async (params) => {
|
|
1351
|
+
const { app, preview = false, debug, guestSpaceId } = params;
|
|
1352
|
+
return api2({
|
|
1353
|
+
endpointName: API_ENDPOINT_FORM_LAYOUT,
|
|
1354
|
+
method: "GET",
|
|
1355
|
+
body: { app },
|
|
1356
|
+
preview,
|
|
1357
|
+
debug,
|
|
1358
|
+
guestSpaceId
|
|
1359
|
+
});
|
|
1360
|
+
};
|
|
1361
|
+
var getAppSettings = async (params) => {
|
|
1362
|
+
const { app, preview = false, debug, guestSpaceId } = params;
|
|
1363
|
+
return api2({
|
|
1364
|
+
endpointName: API_ENDPOINT_APP_SETTINGS,
|
|
1365
|
+
method: "GET",
|
|
1366
|
+
body: { app },
|
|
1367
|
+
preview,
|
|
1368
|
+
debug,
|
|
1369
|
+
guestSpaceId
|
|
1370
|
+
});
|
|
1371
|
+
};
|
|
1372
|
+
|
|
1373
|
+
// src/rest-api/record.ts
|
|
1374
|
+
var API_ENDPOINT_RECORD = `record`;
|
|
1375
|
+
var API_ENDPOINT_RECORDS = `records`;
|
|
1376
|
+
var API_ENDPOINT_CURSOR = `records/cursor`;
|
|
1377
|
+
var API_ENDPOINT_ASSIGNEES = `record/assignees`;
|
|
1378
|
+
var API_ENDPOINT_RECORD_STATUS = `record/status`;
|
|
1379
|
+
var API_ENDPOINT_RECORD_STATUSES = `records/status`;
|
|
1380
|
+
var API_ENDPOINT_ACL_EVALUATE = `records/acl/evaluate`;
|
|
1381
|
+
var API_ENDPOINT_BULK = `bulkRequest`;
|
|
1382
|
+
var API_LIMIT_GET = 500;
|
|
1383
|
+
var API_LIMIT_PUT = 100;
|
|
1384
|
+
var API_LIMIT_POST = 100;
|
|
1385
|
+
var API_LIMIT_DELETE = 100;
|
|
1386
|
+
var API_LIMIT_BULK_REQUEST = 20;
|
|
1387
|
+
var backdoor = async (params) => {
|
|
1388
|
+
checkBrowser2();
|
|
1389
|
+
const { apiToken, method, path, body } = params;
|
|
1390
|
+
const header = {
|
|
1391
|
+
"X-Cybozu-API-Token": apiToken
|
|
1392
|
+
};
|
|
1393
|
+
if (method !== "GET") {
|
|
1394
|
+
header["Content-Type"] = "application/json";
|
|
1395
|
+
}
|
|
1396
|
+
const uri = kintone.api.url(path, true);
|
|
1397
|
+
const response = await kintone.proxy(uri, method, header, body);
|
|
1398
|
+
if (response[1] !== 200) {
|
|
1399
|
+
throw new Error(`Backdoor API Error: ${response[1]} ${response[0]}`);
|
|
1400
|
+
}
|
|
1401
|
+
return JSON.parse(response[0]);
|
|
1402
|
+
};
|
|
1403
|
+
var getRecord = async (params) => {
|
|
1404
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1405
|
+
const { record } = await api2({
|
|
1406
|
+
endpointName: API_ENDPOINT_RECORD,
|
|
1407
|
+
method: "GET",
|
|
1408
|
+
body: requestParams,
|
|
1409
|
+
debug,
|
|
1410
|
+
guestSpaceId
|
|
1411
|
+
});
|
|
1412
|
+
return record;
|
|
1413
|
+
};
|
|
1414
|
+
var backdoorGetRecord = async (params) => {
|
|
1415
|
+
const { app, id, apiToken } = params;
|
|
1416
|
+
const { record } = await backdoor({
|
|
1417
|
+
apiToken,
|
|
1418
|
+
method: "GET",
|
|
1419
|
+
path: API_ENDPOINT_RECORD,
|
|
1420
|
+
body: { app, id }
|
|
1421
|
+
});
|
|
1422
|
+
return record;
|
|
1423
|
+
};
|
|
1424
|
+
var getRecords = async (params) => {
|
|
1425
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1426
|
+
return await api2({
|
|
1427
|
+
endpointName: API_ENDPOINT_RECORDS,
|
|
1428
|
+
method: "GET",
|
|
1429
|
+
body: requestParams,
|
|
1430
|
+
debug,
|
|
1431
|
+
guestSpaceId
|
|
1432
|
+
});
|
|
1433
|
+
};
|
|
1434
|
+
var updateRecord = async (params) => {
|
|
1435
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1436
|
+
return api2({
|
|
1437
|
+
endpointName: API_ENDPOINT_RECORD,
|
|
1438
|
+
method: "PUT",
|
|
1439
|
+
body: requestParams,
|
|
1440
|
+
debug,
|
|
1441
|
+
guestSpaceId
|
|
1442
|
+
});
|
|
1443
|
+
};
|
|
1444
|
+
var addRecord = async (params) => {
|
|
1445
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1446
|
+
return api2({
|
|
1447
|
+
endpointName: API_ENDPOINT_RECORD,
|
|
1448
|
+
method: "POST",
|
|
1449
|
+
body: requestParams,
|
|
1450
|
+
debug,
|
|
1451
|
+
guestSpaceId
|
|
1452
|
+
});
|
|
1453
|
+
};
|
|
1454
|
+
var addRecords = async (params) => {
|
|
1455
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1456
|
+
return api2({
|
|
1457
|
+
endpointName: API_ENDPOINT_RECORDS,
|
|
1458
|
+
method: "POST",
|
|
1459
|
+
body: requestParams,
|
|
1460
|
+
debug,
|
|
1461
|
+
guestSpaceId
|
|
1462
|
+
});
|
|
1463
|
+
};
|
|
1464
|
+
var upsertRecord = async (params) => {
|
|
1465
|
+
const { record, updateKey, app, ...rest } = params;
|
|
1466
|
+
const { records } = await getRecords({
|
|
1467
|
+
app,
|
|
1468
|
+
query: `${updateKey.field} = "${updateKey.value}"`,
|
|
1469
|
+
fields: ["$id"],
|
|
1470
|
+
...rest
|
|
1471
|
+
});
|
|
1472
|
+
if (records.length) {
|
|
1473
|
+
const res = await updateRecord({
|
|
1474
|
+
app,
|
|
1475
|
+
record,
|
|
1476
|
+
id: records[0].$id.value,
|
|
1477
|
+
...rest
|
|
1478
|
+
});
|
|
1479
|
+
return { id: records[0].$id.value, revision: res.revision };
|
|
1480
|
+
}
|
|
1481
|
+
return addRecord({ app, record, ...rest });
|
|
1482
|
+
};
|
|
1483
|
+
var updateAllRecords = async (params) => {
|
|
1484
|
+
const { onProgress, debug, guestSpaceId, ...requestParams } = params;
|
|
1485
|
+
const response = await bulkRequest({
|
|
1486
|
+
requests: [{ type: "updateAllRecords", params: requestParams }],
|
|
1487
|
+
onProgress,
|
|
1488
|
+
debug,
|
|
1489
|
+
guestSpaceId
|
|
1490
|
+
});
|
|
1491
|
+
return response.results.reduce(
|
|
1492
|
+
(acc, result) => {
|
|
1493
|
+
return { records: [...acc.records, ...result.records] };
|
|
1494
|
+
},
|
|
1495
|
+
{ records: [] }
|
|
1496
|
+
);
|
|
1497
|
+
};
|
|
1498
|
+
var addAllRecords = async (params) => {
|
|
1499
|
+
const { onProgress, debug, guestSpaceId, ...requestParams } = params;
|
|
1500
|
+
if (requestParams.records.length === 0) {
|
|
1501
|
+
if (debug) {
|
|
1502
|
+
console.log("\u{1F615} %caddAllRecords: No records to add", "color: #fbbf24");
|
|
1503
|
+
}
|
|
1504
|
+
return { ids: [], revisions: [] };
|
|
1505
|
+
}
|
|
1506
|
+
const responses = await bulkRequest({
|
|
1507
|
+
requests: [{ type: "addAllRecords", params: requestParams }],
|
|
1508
|
+
onProgress,
|
|
1509
|
+
debug,
|
|
1510
|
+
guestSpaceId
|
|
1511
|
+
});
|
|
1512
|
+
return responses.results.reduce(
|
|
1513
|
+
(acc, result) => {
|
|
1514
|
+
return {
|
|
1515
|
+
ids: [...acc.ids, ...result.ids],
|
|
1516
|
+
revisions: [...acc.revisions, ...result.revisions]
|
|
1517
|
+
};
|
|
1518
|
+
},
|
|
1519
|
+
{ ids: [], revisions: [] }
|
|
1520
|
+
);
|
|
1521
|
+
};
|
|
1522
|
+
var deleteAllRecords = async (params) => {
|
|
1523
|
+
const { onProgress, debug, guestSpaceId, ...requestParams } = params;
|
|
1524
|
+
return bulkRequest({
|
|
1525
|
+
requests: [{ type: "deleteRecords", params: requestParams }],
|
|
1526
|
+
onProgress,
|
|
1527
|
+
debug,
|
|
1528
|
+
guestSpaceId
|
|
1529
|
+
});
|
|
1530
|
+
};
|
|
1531
|
+
var deleteAllRecordsByQuery = async (params) => {
|
|
1532
|
+
const { onProgress, debug, guestSpaceId, app, query } = params;
|
|
1533
|
+
const fields = ["$id"];
|
|
1534
|
+
const records = await getAllRecords({ app, query, fields, debug, guestSpaceId });
|
|
1535
|
+
const ids = records.map((record) => Number(record.$id.value));
|
|
1536
|
+
return bulkRequest({
|
|
1537
|
+
requests: [{ type: "deleteRecords", params: { app, ids } }],
|
|
1538
|
+
onProgress,
|
|
1539
|
+
debug,
|
|
1540
|
+
guestSpaceId
|
|
1541
|
+
});
|
|
1542
|
+
};
|
|
1543
|
+
var getAllRecords = async (params) => {
|
|
1544
|
+
if (params.query && /limit \d+/.test(params.query)) {
|
|
1545
|
+
const { records } = await getRecords(params);
|
|
1546
|
+
return records;
|
|
1547
|
+
}
|
|
1548
|
+
if (params.query && params.query.includes("order by")) {
|
|
1549
|
+
return getAllRecordsWithCursor(params);
|
|
1550
|
+
}
|
|
1551
|
+
return getAllRecordsWithId({ ...params, condition: params.query });
|
|
1552
|
+
};
|
|
1553
|
+
var getAllRecordsWithId = async (params) => {
|
|
1554
|
+
const { fields: initFields, condition: initCondition = "", debug } = params;
|
|
1555
|
+
const fields = initFields?.length ? [.../* @__PURE__ */ new Set([...initFields, "$id"])] : void 0;
|
|
1556
|
+
const condition = initCondition.replace(/order by.*/g, "");
|
|
1557
|
+
if (debug) {
|
|
1558
|
+
console.groupCollapsed("\u{1F4E6} %cgetAllRecordsWithId", "color: #1e40af");
|
|
1559
|
+
}
|
|
1560
|
+
try {
|
|
1561
|
+
const records = await getRecursive({ ...params, fields, condition });
|
|
1562
|
+
return records;
|
|
1563
|
+
} finally {
|
|
1564
|
+
if (debug) {
|
|
1565
|
+
console.groupEnd();
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
};
|
|
1569
|
+
var getRecursive = async (params) => {
|
|
1570
|
+
const { app, fields, condition, id, debug, guestSpaceId } = params;
|
|
1571
|
+
const newCondition = id ? `${condition ? `(${condition}) and ` : ""} $id < ${id}` : condition;
|
|
1572
|
+
const query = `${newCondition} order by $id desc limit ${API_LIMIT_GET}`;
|
|
1573
|
+
const { records } = await api2({
|
|
1574
|
+
endpointName: API_ENDPOINT_RECORDS,
|
|
1575
|
+
method: "GET",
|
|
1576
|
+
body: { app, fields, query },
|
|
1577
|
+
debug,
|
|
1578
|
+
guestSpaceId
|
|
1579
|
+
});
|
|
1580
|
+
if (!records.length) {
|
|
1581
|
+
return params.stored ?? [];
|
|
1582
|
+
}
|
|
1583
|
+
const stored = [...params.stored ?? [], ...records];
|
|
1584
|
+
if (params.onStep) {
|
|
1585
|
+
params.onStep({ records: stored, incremental: records });
|
|
1586
|
+
}
|
|
1587
|
+
const lastRecord = stored[stored.length - 1];
|
|
1588
|
+
const lastId = lastRecord.$id.value;
|
|
1589
|
+
return records.length === API_LIMIT_GET ? getRecursive({ ...params, id: lastId, stored }) : stored;
|
|
1590
|
+
};
|
|
1591
|
+
var getAllRecordsWithCursor = async (params) => {
|
|
1592
|
+
const {
|
|
1593
|
+
app,
|
|
1594
|
+
fields = [],
|
|
1595
|
+
query = "",
|
|
1596
|
+
onTotalGet = null,
|
|
1597
|
+
onStep = null,
|
|
1598
|
+
debug,
|
|
1599
|
+
guestSpaceId
|
|
1600
|
+
} = params;
|
|
1601
|
+
if (debug) {
|
|
1602
|
+
console.groupCollapsed("\u{1F4E6} %cgetAllRecordsWithCursor", "color: #1e40af");
|
|
1603
|
+
}
|
|
1604
|
+
try {
|
|
1605
|
+
const param = { app, fields, size: API_LIMIT_GET, query };
|
|
1606
|
+
const cursor = await api2({
|
|
1607
|
+
endpointName: API_ENDPOINT_CURSOR,
|
|
1608
|
+
method: "POST",
|
|
1609
|
+
body: param,
|
|
1610
|
+
debug,
|
|
1611
|
+
guestSpaceId
|
|
1612
|
+
});
|
|
1613
|
+
if (onTotalGet) {
|
|
1614
|
+
onTotalGet({
|
|
1615
|
+
total: Number(cursor.totalCount)
|
|
1616
|
+
});
|
|
1617
|
+
}
|
|
1618
|
+
const records = await getRecordsByCursorId({ id: cursor.id, onStep, debug, guestSpaceId });
|
|
1619
|
+
return records;
|
|
1620
|
+
} finally {
|
|
1621
|
+
if (debug) {
|
|
1622
|
+
console.groupEnd();
|
|
1623
|
+
}
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
var getRecordsByCursorId = async (params) => {
|
|
1627
|
+
const { id, onStep, loadedData = [], debug, guestSpaceId } = params;
|
|
1628
|
+
const response = await api2({
|
|
1629
|
+
endpointName: API_ENDPOINT_CURSOR,
|
|
1630
|
+
method: "GET",
|
|
1631
|
+
body: { id },
|
|
1632
|
+
debug,
|
|
1633
|
+
guestSpaceId
|
|
1634
|
+
});
|
|
1635
|
+
const newRecords = [...loadedData, ...response.records];
|
|
1636
|
+
if (onStep) {
|
|
1637
|
+
onStep({ records: newRecords, incremental: response.records });
|
|
1638
|
+
}
|
|
1639
|
+
return response.next ? getRecordsByCursorId({ ...params, loadedData: newRecords }) : newRecords;
|
|
1640
|
+
};
|
|
1641
|
+
var updateRecordAssignees = async (params) => {
|
|
1642
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1643
|
+
return api2({
|
|
1644
|
+
endpointName: API_ENDPOINT_ASSIGNEES,
|
|
1645
|
+
method: "PUT",
|
|
1646
|
+
body: requestParams,
|
|
1647
|
+
debug,
|
|
1648
|
+
guestSpaceId
|
|
1649
|
+
});
|
|
1650
|
+
};
|
|
1651
|
+
var updateRecordStatus = async (params) => {
|
|
1652
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1653
|
+
return api2({
|
|
1654
|
+
endpointName: API_ENDPOINT_RECORD_STATUS,
|
|
1655
|
+
method: "PUT",
|
|
1656
|
+
body: requestParams,
|
|
1657
|
+
debug,
|
|
1658
|
+
guestSpaceId
|
|
1659
|
+
});
|
|
1660
|
+
};
|
|
1661
|
+
var updateAllRecordStatuses = async (params) => {
|
|
1662
|
+
const { onProgress, debug, guestSpaceId, ...requestParams } = params;
|
|
1663
|
+
const responses = await bulkRequest({
|
|
1664
|
+
requests: [{ type: "updateRecordStatuses", params: requestParams }],
|
|
1665
|
+
onProgress,
|
|
1666
|
+
debug,
|
|
1667
|
+
guestSpaceId
|
|
1668
|
+
});
|
|
1669
|
+
return responses.results.reduce(
|
|
1670
|
+
(acc, result) => {
|
|
1671
|
+
return {
|
|
1672
|
+
records: [...acc.records, ...result.records]
|
|
1673
|
+
};
|
|
1674
|
+
},
|
|
1675
|
+
{ records: [] }
|
|
1676
|
+
);
|
|
1677
|
+
};
|
|
1678
|
+
var getRecordACLEvaluate = async (params) => {
|
|
1679
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1680
|
+
return api2({
|
|
1681
|
+
endpointName: API_ENDPOINT_ACL_EVALUATE,
|
|
1682
|
+
method: "GET",
|
|
1683
|
+
body: requestParams,
|
|
1684
|
+
debug,
|
|
1685
|
+
guestSpaceId
|
|
1686
|
+
});
|
|
1687
|
+
};
|
|
1688
|
+
var bulkRequest = async (params) => {
|
|
1689
|
+
const { requests, debug, guestSpaceId, limit = API_LIMIT_BULK_REQUEST } = params;
|
|
1690
|
+
if (debug) {
|
|
1691
|
+
console.groupCollapsed("\u{1F4E6} %cbulkRequest", "color: #1e40af");
|
|
1692
|
+
}
|
|
1693
|
+
try {
|
|
1694
|
+
const apiTable = {
|
|
1695
|
+
updateRecord: { endpointName: API_ENDPOINT_RECORD, method: "PUT" },
|
|
1696
|
+
addRecord: { endpointName: API_ENDPOINT_RECORD, method: "POST" },
|
|
1697
|
+
updateAllRecords: { endpointName: API_ENDPOINT_RECORDS, method: "PUT" },
|
|
1698
|
+
addAllRecords: { endpointName: API_ENDPOINT_RECORDS, method: "POST" },
|
|
1699
|
+
deleteRecords: { endpointName: API_ENDPOINT_RECORDS, method: "DELETE" },
|
|
1700
|
+
updateRecordAssignees: { endpointName: API_ENDPOINT_ASSIGNEES, method: "PUT" },
|
|
1701
|
+
updateRecordStatus: { endpointName: API_ENDPOINT_RECORD_STATUS, method: "PUT" },
|
|
1702
|
+
updateRecordStatuses: { endpointName: API_ENDPOINT_RECORD_STATUSES, method: "PUT" }
|
|
1703
|
+
};
|
|
1704
|
+
let reshapedRequests = [];
|
|
1705
|
+
for (const request of requests) {
|
|
1706
|
+
const { endpointName, method } = apiTable[request.type];
|
|
1707
|
+
const api3 = buildPath2({ endpointName, guestSpaceId });
|
|
1708
|
+
if (request.type === "updateRecord" || request.type === "addRecord" || request.type === "updateRecordAssignees" || request.type === "updateRecordStatus") {
|
|
1709
|
+
reshapedRequests.push({ method, api: api3, payload: request.params });
|
|
1710
|
+
} else if (request.type === "updateAllRecords") {
|
|
1711
|
+
const { records: allRecords, ...commonRequestParams } = request.params;
|
|
1712
|
+
const recordChunks = sliceIntoChunks(allRecords, API_LIMIT_PUT);
|
|
1713
|
+
for (const records of recordChunks) {
|
|
1714
|
+
reshapedRequests.push({
|
|
1715
|
+
method,
|
|
1716
|
+
api: api3,
|
|
1717
|
+
payload: { ...commonRequestParams, records }
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
} else if (request.type === "addAllRecords") {
|
|
1721
|
+
const recordChunks = sliceIntoChunks(
|
|
1722
|
+
request.params.records,
|
|
1723
|
+
Math.min(request.params.limit ?? API_LIMIT_POST, API_LIMIT_POST)
|
|
1724
|
+
);
|
|
1725
|
+
for (const records of recordChunks) {
|
|
1726
|
+
reshapedRequests.push({ method, api: api3, payload: { ...request.params, records } });
|
|
1727
|
+
}
|
|
1728
|
+
} else if (request.type === "deleteRecords") {
|
|
1729
|
+
const idChunks = sliceIntoChunks(request.params.ids, API_LIMIT_DELETE);
|
|
1730
|
+
for (const ids of idChunks) {
|
|
1731
|
+
reshapedRequests.push({ method, api: api3, payload: { ...request.params, ids } });
|
|
1732
|
+
}
|
|
1733
|
+
} else if (request.type === "updateRecordStatuses") {
|
|
1734
|
+
const recordChunks = sliceIntoChunks(request.params.records, API_LIMIT_PUT);
|
|
1735
|
+
for (const records of recordChunks) {
|
|
1736
|
+
reshapedRequests.push({ method, api: api3, payload: { ...request.params, records } });
|
|
1737
|
+
}
|
|
1738
|
+
}
|
|
1739
|
+
}
|
|
1740
|
+
const responses = [];
|
|
1741
|
+
const requestChunks = sliceIntoChunks(
|
|
1742
|
+
reshapedRequests,
|
|
1743
|
+
Math.min(limit, API_LIMIT_BULK_REQUEST)
|
|
1744
|
+
);
|
|
1745
|
+
let done = 0;
|
|
1746
|
+
for (const requests2 of requestChunks) {
|
|
1747
|
+
const response = await api2({
|
|
1748
|
+
endpointName: API_ENDPOINT_BULK,
|
|
1749
|
+
method: "POST",
|
|
1750
|
+
body: { requests: requests2 },
|
|
1751
|
+
debug,
|
|
1752
|
+
guestSpaceId
|
|
1753
|
+
});
|
|
1754
|
+
if (debug) {
|
|
1755
|
+
done += requests2.length;
|
|
1756
|
+
console.log(
|
|
1757
|
+
`%cbulk request in progress... ${done}/${reshapedRequests.length}`,
|
|
1758
|
+
"color: #999"
|
|
1759
|
+
);
|
|
1760
|
+
}
|
|
1761
|
+
responses.push(response);
|
|
1762
|
+
if (params.onProgress) {
|
|
1763
|
+
params.onProgress({
|
|
1764
|
+
total: reshapedRequests.length,
|
|
1765
|
+
done: responses.reduce((acc, response2) => acc + response2.results.length, 0)
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
return responses.reduce(
|
|
1770
|
+
(acc, response) => {
|
|
1771
|
+
return { results: [...acc.results, ...response.results] };
|
|
1772
|
+
},
|
|
1773
|
+
{ results: [] }
|
|
1774
|
+
);
|
|
1775
|
+
} finally {
|
|
1776
|
+
if (debug) {
|
|
1777
|
+
console.groupEnd();
|
|
1778
|
+
}
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
|
|
1782
|
+
// src/rest-api/client.ts
|
|
1783
|
+
var useApi = (props) => {
|
|
1784
|
+
return {
|
|
1785
|
+
records: {
|
|
1786
|
+
$post: async (params) => {
|
|
1787
|
+
const { limit = API_LIMIT_POST, ...requestParams } = params;
|
|
1788
|
+
if (requestParams.records.length === 1) {
|
|
1789
|
+
return addRecord({ ...props, record: requestParams.records[0] }).then((res) => ({
|
|
1790
|
+
ids: [res.id],
|
|
1791
|
+
revisions: [res.revision]
|
|
1792
|
+
}));
|
|
1793
|
+
}
|
|
1794
|
+
if (requestParams.records.length <= limit) {
|
|
1795
|
+
return addRecords({ ...props, ...params });
|
|
1796
|
+
}
|
|
1797
|
+
return addAllRecords({ ...props, ...params });
|
|
1798
|
+
}
|
|
1799
|
+
}
|
|
1800
|
+
};
|
|
1801
|
+
};
|
|
1802
|
+
|
|
1803
|
+
// src/rest-api/file.ts
|
|
1804
|
+
var uploadFile = async (params) => {
|
|
1805
|
+
const { file, debug, guestSpaceId } = params;
|
|
1806
|
+
const formData = new FormData();
|
|
1807
|
+
formData.append("__REQUEST_TOKEN__", kintone.getRequestToken());
|
|
1808
|
+
formData.append("file", file.data, file.name);
|
|
1809
|
+
const headers = { "X-Requested-With": "XMLHttpRequest" };
|
|
1810
|
+
const response = await fetch(buildPath2({ endpointName: "file", guestSpaceId }), {
|
|
1811
|
+
method: "POST",
|
|
1812
|
+
headers,
|
|
1813
|
+
body: formData
|
|
1814
|
+
});
|
|
1815
|
+
return response.json();
|
|
1816
|
+
};
|
|
1817
|
+
var downloadFile = async (params) => {
|
|
1818
|
+
const { fileKey, debug, guestSpaceId } = params;
|
|
1819
|
+
const headers = { "X-Requested-With": "XMLHttpRequest" };
|
|
1820
|
+
const path = buildPath2({ endpointName: "file", guestSpaceId });
|
|
1821
|
+
const response = await fetch(`${path}?fileKey=${fileKey}`, { method: "GET", headers });
|
|
1822
|
+
return response.blob();
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
// src/rest-api/record-comment.ts
|
|
1826
|
+
var API_ENDPOINT_COMMENTS = `record/comments`;
|
|
1827
|
+
var API_ENDPOINT_COMMENT = `record/comment`;
|
|
1828
|
+
var API_LIMIT_COMMENT = 10;
|
|
1829
|
+
var getRecordComments = (props) => {
|
|
1830
|
+
return getRecursiveRecordComments(props);
|
|
1831
|
+
};
|
|
1832
|
+
var getRecursiveRecordComments = async (requestParams, stored = []) => {
|
|
1833
|
+
const offset = stored.length;
|
|
1834
|
+
const newRequest = {
|
|
1835
|
+
...requestParams,
|
|
1836
|
+
limit: API_LIMIT_COMMENT,
|
|
1837
|
+
offset
|
|
1838
|
+
};
|
|
1839
|
+
const response = await api2({
|
|
1840
|
+
endpointName: API_ENDPOINT_COMMENTS,
|
|
1841
|
+
method: "GET",
|
|
1842
|
+
body: newRequest,
|
|
1843
|
+
guestSpaceId: requestParams.guestSpaceId
|
|
1844
|
+
});
|
|
1845
|
+
const comments = [...stored, ...response.comments];
|
|
1846
|
+
return response.comments.length === API_LIMIT_COMMENT ? getRecursiveRecordComments(requestParams, comments) : comments;
|
|
1847
|
+
};
|
|
1848
|
+
var addRecordComment = (params) => {
|
|
1849
|
+
return api2({
|
|
1850
|
+
endpointName: API_ENDPOINT_COMMENT,
|
|
1851
|
+
method: "POST",
|
|
1852
|
+
body: params,
|
|
1853
|
+
guestSpaceId: params.guestSpaceId
|
|
1854
|
+
});
|
|
1855
|
+
};
|
|
1856
|
+
var deleteRecordComment = (params) => {
|
|
1857
|
+
return api2({
|
|
1858
|
+
endpointName: API_ENDPOINT_COMMENT,
|
|
1859
|
+
method: "DELETE",
|
|
1860
|
+
body: params,
|
|
1861
|
+
guestSpaceId: params.guestSpaceId
|
|
1862
|
+
});
|
|
1863
|
+
};
|
|
1864
|
+
|
|
1865
|
+
// src/rest-api/report.ts
|
|
1866
|
+
var API_ENDPOINT_REPORTS = "app/reports";
|
|
1867
|
+
var getAppCharts = (params) => {
|
|
1868
|
+
const { debug, guestSpaceId, ...requestParams } = params;
|
|
1869
|
+
return api2({
|
|
1870
|
+
endpointName: API_ENDPOINT_REPORTS,
|
|
1871
|
+
method: "GET",
|
|
1872
|
+
body: requestParams,
|
|
1873
|
+
debug,
|
|
1874
|
+
guestSpaceId
|
|
1875
|
+
});
|
|
1876
|
+
};
|
|
1877
|
+
|
|
1878
|
+
// src/rest-api/space.ts
|
|
1879
|
+
var API_ENDPOINT_SPACE = "space";
|
|
1880
|
+
var API_ENDPOINT_THREAD = "space/thread";
|
|
1881
|
+
var API_ENDPOINT_TEMPLATE = "template/space";
|
|
1882
|
+
var getSpace = (params) => {
|
|
1883
|
+
return api2({
|
|
1884
|
+
endpointName: API_ENDPOINT_SPACE,
|
|
1885
|
+
method: "GET",
|
|
1886
|
+
body: params,
|
|
1887
|
+
...params
|
|
1888
|
+
});
|
|
1889
|
+
};
|
|
1890
|
+
var createSpace = (params) => {
|
|
1891
|
+
const { guestSpaceId, debug, ...body } = params;
|
|
1892
|
+
return api2({
|
|
1893
|
+
endpointName: API_ENDPOINT_TEMPLATE,
|
|
1894
|
+
method: "POST",
|
|
1895
|
+
body,
|
|
1896
|
+
debug,
|
|
1897
|
+
guestSpaceId
|
|
1898
|
+
});
|
|
1899
|
+
};
|
|
1900
|
+
var deleteSpace = (params) => {
|
|
1901
|
+
const { guestSpaceId, debug, ...body } = params;
|
|
1902
|
+
return api2({
|
|
1903
|
+
endpointName: API_ENDPOINT_SPACE,
|
|
1904
|
+
method: "DELETE",
|
|
1905
|
+
body,
|
|
1906
|
+
debug,
|
|
1907
|
+
guestSpaceId
|
|
1908
|
+
});
|
|
1909
|
+
};
|
|
1910
|
+
var updateThread = (params) => {
|
|
1911
|
+
const { guestSpaceId, debug, ...body } = params;
|
|
1912
|
+
return api2({
|
|
1913
|
+
endpointName: API_ENDPOINT_THREAD,
|
|
1914
|
+
method: "PUT",
|
|
1915
|
+
body,
|
|
1916
|
+
debug,
|
|
1917
|
+
guestSpaceId
|
|
1918
|
+
});
|
|
1919
|
+
};
|
|
1920
|
+
|
|
1921
|
+
// src/rest-api/utility.ts
|
|
1922
|
+
var filterFieldProperties = (properties, callback) => {
|
|
1923
|
+
const filtered = Object.entries(properties).filter(([_, value]) => callback(value));
|
|
1924
|
+
const reduced = filtered.reduce(
|
|
1925
|
+
(acc, [key, value]) => ({ ...acc, [key]: value }),
|
|
1926
|
+
{}
|
|
1927
|
+
);
|
|
1928
|
+
return reduced;
|
|
1929
|
+
};
|
|
1930
|
+
var withSpaceIdFallback = async (params) => {
|
|
1931
|
+
const { spaceId, func, funcParams } = params;
|
|
1932
|
+
try {
|
|
1933
|
+
const response = await func(funcParams);
|
|
1934
|
+
return response;
|
|
1935
|
+
} catch (error) {
|
|
1936
|
+
if (["GAIA_IL23", "GAIA_IL25"].includes(error.code)) {
|
|
1937
|
+
const response = await func({ ...funcParams, guestSpaceId: spaceId });
|
|
1938
|
+
return response;
|
|
1939
|
+
}
|
|
1940
|
+
throw error;
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
var isGuestSpace = async (appId) => {
|
|
1944
|
+
try {
|
|
1945
|
+
await getRecords({ app: appId });
|
|
1946
|
+
} catch (error) {
|
|
1947
|
+
return error.code === "GAIA_IL23";
|
|
1948
|
+
}
|
|
1949
|
+
return false;
|
|
1950
|
+
};
|
|
1951
|
+
var useSorting = (field2, orderBy) => {
|
|
1952
|
+
return ` order by ${String(field2)} ${orderBy}`;
|
|
1953
|
+
};
|
|
1954
|
+
var useQuery = (conditions, options) => {
|
|
1955
|
+
const { sort, debug = false } = options || {};
|
|
1956
|
+
const mergedCondition = conditions.reduce((acc, condition) => {
|
|
1957
|
+
const { field: field2, operator, value, truth } = condition;
|
|
1958
|
+
const isNumber = !isNaN(Number(value));
|
|
1959
|
+
const formattedValue = !isNumber && !/^("|')/.test(value) ? `"${value}"` : value;
|
|
1960
|
+
if (acc.length) {
|
|
1961
|
+
acc += ` ${truth || "and"} `;
|
|
1962
|
+
}
|
|
1963
|
+
return acc + `${String(field2)} ${operator} ${formattedValue}`;
|
|
1964
|
+
}, "");
|
|
1965
|
+
if (debug) {
|
|
1966
|
+
console.log(`\u{1F50D} Query: ${mergedCondition}`);
|
|
1967
|
+
}
|
|
1968
|
+
if (sort) {
|
|
1969
|
+
return `${mergedCondition}${useSorting(sort.field, sort.orderBy)}`;
|
|
1970
|
+
}
|
|
1971
|
+
return mergedCondition;
|
|
1972
|
+
};
|
|
1973
|
+
var chunk = (arr, size) => Array.from(
|
|
1974
|
+
{ length: Math.ceil(arr.length / size) },
|
|
1975
|
+
(_, i) => arr.slice(i * size, i * size + size)
|
|
1976
|
+
);
|
|
1977
|
+
|
|
1978
|
+
exports.API_LIMIT_POST = API_LIMIT_POST;
|
|
1979
|
+
exports.KintoneEventListener = KintoneEventListener;
|
|
1980
|
+
exports.KintoneEventManager = KintoneEventManager;
|
|
1981
|
+
exports.PluginLocalStorage = PluginLocalStorage;
|
|
1982
|
+
exports.addAllRecords = addAllRecords;
|
|
1983
|
+
exports.addRecord = addRecord;
|
|
1984
|
+
exports.addRecordComment = addRecordComment;
|
|
1985
|
+
exports.addRecords = addRecords;
|
|
1986
|
+
exports.backdoor = backdoor;
|
|
1987
|
+
exports.backdoorGetRecord = backdoorGetRecord;
|
|
1988
|
+
exports.bulkRequest = bulkRequest;
|
|
1989
|
+
exports.chunk = chunk;
|
|
1990
|
+
exports.compareField = compareField;
|
|
1991
|
+
exports.convertFullwidthAlphanumericToHalfwidth = convertFullwidthAlphanumericToHalfwidth;
|
|
1992
|
+
exports.convertHalfwidthKatakanaToFullwidth = convertHalfwidthKatakanaToFullwidth;
|
|
1993
|
+
exports.convertKatakanaToHiragana = convertKatakanaToHiragana;
|
|
1994
|
+
exports.createSpace = createSpace;
|
|
1995
|
+
exports.deleteAllRecords = deleteAllRecords;
|
|
1996
|
+
exports.deleteAllRecordsByQuery = deleteAllRecordsByQuery;
|
|
1997
|
+
exports.deleteRecordComment = deleteRecordComment;
|
|
1998
|
+
exports.deleteSpace = deleteSpace;
|
|
1999
|
+
exports.detectGuestSpaceId = detectGuestSpaceId;
|
|
2000
|
+
exports.downloadFile = downloadFile;
|
|
2001
|
+
exports.filterFieldProperties = filterFieldProperties;
|
|
2002
|
+
exports.getAllApps = getAllApps;
|
|
2003
|
+
exports.getAllRecords = getAllRecords;
|
|
2004
|
+
exports.getAllRecordsWithCursor = getAllRecordsWithCursor;
|
|
2005
|
+
exports.getAllRecordsWithId = getAllRecordsWithId;
|
|
2006
|
+
exports.getApp = getApp;
|
|
2007
|
+
exports.getAppCharts = getAppCharts;
|
|
2008
|
+
exports.getAppId = getAppId;
|
|
2009
|
+
exports.getAppObject = getAppObject;
|
|
2010
|
+
exports.getAppSettings = getAppSettings;
|
|
2011
|
+
exports.getCalcFieldValueAsString = getCalcFieldValueAsString;
|
|
2012
|
+
exports.getCurrentRecord = getCurrentRecord;
|
|
2013
|
+
exports.getCybozuGroupUsers = getCybozuGroupUsers;
|
|
2014
|
+
exports.getCybozuGroups = getCybozuGroups;
|
|
2015
|
+
exports.getCybozuOrganizationUsers = getCybozuOrganizationUsers;
|
|
2016
|
+
exports.getCybozuOrganizations = getCybozuOrganizations;
|
|
2017
|
+
exports.getCybozuUserGroups = getCybozuUserGroups;
|
|
2018
|
+
exports.getCybozuUserOrganizations = getCybozuUserOrganizations;
|
|
2019
|
+
exports.getCybozuUsers = getCybozuUsers;
|
|
2020
|
+
exports.getDefaultValue = getDefaultValue;
|
|
2021
|
+
exports.getEmptyValue = getEmptyValue;
|
|
2022
|
+
exports.getFieldElement = getFieldElement;
|
|
2023
|
+
exports.getFieldElements = getFieldElements;
|
|
2024
|
+
exports.getFieldValueAsString = getFieldValueAsString;
|
|
2025
|
+
exports.getFormFields = getFormFields;
|
|
2026
|
+
exports.getFormLayout = getFormLayout;
|
|
2027
|
+
exports.getHeaderSpace = getHeaderSpace;
|
|
2028
|
+
exports.getMetaFieldId_UNSTABLE = getMetaFieldId_UNSTABLE;
|
|
2029
|
+
exports.getMetaFields_UNSTABLE = getMetaFields_UNSTABLE;
|
|
2030
|
+
exports.getMetaSubtableFields_UNSTABLE = getMetaSubtableFields_UNSTABLE;
|
|
2031
|
+
exports.getMetaSubtable_UNSTABLE = getMetaSubtable_UNSTABLE;
|
|
2032
|
+
exports.getMetaTable_UNSTABLE = getMetaTable_UNSTABLE;
|
|
2033
|
+
exports.getNumberFieldValueAsString = getNumberFieldValueAsString;
|
|
2034
|
+
exports.getQuery = getQuery;
|
|
2035
|
+
exports.getQueryCondition = getQueryCondition;
|
|
2036
|
+
exports.getQueryString_UNSTABLE = getQueryString_UNSTABLE;
|
|
2037
|
+
exports.getRecord = getRecord;
|
|
2038
|
+
exports.getRecordACLEvaluate = getRecordACLEvaluate;
|
|
2039
|
+
exports.getRecordComments = getRecordComments;
|
|
2040
|
+
exports.getRecordId = getRecordId;
|
|
2041
|
+
exports.getRecords = getRecords;
|
|
2042
|
+
exports.getSortFromQuery = getSortFromQuery;
|
|
2043
|
+
exports.getSpace = getSpace;
|
|
2044
|
+
exports.getSpaceElement = getSpaceElement;
|
|
2045
|
+
exports.getViews = getViews;
|
|
2046
|
+
exports.getWareki = getWareki;
|
|
2047
|
+
exports.getYuruChara = getYuruChara;
|
|
2048
|
+
exports.isGuestSpace = isGuestSpace;
|
|
2049
|
+
exports.isMobile = isMobile;
|
|
2050
|
+
exports.onFileLoad = onFileLoad;
|
|
2051
|
+
exports.restorePluginConfig = restorePluginConfig;
|
|
2052
|
+
exports.restoreStorage = restoreStorage;
|
|
2053
|
+
exports.setCurrentRecord = setCurrentRecord;
|
|
2054
|
+
exports.setFieldShown = setFieldShown;
|
|
2055
|
+
exports.setPluginProxyConfig = setPluginProxyConfig;
|
|
2056
|
+
exports.sortField = sortField;
|
|
2057
|
+
exports.storePluginConfig = storePluginConfig;
|
|
2058
|
+
exports.storeStorage = storeStorage;
|
|
2059
|
+
exports.updateAllRecordStatuses = updateAllRecordStatuses;
|
|
2060
|
+
exports.updateAllRecords = updateAllRecords;
|
|
2061
|
+
exports.updateRecord = updateRecord;
|
|
2062
|
+
exports.updateRecordAssignees = updateRecordAssignees;
|
|
2063
|
+
exports.updateRecordStatus = updateRecordStatus;
|
|
2064
|
+
exports.updateThread = updateThread;
|
|
2065
|
+
exports.updateViews = updateViews;
|
|
2066
|
+
exports.uploadFile = uploadFile;
|
|
2067
|
+
exports.upsertRecord = upsertRecord;
|
|
2068
|
+
exports.useApi = useApi;
|
|
2069
|
+
exports.useQuery = useQuery;
|
|
2070
|
+
exports.useSorting = useSorting;
|
|
2071
|
+
exports.withLogging = withLogging;
|
|
2072
|
+
exports.withMobileEvents = withMobileEvents;
|
|
2073
|
+
exports.withSpaceIdFallback = withSpaceIdFallback;
|
|
2074
|
+
exports.xapp = xapp;
|
|
2075
|
+
//# sourceMappingURL=index.cjs.map
|
|
2076
|
+
//# sourceMappingURL=index.cjs.map
|