@app-connect/core 1.7.21 → 1.7.22
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/README.md +8 -1
- package/connector/developerPortal.js +4 -4
- package/docs/README.md +50 -0
- package/docs/architecture.md +93 -0
- package/docs/connectors.md +117 -0
- package/docs/handlers.md +125 -0
- package/docs/libraries.md +101 -0
- package/docs/models.md +144 -0
- package/docs/routes.md +115 -0
- package/docs/tests.md +73 -0
- package/handlers/admin.js +22 -2
- package/handlers/auth.js +51 -10
- package/handlers/log.js +4 -4
- package/handlers/managedAuth.js +446 -0
- package/index.js +264 -34
- package/lib/jwt.js +1 -1
- package/mcp/tools/createCallLog.js +5 -1
- package/mcp/tools/createContact.js +5 -1
- package/mcp/tools/createMessageLog.js +5 -1
- package/mcp/tools/findContactByName.js +5 -1
- package/mcp/tools/findContactByPhone.js +6 -2
- package/mcp/tools/getCallLog.js +5 -1
- package/mcp/tools/rcGetCallLogs.js +6 -2
- package/mcp/tools/updateCallLog.js +5 -1
- package/mcp/ui/App/lib/developerPortal.ts +1 -1
- package/package.json +72 -72
- package/releaseNotes.json +8 -0
- package/test/handlers/admin.test.js +34 -0
- package/test/handlers/auth.test.js +402 -6
- package/test/handlers/managedAuth.test.js +458 -0
- package/test/index.test.js +105 -0
- package/test/lib/jwt.test.js +15 -0
- package/test/mcp/tools/createCallLog.test.js +11 -0
- package/test/mcp/tools/createContact.test.js +58 -0
- package/test/mcp/tools/createMessageLog.test.js +15 -0
- package/test/mcp/tools/findContactByName.test.js +12 -0
- package/test/mcp/tools/findContactByPhone.test.js +12 -0
- package/test/mcp/tools/getCallLog.test.js +12 -0
- package/test/mcp/tools/rcGetCallLogs.test.js +56 -0
- package/test/mcp/tools/updateCallLog.test.js +14 -0
- package/test/routes/managedAuthRoutes.test.js +132 -0
- package/test/setup.js +2 -0
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
const connectorRegistry = require('../connector/registry');
|
|
2
|
+
const developerPortal = require('../connector/developerPortal');
|
|
3
|
+
const { AccountDataModel } = require('../models/accountDataModel');
|
|
4
|
+
const { Op } = require('sequelize');
|
|
5
|
+
const { encode, decoded } = require('../lib/encode');
|
|
6
|
+
|
|
7
|
+
const MANAGED_AUTH_ORG_DATA_KEY = 'managed-auth-org';
|
|
8
|
+
const MANAGED_AUTH_USER_DATA_KEY = 'managed-auth-user';
|
|
9
|
+
const MANAGED_AUTH_LOGIN_FAILURE_DATA_KEY = 'managed-auth-login-failure';
|
|
10
|
+
|
|
11
|
+
function getUserManagedAuthDataKey({ rcExtensionId }) {
|
|
12
|
+
return `${MANAGED_AUTH_USER_DATA_KEY}:${rcExtensionId}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function getManagedAuthLoginFailureDataKey({ rcExtensionId }) {
|
|
16
|
+
return `${MANAGED_AUTH_LOGIN_FAILURE_DATA_KEY}:${rcExtensionId}`;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isFilled(value) {
|
|
20
|
+
return value !== undefined && value !== null && value !== '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async function getApiKeyFieldDefinitions({ platform, connectorId, isPrivate = false }) {
|
|
24
|
+
if (!platform) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
if (connectorId) {
|
|
28
|
+
const manifest = await developerPortal.getConnectorManifest({ connectorId, isPrivate });
|
|
29
|
+
if (manifest?.platforms?.[platform]?.auth?.apiKey?.page?.content) {
|
|
30
|
+
return manifest.platforms[platform].auth.apiKey.page.content;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
const manifest = connectorRegistry.getManifest(platform, true);
|
|
35
|
+
return manifest?.platforms?.[platform]?.auth?.apiKey?.page?.content ?? [];
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function getManagedFieldDefinitions({ platform, connectorId, isPrivate = false }) {
|
|
43
|
+
const fieldDefinitions = await getApiKeyFieldDefinitions({ platform, connectorId, isPrivate });
|
|
44
|
+
return fieldDefinitions.filter(field => field?.managed);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function encryptStoredValue(value) {
|
|
48
|
+
return {
|
|
49
|
+
version: 1,
|
|
50
|
+
encrypted: true,
|
|
51
|
+
value: encode(JSON.stringify(value))
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function decryptStoredValue(value) {
|
|
56
|
+
if (!value) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (value?.encrypted && value?.value) {
|
|
60
|
+
return JSON.parse(decoded(value.value));
|
|
61
|
+
}
|
|
62
|
+
return value;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function getManagedAuthRecord({ rcAccountId, platform, dataKey }) {
|
|
66
|
+
if (!rcAccountId || !platform) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
return AccountDataModel.findOne({
|
|
70
|
+
where: {
|
|
71
|
+
rcAccountId,
|
|
72
|
+
platformName: platform,
|
|
73
|
+
dataKey
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function getOrgManagedAuthValues({ rcAccountId, platform }) {
|
|
79
|
+
const record = await getManagedAuthRecord({
|
|
80
|
+
rcAccountId,
|
|
81
|
+
platform,
|
|
82
|
+
dataKey: MANAGED_AUTH_ORG_DATA_KEY
|
|
83
|
+
});
|
|
84
|
+
const fields = record?.data?.fields ?? {};
|
|
85
|
+
const decryptedFields = {};
|
|
86
|
+
Object.keys(fields).forEach(key => {
|
|
87
|
+
decryptedFields[key] = decryptStoredValue(fields[key]);
|
|
88
|
+
});
|
|
89
|
+
return decryptedFields;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
async function getUserManagedAuthValues({ rcAccountId, platform, rcExtensionId }) {
|
|
93
|
+
if (!rcExtensionId) {
|
|
94
|
+
return {};
|
|
95
|
+
}
|
|
96
|
+
const userDataKey = getUserManagedAuthDataKey({ rcExtensionId });
|
|
97
|
+
const scopedRecord = await getManagedAuthRecord({
|
|
98
|
+
rcAccountId,
|
|
99
|
+
platform,
|
|
100
|
+
dataKey: userDataKey
|
|
101
|
+
});
|
|
102
|
+
const fields = scopedRecord?.data?.fields ?? {};
|
|
103
|
+
const decryptedFields = {};
|
|
104
|
+
Object.keys(fields).forEach(key => {
|
|
105
|
+
decryptedFields[key] = decryptStoredValue(fields[key]);
|
|
106
|
+
});
|
|
107
|
+
return decryptedFields;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
async function hasManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId }) {
|
|
111
|
+
if (!rcExtensionId) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
const record = await getManagedAuthRecord({
|
|
115
|
+
rcAccountId,
|
|
116
|
+
platform,
|
|
117
|
+
dataKey: getManagedAuthLoginFailureDataKey({ rcExtensionId })
|
|
118
|
+
});
|
|
119
|
+
return !!record;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async function markManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId }) {
|
|
123
|
+
if (!rcAccountId || !platform || !rcExtensionId) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const dataKey = getManagedAuthLoginFailureDataKey({ rcExtensionId });
|
|
127
|
+
const existingRecord = await getManagedAuthRecord({
|
|
128
|
+
rcAccountId,
|
|
129
|
+
platform,
|
|
130
|
+
dataKey
|
|
131
|
+
});
|
|
132
|
+
const data = {
|
|
133
|
+
failedAt: new Date().toISOString()
|
|
134
|
+
};
|
|
135
|
+
if (existingRecord) {
|
|
136
|
+
await existingRecord.update({ data });
|
|
137
|
+
return existingRecord;
|
|
138
|
+
}
|
|
139
|
+
return AccountDataModel.create({
|
|
140
|
+
rcAccountId,
|
|
141
|
+
platformName: platform,
|
|
142
|
+
dataKey,
|
|
143
|
+
data
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function clearManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId }) {
|
|
148
|
+
if (!rcAccountId || !platform || !rcExtensionId) {
|
|
149
|
+
return 0;
|
|
150
|
+
}
|
|
151
|
+
return AccountDataModel.destroy({
|
|
152
|
+
where: {
|
|
153
|
+
rcAccountId,
|
|
154
|
+
platformName: platform,
|
|
155
|
+
dataKey: getManagedAuthLoginFailureDataKey({ rcExtensionId })
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function upsertOrgManagedAuthValues({ rcAccountId, platform, values = {}, fieldsToRemove = [] }) {
|
|
161
|
+
const existingRecord = await getManagedAuthRecord({
|
|
162
|
+
rcAccountId,
|
|
163
|
+
platform,
|
|
164
|
+
dataKey: MANAGED_AUTH_ORG_DATA_KEY
|
|
165
|
+
});
|
|
166
|
+
const nextFields = {
|
|
167
|
+
...(existingRecord?.data?.fields ?? {})
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
Object.keys(values).forEach(key => {
|
|
171
|
+
if (isFilled(values[key])) {
|
|
172
|
+
nextFields[key] = encryptStoredValue(values[key]);
|
|
173
|
+
}
|
|
174
|
+
});
|
|
175
|
+
fieldsToRemove.forEach(key => {
|
|
176
|
+
delete nextFields[key];
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
const nextData = {
|
|
180
|
+
fields: nextFields
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
if (existingRecord) {
|
|
184
|
+
await existingRecord.update({ data: nextData });
|
|
185
|
+
return existingRecord;
|
|
186
|
+
}
|
|
187
|
+
return AccountDataModel.create({
|
|
188
|
+
rcAccountId,
|
|
189
|
+
platformName: platform,
|
|
190
|
+
dataKey: MANAGED_AUTH_ORG_DATA_KEY,
|
|
191
|
+
data: nextData
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
async function upsertUserManagedAuthValues({ rcAccountId, platform, rcExtensionId, rcUserName, values = {}, fieldsToRemove = [] }) {
|
|
196
|
+
if (!rcExtensionId) {
|
|
197
|
+
throw new Error('rcExtensionId is required for user managed auth values');
|
|
198
|
+
}
|
|
199
|
+
const userDataKey = getUserManagedAuthDataKey({ rcExtensionId });
|
|
200
|
+
const existingRecord = await getManagedAuthRecord({
|
|
201
|
+
rcAccountId,
|
|
202
|
+
platform,
|
|
203
|
+
dataKey: userDataKey
|
|
204
|
+
});
|
|
205
|
+
const nextFields = {
|
|
206
|
+
...(existingRecord?.data?.fields ?? {})
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
Object.keys(values).forEach(key => {
|
|
210
|
+
if (isFilled(values[key])) {
|
|
211
|
+
nextFields[key] = encryptStoredValue(values[key]);
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
fieldsToRemove.forEach(key => {
|
|
215
|
+
delete nextFields[key];
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
const nextData = {
|
|
219
|
+
rcExtensionId,
|
|
220
|
+
rcUserName: rcUserName ?? existingRecord?.data?.rcUserName ?? '',
|
|
221
|
+
fields: nextFields
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
if (existingRecord) {
|
|
225
|
+
await existingRecord.update({ data: nextData });
|
|
226
|
+
return existingRecord;
|
|
227
|
+
}
|
|
228
|
+
return AccountDataModel.create({
|
|
229
|
+
rcAccountId,
|
|
230
|
+
platformName: platform,
|
|
231
|
+
dataKey: userDataKey,
|
|
232
|
+
data: nextData
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
function getStoredFieldValue({ value }) {
|
|
237
|
+
if (!isFilled(value)) {
|
|
238
|
+
return {
|
|
239
|
+
hasValue: false,
|
|
240
|
+
value: ''
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
return {
|
|
244
|
+
hasValue: true,
|
|
245
|
+
value
|
|
246
|
+
};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
async function getManagedAuthAdminSettings({ platform, rcAccountId, connectorId, isPrivate = false }) {
|
|
250
|
+
const fieldDefinitions = await getManagedFieldDefinitions({ platform, connectorId, isPrivate });
|
|
251
|
+
const orgFieldDefinitions = fieldDefinitions.filter(field => field.managedScope === 'account');
|
|
252
|
+
const userFieldDefinitions = fieldDefinitions.filter(field => field.managedScope === 'user');
|
|
253
|
+
const orgValues = await getOrgManagedAuthValues({ rcAccountId, platform });
|
|
254
|
+
const userRecords = await AccountDataModel.findAll({
|
|
255
|
+
where: {
|
|
256
|
+
rcAccountId,
|
|
257
|
+
platformName: platform,
|
|
258
|
+
dataKey: {
|
|
259
|
+
[Op.like]: `${MANAGED_AUTH_USER_DATA_KEY}:%`
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
const userEntries = userRecords
|
|
264
|
+
.map(record => {
|
|
265
|
+
const extensionIdFromDataKey = record.dataKey?.split(`${MANAGED_AUTH_USER_DATA_KEY}:`)?.[1];
|
|
266
|
+
const rcExtensionId = record?.data?.rcExtensionId ?? extensionIdFromDataKey;
|
|
267
|
+
if (!rcExtensionId) {
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
return {
|
|
271
|
+
rcExtensionId,
|
|
272
|
+
rcUserName: record?.data?.rcUserName ?? '',
|
|
273
|
+
fields: record?.data?.fields ?? {}
|
|
274
|
+
};
|
|
275
|
+
})
|
|
276
|
+
.filter(Boolean);
|
|
277
|
+
|
|
278
|
+
const adminOrgValues = {};
|
|
279
|
+
orgFieldDefinitions.forEach(field => {
|
|
280
|
+
adminOrgValues[field.const] = getStoredFieldValue({
|
|
281
|
+
value: orgValues[field.const]
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const adminUserValues = userEntries.map(entry => {
|
|
286
|
+
const fields = {};
|
|
287
|
+
userFieldDefinitions.forEach(field => {
|
|
288
|
+
fields[field.const] = getStoredFieldValue({
|
|
289
|
+
value: decryptStoredValue(entry?.fields?.[field.const])
|
|
290
|
+
});
|
|
291
|
+
});
|
|
292
|
+
return {
|
|
293
|
+
rcExtensionId: entry.rcExtensionId,
|
|
294
|
+
rcUserName: entry.rcUserName ?? '',
|
|
295
|
+
fields
|
|
296
|
+
};
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
return {
|
|
300
|
+
hasManagedAuth: fieldDefinitions.length > 0,
|
|
301
|
+
fields: fieldDefinitions,
|
|
302
|
+
orgFields: orgFieldDefinitions,
|
|
303
|
+
userFields: userFieldDefinitions,
|
|
304
|
+
orgValues: adminOrgValues,
|
|
305
|
+
userValues: adminUserValues
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
async function getManagedAuthState({ platform, rcAccountId, rcExtensionId, connectorId, isPrivate = false }) {
|
|
310
|
+
const fieldDefinitions = await getApiKeyFieldDefinitions({ platform, connectorId, isPrivate });
|
|
311
|
+
const managedFieldDefinitions = fieldDefinitions.filter(field => field?.managed);
|
|
312
|
+
const orgValues = await getOrgManagedAuthValues({ rcAccountId, platform });
|
|
313
|
+
const userValues = await getUserManagedAuthValues({ rcAccountId, platform, rcExtensionId });
|
|
314
|
+
const hasLoginFailureFallback = await hasManagedAuthLoginFailure({ rcAccountId, platform, rcExtensionId });
|
|
315
|
+
|
|
316
|
+
const visibleFieldConsts = [];
|
|
317
|
+
const missingRequiredFieldConsts = [];
|
|
318
|
+
let allRequiredFieldsSatisfied = true;
|
|
319
|
+
|
|
320
|
+
// Default behavior for connectors without managed auth: render full API key form.
|
|
321
|
+
if (managedFieldDefinitions.length === 0) {
|
|
322
|
+
return {
|
|
323
|
+
hasManagedAuth: false,
|
|
324
|
+
allRequiredFieldsSatisfied: false,
|
|
325
|
+
visibleFieldConsts: null,
|
|
326
|
+
missingRequiredFieldConsts: fieldDefinitions.filter(field => field.required).map(field => field.const),
|
|
327
|
+
fallbackToManualAuth: false
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (hasLoginFailureFallback) {
|
|
332
|
+
return {
|
|
333
|
+
hasManagedAuth: true,
|
|
334
|
+
allRequiredFieldsSatisfied: false,
|
|
335
|
+
visibleFieldConsts: null,
|
|
336
|
+
missingRequiredFieldConsts: fieldDefinitions.filter(field => field.required).map(field => field.const),
|
|
337
|
+
fallbackToManualAuth: true
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
fieldDefinitions.forEach(field => {
|
|
342
|
+
const storedValue = field.managed
|
|
343
|
+
? (field.managedScope === 'user' ? userValues[field.const] : orgValues[field.const])
|
|
344
|
+
: undefined;
|
|
345
|
+
const hasStoredValue = isFilled(storedValue);
|
|
346
|
+
// Show any required field the user still needs to provide, including
|
|
347
|
+
// managed fields that have not been configured yet.
|
|
348
|
+
if (field.required && (!field.managed || !hasStoredValue)) {
|
|
349
|
+
visibleFieldConsts.push(field.const);
|
|
350
|
+
}
|
|
351
|
+
if (field.required && !hasStoredValue) {
|
|
352
|
+
missingRequiredFieldConsts.push(field.const);
|
|
353
|
+
allRequiredFieldsSatisfied = false;
|
|
354
|
+
}
|
|
355
|
+
if (field.required && !field.managed) {
|
|
356
|
+
allRequiredFieldsSatisfied = false;
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
|
|
360
|
+
return {
|
|
361
|
+
hasManagedAuth: managedFieldDefinitions.length > 0,
|
|
362
|
+
allRequiredFieldsSatisfied,
|
|
363
|
+
visibleFieldConsts,
|
|
364
|
+
missingRequiredFieldConsts,
|
|
365
|
+
fallbackToManualAuth: false
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
async function resolveApiKeyLoginFields({ platform, rcAccountId, rcExtensionId, connectorId, isPrivate = false, apiKey, additionalInfo = {}, preferSubmittedValuesForManagedFields = false }) {
|
|
370
|
+
const fieldDefinitions = await getApiKeyFieldDefinitions({ platform, connectorId, isPrivate });
|
|
371
|
+
const resolvedAdditionalInfo = {
|
|
372
|
+
...(additionalInfo ?? {})
|
|
373
|
+
};
|
|
374
|
+
if (resolvedAdditionalInfo.apiKey === undefined && apiKey !== undefined) {
|
|
375
|
+
resolvedAdditionalInfo.apiKey = apiKey;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const orgValues = await getOrgManagedAuthValues({ rcAccountId, platform });
|
|
379
|
+
const userValues = await getUserManagedAuthValues({ rcAccountId, platform, rcExtensionId });
|
|
380
|
+
const missingRequiredFieldConsts = [];
|
|
381
|
+
|
|
382
|
+
fieldDefinitions.forEach(field => {
|
|
383
|
+
if (!field?.managed) {
|
|
384
|
+
if (field.required && !isFilled(resolvedAdditionalInfo[field.const])) {
|
|
385
|
+
missingRequiredFieldConsts.push(field.const);
|
|
386
|
+
}
|
|
387
|
+
return;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
const storedValue = field.managedScope === 'user'
|
|
391
|
+
? userValues[field.const]
|
|
392
|
+
: orgValues[field.const];
|
|
393
|
+
// Prefer managed values when configured, but fall back to submitted
|
|
394
|
+
// auth-page input so missing managed fields can still be supplied.
|
|
395
|
+
if (isFilled(storedValue) && !(preferSubmittedValuesForManagedFields && isFilled(resolvedAdditionalInfo[field.const]))) {
|
|
396
|
+
resolvedAdditionalInfo[field.const] = storedValue;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
if (field.required && !isFilled(resolvedAdditionalInfo[field.const])) {
|
|
400
|
+
missingRequiredFieldConsts.push(field.const);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
return {
|
|
405
|
+
resolvedAdditionalInfo,
|
|
406
|
+
resolvedApiKey: resolvedAdditionalInfo.apiKey ?? apiKey,
|
|
407
|
+
missingRequiredFieldConsts
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
async function persistSubmittedManagedValues({ platform, rcAccountId, rcExtensionId, rcUserName, submittedManagedValues = {} }) {
|
|
412
|
+
if (!rcAccountId) {
|
|
413
|
+
return;
|
|
414
|
+
}
|
|
415
|
+
if (Object.keys(submittedManagedValues.org ?? {}).length > 0) {
|
|
416
|
+
await upsertOrgManagedAuthValues({
|
|
417
|
+
rcAccountId,
|
|
418
|
+
platform,
|
|
419
|
+
values: submittedManagedValues.org
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
if (rcExtensionId && Object.keys(submittedManagedValues.user ?? {}).length > 0) {
|
|
423
|
+
await upsertUserManagedAuthValues({
|
|
424
|
+
rcAccountId,
|
|
425
|
+
platform,
|
|
426
|
+
rcExtensionId,
|
|
427
|
+
rcUserName,
|
|
428
|
+
values: submittedManagedValues.user
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
exports.MANAGED_AUTH_ORG_DATA_KEY = MANAGED_AUTH_ORG_DATA_KEY;
|
|
434
|
+
exports.MANAGED_AUTH_USER_DATA_KEY = MANAGED_AUTH_USER_DATA_KEY;
|
|
435
|
+
exports.getApiKeyFieldDefinitions = getApiKeyFieldDefinitions;
|
|
436
|
+
exports.getManagedFieldDefinitions = getManagedFieldDefinitions;
|
|
437
|
+
exports.getManagedAuthAdminSettings = getManagedAuthAdminSettings;
|
|
438
|
+
exports.getManagedAuthState = getManagedAuthState;
|
|
439
|
+
exports.hasManagedAuthLoginFailure = hasManagedAuthLoginFailure;
|
|
440
|
+
exports.markManagedAuthLoginFailure = markManagedAuthLoginFailure;
|
|
441
|
+
exports.clearManagedAuthLoginFailure = clearManagedAuthLoginFailure;
|
|
442
|
+
exports.resolveApiKeyLoginFields = resolveApiKeyLoginFields;
|
|
443
|
+
exports.persistSubmittedManagedValues = persistSubmittedManagedValues;
|
|
444
|
+
exports.upsertOrgManagedAuthValues = upsertOrgManagedAuthValues;
|
|
445
|
+
exports.upsertUserManagedAuthValues = upsertUserManagedAuthValues;
|
|
446
|
+
|