@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 isNonEmptyString4 = (term) => {
|
|
128
128
|
return primitives_1.isString(term) && term.length > 0;
|
|
129
129
|
};
|
|
130
|
-
exports.isNonEmptyString =
|
|
130
|
+
exports.isNonEmptyString = isNonEmptyString4;
|
|
131
131
|
var isNumberOrNaN = (term) => {
|
|
132
132
|
return typeof term === "number";
|
|
133
133
|
};
|
|
@@ -555,7 +555,7 @@ var GraphRequestError = class extends Error {
|
|
|
555
555
|
};
|
|
556
556
|
|
|
557
557
|
// src/features/transcripts/logic-functions/utils/fetch-graph-response.ts
|
|
558
|
-
var
|
|
558
|
+
var import_guards5 = __toESM(require_build());
|
|
559
559
|
|
|
560
560
|
// src/features/transcripts/logic-functions/constants/graph-request-max-attempts.ts
|
|
561
561
|
var GRAPH_REQUEST_MAX_ATTEMPTS = 4;
|
|
@@ -578,62 +578,93 @@ var resolveGraphUrlOrThrow = (url) => {
|
|
|
578
578
|
return resolvedUrl.toString();
|
|
579
579
|
};
|
|
580
580
|
|
|
581
|
-
// src/
|
|
581
|
+
// src/utils/parse-retry-after-ms.ts
|
|
582
|
+
var import_guards4 = __toESM(require_build());
|
|
583
|
+
var parseRetryAfterMs = (retryAfter) => {
|
|
584
|
+
if (!(0, import_guards4.isNonEmptyString)(retryAfter)) {
|
|
585
|
+
return void 0;
|
|
586
|
+
}
|
|
587
|
+
const retryAfterSeconds = Number(retryAfter);
|
|
588
|
+
if (Number.isFinite(retryAfterSeconds)) {
|
|
589
|
+
return Math.max(retryAfterSeconds * 1e3, 0);
|
|
590
|
+
}
|
|
591
|
+
const retryAtMs = Date.parse(retryAfter);
|
|
592
|
+
return Number.isNaN(retryAtMs) ? void 0 : Math.max(retryAtMs - Date.now(), 0);
|
|
593
|
+
};
|
|
594
|
+
|
|
595
|
+
// src/utils/sleep-for-milliseconds.ts
|
|
582
596
|
var sleepForMilliseconds = (milliseconds) => new Promise((resolve) => setTimeout(resolve, milliseconds));
|
|
583
597
|
|
|
598
|
+
// src/utils/fetch-with-retries.ts
|
|
599
|
+
var fetchWithRetries = async ({
|
|
600
|
+
sendRequest,
|
|
601
|
+
maxAttempts,
|
|
602
|
+
isRetryableStatus,
|
|
603
|
+
getRetryDelayMs,
|
|
604
|
+
retryAbortSignal
|
|
605
|
+
}) => {
|
|
606
|
+
const sendAttempt = async ({
|
|
607
|
+
attempt,
|
|
608
|
+
waitedMs
|
|
609
|
+
}) => {
|
|
610
|
+
const response = await sendRequest();
|
|
611
|
+
if (response.ok || !isRetryableStatus(response.status) || attempt + 1 >= maxAttempts) {
|
|
612
|
+
return response;
|
|
613
|
+
}
|
|
614
|
+
const delayMs = getRetryDelayMs({
|
|
615
|
+
attempt,
|
|
616
|
+
retryAfterMs: parseRetryAfterMs(response.headers.get("retry-after")),
|
|
617
|
+
waitedMs
|
|
618
|
+
});
|
|
619
|
+
if (!o(delayMs)) {
|
|
620
|
+
return response;
|
|
621
|
+
}
|
|
622
|
+
await sleepForMilliseconds(delayMs);
|
|
623
|
+
if (o(retryAbortSignal) && retryAbortSignal.aborted) {
|
|
624
|
+
return response;
|
|
625
|
+
}
|
|
626
|
+
await response.body?.cancel();
|
|
627
|
+
return sendAttempt({ attempt: attempt + 1, waitedMs: waitedMs + delayMs });
|
|
628
|
+
};
|
|
629
|
+
return sendAttempt({ attempt: 0, waitedMs: 0 });
|
|
630
|
+
};
|
|
631
|
+
|
|
584
632
|
// src/features/transcripts/logic-functions/utils/fetch-graph-response.ts
|
|
585
|
-
var
|
|
633
|
+
var fetchGraphResponse = async ({
|
|
586
634
|
accessToken,
|
|
587
635
|
url,
|
|
588
636
|
accept,
|
|
589
637
|
method,
|
|
590
|
-
body
|
|
591
|
-
attempt
|
|
638
|
+
body
|
|
592
639
|
}) => {
|
|
593
|
-
const
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
640
|
+
const resolvedUrl = resolveGraphUrlOrThrow(url);
|
|
641
|
+
const response = await fetchWithRetries({
|
|
642
|
+
sendRequest: () => fetch(resolvedUrl, {
|
|
643
|
+
method,
|
|
644
|
+
redirect: "error",
|
|
645
|
+
headers: {
|
|
646
|
+
Authorization: `Bearer ${accessToken}`,
|
|
647
|
+
Accept: accept,
|
|
648
|
+
...o(body) ? { "Content-Type": "application/json" } : {}
|
|
649
|
+
},
|
|
650
|
+
body: o(body) ? JSON.stringify(body) : void 0
|
|
651
|
+
}),
|
|
652
|
+
maxAttempts: GRAPH_REQUEST_MAX_ATTEMPTS,
|
|
653
|
+
isRetryableStatus: (status) => GRAPH_RETRYABLE_STATUSES.has(status),
|
|
654
|
+
getRetryDelayMs: ({ attempt, retryAfterMs }) => o(retryAfterMs) && retryAfterMs > 0 ? retryAfterMs : GRAPH_REQUEST_RETRY_BASE_DELAY_MILLISECONDS * 2 ** attempt
|
|
602
655
|
});
|
|
603
656
|
if (response.ok) {
|
|
604
657
|
return response;
|
|
605
658
|
}
|
|
606
|
-
if (GRAPH_RETRYABLE_STATUSES.has(response.status) && attempt + 1 < GRAPH_REQUEST_MAX_ATTEMPTS) {
|
|
607
|
-
const retryAfterSeconds = Number(response.headers.get("Retry-After"));
|
|
608
|
-
await sleepForMilliseconds(
|
|
609
|
-
retryAfterSeconds > 0 ? retryAfterSeconds * 1e3 : GRAPH_REQUEST_RETRY_BASE_DELAY_MILLISECONDS * 2 ** attempt
|
|
610
|
-
);
|
|
611
|
-
return fetchGraphResponseWithRetries({
|
|
612
|
-
accessToken,
|
|
613
|
-
url,
|
|
614
|
-
accept,
|
|
615
|
-
method,
|
|
616
|
-
body,
|
|
617
|
-
attempt: attempt + 1
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
659
|
const errorBody = await response.json().catch(() => ({}));
|
|
621
|
-
const innerErrorCode = (0,
|
|
622
|
-
const message = (0,
|
|
660
|
+
const innerErrorCode = (0, import_guards5.isNonEmptyString)(errorBody.error?.innerError?.code) ? errorBody.error.innerError.code : void 0;
|
|
661
|
+
const message = (0, import_guards5.isNonEmptyString)(errorBody.error?.message) ? errorBody.error.message : response.statusText;
|
|
623
662
|
throw new GraphRequestError({
|
|
624
|
-
message: `Microsoft Graph request failed (${response.status}${(0,
|
|
663
|
+
message: `Microsoft Graph request failed (${response.status}${(0, import_guards5.isNonEmptyString)(innerErrorCode) ? ` ${innerErrorCode}` : ""}): ${message}`,
|
|
625
664
|
status: response.status,
|
|
626
665
|
innerErrorCode
|
|
627
666
|
});
|
|
628
667
|
};
|
|
629
|
-
var fetchGraphResponse = ({
|
|
630
|
-
url,
|
|
631
|
-
...request
|
|
632
|
-
}) => fetchGraphResponseWithRetries({
|
|
633
|
-
...request,
|
|
634
|
-
url: resolveGraphUrlOrThrow(url),
|
|
635
|
-
attempt: 0
|
|
636
|
-
});
|
|
637
668
|
|
|
638
669
|
// src/features/transcripts/logic-functions/utils/delete-teams-transcript-subscription.ts
|
|
639
670
|
var deleteTeamsTranscriptSubscription = async ({
|