@nevermined-io/commons 0.1.25 → 0.1.26
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/dist/lib/types/TransactionTypes.d.ts +52 -0
- package/dist/lib/types/TransactionTypes.d.ts.map +1 -0
- package/dist/lib/types/TransactionTypes.js +4 -0
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/index.js +1 -0
- package/package.json +1 -1
- package/src/lib/types/TransactionTypes.ts +54 -0
- package/src/lib/types/index.ts +1 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared transaction types used by both API and webapp
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Credits information for a purchased plan
|
|
6
|
+
*/
|
|
7
|
+
export interface PlanCreditsInfo {
|
|
8
|
+
/** Indicates if the redemption amount is fixed (true) or dynamic (false) */
|
|
9
|
+
isRedemptionAmountFixed: boolean;
|
|
10
|
+
/** For EXPIRABLE plans: percentage consumed (0-100). For FIXED/DYNAMIC: remaining credits */
|
|
11
|
+
consumptionInfo: number;
|
|
12
|
+
/** For EXPIRABLE plans: true if expired. For FIXED/DYNAMIC: true if no credits left */
|
|
13
|
+
isExpired: boolean;
|
|
14
|
+
/** Current credits balance */
|
|
15
|
+
currentBalance: string;
|
|
16
|
+
/** Total credits originally granted */
|
|
17
|
+
totalCredits: string;
|
|
18
|
+
/** Purchase date for expirable plans */
|
|
19
|
+
purchaseDate?: string;
|
|
20
|
+
/** Duration in seconds for expirable plans */
|
|
21
|
+
durationSecs?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Single item from the plans-purchased-detailed API response
|
|
25
|
+
*/
|
|
26
|
+
export interface PurchasedPlanItem {
|
|
27
|
+
/** Plan detailed information */
|
|
28
|
+
plan?: {
|
|
29
|
+
id: string;
|
|
30
|
+
[key: string]: unknown;
|
|
31
|
+
};
|
|
32
|
+
/** Agents associated to this plan */
|
|
33
|
+
agents?: unknown[];
|
|
34
|
+
/** Credits consumption information */
|
|
35
|
+
creditsInfo?: PlanCreditsInfo | null;
|
|
36
|
+
/** List of transactions for this plan */
|
|
37
|
+
transactions?: unknown[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Response from GET /api/v1/transactions/plans-purchased-detailed
|
|
41
|
+
*/
|
|
42
|
+
export interface PlanPurchasedDetailedResponse {
|
|
43
|
+
/** Current page number */
|
|
44
|
+
page: number;
|
|
45
|
+
/** Total number of pages */
|
|
46
|
+
totalPages: number;
|
|
47
|
+
/** Total number of results found */
|
|
48
|
+
totalResults: number;
|
|
49
|
+
/** List of purchased plans with detailed information */
|
|
50
|
+
results: PurchasedPlanItem[];
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=TransactionTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransactionTypes.d.ts","sourceRoot":"","sources":["../../../src/lib/types/TransactionTypes.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4EAA4E;IAC5E,uBAAuB,EAAE,OAAO,CAAA;IAChC,6FAA6F;IAC7F,eAAe,EAAE,MAAM,CAAA;IACvB,uFAAuF;IACvF,SAAS,EAAE,OAAO,CAAA;IAClB,8BAA8B;IAC9B,cAAc,EAAE,MAAM,CAAA;IACtB,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAA;IACpB,wCAAwC;IACxC,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,8CAA8C;IAC9C,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,gCAAgC;IAChC,IAAI,CAAC,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,CAAA;IACD,qCAAqC;IACrC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAA;IAClB,sCAAsC;IACtC,WAAW,CAAC,EAAE,eAAe,GAAG,IAAI,CAAA;IACpC,yCAAyC;IACzC,YAAY,CAAC,EAAE,OAAO,EAAE,CAAA;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,6BAA6B;IAC5C,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAA;IAClB,oCAAoC;IACpC,YAAY,EAAE,MAAM,CAAA;IACpB,wDAAwD;IACxD,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B"}
|
|
@@ -2,6 +2,7 @@ export * from './ContractsTypes.js';
|
|
|
2
2
|
export * from './DDOTypes.js';
|
|
3
3
|
export * from './GeneralTypes.js';
|
|
4
4
|
export * from './MetadataTypes.js';
|
|
5
|
+
export * from './TransactionTypes.js';
|
|
5
6
|
export * from './TranscoderTypes.js';
|
|
6
7
|
export * from './types.js';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/lib/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA"}
|
package/dist/lib/types/index.js
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared transaction types used by both API and webapp
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Credits information for a purchased plan
|
|
7
|
+
*/
|
|
8
|
+
export interface PlanCreditsInfo {
|
|
9
|
+
/** Indicates if the redemption amount is fixed (true) or dynamic (false) */
|
|
10
|
+
isRedemptionAmountFixed: boolean
|
|
11
|
+
/** For EXPIRABLE plans: percentage consumed (0-100). For FIXED/DYNAMIC: remaining credits */
|
|
12
|
+
consumptionInfo: number
|
|
13
|
+
/** For EXPIRABLE plans: true if expired. For FIXED/DYNAMIC: true if no credits left */
|
|
14
|
+
isExpired: boolean
|
|
15
|
+
/** Current credits balance */
|
|
16
|
+
currentBalance: string
|
|
17
|
+
/** Total credits originally granted */
|
|
18
|
+
totalCredits: string
|
|
19
|
+
/** Purchase date for expirable plans */
|
|
20
|
+
purchaseDate?: string
|
|
21
|
+
/** Duration in seconds for expirable plans */
|
|
22
|
+
durationSecs?: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Single item from the plans-purchased-detailed API response
|
|
27
|
+
*/
|
|
28
|
+
export interface PurchasedPlanItem {
|
|
29
|
+
/** Plan detailed information */
|
|
30
|
+
plan?: {
|
|
31
|
+
id: string
|
|
32
|
+
[key: string]: unknown
|
|
33
|
+
}
|
|
34
|
+
/** Agents associated to this plan */
|
|
35
|
+
agents?: unknown[]
|
|
36
|
+
/** Credits consumption information */
|
|
37
|
+
creditsInfo?: PlanCreditsInfo | null
|
|
38
|
+
/** List of transactions for this plan */
|
|
39
|
+
transactions?: unknown[]
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Response from GET /api/v1/transactions/plans-purchased-detailed
|
|
44
|
+
*/
|
|
45
|
+
export interface PlanPurchasedDetailedResponse {
|
|
46
|
+
/** Current page number */
|
|
47
|
+
page: number
|
|
48
|
+
/** Total number of pages */
|
|
49
|
+
totalPages: number
|
|
50
|
+
/** Total number of results found */
|
|
51
|
+
totalResults: number
|
|
52
|
+
/** List of purchased plans with detailed information */
|
|
53
|
+
results: PurchasedPlanItem[]
|
|
54
|
+
}
|
package/src/lib/types/index.ts
CHANGED