@wipperoz/wipperoz-core 1.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.
- package/README.md +35 -0
- package/bin/run-clean.js +53 -0
- package/dist/account/index.d.ts +2 -0
- package/dist/account/index.d.ts.map +1 -0
- package/dist/account/index.js +5 -0
- package/dist/account/index.js.map +1 -0
- package/dist/account/interfaces/accountRecord.interface.d.ts +9 -0
- package/dist/account/interfaces/accountRecord.interface.d.ts.map +1 -0
- package/dist/account/interfaces/accountRecord.interface.js +3 -0
- package/dist/account/interfaces/accountRecord.interface.js.map +1 -0
- package/dist/account/services/account.service.d.ts +9 -0
- package/dist/account/services/account.service.d.ts.map +1 -0
- package/dist/account/services/account.service.js +30 -0
- package/dist/account/services/account.service.js.map +1 -0
- package/dist/billing/constants.d.ts +39 -0
- package/dist/billing/constants.d.ts.map +1 -0
- package/dist/billing/constants.js +57 -0
- package/dist/billing/constants.js.map +1 -0
- package/dist/billing/enums/accountType.enum.d.ts +2 -0
- package/dist/billing/enums/accountType.enum.d.ts.map +1 -0
- package/dist/billing/enums/accountType.enum.js +6 -0
- package/dist/billing/enums/accountType.enum.js.map +1 -0
- package/dist/billing/enums/creditReason.enum.d.ts +7 -0
- package/dist/billing/enums/creditReason.enum.d.ts.map +1 -0
- package/dist/billing/enums/creditReason.enum.js +11 -0
- package/dist/billing/enums/creditReason.enum.js.map +1 -0
- package/dist/billing/enums/displayCurrency.enum.d.ts +2 -0
- package/dist/billing/enums/displayCurrency.enum.d.ts.map +1 -0
- package/dist/billing/enums/displayCurrency.enum.js +6 -0
- package/dist/billing/enums/displayCurrency.enum.js.map +1 -0
- package/dist/billing/enums/index.d.ts +8 -0
- package/dist/billing/enums/index.d.ts.map +1 -0
- package/dist/billing/enums/index.js +11 -0
- package/dist/billing/enums/index.js.map +1 -0
- package/dist/billing/enums/reasoningEffort.enum.d.ts +8 -0
- package/dist/billing/enums/reasoningEffort.enum.d.ts.map +1 -0
- package/dist/billing/enums/reasoningEffort.enum.js +12 -0
- package/dist/billing/enums/reasoningEffort.enum.js.map +1 -0
- package/dist/billing/enums/stripePaymentStatus.enum.d.ts +7 -0
- package/dist/billing/enums/stripePaymentStatus.enum.d.ts.map +1 -0
- package/dist/billing/enums/stripePaymentStatus.enum.js +11 -0
- package/dist/billing/enums/stripePaymentStatus.enum.js.map +1 -0
- package/dist/billing/enums/stripeRegion.enum.d.ts +2 -0
- package/dist/billing/enums/stripeRegion.enum.d.ts.map +1 -0
- package/dist/billing/enums/stripeRegion.enum.js +6 -0
- package/dist/billing/enums/stripeRegion.enum.js.map +1 -0
- package/dist/billing/enums/transactionType.enum.d.ts +8 -0
- package/dist/billing/enums/transactionType.enum.d.ts.map +1 -0
- package/dist/billing/enums/transactionType.enum.js +12 -0
- package/dist/billing/enums/transactionType.enum.js.map +1 -0
- package/dist/billing/index.d.ts +3 -0
- package/dist/billing/index.d.ts.map +1 -0
- package/dist/billing/index.js +6 -0
- package/dist/billing/index.js.map +1 -0
- package/dist/billing/interfaces/addCreditsResult.interface.d.ts +7 -0
- package/dist/billing/interfaces/addCreditsResult.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/addCreditsResult.interface.js +3 -0
- package/dist/billing/interfaces/addCreditsResult.interface.js.map +1 -0
- package/dist/billing/interfaces/aiRequestBillingResponse.interface.d.ts +30 -0
- package/dist/billing/interfaces/aiRequestBillingResponse.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/aiRequestBillingResponse.interface.js +3 -0
- package/dist/billing/interfaces/aiRequestBillingResponse.interface.js.map +1 -0
- package/dist/billing/interfaces/autoTopUpCheckResult.interface.d.ts +6 -0
- package/dist/billing/interfaces/autoTopUpCheckResult.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/autoTopUpCheckResult.interface.js +3 -0
- package/dist/billing/interfaces/autoTopUpCheckResult.interface.js.map +1 -0
- package/dist/billing/interfaces/autoTopUpMessage.interface.d.ts +15 -0
- package/dist/billing/interfaces/autoTopUpMessage.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/autoTopUpMessage.interface.js +3 -0
- package/dist/billing/interfaces/autoTopUpMessage.interface.js.map +1 -0
- package/dist/billing/interfaces/balanceResponse.interface.d.ts +9 -0
- package/dist/billing/interfaces/balanceResponse.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/balanceResponse.interface.js +3 -0
- package/dist/billing/interfaces/balanceResponse.interface.js.map +1 -0
- package/dist/billing/interfaces/billing.interface.d.ts +2 -0
- package/dist/billing/interfaces/billing.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/billing.interface.js +3 -0
- package/dist/billing/interfaces/billing.interface.js.map +1 -0
- package/dist/billing/interfaces/canAffordResult.interface.d.ts +6 -0
- package/dist/billing/interfaces/canAffordResult.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/canAffordResult.interface.js +3 -0
- package/dist/billing/interfaces/canAffordResult.interface.js.map +1 -0
- package/dist/billing/interfaces/chargeResult.interface.d.ts +7 -0
- package/dist/billing/interfaces/chargeResult.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/chargeResult.interface.js +3 -0
- package/dist/billing/interfaces/chargeResult.interface.js.map +1 -0
- package/dist/billing/interfaces/costBreakdown.interface.d.ts +9 -0
- package/dist/billing/interfaces/costBreakdown.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/costBreakdown.interface.js +3 -0
- package/dist/billing/interfaces/costBreakdown.interface.js.map +1 -0
- package/dist/billing/interfaces/creditTransaction.interface.d.ts +28 -0
- package/dist/billing/interfaces/creditTransaction.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/creditTransaction.interface.js +3 -0
- package/dist/billing/interfaces/creditTransaction.interface.js.map +1 -0
- package/dist/billing/interfaces/depositMetadata.interface.d.ts +10 -0
- package/dist/billing/interfaces/depositMetadata.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/depositMetadata.interface.js +3 -0
- package/dist/billing/interfaces/depositMetadata.interface.js.map +1 -0
- package/dist/billing/interfaces/iAccountCreditManager.interface.d.ts +43 -0
- package/dist/billing/interfaces/iAccountCreditManager.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/iAccountCreditManager.interface.js +3 -0
- package/dist/billing/interfaces/iAccountCreditManager.interface.js.map +1 -0
- package/dist/billing/interfaces/iCostCalculator.interface.d.ts +7 -0
- package/dist/billing/interfaces/iCostCalculator.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/iCostCalculator.interface.js +3 -0
- package/dist/billing/interfaces/iCostCalculator.interface.js.map +1 -0
- package/dist/billing/interfaces/index.d.ts +16 -0
- package/dist/billing/interfaces/index.d.ts.map +1 -0
- package/dist/billing/interfaces/index.js +19 -0
- package/dist/billing/interfaces/index.js.map +1 -0
- package/dist/billing/interfaces/initialCreditResult.interface.d.ts +7 -0
- package/dist/billing/interfaces/initialCreditResult.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/initialCreditResult.interface.js +3 -0
- package/dist/billing/interfaces/initialCreditResult.interface.js.map +1 -0
- package/dist/billing/interfaces/requestCostParams.interface.d.ts +7 -0
- package/dist/billing/interfaces/requestCostParams.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/requestCostParams.interface.js +3 -0
- package/dist/billing/interfaces/requestCostParams.interface.js.map +1 -0
- package/dist/billing/interfaces/stripePayment.interface.d.ts +29 -0
- package/dist/billing/interfaces/stripePayment.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/stripePayment.interface.js +3 -0
- package/dist/billing/interfaces/stripePayment.interface.js.map +1 -0
- package/dist/billing/interfaces/transactionHistory.interface.d.ts +16 -0
- package/dist/billing/interfaces/transactionHistory.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/transactionHistory.interface.js +3 -0
- package/dist/billing/interfaces/transactionHistory.interface.js.map +1 -0
- package/dist/billing/interfaces/triggeredBy.interface.d.ts +1 -0
- package/dist/billing/interfaces/triggeredBy.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/triggeredBy.interface.js +2 -0
- package/dist/billing/interfaces/triggeredBy.interface.js.map +1 -0
- package/dist/billing/interfaces/usageMetadata.interface.d.ts +12 -0
- package/dist/billing/interfaces/usageMetadata.interface.d.ts.map +1 -0
- package/dist/billing/interfaces/usageMetadata.interface.js +3 -0
- package/dist/billing/interfaces/usageMetadata.interface.js.map +1 -0
- package/dist/billing/services/accountCreditManager.service.d.ts +81 -0
- package/dist/billing/services/accountCreditManager.service.d.ts.map +1 -0
- package/dist/billing/services/accountCreditManager.service.js +658 -0
- package/dist/billing/services/accountCreditManager.service.js.map +1 -0
- package/dist/billing/services/costCalculator.service.d.ts +36 -0
- package/dist/billing/services/costCalculator.service.d.ts.map +1 -0
- package/dist/billing/services/costCalculator.service.js +100 -0
- package/dist/billing/services/costCalculator.service.js.map +1 -0
- package/dist/billing/services/tokenFormatter.d.ts +10 -0
- package/dist/billing/services/tokenFormatter.d.ts.map +1 -0
- package/dist/billing/services/tokenFormatter.js +27 -0
- package/dist/billing/services/tokenFormatter.js.map +1 -0
- package/dist/billing/utils.d.ts +8 -0
- package/dist/billing/utils.d.ts.map +1 -0
- package/dist/billing/utils.js +33 -0
- package/dist/billing/utils.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +196 -0
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
### What is this repository for?
|
|
2
|
+
|
|
3
|
+
Wipperoz core utilities to use with Node.js Lambdas.
|
|
4
|
+
|
|
5
|
+
This package contains shared domain logic for Wipperoz services, including:
|
|
6
|
+
|
|
7
|
+
- Billing and credit management helpers (e.g. `AccountCreditManager`, `CostCalculator`, `TokenFormatter`)
|
|
8
|
+
- Shared enums, interfaces and utility functions used across Lambda projects
|
|
9
|
+
|
|
10
|
+
### How do I get set up?
|
|
11
|
+
|
|
12
|
+
- `yarn add @wipperoz/wipperoz-core`
|
|
13
|
+
|
|
14
|
+
### Billing utilities
|
|
15
|
+
|
|
16
|
+
The billing module provides helpers to manage account credits and pricing:
|
|
17
|
+
|
|
18
|
+
- `AccountCreditManager` – high-level API for reading balances, charging usage, adding credits and managing auto top-up settings
|
|
19
|
+
- `CostCalculator` – encapsulates token-based pricing rules and returns detailed cost breakdowns
|
|
20
|
+
- `TokenFormatter` – formats token amounts with signs and currencies and converts between tokens and currency cents
|
|
21
|
+
|
|
22
|
+
These classes are designed to be used from Lambda handlers; see the TypeScript types in `src/billing` for details.
|
|
23
|
+
|
|
24
|
+
### Running tests
|
|
25
|
+
|
|
26
|
+
This project uses Jest with `ts-jest`:
|
|
27
|
+
|
|
28
|
+
- `yarn test` – run the full Jest suite once
|
|
29
|
+
- `yarn test --watch` – run tests in watch mode during development
|
|
30
|
+
|
|
31
|
+
Coverage reports are written to the `coverage/` directory.
|
|
32
|
+
|
|
33
|
+
## Change log
|
|
34
|
+
|
|
35
|
+
See [CHANGELOG](./CHANGELOG.md) for all notable changes to this project, covering all packages.
|
package/bin/run-clean.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Copyright IBM Corp. 2017,2020. All Rights Reserved.
|
|
3
|
+
// Node module: @loopback/build
|
|
4
|
+
// This file is licensed under the MIT License.
|
|
5
|
+
// License text available at https://opensource.org/licenses/MIT
|
|
6
|
+
|
|
7
|
+
/*
|
|
8
|
+
========
|
|
9
|
+
|
|
10
|
+
Usage:
|
|
11
|
+
node ./bin/run-clean file1 file2 ...
|
|
12
|
+
|
|
13
|
+
The script will `rm -rf` all files/folders.
|
|
14
|
+
|
|
15
|
+
Then the provided command is executed with the modified arguments.
|
|
16
|
+
|
|
17
|
+
Example usage:
|
|
18
|
+
|
|
19
|
+
node ./bin/run-clean dist dist6
|
|
20
|
+
|
|
21
|
+
========
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
'use strict';
|
|
25
|
+
|
|
26
|
+
function run(argv, options) {
|
|
27
|
+
const rimraf = require('rimraf');
|
|
28
|
+
const path = require('path');
|
|
29
|
+
const globPatterns = argv.slice(2);
|
|
30
|
+
const removed = [];
|
|
31
|
+
if (!globPatterns.length) {
|
|
32
|
+
console.error('Please specify file patterns to remove.');
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
// Keep it backward compatible as dryRun
|
|
36
|
+
if (typeof options === 'boolean') options = {dryRun: options};
|
|
37
|
+
options = options || {};
|
|
38
|
+
globPatterns.forEach(pattern => {
|
|
39
|
+
const relativePath = path.relative(process.cwd(), pattern);
|
|
40
|
+
if (relativePath.indexOf('..') !== -1) {
|
|
41
|
+
if (!options.dryRun) {
|
|
42
|
+
console.error('Skipping ' + pattern + ' as it is not inside the project root directory.');
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
if (!options.dryRun) rimraf.sync(pattern);
|
|
46
|
+
removed.push(pattern);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return 'rm -rf ' + removed.join(' ');
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = run;
|
|
53
|
+
if (require.main === module) run(process.argv);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/account/index.ts"],"names":[],"mappings":";;;AAAA,qEAA2C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountRecord.interface.d.ts","sourceRoot":"","sources":["../../../src/account/interfaces/accountRecord.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,4CAA4C,CAAC;AAE3E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE;QAAC,eAAe,EAAE,eAAe,CAAA;KAAC,CAAC;CAC7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountRecord.interface.js","sourceRoot":"","sources":["../../../src/account/interfaces/accountRecord.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DatabaseService } from '@wipperoz/common-utils';
|
|
2
|
+
import { AccountRecord } from '../interfaces/accountRecord.interface';
|
|
3
|
+
export declare class AccountService {
|
|
4
|
+
private db;
|
|
5
|
+
private tableName;
|
|
6
|
+
constructor(db: DatabaseService, tableName: string);
|
|
7
|
+
getAccountById(accountId: string): Promise<AccountRecord | null>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=account.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.service.d.ts","sourceRoot":"","sources":["../../../src/account/services/account.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,wBAAwB,CAAC;AAEvD,OAAO,EAAC,aAAa,EAAC,MAAM,uCAAuC,CAAC;AAEpE,qBAAa,cAAc;IACzB,OAAO,CAAC,EAAE,CAAkB;IAC5B,OAAO,CAAC,SAAS,CAAS;gBAEd,EAAE,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM;IAK5C,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;CAkBvE"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountService = void 0;
|
|
4
|
+
const constants_1 = require("../../billing/constants");
|
|
5
|
+
class AccountService {
|
|
6
|
+
db;
|
|
7
|
+
tableName;
|
|
8
|
+
constructor(db, tableName) {
|
|
9
|
+
this.db = db;
|
|
10
|
+
this.tableName = tableName;
|
|
11
|
+
}
|
|
12
|
+
async getAccountById(accountId) {
|
|
13
|
+
const result = await this.db.query({
|
|
14
|
+
TableName: this.tableName,
|
|
15
|
+
KeyConditionExpression: 'Pkey = :pk AND begins_with(Skey, :sk)',
|
|
16
|
+
ExpressionAttributeValues: {
|
|
17
|
+
':pk': constants_1.BillingKeys.accountPkey(accountId),
|
|
18
|
+
':sk': 'account-type:',
|
|
19
|
+
},
|
|
20
|
+
Limit: 1,
|
|
21
|
+
});
|
|
22
|
+
if (!result || !result.Items || result.Items.length === 0) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
const item = result.Items[0];
|
|
26
|
+
return item;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.AccountService = AccountService;
|
|
30
|
+
//# sourceMappingURL=account.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.service.js","sourceRoot":"","sources":["../../../src/account/services/account.service.ts"],"names":[],"mappings":";;;AACA,uDAAoD;AAGpD,MAAa,cAAc;IACjB,EAAE,CAAkB;IACpB,SAAS,CAAS;IAE1B,YAAY,EAAmB,EAAE,SAAiB;QAChD,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,SAAiB;QACpC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC;YACjC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,sBAAsB,EAAE,uCAAuC;YAC/D,yBAAyB,EAAE;gBACzB,KAAK,EAAE,uBAAW,CAAC,WAAW,CAAC,SAAS,CAAC;gBACzC,KAAK,EAAE,eAAe;aACvB;YACD,KAAK,EAAE,CAAC;SACT,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1D,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAkB,CAAC;QAC9C,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AA3BD,wCA2BC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { AccountTypeEnum } from './enums';
|
|
2
|
+
export declare const COST_CONFIG: {
|
|
3
|
+
readonly gpt51: {
|
|
4
|
+
readonly inputPerMillion: 1.25;
|
|
5
|
+
readonly outputPerMillion: 10;
|
|
6
|
+
readonly cachedInputPerMillion: 0.125;
|
|
7
|
+
};
|
|
8
|
+
readonly infrastructure: {
|
|
9
|
+
readonly lambda: 4e-7;
|
|
10
|
+
readonly dynamodb: 0.0000025;
|
|
11
|
+
readonly apiGateway: 0.0000035;
|
|
12
|
+
readonly cloudwatch: 0.0000025;
|
|
13
|
+
readonly sqs: 4e-7;
|
|
14
|
+
readonly total: number;
|
|
15
|
+
};
|
|
16
|
+
readonly operations: {
|
|
17
|
+
readonly monthlyTotal: 11876;
|
|
18
|
+
readonly estimatedMonthlyRequests: 50000;
|
|
19
|
+
readonly perRequest: number;
|
|
20
|
+
};
|
|
21
|
+
readonly payment: {
|
|
22
|
+
readonly stripePercentage: 0.029;
|
|
23
|
+
readonly stripeFixed: 0.3;
|
|
24
|
+
readonly avgTopUpTokens: 500;
|
|
25
|
+
readonly avgRequestsPerTopUp: 50;
|
|
26
|
+
};
|
|
27
|
+
readonly profitMargin: 0.65;
|
|
28
|
+
readonly initialCreditTokens: 500;
|
|
29
|
+
};
|
|
30
|
+
export declare const BillingKeys: {
|
|
31
|
+
readonly generateTransactionId: () => string;
|
|
32
|
+
readonly accountPkey: (accountId: string) => string;
|
|
33
|
+
readonly accountSkey: (accountType: AccountTypeEnum) => string;
|
|
34
|
+
readonly creditTransactionSkey: (transactionId: string) => string;
|
|
35
|
+
readonly stripePaymentSkey: (paymentIntentId: string) => string;
|
|
36
|
+
readonly autoTopUpData2: (enabled: boolean) => string;
|
|
37
|
+
readonly calculateTtl: (days?: number) => number;
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/billing/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,SAAS,CAAC;AAExC,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0Cd,CAAC;AAEX,eAAO,MAAM,WAAW;0CACK,MAAM;sCAMR,MAAM,KAAG,MAAM;wCAEb,eAAe,KAAG,MAAM;oDAEZ,MAAM,KAAG,MAAM;kDAEjB,MAAM,KAAG,MAAM;uCAE1B,OAAO,KAAG,MAAM;8CAEf,MAAM;CAGzB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BillingKeys = exports.COST_CONFIG = void 0;
|
|
4
|
+
exports.COST_CONFIG = {
|
|
5
|
+
// GPT-5.1 pricing (per million tokens)
|
|
6
|
+
gpt51: {
|
|
7
|
+
inputPerMillion: 1.25,
|
|
8
|
+
outputPerMillion: 10.0,
|
|
9
|
+
cachedInputPerMillion: 0.125,
|
|
10
|
+
},
|
|
11
|
+
// AWS infrastructure per request (in dollars)
|
|
12
|
+
infrastructure: {
|
|
13
|
+
lambda: 0.0000004,
|
|
14
|
+
dynamodb: 0.0000025,
|
|
15
|
+
apiGateway: 0.0000035,
|
|
16
|
+
cloudwatch: 0.0000025,
|
|
17
|
+
sqs: 0.0000004,
|
|
18
|
+
get total() {
|
|
19
|
+
return this.lambda + this.dynamodb + this.apiGateway + this.cloudwatch + this.sqs;
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
// Monthly operational costs
|
|
23
|
+
operations: {
|
|
24
|
+
monthlyTotal: 11876, // $11,876/month
|
|
25
|
+
estimatedMonthlyRequests: 50000,
|
|
26
|
+
get perRequest() {
|
|
27
|
+
return this.monthlyTotal / this.estimatedMonthlyRequests;
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
// Payment processing (Stripe)
|
|
31
|
+
payment: {
|
|
32
|
+
stripePercentage: 0.029,
|
|
33
|
+
stripeFixed: 0.3,
|
|
34
|
+
avgTopUpTokens: 500,
|
|
35
|
+
avgRequestsPerTopUp: 50,
|
|
36
|
+
},
|
|
37
|
+
// Margin
|
|
38
|
+
profitMargin: 0.65, // 65% target margin
|
|
39
|
+
// Initial credit
|
|
40
|
+
initialCreditTokens: 500,
|
|
41
|
+
};
|
|
42
|
+
exports.BillingKeys = {
|
|
43
|
+
generateTransactionId: () => {
|
|
44
|
+
const timestamp = Date.now();
|
|
45
|
+
const random = Math.random().toString(36).substring(2, 10);
|
|
46
|
+
return `txn_${timestamp}_${random}`;
|
|
47
|
+
},
|
|
48
|
+
accountPkey: (accountId) => `account-id:${accountId}`,
|
|
49
|
+
accountSkey: (accountType) => `account:${accountType}`,
|
|
50
|
+
creditTransactionSkey: (transactionId) => `credit-txn:${transactionId}`,
|
|
51
|
+
stripePaymentSkey: (paymentIntentId) => `stripe-payment:${paymentIntentId}`,
|
|
52
|
+
autoTopUpData2: (enabled) => `auto-topup:${enabled ? 'enabled' : 'disabled'}`,
|
|
53
|
+
calculateTtl: (days = 90) => {
|
|
54
|
+
return Math.floor(Date.now() / 1000) + days * 24 * 60 * 60;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/billing/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,WAAW,GAAG;IACzB,uCAAuC;IACvC,KAAK,EAAE;QACL,eAAe,EAAE,IAAI;QACrB,gBAAgB,EAAE,IAAI;QACtB,qBAAqB,EAAE,KAAK;KAC7B;IAED,8CAA8C;IAC9C,cAAc,EAAE;QACd,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,SAAS;QACnB,UAAU,EAAE,SAAS;QACrB,UAAU,EAAE,SAAS;QACrB,GAAG,EAAE,SAAS;QACd,IAAI,KAAK;YACP,OAAO,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC;QACpF,CAAC;KACF;IAED,4BAA4B;IAC5B,UAAU,EAAE;QACV,YAAY,EAAE,KAAK,EAAE,gBAAgB;QACrC,wBAAwB,EAAE,KAAK;QAC/B,IAAI,UAAU;YACZ,OAAO,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,wBAAwB,CAAC;QAC3D,CAAC;KACF;IAED,8BAA8B;IAC9B,OAAO,EAAE;QACP,gBAAgB,EAAE,KAAK;QACvB,WAAW,EAAE,GAAG;QAChB,cAAc,EAAE,GAAG;QACnB,mBAAmB,EAAE,EAAE;KACxB;IAED,SAAS;IACT,YAAY,EAAE,IAAI,EAAE,oBAAoB;IAExC,iBAAiB;IACjB,mBAAmB,EAAE,GAAG;CAChB,CAAC;AAEE,QAAA,WAAW,GAAG;IACzB,qBAAqB,EAAE,GAAW,EAAE;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC3D,OAAO,OAAO,SAAS,IAAI,MAAM,EAAE,CAAC;IACtC,CAAC;IAED,WAAW,EAAE,CAAC,SAAiB,EAAU,EAAE,CAAC,cAAc,SAAS,EAAE;IAErE,WAAW,EAAE,CAAC,WAA4B,EAAU,EAAE,CAAC,WAAW,WAAW,EAAE;IAE/E,qBAAqB,EAAE,CAAC,aAAqB,EAAU,EAAE,CAAC,cAAc,aAAa,EAAE;IAEvF,iBAAiB,EAAE,CAAC,eAAuB,EAAU,EAAE,CAAC,kBAAkB,eAAe,EAAE;IAE3F,cAAc,EAAE,CAAC,OAAgB,EAAU,EAAE,CAAC,cAAc,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,EAAE;IAE9F,YAAY,EAAE,CAAC,IAAI,GAAG,EAAE,EAAU,EAAE;QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IAC7D,CAAC;CACO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountType.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/accountType.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,kDAAkD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AccountTypeEnum = void 0;
|
|
4
|
+
var enums_1 = require("@wipperoz/common-entities-account/dist/src/enums");
|
|
5
|
+
Object.defineProperty(exports, "AccountTypeEnum", { enumerable: true, get: function () { return enums_1.AccountTypeEnum; } });
|
|
6
|
+
//# sourceMappingURL=accountType.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accountType.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/accountType.enum.ts"],"names":[],"mappings":";;;AAAA,0EAAiF;AAAzE,wGAAA,eAAe,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditReason.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/creditReason.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,gBAAgB;IAC1B,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,MAAM,WAAW;IACjB,cAAc,mBAAmB;CAClC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CreditReasonEnum = void 0;
|
|
4
|
+
var CreditReasonEnum;
|
|
5
|
+
(function (CreditReasonEnum) {
|
|
6
|
+
CreditReasonEnum["DEPOSIT"] = "Deposit";
|
|
7
|
+
CreditReasonEnum["USAGE"] = "Usage";
|
|
8
|
+
CreditReasonEnum["REFUND"] = "Refund";
|
|
9
|
+
CreditReasonEnum["INITIAL_CREDIT"] = "Initial Credit";
|
|
10
|
+
})(CreditReasonEnum || (exports.CreditReasonEnum = CreditReasonEnum = {}));
|
|
11
|
+
//# sourceMappingURL=creditReason.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"creditReason.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/creditReason.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,gBAKX;AALD,WAAY,gBAAgB;IAC1B,uCAAmB,CAAA;IACnB,mCAAe,CAAA;IACf,qCAAiB,CAAA;IACjB,qDAAiC,CAAA;AACnC,CAAC,EALW,gBAAgB,gCAAhB,gBAAgB,QAK3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayCurrency.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/displayCurrency.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,kDAAkD,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisplayCurrencyEnum = void 0;
|
|
4
|
+
var enums_1 = require("@wipperoz/common-entities-account/dist/src/enums");
|
|
5
|
+
Object.defineProperty(exports, "DisplayCurrencyEnum", { enumerable: true, get: function () { return enums_1.DisplayCurrencyEnum; } });
|
|
6
|
+
//# sourceMappingURL=displayCurrency.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"displayCurrency.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/displayCurrency.enum.ts"],"names":[],"mappings":";;;AAAA,0EAAqF;AAA7E,4GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './creditReason.enum';
|
|
2
|
+
export * from './reasoningEffort.enum';
|
|
3
|
+
export * from './stripePaymentStatus.enum';
|
|
4
|
+
export * from './stripeRegion.enum';
|
|
5
|
+
export * from './transactionType.enum';
|
|
6
|
+
export * from './displayCurrency.enum';
|
|
7
|
+
export * from './accountType.enum';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./creditReason.enum"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./reasoningEffort.enum"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./stripePaymentStatus.enum"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./stripeRegion.enum"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./transactionType.enum"), exports);
|
|
9
|
+
tslib_1.__exportStar(require("./displayCurrency.enum"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./accountType.enum"), exports);
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/billing/enums/index.ts"],"names":[],"mappings":";;;AAAA,8DAAoC;AACpC,iEAAuC;AACvC,qEAA2C;AAC3C,8DAAoC;AACpC,iEAAuC;AACvC,iEAAuC;AACvC,6DAAmC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoningEffort.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/reasoningEffort.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAC7B,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;CACd;AAED,eAAO,MAAM,mBAAmB,uBAAqC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reasoningEffortEnum = exports.ReasoningEffortEnum = void 0;
|
|
4
|
+
var ReasoningEffortEnum;
|
|
5
|
+
(function (ReasoningEffortEnum) {
|
|
6
|
+
ReasoningEffortEnum["NONE"] = "none";
|
|
7
|
+
ReasoningEffortEnum["LOW"] = "low";
|
|
8
|
+
ReasoningEffortEnum["MEDIUM"] = "medium";
|
|
9
|
+
ReasoningEffortEnum["HIGH"] = "high";
|
|
10
|
+
})(ReasoningEffortEnum || (exports.ReasoningEffortEnum = ReasoningEffortEnum = {}));
|
|
11
|
+
exports.reasoningEffortEnum = Object.values(ReasoningEffortEnum);
|
|
12
|
+
//# sourceMappingURL=reasoningEffort.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reasoningEffort.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/reasoningEffort.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,kCAAW,CAAA;IACX,wCAAiB,CAAA;IACjB,oCAAa,CAAA;AACf,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B;AAEY,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripePaymentStatus.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/stripePaymentStatus.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,uBAAuB;IACjC,SAAS,cAAc;IACvB,OAAO,YAAY;IACnB,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,uBAAuB,2BAAyC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripePaymentStatusEnum = exports.StripePaymentStatusEnum = void 0;
|
|
4
|
+
var StripePaymentStatusEnum;
|
|
5
|
+
(function (StripePaymentStatusEnum) {
|
|
6
|
+
StripePaymentStatusEnum["SUCCEEDED"] = "succeeded";
|
|
7
|
+
StripePaymentStatusEnum["PENDING"] = "pending";
|
|
8
|
+
StripePaymentStatusEnum["FAILED"] = "failed";
|
|
9
|
+
})(StripePaymentStatusEnum || (exports.StripePaymentStatusEnum = StripePaymentStatusEnum = {}));
|
|
10
|
+
exports.stripePaymentStatusEnum = Object.values(StripePaymentStatusEnum);
|
|
11
|
+
//# sourceMappingURL=stripePaymentStatus.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripePaymentStatus.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/stripePaymentStatus.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,uBAIX;AAJD,WAAY,uBAAuB;IACjC,kDAAuB,CAAA;IACvB,8CAAmB,CAAA;IACnB,4CAAiB,CAAA;AACnB,CAAC,EAJW,uBAAuB,uCAAvB,uBAAuB,QAIlC;AAEY,QAAA,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripeRegion.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/stripeRegion.enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,oEAAoE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.StripeRegionEnum = void 0;
|
|
4
|
+
var stripeRegion_enum_1 = require("@wipperoz/common-entities-account/dist/src/enums/stripeRegion.enum");
|
|
5
|
+
Object.defineProperty(exports, "StripeRegionEnum", { enumerable: true, get: function () { return stripeRegion_enum_1.StripeRegionEnum; } });
|
|
6
|
+
//# sourceMappingURL=stripeRegion.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripeRegion.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/stripeRegion.enum.ts"],"names":[],"mappings":";;;AAAA,wGAAoG;AAA5F,qHAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare enum TransactionTypeEnum {
|
|
2
|
+
USAGE = "usage",
|
|
3
|
+
DEPOSIT = "deposit",
|
|
4
|
+
AUTO_TOPUP = "auto_topup",
|
|
5
|
+
INITIAL_CREDIT = "initial_credit"
|
|
6
|
+
}
|
|
7
|
+
export declare const transactionTypeEnum: TransactionTypeEnum[];
|
|
8
|
+
//# sourceMappingURL=transactionType.enum.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionType.enum.d.ts","sourceRoot":"","sources":["../../../src/billing/enums/transactionType.enum.ts"],"names":[],"mappings":"AAAA,oBAAY,mBAAmB;IAC7B,KAAK,UAAU;IACf,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,cAAc,mBAAmB;CAClC;AAED,eAAO,MAAM,mBAAmB,uBAAqC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transactionTypeEnum = exports.TransactionTypeEnum = void 0;
|
|
4
|
+
var TransactionTypeEnum;
|
|
5
|
+
(function (TransactionTypeEnum) {
|
|
6
|
+
TransactionTypeEnum["USAGE"] = "usage";
|
|
7
|
+
TransactionTypeEnum["DEPOSIT"] = "deposit";
|
|
8
|
+
TransactionTypeEnum["AUTO_TOPUP"] = "auto_topup";
|
|
9
|
+
TransactionTypeEnum["INITIAL_CREDIT"] = "initial_credit";
|
|
10
|
+
})(TransactionTypeEnum || (exports.TransactionTypeEnum = TransactionTypeEnum = {}));
|
|
11
|
+
exports.transactionTypeEnum = Object.values(TransactionTypeEnum);
|
|
12
|
+
//# sourceMappingURL=transactionType.enum.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactionType.enum.js","sourceRoot":"","sources":["../../../src/billing/enums/transactionType.enum.ts"],"names":[],"mappings":";;;AAAA,IAAY,mBAKX;AALD,WAAY,mBAAmB;IAC7B,sCAAe,CAAA;IACf,0CAAmB,CAAA;IACnB,gDAAyB,CAAA;IACzB,wDAAiC,CAAA;AACnC,CAAC,EALW,mBAAmB,mCAAnB,mBAAmB,QAK9B;AAEY,QAAA,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yCAAyC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./services/tokenFormatter"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./services/accountCreditManager.service"), exports);
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/billing/index.ts"],"names":[],"mappings":";;;AAAA,oEAA0C;AAC1C,kFAAwD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addCreditsResult.interface.d.ts","sourceRoot":"","sources":["../../../src/billing/interfaces/addCreditsResult.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addCreditsResult.interface.js","sourceRoot":"","sources":["../../../src/billing/interfaces/addCreditsResult.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReasoningEffortEnum } from '../enums';
|
|
2
|
+
export interface AiRequestBillingResponse {
|
|
3
|
+
success: boolean;
|
|
4
|
+
response: string;
|
|
5
|
+
billing: {
|
|
6
|
+
chargedTokens: number;
|
|
7
|
+
chargedFormatted: string;
|
|
8
|
+
breakdown: {
|
|
9
|
+
ai: string;
|
|
10
|
+
infrastructure: string;
|
|
11
|
+
operations: string;
|
|
12
|
+
processing: string;
|
|
13
|
+
carboneIo: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
usage: {
|
|
17
|
+
inputTokens: number;
|
|
18
|
+
outputTokens: number;
|
|
19
|
+
cachedTokens: number;
|
|
20
|
+
model: string;
|
|
21
|
+
reasoningEffort: ReasoningEffortEnum;
|
|
22
|
+
};
|
|
23
|
+
account: {
|
|
24
|
+
balanceBefore: number;
|
|
25
|
+
balanceAfter: number;
|
|
26
|
+
balanceFormatted: string;
|
|
27
|
+
};
|
|
28
|
+
transactionId: string;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=aiRequestBillingResponse.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiRequestBillingResponse.interface.d.ts","sourceRoot":"","sources":["../../../src/billing/interfaces/aiRequestBillingResponse.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAE7C,MAAM,WAAW,wBAAwB;IACvC,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,gBAAgB,EAAE,MAAM,CAAC;QACzB,SAAS,EAAE;YACT,EAAE,EAAE,MAAM,CAAC;YACX,cAAc,EAAE,MAAM,CAAC;YACvB,UAAU,EAAE,MAAM,CAAC;YACnB,UAAU,EAAE,MAAM,CAAC;YACnB,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC;KACH,CAAC;IACF,KAAK,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,KAAK,EAAE,MAAM,CAAC;QACd,eAAe,EAAE,mBAAmB,CAAC;KACtC,CAAC;IACF,OAAO,EAAE;QACP,aAAa,EAAE,MAAM,CAAC;QACtB,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,aAAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiRequestBillingResponse.interface.js","sourceRoot":"","sources":["../../../src/billing/interfaces/aiRequestBillingResponse.interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoTopUpCheckResult.interface.d.ts","sourceRoot":"","sources":["../../../src/billing/interfaces/autoTopUpCheckResult.interface.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"autoTopUpCheckResult.interface.js","sourceRoot":"","sources":["../../../src/billing/interfaces/autoTopUpCheckResult.interface.ts"],"names":[],"mappings":""}
|