@abyss-project/main 2.1.0 → 2.2.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 (127) hide show
  1. package/dist/api/billing-account.admin.api.d.ts +7 -3
  2. package/dist/api/billing-account.admin.api.js +13 -5
  3. package/dist/api/billing-account.admin.api.js.map +1 -1
  4. package/dist/api/organization-billing.api.d.ts +11 -0
  5. package/dist/api/organization-billing.api.js +17 -1
  6. package/dist/api/organization-billing.api.js.map +1 -1
  7. package/dist/api/organization-external-identity.api.d.ts +7 -0
  8. package/dist/api/organization-external-identity.api.js +25 -0
  9. package/dist/api/organization-external-identity.api.js.map +1 -0
  10. package/dist/api/organization-member.admin.api.d.ts +2 -1
  11. package/dist/api/organization-member.admin.api.js +5 -1
  12. package/dist/api/organization-member.admin.api.js.map +1 -1
  13. package/dist/api/user-billing.api.d.ts +9 -0
  14. package/dist/api/user-billing.api.js +17 -1
  15. package/dist/api/user-billing.api.js.map +1 -1
  16. package/dist/constants/catalog-plan-quotas.constants.d.ts +2 -0
  17. package/dist/constants/catalog-plan-quotas.constants.js +70 -1
  18. package/dist/constants/catalog-plan-quotas.constants.js.map +1 -1
  19. package/dist/constants/index.d.ts +1 -0
  20. package/dist/constants/index.js +1 -0
  21. package/dist/constants/index.js.map +1 -1
  22. package/dist/constants/metric-price-scale.constants.d.ts +1 -0
  23. package/dist/constants/metric-price-scale.constants.js +12 -1
  24. package/dist/constants/metric-price-scale.constants.js.map +1 -1
  25. package/dist/constants/module-catalog.constants.d.ts +65 -0
  26. package/dist/constants/module-catalog.constants.js +336 -0
  27. package/dist/constants/module-catalog.constants.js.map +1 -0
  28. package/dist/constants/quota-metric-kind.constants.d.ts +2 -0
  29. package/dist/constants/quota-metric-kind.constants.js +12 -1
  30. package/dist/constants/quota-metric-kind.constants.js.map +1 -1
  31. package/dist/index.d.ts +20 -0
  32. package/dist/index.js +20 -0
  33. package/dist/index.js.map +1 -1
  34. package/dist/types/enum/abyss-application-event.enum.d.ts +4 -1
  35. package/dist/types/enum/abyss-application-event.enum.js +4 -1
  36. package/dist/types/enum/abyss-application-event.enum.js.map +1 -1
  37. package/dist/types/enum/external-delivery.enum.d.ts +6 -0
  38. package/dist/types/enum/external-delivery.enum.js +11 -0
  39. package/dist/types/enum/external-delivery.enum.js.map +1 -0
  40. package/dist/types/enum/index.d.ts +2 -0
  41. package/dist/types/enum/index.js +2 -0
  42. package/dist/types/enum/index.js.map +1 -1
  43. package/dist/types/enum/organization-billing.enum.d.ts +15 -2
  44. package/dist/types/enum/organization-billing.enum.js +29 -2
  45. package/dist/types/enum/organization-billing.enum.js.map +1 -1
  46. package/dist/types/enum/organization-external-identity.enum.d.ts +17 -0
  47. package/dist/types/enum/organization-external-identity.enum.js +24 -0
  48. package/dist/types/enum/organization-external-identity.enum.js.map +1 -0
  49. package/dist/types/enum/slack-webhook.enum.d.ts +3 -1
  50. package/dist/types/enum/slack-webhook.enum.js +2 -0
  51. package/dist/types/enum/slack-webhook.enum.js.map +1 -1
  52. package/dist/types/enum/token-type.enum.d.ts +2 -1
  53. package/dist/types/enum/token-type.enum.js +1 -0
  54. package/dist/types/enum/token-type.enum.js.map +1 -1
  55. package/dist/types/enum/user-notification-category.enum.d.ts +7 -1
  56. package/dist/types/enum/user-notification-category.enum.js +19 -1
  57. package/dist/types/enum/user-notification-category.enum.js.map +1 -1
  58. package/dist/types/enum/user-notification-content-type.enum.d.ts +2 -0
  59. package/dist/types/enum/user-notification-content-type.enum.js.map +1 -1
  60. package/dist/types/interface/api/index.d.ts +9 -0
  61. package/dist/types/interface/api/index.js +9 -0
  62. package/dist/types/interface/api/index.js.map +1 -1
  63. package/dist/types/interface/api/requests/billing-account.admin.request.d.ts +9 -5
  64. package/dist/types/interface/api/requests/billing-module.request.d.ts +25 -0
  65. package/dist/types/interface/api/requests/billing-module.request.js +3 -0
  66. package/dist/types/interface/api/requests/billing-module.request.js.map +1 -0
  67. package/dist/types/interface/api/requests/billing-snapshot-admin.request.d.ts +7 -0
  68. package/dist/types/interface/api/requests/billing-snapshot-admin.request.js +3 -0
  69. package/dist/types/interface/api/requests/billing-snapshot-admin.request.js.map +1 -0
  70. package/dist/types/interface/api/requests/organization-external-identity.request.d.ts +28 -0
  71. package/dist/types/interface/api/requests/organization-external-identity.request.js +3 -0
  72. package/dist/types/interface/api/requests/organization-external-identity.request.js.map +1 -0
  73. package/dist/types/interface/api/requests/organization-integration-webhook.request.d.ts +17 -1
  74. package/dist/types/interface/api/requests/organization-member.request.d.ts +3 -0
  75. package/dist/types/interface/api/requests/quota-offer.request.d.ts +10 -0
  76. package/dist/types/interface/api/requests/quota-offer.request.js +3 -0
  77. package/dist/types/interface/api/requests/quota-offer.request.js.map +1 -0
  78. package/dist/types/interface/api/responses/billing-account.admin.response.d.ts +10 -13
  79. package/dist/types/interface/api/responses/billing-estimate.response.d.ts +18 -0
  80. package/dist/types/interface/api/responses/billing-estimate.response.js +3 -0
  81. package/dist/types/interface/api/responses/billing-estimate.response.js.map +1 -0
  82. package/dist/types/interface/api/responses/billing-module.response.d.ts +21 -0
  83. package/dist/types/interface/api/responses/billing-module.response.js +3 -0
  84. package/dist/types/interface/api/responses/billing-module.response.js.map +1 -0
  85. package/dist/types/interface/api/responses/billing-snapshot-admin.response.d.ts +9 -0
  86. package/dist/types/interface/api/responses/billing-snapshot-admin.response.js +3 -0
  87. package/dist/types/interface/api/responses/billing-snapshot-admin.response.js.map +1 -0
  88. package/dist/types/interface/api/responses/organization-external-identity.response.d.ts +22 -0
  89. package/dist/types/interface/api/responses/organization-external-identity.response.js +3 -0
  90. package/dist/types/interface/api/responses/organization-external-identity.response.js.map +1 -0
  91. package/dist/types/interface/api/responses/organization-member.response.d.ts +8 -0
  92. package/dist/types/interface/api/responses/quota-offer.response.d.ts +27 -0
  93. package/dist/types/interface/api/responses/quota-offer.response.js +3 -0
  94. package/dist/types/interface/api/responses/quota-offer.response.js.map +1 -0
  95. package/dist/types/interface/index.d.ts +3 -0
  96. package/dist/types/interface/index.js +3 -0
  97. package/dist/types/interface/index.js.map +1 -1
  98. package/dist/types/interface/models/billing-account-addon.model.d.ts +16 -0
  99. package/dist/types/interface/models/billing-account-addon.model.js +3 -0
  100. package/dist/types/interface/models/billing-account-addon.model.js.map +1 -0
  101. package/dist/types/interface/models/external-delivery.model.d.ts +22 -0
  102. package/dist/types/interface/models/external-delivery.model.js +3 -0
  103. package/dist/types/interface/models/external-delivery.model.js.map +1 -0
  104. package/dist/types/interface/models/index.d.ts +1 -0
  105. package/dist/types/interface/models/index.js +1 -0
  106. package/dist/types/interface/models/index.js.map +1 -1
  107. package/dist/types/interface/models/organization-external-identity.model.d.ts +20 -0
  108. package/dist/types/interface/models/organization-external-identity.model.js +3 -0
  109. package/dist/types/interface/models/organization-external-identity.model.js.map +1 -0
  110. package/dist/types/interface/models/organization-member.model.d.ts +1 -0
  111. package/dist/types/interface/models/organization-service-quota.model.d.ts +1 -0
  112. package/dist/types/session.d.ts +8 -1
  113. package/dist/utils/billing-deep-link.utils.d.ts +15 -0
  114. package/dist/utils/billing-deep-link.utils.js +23 -0
  115. package/dist/utils/billing-deep-link.utils.js.map +1 -0
  116. package/dist/utils/billing.utils.d.ts +0 -2
  117. package/dist/utils/billing.utils.js +1 -6
  118. package/dist/utils/billing.utils.js.map +1 -1
  119. package/dist/utils/index.d.ts +1 -0
  120. package/dist/utils/index.js +1 -0
  121. package/dist/utils/index.js.map +1 -1
  122. package/dist/utils/pricing.utils.d.ts +21 -1
  123. package/dist/utils/pricing.utils.js +111 -4
  124. package/dist/utils/pricing.utils.js.map +1 -1
  125. package/package.json +15 -11
  126. package/tsconfig.build.json +4 -0
  127. package/tsconfig.json +35 -36
@@ -39,8 +39,11 @@ __exportStar(require("./models/report-notification-subscription.model"), exports
39
39
  __exportStar(require("./models/organization.model"), exports);
40
40
  __exportStar(require("./models/organization-integration.model"), exports);
41
41
  __exportStar(require("./models/organization-member.model"), exports);
42
+ __exportStar(require("./models/organization-external-identity.model"), exports);
43
+ __exportStar(require("./models/external-delivery.model"), exports);
42
44
  __exportStar(require("./models/plan-template.model"), exports);
43
45
  __exportStar(require("./models/billing-account.model"), exports);
46
+ __exportStar(require("./models/billing-account-addon.model"), exports);
44
47
  __exportStar(require("./models/organization-service-quota.model"), exports);
45
48
  __exportStar(require("./models/organization-project-quota.model"), exports);
46
49
  __exportStar(require("./models/usage-record.model"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/interface/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,yDAAuC;AACvC,gEAA8C;AAC9C,4EAA0D;AAC1D,6DAA2C;AAC3C,mEAAiD;AACjD,yEAAuD;AACvD,+DAA6C;AAC7C,+DAA6C;AAC7C,8DAA4C;AAC5C,mEAAiD;AACjD,oEAAkD;AAGlD,2DAAyC;AACzC,sEAAoD;AAGpD,wCAAsB;AAGtB,uDAAqC;AAGrC,wDAAsC;AACtC,gEAA8C;AAC9C,8DAA4C;AAC5C,oEAAkD;AAClD,8EAA4D;AAC5D,kFAAgE;AAGhE,8DAA4C;AAC5C,0EAAwD;AACxD,qEAAmD;AAGnD,+DAA6C;AAC7C,iEAA+C;AAC/C,4EAA0D;AAC1D,4EAA0D;AAC1D,8DAA4C;AAC5C,yDAAuC;AACvC,oEAAkD;AAClD,iEAA+C;AAC/C,0EAAwD;AACxD,6DAA2C;AAC3C,sEAAoD;AACpD,mEAAiD;AACjD,mEAAiD;AACjD,kEAAgD;AAChD,qEAAmD;AACnD,wEAAsD;AACtD,+DAA6C;AAC7C,8DAA4C;AAC5C,qEAAmD;AACnD,sDAAoC;AACpC,6DAA2C;AAC3C,qEAAmD;AACnD,iFAA+D;AAC/D,iEAA+C;AAC/C,oFAAkE;AAGlE,kEAAgD;AAGhD,mEAAiD;AAGjD,+DAA6C;AAO7C,gEAA8C;AAG9C,gEAA8C;AAC9C,wEAAsD;AACtD,2EAAyD;AACzD,oEAAkD;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GhD,iEAA+C;AAC/C,4DAA0C"}
@@ -0,0 +1,16 @@
1
+ import { BillingAddonStatus } from '../../enum';
2
+ import { BillingModuleId } from '../../../constants/module-catalog.constants';
3
+ import { IBillingAccount } from './billing-account.model';
4
+ export interface IBillingAccountAddon {
5
+ id?: string;
6
+ billingAccountId: string;
7
+ moduleId: BillingModuleId;
8
+ quantity: number;
9
+ stripeSubscriptionItemId: string | null;
10
+ status: BillingAddonStatus;
11
+ pendingEffectiveAt: Date | null;
12
+ pendingQuantity: number | null;
13
+ updatedAt?: Date;
14
+ createdAt?: Date;
15
+ billingAccount?: IBillingAccount;
16
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=billing-account-addon.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-account-addon.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/billing-account-addon.model.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
1
+ import { ExternalDeliveryStatus, ExternalMessagingPlatform } from '../../enum';
2
+ import { IOrganization } from './organization.model';
3
+ import { IUser } from './user.model';
4
+ import { IUserNotification } from './user-notification.model';
5
+ export interface IExternalDelivery {
6
+ id?: string;
7
+ userNotificationId?: string | null;
8
+ organizationId: string;
9
+ userId: string;
10
+ platform: ExternalMessagingPlatform;
11
+ organizationExternalIdentityId?: string | null;
12
+ status: ExternalDeliveryStatus;
13
+ attemptCount: number;
14
+ nextAttemptAt?: Date | null;
15
+ externalMessageId?: string | null;
16
+ lastError?: string | null;
17
+ updatedAt?: Date;
18
+ createdAt?: Date;
19
+ organization?: IOrganization;
20
+ user?: IUser;
21
+ userNotification?: IUserNotification;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=external-delivery.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"external-delivery.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/external-delivery.model.ts"],"names":[],"mappings":""}
@@ -18,6 +18,7 @@ export * from './organization-integration.model';
18
18
  export * from './organization-member.model';
19
19
  export * from './plan-template.model';
20
20
  export * from './billing-account.model';
21
+ export * from './billing-account-addon.model';
21
22
  export * from './organization-service-quota.model';
22
23
  export * from './organization-project-quota.model';
23
24
  export * from './usage-record.model';
@@ -34,6 +34,7 @@ __exportStar(require("./organization-integration.model"), exports);
34
34
  __exportStar(require("./organization-member.model"), exports);
35
35
  __exportStar(require("./plan-template.model"), exports);
36
36
  __exportStar(require("./billing-account.model"), exports);
37
+ __exportStar(require("./billing-account-addon.model"), exports);
37
38
  __exportStar(require("./organization-service-quota.model"), exports);
38
39
  __exportStar(require("./organization-project-quota.model"), exports);
39
40
  __exportStar(require("./usage-record.model"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,qEAAmD;AACnD,sDAAoC;AACpC,4DAA0C;AAC1C,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,6DAA2C;AAG3C,oDAAkC;AAClC,+DAA6C;AAG7C,gDAA8B;AAG9B,iDAA+B;AAG/B,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C;AAG5C,wDAAsC;AACtC,0DAAwC;AACxC,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,8DAA4C;AAC5C,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,0EAAwD;AACxD,0DAAwC;AACxC,6EAA2D;AAG3D,2DAAyC;AAGzC,4DAA0C;AAG1C,wDAAsC;AAGtC,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAGhD,qDAAmC;AAGnC,qDAAmC;AAGnC,8DAA4C;AAG5C,8DAA4C;AAG5C,2DAAyC;AAGzC,0DAAwC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/interface/models/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,+CAA6B;AAC7B,kDAAgC;AAChC,yDAAuC;AACvC,qEAAmD;AACnD,sDAAoC;AACpC,4DAA0C;AAC1C,wDAAsC;AACtC,wDAAsC;AACtC,uDAAqC;AACrC,4DAA0C;AAC1C,6DAA2C;AAG3C,oDAAkC;AAClC,+DAA6C;AAG7C,gDAA8B;AAG9B,iDAA+B;AAG/B,uDAAqC;AACrC,mEAAiD;AACjD,8DAA4C;AAG5C,wDAAsC;AACtC,0DAAwC;AACxC,gEAA8C;AAC9C,qEAAmD;AACnD,qEAAmD;AACnD,uDAAqC;AACrC,kDAAgC;AAChC,6DAA2C;AAC3C,0DAAwC;AACxC,mEAAiD;AACjD,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,4DAA0C;AAC1C,2DAAyC;AACzC,8DAA4C;AAC5C,iEAA+C;AAC/C,wDAAsC;AACtC,uDAAqC;AACrC,8DAA4C;AAC5C,+CAA6B;AAC7B,sDAAoC;AACpC,8DAA4C;AAC5C,0EAAwD;AACxD,0DAAwC;AACxC,6EAA2D;AAG3D,2DAAyC;AAGzC,4DAA0C;AAG1C,wDAAsC;AAGtC,yDAAuC;AACvC,iEAA+C;AAC/C,oEAAkD;AAClD,yDAAuC;AACvC,6DAA2C;AAC3C,kEAAgD;AAGhD,qDAAmC;AAGnC,qDAAmC;AAGnC,8DAA4C;AAG5C,8DAA4C;AAG5C,2DAAyC;AAGzC,0DAAwC"}
@@ -0,0 +1,20 @@
1
+ import { ExternalIdentitySource, ExternalIdentityStatus, ExternalMessagingPlatform } from '../../enum';
2
+ import { IOrganization } from './organization.model';
3
+ import { IUser } from './user.model';
4
+ export interface IOrganizationExternalIdentity {
5
+ id?: string;
6
+ organizationId: string;
7
+ userId?: string | null;
8
+ platform: ExternalMessagingPlatform;
9
+ externalUserId: string;
10
+ externalWorkspaceId: string;
11
+ externalEnterpriseId?: string | null;
12
+ externalEmail?: string | null;
13
+ source: ExternalIdentitySource;
14
+ status: ExternalIdentityStatus;
15
+ lastVerifiedAt?: Date | null;
16
+ updatedAt?: Date;
17
+ createdAt?: Date;
18
+ organization?: IOrganization;
19
+ user?: IUser;
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=organization-external-identity.model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-external-identity.model.js","sourceRoot":"","sources":["../../../../src/types/interface/models/organization-external-identity.model.ts"],"names":[],"mappings":""}
@@ -8,6 +8,7 @@ export interface IOrganizationMember {
8
8
  organizationId: string;
9
9
  userId: string;
10
10
  permissions: OrganizationPermission[];
11
+ workEmail?: string | null;
11
12
  adultStatus?: boolean;
12
13
  updatedAt?: Date;
13
14
  createdAt?: Date;
@@ -9,6 +9,7 @@ export interface IServiceQuota {
9
9
  isOverridden: boolean;
10
10
  ceilingMode: QuotaCeilingMode;
11
11
  ceilingValue: number | null;
12
+ overageNanocentsPerUnit?: number | null;
12
13
  updatedAt?: Date;
13
14
  createdAt?: Date;
14
15
  billingAccount?: IBillingAccount;
@@ -1,4 +1,4 @@
1
- import { AbyssService, TokenType } from './enum';
1
+ import { AbyssService, ExternalMessagingPlatform, TokenType } from './enum';
2
2
  export type SessionToken = {
3
3
  emitter: AbyssService;
4
4
  expiration: string;
@@ -33,3 +33,10 @@ export type InvitationTokenPayload = {
33
33
  invitationId: string;
34
34
  email: string;
35
35
  };
36
+ export type ExternalIdentityBindingTokenPayload = {
37
+ tokenHistoryId: string;
38
+ type: TokenType.EXTERNAL_IDENTITY_BINDING;
39
+ userId: string;
40
+ organizationId: string;
41
+ platform: ExternalMessagingPlatform;
42
+ };
@@ -0,0 +1,15 @@
1
+ export declare enum BillingDeepLinkAction {
2
+ THRESHOLD = "threshold",
3
+ EXTENSION = "extension",
4
+ CEILING = "ceiling",
5
+ OVERAGE = "overage"
6
+ }
7
+ export interface BillingDeepLinkParams {
8
+ billingBaseUrl: string;
9
+ service: string;
10
+ metric: string;
11
+ action: BillingDeepLinkAction;
12
+ organizationId?: string;
13
+ returnUrl?: string;
14
+ }
15
+ export declare const buildBillingDeepLink: ({ billingBaseUrl, service, metric, action, organizationId, returnUrl, }: BillingDeepLinkParams) => string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildBillingDeepLink = exports.BillingDeepLinkAction = void 0;
4
+ var BillingDeepLinkAction;
5
+ (function (BillingDeepLinkAction) {
6
+ BillingDeepLinkAction["THRESHOLD"] = "threshold";
7
+ BillingDeepLinkAction["EXTENSION"] = "extension";
8
+ BillingDeepLinkAction["CEILING"] = "ceiling";
9
+ BillingDeepLinkAction["OVERAGE"] = "overage";
10
+ })(BillingDeepLinkAction || (exports.BillingDeepLinkAction = BillingDeepLinkAction = {}));
11
+ const buildBillingDeepLink = ({ billingBaseUrl, service, metric, action, organizationId, returnUrl, }) => {
12
+ const params = new URLSearchParams({ service, metric, action });
13
+ if (returnUrl) {
14
+ params.set('return', returnUrl);
15
+ }
16
+ const base = billingBaseUrl.replace(/\/+$/, '');
17
+ const chemin = organizationId
18
+ ? `/org/${encodeURIComponent(organizationId)}/billing/consumption`
19
+ : '/dashboard/account/billing/consumption';
20
+ return `${base}${chemin}?${params.toString()}`;
21
+ };
22
+ exports.buildBillingDeepLink = buildBillingDeepLink;
23
+ //# sourceMappingURL=billing-deep-link.utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"billing-deep-link.utils.js","sourceRoot":"","sources":["../../src/utils/billing-deep-link.utils.ts"],"names":[],"mappings":";;;AAuBA,IAAY,qBASX;AATD,WAAY,qBAAqB;IAE/B,gDAAuB,CAAA;IAEvB,gDAAuB,CAAA;IAEvB,4CAAmB,CAAA;IAEnB,4CAAmB,CAAA;AACrB,CAAC,EATW,qBAAqB,qCAArB,qBAAqB,QAShC;AAyDM,MAAM,oBAAoB,GAAG,CAAC,EACnC,cAAc,EACd,OAAO,EACP,MAAM,EACN,MAAM,EACN,cAAc,EACd,SAAS,GACa,EAAU,EAAE;IAClC,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IAChE,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAID,MAAM,IAAI,GAAG,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAGhD,MAAM,MAAM,GAAG,cAAc;QAC3B,CAAC,CAAC,QAAQ,kBAAkB,CAAC,cAAc,CAAC,sBAAsB;QAClE,CAAC,CAAC,wCAAwC,CAAC;IAC7C,OAAO,GAAG,IAAI,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;AACjD,CAAC,CAAC;AAtBW,QAAA,oBAAoB,wBAsB/B"}
@@ -1,5 +1,3 @@
1
- import { BillingAccountStatus } from '../types/enum';
2
- export declare const isSubscriptionExpired: (status: BillingAccountStatus) => boolean;
3
1
  export interface ParsedQuotaUnit {
4
2
  multiplier: number;
5
3
  baseUnit: string;
@@ -1,11 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveQuotaAmount = exports.parseQuotaUnit = exports.isSubscriptionExpired = void 0;
4
- const enum_1 = require("../types/enum");
5
- const isSubscriptionExpired = (status) => {
6
- return status === enum_1.BillingAccountStatus.CANCELLED;
7
- };
8
- exports.isSubscriptionExpired = isSubscriptionExpired;
3
+ exports.resolveQuotaAmount = exports.parseQuotaUnit = void 0;
9
4
  const parseQuotaUnit = (unit) => {
10
5
  const raw = (unit ?? '').trim();
11
6
  if (!raw) {
@@ -1 +1 @@
1
- {"version":3,"file":"billing.utils.js","sourceRoot":"","sources":["../../src/utils/billing.utils.ts"],"names":[],"mappings":";;;AAAA,wCAAqD;AAK9C,MAAM,qBAAqB,GAAG,CAAC,MAA4B,EAAW,EAAE;IAC7E,OAAO,MAAM,KAAK,2BAAoB,CAAC,SAAS,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AA8BK,MAAM,cAAc,GAAG,CAAC,IAA+B,EAAmB,EAAE;IACjF,MAAM,GAAG,GAAG,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAChC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACzC,CAAC;IAGD,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAChD,IAAI,MAAM,EAAE,CAAC;QACX,OAAO;YACL,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK;YAC3C,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;SAC3B,CAAC;IACJ,CAAC;IAGD,MAAM,YAAY,GAAG,GAAG,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACjE,IAAI,YAAY,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;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CAChC,KAAa,EACb,IAA+B,EACV,EAAE;IACvB,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC;IACtD,IAAI,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC;QACjB,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACnD,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,KAAK,GAAG,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;AACpE,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
@@ -23,3 +23,4 @@ export * from './invitation.utils';
23
23
  export * from './invoice-amounts.utils';
24
24
  export * from './resolve-user.utils';
25
25
  export * from './pricing.utils';
26
+ export * from './billing-deep-link.utils';
@@ -39,4 +39,5 @@ __exportStar(require("./invitation.utils"), exports);
39
39
  __exportStar(require("./invoice-amounts.utils"), exports);
40
40
  __exportStar(require("./resolve-user.utils"), exports);
41
41
  __exportStar(require("./pricing.utils"), exports);
42
+ __exportStar(require("./billing-deep-link.utils"), exports);
42
43
  //# sourceMappingURL=index.js.map
@@ -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,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,uDAAqC;AAIrC,kDAAgC"}
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,6DAA2C;AAC3C,8DAA4C;AAC5C,qDAAmC;AACnC,0DAAwC;AACxC,uDAAqC;AAIrC,kDAAgC;AAChC,4DAA0C"}
@@ -1,9 +1,20 @@
1
+ import { BillingModuleId } from '../constants/module-catalog.constants';
1
2
  import { PriceTranche } from '../constants/metric-price-scale.constants';
2
3
  import { BillingMetric } from '../types/enum/organization-billing.enum';
3
4
  export declare const priceForQuantity: (scale: PriceTranche[], quantity: number) => number;
4
5
  export declare const quantityForBudget: (scale: PriceTranche[], budgetCents: number) => number;
5
6
  export declare const overageNanocentsPerUnit: (scale: PriceTranche[]) => number;
6
- export declare const resolveOverageNanocentsPerUnit: (metric: BillingMetric) => number | null;
7
+ export declare enum OverageRateSource {
8
+ NEGOTIATED = "NEGOTIATED",
9
+ MODULE_SCALE = "MODULE_SCALE",
10
+ CATALOG_FLAT = "CATALOG_FLAT",
11
+ NONE = "NONE"
12
+ }
13
+ export declare const resolveOverageRate: (metric: BillingMetric, accountNanocentsPerUnit?: number | null) => {
14
+ nanocentsPerUnit: number | null;
15
+ source: OverageRateSource;
16
+ };
17
+ export declare const resolveOverageNanocentsPerUnit: (metric: BillingMetric, accountNanocentsPerUnit?: number | null) => number | null;
7
18
  export declare const overageAmountCents: (nanocentsPerUnit: number, overageQuantity: number) => number;
8
19
  export declare const overagePriceCents: (metric: BillingMetric, includedQuantity: number, overageQuantity: number) => number;
9
20
  export interface PlanCapacityItem {
@@ -19,3 +30,12 @@ export interface OverageRateQuote {
19
30
  eur: number;
20
31
  }
21
32
  export declare const quoteOverageRate: (nanocentsPerUnit: number) => OverageRateQuote;
33
+ export interface StripePriceTier {
34
+ upTo: number | 'inf';
35
+ unitAmountDecimal: string;
36
+ }
37
+ export declare const shiftedTiersForModule: (scale: PriceTranche[], includedQuantity: number) => StripePriceTier[];
38
+ export declare const modulePriceCentsFor: (scale: PriceTranche[], includedQuantity: number, quantity: number) => number;
39
+ export declare const moduleMonthlyPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number) => number;
40
+ export declare const remainingPeriodShare: (now: Date, periodStart: Date, periodEnd: Date) => number;
41
+ export declare const moduleProratedPriceCents: (moduleId: BillingModuleId, includedQuantity: number, quantity: number, now: Date, periodStart: Date, periodEnd: Date) => number;
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.quoteOverageRate = exports.OVERAGE_QUOTE_QUANTITIES = exports.formatNanoCentsAsEur = exports.planCapacityShare = exports.planCapacityValueCents = exports.overagePriceCents = exports.overageAmountCents = exports.resolveOverageNanocentsPerUnit = exports.overageNanocentsPerUnit = exports.quantityForBudget = exports.priceForQuantity = void 0;
3
+ exports.moduleProratedPriceCents = exports.remainingPeriodShare = exports.moduleMonthlyPriceCents = exports.modulePriceCentsFor = exports.shiftedTiersForModule = exports.quoteOverageRate = exports.OVERAGE_QUOTE_QUANTITIES = exports.formatNanoCentsAsEur = exports.planCapacityShare = exports.planCapacityValueCents = exports.overagePriceCents = exports.overageAmountCents = exports.resolveOverageNanocentsPerUnit = exports.resolveOverageRate = exports.OverageRateSource = exports.overageNanocentsPerUnit = exports.quantityForBudget = exports.priceForQuantity = void 0;
4
4
  const overage_base_rates_constants_1 = require("../constants/overage-base-rates.constants");
5
+ const module_catalog_constants_1 = require("../constants/module-catalog.constants");
5
6
  const metric_price_scale_constants_1 = require("../constants/metric-price-scale.constants");
6
7
  const priceForQuantity = (scale, quantity) => {
7
8
  if (!Number.isFinite(quantity) || quantity <= 0) {
@@ -49,14 +50,40 @@ const quantityForBudget = (scale, budgetCents) => {
49
50
  exports.quantityForBudget = quantityForBudget;
50
51
  const overageNanocentsPerUnit = (scale) => scale[0].nanocentsPerUnit * metric_price_scale_constants_1.OVERAGE_MULTIPLIER;
51
52
  exports.overageNanocentsPerUnit = overageNanocentsPerUnit;
52
- const resolveOverageNanocentsPerUnit = (metric) => {
53
+ var OverageRateSource;
54
+ (function (OverageRateSource) {
55
+ OverageRateSource["NEGOTIATED"] = "NEGOTIATED";
56
+ OverageRateSource["MODULE_SCALE"] = "MODULE_SCALE";
57
+ OverageRateSource["CATALOG_FLAT"] = "CATALOG_FLAT";
58
+ OverageRateSource["NONE"] = "NONE";
59
+ })(OverageRateSource || (exports.OverageRateSource = OverageRateSource = {}));
60
+ const resolveOverageRate = (metric, accountNanocentsPerUnit) => {
61
+ if (accountNanocentsPerUnit !== undefined &&
62
+ accountNanocentsPerUnit !== null &&
63
+ Number.isFinite(accountNanocentsPerUnit)) {
64
+ return {
65
+ nanocentsPerUnit: accountNanocentsPerUnit,
66
+ source: OverageRateSource.NEGOTIATED,
67
+ };
68
+ }
53
69
  const scale = metric_price_scale_constants_1.METRIC_PRICE_SCALE[metric];
54
70
  if (scale) {
55
- return (0, exports.overageNanocentsPerUnit)(scale);
71
+ return {
72
+ nanocentsPerUnit: (0, exports.overageNanocentsPerUnit)(scale),
73
+ source: OverageRateSource.MODULE_SCALE,
74
+ };
56
75
  }
57
76
  const flat = overage_base_rates_constants_1.DEFAULT_OVERAGE_BASE_RATES[metric];
58
- return flat ? flat.rate * metric_price_scale_constants_1.NANOCENTS_PER_CENT : null;
77
+ if (flat) {
78
+ return {
79
+ nanocentsPerUnit: flat.rate * metric_price_scale_constants_1.NANOCENTS_PER_CENT,
80
+ source: OverageRateSource.CATALOG_FLAT,
81
+ };
82
+ }
83
+ return { nanocentsPerUnit: null, source: OverageRateSource.NONE };
59
84
  };
85
+ exports.resolveOverageRate = resolveOverageRate;
86
+ const resolveOverageNanocentsPerUnit = (metric, accountNanocentsPerUnit) => (0, exports.resolveOverageRate)(metric, accountNanocentsPerUnit).nanocentsPerUnit;
60
87
  exports.resolveOverageNanocentsPerUnit = resolveOverageNanocentsPerUnit;
61
88
  const overageAmountCents = (nanocentsPerUnit, overageQuantity) => {
62
89
  if (!Number.isFinite(nanocentsPerUnit) ||
@@ -115,4 +142,84 @@ const quoteOverageRate = (nanocentsPerUnit) => {
115
142
  };
116
143
  };
117
144
  exports.quoteOverageRate = quoteOverageRate;
145
+ const shiftedTiersForModule = (scale, includedQuantity) => {
146
+ const inclus = Number.isFinite(includedQuantity) ? Math.max(0, includedQuantity) : 0;
147
+ const tiers = [];
148
+ for (const tranche of scale) {
149
+ const taux = (tranche.nanocentsPerUnit / metric_price_scale_constants_1.NANOCENTS_PER_CENT).toString();
150
+ if (tranche.upToQuantity === null) {
151
+ tiers.push({ upTo: 'inf', unitAmountDecimal: taux });
152
+ break;
153
+ }
154
+ if (tranche.upToQuantity <= inclus) {
155
+ continue;
156
+ }
157
+ tiers.push({ upTo: tranche.upToQuantity - inclus, unitAmountDecimal: taux });
158
+ }
159
+ if (tiers.length === 0 && scale.length > 0) {
160
+ const dernier = scale[scale.length - 1];
161
+ tiers.push({
162
+ upTo: 'inf',
163
+ unitAmountDecimal: (dernier.nanocentsPerUnit / metric_price_scale_constants_1.NANOCENTS_PER_CENT).toString(),
164
+ });
165
+ }
166
+ return tiers;
167
+ };
168
+ exports.shiftedTiersForModule = shiftedTiersForModule;
169
+ const modulePriceCentsFor = (scale, includedQuantity, quantity) => {
170
+ if (!Number.isFinite(quantity) || quantity <= 0) {
171
+ return 0;
172
+ }
173
+ const tiers = (0, exports.shiftedTiersForModule)(scale, includedQuantity);
174
+ let restant = quantity;
175
+ let bornePrecedente = 0;
176
+ let centimes = 0;
177
+ for (const tier of tiers) {
178
+ const borne = tier.upTo === 'inf' ? Number.POSITIVE_INFINITY : tier.upTo;
179
+ const tranche = Math.min(restant, borne - bornePrecedente);
180
+ if (tranche > 0) {
181
+ centimes += tranche * Number(tier.unitAmountDecimal);
182
+ restant -= tranche;
183
+ }
184
+ bornePrecedente = borne;
185
+ if (restant <= 0) {
186
+ break;
187
+ }
188
+ }
189
+ return Math.round(centimes);
190
+ };
191
+ exports.modulePriceCentsFor = modulePriceCentsFor;
192
+ const moduleMonthlyPriceCents = (moduleId, includedQuantity, quantity) => {
193
+ const module = (0, module_catalog_constants_1.moduleById)(moduleId);
194
+ if (!module || !Number.isFinite(quantity) || quantity <= 0) {
195
+ return 0;
196
+ }
197
+ if (module.kind === module_catalog_constants_1.BillingModuleKind.UNLOCK) {
198
+ return module.flatPriceCents;
199
+ }
200
+ const scale = metric_price_scale_constants_1.METRIC_PRICE_SCALE[module.scaleKey];
201
+ if (!scale) {
202
+ return 0;
203
+ }
204
+ return (0, exports.modulePriceCentsFor)(scale, includedQuantity, quantity);
205
+ };
206
+ exports.moduleMonthlyPriceCents = moduleMonthlyPriceCents;
207
+ const remainingPeriodShare = (now, periodStart, periodEnd) => {
208
+ const debut = periodStart.getTime();
209
+ const fin = periodEnd.getTime();
210
+ const instant = now.getTime();
211
+ const duree = fin - debut;
212
+ if (!Number.isFinite(duree) || duree <= 0) {
213
+ return 0;
214
+ }
215
+ const restant = fin - instant;
216
+ if (restant <= 0) {
217
+ return 0;
218
+ }
219
+ return Math.min(1, restant / duree);
220
+ };
221
+ exports.remainingPeriodShare = remainingPeriodShare;
222
+ const moduleProratedPriceCents = (moduleId, includedQuantity, quantity, now, periodStart, periodEnd) => Math.floor((0, exports.moduleMonthlyPriceCents)(moduleId, includedQuantity, quantity) *
223
+ (0, exports.remainingPeriodShare)(now, periodStart, periodEnd));
224
+ exports.moduleProratedPriceCents = moduleProratedPriceCents;
118
225
  //# sourceMappingURL=pricing.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pricing.utils.js","sourceRoot":"","sources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AC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,CAAC;QAC1C,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,OAAO,GAAG,GAAG,GAAG,OAAO,CAAC;IAC9B,IAAI,OAAO,IAAI,CAAC,EAAE,CAAC;QACjB,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,CAAC;AACtC,CAAC,CAAC;AAbW,QAAA,oBAAoB,wBAa/B;AASK,MAAM,wBAAwB,GAAG,CACtC,QAAyB,EACzB,gBAAwB,EACxB,QAAgB,EAChB,GAAS,EACT,WAAiB,EACjB,SAAe,EACP,EAAE,CACV,IAAI,CAAC,KAAK,CACR,IAAA,+BAAuB,EAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,CAAC;IAC3D,IAAA,4BAAoB,EAAC,GAAG,EAAE,WAAW,EAAE,SAAS,CAAC,CACpD,CAAC;AAXS,QAAA,wBAAwB,4BAWjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@abyss-project/main",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Core package to interact with Abyss-Project",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,6 +21,19 @@
21
21
  ]
22
22
  }
23
23
  },
24
+ "publishConfig": {
25
+ "main": "dist/index.js",
26
+ "types": "dist/index.d.ts"
27
+ },
28
+ "scripts": {
29
+ "lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
30
+ "lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
31
+ "tsc": "tsc",
32
+ "build": "tsc -p tsconfig.build.json",
33
+ "dev": "tsc --watch",
34
+ "test": "jest",
35
+ "prepublish": "tsc"
36
+ },
24
37
  "repository": {
25
38
  "type": "git",
26
39
  "url": "https://gitlab.com/abyss-group"
@@ -69,14 +82,5 @@
69
82
  "sequelize-cli": "^6.2.0",
70
83
  "ts-jest": "^29.1.1",
71
84
  "typescript": "5.4.2"
72
- },
73
- "scripts": {
74
- "lint": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --fix",
75
- "lint:check": "eslint \"{src,apps,libs,test,core}/**/*.ts\" --max-warnings 0",
76
- "tsc": "tsc",
77
- "build": "tsc",
78
- "dev": "tsc --watch",
79
- "test": "jest",
80
- "prepublish": "tsc"
81
85
  }
82
- }
86
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "exclude": ["./dist/**/*", "./src/**/*.spec.ts"]
4
+ }
package/tsconfig.json CHANGED
@@ -1,36 +1,35 @@
1
- {
2
- "compilerOptions": {
3
- "incremental": false,
4
- "target": "es2021",
5
- "lib": [
6
- "dom",
7
- "es2021"
8
- ],
9
- "experimentalDecorators": true,
10
- "emitDecoratorMetadata": true,
11
- "module": "commonjs",
12
- "rootDir": "src",
13
- "moduleResolution": "node",
14
- "resolveJsonModule": true,
15
- "allowJs": true,
16
- "declaration": true,
17
- "sourceMap": true,
18
- "outDir": "./dist",
19
- "removeComments": true,
20
- "allowSyntheticDefaultImports": true,
21
- "esModuleInterop": true,
22
- "forceConsistentCasingInFileNames": true,
23
- "strict": true,
24
- "strictNullChecks": true,
25
- "strictFunctionTypes": true,
26
- "strictPropertyInitialization": false,
27
- "skipLibCheck": true
28
- },
29
- "include": [
30
- "./src"
31
- ],
32
- "exclude": [
33
- "./dist/**/*",
34
- "./src/**/*.spec.ts"
35
- ]
36
- }
1
+ {
2
+ "compilerOptions": {
3
+ "incremental": false,
4
+ "target": "es2021",
5
+ "lib": [
6
+ "dom",
7
+ "es2021"
8
+ ],
9
+ "experimentalDecorators": true,
10
+ "emitDecoratorMetadata": true,
11
+ "module": "commonjs",
12
+ "rootDir": "src",
13
+ "moduleResolution": "node",
14
+ "resolveJsonModule": true,
15
+ "allowJs": true,
16
+ "declaration": true,
17
+ "sourceMap": true,
18
+ "outDir": "./dist",
19
+ "removeComments": true,
20
+ "allowSyntheticDefaultImports": true,
21
+ "esModuleInterop": true,
22
+ "forceConsistentCasingInFileNames": true,
23
+ "strict": true,
24
+ "strictNullChecks": true,
25
+ "strictFunctionTypes": true,
26
+ "strictPropertyInitialization": false,
27
+ "skipLibCheck": true
28
+ },
29
+ "include": [
30
+ "./src"
31
+ ],
32
+ "exclude": [
33
+ "./dist/**/*"
34
+ ]
35
+ }