@greatwait/contracts 0.2.1 → 0.2.2

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 (46) hide show
  1. package/dist/billing.d.ts +339 -0
  2. package/dist/billing.js +131 -1
  3. package/dist/host-correlation.d.ts +4 -0
  4. package/dist/host-correlation.js +18 -0
  5. package/dist/identifiers.d.ts +2 -0
  6. package/dist/identifiers.js +3 -0
  7. package/dist/index.d.ts +2 -1
  8. package/dist/index.js +2 -1
  9. package/dist/operations.d.ts +514 -0
  10. package/dist/operations.js +93 -1
  11. package/dist/protocol.d.ts +2 -0
  12. package/dist/protocol.js +3 -0
  13. package/dist/scheduling-records.d.ts +4 -0
  14. package/dist/scheduling.d.ts +12 -0
  15. package/dist/scheduling.js +13 -0
  16. package/generated/v1/examples/billing.promotions.response.json +26 -0
  17. package/generated/v1/examples/billing.redeem.request.json +4 -0
  18. package/generated/v1/examples/billing.redeem.response.json +43 -0
  19. package/generated/v1/manifest.json +56 -0
  20. package/generated/v1/openapi.json +2749 -89
  21. package/generated/v1/policy-matrix.json +14 -0
  22. package/generated/v1/schemas/billing.change.response.json +64 -0
  23. package/generated/v1/schemas/billing.projects.response.json +64 -0
  24. package/generated/v1/schemas/billing.promotions.response.json +188 -0
  25. package/generated/v1/schemas/billing.quote.response.json +51 -0
  26. package/generated/v1/schemas/billing.reconcile.response.json +324 -0
  27. package/generated/v1/schemas/billing.redeem.request-headers.json +13 -0
  28. package/generated/v1/schemas/billing.redeem.request.json +22 -0
  29. package/generated/v1/schemas/billing.redeem.response-headers.json +10 -0
  30. package/generated/v1/schemas/billing.redeem.response.json +326 -0
  31. package/generated/v1/schemas/billing.summary.response.json +324 -0
  32. package/generated/v1/schemas/executions.list.query.json +12 -0
  33. package/generated/v1/schemas/schedules.archive.response.json +17 -0
  34. package/generated/v1/schemas/schedules.cancel.response.json +17 -0
  35. package/generated/v1/schemas/schedules.create.request.json +17 -0
  36. package/generated/v1/schemas/schedules.create.response.json +17 -0
  37. package/generated/v1/schemas/schedules.list.query.json +12 -0
  38. package/generated/v1/schemas/schedules.list.response.json +17 -0
  39. package/generated/v1/schemas/schedules.pause.response.json +17 -0
  40. package/generated/v1/schemas/schedules.read.response.json +17 -0
  41. package/generated/v1/schemas/schedules.replace.request.json +17 -0
  42. package/generated/v1/schemas/schedules.replace.response.json +17 -0
  43. package/generated/v1/schemas/schedules.resume.response.json +17 -0
  44. package/generated/v1/snippets/billing.promotions.json +6 -0
  45. package/generated/v1/snippets/billing.redeem.json +6 -0
  46. package/package.json +1 -1
package/dist/billing.d.ts CHANGED
@@ -706,6 +706,92 @@ export declare const billingSummarySchema: import("zod").ZodObject<{
706
706
  microdollars: import("zod").ZodString;
707
707
  scale: import("zod").ZodLiteral<6>;
708
708
  }, import("zod/v4/core").$strip>;
709
+ byKind: import("zod").ZodOptional<import("zod").ZodObject<{
710
+ purchased: import("zod").ZodObject<{
711
+ available: import("zod").ZodObject<{
712
+ currency: import("zod").ZodLiteral<"USD">;
713
+ microdollars: import("zod").ZodString;
714
+ scale: import("zod").ZodLiteral<6>;
715
+ }, import("zod/v4/core").$strip>;
716
+ reserved: import("zod").ZodObject<{
717
+ currency: import("zod").ZodLiteral<"USD">;
718
+ microdollars: import("zod").ZodString;
719
+ scale: import("zod").ZodLiteral<6>;
720
+ }, import("zod/v4/core").$strip>;
721
+ consumed: import("zod").ZodObject<{
722
+ currency: import("zod").ZodLiteral<"USD">;
723
+ microdollars: import("zod").ZodString;
724
+ scale: import("zod").ZodLiteral<6>;
725
+ }, import("zod/v4/core").$strip>;
726
+ forfeited: import("zod").ZodObject<{
727
+ currency: import("zod").ZodLiteral<"USD">;
728
+ microdollars: import("zod").ZodString;
729
+ scale: import("zod").ZodLiteral<6>;
730
+ }, import("zod/v4/core").$strip>;
731
+ granted: import("zod").ZodObject<{
732
+ currency: import("zod").ZodLiteral<"USD">;
733
+ microdollars: import("zod").ZodString;
734
+ scale: import("zod").ZodLiteral<6>;
735
+ }, import("zod/v4/core").$strip>;
736
+ expiresAt: import("zod").ZodOptional<import("zod").ZodString>;
737
+ }, import("zod/v4/core").$strip>;
738
+ trial: import("zod").ZodObject<{
739
+ available: import("zod").ZodObject<{
740
+ currency: import("zod").ZodLiteral<"USD">;
741
+ microdollars: import("zod").ZodString;
742
+ scale: import("zod").ZodLiteral<6>;
743
+ }, import("zod/v4/core").$strip>;
744
+ reserved: import("zod").ZodObject<{
745
+ currency: import("zod").ZodLiteral<"USD">;
746
+ microdollars: import("zod").ZodString;
747
+ scale: import("zod").ZodLiteral<6>;
748
+ }, import("zod/v4/core").$strip>;
749
+ consumed: import("zod").ZodObject<{
750
+ currency: import("zod").ZodLiteral<"USD">;
751
+ microdollars: import("zod").ZodString;
752
+ scale: import("zod").ZodLiteral<6>;
753
+ }, import("zod/v4/core").$strip>;
754
+ forfeited: import("zod").ZodObject<{
755
+ currency: import("zod").ZodLiteral<"USD">;
756
+ microdollars: import("zod").ZodString;
757
+ scale: import("zod").ZodLiteral<6>;
758
+ }, import("zod/v4/core").$strip>;
759
+ granted: import("zod").ZodObject<{
760
+ currency: import("zod").ZodLiteral<"USD">;
761
+ microdollars: import("zod").ZodString;
762
+ scale: import("zod").ZodLiteral<6>;
763
+ }, import("zod/v4/core").$strip>;
764
+ expiresAt: import("zod").ZodOptional<import("zod").ZodString>;
765
+ }, import("zod/v4/core").$strip>;
766
+ promotional: import("zod").ZodObject<{
767
+ available: import("zod").ZodObject<{
768
+ currency: import("zod").ZodLiteral<"USD">;
769
+ microdollars: import("zod").ZodString;
770
+ scale: import("zod").ZodLiteral<6>;
771
+ }, import("zod/v4/core").$strip>;
772
+ reserved: import("zod").ZodObject<{
773
+ currency: import("zod").ZodLiteral<"USD">;
774
+ microdollars: import("zod").ZodString;
775
+ scale: import("zod").ZodLiteral<6>;
776
+ }, import("zod/v4/core").$strip>;
777
+ consumed: import("zod").ZodObject<{
778
+ currency: import("zod").ZodLiteral<"USD">;
779
+ microdollars: import("zod").ZodString;
780
+ scale: import("zod").ZodLiteral<6>;
781
+ }, import("zod/v4/core").$strip>;
782
+ forfeited: import("zod").ZodObject<{
783
+ currency: import("zod").ZodLiteral<"USD">;
784
+ microdollars: import("zod").ZodString;
785
+ scale: import("zod").ZodLiteral<6>;
786
+ }, import("zod/v4/core").$strip>;
787
+ granted: import("zod").ZodObject<{
788
+ currency: import("zod").ZodLiteral<"USD">;
789
+ microdollars: import("zod").ZodString;
790
+ scale: import("zod").ZodLiteral<6>;
791
+ }, import("zod/v4/core").$strip>;
792
+ expiresAt: import("zod").ZodOptional<import("zod").ZodString>;
793
+ }, import("zod/v4/core").$strip>;
794
+ }, import("zod/v4/core").$strip>>;
709
795
  }, import("zod/v4/core").$strip>;
710
796
  desiredRevision: import("zod").ZodNumber;
711
797
  effectiveRevision: import("zod").ZodNumber;
@@ -970,6 +1056,23 @@ export declare const projectBillingQuoteSchema: import("zod").ZodObject<{
970
1056
  }, import("zod/v4/core").$strip>;
971
1057
  effectiveAt: import("zod").ZodString;
972
1058
  formerIncludedWillBlock: import("zod").ZodBoolean;
1059
+ discount: import("zod").ZodOptional<import("zod").ZodObject<{
1060
+ gross: import("zod").ZodObject<{
1061
+ currency: import("zod").ZodLiteral<"USD">;
1062
+ microdollars: import("zod").ZodString;
1063
+ scale: import("zod").ZodLiteral<6>;
1064
+ }, import("zod/v4/core").$strip>;
1065
+ amount: import("zod").ZodObject<{
1066
+ currency: import("zod").ZodLiteral<"USD">;
1067
+ microdollars: import("zod").ZodString;
1068
+ scale: import("zod").ZodLiteral<6>;
1069
+ }, import("zod/v4/core").$strip>;
1070
+ duration: import("zod").ZodEnum<{
1071
+ once: "once";
1072
+ repeating: "repeating";
1073
+ }>;
1074
+ durationInMonths: import("zod").ZodOptional<import("zod").ZodNumber>;
1075
+ }, import("zod/v4/core").$strip>>;
973
1076
  }, import("zod/v4/core").$strict>;
974
1077
  export declare const projectBillingChangeRequestSchema: import("zod").ZodObject<{
975
1078
  quote: import("zod").ZodString;
@@ -998,6 +1101,29 @@ export declare const projectBillingStateSchema: import("zod").ZodObject<{
998
1101
  renewalGraceUntil: import("zod").ZodOptional<import("zod").ZodString>;
999
1102
  cancellationAt: import("zod").ZodOptional<import("zod").ZodString>;
1000
1103
  deleted: import("zod").ZodBoolean;
1104
+ complimentary: import("zod").ZodOptional<import("zod").ZodObject<{
1105
+ grant: import("zod").ZodString;
1106
+ endsAt: import("zod").ZodString;
1107
+ }, import("zod/v4/core").$strip>>;
1108
+ }, import("zod/v4/core").$strip>>;
1109
+ discount: import("zod").ZodOptional<import("zod").ZodObject<{
1110
+ grant: import("zod").ZodString;
1111
+ duration: import("zod").ZodEnum<{
1112
+ once: "once";
1113
+ repeating: "repeating";
1114
+ }>;
1115
+ durationInMonths: import("zod").ZodOptional<import("zod").ZodNumber>;
1116
+ percentOff: import("zod").ZodOptional<import("zod").ZodNumber>;
1117
+ amountOff: import("zod").ZodOptional<import("zod").ZodObject<{
1118
+ currency: import("zod").ZodLiteral<"USD">;
1119
+ microdollars: import("zod").ZodString;
1120
+ scale: import("zod").ZodLiteral<6>;
1121
+ }, import("zod/v4/core").$strip>>;
1122
+ state: import("zod").ZodEnum<{
1123
+ pending: "pending";
1124
+ applied: "applied";
1125
+ }>;
1126
+ appliedAt: import("zod").ZodOptional<import("zod").ZodString>;
1001
1127
  }, import("zod/v4/core").$strip>>;
1002
1128
  pendingOperations: import("zod").ZodArray<import("zod").ZodObject<{
1003
1129
  id: import("zod").ZodString;
@@ -1230,4 +1356,217 @@ export type BillingInvoiceList = z.infer<typeof billingInvoiceListSchema>;
1230
1356
  export type BillingPaymentMethodSetupRequest = z.infer<typeof billingPaymentMethodSetupRequestSchema>;
1231
1357
  export type BillingPaymentMethodConfirmRequest = z.infer<typeof billingPaymentMethodConfirmRequestSchema>;
1232
1358
  export type BillingPaymentMethodRemoveRequest = z.infer<typeof billingPaymentMethodRemoveRequestSchema>;
1359
+ /**
1360
+ * W7-15 launch promotions.
1361
+ *
1362
+ * A customer redeems a code; an operator grants directly. Either way the
1363
+ * organization receives one benefit: promotional execution credit, a
1364
+ * complimentary project slot, a perk, or a discount on the project
1365
+ * subscription. Promotional value has no cash value, is never refunded and
1366
+ * cannot move to another organization or product.
1367
+ */
1368
+ export declare const PROMOTION_BENEFIT_KINDS: readonly ["credit", "project-slot", "perk", "discount"];
1369
+ export declare const promotionCodeSchema: import("zod").ZodString;
1370
+ export declare const billingRedeemRequestSchema: import("zod").ZodObject<{
1371
+ code: import("zod").ZodString;
1372
+ project: import("zod").ZodOptional<import("zod").ZodString>;
1373
+ confirmed: import("zod").ZodLiteral<true>;
1374
+ }, import("zod/v4/core").$strict>;
1375
+ export declare const promotionGrantViewSchema: import("zod").ZodObject<{
1376
+ id: import("zod").ZodString;
1377
+ source: import("zod").ZodEnum<{
1378
+ code: "code";
1379
+ operator: "operator";
1380
+ }>;
1381
+ benefit: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
1382
+ kind: import("zod").ZodLiteral<"credit">;
1383
+ amount: import("zod").ZodObject<{
1384
+ currency: import("zod").ZodLiteral<"USD">;
1385
+ microdollars: import("zod").ZodString;
1386
+ scale: import("zod").ZodLiteral<6>;
1387
+ }, import("zod/v4/core").$strip>;
1388
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1389
+ kind: import("zod").ZodLiteral<"project-slot">;
1390
+ project: import("zod").ZodString;
1391
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1392
+ kind: import("zod").ZodLiteral<"perk">;
1393
+ perk: import("zod").ZodString;
1394
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1395
+ kind: import("zod").ZodLiteral<"discount">;
1396
+ percentOff: import("zod").ZodOptional<import("zod").ZodNumber>;
1397
+ amountOff: import("zod").ZodOptional<import("zod").ZodObject<{
1398
+ currency: import("zod").ZodLiteral<"USD">;
1399
+ microdollars: import("zod").ZodString;
1400
+ scale: import("zod").ZodLiteral<6>;
1401
+ }, import("zod/v4/core").$strip>>;
1402
+ duration: import("zod").ZodEnum<{
1403
+ once: "once";
1404
+ repeating: "repeating";
1405
+ }>;
1406
+ durationInMonths: import("zod").ZodOptional<import("zod").ZodNumber>;
1407
+ }, import("zod/v4/core").$strip>], "kind">;
1408
+ state: import("zod").ZodEnum<{
1409
+ expired: "expired";
1410
+ active: "active";
1411
+ revoked: "revoked";
1412
+ }>;
1413
+ startsAt: import("zod").ZodString;
1414
+ endsAt: import("zod").ZodOptional<import("zod").ZodString>;
1415
+ revokedAt: import("zod").ZodOptional<import("zod").ZodString>;
1416
+ }, import("zod/v4/core").$strip>;
1417
+ export type PromotionGrantView = z.infer<typeof promotionGrantViewSchema>;
1418
+ export declare const billingPromotionsSchema: import("zod").ZodObject<{
1419
+ grants: import("zod").ZodArray<import("zod").ZodObject<{
1420
+ id: import("zod").ZodString;
1421
+ source: import("zod").ZodEnum<{
1422
+ code: "code";
1423
+ operator: "operator";
1424
+ }>;
1425
+ benefit: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
1426
+ kind: import("zod").ZodLiteral<"credit">;
1427
+ amount: import("zod").ZodObject<{
1428
+ currency: import("zod").ZodLiteral<"USD">;
1429
+ microdollars: import("zod").ZodString;
1430
+ scale: import("zod").ZodLiteral<6>;
1431
+ }, import("zod/v4/core").$strip>;
1432
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1433
+ kind: import("zod").ZodLiteral<"project-slot">;
1434
+ project: import("zod").ZodString;
1435
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1436
+ kind: import("zod").ZodLiteral<"perk">;
1437
+ perk: import("zod").ZodString;
1438
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1439
+ kind: import("zod").ZodLiteral<"discount">;
1440
+ percentOff: import("zod").ZodOptional<import("zod").ZodNumber>;
1441
+ amountOff: import("zod").ZodOptional<import("zod").ZodObject<{
1442
+ currency: import("zod").ZodLiteral<"USD">;
1443
+ microdollars: import("zod").ZodString;
1444
+ scale: import("zod").ZodLiteral<6>;
1445
+ }, import("zod/v4/core").$strip>>;
1446
+ duration: import("zod").ZodEnum<{
1447
+ once: "once";
1448
+ repeating: "repeating";
1449
+ }>;
1450
+ durationInMonths: import("zod").ZodOptional<import("zod").ZodNumber>;
1451
+ }, import("zod/v4/core").$strip>], "kind">;
1452
+ state: import("zod").ZodEnum<{
1453
+ expired: "expired";
1454
+ active: "active";
1455
+ revoked: "revoked";
1456
+ }>;
1457
+ startsAt: import("zod").ZodString;
1458
+ endsAt: import("zod").ZodOptional<import("zod").ZodString>;
1459
+ revokedAt: import("zod").ZodOptional<import("zod").ZodString>;
1460
+ }, import("zod/v4/core").$strip>>;
1461
+ projectCapacity: import("zod").ZodObject<{
1462
+ included: import("zod").ZodNumber;
1463
+ paid: import("zod").ZodNumber;
1464
+ complimentary: import("zod").ZodNumber;
1465
+ }, import("zod/v4/core").$strip>;
1466
+ perks: import("zod").ZodArray<import("zod").ZodObject<{
1467
+ perk: import("zod").ZodString;
1468
+ endsAt: import("zod").ZodString;
1469
+ }, import("zod/v4/core").$strip>>;
1470
+ restrictions: import("zod").ZodArray<import("zod").ZodString>;
1471
+ }, import("zod/v4/core").$strip>;
1472
+ export type BillingPromotions = z.infer<typeof billingPromotionsSchema>;
1473
+ export declare const billingRedeemResponseSchema: import("zod").ZodObject<{
1474
+ grant: import("zod").ZodObject<{
1475
+ id: import("zod").ZodString;
1476
+ source: import("zod").ZodEnum<{
1477
+ code: "code";
1478
+ operator: "operator";
1479
+ }>;
1480
+ benefit: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
1481
+ kind: import("zod").ZodLiteral<"credit">;
1482
+ amount: import("zod").ZodObject<{
1483
+ currency: import("zod").ZodLiteral<"USD">;
1484
+ microdollars: import("zod").ZodString;
1485
+ scale: import("zod").ZodLiteral<6>;
1486
+ }, import("zod/v4/core").$strip>;
1487
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1488
+ kind: import("zod").ZodLiteral<"project-slot">;
1489
+ project: import("zod").ZodString;
1490
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1491
+ kind: import("zod").ZodLiteral<"perk">;
1492
+ perk: import("zod").ZodString;
1493
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1494
+ kind: import("zod").ZodLiteral<"discount">;
1495
+ percentOff: import("zod").ZodOptional<import("zod").ZodNumber>;
1496
+ amountOff: import("zod").ZodOptional<import("zod").ZodObject<{
1497
+ currency: import("zod").ZodLiteral<"USD">;
1498
+ microdollars: import("zod").ZodString;
1499
+ scale: import("zod").ZodLiteral<6>;
1500
+ }, import("zod/v4/core").$strip>>;
1501
+ duration: import("zod").ZodEnum<{
1502
+ once: "once";
1503
+ repeating: "repeating";
1504
+ }>;
1505
+ durationInMonths: import("zod").ZodOptional<import("zod").ZodNumber>;
1506
+ }, import("zod/v4/core").$strip>], "kind">;
1507
+ state: import("zod").ZodEnum<{
1508
+ expired: "expired";
1509
+ active: "active";
1510
+ revoked: "revoked";
1511
+ }>;
1512
+ startsAt: import("zod").ZodString;
1513
+ endsAt: import("zod").ZodOptional<import("zod").ZodString>;
1514
+ revokedAt: import("zod").ZodOptional<import("zod").ZodString>;
1515
+ }, import("zod/v4/core").$strip>;
1516
+ promotions: import("zod").ZodObject<{
1517
+ grants: import("zod").ZodArray<import("zod").ZodObject<{
1518
+ id: import("zod").ZodString;
1519
+ source: import("zod").ZodEnum<{
1520
+ code: "code";
1521
+ operator: "operator";
1522
+ }>;
1523
+ benefit: import("zod").ZodDiscriminatedUnion<[import("zod").ZodObject<{
1524
+ kind: import("zod").ZodLiteral<"credit">;
1525
+ amount: import("zod").ZodObject<{
1526
+ currency: import("zod").ZodLiteral<"USD">;
1527
+ microdollars: import("zod").ZodString;
1528
+ scale: import("zod").ZodLiteral<6>;
1529
+ }, import("zod/v4/core").$strip>;
1530
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1531
+ kind: import("zod").ZodLiteral<"project-slot">;
1532
+ project: import("zod").ZodString;
1533
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1534
+ kind: import("zod").ZodLiteral<"perk">;
1535
+ perk: import("zod").ZodString;
1536
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
1537
+ kind: import("zod").ZodLiteral<"discount">;
1538
+ percentOff: import("zod").ZodOptional<import("zod").ZodNumber>;
1539
+ amountOff: import("zod").ZodOptional<import("zod").ZodObject<{
1540
+ currency: import("zod").ZodLiteral<"USD">;
1541
+ microdollars: import("zod").ZodString;
1542
+ scale: import("zod").ZodLiteral<6>;
1543
+ }, import("zod/v4/core").$strip>>;
1544
+ duration: import("zod").ZodEnum<{
1545
+ once: "once";
1546
+ repeating: "repeating";
1547
+ }>;
1548
+ durationInMonths: import("zod").ZodOptional<import("zod").ZodNumber>;
1549
+ }, import("zod/v4/core").$strip>], "kind">;
1550
+ state: import("zod").ZodEnum<{
1551
+ expired: "expired";
1552
+ active: "active";
1553
+ revoked: "revoked";
1554
+ }>;
1555
+ startsAt: import("zod").ZodString;
1556
+ endsAt: import("zod").ZodOptional<import("zod").ZodString>;
1557
+ revokedAt: import("zod").ZodOptional<import("zod").ZodString>;
1558
+ }, import("zod/v4/core").$strip>>;
1559
+ projectCapacity: import("zod").ZodObject<{
1560
+ included: import("zod").ZodNumber;
1561
+ paid: import("zod").ZodNumber;
1562
+ complimentary: import("zod").ZodNumber;
1563
+ }, import("zod/v4/core").$strip>;
1564
+ perks: import("zod").ZodArray<import("zod").ZodObject<{
1565
+ perk: import("zod").ZodString;
1566
+ endsAt: import("zod").ZodString;
1567
+ }, import("zod/v4/core").$strip>>;
1568
+ restrictions: import("zod").ZodArray<import("zod").ZodString>;
1569
+ }, import("zod/v4/core").$strip>;
1570
+ }, import("zod/v4/core").$strip>;
1571
+ export type BillingRedeemResponse = z.infer<typeof billingRedeemResponseSchema>;
1233
1572
  export {};
package/dist/billing.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { z } from "./zod.js";
2
- import { attemptIdSchema, projectIdSchema } from "./identifiers.js";
2
+ import { attemptIdSchema, idSchema, projectIdSchema } from "./identifiers.js";
3
3
  import { pageRequestSchema, pageSchema, requiredIdempotencyRequestHeaderSchema, } from "./protocol.js";
4
4
  import { timestampSchema } from "./time.js";
5
5
  export const BILLING_AMOUNT_SCALE = 6;
@@ -598,6 +598,18 @@ export const billingPeriodSummarySchema = z.object({
598
598
  start: timestampSchema,
599
599
  end: timestampSchema,
600
600
  });
601
+ function creditKindBalanceSchema() {
602
+ return z.object({
603
+ available: nonnegativeExactMoneySchema,
604
+ reserved: nonnegativeExactMoneySchema,
605
+ consumed: nonnegativeExactMoneySchema,
606
+ /** Expired or revoked before use; never spendable again. */
607
+ forfeited: nonnegativeExactMoneySchema,
608
+ granted: nonnegativeExactMoneySchema,
609
+ /** The earliest end of credit of this kind that is still available. */
610
+ expiresAt: timestampSchema.optional(),
611
+ });
612
+ }
601
613
  export const billingSummarySchema = z
602
614
  .object({
603
615
  activation: z.object({
@@ -611,6 +623,18 @@ export const billingSummarySchema = z
611
623
  available: signedExactMoneySchema,
612
624
  consumed: nonnegativeExactMoneySchema,
613
625
  reserved: nonnegativeExactMoneySchema,
626
+ /**
627
+ * The same position by kind of credit (W7-15): purchased (never expires,
628
+ * refundable), trial and promotional (both expire, spent earliest
629
+ * expiry first and always before purchased credit).
630
+ */
631
+ byKind: z
632
+ .object({
633
+ purchased: creditKindBalanceSchema(),
634
+ trial: creditKindBalanceSchema(),
635
+ promotional: creditKindBalanceSchema(),
636
+ })
637
+ .optional(),
614
638
  }),
615
639
  desiredRevision: z.number().int().positive(),
616
640
  effectiveRevision: z.number().int().positive(),
@@ -682,6 +706,18 @@ export const projectBillingQuoteSchema = projectBillingQuoteRequestSchema.extend
682
706
  monthlyProjectFees: nonnegativeExactMoneySchema,
683
707
  effectiveAt: timestampSchema,
684
708
  formerIncludedWillBlock: z.boolean(),
709
+ /**
710
+ * A redeemed discount this charge receives (W7-15): `gross` less `amount`
711
+ * is `charge`, and `duration` says how many monthly invoices it covers.
712
+ */
713
+ discount: z
714
+ .object({
715
+ gross: nonnegativeExactMoneySchema,
716
+ amount: nonnegativeExactMoneySchema,
717
+ duration: z.enum(["once", "repeating"]),
718
+ durationInMonths: z.number().int().min(1).max(12).optional(),
719
+ })
720
+ .optional(),
685
721
  });
686
722
  export const projectBillingChangeRequestSchema = z
687
723
  .object({
@@ -690,6 +726,18 @@ export const projectBillingChangeRequestSchema = z
690
726
  confirmed: z.literal(true),
691
727
  })
692
728
  .strict();
729
+ const promotionGrantIdSchema = idSchema("promotionGrant");
730
+ /** A redeemed purchase discount on the project subscription (W7-15). */
731
+ const projectDiscountSchema = z.object({
732
+ grant: promotionGrantIdSchema,
733
+ duration: z.enum(["once", "repeating"]),
734
+ durationInMonths: z.number().int().min(1).max(12).optional(),
735
+ percentOff: z.number().int().min(1).max(100).optional(),
736
+ amountOff: nonnegativeExactMoneySchema.optional(),
737
+ /** `pending` until it is attached to the subscription's invoices. */
738
+ state: z.enum(["pending", "applied"]),
739
+ appliedAt: timestampSchema.optional(),
740
+ });
693
741
  export const projectBillingStateSchema = z.object({
694
742
  includedProject: projectIdSchema.optional(),
695
743
  desiredRevision: z.number().int().positive(),
@@ -704,7 +752,19 @@ export const projectBillingStateSchema = z.object({
704
752
  renewalGraceUntil: timestampSchema.optional(),
705
753
  cancellationAt: timestampSchema.optional(),
706
754
  deleted: z.boolean(),
755
+ /**
756
+ * A complimentary project slot (W7-15). The project costs nothing and
757
+ * is never part of the subscription; when the slot ends it is blocked
758
+ * until the customer chooses to add it as a paid project.
759
+ */
760
+ complimentary: z
761
+ .object({
762
+ grant: promotionGrantIdSchema,
763
+ endsAt: timestampSchema,
764
+ })
765
+ .optional(),
707
766
  })),
767
+ discount: projectDiscountSchema.optional(),
708
768
  pendingOperations: z.array(z.object({
709
769
  id: z.string().min(1).max(255),
710
770
  kind: z.enum(["add", "cancel"]),
@@ -841,3 +901,73 @@ export const billingInvoiceListSchema = z
841
901
  * BILLING_PAYMENT_METHOD_REQUIRED_TITLE`.
842
902
  */
843
903
  export const BILLING_PAYMENT_METHOD_REQUIRED_TITLE = "A card on file is required";
904
+ /**
905
+ * W7-15 launch promotions.
906
+ *
907
+ * A customer redeems a code; an operator grants directly. Either way the
908
+ * organization receives one benefit: promotional execution credit, a
909
+ * complimentary project slot, a perk, or a discount on the project
910
+ * subscription. Promotional value has no cash value, is never refunded and
911
+ * cannot move to another organization or product.
912
+ */
913
+ export const PROMOTION_BENEFIT_KINDS = [
914
+ "credit",
915
+ "project-slot",
916
+ "perk",
917
+ "discount",
918
+ ];
919
+ /** A perk's name; which perks exist is the server's allowlist, now empty. */
920
+ const promotionPerkNameSchema = z
921
+ .string()
922
+ .regex(/^[a-z][a-z0-9-]{0,63}$/u, "a perk's lowercase name");
923
+ export const promotionCodeSchema = z
924
+ .string()
925
+ .trim()
926
+ .min(4)
927
+ .max(64)
928
+ .regex(/^[A-Za-z0-9][A-Za-z0-9 _-]*$/u, "letters, digits, spaces, - and _");
929
+ export const billingRedeemRequestSchema = z
930
+ .object({
931
+ code: promotionCodeSchema,
932
+ /** Required for a project-slot code: the project it covers. */
933
+ project: projectIdSchema.optional(),
934
+ confirmed: z.literal(true),
935
+ })
936
+ .strict();
937
+ const promotionBenefitViewSchema = z.discriminatedUnion("kind", [
938
+ z.object({ kind: z.literal("credit"), amount: nonnegativeExactMoneySchema }),
939
+ z.object({ kind: z.literal("project-slot"), project: projectIdSchema }),
940
+ z.object({ kind: z.literal("perk"), perk: promotionPerkNameSchema }),
941
+ z.object({
942
+ kind: z.literal("discount"),
943
+ percentOff: z.number().int().min(1).max(100).optional(),
944
+ amountOff: nonnegativeExactMoneySchema.optional(),
945
+ duration: z.enum(["once", "repeating"]),
946
+ durationInMonths: z.number().int().min(1).max(12).optional(),
947
+ }),
948
+ ]);
949
+ export const promotionGrantViewSchema = z.object({
950
+ id: promotionGrantIdSchema,
951
+ source: z.enum(["operator", "code"]),
952
+ benefit: promotionBenefitViewSchema,
953
+ state: z.enum(["active", "expired", "revoked"]),
954
+ startsAt: timestampSchema,
955
+ /** The benefit's own end; a discount ends by `duration` instead. */
956
+ endsAt: timestampSchema.optional(),
957
+ revokedAt: timestampSchema.optional(),
958
+ });
959
+ export const billingPromotionsSchema = z.object({
960
+ grants: z.array(promotionGrantViewSchema),
961
+ /** Effective project capacity: each project that may deliver, by source. */
962
+ projectCapacity: z.object({
963
+ included: z.number().int().min(0),
964
+ paid: z.number().int().min(0),
965
+ complimentary: z.number().int().min(0),
966
+ }),
967
+ perks: z.array(z.object({ perk: promotionPerkNameSchema, endsAt: timestampSchema })),
968
+ restrictions: z.array(z.string().min(1).max(300)),
969
+ });
970
+ export const billingRedeemResponseSchema = z.object({
971
+ grant: promotionGrantViewSchema,
972
+ promotions: billingPromotionsSchema,
973
+ });
@@ -0,0 +1,4 @@
1
+ /** Nonunique: one host action may create several schedules. Exact, case-sensitive. */
2
+ export declare const externalIdentifierSchema: import("zod").ZodString;
3
+ export declare const scheduleTagSchema: import("zod").ZodString;
4
+ export declare const scheduleTagsSchema: import("zod").ZodArray<import("zod").ZodString>;
@@ -0,0 +1,18 @@
1
+ import { z } from "./zod.js";
2
+ /** Searchable host metadata is public schedule data; never put secrets here. */
3
+ function boundedIdentifier(bytes) {
4
+ return z
5
+ .string()
6
+ .min(1)
7
+ .max(bytes)
8
+ .refine((value) => !value.includes("\u0000") &&
9
+ new TextEncoder().encode(value).length <= bytes, `must contain 1–${bytes} UTF-8 bytes and no NUL characters`);
10
+ }
11
+ /** Nonunique: one host action may create several schedules. Exact, case-sensitive. */
12
+ export const externalIdentifierSchema = boundedIdentifier(256).describe("Host application identifier, matched exactly and case-sensitively; at most 256 UTF-8 bytes. Readable by schedule readers; do not include secrets.");
13
+ export const scheduleTagSchema = boundedIdentifier(64).describe("An exact, case-sensitive tag of at most 64 UTF-8 bytes.");
14
+ export const scheduleTagsSchema = z
15
+ .array(scheduleTagSchema)
16
+ .max(16)
17
+ .refine((tags) => new Set(tags).size === tags.length, "must contain distinct tags")
18
+ .describe("Up to 16 distinct searchable tags. Omission preserves tags on replacement; [] clears them.");
@@ -29,6 +29,8 @@ export declare const ID_PREFIXES: {
29
29
  readonly occurrence: "occ";
30
30
  readonly organization: "org";
31
31
  readonly project: "proj";
32
+ readonly promotionGrant: "grn";
33
+ readonly promotionOffer: "ofr";
32
34
  readonly schedule: "sch";
33
35
  readonly testSink: "tsk";
34
36
  readonly testSinkDelivery: "tsd";
@@ -41,6 +41,9 @@ export const ID_PREFIXES = {
41
41
  occurrence: "occ",
42
42
  organization: "org",
43
43
  project: "proj",
44
+ // A launch offer and one organization's grant of a benefit (W7-15).
45
+ promotionGrant: "grn",
46
+ promotionOffer: "ofr",
44
47
  schedule: "sch",
45
48
  // A deterministic test-only callback receiver, and one delivery it recorded.
46
49
  // The receipt has its own prefix rather than reusing `delivery`, which names
package/dist/index.d.ts CHANGED
@@ -28,9 +28,10 @@ export { BILLABLE_TERMINAL_STATES, USAGE_BOUNDS, USAGE_WINDOW_REASONS, billableT
28
28
  export { BILLING_ACTIVATION_MODES, BILLING_AMOUNT_SCALE, BILLING_BLOCK_REASONS, BILLING_CURRENCY, BILLING_ENTRY_KINDS, BILLING_LEDGER_ENTRY_NOTES, BILLING_PAYMENT_KINDS, BILLING_PAYMENT_STATES, BILLING_NOTICE_KINDS, billingAutoTopUpApplyRequestSchema, billingAutoTopUpConfigurationSchema, billingAutoTopUpPreviewRequestSchema, billingAutoTopUpPreviewSchema, billingAutoTopUpRuleSchema, billingBudgetPolicySchema, billingBudgetUpdateRequestHeadersSchema, billingBudgetUpdateRequestSchema, billingBudgetUpdateResponseSchema, billingCeilingUpdateRequestSchema, billingFundingQuoteRequestSchema, billingFundingQuoteSchema, billingFundingViewSchema, billingNoticePageSchema, billingNoticeRecoveryPathSchema, billingNoticeSchema, billingNotificationSettingsSchema, billingNotificationSettingsUpdateRequestSchema, billingLedgerEntrySchema, billingLedgerPageSchema, billingLedgerRequestSchema, billingPaymentOperationSchema, billingPeriodSummarySchema, billingPurchaseRequestSchema, billingRefundRequestCreateSchema, billingRefundResolutionRequestSchema, billingRefundRequestViewSchema, billingSummarySchema, exactCentMoneySchema, manualFundingCreditSchema, microdollarAmountSchema, nonnegativeMicrodollarAmountSchema, type BillingAutoTopUpApplyRequest, type BillingAutoTopUpConfiguration, type BillingAutoTopUpPreview, type BillingAutoTopUpPreviewRequest, type BillingAutoTopUpRule, type BillingCeilingUpdateRequest, type BillingFundingQuote, type BillingFundingQuoteRequest, type BillingFundingView, type BillingNotice, type BillingNoticePage, type BillingNotificationSettings, type BillingNotificationSettingsUpdateRequest, type BillingLedgerEntryView, type BillingLedgerPage, type BillingLedgerRequest, type BillingBudgetUpdateRequest, type BillingBudgetUpdateResponse, type BillingPaymentOperation, type BillingPurchaseRequest, type BillingRefundRequestCreate, type BillingRefundResolutionRequest, type BillingRefundRequestView, type BillingSummaryView, } from "./billing.js";
29
29
  export { DELIVERY_TIMING_TARGETS_MS, DELIVERY_TIMING_VERDICTS, deliveryTimingSummarySchema, timingThresholdSummarySchema, type DeliveryTimingSummaryView, type TimingThresholdView, } from "./timing.js";
30
30
  export { CALLBACK_RECEIVER_DISPOSITIONS, CALLBACK_RECEIVER_PROTOCOL, CALLBACK_RECEIVER_STATUS, TEST_SINK_BEHAVIORS, TEST_SINK_BEHAVIOR_FACTS, TEST_SINK_BOUNDS, TEST_SINK_CLIENT_ERROR_STATUSES, TEST_SINK_DISPOSITIONS, TEST_SINK_PROTOCOL_VERSION, TEST_SINK_SERVER_ERROR_STATUSES, callbackReceiverAcknowledgementSchema, callbackReceiverDispositionSchema, resolveTestSinkAction, testSinkBehaviorSchema, testSinkCreateRequestSchema, testSinkDeliveryBodySchema, testSinkDispositionSchema, testSinkDeliveryPageSchema, testSinkDeliverySchema, testSinkPageSchema, testSinkProgramSchema, testSinkSchema, type CallbackReceiverAcknowledgement, type CallbackReceiverDisposition, type TestSink, type TestSinkAction, type TestSinkBehavior, type TestSinkCreateRequest, type TestSinkDelivery, type TestSinkDeliveryBody, type TestSinkDeliveryPage, type TestSinkDisposition, type TestSinkPage, type TestSinkProgram, } from "./test-sink.js";
31
- export { PROJECT_BILLING_ACTIONS, projectBillingQuoteRequestSchema, projectBillingQuoteSchema, projectBillingChangeRequestSchema, projectBillingStateSchema, billingPortalSchema, BILLING_PAYMENT_METHOD_REQUIRED_TITLE, billingPaymentMethodSchema, billingPaymentMethodSetupRequestSchema, billingPaymentMethodConfirmRequestSchema, billingPaymentMethodRemoveRequestSchema, billingInvoiceSchema, billingInvoiceListSchema, billingPaymentHistoryPageSchema, billingInvoiceHistoryPageSchema, type BillingPaymentHistoryPage, type BillingInvoiceHistoryPage, type BillingInvoice, type BillingInvoiceList, type BillingPaymentMethod, type BillingPaymentMethodSetupRequest, type BillingPaymentMethodConfirmRequest, type BillingPaymentMethodRemoveRequest, type ProjectBillingQuoteRequest, type ProjectBillingQuote, type ProjectBillingChangeRequest, type ProjectBillingState, } from "./billing.js";
31
+ export { PROMOTION_BENEFIT_KINDS, billingPromotionsSchema, billingRedeemRequestSchema, billingRedeemResponseSchema, promotionCodeSchema, promotionGrantViewSchema, type BillingPromotions, type BillingRedeemResponse, type PromotionGrantView, PROJECT_BILLING_ACTIONS, projectBillingQuoteRequestSchema, projectBillingQuoteSchema, projectBillingChangeRequestSchema, projectBillingStateSchema, billingPortalSchema, BILLING_PAYMENT_METHOD_REQUIRED_TITLE, billingPaymentMethodSchema, billingPaymentMethodSetupRequestSchema, billingPaymentMethodConfirmRequestSchema, billingPaymentMethodRemoveRequestSchema, billingInvoiceSchema, billingInvoiceListSchema, billingPaymentHistoryPageSchema, billingInvoiceHistoryPageSchema, type BillingPaymentHistoryPage, type BillingInvoiceHistoryPage, type BillingInvoice, type BillingInvoiceList, type BillingPaymentMethod, type BillingPaymentMethodSetupRequest, type BillingPaymentMethodConfirmRequest, type BillingPaymentMethodRemoveRequest, type ProjectBillingQuoteRequest, type ProjectBillingQuote, type ProjectBillingChangeRequest, type ProjectBillingState, } from "./billing.js";
32
32
  export { effectiveCustomerLimitsSchema, type EffectiveCustomerLimits, } from "./effective-limits.js";
33
33
  export * from "./members.js";
34
34
  export * from "./http-request.js";
35
35
  export { sanitizedDiagnosticText, diagnosticBodyText, responseBodySentence, requestCaptureSentence, attemptStatusGuidance, } from "./attempt-diagnostics.js";
36
36
  export { PROJECT_NOTIFICATION_OPERATIONS, notificationEmailRecipientsSchema, notificationEmailSettingsSchema, statusWebhookEventSchema, statusWebhookConfigurationSchema, projectNotificationSettingsSchema, projectNotificationSettingsUpdateRequestSchema, statusSigningKeyRequestSchema, statusSigningKeyCreatedSchema, statusWebhookPayloadSchema, statusWebhookDeliverySchema, statusWebhookDeliveryPageSchema, type ProjectNotificationSettings, type ProjectNotificationSettingsUpdateRequest, type StatusSigningKeyCreated, type StatusWebhookEvent, type StatusWebhookPayload, type StatusWebhookDelivery, type StatusWebhookDeliveryPage, } from "./project-notifications.js";
37
+ export { externalIdentifierSchema, scheduleTagSchema, scheduleTagsSchema, } from "./host-correlation.js";
package/dist/index.js CHANGED
@@ -28,9 +28,10 @@ export { BILLABLE_TERMINAL_STATES, USAGE_BOUNDS, USAGE_WINDOW_REASONS, billableT
28
28
  export { BILLING_ACTIVATION_MODES, BILLING_AMOUNT_SCALE, BILLING_BLOCK_REASONS, BILLING_CURRENCY, BILLING_ENTRY_KINDS, BILLING_LEDGER_ENTRY_NOTES, BILLING_PAYMENT_KINDS, BILLING_PAYMENT_STATES, BILLING_NOTICE_KINDS, billingAutoTopUpApplyRequestSchema, billingAutoTopUpConfigurationSchema, billingAutoTopUpPreviewRequestSchema, billingAutoTopUpPreviewSchema, billingAutoTopUpRuleSchema, billingBudgetPolicySchema, billingBudgetUpdateRequestHeadersSchema, billingBudgetUpdateRequestSchema, billingBudgetUpdateResponseSchema, billingCeilingUpdateRequestSchema, billingFundingQuoteRequestSchema, billingFundingQuoteSchema, billingFundingViewSchema, billingNoticePageSchema, billingNoticeRecoveryPathSchema, billingNoticeSchema, billingNotificationSettingsSchema, billingNotificationSettingsUpdateRequestSchema, billingLedgerEntrySchema, billingLedgerPageSchema, billingLedgerRequestSchema, billingPaymentOperationSchema, billingPeriodSummarySchema, billingPurchaseRequestSchema, billingRefundRequestCreateSchema, billingRefundResolutionRequestSchema, billingRefundRequestViewSchema, billingSummarySchema, exactCentMoneySchema, manualFundingCreditSchema, microdollarAmountSchema, nonnegativeMicrodollarAmountSchema, } from "./billing.js";
29
29
  export { DELIVERY_TIMING_TARGETS_MS, DELIVERY_TIMING_VERDICTS, deliveryTimingSummarySchema, timingThresholdSummarySchema, } from "./timing.js";
30
30
  export { CALLBACK_RECEIVER_DISPOSITIONS, CALLBACK_RECEIVER_PROTOCOL, CALLBACK_RECEIVER_STATUS, TEST_SINK_BEHAVIORS, TEST_SINK_BEHAVIOR_FACTS, TEST_SINK_BOUNDS, TEST_SINK_CLIENT_ERROR_STATUSES, TEST_SINK_DISPOSITIONS, TEST_SINK_PROTOCOL_VERSION, TEST_SINK_SERVER_ERROR_STATUSES, callbackReceiverAcknowledgementSchema, callbackReceiverDispositionSchema, resolveTestSinkAction, testSinkBehaviorSchema, testSinkCreateRequestSchema, testSinkDeliveryBodySchema, testSinkDispositionSchema, testSinkDeliveryPageSchema, testSinkDeliverySchema, testSinkPageSchema, testSinkProgramSchema, testSinkSchema, } from "./test-sink.js";
31
- export { PROJECT_BILLING_ACTIONS, projectBillingQuoteRequestSchema, projectBillingQuoteSchema, projectBillingChangeRequestSchema, projectBillingStateSchema, billingPortalSchema, BILLING_PAYMENT_METHOD_REQUIRED_TITLE, billingPaymentMethodSchema, billingPaymentMethodSetupRequestSchema, billingPaymentMethodConfirmRequestSchema, billingPaymentMethodRemoveRequestSchema, billingInvoiceSchema, billingInvoiceListSchema, billingPaymentHistoryPageSchema, billingInvoiceHistoryPageSchema, } from "./billing.js";
31
+ export { PROMOTION_BENEFIT_KINDS, billingPromotionsSchema, billingRedeemRequestSchema, billingRedeemResponseSchema, promotionCodeSchema, promotionGrantViewSchema, PROJECT_BILLING_ACTIONS, projectBillingQuoteRequestSchema, projectBillingQuoteSchema, projectBillingChangeRequestSchema, projectBillingStateSchema, billingPortalSchema, BILLING_PAYMENT_METHOD_REQUIRED_TITLE, billingPaymentMethodSchema, billingPaymentMethodSetupRequestSchema, billingPaymentMethodConfirmRequestSchema, billingPaymentMethodRemoveRequestSchema, billingInvoiceSchema, billingInvoiceListSchema, billingPaymentHistoryPageSchema, billingInvoiceHistoryPageSchema, } from "./billing.js";
32
32
  export { effectiveCustomerLimitsSchema, } from "./effective-limits.js";
33
33
  export * from "./members.js";
34
34
  export * from "./http-request.js";
35
35
  export { sanitizedDiagnosticText, diagnosticBodyText, responseBodySentence, requestCaptureSentence, attemptStatusGuidance, } from "./attempt-diagnostics.js";
36
36
  export { PROJECT_NOTIFICATION_OPERATIONS, notificationEmailRecipientsSchema, notificationEmailSettingsSchema, statusWebhookEventSchema, statusWebhookConfigurationSchema, projectNotificationSettingsSchema, projectNotificationSettingsUpdateRequestSchema, statusSigningKeyRequestSchema, statusSigningKeyCreatedSchema, statusWebhookPayloadSchema, statusWebhookDeliverySchema, statusWebhookDeliveryPageSchema, } from "./project-notifications.js";
37
+ export { externalIdentifierSchema, scheduleTagSchema, scheduleTagsSchema, } from "./host-correlation.js";