@twentyhq/teams 1.1.2 → 1.2.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/dependencies/yarn.lock +723 -3
- package/manifest.json +46 -29
- package/package.json +4 -2
- package/src/features/chat/logic-functions/teams-activities-enqueue.mjs +378 -162
- package/src/features/chat/logic-functions/teams-activities-enqueue.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-activities-enqueue.ts +1 -1
- package/src/features/chat/logic-functions/teams-activities-resolver.mjs +500 -40
- package/src/features/chat/logic-functions/teams-activities-resolver.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-activities-resolver.ts +13 -2
- package/src/features/chat/logic-functions/teams-list-unlinked-users.mjs +95 -61
- package/src/features/chat/logic-functions/teams-list-unlinked-users.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-match-user-links.mjs +105 -86
- package/src/features/chat/logic-functions/teams-match-user-links.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-register-connection.mjs +119 -101
- package/src/features/chat/logic-functions/teams-register-connection.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-register-connection.ts +1 -1
- package/src/features/chat/logic-functions/teams-search-users.mjs +96 -62
- package/src/features/chat/logic-functions/teams-search-users.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-set-user-link.mjs +88 -54
- package/src/features/chat/logic-functions/teams-set-user-link.mjs.map +4 -4
- package/src/features/chat/logic-functions/teams-tenant-release.mjs +72 -41
- package/src/features/chat/logic-functions/teams-tenant-release.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-count-transcript-history.mjs +99 -68
- package/src/features/transcripts/logic-functions/teams-count-transcript-history.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-import-transcript-history.mjs +99 -68
- package/src/features/transcripts/logic-functions/teams-import-transcript-history.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-import-transcript.mjs +96 -65
- package/src/features/transcripts/logic-functions/teams-import-transcript.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.mjs +89 -58
- package/src/features/transcripts/logic-functions/teams-list-organizer-transcripts.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-sync-transcript.mjs +96 -65
- package/src/features/transcripts/logic-functions/teams-sync-transcript.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-transcript-history-count.mjs +0 -1
- package/src/features/transcripts/logic-functions/teams-transcript-history-count.mjs.map +2 -2
- package/src/features/transcripts/logic-functions/teams-transcript-history-import.mjs +0 -1
- package/src/features/transcripts/logic-functions/teams-transcript-history-import.mjs.map +2 -2
- package/src/features/transcripts/logic-functions/teams-transcript-history-status.mjs +0 -1
- package/src/features/transcripts/logic-functions/teams-transcript-history-status.mjs.map +2 -2
- package/src/features/transcripts/logic-functions/teams-transcripts-webhook.mjs +104 -73
- package/src/features/transcripts/logic-functions/teams-transcripts-webhook.mjs.map +4 -4
- package/src/features/transcripts/logic-functions/teams-uninstall.mjs +72 -41
- package/src/features/transcripts/logic-functions/teams-uninstall.mjs.map +4 -4
- package/src/front-components/settings.front-component.mjs +113 -113
- package/src/front-components/settings.front-component.mjs.map +4 -4
- package/src/logic-functions/teams-health-check.mjs +46 -25
- package/src/logic-functions/teams-health-check.mjs.map +4 -4
- package/src/logic-functions/teams-health-check.ts +21 -6
- package/src/logic-functions/teams-post-install.mjs +1270 -0
- package/src/logic-functions/teams-post-install.mjs.map +7 -0
- package/src/logic-functions/teams-post-install.ts +15 -0
|
@@ -124,10 +124,10 @@ var require_convenience = __commonJS({
|
|
|
124
124
|
return structural_1.isArray(term) && term.length > 0;
|
|
125
125
|
};
|
|
126
126
|
exports.isNonEmptyArray = isNonEmptyArray;
|
|
127
|
-
var
|
|
127
|
+
var isNonEmptyString3 = (term) => {
|
|
128
128
|
return primitives_1.isString(term) && term.length > 0;
|
|
129
129
|
};
|
|
130
|
-
exports.isNonEmptyString =
|
|
130
|
+
exports.isNonEmptyString = isNonEmptyString3;
|
|
131
131
|
var isNumberOrNaN = (term) => {
|
|
132
132
|
return typeof term === "number";
|
|
133
133
|
};
|
|
@@ -458,7 +458,7 @@ var GraphRequestError = class extends Error {
|
|
|
458
458
|
};
|
|
459
459
|
|
|
460
460
|
// src/features/transcripts/logic-functions/utils/fetch-graph-response.ts
|
|
461
|
-
var
|
|
461
|
+
var import_guards4 = __toESM(require_build());
|
|
462
462
|
|
|
463
463
|
// src/features/transcripts/logic-functions/constants/graph-request-max-attempts.ts
|
|
464
464
|
var GRAPH_REQUEST_MAX_ATTEMPTS = 4;
|
|
@@ -481,62 +481,93 @@ var resolveGraphUrlOrThrow = (url) => {
|
|
|
481
481
|
return resolvedUrl.toString();
|
|
482
482
|
};
|
|
483
483
|
|
|
484
|
-
// src/
|
|
484
|
+
// src/utils/parse-retry-after-ms.ts
|
|
485
|
+
var import_guards3 = __toESM(require_build());
|
|
486
|
+
var parseRetryAfterMs = (retryAfter) => {
|
|
487
|
+
if (!(0, import_guards3.isNonEmptyString)(retryAfter)) {
|
|
488
|
+
return void 0;
|
|
489
|
+
}
|
|
490
|
+
const retryAfterSeconds = Number(retryAfter);
|
|
491
|
+
if (Number.isFinite(retryAfterSeconds)) {
|
|
492
|
+
return Math.max(retryAfterSeconds * 1e3, 0);
|
|
493
|
+
}
|
|
494
|
+
const retryAtMs = Date.parse(retryAfter);
|
|
495
|
+
return Number.isNaN(retryAtMs) ? void 0 : Math.max(retryAtMs - Date.now(), 0);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
// src/utils/sleep-for-milliseconds.ts
|
|
485
499
|
var sleepForMilliseconds = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
486
500
|
|
|
501
|
+
// src/utils/fetch-with-retries.ts
|
|
502
|
+
var fetchWithRetries = async ({
|
|
503
|
+
sendRequest,
|
|
504
|
+
maxAttempts,
|
|
505
|
+
isRetryableStatus,
|
|
506
|
+
getRetryDelayMs,
|
|
507
|
+
retryAbortSignal
|
|
508
|
+
}) => {
|
|
509
|
+
const sendAttempt = async ({
|
|
510
|
+
attempt,
|
|
511
|
+
waitedMs
|
|
512
|
+
}) => {
|
|
513
|
+
const response = await sendRequest();
|
|
514
|
+
if (response.ok || !isRetryableStatus(response.status) || attempt + 1 >= maxAttempts) {
|
|
515
|
+
return response;
|
|
516
|
+
}
|
|
517
|
+
const delayMs = getRetryDelayMs({
|
|
518
|
+
attempt,
|
|
519
|
+
retryAfterMs: parseRetryAfterMs(response.headers.get("retry-after")),
|
|
520
|
+
waitedMs
|
|
521
|
+
});
|
|
522
|
+
if (!o(delayMs)) {
|
|
523
|
+
return response;
|
|
524
|
+
}
|
|
525
|
+
await sleepForMilliseconds(delayMs);
|
|
526
|
+
if (o(retryAbortSignal) && retryAbortSignal.aborted) {
|
|
527
|
+
return response;
|
|
528
|
+
}
|
|
529
|
+
await response.body?.cancel();
|
|
530
|
+
return sendAttempt({ attempt: attempt + 1, waitedMs: waitedMs + delayMs });
|
|
531
|
+
};
|
|
532
|
+
return sendAttempt({ attempt: 0, waitedMs: 0 });
|
|
533
|
+
};
|
|
534
|
+
|
|
487
535
|
// src/features/transcripts/logic-functions/utils/fetch-graph-response.ts
|
|
488
|
-
var
|
|
536
|
+
var fetchGraphResponse = async ({
|
|
489
537
|
accessToken,
|
|
490
538
|
url,
|
|
491
539
|
accept,
|
|
492
540
|
method,
|
|
493
|
-
body
|
|
494
|
-
attempt
|
|
541
|
+
body
|
|
495
542
|
}) => {
|
|
496
|
-
const
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
543
|
+
const resolvedUrl = resolveGraphUrlOrThrow(url);
|
|
544
|
+
const response = await fetchWithRetries({
|
|
545
|
+
sendRequest: () => fetch(resolvedUrl, {
|
|
546
|
+
method,
|
|
547
|
+
redirect: "error",
|
|
548
|
+
headers: {
|
|
549
|
+
Authorization: `Bearer ${accessToken}`,
|
|
550
|
+
Accept: accept,
|
|
551
|
+
...o(body) ? { "Content-Type": "application/json" } : {}
|
|
552
|
+
},
|
|
553
|
+
body: o(body) ? JSON.stringify(body) : void 0
|
|
554
|
+
}),
|
|
555
|
+
maxAttempts: GRAPH_REQUEST_MAX_ATTEMPTS,
|
|
556
|
+
isRetryableStatus: (status) => GRAPH_RETRYABLE_STATUSES.has(status),
|
|
557
|
+
getRetryDelayMs: ({ attempt, retryAfterMs }) => o(retryAfterMs) && retryAfterMs > 0 ? retryAfterMs : GRAPH_REQUEST_RETRY_BASE_DELAY_MILLISECONDS * 2 ** attempt
|
|
505
558
|
});
|
|
506
559
|
if (response.ok) {
|
|
507
560
|
return response;
|
|
508
561
|
}
|
|
509
|
-
if (GRAPH_RETRYABLE_STATUSES.has(response.status) && attempt + 1 < GRAPH_REQUEST_MAX_ATTEMPTS) {
|
|
510
|
-
const retryAfterSeconds = Number(response.headers.get("Retry-After"));
|
|
511
|
-
await sleepForMilliseconds(
|
|
512
|
-
retryAfterSeconds > 0 ? retryAfterSeconds * 1e3 : GRAPH_REQUEST_RETRY_BASE_DELAY_MILLISECONDS * 2 ** attempt
|
|
513
|
-
);
|
|
514
|
-
return fetchGraphResponseWithRetries({
|
|
515
|
-
accessToken,
|
|
516
|
-
url,
|
|
517
|
-
accept,
|
|
518
|
-
method,
|
|
519
|
-
body,
|
|
520
|
-
attempt: attempt + 1
|
|
521
|
-
});
|
|
522
|
-
}
|
|
523
562
|
const errorBody = await response.json().catch(() => ({}));
|
|
524
|
-
const innerErrorCode = (0,
|
|
525
|
-
const message = (0,
|
|
563
|
+
const innerErrorCode = (0, import_guards4.isNonEmptyString)(errorBody.error?.innerError?.code) ? errorBody.error.innerError.code : void 0;
|
|
564
|
+
const message = (0, import_guards4.isNonEmptyString)(errorBody.error?.message) ? errorBody.error.message : response.statusText;
|
|
526
565
|
throw new GraphRequestError({
|
|
527
|
-
message: `Microsoft Graph request failed (${response.status}${(0,
|
|
566
|
+
message: `Microsoft Graph request failed (${response.status}${(0, import_guards4.isNonEmptyString)(innerErrorCode) ? ` ${innerErrorCode}` : ""}): ${message}`,
|
|
528
567
|
status: response.status,
|
|
529
568
|
innerErrorCode
|
|
530
569
|
});
|
|
531
570
|
};
|
|
532
|
-
var fetchGraphResponse = ({
|
|
533
|
-
url,
|
|
534
|
-
...request
|
|
535
|
-
}) => fetchGraphResponseWithRetries({
|
|
536
|
-
...request,
|
|
537
|
-
url: resolveGraphUrlOrThrow(url),
|
|
538
|
-
attempt: 0
|
|
539
|
-
});
|
|
540
571
|
|
|
541
572
|
// src/features/transcripts/logic-functions/utils/delete-teams-transcript-subscription.ts
|
|
542
573
|
var deleteTeamsTranscriptSubscription = async ({
|