@abyss-project/main 37.5.0 → 38.0.0

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 (76) hide show
  1. package/dist/api/billing-account.admin.api.d.ts +3 -3
  2. package/dist/api/billing-account.admin.api.js +4 -4
  3. package/dist/api/billing-account.admin.api.js.map +1 -1
  4. package/dist/api/organization-billing.api.d.ts +2 -3
  5. package/dist/api/organization-billing.api.js +1 -5
  6. package/dist/api/organization-billing.api.js.map +1 -1
  7. package/dist/billing-metric-label/billing-metric-label.labels.d.ts +0 -6
  8. package/dist/billing-metric-label/billing-metric-label.labels.js +0 -6
  9. package/dist/billing-metric-label/billing-metric-label.labels.js.map +1 -1
  10. package/dist/constants/billing-catalog.constants.js +0 -28
  11. package/dist/constants/billing-catalog.constants.js.map +1 -1
  12. package/dist/constants/catalog-plan-quotas.constants.js +0 -9
  13. package/dist/constants/catalog-plan-quotas.constants.js.map +1 -1
  14. package/dist/constants/enforcement-registry.constants.js +2 -20
  15. package/dist/constants/enforcement-registry.constants.js.map +1 -1
  16. package/dist/constants/metric-price-scale.constants.js +0 -8
  17. package/dist/constants/metric-price-scale.constants.js.map +1 -1
  18. package/dist/constants/module-catalog.constants.d.ts +0 -2
  19. package/dist/constants/module-catalog.constants.js +0 -24
  20. package/dist/constants/module-catalog.constants.js.map +1 -1
  21. package/dist/constants/overage-base-rates.constants.js +0 -1
  22. package/dist/constants/overage-base-rates.constants.js.map +1 -1
  23. package/dist/constants/public-plans.constants.js +0 -81
  24. package/dist/constants/public-plans.constants.js.map +1 -1
  25. package/dist/constants/quota-metric-kind.constants.js +0 -3
  26. package/dist/constants/quota-metric-kind.constants.js.map +1 -1
  27. package/dist/constants/tests/billing-catalog.constants.spec.js +1 -114
  28. package/dist/constants/tests/billing-catalog.constants.spec.js.map +1 -1
  29. package/dist/constants/tests/catalog-plan-quotas.coherence.spec.js +0 -16
  30. package/dist/constants/tests/catalog-plan-quotas.coherence.spec.js.map +1 -1
  31. package/dist/constants/tests/metric-price-scale.constants.spec.js +1 -5
  32. package/dist/constants/tests/metric-price-scale.constants.spec.js.map +1 -1
  33. package/dist/constants/tests/module-calibration.constants.spec.js +0 -1
  34. package/dist/constants/tests/module-calibration.constants.spec.js.map +1 -1
  35. package/dist/constants/tests/module-catalog.constants.spec.js +2 -58
  36. package/dist/constants/tests/module-catalog.constants.spec.js.map +1 -1
  37. package/dist/index.d.ts +1 -2
  38. package/dist/index.js +1 -2
  39. package/dist/index.js.map +1 -1
  40. package/dist/translate/en.translate.d.ts +0 -4
  41. package/dist/translate/en.translate.js +0 -4
  42. package/dist/translate/en.translate.js.map +1 -1
  43. package/dist/translate/fr.translate.d.ts +0 -4
  44. package/dist/translate/fr.translate.js +0 -4
  45. package/dist/translate/fr.translate.js.map +1 -1
  46. package/dist/types/enum/email-type.enum.d.ts +0 -1
  47. package/dist/types/enum/email-type.enum.js +0 -1
  48. package/dist/types/enum/email-type.enum.js.map +1 -1
  49. package/dist/types/enum/index.d.ts +0 -1
  50. package/dist/types/enum/index.js +0 -1
  51. package/dist/types/enum/index.js.map +1 -1
  52. package/dist/types/enum/organization-billing.enum.d.ts +0 -3
  53. package/dist/types/enum/organization-billing.enum.js +0 -3
  54. package/dist/types/enum/organization-billing.enum.js.map +1 -1
  55. package/dist/types/enum/user-notification-category.enum.js +0 -1
  56. package/dist/types/enum/user-notification-category.enum.js.map +1 -1
  57. package/dist/types/enum/user-notification-content-type.enum.d.ts +0 -10
  58. package/dist/types/enum/user-notification-content-type.enum.js +1 -2
  59. package/dist/types/enum/user-notification-content-type.enum.js.map +1 -1
  60. package/dist/types/interface/api/requests/billing-account.admin.request.d.ts +9 -2
  61. package/dist/types/interface/api/requests/organization-billing.request.d.ts +1 -28
  62. package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +9 -6
  63. package/dist/types/interface/api/responses/organization-billing.response.d.ts +0 -4
  64. package/dist/utils/index.d.ts +1 -0
  65. package/dist/utils/index.js +1 -0
  66. package/dist/utils/index.js.map +1 -1
  67. package/dist/utils/quota-inventory.utils.d.ts +3 -0
  68. package/dist/utils/quota-inventory.utils.js +11 -0
  69. package/dist/utils/quota-inventory.utils.js.map +1 -0
  70. package/package.json +1 -1
  71. package/dist/api/tests/sdk-resource-alert.spec.d.ts +0 -1
  72. package/dist/api/tests/sdk-resource-alert.spec.js +0 -38
  73. package/dist/api/tests/sdk-resource-alert.spec.js.map +0 -1
  74. package/dist/types/enum/resource-alert-kind.enum.d.ts +0 -18
  75. package/dist/types/enum/resource-alert-kind.enum.js +0 -11
  76. package/dist/types/enum/resource-alert-kind.enum.js.map +0 -1
@@ -28,9 +28,16 @@ export type IListTransactionsAdminBillingQuery = {
28
28
  export type IListPurchasesAdminBillingQuery = {
29
29
  billingAccountId?: string;
30
30
  } & QueryPaginate;
31
- export interface IListStaleAnnounceScopesAdminBillingQuery {
31
+ export interface IQuotaInventoryScopeTotal {
32
+ organizationId?: string;
33
+ userId?: string;
34
+ count: number;
35
+ fingerprint: string;
36
+ }
37
+ export interface IReconcileQuotaInventoryAdminBillingBody {
32
38
  service: BillingService;
33
- limit: number;
39
+ metric: BillingMetric;
40
+ scopes: IQuotaInventoryScopeTotal[];
34
41
  }
35
42
  export interface IGetAccountAdminBillingParams {
36
43
  billingAccountId: string;
@@ -1,4 +1,4 @@
1
- import { BillingInterval, BillingMetric, BillingQuotaCapAction, BillingQuotaCapMode, BillingService, QuotaCeilingMode, QuotaGrantScope, ResourceAlertKind, StorageSubtotalSource, UsageResourceType } from '../../../enum';
1
+ import { BillingInterval, BillingMetric, BillingQuotaCapAction, BillingQuotaCapMode, BillingService, QuotaCeilingMode, QuotaGrantScope, StorageSubtotalSource, UsageResourceType } from '../../../enum';
2
2
  import { IBillingAddress } from '../../models/billing-account.model';
3
3
  import { BillingModuleId } from '../../../../constants/module-catalog.constants';
4
4
  import type { ICancellationFlowContext } from './subscription-retention.request';
@@ -244,30 +244,3 @@ export interface IListOrgDailySnapshotsQuery {
244
244
  from: string;
245
245
  to: string;
246
246
  }
247
- export interface IReportResourceAlertOrganizationParams {
248
- organizationId: string;
249
- }
250
- export interface IReportResourceAlertOrganizationBase {
251
- metric: BillingMetric;
252
- resourceId: string;
253
- resourceLabel: string;
254
- threshold: number;
255
- period: string;
256
- actionUrl: string;
257
- channels: {
258
- email: boolean;
259
- inApp: boolean;
260
- };
261
- }
262
- export type IReportResourceAlertOrganizationBody = IReportResourceAlertOrganizationBase & ({
263
- kind: ResourceAlertKind.USAGE_THRESHOLD;
264
- } | {
265
- kind: ResourceAlertKind.RATE_REJECTED;
266
- } | {
267
- kind: ResourceAlertKind.SPEND_CAP_THRESHOLD;
268
- spendCapCents: number;
269
- } | {
270
- kind: ResourceAlertKind.RATE_ALLOCATION_REDUCED;
271
- lotsBefore: number;
272
- lotsAfter: number;
273
- });
@@ -102,15 +102,18 @@ export type IListTransactionsAdminBillingData = BasePaginate<ICreditTransaction>
102
102
  export type IListTransactionsAdminBillingResponse = IResponse<IListTransactionsAdminBillingData>;
103
103
  export type IListPurchasesAdminBillingData = BasePaginate<IEurTransaction>;
104
104
  export type IListPurchasesAdminBillingResponse = IResponse<IListPurchasesAdminBillingData>;
105
- export interface IStaleAnnounceScope {
106
- billingAccountId: string;
107
- userId: string | null;
105
+ export interface IQuotaInventoryMismatch {
108
106
  organizationId: string | null;
107
+ userId: string | null;
108
+ satelliteCount: number;
109
+ mainCount: number;
109
110
  }
110
- export interface IListStaleAnnounceScopesAdminBillingData {
111
- scopes: IStaleAnnounceScope[];
111
+ export interface IReconcileQuotaInventoryAdminBillingData {
112
+ checked: number;
113
+ unknownScopes: number;
114
+ mismatches: IQuotaInventoryMismatch[];
112
115
  }
113
- export type IListStaleAnnounceScopesAdminBillingResponse = IResponse<IListStaleAnnounceScopesAdminBillingData>;
116
+ export type IReconcileQuotaInventoryAdminBillingResponse = IResponse<IReconcileQuotaInventoryAdminBillingData>;
114
117
  export interface IMigrateSubscriptionsAdminBillingData {
115
118
  migrated: number;
116
119
  failed: number;
@@ -115,10 +115,6 @@ export interface IImportQuotaOrganizationData {
115
115
  swept: number;
116
116
  }
117
117
  export type IImportQuotaOrganizationResponse = IResponse<IImportQuotaOrganizationData>;
118
- export interface IReportResourceAlertOrganizationData {
119
- sent: boolean;
120
- }
121
- export type IReportResourceAlertOrganizationResponse = IResponse<IReportResourceAlertOrganizationData>;
122
118
  export interface ISetStorageSubtotalOrganizationData {
123
119
  poolBytes: number;
124
120
  limitBytes: number;
@@ -15,6 +15,7 @@ export * from './tracking.utils';
15
15
  export * from './duration.utils';
16
16
  export * from './time-period.utils';
17
17
  export * from './billing.utils';
18
+ export * from './quota-inventory.utils';
18
19
  export * from './quota-ceiling.utils';
19
20
  export * from './user-language.utils';
20
21
  export * from './user-currency.utils';
@@ -31,6 +31,7 @@ __exportStar(require("./tracking.utils"), exports);
31
31
  __exportStar(require("./duration.utils"), exports);
32
32
  __exportStar(require("./time-period.utils"), exports);
33
33
  __exportStar(require("./billing.utils"), exports);
34
+ __exportStar(require("./quota-inventory.utils"), exports);
34
35
  __exportStar(require("./quota-ceiling.utils"), exports);
35
36
  __exportStar(require("./user-language.utils"), exports);
36
37
  __exportStar(require("./user-currency.utils"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C;AAI/C,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C;AAC1C,yDAAuC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,gDAA8B;AAC9B,0DAAwC;AACxC,+CAA6B;AAC7B,iDAA+B;AAC/B,uDAAqC;AACrC,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,gDAA8B;AAC9B,+CAA6B;AAC7B,sDAAoC;AACpC,iDAA+B;AAC/B,mDAAiC;AACjC,mDAAiC;AACjC,sDAAoC;AACpC,kDAAgC;AAChC,0DAAwC;AACxC,wDAAsC;AACtC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,6DAA2C;AAC3C,uDAAqC;AACrC,0DAAwC;AACxC,iEAA+C;AAI/C,kDAAgC;AAChC,wDAAsC;AACtC,4DAA0C;AAC1C,yDAAuC"}
@@ -0,0 +1,3 @@
1
+ export declare const QUOTA_INVENTORY_FINGERPRINT_PATTERN: RegExp;
2
+ export declare const MAX_QUOTA_RECONCILE_SCOPES = 20000;
3
+ export declare const quotaInventoryFingerprintSql: (idSql: string) => string;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.quotaInventoryFingerprintSql = exports.MAX_QUOTA_RECONCILE_SCOPES = exports.QUOTA_INVENTORY_FINGERPRINT_PATTERN = void 0;
4
+ exports.QUOTA_INVENTORY_FINGERPRINT_PATTERN = /^[0-9a-f]{32}$/;
5
+ exports.MAX_QUOTA_RECONCILE_SCOPES = 20000;
6
+ const quotaInventoryFingerprintSql = (idSql) => {
7
+ const id = `(${idSql})::text COLLATE "C"`;
8
+ return `md5(COALESCE(string_agg(DISTINCT ${id}, E'\\n' ORDER BY ${id}), ''))`;
9
+ };
10
+ exports.quotaInventoryFingerprintSql = quotaInventoryFingerprintSql;
11
+ //# sourceMappingURL=quota-inventory.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"quota-inventory.utils.js","sourceRoot":"","sources":["../../src/utils/quota-inventory.utils.ts"],"names":[],"mappings":";;;AASa,QAAA,mCAAmC,GAAG,gBAAgB,CAAC;AAOvD,QAAA,0BAA0B,GAAG,KAAK,CAAC;AAkBzC,MAAM,4BAA4B,GAAG,CAAC,KAAa,EAAU,EAAE;IACpE,MAAM,EAAE,GAAG,IAAI,KAAK,qBAAqB,CAAC;IAC1C,OAAO,oCAAoC,EAAE,qBAAqB,EAAE,SAAS,CAAC;AAChF,CAAC,CAAC;AAHW,QAAA,4BAA4B,gCAGvC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/main",
3
- "version": "37.5.0",
3
+ "version": "38.0.0",
4
4
  "description": "Core package to interact with Abyss-Project",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1 +0,0 @@
1
- export {};
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const __1 = require("../..");
4
- describe('SDK — per-resource alerts (#844)', () => {
5
- it('posts the alert to the admin resource-alert route of the organization', async () => {
6
- const post = jest
7
- .spyOn(__1.AbyssCore.axios, 'post')
8
- .mockResolvedValue({ data: { data: { sent: true } } });
9
- const body = {
10
- kind: __1.ResourceAlertKind.SPEND_CAP_THRESHOLD,
11
- spendCapCents: 1250,
12
- metric: __1.BillingMetric.REFLEX_CREDITS_MONTH,
13
- resourceId: 'bot-1',
14
- resourceLabel: 'My bot',
15
- threshold: 80,
16
- period: '2026-11-21',
17
- actionUrl: 'https://abyss.example/reflex/bot-1',
18
- channels: { email: true, inApp: false },
19
- };
20
- const res = await __1.AbyssCore.sdk.organizationBilling.reportResourceAlertAdmin({ organizationId: 'org-1' }, body);
21
- expect(post).toHaveBeenCalledWith('admin/organization/org-1/quota/resource-alert', body);
22
- expect(res.data.sent).toBe(true);
23
- });
24
- it('declares the notification type, its category and the e-mail type', () => {
25
- expect(__1.UserNotificationContentType.BILLING_RESOURCE_THRESHOLD).toBe('billing-resource-threshold');
26
- expect(__1.USER_NOTIFICATION_CONTENT_TYPE_CATEGORY[__1.UserNotificationContentType.BILLING_RESOURCE_THRESHOLD]).toBe(__1.UserNotificationCategory.OPERATIONAL);
27
- expect(__1.EmailType.BILLING_RESOURCE_WARNING).toBe('BILLING_RESOURCE_WARNING');
28
- });
29
- it('names the four kinds of alert, each worded on its own', () => {
30
- expect(Object.values(__1.ResourceAlertKind)).toEqual([
31
- 'USAGE_THRESHOLD',
32
- 'RATE_REJECTED',
33
- 'SPEND_CAP_THRESHOLD',
34
- 'RATE_ALLOCATION_REDUCED',
35
- ]);
36
- });
37
- });
38
- //# sourceMappingURL=sdk-resource-alert.spec.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"sdk-resource-alert.spec.js","sourceRoot":"","sources":["../../../src/api/tests/sdk-resource-alert.spec.ts"],"names":[],"mappings":";;AAAA,6BASe;AAEf,QAAQ,CAAC,kCAAkC,EAAE,GAAG,EAAE;IAChD,EAAE,CAAC,uEAAuE,EAAE,KAAK,IAAI,EAAE;QACrF,MAAM,IAAI,GAAG,IAAI;aACd,KAAK,CAAC,aAAS,CAAC,KAAK,EAAE,MAAM,CAAC;aAC9B,iBAAiB,CAAC,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;QACzD,MAAM,IAAI,GAAyC;YACjD,IAAI,EAAE,qBAAiB,CAAC,mBAAmB;YAC3C,aAAa,EAAE,IAAI;YACnB,MAAM,EAAE,iBAAa,CAAC,oBAAoB;YAC1C,UAAU,EAAE,OAAO;YACnB,aAAa,EAAE,QAAQ;YACvB,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,YAAY;YACpB,S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_ALLOCATION_REDUCED"
6
- }
7
- export type ResourceAlertKindData = {
8
- kind: ResourceAlertKind.USAGE_THRESHOLD;
9
- } | {
10
- kind: ResourceAlertKind.RATE_REJECTED;
11
- } | {
12
- kind: ResourceAlertKind.SPEND_CAP_THRESHOLD;
13
- spendCapCents: string;
14
- } | {
15
- kind: ResourceAlertKind.RATE_ALLOCATION_REDUCED;
16
- lotsBefore: string;
17
- lotsAfter: string;
18
- };
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ResourceAlertKind = void 0;
4
- var ResourceAlertKind;
5
- (function (ResourceAlertKind) {
6
- ResourceAlertKind["USAGE_THRESHOLD"] = "USAGE_THRESHOLD";
7
- ResourceAlertKind["RATE_REJECTED"] = "RATE_REJECTED";
8
- ResourceAlertKind["SPEND_CAP_THRESHOLD"] = "SPEND_CAP_THRESHOLD";
9
- ResourceAlertKind["RATE_ALLOCATION_REDUCED"] = "RATE_ALLOCATION_REDUCED";
10
- })(ResourceAlertKind || (exports.ResourceAlertKind = ResourceAlertKind = {}));
11
- //# sourceMappingURL=resource-alert-kind.enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resource-alert-kind.enum.js","sourceRoot":"","sources":["../../../src/types/enum/resource-alert-kind.enum.ts"],"names":[],"mappings":";;;AAKA,IAAY,iBASX;AATD,WAAY,iBAAiB;IAE3B,wDAAmC,CAAA;IAEnC,oDAA+B,CAAA;IAE/B,gEAA2C,CAAA;IAE3C,wEAAmD,CAAA;AACrD,CAAC,EATW,iBAAiB,iCAAjB,iBAAiB,QAS5B"}