deepline 0.3.87 → 0.3.88

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.
Files changed (65) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +2 -2
  2. package/dist/bundling-sources/sdk/src/monitor-fleet-contract.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/monitors/org-monitor-limits.ts +1 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/runtime-env.ts +0 -6
  7. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +1 -1
  8. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +1 -1
  9. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +0 -302
  10. package/dist/bundling-sources/shared_libs/plays/email-status.ts +1 -1
  11. package/dist/bundling-sources/shared_libs/plays/tool-category-descriptions.ts +2 -2
  12. package/dist/bundling-sources/shared_libs/runtime-env.ts +0 -6
  13. package/dist/cli/index.js +4 -6
  14. package/dist/cli/index.mjs +4 -6
  15. package/dist/index.d.mts +1 -1
  16. package/dist/index.d.ts +1 -1
  17. package/dist/index.js +3 -3
  18. package/dist/index.mjs +3 -3
  19. package/dist/install-integrity.json +2 -45
  20. package/package.json +1 -3
  21. package/dist/bundling-sources/shared_libs/integration-contracts/AGENTS.md +0 -9
  22. package/dist/bundling-sources/shared_libs/integration-contracts/README.md +0 -3
  23. package/dist/bundling-sources/shared_libs/integration-contracts/index.ts +0 -2
  24. package/dist/bundling-sources/shared_libs/monitors/analytics-install-guides.ts +0 -77
  25. package/dist/bundling-sources/shared_libs/monitors/billing/charges.ts +0 -125
  26. package/dist/bundling-sources/shared_libs/monitors/billing/policy-builders.ts +0 -686
  27. package/dist/bundling-sources/shared_libs/monitors/billing/pricing.ts +0 -54
  28. package/dist/bundling-sources/shared_libs/monitors/billing/public-pricing.ts +0 -72
  29. package/dist/bundling-sources/shared_libs/monitors/billing/session.ts +0 -45
  30. package/dist/bundling-sources/shared_libs/monitors/billing/state.ts +0 -454
  31. package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +0 -260
  32. package/dist/bundling-sources/shared_libs/monitors/billing/types.ts +0 -215
  33. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -333
  34. package/dist/bundling-sources/shared_libs/monitors/cursor-page.ts +0 -42
  35. package/dist/bundling-sources/shared_libs/monitors/framework-managed-payload-fields.ts +0 -71
  36. package/dist/bundling-sources/shared_libs/monitors/generated/provider-monitor-callback-admission-targets.ts +0 -16
  37. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +0 -267
  38. package/dist/bundling-sources/shared_libs/monitors/inbound-publish-key.ts +0 -39
  39. package/dist/bundling-sources/shared_libs/monitors/inbound-queue.ts +0 -82
  40. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +0 -473
  41. package/dist/bundling-sources/shared_libs/monitors/package.json +0 -29
  42. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +0 -1125
  43. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-capability.ts +0 -964
  44. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-consumer-health.ts +0 -56
  45. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-errors.ts +0 -131
  46. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-identity-claims.ts +0 -527
  47. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-legacy-aliases.ts +0 -16
  48. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-priority-execution.ts +0 -56
  49. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-public-aliases.ts +0 -28
  50. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-runtime-read-eligibility.ts +0 -38
  51. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-status.ts +0 -10
  52. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +0 -112
  53. package/dist/bundling-sources/shared_libs/monitors/provider-webhook-monitor-runtime.ts +0 -300
  54. package/dist/bundling-sources/shared_libs/monitors/quickstart-prompts.ts +0 -22
  55. package/dist/bundling-sources/shared_libs/monitors/snitcher-install-validation.ts +0 -93
  56. package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +0 -332
  57. package/dist/bundling-sources/shared_libs/monitors/snitcher-radar.ts +0 -221
  58. package/dist/bundling-sources/shared_libs/monitors/starter-templates.ts +0 -105
  59. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +0 -73
  60. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-integrations.ts +0 -81
  61. package/dist/bundling-sources/shared_libs/monitors/tsconfig.json +0 -10
  62. package/dist/bundling-sources/shared_libs/security/header-safe-env.ts +0 -28
  63. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +0 -267
  64. /package/dist/bundling-sources/shared_libs/{integration-contracts/bettercontact/execution-policy.ts → integrations/bettercontact-execution-policy.ts} +0 -0
  65. /package/dist/bundling-sources/shared_libs/{integration-contracts/theirstack/execution-policy.ts → integrations/theirstack-execution-policy.ts} +0 -0
@@ -1,686 +0,0 @@
1
- import { getUsdPerCustomerCredit } from '@deepline/billing/credit-pricing';
2
- import {
3
- MONITOR_BASE_LIFECYCLE_CREDITS,
4
- MONITOR_BILLING_VERIFIED_AT,
5
- MONITOR_PLAN_ENTITLEMENT_ALLOCATION_DIVISOR,
6
- MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
7
- monitorProviderUsdToRetailCredits,
8
- planEntitlementCreateCredits,
9
- } from '@deepline/monitors/billing/pricing';
10
- import type {
11
- MonitorBillingPolicy,
12
- MonitorBillingSource,
13
- MonitorEconomicResponsibility,
14
- MonitorPayloadPricingEntry,
15
- MonitorPayloadPricingMap,
16
- MonitorProviderChargeComponent,
17
- MonitorRetailCharge,
18
- MonitorRetailChargeComponent,
19
- } from '@deepline/monitors/billing/types';
20
- import { providerMonitorCapabilityId } from '@deepline/monitors/provider-monitor-capability';
21
- import { tamradarPayloadPricingForCapability } from '@deepline/monitors/billing/tamradar';
22
-
23
- export type MonitorBillingSourceInput = Omit<
24
- MonitorBillingSource,
25
- 'verifiedAt'
26
- >;
27
-
28
- type FixedRetailChargeSource = Extract<
29
- MonitorRetailChargeComponent,
30
- { kind: 'fixed_deepline_credits' }
31
- >['source'];
32
- type NoCustomerChargeReason = Extract<
33
- MonitorRetailChargeComponent,
34
- { kind: 'no_customer_charge' }
35
- >['reason'];
36
- type UpstreamMarkupSource = Extract<
37
- MonitorRetailChargeComponent,
38
- { kind: 'upstream_cost_markup' }
39
- >['source'];
40
-
41
- function source(input: MonitorBillingSourceInput): MonitorBillingSource {
42
- return {
43
- ...input,
44
- verifiedAt: MONITOR_BILLING_VERIFIED_AT,
45
- };
46
- }
47
-
48
- function fixedCredits(
49
- credits: number,
50
- customerLabel: string,
51
- sourceKind: FixedRetailChargeSource,
52
- basis?: Extract<
53
- MonitorRetailChargeComponent,
54
- { kind: 'fixed_deepline_credits' }
55
- >['basis'],
56
- ): MonitorRetailChargeComponent {
57
- return {
58
- kind: 'fixed_deepline_credits',
59
- credits,
60
- source: sourceKind,
61
- customerLabel,
62
- ...(basis ? { basis } : {}),
63
- };
64
- }
65
-
66
- function noCustomerCharge(
67
- reason: NoCustomerChargeReason,
68
- customerLabel: string,
69
- ): MonitorRetailChargeComponent {
70
- return {
71
- kind: 'no_customer_charge',
72
- reason,
73
- customerLabel,
74
- };
75
- }
76
-
77
- function upstreamMarkupCharge(input: {
78
- customerLabel: string;
79
- providerCostKey: string;
80
- retailCredits?: number;
81
- source: UpstreamMarkupSource;
82
- multiplier?: number;
83
- }): MonitorRetailChargeComponent {
84
- return {
85
- kind: 'upstream_cost_markup',
86
- multiplier: input.multiplier ?? MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
87
- source: input.source,
88
- customerLabel: input.customerLabel,
89
- providerCostKey: input.providerCostKey,
90
- ...(typeof input.retailCredits === 'number'
91
- ? { retailCredits: input.retailCredits }
92
- : {}),
93
- };
94
- }
95
-
96
- function retailCharge(
97
- input: Omit<MonitorRetailCharge, 'components'> & {
98
- components: MonitorRetailChargeComponent[];
99
- },
100
- ): MonitorRetailCharge {
101
- return input;
102
- }
103
-
104
- export function definePlanEntitlementMonitorBillingPolicy(input: {
105
- provider: string;
106
- capability: string;
107
- planName: string;
108
- minimumMonthlyPlanUsd: number;
109
- sources: MonitorBillingSourceInput[];
110
- eventDeliverySourceLabel: string;
111
- economicResponsibility?: MonitorEconomicResponsibility;
112
- }): MonitorBillingPolicy {
113
- const providerCapability = providerMonitorCapabilityId(input);
114
- const createCredits = planEntitlementCreateCredits(
115
- input.minimumMonthlyPlanUsd,
116
- );
117
- const basis = {
118
- minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
119
- allocationDivisor: MONITOR_PLAN_ENTITLEMENT_ALLOCATION_DIVISOR,
120
- usdPerDeeplineCredit: getUsdPerCustomerCredit(),
121
- };
122
- const owner =
123
- input.economicResponsibility ?? 'runtime_upstream_account_owner';
124
- return {
125
- provider: input.provider,
126
- capability: input.capability,
127
- providerCapability,
128
- pricingMode: 'plan_entitlement',
129
- evidenceStatus: 'verified',
130
- economicResponsibility: owner,
131
- sourceDocs: input.sources.map(source),
132
- upstreamMarkupMultiplier: MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
133
- customerCreateCharge: retailCharge({
134
- phase: 'create',
135
- label: 'Monitor create',
136
- components: [
137
- fixedCredits(
138
- createCredits,
139
- 'Monitor create',
140
- 'plan_entitlement_formula',
141
- basis,
142
- ),
143
- ],
144
- }),
145
- customerReactivateCharge: retailCharge({
146
- phase: 'reactivate',
147
- label: 'Monitor reactivate',
148
- components: [
149
- fixedCredits(
150
- createCredits,
151
- 'Monitor reactivate',
152
- 'plan_entitlement_formula',
153
- basis,
154
- ),
155
- ],
156
- }),
157
- customerUsageCharges: [
158
- retailCharge({
159
- phase: 'periodic_renewal',
160
- label: 'Monitor renewal',
161
- components: [
162
- fixedCredits(
163
- createCredits,
164
- 'Monitor renewal',
165
- 'plan_entitlement_formula',
166
- basis,
167
- ),
168
- ],
169
- }),
170
- retailCharge({
171
- phase: 'webhook_event',
172
- label: 'Webhook event delivery',
173
- components: [
174
- noCustomerCharge(
175
- 'included_in_plan_entitlement',
176
- 'Usage included in monitor entitlement',
177
- ),
178
- ],
179
- }),
180
- ],
181
- providerChargeComponents: [
182
- {
183
- kind: 'provider_entitlement_cost',
184
- phase: 'create',
185
- owner,
186
- planName: input.planName,
187
- minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
188
- allocation:
189
- owner === 'customer_owned_upstream'
190
- ? 'customer_paid_directly'
191
- : 'plan_entitlement_retail_formula',
192
- usageIncluded: true,
193
- },
194
- {
195
- kind: 'provider_entitlement_cost',
196
- phase: 'periodic_renewal',
197
- owner,
198
- planName: input.planName,
199
- minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
200
- allocation:
201
- owner === 'customer_owned_upstream'
202
- ? 'customer_paid_directly'
203
- : 'plan_entitlement_retail_formula',
204
- usageIncluded: true,
205
- },
206
- {
207
- kind: 'provider_entitlement_cost',
208
- phase: 'webhook_event',
209
- owner,
210
- planName: input.planName,
211
- minimumMonthlyPlanUsd: input.minimumMonthlyPlanUsd,
212
- allocation:
213
- owner === 'customer_owned_upstream'
214
- ? 'customer_paid_directly'
215
- : 'plan_entitlement_retail_formula',
216
- usageIncluded: true,
217
- },
218
- {
219
- kind: 'provider_documented_no_charge',
220
- phase: 'webhook_event',
221
- scope: 'Webhook event delivery inside the eligible plan entitlement',
222
- sourceLabel: input.eventDeliverySourceLabel,
223
- },
224
- ],
225
- disableOnBillingFailure: true,
226
- };
227
- }
228
-
229
- export function defineWrapperEntitlementMonitorBillingPolicy(input: {
230
- provider: string;
231
- capability: string;
232
- planName: string;
233
- minimumMonthlyPlanUsd: number;
234
- sources: MonitorBillingSourceInput[];
235
- eventDeliverySourceLabel: string;
236
- economicResponsibility?: MonitorEconomicResponsibility;
237
- }): MonitorBillingPolicy {
238
- const policy = definePlanEntitlementMonitorBillingPolicy(input);
239
- const noCharge = (phase: MonitorRetailCharge['phase']) =>
240
- retailCharge({
241
- phase,
242
- label:
243
- phase === 'webhook_event'
244
- ? 'Webhook event delivery'
245
- : phase === 'create'
246
- ? 'Monitor create'
247
- : 'Monitor reactivate',
248
- components: [
249
- noCustomerCharge(
250
- 'included_in_plan_entitlement',
251
- 'Included in Monitor Wrapper Pack entitlement',
252
- ),
253
- ],
254
- });
255
- return {
256
- ...policy,
257
- customerCreateCharge: noCharge('create'),
258
- customerReactivateCharge: noCharge('reactivate'),
259
- customerUsageCharges: policy.customerUsageCharges.map((charge) =>
260
- noCharge(charge.phase),
261
- ),
262
- };
263
- }
264
-
265
- export function defineMeteredStaticMonitorBillingPolicy(input: {
266
- provider: string;
267
- capability: string;
268
- customerMarkupMultiplier?: number;
269
- sources: MonitorBillingSourceInput[];
270
- createProviderComponents: MonitorProviderChargeComponent[];
271
- usageCharges: {
272
- label: string;
273
- providerCostKey: string;
274
- unitName: string;
275
- units: number | { min: number; max: number };
276
- unitCostUsd: number;
277
- sourceLabel: string;
278
- }[];
279
- }): MonitorBillingPolicy {
280
- const providerCapability = providerMonitorCapabilityId(input);
281
- const customerMarkupMultiplier =
282
- input.customerMarkupMultiplier ?? MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER;
283
- const usageRetailCharges = input.usageCharges.map((charge) => {
284
- const units =
285
- typeof charge.units === 'number' ? charge.units : charge.units.max;
286
- const retailCredits = monitorProviderUsdToRetailCredits(
287
- units * charge.unitCostUsd,
288
- customerMarkupMultiplier,
289
- );
290
- return retailCharge({
291
- phase: 'webhook_event',
292
- label: charge.label,
293
- components: [
294
- upstreamMarkupCharge({
295
- customerLabel: charge.label,
296
- providerCostKey: charge.providerCostKey,
297
- source: 'static_provider_unit',
298
- retailCredits,
299
- multiplier: customerMarkupMultiplier,
300
- }),
301
- ],
302
- });
303
- });
304
- const upstreamCreateIsFree =
305
- input.createProviderComponents.length > 0 &&
306
- input.createProviderComponents.every(
307
- (component) => component.kind === 'provider_documented_no_charge',
308
- );
309
- // create and reactivate share the same "waive base fee when upstream create is
310
- // free, otherwise charge the base lifecycle credits" shape — differing only in
311
- // phase + label. Build both from one helper so the waiver contract stays in
312
- // lockstep across the two phases.
313
- const baseLifecycleCharge = (
314
- phase: 'create' | 'reactivate',
315
- label: string,
316
- ): MonitorRetailCharge =>
317
- retailCharge({
318
- phase,
319
- label,
320
- components: upstreamCreateIsFree
321
- ? [
322
- noCustomerCharge(
323
- 'provider_documented_no_charge',
324
- 'No Deepline base create fee — upstream creation is free; billed on responses',
325
- ),
326
- ]
327
- : [
328
- fixedCredits(
329
- MONITOR_BASE_LIFECYCLE_CREDITS,
330
- label,
331
- 'metered_monitor_default',
332
- ),
333
- ],
334
- });
335
- const createCharge = baseLifecycleCharge('create', 'Monitor create');
336
- const reactivateCharge = baseLifecycleCharge(
337
- 'reactivate',
338
- 'Monitor reactivate',
339
- );
340
- return {
341
- provider: input.provider,
342
- capability: input.capability,
343
- providerCapability,
344
- pricingMode: 'metered_static',
345
- evidenceStatus: 'verified',
346
- economicResponsibility: 'deepline_managed_upstream',
347
- sourceDocs: input.sources.map(source),
348
- upstreamMarkupMultiplier: customerMarkupMultiplier,
349
- customerCreateCharge: createCharge,
350
- customerReactivateCharge: reactivateCharge,
351
- customerUsageCharges: usageRetailCharges,
352
- providerChargeComponents: [
353
- ...input.createProviderComponents,
354
- ...input.usageCharges.map((charge): MonitorProviderChargeComponent => {
355
- const units =
356
- typeof charge.units === 'number' ? charge.units : charge.units.max;
357
- return {
358
- kind: 'provider_metered_static',
359
- phase: 'webhook_event',
360
- providerCostKey: charge.providerCostKey,
361
- unitName: charge.unitName,
362
- units: charge.units,
363
- unitCostUsd: charge.unitCostUsd,
364
- retailCredits: monitorProviderUsdToRetailCredits(
365
- units * charge.unitCostUsd,
366
- customerMarkupMultiplier,
367
- ),
368
- sourceLabel: charge.sourceLabel,
369
- };
370
- }),
371
- ],
372
- disableOnBillingFailure: true,
373
- };
374
- }
375
-
376
- export function defineTamradarUnresolvedMonitorBillingPolicy(
377
- capability: string,
378
- ): MonitorBillingPolicy {
379
- const providerCapability = providerMonitorCapabilityId({
380
- provider: 'deepline_native',
381
- capability,
382
- });
383
- return {
384
- provider: 'deepline_native',
385
- capability,
386
- providerCapability,
387
- pricingMode: 'hybrid_unresolved',
388
- evidenceStatus: 'partially_unresolved',
389
- economicResponsibility: 'deepline_managed_upstream',
390
- sourceDocs: [
391
- source({
392
- kind: 'official_provider_docs',
393
- label: 'Deepline Balance and Pricing',
394
- url: 'https://tamradar.mintlify.app/guides/balance-system-explained',
395
- }),
396
- source({
397
- kind: 'official_provider_docs',
398
- label: 'Deepline Monthly Subscription Billing',
399
- url: 'https://tamradar.mintlify.app/guides/balance-monthly-subscription',
400
- }),
401
- source({
402
- kind: 'official_provider_docs',
403
- label: 'Deepline Update-Based Billing',
404
- url: 'https://tamradar.mintlify.app/guides/balance-update-based',
405
- }),
406
- source({
407
- kind: 'official_api_reference',
408
- label: 'Deepline Account Summary',
409
- url: 'https://tamradar.mintlify.app/api-reference/account',
410
- }),
411
- source({
412
- kind: 'official_api_reference',
413
- label: 'Deepline List Radars',
414
- url: 'https://tamradar.mintlify.app/api-reference/list-radars',
415
- }),
416
- ],
417
- upstreamMarkupMultiplier: MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
418
- customerCreateCharge: retailCharge({
419
- phase: 'create',
420
- label: 'Monitor create',
421
- components: [
422
- fixedCredits(
423
- MONITOR_BASE_LIFECYCLE_CREDITS,
424
- 'Monitor create',
425
- 'metered_monitor_default',
426
- ),
427
- upstreamMarkupCharge({
428
- customerLabel: 'Provider setup charge, once known',
429
- providerCostKey: `deepline_native.${capability}.create_or_period`,
430
- source: 'provider_truth',
431
- }),
432
- ],
433
- }),
434
- customerReactivateCharge: retailCharge({
435
- phase: 'reactivate',
436
- label: 'Monitor reactivate',
437
- components: [
438
- fixedCredits(
439
- MONITOR_BASE_LIFECYCLE_CREDITS,
440
- 'Monitor reactivate',
441
- 'metered_monitor_default',
442
- ),
443
- upstreamMarkupCharge({
444
- customerLabel: 'Provider reactivation charge, once known',
445
- providerCostKey: `deepline_native.${capability}.reactivate_or_period`,
446
- source: 'provider_truth',
447
- }),
448
- ],
449
- }),
450
- customerUsageCharges: [
451
- retailCharge({
452
- phase: 'periodic_renewal',
453
- label: 'Provider billing period',
454
- components: [
455
- upstreamMarkupCharge({
456
- customerLabel: 'Provider billing period, once known',
457
- providerCostKey: `deepline_native.${capability}.periodic_renewal`,
458
- source: 'provider_truth',
459
- }),
460
- ],
461
- }),
462
- retailCharge({
463
- phase: 'webhook_event',
464
- label: 'Approved update or finding',
465
- components: [
466
- upstreamMarkupCharge({
467
- customerLabel: 'Approved update or finding, once known',
468
- providerCostKey: `deepline_native.${capability}.approved_update`,
469
- source: 'provider_truth',
470
- }),
471
- ],
472
- }),
473
- ],
474
- providerChargeComponents: [
475
- {
476
- kind: 'unresolved_deepline_paid_exposure',
477
- phase: 'create',
478
- missing: ['exact_billing_mode', 'exact_usd_amount'],
479
- sourceLabel: 'Deepline Balance and Pricing',
480
- blocksPublicDeploy: true,
481
- },
482
- {
483
- kind: 'provider_recurring_period',
484
- phase: 'periodic_renewal',
485
- periodDays: 30,
486
- amountStatus: 'unresolved',
487
- sourceLabel: 'Deepline Monthly Subscription Billing',
488
- },
489
- {
490
- kind: 'provider_metered_dynamic',
491
- phase: 'webhook_event',
492
- truthSources: [
493
- 'provider_webhook',
494
- 'provider_account_balance_delta',
495
- 'provider_ledger_api',
496
- ],
497
- amountStatus: 'known_at_runtime',
498
- sourceLabel: 'Deepline Update-Based Billing',
499
- },
500
- {
501
- kind: 'unresolved_deepline_paid_exposure',
502
- phase: 'webhook_event',
503
- missing: [
504
- 'exact_billing_mode',
505
- 'exact_usd_amount',
506
- 'provider_truth_source',
507
- ],
508
- sourceLabel: 'Deepline Update-Based Billing',
509
- blocksPublicDeploy: true,
510
- },
511
- ],
512
- disableOnBillingFailure: true,
513
- };
514
- }
515
-
516
- function tamradarSourceDocs(): MonitorBillingSource[] {
517
- return [
518
- source({
519
- kind: 'official_provider_docs',
520
- label: 'Deepline Balance and Pricing',
521
- url: 'https://tamradar.mintlify.app/guides/balance-system-explained',
522
- }),
523
- source({
524
- kind: 'official_provider_docs',
525
- label: 'Deepline Monthly Subscription Billing',
526
- url: 'https://tamradar.mintlify.app/guides/balance-monthly-subscription',
527
- }),
528
- source({
529
- kind: 'official_provider_docs',
530
- label: 'Deepline Update-Based Billing',
531
- url: 'https://tamradar.mintlify.app/guides/balance-update-based',
532
- }),
533
- source({
534
- kind: 'official_api_reference',
535
- label: 'Deepline Account Summary',
536
- url: 'https://tamradar.mintlify.app/api-reference/account',
537
- }),
538
- source({
539
- kind: 'official_api_reference',
540
- label: 'Deepline List Radars',
541
- url: 'https://tamradar.mintlify.app/api-reference/list-radars',
542
- }),
543
- ];
544
- }
545
-
546
- function payloadEntriesByMode(
547
- pricing: MonitorPayloadPricingMap,
548
- mode: MonitorPayloadPricingEntry['mode'],
549
- ) {
550
- return Object.entries(pricing.entries).filter(
551
- (entry): entry is [string, MonitorPayloadPricingEntry] =>
552
- entry[1].mode === mode,
553
- );
554
- }
555
-
556
- function tamradarChargeForPayloadEntry(input: {
557
- phase: MonitorRetailCharge['phase'];
558
- entry: MonitorPayloadPricingEntry;
559
- }): MonitorRetailChargeComponent {
560
- return upstreamMarkupCharge({
561
- customerLabel: `${input.entry.label} ${input.entry.unitLabel}`,
562
- providerCostKey: input.entry.providerCostKey,
563
- source: 'static_provider_unit',
564
- retailCredits: input.entry.retailCredits,
565
- });
566
- }
567
-
568
- export function defineTamradarMonitorBillingPolicy(
569
- capability: string,
570
- ): MonitorBillingPolicy {
571
- const providerCapability = providerMonitorCapabilityId({
572
- provider: 'deepline_native',
573
- capability,
574
- });
575
- const payloadPricing = tamradarPayloadPricingForCapability(capability);
576
- const usageEntries = payloadEntriesByMode(payloadPricing, 'monitor_usage');
577
- const subscriptionEntries = payloadEntriesByMode(
578
- payloadPricing,
579
- 'monitor_subscription',
580
- );
581
- const subscriptionComponents = subscriptionEntries.map(([, entry]) =>
582
- tamradarChargeForPayloadEntry({ phase: 'create', entry }),
583
- );
584
- const usageComponents = usageEntries.map(([, entry]) =>
585
- tamradarChargeForPayloadEntry({ phase: 'webhook_event', entry }),
586
- );
587
- const noBaseCreateCharge = noCustomerCharge(
588
- 'provider_documented_no_charge',
589
- 'No Deepline base create charge',
590
- );
591
- const noBaseReactivateCharge = noCustomerCharge(
592
- 'provider_documented_no_charge',
593
- 'No Deepline base reactivate charge',
594
- );
595
- const customerUsageCharges: MonitorRetailCharge[] = [];
596
- if (subscriptionEntries.length > 0) {
597
- customerUsageCharges.push(
598
- retailCharge({
599
- phase: 'subscription_renewal',
600
- label: 'Monitor subscription renewal',
601
- components: subscriptionEntries.map(([, entry]) =>
602
- tamradarChargeForPayloadEntry({
603
- phase: 'subscription_renewal',
604
- entry,
605
- }),
606
- ),
607
- }),
608
- );
609
- }
610
- if (usageEntries.length > 0) {
611
- customerUsageCharges.push(
612
- retailCharge({
613
- phase: 'webhook_event',
614
- label: 'Approved update or finding',
615
- components: usageComponents,
616
- }),
617
- );
618
- }
619
-
620
- return {
621
- provider: 'deepline_native',
622
- capability,
623
- providerCapability,
624
- pricingMode: 'mixed_provider_native',
625
- evidenceStatus: 'verified',
626
- economicResponsibility: 'deepline_managed_upstream',
627
- sourceDocs: tamradarSourceDocs(),
628
- upstreamMarkupMultiplier: MONITOR_UPSTREAM_COST_MARKUP_MULTIPLIER,
629
- customerCreateCharge: retailCharge({
630
- phase: 'create',
631
- label: 'Monitor create',
632
- components: [noBaseCreateCharge, ...subscriptionComponents],
633
- }),
634
- customerReactivateCharge: retailCharge({
635
- phase: 'reactivate',
636
- label: 'Monitor reactivate',
637
- components: [
638
- noBaseReactivateCharge,
639
- ...subscriptionEntries.map(([, entry]) =>
640
- tamradarChargeForPayloadEntry({ phase: 'reactivate', entry }),
641
- ),
642
- ],
643
- }),
644
- customerUsageCharges,
645
- providerChargeComponents: [
646
- ...usageEntries.map(([, entry]): MonitorProviderChargeComponent => {
647
- return {
648
- kind: 'provider_metered_static',
649
- phase: 'webhook_event',
650
- providerCostKey: entry.providerCostKey,
651
- unitName: entry.unitLabel,
652
- units: 1,
653
- unitCostUsd: entry.providerCostUsd,
654
- retailCredits: entry.retailCredits,
655
- sourceLabel: 'Deepline Update-Based Billing',
656
- };
657
- }),
658
- ...subscriptionEntries.flatMap(([, entry]) => {
659
- return [
660
- {
661
- kind: 'provider_metered_static',
662
- phase: 'create',
663
- providerCostKey: entry.providerCostKey,
664
- unitName: entry.unitLabel,
665
- units: 1,
666
- unitCostUsd: entry.providerCostUsd,
667
- retailCredits: entry.retailCredits,
668
- sourceLabel: 'Deepline Monthly Subscription Billing',
669
- },
670
- {
671
- kind: 'provider_metered_static',
672
- phase: 'subscription_renewal',
673
- providerCostKey: entry.providerCostKey,
674
- unitName: entry.unitLabel,
675
- units: 1,
676
- unitCostUsd: entry.providerCostUsd,
677
- retailCredits: entry.retailCredits,
678
- sourceLabel: 'Deepline Monthly Subscription Billing',
679
- },
680
- ] satisfies MonitorProviderChargeComponent[];
681
- }),
682
- ],
683
- disableOnBillingFailure: true,
684
- payloadPricing,
685
- };
686
- }