deepline 0.3.491 → 0.3.492
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/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +5 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +293 -110
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +104 -2
- package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +7 -2
- package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +4 -0
- package/dist/bundling-sources/shared_libs/product-notifications/content.ts +13 -0
- package/dist/bundling-sources/shared_libs/product-notifications/email.ts +49 -10
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +22 -0
- package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +6 -1
- package/dist/cli/{auth-FXAC472Y.mjs → auth-4I6QY5WX.mjs} +5 -5
- package/dist/cli/auth-7BCLZU6K.js +43 -0
- package/dist/cli/{billing-PDOA3KZ3.js → billing-2H4GOJZY.js} +79 -79
- package/dist/cli/{billing-UM4LE33K.mjs → billing-4F6L4JSI.mjs} +6 -6
- package/dist/cli/{chunk-ORKLMANE.mjs → chunk-3BRDP4UP.mjs} +1 -1
- package/dist/cli/{chunk-AEKJZJ4R.js → chunk-3IBKEOL4.js} +4 -4
- package/dist/cli/{chunk-TH7JLR5D.js → chunk-3TISK5RQ.js} +6 -6
- package/dist/cli/{chunk-I64PYCTB.js → chunk-42Z6VC2Q.js} +2 -2
- package/dist/cli/{chunk-QBOE5LEH.mjs → chunk-4GJIJHRQ.mjs} +1 -1
- package/dist/cli/{chunk-3FMU6F6E.js → chunk-4RB74KJX.js} +10 -10
- package/dist/cli/{chunk-MAM6ZOVS.mjs → chunk-6YO4OJPM.mjs} +4 -4
- package/dist/cli/{chunk-ZEZ3CZ3X.js → chunk-B2JE3HD6.js} +3 -3
- package/dist/cli/{chunk-5KMGKG4B.js → chunk-BDUFZSUL.js} +8 -8
- package/dist/cli/{chunk-74H5OTRM.js → chunk-DJOLMS2A.js} +1 -1
- package/dist/cli/{chunk-VC3SH4QW.mjs → chunk-DVGCPOEA.mjs} +4 -4
- package/dist/cli/{chunk-B2TXKEED.js → chunk-E47VAVAR.js} +5 -5
- package/dist/cli/{chunk-NUOKAKZW.mjs → chunk-EANFUHRM.mjs} +1 -1
- package/dist/cli/{chunk-HNG2U3IG.js → chunk-EFFHRXKB.js} +2 -2
- package/dist/cli/{chunk-WCWVXN3R.mjs → chunk-F6EQWY4E.mjs} +2 -2
- package/dist/cli/{chunk-IIO7UOVW.mjs → chunk-FFOJRD53.mjs} +1 -1
- package/dist/cli/{chunk-MN6DCV63.js → chunk-FPLN7PHP.js} +5 -5
- package/dist/cli/{chunk-CFPFTS3A.mjs → chunk-GDSZWTJK.mjs} +10 -10
- package/dist/cli/{chunk-27MRSV6O.js → chunk-HFEJ7JJT.js} +26 -26
- package/dist/cli/{chunk-ZX2FXZJN.js → chunk-JHBRJDUC.js} +7 -7
- package/dist/cli/{chunk-SUMKWA53.js → chunk-JJAHWKJ2.js} +53 -53
- package/dist/cli/{chunk-LMG7O6XJ.mjs → chunk-LCCFGSV7.mjs} +2 -2
- package/dist/cli/{chunk-3K4IAV7I.mjs → chunk-MJFVF5AW.mjs} +2 -2
- package/dist/cli/{chunk-EPD7NSDJ.mjs → chunk-MPITIXW4.mjs} +1 -1
- package/dist/cli/{chunk-HSJK6EMU.mjs → chunk-MQ2LQOAM.mjs} +3 -3
- package/dist/cli/{chunk-RFSXXDH7.js → chunk-NBL6JMIY.js} +16 -16
- package/dist/cli/{chunk-X7YOVJBC.js → chunk-NF7NUKWF.js} +37 -37
- package/dist/cli/{chunk-SJOHQ2WW.js → chunk-O2FB42N2.js} +53 -53
- package/dist/cli/{chunk-X75ONMDJ.mjs → chunk-O65HDVA7.mjs} +2 -2
- package/dist/cli/{chunk-6UARNRXT.js → chunk-OGNIB64W.js} +3 -3
- package/dist/cli/{chunk-YV4DP6KQ.mjs → chunk-OKHBAAJG.mjs} +2 -2
- package/dist/cli/{chunk-TMAS3WH3.js → chunk-OTDX4A4W.js} +21 -21
- package/dist/cli/{chunk-2MW6TGNZ.mjs → chunk-OTUT3XTX.mjs} +4 -4
- package/dist/cli/{chunk-PIPEPCRL.mjs → chunk-PIC6M4X3.mjs} +1 -1
- package/dist/cli/{chunk-CRBBGKRH.js → chunk-Q3CCCTRQ.js} +9 -9
- package/dist/cli/{chunk-KGJVDR4Q.mjs → chunk-R5MP3CIY.mjs} +2 -2
- package/dist/cli/{chunk-S4CYM4EC.mjs → chunk-RC366IJS.mjs} +4 -4
- package/dist/cli/{chunk-Q7G7CU4W.js → chunk-SE23YSBK.js} +3 -3
- package/dist/cli/{chunk-IG3GSBBE.js → chunk-TVUE4CPW.js} +7 -7
- package/dist/cli/{chunk-OYJTLEB4.mjs → chunk-UUH4GQRL.mjs} +1 -1
- package/dist/cli/{chunk-DUFRH43S.js → chunk-W4FEX5ZF.js} +94 -94
- package/dist/cli/{chunk-OLHWZM4A.mjs → chunk-Y7QCMOGZ.mjs} +5 -5
- package/dist/cli/{chunk-3WRWPNHE.mjs → chunk-YOCEY4EI.mjs} +5 -5
- package/dist/cli/{chunk-H6UIS36S.mjs → chunk-YVOYZPMY.mjs} +2 -2
- package/dist/cli/{chunk-6PMM7VJN.mjs → chunk-ZCKUNXXR.mjs} +1 -1
- package/dist/cli/{chunk-BCKIBVEJ.js → chunk-ZDTPSVGF.js} +7 -7
- package/dist/cli/{csv-IGPAPAES.js → csv-JGJNDRSA.js} +13 -13
- package/dist/cli/{csv-RNMQHECI.mjs → csv-VGXGV7YM.mjs} +4 -4
- package/dist/cli/{db-CKMVVGXJ.mjs → db-OYG27ZBM.mjs} +6 -6
- package/dist/cli/{db-32OXM3TO.js → db-W52WJ6E5.js} +27 -27
- package/dist/cli/{describe-QR7I3VOF.mjs → describe-FIXCRO5N.mjs} +17 -17
- package/dist/cli/describe-G3O6OUBG.js +50 -0
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-S4M4JMCU.mjs → executions-EVE4KUGL.mjs} +6 -6
- package/dist/cli/{executions-PCZS7B2M.js → executions-LAJHZGPY.js} +8 -8
- package/dist/cli/{feedback-FGUJVCBS.mjs → feedback-75QB7KVG.mjs} +4 -4
- package/dist/cli/{feedback-6EGKPZ3U.js → feedback-ZABCN7RT.js} +8 -8
- package/dist/cli/git-QBAR46NW.js +25 -0
- package/dist/cli/{git-LR4ARG5H.mjs → git-QIFEYQGY.mjs} +5 -5
- package/dist/cli/index.js +137 -137
- package/dist/cli/index.mjs +40 -40
- package/dist/cli/{legacy-noops-VX4JEQR6.js → legacy-noops-2TBIAMCM.js} +8 -8
- package/dist/cli/{legacy-noops-S37PJ7OJ.mjs → legacy-noops-PNTWBBGY.mjs} +5 -5
- package/dist/cli/{monitors-H3AX6CZG.mjs → monitors-LOHUYJEI.mjs} +7 -7
- package/dist/cli/{monitors-ADASJI72.js → monitors-UKBOEGBS.js} +91 -91
- package/dist/cli/{org-ZRJ3C56J.js → org-E7A6QLBW.js} +72 -72
- package/dist/cli/{org-D3F5LUDW.mjs → org-JRUKUOUF.mjs} +6 -6
- package/dist/cli/{pages-5TKO3644.js → pages-EUDFFLLD.js} +17 -17
- package/dist/cli/{pages-PSHU366M.mjs → pages-K76HA473.mjs} +6 -6
- package/dist/cli/{play-AUDDK7XB.mjs → play-DG2N66SV.mjs} +17 -17
- package/dist/cli/{play-VDAETQDI.js → play-UWHNUJRA.js} +312 -312
- package/dist/cli/{providers-IURPWRWD.js → providers-DZX6TTC6.js} +9 -9
- package/dist/cli/{providers-X7YMZSKQ.mjs → providers-RUTTPUZD.mjs} +6 -6
- package/dist/cli/{quickstart-6AGWVFNX.mjs → quickstart-RGZZN2YE.mjs} +4 -4
- package/dist/cli/{quickstart-Y6GFXLDV.js → quickstart-U4NMD7KX.js} +6 -6
- package/dist/cli/{run-TQFGOXNT.js → run-5UNF4FHG.js} +36 -36
- package/dist/cli/{run-TG7J45NS.mjs → run-MOJWQYFQ.mjs} +22 -22
- package/dist/cli/search-3DAEJL6S.js +32 -0
- package/dist/cli/{search-3G4J2GC6.mjs → search-5B3ZDU7H.mjs} +7 -7
- package/dist/cli/{search-output-ZGNHDCLL.mjs → search-output-QS4IWWHA.mjs} +4 -4
- package/dist/cli/{search-output-NPZICK5C.js → search-output-VQWJS3FN.js} +6 -6
- package/dist/cli/{secrets-KTTHT4ZG.js → secrets-S3PJMEAC.js} +15 -15
- package/dist/cli/{secrets-EAWJBRUD.mjs → secrets-V5XVDBIS.mjs} +6 -6
- package/dist/cli/{sessions-D4Q3LCEQ.mjs → sessions-5V3X24XI.mjs} +5 -5
- package/dist/cli/{sessions-S4YVBPAW.js → sessions-Y5QMEZ3D.js} +6 -6
- package/dist/cli/{settings-BAK3VOWW.js → settings-3U6RRO5F.js} +78 -78
- package/dist/cli/{settings-JUORW6NL.mjs → settings-LHZYY5PT.mjs} +11 -11
- package/dist/cli/{setup-AXFGCXJE.mjs → setup-AJLWXYAN.mjs} +9 -9
- package/dist/cli/{setup-NJPHTW32.js → setup-MLLIGO2S.js} +49 -49
- package/dist/cli/{skills-SKJVDJEF.mjs → skills-5O2MUWKK.mjs} +7 -7
- package/dist/cli/skills-BBLIML5M.js +36 -0
- package/dist/cli/{tools-63THJVJZ.mjs → tools-PWNMI5CD.mjs} +16 -16
- package/dist/cli/tools-X5SQXUMM.js +57 -0
- package/dist/cli/update-AEJ2ZSZQ.js +34 -0
- package/dist/cli/{update-KSID5F74.mjs → update-SXT4QW7S.mjs} +9 -9
- package/dist/cli/{workflow-BLSMWBKW.js → workflow-3WTF5IYT.js} +17 -17
- package/dist/cli/{workflow-C4B54X2Z.mjs → workflow-KPRM6ARO.mjs} +7 -7
- package/dist/{client-CQgGFxAH.d.ts → client-Cb1ej1Vr.d.ts} +1 -1
- package/dist/{client-core-BUNjKBKq.d.ts → client-core-BmVs6SP0.d.ts} +66 -2
- package/dist/{client-core-DMvHWjub.d.mts → client-core-CoBTvsXG.d.mts} +66 -2
- package/dist/{client-B4R1scm2.d.mts → client-vWpbLNCB.d.mts} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +102 -102
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-QIDL3YCW.js +0 -43
- package/dist/cli/describe-67GMIEIO.js +0 -50
- package/dist/cli/git-PIH5Z5LN.js +0 -25
- package/dist/cli/search-VC43NUY7.js +0 -32
- package/dist/cli/skills-4NQZISNK.js +0 -36
- package/dist/cli/tools-BAHK33FQ.js +0 -57
- package/dist/cli/update-EMIGRGJ7.js +0 -34
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
ProductNotificationRepeatMode,
|
|
5
5
|
ProductNotificationTrigger,
|
|
6
6
|
} from './configuration';
|
|
7
|
+
import { INCLUDED_ALLOWANCE_RULE_KEY } from './configuration';
|
|
7
8
|
import { PRODUCT_NOTIFICATION_EVENT_CATALOG } from './contract';
|
|
8
9
|
import {
|
|
9
10
|
ProductNotificationEvent,
|
|
@@ -13,7 +14,7 @@ import {
|
|
|
13
14
|
type ProductNotificationEventName,
|
|
14
15
|
} from './events';
|
|
15
16
|
import { legacySlackNotificationType } from './legacy-slack';
|
|
16
|
-
import type { NotificationText } from './content';
|
|
17
|
+
import type { NotificationText, NotificationUsageMeter } from './content';
|
|
17
18
|
import {
|
|
18
19
|
BILLING_PURCHASE_LATE_RULE_KEY,
|
|
19
20
|
BILLING_RENEWAL_LATE_RULE_KEY,
|
|
@@ -83,7 +84,8 @@ export type ProductNotificationPresentation = {
|
|
|
83
84
|
subjectId: string;
|
|
84
85
|
severity?: ProductNotificationSeverity;
|
|
85
86
|
/** Selects an alternate email layout; absent means the standard one. */
|
|
86
|
-
emailFormat?: 'thank_you';
|
|
87
|
+
emailFormat?: 'thank_you' | 'included_allowance';
|
|
88
|
+
usageMeters?: NotificationUsageMeter[];
|
|
87
89
|
playRun?: import('./content').PlayRunEmailContent;
|
|
88
90
|
};
|
|
89
91
|
|
|
@@ -931,6 +933,106 @@ const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
|
|
|
931
933
|
}),
|
|
932
934
|
},
|
|
933
935
|
},
|
|
936
|
+
{
|
|
937
|
+
id: 'billing.included_usage.exhausted',
|
|
938
|
+
eventName: ProductNotificationEvent.BillingIncludedUsageExhausted,
|
|
939
|
+
requiredFilter: {},
|
|
940
|
+
allowedTriggers: ['each_match'],
|
|
941
|
+
catalog: {
|
|
942
|
+
name: 'Included usage exhausted',
|
|
943
|
+
category: 'credits',
|
|
944
|
+
description:
|
|
945
|
+
'Email workspace owners when included people search, Play compute, or managed storage is used up.',
|
|
946
|
+
allowMultiple: false,
|
|
947
|
+
editor: { kind: 'none' },
|
|
948
|
+
},
|
|
949
|
+
rule: {
|
|
950
|
+
default: {
|
|
951
|
+
ruleKey: INCLUDED_ALLOWANCE_RULE_KEY,
|
|
952
|
+
groupKey: 'default',
|
|
953
|
+
},
|
|
954
|
+
create: (_input, base) => ({
|
|
955
|
+
...base,
|
|
956
|
+
repeatMode: 'every_match',
|
|
957
|
+
trigger: { kind: 'each_match' },
|
|
958
|
+
}),
|
|
959
|
+
present: ({ payload }) => {
|
|
960
|
+
const allowance = String(payload.allowance);
|
|
961
|
+
const storage = allowance === 'Managed storage';
|
|
962
|
+
const compute = allowance === 'Play compute';
|
|
963
|
+
const benefit = storage
|
|
964
|
+
? 'storage'
|
|
965
|
+
: compute
|
|
966
|
+
? allowance
|
|
967
|
+
: allowance.toLowerCase();
|
|
968
|
+
const overage = compute
|
|
969
|
+
? 'additional Play runtime'
|
|
970
|
+
: 'Deepline-native searches';
|
|
971
|
+
const resetDate = new Date(Number(payload.resetsAt)).toLocaleString(
|
|
972
|
+
'en-US',
|
|
973
|
+
{
|
|
974
|
+
month: 'long',
|
|
975
|
+
day: 'numeric',
|
|
976
|
+
year: 'numeric',
|
|
977
|
+
hour: '2-digit',
|
|
978
|
+
minute: '2-digit',
|
|
979
|
+
hourCycle: 'h23',
|
|
980
|
+
timeZone: 'UTC',
|
|
981
|
+
},
|
|
982
|
+
);
|
|
983
|
+
const hasUpgrade =
|
|
984
|
+
typeof payload.nextPlan === 'string' &&
|
|
985
|
+
typeof payload.nextIncluded === 'number' &&
|
|
986
|
+
payload.nextIncluded > 0;
|
|
987
|
+
const unit = compute
|
|
988
|
+
? 'standard-equivalent hours'
|
|
989
|
+
: String(payload.unit);
|
|
990
|
+
const unitsPerDisplayUnit = compute ? 60 : 1;
|
|
991
|
+
const meter = {
|
|
992
|
+
used: Number(payload.used) / unitsPerDisplayUnit,
|
|
993
|
+
included: Number(payload.included) / unitsPerDisplayUnit,
|
|
994
|
+
unit,
|
|
995
|
+
};
|
|
996
|
+
return {
|
|
997
|
+
title: storage
|
|
998
|
+
? 'Your included Deepline storage is used up'
|
|
999
|
+
: `${allowance} allowance used up`,
|
|
1000
|
+
summary: [
|
|
1001
|
+
'Your ',
|
|
1002
|
+
{ workspace: true },
|
|
1003
|
+
storage
|
|
1004
|
+
? ' has used all its included storage, which means you’ll start paying to store your enrichment data and Play outputs in the Deepline database beyond that limit.'
|
|
1005
|
+
: ` has used all its included ${benefit}, which means you’ll start paying for ${overage}.`,
|
|
1006
|
+
],
|
|
1007
|
+
details: [
|
|
1008
|
+
[
|
|
1009
|
+
storage
|
|
1010
|
+
? `Storage is measured daily. Additional storage costs ${payload.overageRate}.`
|
|
1011
|
+
: `Your allowance resets on ${resetDate} (UTC). Additional usage costs ${payload.overageRate}.`,
|
|
1012
|
+
...(compute
|
|
1013
|
+
? [' Larger sandboxes use more compute per hour.']
|
|
1014
|
+
: []),
|
|
1015
|
+
...(hasUpgrade
|
|
1016
|
+
? [
|
|
1017
|
+
` If you’d like more included ${benefit}, `,
|
|
1018
|
+
{
|
|
1019
|
+
link: String(payload.nextPlan),
|
|
1020
|
+
href: 'https://deepline.com/pricing',
|
|
1021
|
+
},
|
|
1022
|
+
` includes ${formatCredits(Number(payload.nextIncluded) / unitsPerDisplayUnit)} ${unit}.`,
|
|
1023
|
+
]
|
|
1024
|
+
: []),
|
|
1025
|
+
],
|
|
1026
|
+
],
|
|
1027
|
+
usageMeters: [{ ...meter, label: `${allowance} · Your plan` }],
|
|
1028
|
+
emailFormat: 'included_allowance',
|
|
1029
|
+
targetUrl: String(payload.targetUrl),
|
|
1030
|
+
subjectKind: 'workspace',
|
|
1031
|
+
subjectId: String(payload.accountId),
|
|
1032
|
+
};
|
|
1033
|
+
},
|
|
1034
|
+
},
|
|
1035
|
+
},
|
|
934
1036
|
{
|
|
935
1037
|
id: 'internal.billing.credit_purchase',
|
|
936
1038
|
eventName: ProductNotificationEvent.CreditsPurchaseCompleted,
|
|
@@ -9,9 +9,12 @@ import type {
|
|
|
9
9
|
ProductNotificationDefaultRule,
|
|
10
10
|
ProductNotificationGroupDraft,
|
|
11
11
|
} from './configuration';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
INCLUDED_ALLOWANCE_RULE_KEY,
|
|
14
|
+
normalizeProductNotificationEmailList,
|
|
15
|
+
productNotificationValuesEqual,
|
|
16
|
+
} from './configuration';
|
|
13
17
|
import { PRODUCT_NOTIFICATION_SHADOW_TYPES } from './catalog';
|
|
14
|
-
import { normalizeProductNotificationEmailList } from './configuration';
|
|
15
18
|
export {
|
|
16
19
|
createProductNotificationRule,
|
|
17
20
|
type ProductNotificationPlayFailureSettings as PlayFailureOptions,
|
|
@@ -322,6 +325,8 @@ export function buildProductNotificationGroupOperations(
|
|
|
322
325
|
for (const rule of savedRules) {
|
|
323
326
|
if (draft.rules.some((candidate) => candidate.ruleKey === rule.ruleKey))
|
|
324
327
|
continue;
|
|
328
|
+
// Older editors omit this rule. Its single-rule toggle sends an explicit setting.
|
|
329
|
+
if (rule.ruleKey === INCLUDED_ALLOWANCE_RULE_KEY) continue;
|
|
325
330
|
if (
|
|
326
331
|
rule.configMode === 'default' ||
|
|
327
332
|
rule.configMode === 'replace_default'
|
|
@@ -4,6 +4,8 @@ export type ProductNotificationFacts = Record<
|
|
|
4
4
|
ProductNotificationFactValue
|
|
5
5
|
>;
|
|
6
6
|
|
|
7
|
+
export const INCLUDED_ALLOWANCE_RULE_KEY = 'default.included_usage_exhausted';
|
|
8
|
+
|
|
7
9
|
const PRODUCT_NOTIFICATION_EMAIL_PATTERN = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
8
10
|
|
|
9
11
|
/** Normalize an email destination consistently across API, CLI, and delivery. */
|
|
@@ -543,6 +545,8 @@ export function resolveEffectiveProductNotificationConfiguration(input: {
|
|
|
543
545
|
>({
|
|
544
546
|
defaults: input.policy.rules.filter(
|
|
545
547
|
(rule) =>
|
|
548
|
+
// An existing group snapshot predates this newly added default.
|
|
549
|
+
rule.ruleKey === INCLUDED_ALLOWANCE_RULE_KEY ||
|
|
546
550
|
!replacedDefaultGroupKeys.has(rule.groupKey) ||
|
|
547
551
|
ruleOverrides.has(rule.ruleKey),
|
|
548
552
|
),
|
|
@@ -13,6 +13,19 @@ export type NotificationText =
|
|
|
13
13
|
|
|
14
14
|
export type NotificationIcon = 'calendar' | 'book-open';
|
|
15
15
|
|
|
16
|
+
export type NotificationUsageMeter = {
|
|
17
|
+
label: string;
|
|
18
|
+
unit: string;
|
|
19
|
+
used: number;
|
|
20
|
+
included: number;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export function notificationUsageMeterText(meter: NotificationUsageMeter) {
|
|
24
|
+
const format = (amount: number) =>
|
|
25
|
+
amount.toLocaleString('en-US', { maximumFractionDigits: 2 });
|
|
26
|
+
return `${meter.label} · ${format(meter.used)} of ${format(meter.included)} included ${meter.unit}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
16
29
|
export type PlayRunEmailContent = {
|
|
17
30
|
name: string;
|
|
18
31
|
description?: string;
|
|
@@ -10,8 +10,10 @@ import {
|
|
|
10
10
|
} from './workspace';
|
|
11
11
|
import {
|
|
12
12
|
notificationText,
|
|
13
|
+
notificationUsageMeterText,
|
|
13
14
|
type NotificationText,
|
|
14
15
|
type PlayRunEmailContent,
|
|
16
|
+
type NotificationUsageMeter,
|
|
15
17
|
} from './content';
|
|
16
18
|
|
|
17
19
|
export {
|
|
@@ -38,10 +40,11 @@ type ProductNotificationEmailContent = {
|
|
|
38
40
|
severity?: 'success' | 'warning' | 'error';
|
|
39
41
|
/**
|
|
40
42
|
* `thank_you` is the standard layout without the notification group header,
|
|
41
|
-
* with
|
|
42
|
-
*
|
|
43
|
+
* with compact details. `included_allowance` leads with usage meters and
|
|
44
|
+
* uses paragraphs for the details.
|
|
43
45
|
*/
|
|
44
|
-
emailFormat?: 'thank_you';
|
|
46
|
+
emailFormat?: 'thank_you' | 'included_allowance';
|
|
47
|
+
usageMeters?: NotificationUsageMeter[];
|
|
45
48
|
playRun?: PlayRunEmailContent;
|
|
46
49
|
};
|
|
47
50
|
|
|
@@ -49,6 +52,16 @@ const MAX_RECIPIENTS = 50;
|
|
|
49
52
|
const MAX_FAILURE_PREVIEW_CHARACTERS = 280;
|
|
50
53
|
const MAX_FAILURE_PREVIEW_LINES = 3;
|
|
51
54
|
|
|
55
|
+
function meterHtml(meter: NotificationUsageMeter, allowanceExhausted: boolean) {
|
|
56
|
+
const filled = Number(
|
|
57
|
+
(Math.max(0, Math.min(1, meter.used / meter.included)) * 100).toFixed(2),
|
|
58
|
+
);
|
|
59
|
+
const color =
|
|
60
|
+
allowanceExhausted || meter.used > meter.included ? '#ffbf00' : '#1919ff';
|
|
61
|
+
return `<p style="margin:0 0 ${allowanceExhausted ? '10px' : '6px'};font-size:13px;color:#525252">${escapeHtml(notificationUsageMeterText(meter))}</p>
|
|
62
|
+
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="table-layout:fixed;margin:0 0 ${allowanceExhausted ? '32px' : '18px'};background:#e5e5e5;border-radius:8px"><tr>${filled > 0 ? `<td width="${filled}%" height="8" style="background:${color};border-radius:8px;font-size:0"> </td>` : ''}${filled < 100 ? `<td height="8" style="font-size:0"> </td>` : ''}</tr></table>`;
|
|
63
|
+
}
|
|
64
|
+
|
|
52
65
|
function failurePreview(error: string): string {
|
|
53
66
|
const lines = error.split(/\r?\n/, MAX_FAILURE_PREVIEW_LINES + 1);
|
|
54
67
|
const characters = Array.from(
|
|
@@ -213,7 +226,16 @@ export function renderProductNotificationEmail(
|
|
|
213
226
|
const oneClickOptOutUrl = input.oneClickUnsubscribeUrl
|
|
214
227
|
? unsubscribeUrl(input.oneClickUnsubscribeUrl)
|
|
215
228
|
: optOutUrl;
|
|
216
|
-
const
|
|
229
|
+
const includedAllowance = input.content.emailFormat === 'included_allowance';
|
|
230
|
+
const showGroupHeader = input.content.emailFormat === undefined;
|
|
231
|
+
const meters = (input.content.usageMeters ?? []).filter(
|
|
232
|
+
(meter) =>
|
|
233
|
+
Number.isFinite(meter.used) &&
|
|
234
|
+
Number.isFinite(meter.included) &&
|
|
235
|
+
meter.included > 0,
|
|
236
|
+
);
|
|
237
|
+
const htmlMeters = meters.map((meter) => meterHtml(meter, includedAllowance));
|
|
238
|
+
const openLabel = meters.length > 0 ? 'View billing' : 'Open Deepline';
|
|
217
239
|
if (playRun && !targetUrl) {
|
|
218
240
|
throw new Error('Play run email requires a run link.');
|
|
219
241
|
}
|
|
@@ -222,10 +244,15 @@ export function renderProductNotificationEmail(
|
|
|
222
244
|
: undefined;
|
|
223
245
|
const text = [
|
|
224
246
|
input.content.title,
|
|
247
|
+
...(includedAllowance
|
|
248
|
+
? ['', ...meters.map(notificationUsageMeterText)]
|
|
249
|
+
: []),
|
|
225
250
|
...(showGroupHeader && !playRun
|
|
226
251
|
? [`Notification group: ${input.content.groupName}`]
|
|
227
252
|
: []),
|
|
228
|
-
...(targetUrl && !playRun
|
|
253
|
+
...(targetUrl && !playRun && !includedAllowance
|
|
254
|
+
? [`${openLabel}: ${targetUrl}`]
|
|
255
|
+
: []),
|
|
229
256
|
'',
|
|
230
257
|
...(playRun
|
|
231
258
|
? [
|
|
@@ -246,7 +273,11 @@ export function renderProductNotificationEmail(
|
|
|
246
273
|
...input.content.details.map((detail) =>
|
|
247
274
|
notificationText(detail, input.workspaceName),
|
|
248
275
|
),
|
|
276
|
+
...(!includedAllowance ? meters.map(notificationUsageMeterText) : []),
|
|
249
277
|
]),
|
|
278
|
+
...(targetUrl && includedAllowance
|
|
279
|
+
? ['', `${openLabel}: ${targetUrl}`]
|
|
280
|
+
: []),
|
|
250
281
|
'',
|
|
251
282
|
`You are receiving this because of your Deepline notification settings: ${settingsUrl}`,
|
|
252
283
|
...(optOutUrl
|
|
@@ -262,7 +293,7 @@ export function renderProductNotificationEmail(
|
|
|
262
293
|
const detailCount = input.content.details.length;
|
|
263
294
|
const html = [
|
|
264
295
|
'<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background-color:#ffffff"><tr><td align="center" style="padding:48px 24px">',
|
|
265
|
-
|
|
296
|
+
`<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="max-width:480px"><tr><td style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased${includedAllowance ? ';text-align:left' : ''}">`,
|
|
266
297
|
'<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="margin:0 0 40px"><tr>',
|
|
267
298
|
`<td align="left" valign="middle"><a href="${escapeHtml(logoUrl)}" style="display:inline-block;text-decoration:none"><img src="https://code.deepline.com/brand/logo_full_dark.png" width="120" height="auto" alt="Deepline" style="display:block;border:0"></a></td>`,
|
|
268
299
|
`<td align="right" valign="middle">${severityBadge}</td>`,
|
|
@@ -301,10 +332,17 @@ export function renderProductNotificationEmail(
|
|
|
301
332
|
`<p style="margin:16px 0 32px;font-size:14px;line-height:1.6;color:#525252">Run: <a href="${escapeHtml(targetUrl!)}" style="color:#525252;text-decoration:underline">${escapeHtml(playRun.runId)}</a></p>`,
|
|
302
333
|
]
|
|
303
334
|
: [
|
|
304
|
-
`<h1 style="margin:0 0 8px;font-size:22px;font-weight:600;color:#0a0a0a;line-height:1.3;letter-spacing:-0.02em">${escapeHtml(input.content.title)}</h1>`,
|
|
305
|
-
|
|
335
|
+
`<h1 style="margin:0 0 ${includedAllowance ? '32px' : '8px'};font-size:22px;font-weight:600;color:#0a0a0a;line-height:1.3;letter-spacing:-0.02em">${escapeHtml(input.content.title)}</h1>`,
|
|
336
|
+
...(includedAllowance ? htmlMeters : []),
|
|
337
|
+
`<p style="margin:0 0 ${includedAllowance ? '12px' : '24px'};font-size:15px;line-height:1.6;color:#525252">${contentHtml(input.content.summary, input.workspaceName)}</p>`,
|
|
306
338
|
]),
|
|
307
|
-
...(
|
|
339
|
+
...(includedAllowance
|
|
340
|
+
? input.content.details.map(
|
|
341
|
+
(detail) =>
|
|
342
|
+
`<p style="margin:0 0 12px;font-size:15px;line-height:1.6;color:#525252">${contentHtml(detail, input.workspaceName)}</p>`,
|
|
343
|
+
)
|
|
344
|
+
: []),
|
|
345
|
+
...(!playRun && !includedAllowance && detailCount > 0
|
|
308
346
|
? [
|
|
309
347
|
`<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="border:1px solid #e5e5e5;border-radius:10px;margin:0 0 28px"><tr><td style="padding:${showGroupHeader ? '4px' : '11px'} 18px">`,
|
|
310
348
|
...input.content.details.map((detail, index) =>
|
|
@@ -318,10 +356,11 @@ export function renderProductNotificationEmail(
|
|
|
318
356
|
'</td></tr></table>',
|
|
319
357
|
]
|
|
320
358
|
: []),
|
|
359
|
+
...(!includedAllowance ? htmlMeters : []),
|
|
321
360
|
...(targetUrl && !playRun
|
|
322
361
|
? [
|
|
323
362
|
'<table role="presentation" cellspacing="0" cellpadding="0" style="margin:0 0 32px"><tr>',
|
|
324
|
-
`<td style="background-color:#0a0a0a;border-radius:6px"><a href="${escapeHtml(targetUrl)}" style="display:inline-block;padding:12px 24px;font-size:14px;font-weight:500;color:#ffffff;text-decoration:none"
|
|
363
|
+
`<td style="background-color:#0a0a0a;border-radius:6px"><a href="${escapeHtml(targetUrl)}" style="display:inline-block;padding:12px 24px;font-size:14px;font-weight:500;color:#ffffff;text-decoration:none">${openLabel}</a></td>`,
|
|
325
364
|
'</tr></table>',
|
|
326
365
|
]
|
|
327
366
|
: []),
|
|
@@ -34,6 +34,7 @@ export const ProductNotificationEvent = {
|
|
|
34
34
|
BillingRenewalLate: 'billing.renewal.late',
|
|
35
35
|
BillingUsageChargeObserved: 'billing.usage.charge_observed',
|
|
36
36
|
BillingAllowanceExhausted: 'billing.allowance.exhausted',
|
|
37
|
+
BillingIncludedUsageExhausted: 'billing.included_usage.exhausted',
|
|
37
38
|
MonitorLifecycleChanged: 'monitor.lifecycle.changed',
|
|
38
39
|
PlayLifecycleChanged: 'play.lifecycle.changed',
|
|
39
40
|
PlayRunCompleted: 'play.run.completed',
|
|
@@ -80,6 +81,7 @@ export const PRODUCT_NOTIFICATION_EVENT_NAMES = [
|
|
|
80
81
|
ProductNotificationEvent.BillingRenewalLate,
|
|
81
82
|
ProductNotificationEvent.BillingUsageChargeObserved,
|
|
82
83
|
ProductNotificationEvent.BillingAllowanceExhausted,
|
|
84
|
+
ProductNotificationEvent.BillingIncludedUsageExhausted,
|
|
83
85
|
] as const;
|
|
84
86
|
|
|
85
87
|
export const PRODUCT_NOTIFICATION_COMPATIBILITY_EVENT_NAMES = [
|
|
@@ -298,6 +300,26 @@ export const PRODUCT_NOTIFICATION_EVENT_DEFINITIONS: readonly ProductNotificatio
|
|
|
298
300
|
orderingSubjectFact: 'accountId',
|
|
299
301
|
allowedTriggers: ['each_match'],
|
|
300
302
|
},
|
|
303
|
+
{
|
|
304
|
+
eventName: ProductNotificationEvent.BillingIncludedUsageExhausted,
|
|
305
|
+
producerKey: ProductNotificationProducerKey.BillingUsage,
|
|
306
|
+
requiredFacts: {
|
|
307
|
+
accountId: 'string',
|
|
308
|
+
allowance: 'string',
|
|
309
|
+
used: 'number',
|
|
310
|
+
included: 'number',
|
|
311
|
+
unit: 'string',
|
|
312
|
+
overageRate: 'string',
|
|
313
|
+
resetsAt: 'number',
|
|
314
|
+
targetUrl: 'string',
|
|
315
|
+
},
|
|
316
|
+
optionalFacts: {
|
|
317
|
+
nextPlan: 'string',
|
|
318
|
+
nextIncluded: 'number',
|
|
319
|
+
},
|
|
320
|
+
orderingSubjectFact: 'accountId',
|
|
321
|
+
allowedTriggers: ['each_match'],
|
|
322
|
+
},
|
|
301
323
|
{
|
|
302
324
|
eventName: ProductNotificationEvent.BillingRenewalLate,
|
|
303
325
|
producerKey: ProductNotificationProducerKey.BillingPurchases,
|
|
@@ -36,6 +36,7 @@ export type SlackPayloadEnricher = (
|
|
|
36
36
|
) => SlackPayload | Promise<SlackPayload>;
|
|
37
37
|
|
|
38
38
|
export type SlackDeliveryOptions = {
|
|
39
|
+
allowWebhookFallback?: boolean;
|
|
39
40
|
enrichPayload?: SlackPayloadEnricher;
|
|
40
41
|
postMessage?: (
|
|
41
42
|
token: string,
|
|
@@ -701,7 +702,11 @@ export async function sendSlackEvent(
|
|
|
701
702
|
logSlackEventDispatch(channel, sanitizedNormalized, 'bot');
|
|
702
703
|
return;
|
|
703
704
|
}
|
|
704
|
-
if (
|
|
705
|
+
if (
|
|
706
|
+
isBotOnlySlackChannel(channel) ||
|
|
707
|
+
options.allowWebhookFallback === false
|
|
708
|
+
)
|
|
709
|
+
throw error;
|
|
705
710
|
const webhookUrl = resolveWebhookUrl(channel);
|
|
706
711
|
if (!webhookUrl) throw error;
|
|
707
712
|
await postSlackWebhook(webhookUrl, sanitizedNormalized);
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-MQ2LQOAM.mjs";
|
|
18
|
+
import "./chunk-O65HDVA7.mjs";
|
|
19
|
+
import "./chunk-PIC6M4X3.mjs";
|
|
20
|
+
import "./chunk-ZCKUNXXR.mjs";
|
|
21
21
|
import "./chunk-4QF2K7TM.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-HBL4PM5Q.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-UUH4GQRL.mjs";
|
|
25
25
|
import "./chunk-WZYKRD7T.mjs";
|
|
26
26
|
import "./chunk-KRD6H754.mjs";
|
|
27
27
|
export {
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkJJAHWKJ2js = require('./chunk-JJAHWKJ2.js');
|
|
18
|
+
require('./chunk-ZDTPSVGF.js');
|
|
19
|
+
require('./chunk-B2JE3HD6.js');
|
|
20
|
+
require('./chunk-3IBKEOL4.js');
|
|
21
|
+
require('./chunk-ALJJRZNJ.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-DIAWYWT5.js');
|
|
24
|
+
require('./chunk-DJOLMS2A.js');
|
|
25
|
+
require('./chunk-OG64RBAC.js');
|
|
26
|
+
require('./chunk-COGTRVWW.js');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkJJAHWKJ2js.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkJJAHWKJ2js.authStatusLine; exports.clearPendingClaim = _chunkJJAHWKJ2js.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkJJAHWKJ2js.clearSatisfiedPendingClaim; exports.handleRegister = _chunkJJAHWKJ2js.handleRegister; exports.handleStatus = _chunkJJAHWKJ2js.handleStatus; exports.handleWait = _chunkJJAHWKJ2js.handleWait; exports.httpJson = _chunkJJAHWKJ2js.httpJson; exports.readPendingAuthClaim = _chunkJJAHWKJ2js.readPendingAuthClaim; exports.readStatusBanner = _chunkJJAHWKJ2js.readStatusBanner; exports.registerAuthCommands = _chunkJJAHWKJ2js.registerAuthCommands; exports.reportApprovalLinkShown = _chunkJJAHWKJ2js.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkJJAHWKJ2js.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkJJAHWKJ2js.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkJJAHWKJ2js.statusBannerLine;
|