deepline 0.3.415 → 0.3.417
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/scheduled-jobs.json +18 -0
- package/dist/bundling-sources/shared_libs/product-notifications/billing-sales.ts +6 -1
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +53 -32
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +14 -0
- package/dist/bundling-sources/shared_libs/security/receipt-admission-token.ts +64 -9
- package/dist/cli/{auth-3R7XJOU4.mjs → auth-2WNDS7OY.mjs} +4 -4
- package/dist/cli/auth-3NIULVL4.js +40 -0
- package/dist/cli/{billing-CEQACJBE.mjs → billing-4Z7QGTTO.mjs} +4 -4
- package/dist/cli/{billing-63YR65DL.js → billing-P26TYS3F.js} +73 -73
- package/dist/cli/{chunk-TOUMT7XB.mjs → chunk-2HQOCIFE.mjs} +2 -2
- package/dist/cli/{chunk-KOQGG5WZ.js → chunk-3FPDXTYQ.js} +16 -16
- package/dist/cli/{chunk-EMWMLURG.mjs → chunk-3U6CYHMT.mjs} +1 -1
- package/dist/cli/{chunk-DI63MOEP.js → chunk-5D477CAK.js} +28 -19
- package/dist/cli/{chunk-JM3BQNP2.mjs → chunk-723EDOP2.mjs} +2 -2
- package/dist/cli/{chunk-OJ4N5XMI.js → chunk-A3G7FZXB.js} +35 -35
- package/dist/cli/{chunk-5MP7LBHF.js → chunk-C3YRH3EQ.js} +2 -2
- package/dist/cli/{chunk-OJGQ7JE3.mjs → chunk-CCRV2MCO.mjs} +1 -1
- package/dist/cli/{chunk-Y2CT65YJ.mjs → chunk-ECKCIGJC.mjs} +1 -1
- package/dist/cli/{chunk-IOULR7YA.js → chunk-EHGFSE44.js} +1 -1
- package/dist/cli/{chunk-CQ5FHAX2.mjs → chunk-GRIE5VE3.mjs} +1 -1
- package/dist/cli/{chunk-Q44253PX.mjs → chunk-H25KUAJM.mjs} +1 -1
- package/dist/cli/{chunk-U4RSPPD7.mjs → chunk-H67BP5SQ.mjs} +3 -3
- package/dist/cli/{chunk-6WQGIJSW.mjs → chunk-IHHPUALO.mjs} +1 -1
- package/dist/cli/{chunk-BBQTQRDC.js → chunk-IX6CRC7R.js} +6 -6
- package/dist/cli/{chunk-WAPSY6F3.js → chunk-L5YPTOLF.js} +10 -10
- package/dist/cli/{chunk-TQU3G7NC.mjs → chunk-MRBM5H5V.mjs} +4 -4
- package/dist/cli/{chunk-EV6OLL4W.mjs → chunk-NATVQHG6.mjs} +5 -5
- package/dist/cli/{chunk-UCE2CYXP.js → chunk-OLCY3CTW.js} +2 -2
- package/dist/cli/{chunk-N4SYPFH4.js → chunk-OW7VBN4Q.js} +6 -6
- package/dist/cli/{chunk-H3ZWEHLG.js → chunk-QLP4Z6JG.js} +4 -4
- package/dist/cli/{chunk-UOGTM7NF.js → chunk-QS7WRPCP.js} +50 -50
- package/dist/cli/{chunk-44SXWCI5.js → chunk-R7HAELOE.js} +52 -52
- package/dist/cli/{chunk-LEPECCA5.mjs → chunk-RRBYMSN6.mjs} +2 -2
- package/dist/cli/{chunk-UK22LQKF.mjs → chunk-TNFYPFMU.mjs} +8 -8
- package/dist/cli/{chunk-D34G5I2G.js → chunk-ULGMHMTD.js} +8 -8
- package/dist/cli/{chunk-5L3NL6HV.mjs → chunk-W2DLQJ35.mjs} +23 -14
- package/dist/cli/{chunk-WQXQDVHQ.mjs → chunk-WRM2OWWT.mjs} +2 -2
- package/dist/cli/{chunk-CKP2OAKZ.js → chunk-Y2HY7GL3.js} +20 -20
- package/dist/cli/{chunk-F66SBZUA.js → chunk-YGZV4IVP.js} +79 -79
- package/dist/cli/{chunk-5RZZHZEJ.mjs → chunk-Z7IVSY3A.mjs} +3 -3
- package/dist/cli/{chunk-M2I4TC2C.js → chunk-ZJFUKGDR.js} +26 -26
- package/dist/cli/{csv-PKQX3TSA.js → csv-PHHEOCRC.js} +12 -12
- package/dist/cli/{csv-2KFJJLDT.mjs → csv-UKZDQDD5.mjs} +3 -3
- package/dist/cli/{db-PLBBJZSD.js → db-DUMQYDPZ.js} +25 -25
- package/dist/cli/{db-N26UHFY7.mjs → db-K3N4AJHP.mjs} +4 -4
- package/dist/cli/{describe-7RR4IO2K.mjs → describe-LYS7YLGP.mjs} +12 -12
- package/dist/cli/{describe-QGZ33RCB.js → describe-RSQAAZWX.js} +16 -16
- package/dist/cli/describe-core.d.mts +1 -1
- package/dist/cli/describe-core.d.ts +1 -1
- package/dist/cli/{executions-XUFGT3SW.mjs → executions-A7OT35MH.mjs} +4 -4
- package/dist/cli/{executions-A7JY32A5.js → executions-FQI2EGXY.js} +6 -6
- package/dist/cli/{feedback-PIDESS5I.mjs → feedback-E77JS5G4.mjs} +3 -3
- package/dist/cli/{feedback-GU7HYQPX.js → feedback-EGTCQ4VW.js} +7 -7
- package/dist/cli/git-PHGV243L.js +24 -0
- package/dist/cli/{git-ST2L7VCM.mjs → git-Y66QSXUA.mjs} +4 -4
- package/dist/cli/index.js +131 -131
- package/dist/cli/index.mjs +36 -36
- package/dist/cli/{legacy-noops-Q4D3TT7J.js → legacy-noops-BUEO7ZIG.js} +7 -7
- package/dist/cli/{legacy-noops-WLZ3HD5L.mjs → legacy-noops-E7NYDS2S.mjs} +4 -4
- package/dist/cli/{monitors-DQBYHBTI.js → monitors-IGOA4L5O.js} +84 -84
- package/dist/cli/{monitors-4DRP7ABU.mjs → monitors-YGX7XZHL.mjs} +4 -4
- package/dist/cli/{org-XMP5FH4W.mjs → org-IUCMNFCG.mjs} +4 -4
- package/dist/cli/{org-JDFN2BMD.js → org-QOVN4IJE.js} +64 -64
- package/dist/cli/{play-LSEV7CLQ.mjs → play-BASBWJY7.mjs} +10 -10
- package/dist/cli/{play-AVX67TTR.js → play-GCQETZW6.js} +283 -283
- package/dist/cli/{providers-3B7KUXCF.mjs → providers-RF7LEMAP.mjs} +4 -4
- package/dist/cli/{providers-QOUY73G2.js → providers-VC5QBJZ3.js} +7 -7
- package/dist/cli/{quickstart-BVKDXXBN.js → quickstart-64EULHRG.js} +5 -5
- package/dist/cli/{quickstart-KFITIZGE.mjs → quickstart-7GAOQSQA.mjs} +3 -3
- package/dist/cli/search-7TOXLL4V.js +30 -0
- package/dist/cli/{search-MXMDK6BE.mjs → search-UOMJJUVT.mjs} +5 -5
- package/dist/cli/{secrets-PHV2PC55.js → secrets-GGXQOSGV.js} +13 -13
- package/dist/cli/{secrets-IX6ZHGMU.mjs → secrets-MIIKANZ7.mjs} +4 -4
- package/dist/cli/{sessions-2YAIVSQY.js → sessions-L7OMZEPU.js} +5 -5
- package/dist/cli/{sessions-NHNLYXBA.mjs → sessions-VQENKFWC.mjs} +4 -4
- package/dist/cli/{settings-APUXXPOD.js → settings-GKI7CZ62.js} +75 -75
- package/dist/cli/{settings-SAHN4OJN.mjs → settings-JCJPJCKF.mjs} +8 -8
- package/dist/cli/{setup-QOZSIUEX.mjs → setup-BN25RDMT.mjs} +7 -7
- package/dist/cli/{setup-URQ7BG5P.js → setup-P4AM7K34.js} +42 -42
- package/dist/cli/{skills-FLNMB5IF.mjs → skills-3M2OV4EQ.mjs} +5 -5
- package/dist/cli/skills-NGE2YPQJ.js +29 -0
- package/dist/cli/{tools-USDETSBP.mjs → tools-337Y5WWW.mjs} +12 -12
- package/dist/cli/tools-ROHOYYLK.js +44 -0
- package/dist/cli/update-6ZC2XCW6.js +31 -0
- package/dist/cli/{update-ZPY45JN4.mjs → update-A3Y6PY7O.mjs} +7 -7
- package/dist/cli/{workflow-GSEM32G7.mjs → workflow-LPO25MX7.mjs} +5 -5
- package/dist/cli/{workflow-KYWMP2JG.js → workflow-XQATHEOS.js} +15 -15
- package/dist/{client-D2A39edb.d.mts → client-CNfY1AzH.d.mts} +57 -13
- package/dist/{client-D6w0_gN1.d.ts → client-CNjtvsqn.d.ts} +57 -13
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +6 -6
- package/dist/index.mjs +3 -3
- package/dist/install-integrity.json +80 -80
- 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/package.json +1 -1
- package/dist/cli/auth-BPP3XUUK.js +0 -40
- package/dist/cli/git-EGJIIULI.js +0 -24
- package/dist/cli/search-UWPN4TLM.js +0 -30
- package/dist/cli/skills-ODG4WSUP.js +0 -29
- package/dist/cli/tools-R43QU6JL.js +0 -44
- package/dist/cli/update-AGI5HJUV.js +0 -31
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.417',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -1447,5 +1447,23 @@
|
|
|
1447
1447
|
"runTimeoutMs": 300000,
|
|
1448
1448
|
"failureAlert": "convex_action_wrapper",
|
|
1449
1449
|
"domainReportRequired": true
|
|
1450
|
+
},
|
|
1451
|
+
{
|
|
1452
|
+
"id": "convex.billing-credit-delivery-watchdog",
|
|
1453
|
+
"name": "Billing credit delivery watchdog",
|
|
1454
|
+
"scheduler": "convex_scheduled_action",
|
|
1455
|
+
"cadence": "runAfter at 30 and 120 seconds per paid invoice",
|
|
1456
|
+
"timezone": "UTC",
|
|
1457
|
+
"source": "packages/convex/scheduledJobsNode.ts",
|
|
1458
|
+
"locator": "checkBillingInvoiceDelivery",
|
|
1459
|
+
"owner": "billing",
|
|
1460
|
+
"criticality": "critical",
|
|
1461
|
+
"purpose": "Observe paid-invoice credit delivery independently of renewal operations and admit the shared direct Slack alert.",
|
|
1462
|
+
"successDefinition": "The invoice is verified delivered, outside scope, or a missing-credit alert is durably admitted.",
|
|
1463
|
+
"failureDefinition": "Payment or credit evidence cannot be verified, or observation/notification admission fails.",
|
|
1464
|
+
"startGraceMs": 120000,
|
|
1465
|
+
"runTimeoutMs": 60000,
|
|
1466
|
+
"failureAlert": "convex_action_wrapper",
|
|
1467
|
+
"domainReportRequired": true
|
|
1450
1468
|
}
|
|
1451
1469
|
]
|
|
@@ -4,10 +4,15 @@ export const BILLING_SALES_SLACK_CHANNEL_ID = 'C0AGWVD2TNK';
|
|
|
4
4
|
export const BILLING_SALES_CONNECTION_ID = 'platform-reporting-bot';
|
|
5
5
|
export const BILLING_SALES_CREDIT_PURCHASE_MINIMUM_CENTS = 1;
|
|
6
6
|
export const BILLING_PURCHASE_LATE_RULE_KEY = 'internal.billing.purchase_late';
|
|
7
|
+
export const BILLING_RENEWAL_LATE_RULE_KEY = 'internal.billing.renewal_late';
|
|
8
|
+
export const BILLING_DELIVERY_LATE_RULE_KEYS: readonly string[] = [
|
|
9
|
+
BILLING_PURCHASE_LATE_RULE_KEY,
|
|
10
|
+
BILLING_RENEWAL_LATE_RULE_KEY,
|
|
11
|
+
];
|
|
7
12
|
export const BILLING_SALES_RULE_KEYS: readonly string[] = [
|
|
8
13
|
'internal.billing.credit_purchase',
|
|
9
14
|
'internal.billing.paid_plan',
|
|
10
|
-
|
|
15
|
+
...BILLING_DELIVERY_LATE_RULE_KEYS,
|
|
11
16
|
];
|
|
12
17
|
|
|
13
18
|
export function isPlatformNotificationGroup(groupKey: string): boolean {
|
|
@@ -15,6 +15,7 @@ import { legacySlackNotificationType } from './legacy-slack';
|
|
|
15
15
|
import type { NotificationText } from './content';
|
|
16
16
|
import {
|
|
17
17
|
BILLING_PURCHASE_LATE_RULE_KEY,
|
|
18
|
+
BILLING_RENEWAL_LATE_RULE_KEY,
|
|
18
19
|
BILLING_SALES_CREDIT_PURCHASE_MINIMUM_CENTS,
|
|
19
20
|
BILLING_SALES_GROUP_KEY,
|
|
20
21
|
} from './billing-sales';
|
|
@@ -273,6 +274,46 @@ const GROWTH_LEARN_MORE_DETAILS: NotificationText[] = [
|
|
|
273
274
|
];
|
|
274
275
|
|
|
275
276
|
/** One canonical registry owns every notification type's runtime and UI metadata. */
|
|
277
|
+
function lateCreditDeliveryRegistration<Id extends string>(
|
|
278
|
+
id: Id,
|
|
279
|
+
eventName: ProductNotificationEventName,
|
|
280
|
+
label: 'Purchase' | 'Renewal',
|
|
281
|
+
identityField: 'operationId' | 'stripeInvoiceId',
|
|
282
|
+
) {
|
|
283
|
+
return {
|
|
284
|
+
id,
|
|
285
|
+
eventName,
|
|
286
|
+
requiredFilter: {},
|
|
287
|
+
allowedTriggers: ['each_match'],
|
|
288
|
+
catalog: undefined,
|
|
289
|
+
shadow: true,
|
|
290
|
+
rule: {
|
|
291
|
+
default: { ruleKey: id, groupKey: BILLING_SALES_GROUP_KEY },
|
|
292
|
+
create: (_input, base) => ({
|
|
293
|
+
...base,
|
|
294
|
+
repeatMode: 'every_match',
|
|
295
|
+
trigger: { kind: 'each_match' },
|
|
296
|
+
}),
|
|
297
|
+
present: ({ payload }) => ({
|
|
298
|
+
title: `${label} not completed after ${payload.thresholdSeconds} seconds`,
|
|
299
|
+
summary: [
|
|
300
|
+
`<!channel> ${label} fulfillment in `,
|
|
301
|
+
{ workspace: true },
|
|
302
|
+
' needs investigation. Verify payment and fulfillment independently.',
|
|
303
|
+
],
|
|
304
|
+
details: [
|
|
305
|
+
`${label === 'Purchase' ? 'Operation' : 'Stripe invoice'}: ${payload[identityField]}`,
|
|
306
|
+
],
|
|
307
|
+
targetUrl: String(payload.targetUrl),
|
|
308
|
+
subjectKind:
|
|
309
|
+
label === 'Purchase' ? 'billing_operation' : 'billing_invoice',
|
|
310
|
+
subjectId: String(payload[identityField]),
|
|
311
|
+
severity: 'error',
|
|
312
|
+
}),
|
|
313
|
+
},
|
|
314
|
+
} satisfies NotificationTypeRegistration;
|
|
315
|
+
}
|
|
316
|
+
|
|
276
317
|
const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
|
|
277
318
|
{
|
|
278
319
|
id: 'monitor.disabled.insufficient_credits',
|
|
@@ -816,38 +857,18 @@ const PRODUCT_NOTIFICATION_TYPE_REGISTRY = [
|
|
|
816
857
|
}),
|
|
817
858
|
},
|
|
818
859
|
},
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
create: (_input, base) => ({
|
|
832
|
-
...base,
|
|
833
|
-
repeatMode: 'every_match',
|
|
834
|
-
trigger: { kind: 'each_match' },
|
|
835
|
-
}),
|
|
836
|
-
present: ({ payload }) => ({
|
|
837
|
-
title: `Purchase not completed after ${payload.thresholdSeconds} seconds`,
|
|
838
|
-
summary: [
|
|
839
|
-
'<!channel> Purchase fulfillment in ',
|
|
840
|
-
{ workspace: true },
|
|
841
|
-
' needs investigation. Verify payment and fulfillment independently.',
|
|
842
|
-
],
|
|
843
|
-
details: [`Operation: ${payload.operationId}`],
|
|
844
|
-
targetUrl: String(payload.targetUrl),
|
|
845
|
-
subjectKind: 'billing_operation',
|
|
846
|
-
subjectId: String(payload.operationId),
|
|
847
|
-
severity: 'error',
|
|
848
|
-
}),
|
|
849
|
-
},
|
|
850
|
-
},
|
|
860
|
+
lateCreditDeliveryRegistration(
|
|
861
|
+
BILLING_PURCHASE_LATE_RULE_KEY,
|
|
862
|
+
ProductNotificationEvent.BillingPurchaseLate,
|
|
863
|
+
'Purchase',
|
|
864
|
+
'operationId',
|
|
865
|
+
),
|
|
866
|
+
lateCreditDeliveryRegistration(
|
|
867
|
+
BILLING_RENEWAL_LATE_RULE_KEY,
|
|
868
|
+
ProductNotificationEvent.BillingRenewalLate,
|
|
869
|
+
'Renewal',
|
|
870
|
+
'stripeInvoiceId',
|
|
871
|
+
),
|
|
851
872
|
{
|
|
852
873
|
id: 'play.failed',
|
|
853
874
|
eventName: ProductNotificationEvent.PlayRunCompleted,
|
|
@@ -21,6 +21,7 @@ export const ProductNotificationEvent = {
|
|
|
21
21
|
AutoTopupLimitObserved: 'billing.auto_topup.limit_observed',
|
|
22
22
|
BillingPlanPurchased: 'billing.plan.purchased',
|
|
23
23
|
BillingPurchaseLate: 'billing.purchase.late',
|
|
24
|
+
BillingRenewalLate: 'billing.renewal.late',
|
|
24
25
|
MonitorLifecycleChanged: 'monitor.lifecycle.changed',
|
|
25
26
|
PlayLifecycleChanged: 'play.lifecycle.changed',
|
|
26
27
|
PlayRunCompleted: 'play.run.completed',
|
|
@@ -64,6 +65,7 @@ export const PRODUCT_NOTIFICATION_EVENT_NAMES = [
|
|
|
64
65
|
ProductNotificationEvent.CreditsPurchaseCompleted,
|
|
65
66
|
ProductNotificationEvent.BillingPlanPurchased,
|
|
66
67
|
ProductNotificationEvent.BillingPurchaseLate,
|
|
68
|
+
ProductNotificationEvent.BillingRenewalLate,
|
|
67
69
|
] as const;
|
|
68
70
|
|
|
69
71
|
export const PRODUCT_NOTIFICATION_COMPATIBILITY_EVENT_NAMES = [
|
|
@@ -245,6 +247,18 @@ export const PRODUCT_NOTIFICATION_EVENT_DEFINITIONS: readonly ProductNotificatio
|
|
|
245
247
|
orderingSubjectFact: 'operationId',
|
|
246
248
|
allowedTriggers: ['each_match'],
|
|
247
249
|
},
|
|
250
|
+
{
|
|
251
|
+
eventName: ProductNotificationEvent.BillingRenewalLate,
|
|
252
|
+
producerKey: ProductNotificationProducerKey.BillingPurchases,
|
|
253
|
+
requiredFacts: {
|
|
254
|
+
accountId: 'string',
|
|
255
|
+
stripeInvoiceId: 'string',
|
|
256
|
+
thresholdSeconds: 'number',
|
|
257
|
+
targetUrl: 'string',
|
|
258
|
+
},
|
|
259
|
+
orderingSubjectFact: 'stripeInvoiceId',
|
|
260
|
+
allowedTriggers: ['each_match'],
|
|
261
|
+
},
|
|
248
262
|
...PRODUCT_NOTIFICATION_COMPATIBILITY_EVENT_NAMES.map((eventName) => ({
|
|
249
263
|
eventName,
|
|
250
264
|
producerKey: ProductNotificationProducerKey.LegacyProductNotifications,
|
|
@@ -100,6 +100,26 @@ export async function verifyCreditReadinessToken(
|
|
|
100
100
|
scanId: string;
|
|
101
101
|
cursor: string | null;
|
|
102
102
|
}> {
|
|
103
|
+
const claims = await verifyObservationToken(
|
|
104
|
+
token,
|
|
105
|
+
'deepline.credit_readiness',
|
|
106
|
+
nowMs,
|
|
107
|
+
);
|
|
108
|
+
if (
|
|
109
|
+
typeof claims.scanId !== 'string' ||
|
|
110
|
+
!claims.scanId ||
|
|
111
|
+
(claims.cursor !== null &&
|
|
112
|
+
(typeof claims.cursor !== 'string' || !claims.cursor))
|
|
113
|
+
)
|
|
114
|
+
throw new Error('Invalid credit readiness token.');
|
|
115
|
+
return { scanId: claims.scanId, cursor: claims.cursor as string | null };
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async function verifyObservationToken(
|
|
119
|
+
token: string,
|
|
120
|
+
audience: string,
|
|
121
|
+
nowMs: number,
|
|
122
|
+
): Promise<Record<string, unknown>> {
|
|
103
123
|
const parts = token.split('.');
|
|
104
124
|
if (parts.length !== 3) throw new Error('Invalid credit readiness token.');
|
|
105
125
|
const decode = (value: string) =>
|
|
@@ -126,11 +146,7 @@ export async function verifyCreditReadinessToken(
|
|
|
126
146
|
header.typ !== 'JWT' ||
|
|
127
147
|
claims.v !== TOKEN_VERSION ||
|
|
128
148
|
claims.iss !== TOKEN_ISSUER ||
|
|
129
|
-
claims.aud !==
|
|
130
|
-
typeof claims.scanId !== 'string' ||
|
|
131
|
-
!claims.scanId ||
|
|
132
|
-
(claims.cursor !== null &&
|
|
133
|
-
(typeof claims.cursor !== 'string' || !claims.cursor)) ||
|
|
149
|
+
claims.aud !== audience ||
|
|
134
150
|
!Number.isSafeInteger(claims.iat) ||
|
|
135
151
|
!Number.isSafeInteger(claims.exp) ||
|
|
136
152
|
claims.iat > now + 30 ||
|
|
@@ -138,10 +154,7 @@ export async function verifyCreditReadinessToken(
|
|
|
138
154
|
claims.exp - claims.iat !== TOKEN_TTL_SECONDS
|
|
139
155
|
)
|
|
140
156
|
throw new Error('Invalid credit readiness token.');
|
|
141
|
-
return
|
|
142
|
-
scanId: claims.scanId,
|
|
143
|
-
cursor: claims.cursor,
|
|
144
|
-
};
|
|
157
|
+
return claims as Record<string, unknown>;
|
|
145
158
|
}
|
|
146
159
|
|
|
147
160
|
/**
|
|
@@ -323,3 +336,45 @@ export async function mintSqlListenerDispatchRetryToken(input: {
|
|
|
323
336
|
exp: issuedAt + TOKEN_TTL_SECONDS,
|
|
324
337
|
});
|
|
325
338
|
}
|
|
339
|
+
|
|
340
|
+
/** Authorizes one invoice/threshold observation, never a payment, grant or fleet scan. */
|
|
341
|
+
export async function mintBillingDeliveryToken(input: {
|
|
342
|
+
stripeInvoiceId: string;
|
|
343
|
+
thresholdSeconds: 30 | 120;
|
|
344
|
+
nowMs?: number;
|
|
345
|
+
}): Promise<string> {
|
|
346
|
+
const issuedAt = Math.floor((input.nowMs ?? Date.now()) / 1000);
|
|
347
|
+
return mint({
|
|
348
|
+
v: TOKEN_VERSION,
|
|
349
|
+
iss: TOKEN_ISSUER,
|
|
350
|
+
aud: 'deepline.billing_delivery',
|
|
351
|
+
stripeInvoiceId: input.stripeInvoiceId,
|
|
352
|
+
thresholdSeconds: input.thresholdSeconds,
|
|
353
|
+
iat: issuedAt,
|
|
354
|
+
exp: issuedAt + TOKEN_TTL_SECONDS,
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
export async function verifyBillingDeliveryToken(
|
|
359
|
+
token: string,
|
|
360
|
+
nowMs = Date.now(),
|
|
361
|
+
): Promise<{
|
|
362
|
+
stripeInvoiceId: string;
|
|
363
|
+
thresholdSeconds: 30 | 120;
|
|
364
|
+
}> {
|
|
365
|
+
const claims = await verifyObservationToken(
|
|
366
|
+
token,
|
|
367
|
+
'deepline.billing_delivery',
|
|
368
|
+
nowMs,
|
|
369
|
+
);
|
|
370
|
+
if (
|
|
371
|
+
typeof claims.stripeInvoiceId !== 'string' ||
|
|
372
|
+
!claims.stripeInvoiceId ||
|
|
373
|
+
(claims.thresholdSeconds !== 30 && claims.thresholdSeconds !== 120)
|
|
374
|
+
)
|
|
375
|
+
throw new Error('Invalid billing delivery token.');
|
|
376
|
+
return {
|
|
377
|
+
stripeInvoiceId: claims.stripeInvoiceId,
|
|
378
|
+
thresholdSeconds: claims.thresholdSeconds,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
@@ -13,13 +13,13 @@ import {
|
|
|
13
13
|
reportSetupCompleted,
|
|
14
14
|
resolvePendingAuthClaimForResume,
|
|
15
15
|
statusBannerLine
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
18
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-2HQOCIFE.mjs";
|
|
17
|
+
import "./chunk-CCRV2MCO.mjs";
|
|
18
|
+
import "./chunk-H25KUAJM.mjs";
|
|
19
19
|
import "./chunk-MAMVGOSC.mjs";
|
|
20
20
|
import "./chunk-DLIRSHV6.mjs";
|
|
21
21
|
import "./chunk-E4IXDAZI.mjs";
|
|
22
|
-
import "./chunk-
|
|
22
|
+
import "./chunk-3U6CYHMT.mjs";
|
|
23
23
|
import "./chunk-WZYKRD7T.mjs";
|
|
24
24
|
import "./chunk-KRD6H754.mjs";
|
|
25
25
|
export {
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkQS7WRPCPjs = require('./chunk-QS7WRPCP.js');
|
|
17
|
+
require('./chunk-OW7VBN4Q.js');
|
|
18
|
+
require('./chunk-QLP4Z6JG.js');
|
|
19
|
+
require('./chunk-NPBJI7RE.js');
|
|
20
|
+
require('./chunk-XNYIZMNQ.js');
|
|
21
|
+
require('./chunk-PPDBRJRW.js');
|
|
22
|
+
require('./chunk-EHGFSE44.js');
|
|
23
|
+
require('./chunk-OG64RBAC.js');
|
|
24
|
+
require('./chunk-COGTRVWW.js');
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkQS7WRPCPjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkQS7WRPCPjs.authStatusLine; exports.clearPendingClaim = _chunkQS7WRPCPjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkQS7WRPCPjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkQS7WRPCPjs.handleRegister; exports.handleStatus = _chunkQS7WRPCPjs.handleStatus; exports.handleWait = _chunkQS7WRPCPjs.handleWait; exports.httpJson = _chunkQS7WRPCPjs.httpJson; exports.readPendingAuthClaim = _chunkQS7WRPCPjs.readPendingAuthClaim; exports.readStatusBanner = _chunkQS7WRPCPjs.readStatusBanner; exports.registerAuthCommands = _chunkQS7WRPCPjs.registerAuthCommands; exports.reportSetupCompleted = _chunkQS7WRPCPjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkQS7WRPCPjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkQS7WRPCPjs.statusBannerLine;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
DeeplineClient,
|
|
3
3
|
iterateCursorPages,
|
|
4
4
|
requireBillingIdempotencyKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ECKCIGJC.mjs";
|
|
6
6
|
import "./chunk-L2VKAASU.mjs";
|
|
7
7
|
import "./chunk-KCC3FKIW.mjs";
|
|
8
8
|
import "./chunk-EIMG75BT.mjs";
|
|
@@ -13,8 +13,8 @@ import {
|
|
|
13
13
|
openInBrowser,
|
|
14
14
|
printCommandEnvelope,
|
|
15
15
|
shouldEmitJson
|
|
16
|
-
} from "./chunk-
|
|
17
|
-
import "./chunk-
|
|
16
|
+
} from "./chunk-CCRV2MCO.mjs";
|
|
17
|
+
import "./chunk-H25KUAJM.mjs";
|
|
18
18
|
import {
|
|
19
19
|
AuthError,
|
|
20
20
|
ConfigError
|
|
@@ -23,7 +23,7 @@ import "./chunk-DLIRSHV6.mjs";
|
|
|
23
23
|
import {
|
|
24
24
|
DeeplineError
|
|
25
25
|
} from "./chunk-E4IXDAZI.mjs";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-3U6CYHMT.mjs";
|
|
27
27
|
import "./chunk-WZYKRD7T.mjs";
|
|
28
28
|
import "./chunk-KRD6H754.mjs";
|
|
29
29
|
|