@burdenoff/be-sdk 2026.1107.4 → 2026.1108.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/auth/index.d.ts +2 -2
  2. package/dist/auth/index.js +2 -2
  3. package/dist/{chunk-5EVD6HOD.js → chunk-2T3N5SNW.js} +333 -385
  4. package/dist/chunk-2T3N5SNW.js.map +1 -0
  5. package/dist/{chunk-YZIWBUIN.js → chunk-4XIBXZ6J.js} +3 -3
  6. package/dist/{chunk-YZIWBUIN.js.map → chunk-4XIBXZ6J.js.map} +1 -1
  7. package/dist/{chunk-Y4N7N2G4.js → chunk-A6DE32ZS.js} +3 -3
  8. package/dist/{chunk-Y4N7N2G4.js.map → chunk-A6DE32ZS.js.map} +1 -1
  9. package/dist/{chunk-DIOS6L7M.js → chunk-FHVBMQDW.js} +3 -3
  10. package/dist/{chunk-DIOS6L7M.js.map → chunk-FHVBMQDW.js.map} +1 -1
  11. package/dist/{chunk-5SIL5AG2.js → chunk-I3KOWRT3.js} +3 -3
  12. package/dist/chunk-I3KOWRT3.js.map +1 -0
  13. package/dist/{chunk-DXTBH7IW.js → chunk-ID3WR4JS.js} +3 -3
  14. package/dist/{chunk-DXTBH7IW.js.map → chunk-ID3WR4JS.js.map} +1 -1
  15. package/dist/{chunk-5CS3ZITV.js → chunk-KH4TRQCO.js} +3 -3
  16. package/dist/{chunk-5CS3ZITV.js.map → chunk-KH4TRQCO.js.map} +1 -1
  17. package/dist/{chunk-LQYHWC7F.js → chunk-O2JMZHNH.js} +3 -3
  18. package/dist/{chunk-LQYHWC7F.js.map → chunk-O2JMZHNH.js.map} +1 -1
  19. package/dist/{chunk-BD3SMWUU.js → chunk-QVPIACWD.js} +198 -402
  20. package/dist/chunk-QVPIACWD.js.map +1 -0
  21. package/dist/database/index.js +2 -2
  22. package/dist/event-queue/index.d.ts +3 -3
  23. package/dist/graph/index.d.ts +3 -3
  24. package/dist/graph/index.js +2 -2
  25. package/dist/{graphql-CEblo7lw.d.ts → graphql-CMHMQjvd.d.ts} +1 -1
  26. package/dist/{index-XzbbMKe4.d.ts → index-B8KrxO4j.d.ts} +2 -2
  27. package/dist/{index-BioY0Ewz.d.ts → index-CmpG-zak.d.ts} +1 -1
  28. package/dist/{index-DHQKCVDQ.d.ts → index-DCaVm66D.d.ts} +2 -2
  29. package/dist/{index-7pTpoN3Q.d.ts → index-DE2w7E0d.d.ts} +6 -1
  30. package/dist/{index-BV8hveh_.d.ts → index-DnjJ9CwI.d.ts} +40 -17
  31. package/dist/{index-BHe7zIVb.d.ts → index-DwMJZ8PP.d.ts} +2 -2
  32. package/dist/{index-KZ4OzW6D.d.ts → index-pxYge_6k.d.ts} +1 -1
  33. package/dist/index.d.ts +14 -13
  34. package/dist/index.js +31 -28
  35. package/dist/index.js.map +1 -1
  36. package/dist/instrumentation/index.d.ts +3 -3
  37. package/dist/logger/index.d.ts +2 -2
  38. package/dist/notifications/index.d.ts +3 -3
  39. package/dist/notifications/index.js +2 -2
  40. package/dist/prisma/index.js +2 -2
  41. package/dist/rbac/index.d.ts +2 -2
  42. package/dist/rbac/index.js +2 -2
  43. package/dist/resource-caps/index.d.ts +2 -2
  44. package/dist/telemetry/index.d.ts +4 -4
  45. package/dist/tracker/index.d.ts +4 -4
  46. package/dist/tracker/index.js +5 -5
  47. package/dist/usage/index.d.ts +49 -15
  48. package/dist/usage/index.js +2 -2
  49. package/package.json +1 -1
  50. package/dist/chunk-5EVD6HOD.js.map +0 -1
  51. package/dist/chunk-5SIL5AG2.js.map +0 -1
  52. package/dist/chunk-BD3SMWUU.js.map +0 -1
@@ -1,7 +1,8 @@
1
1
  import { GatewayClient } from './chunk-SPRG6G6G.js';
2
- import { ValidationError, QuotaExceededError } from './chunk-5SIL5AG2.js';
2
+ import { SDKError, ValidationError, QuotaExceededError } from './chunk-I3KOWRT3.js';
3
3
  import { logger } from './chunk-RU266375.js';
4
4
  import { __name } from './chunk-XE4OXN2W.js';
5
+ import { randomUUID } from 'crypto';
5
6
 
6
7
  // src/usage/billing.ts
7
8
  var DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
@@ -425,6 +426,78 @@ var QuotaPeriod = /* @__PURE__ */ (function(QuotaPeriod2) {
425
426
  QuotaPeriod2["LIFETIME"] = "lifetime";
426
427
  return QuotaPeriod2;
427
428
  })({});
429
+ var UsageOperationUnsupportedError = class _UsageOperationUnsupportedError extends SDKError {
430
+ static {
431
+ __name(this, "UsageOperationUnsupportedError");
432
+ }
433
+ constructor(operation, guidance) {
434
+ super(`UsageModule.${operation} is not supported by the workspace usage owner: ${guidance}`, "USAGE_OPERATION_UNSUPPORTED", {
435
+ operation
436
+ });
437
+ this.name = "UsageOperationUnsupportedError";
438
+ Object.setPrototypeOf(this, _UsageOperationUnsupportedError.prototype);
439
+ }
440
+ };
441
+ var CHECK_WORKSPACE_QUOTA_QUERY = `
442
+ query CheckWorkspaceQuota($workspaceId: ID!, $quotaName: String!, $amount: Float) {
443
+ checkWorkspaceQuota(workspaceId: $workspaceId, quotaName: $quotaName, amount: $amount) {
444
+ allowed
445
+ assignmentId
446
+ limitLeft
447
+ noLimit
448
+ }
449
+ }
450
+ `;
451
+ var TRACK_USAGE_MUTATION = `
452
+ mutation TrackUsage($input: TrackUsageInput!) {
453
+ trackUsage(input: $input)
454
+ }
455
+ `;
456
+ function legacyGuidance(replacement) {
457
+ return `quotas are addressed by quotaName on the workspace usage owner; use ${replacement}`;
458
+ }
459
+ __name(legacyGuidance, "legacyGuidance");
460
+ function nonEmpty(value) {
461
+ const trimmed = value?.trim();
462
+ return trimmed ? trimmed : void 0;
463
+ }
464
+ __name(nonEmpty, "nonEmpty");
465
+ function buildTrackUsageInput(options, context = {}) {
466
+ const quotaName = nonEmpty(options.quotaName);
467
+ if (!quotaName) {
468
+ throw new ValidationError("Quota name is required");
469
+ }
470
+ const productId = nonEmpty(options.productId) ?? nonEmpty(context.productId);
471
+ if (!productId) {
472
+ throw new ValidationError("Product ID is required");
473
+ }
474
+ const description = nonEmpty(options.description);
475
+ if (!description) {
476
+ throw new ValidationError("Description is required");
477
+ }
478
+ if (typeof options.amount !== "number" || !Number.isFinite(options.amount) || options.amount === 0) {
479
+ throw new ValidationError("Amount must be a finite, non-zero number");
480
+ }
481
+ const workspaceId = nonEmpty(options.workspaceId) ?? nonEmpty(context.workspaceId);
482
+ if (!workspaceId) {
483
+ throw new ValidationError("Workspace ID is required");
484
+ }
485
+ const input = {
486
+ quotaName,
487
+ productId,
488
+ amount: options.amount,
489
+ description,
490
+ workspaceId,
491
+ hash: nonEmpty(options.hash) ?? `sdk-usage:${randomUUID()}`
492
+ };
493
+ const userId = nonEmpty(options.userId) ?? nonEmpty(context.actorId);
494
+ if (userId) input["userId"] = userId;
495
+ if (options.quotaAssignmentId) input["quotaAssignmentId"] = options.quotaAssignmentId;
496
+ if (options.billingAccountId) input["billingAccountId"] = options.billingAccountId;
497
+ if (options.metadata) input["metadata"] = options.metadata;
498
+ return input;
499
+ }
500
+ __name(buildTrackUsageInput, "buildTrackUsageInput");
428
501
  var UsageModule = class {
429
502
  static {
430
503
  __name(this, "UsageModule");
@@ -436,448 +509,171 @@ var UsageModule = class {
436
509
  this.context = context;
437
510
  }
438
511
  /**
439
- * Track usage
512
+ * Context for one owner call: relayed as a platform service acting for `userId`, with the
513
+ * quota's workspace in scope. The owner takes the workspace from this context, never from
514
+ * the input, and only lets services release (decrement) usage.
440
515
  */
441
- async track(options) {
442
- if (!options.entityId) {
443
- throw new ValidationError("Entity ID is required");
444
- }
445
- if (!options.entityType) {
446
- throw new ValidationError("Entity type is required");
447
- }
448
- if (!options.metricType) {
449
- throw new ValidationError("Metric type is required");
450
- }
451
- if (typeof options.amount !== "number" || options.amount <= 0) {
452
- throw new ValidationError("Amount must be a positive number");
453
- }
454
- logger.debug("[Usage] Tracking usage", {
455
- entityId: options.entityId,
456
- metricType: options.metricType,
457
- amount: options.amount
458
- });
459
- const mutation = `
460
- mutation TrackUsage($input: TrackUsageInput!) {
461
- trackUsage(input: $input) {
462
- id
463
- entityId
464
- entityType
465
- metricType
466
- amount
467
- resourceId
468
- metadata
469
- workspaceId
470
- organizationId
471
- recordedAt
472
- }
473
- }
474
- `;
475
- const variables = {
476
- input: {
477
- entityId: options.entityId,
478
- entityType: options.entityType,
479
- metricType: options.metricType,
480
- amount: options.amount,
481
- resourceId: options.resourceId,
482
- metadata: options.metadata,
483
- workspaceId: options.workspaceId || this.context.workspaceId,
484
- organizationId: options.organizationId
485
- }
516
+ requestContext(workspaceId, userId) {
517
+ const actorId = userId ?? this.context.actorId;
518
+ return {
519
+ ...this.context,
520
+ ...actorId ? {
521
+ actorId
522
+ } : {},
523
+ actorType: "service",
524
+ workspaceId
486
525
  };
487
- const response = await this.client.query(mutation, variables, this.context);
488
- logger.info("[Usage] Usage tracked", {
489
- recordId: response.trackUsage.id
490
- });
491
- return response.trackUsage;
492
526
  }
493
527
  /**
494
- * Check quota availability
528
+ * Check whether a workspace quota has capacity for `amount` (default 1).
495
529
  */
496
- async checkQuota(options) {
497
- if (!options.entityId) {
498
- throw new ValidationError("Entity ID is required");
499
- }
500
- if (!options.metricType) {
501
- throw new ValidationError("Metric type is required");
502
- }
503
- if (typeof options.requestedAmount !== "number" || options.requestedAmount <= 0) {
504
- throw new ValidationError("Requested amount must be a positive number");
505
- }
506
- logger.debug("[Usage] Checking quota", {
507
- entityId: options.entityId,
508
- metricType: options.metricType,
509
- requestedAmount: options.requestedAmount
530
+ async checkWorkspaceQuota(options) {
531
+ const quotaName = nonEmpty(options.quotaName);
532
+ if (!quotaName) {
533
+ throw new ValidationError("Quota name is required");
534
+ }
535
+ const amount = options.amount ?? 1;
536
+ if (typeof amount !== "number" || !Number.isFinite(amount) || amount <= 0) {
537
+ throw new ValidationError("Quota checks need a positive amount");
538
+ }
539
+ const workspaceId = nonEmpty(options.workspaceId) ?? nonEmpty(this.context.workspaceId);
540
+ if (!workspaceId) {
541
+ throw new ValidationError("Workspace ID is required");
542
+ }
543
+ logger.debug("[Usage] Checking workspace quota", {
544
+ workspaceId,
545
+ quotaName,
546
+ amount
510
547
  });
511
- const query = `
512
- query CheckQuota($input: CheckQuotaInput!) {
513
- checkQuota(input: $input) {
514
- allowed
515
- currentUsage
516
- quotaLimit
517
- remainingQuota
518
- resetAt
519
- period
520
- reason
521
- }
522
- }
523
- `;
524
- const variables = {
525
- input: {
526
- entityId: options.entityId,
527
- entityType: options.entityType,
528
- metricType: options.metricType,
529
- requestedAmount: options.requestedAmount,
530
- workspaceId: options.workspaceId || this.context.workspaceId,
531
- organizationId: options.organizationId
532
- }
533
- };
534
- const response = await this.client.query(query, variables, this.context);
535
- logger.debug("[Usage] Quota check result", {
536
- allowed: response.checkQuota.allowed
548
+ const response = await this.client.query(CHECK_WORKSPACE_QUOTA_QUERY, {
549
+ workspaceId,
550
+ quotaName,
551
+ amount
552
+ }, this.requestContext(workspaceId, nonEmpty(options.userId)));
553
+ const result = response.checkWorkspaceQuota;
554
+ logger.debug("[Usage] Workspace quota check result", {
555
+ workspaceId,
556
+ quotaName,
557
+ allowed: result.allowed
537
558
  });
538
- return response.checkQuota;
559
+ return result;
539
560
  }
540
561
  /**
541
- * Require quota (throws if exceeded)
562
+ * Check a workspace quota and throw {@link QuotaExceededError} when it has no capacity.
563
+ * Returns the check result so the caller can pass `assignmentId` to {@link trackUsage}.
542
564
  */
543
- async requireQuota(options) {
544
- const result = await this.checkQuota(options);
565
+ async requireWorkspaceQuota(options) {
566
+ const result = await this.checkWorkspaceQuota(options);
545
567
  if (!result.allowed) {
546
- throw new QuotaExceededError(result.reason || "Quota exceeded", {
547
- entityId: options.entityId,
548
- metricType: options.metricType,
549
- currentUsage: result.currentUsage,
550
- quotaLimit: result.quotaLimit,
551
- requestedAmount: options.requestedAmount,
552
- resetAt: result.resetAt
568
+ const notProvisioned = result.assignmentId === null;
569
+ throw new QuotaExceededError(notProvisioned ? `Quota ${options.quotaName} is not included in this workspace's plan` : "Quota exceeded", {
570
+ quotaName: options.quotaName,
571
+ requestedAmount: options.amount ?? 1,
572
+ limitLeft: result.limitLeft,
573
+ notProvisioned
553
574
  });
554
575
  }
576
+ return result;
555
577
  }
556
578
  /**
557
- * Track usage and check quota atomically
579
+ * Record workspace quota usage. A negative amount releases previously recorded usage.
580
+ * Resolves to `true` once the owner has stored (or deduplicated) the record.
558
581
  */
559
- async trackAndCheck(options) {
560
- const quotaCheck = await this.checkQuota({
561
- entityId: options.entityId,
562
- entityType: options.entityType,
563
- metricType: options.metricType,
564
- requestedAmount: options.amount,
565
- workspaceId: options.workspaceId,
566
- organizationId: options.organizationId
582
+ async trackUsage(options) {
583
+ const input = buildTrackUsageInput(options, this.context);
584
+ const workspaceId = input["workspaceId"];
585
+ logger.debug("[Usage] Tracking workspace usage", {
586
+ workspaceId,
587
+ quotaName: input["quotaName"],
588
+ amount: input["amount"]
567
589
  });
568
- if (!quotaCheck.allowed) {
569
- throw new QuotaExceededError(quotaCheck.reason || "Quota exceeded", {
570
- entityId: options.entityId,
571
- metricType: options.metricType,
572
- currentUsage: quotaCheck.currentUsage,
573
- quotaLimit: quotaCheck.quotaLimit
574
- });
575
- }
576
- const usage = await this.track(options);
577
- return {
578
- usage,
579
- quotaCheck
580
- };
590
+ const response = await this.client.query(TRACK_USAGE_MUTATION, {
591
+ input
592
+ }, this.requestContext(workspaceId, nonEmpty(options.userId)));
593
+ logger.info("[Usage] Workspace usage tracked", {
594
+ workspaceId,
595
+ quotaName: input["quotaName"]
596
+ });
597
+ return response.trackUsage;
581
598
  }
582
599
  /**
583
- * Get usage records
600
+ * @deprecated The workspace usage owner has no `trackUsage` record shape keyed by
601
+ * `entityId`/`metricType`. Use {@link trackUsage} with a `quotaName`.
584
602
  */
585
- async getUsage(options) {
586
- logger.debug("[Usage] Getting usage records", {
587
- entityId: options.entityId
588
- });
589
- const query = `
590
- query GetUsage(
591
- $entityId: ID!
592
- $entityType: String!
593
- $metricType: UsageMetricType
594
- $startDate: DateTime
595
- $endDate: DateTime
596
- $workspaceId: ID
597
- $organizationId: ID
598
- $limit: Int
599
- $offset: Int
600
- ) {
601
- getUsage(
602
- entityId: $entityId
603
- entityType: $entityType
604
- metricType: $metricType
605
- startDate: $startDate
606
- endDate: $endDate
607
- workspaceId: $workspaceId
608
- organizationId: $organizationId
609
- limit: $limit
610
- offset: $offset
611
- ) {
612
- records {
613
- id
614
- entityId
615
- entityType
616
- metricType
617
- amount
618
- resourceId
619
- metadata
620
- workspaceId
621
- organizationId
622
- recordedAt
623
- }
624
- total
625
- }
626
- }
627
- `;
628
- const variables = {
629
- entityId: options.entityId,
630
- entityType: options.entityType,
631
- metricType: options.metricType,
632
- startDate: options.startDate,
633
- endDate: options.endDate,
634
- workspaceId: options.workspaceId || this.context.workspaceId,
635
- organizationId: options.organizationId,
636
- limit: options.limit || 100,
637
- offset: options.offset || 0
638
- };
639
- const response = await this.client.query(query, variables, this.context);
640
- return response.getUsage;
603
+ async track(_options) {
604
+ throw new UsageOperationUnsupportedError("track", legacyGuidance("trackUsage({ quotaName, productId, amount })"));
641
605
  }
642
606
  /**
643
- * Get usage summary
607
+ * @deprecated The owner has no `checkQuota` operation. Use {@link checkWorkspaceQuota}.
644
608
  */
645
- async getSummary(entityId, entityType, metricType, period) {
646
- logger.debug("[Usage] Getting usage summary", {
647
- entityId,
648
- metricType,
649
- period
650
- });
651
- const query = `
652
- query GetUsageSummary(
653
- $entityId: ID!
654
- $entityType: String!
655
- $metricType: UsageMetricType!
656
- $period: QuotaPeriod!
657
- ) {
658
- getUsageSummary(
659
- entityId: $entityId
660
- entityType: $entityType
661
- metricType: $metricType
662
- period: $period
663
- ) {
664
- entityId
665
- entityType
666
- metricType
667
- totalUsage
668
- period
669
- periodStart
670
- periodEnd
671
- quotaLimit
672
- utilizationPercentage
673
- }
674
- }
675
- `;
676
- const response = await this.client.query(query, {
677
- entityId,
678
- entityType,
679
- metricType,
680
- period
681
- }, this.context);
682
- return response.getUsageSummary;
609
+ async checkQuota(_options) {
610
+ throw new UsageOperationUnsupportedError("checkQuota", legacyGuidance("checkWorkspaceQuota({ quotaName, amount })"));
683
611
  }
684
612
  /**
685
- * Set quota limit
613
+ * @deprecated The owner has no `checkQuota` operation. Use {@link requireWorkspaceQuota}.
686
614
  */
687
- async setQuota(options) {
688
- if (!options.entityId) {
689
- throw new ValidationError("Entity ID is required");
690
- }
691
- if (!options.metricType) {
692
- throw new ValidationError("Metric type is required");
693
- }
694
- if (typeof options.limit !== "number" || options.limit < 0) {
695
- throw new ValidationError("Limit must be a non-negative number");
696
- }
697
- logger.debug("[Usage] Setting quota", {
698
- entityId: options.entityId,
699
- metricType: options.metricType,
700
- limit: options.limit
701
- });
702
- const mutation = `
703
- mutation SetQuota($input: SetQuotaInput!) {
704
- setQuota(input: $input) {
705
- id
706
- entityId
707
- entityType
708
- metricType
709
- limit
710
- period
711
- currentUsage
712
- resetAt
713
- createdAt
714
- updatedAt
715
- }
716
- }
717
- `;
718
- const variables = {
719
- input: {
720
- entityId: options.entityId,
721
- entityType: options.entityType,
722
- metricType: options.metricType,
723
- limit: options.limit,
724
- period: options.period,
725
- workspaceId: options.workspaceId || this.context.workspaceId,
726
- organizationId: options.organizationId
727
- }
728
- };
729
- const response = await this.client.query(mutation, variables, this.context);
730
- logger.info("[Usage] Quota set", {
731
- quotaId: response.setQuota.id
732
- });
733
- return response.setQuota;
615
+ async requireQuota(_options) {
616
+ throw new UsageOperationUnsupportedError("requireQuota", legacyGuidance("requireWorkspaceQuota({ quotaName, amount })"));
734
617
  }
735
618
  /**
736
- * Get quota
619
+ * @deprecated Use {@link requireWorkspaceQuota} followed by {@link trackUsage}.
737
620
  */
738
- async getQuota(entityId, entityType, metricType) {
739
- logger.debug("[Usage] Getting quota", {
740
- entityId,
741
- metricType
742
- });
743
- const query = `
744
- query GetQuota($entityId: ID!, $entityType: String!, $metricType: UsageMetricType!) {
745
- getQuota(entityId: $entityId, entityType: $entityType, metricType: $metricType) {
746
- id
747
- entityId
748
- entityType
749
- metricType
750
- limit
751
- period
752
- currentUsage
753
- resetAt
754
- createdAt
755
- updatedAt
756
- }
757
- }
758
- `;
759
- const response = await this.client.query(query, {
760
- entityId,
761
- entityType,
762
- metricType
763
- }, this.context);
764
- return response.getQuota;
621
+ async trackAndCheck(_options) {
622
+ throw new UsageOperationUnsupportedError("trackAndCheck", legacyGuidance("requireWorkspaceQuota() and then trackUsage()"));
765
623
  }
766
624
  /**
767
- * Get all quotas for entity
625
+ * @deprecated The owner has no `getUsage` operation; read records with the owner's
626
+ * `getUsageRecords(filters, pagination)`.
768
627
  */
769
- async getQuotas(entityId, entityType) {
770
- logger.debug("[Usage] Getting all quotas", {
771
- entityId,
772
- entityType
773
- });
774
- const query = `
775
- query GetQuotas($entityId: ID!, $entityType: String!) {
776
- getQuotas(entityId: $entityId, entityType: $entityType) {
777
- id
778
- entityId
779
- entityType
780
- metricType
781
- limit
782
- period
783
- currentUsage
784
- resetAt
785
- createdAt
786
- updatedAt
787
- }
788
- }
789
- `;
790
- const response = await this.client.query(query, {
791
- entityId,
792
- entityType
793
- }, this.context);
794
- return response.getQuotas;
628
+ async getUsage(_options) {
629
+ throw new UsageOperationUnsupportedError("getUsage", legacyGuidance("the owner's getUsageRecords query"));
795
630
  }
796
631
  /**
797
- * Reset quota usage
632
+ * @deprecated The owner's `getUsageSummary` takes `UsageFilters` and returns a list; this
633
+ * signature does not map onto it.
798
634
  */
799
- async resetQuota(entityId, entityType, metricType) {
800
- logger.debug("[Usage] Resetting quota", {
801
- entityId,
802
- metricType
803
- });
804
- const mutation = `
805
- mutation ResetQuota($entityId: ID!, $entityType: String!, $metricType: UsageMetricType!) {
806
- resetQuota(entityId: $entityId, entityType: $entityType, metricType: $metricType) {
807
- success
808
- }
809
- }
810
- `;
811
- await this.client.query(mutation, {
812
- entityId,
813
- entityType,
814
- metricType
815
- }, this.context);
816
- logger.info("[Usage] Quota reset", {
817
- entityId,
818
- metricType
819
- });
820
- return true;
635
+ async getSummary(_entityId, _entityType, _metricType, _period) {
636
+ throw new UsageOperationUnsupportedError("getSummary", legacyGuidance("the owner's getUsageSummary(filters) query"));
821
637
  }
822
638
  /**
823
- * Delete quota
639
+ * @deprecated Quota limits are assigned by global-billing-svc through the owner's
640
+ * `assignWorkspaceQuota`, which only billing's service identity may call.
824
641
  */
825
- async deleteQuota(entityId, entityType, metricType) {
826
- logger.debug("[Usage] Deleting quota", {
827
- entityId,
828
- metricType
829
- });
830
- const mutation = `
831
- mutation DeleteQuota($entityId: ID!, $entityType: String!, $metricType: UsageMetricType!) {
832
- deleteQuota(entityId: $entityId, entityType: $entityType, metricType: $metricType) {
833
- success
834
- }
835
- }
836
- `;
837
- await this.client.query(mutation, {
838
- entityId,
839
- entityType,
840
- metricType
841
- }, this.context);
842
- logger.info("[Usage] Quota deleted", {
843
- entityId,
844
- metricType
845
- });
846
- return true;
642
+ async setQuota(_options) {
643
+ throw new UsageOperationUnsupportedError("setQuota", "quota limits are assigned by global-billing-svc");
847
644
  }
848
645
  /**
849
- * Bulk track usage
646
+ * @deprecated The owner has no `getQuota` operation; read `workspaceQuotaStatuses(workspaceId)`.
850
647
  */
851
- async trackBulk(records) {
852
- logger.debug("[Usage] Bulk tracking usage", {
853
- count: records.length
854
- });
855
- const mutation = `
856
- mutation TrackUsageBulk($records: [TrackUsageInput!]!) {
857
- trackUsageBulk(records: $records) {
858
- id
859
- entityId
860
- entityType
861
- metricType
862
- amount
863
- resourceId
864
- metadata
865
- workspaceId
866
- organizationId
867
- recordedAt
868
- }
869
- }
870
- `;
871
- const response = await this.client.query(mutation, {
872
- records
873
- }, this.context);
874
- logger.info("[Usage] Bulk usage tracked", {
875
- count: response.trackUsageBulk.length
876
- });
877
- return response.trackUsageBulk;
648
+ async getQuota(_entityId, _entityType, _metricType) {
649
+ throw new UsageOperationUnsupportedError("getQuota", legacyGuidance("the owner's workspaceQuotaStatuses query"));
650
+ }
651
+ /**
652
+ * @deprecated The owner has no `getQuotas` operation; read `workspaceQuotaAssignments(workspaceId)`.
653
+ */
654
+ async getQuotas(_entityId, _entityType) {
655
+ throw new UsageOperationUnsupportedError("getQuotas", legacyGuidance("the owner's workspaceQuotaAssignments query"));
656
+ }
657
+ /**
658
+ * @deprecated The owner has no `resetQuota` operation; quotas reset on their `resetPeriod`.
659
+ */
660
+ async resetQuota(_entityId, _entityType, _metricType) {
661
+ throw new UsageOperationUnsupportedError("resetQuota", "quotas reset on the assignment's resetPeriod");
662
+ }
663
+ /**
664
+ * @deprecated The owner has no `deleteQuota` operation; billing deactivates assignments.
665
+ */
666
+ async deleteQuota(_entityId, _entityType, _metricType) {
667
+ throw new UsageOperationUnsupportedError("deleteQuota", "quota assignments are deactivated by global-billing-svc");
668
+ }
669
+ /**
670
+ * @deprecated The owner has no `trackUsageBulk` operation. Call {@link trackUsage} per record.
671
+ */
672
+ async trackBulk(_records) {
673
+ throw new UsageOperationUnsupportedError("trackBulk", legacyGuidance("trackUsage() per record"));
878
674
  }
879
675
  };
880
676
 
881
- export { BillingUsageClient, QuotaPeriod, UsageMetricType, UsageModule };
882
- //# sourceMappingURL=chunk-BD3SMWUU.js.map
883
- //# sourceMappingURL=chunk-BD3SMWUU.js.map
677
+ export { BillingUsageClient, CHECK_WORKSPACE_QUOTA_QUERY, QuotaPeriod, TRACK_USAGE_MUTATION, UsageMetricType, UsageModule, UsageOperationUnsupportedError, buildTrackUsageInput };
678
+ //# sourceMappingURL=chunk-QVPIACWD.js.map
679
+ //# sourceMappingURL=chunk-QVPIACWD.js.map