jaspervault_cli 1.0.16 → 1.0.18

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.
@@ -0,0 +1,12 @@
1
+ import type { PPOSettings } from '../types.js';
2
+ export declare const PPO_TIER_RATIOS: Record<number, number>;
3
+ export interface PpoResult {
4
+ limitType: number;
5
+ ppoSettings: PPOSettings;
6
+ }
7
+ export declare function parsePpoOptions(opts: {
8
+ ppo?: boolean;
9
+ ppoExpire?: string;
10
+ ppoCategory?: string;
11
+ ppoTier?: string;
12
+ }): PpoResult;
@@ -0,0 +1,45 @@
1
+ import { exitWithError, EXIT_CODES } from './output.js';
2
+ export const PPO_TIER_RATIOS = {
3
+ 1: 0.001,
4
+ 2: 0.002,
5
+ 3: 0.003,
6
+ 4: 0.004,
7
+ 5: 0.005,
8
+ };
9
+ const PPO_EXPIRE_MAP = {
10
+ '30m': '1800',
11
+ '8h': '28800',
12
+ };
13
+ export function parsePpoOptions(opts) {
14
+ if (!opts.ppo) {
15
+ return { limitType: 0, ppoSettings: { optionExpireTime: '0' } };
16
+ }
17
+ const expire = opts.ppoExpire ?? '30m';
18
+ const expireSeconds = PPO_EXPIRE_MAP[expire];
19
+ if (!expireSeconds) {
20
+ exitWithError(`--ppo-expire must be 30m or 8h (got "${expire}")`, EXIT_CODES.CONFIG_ERROR);
21
+ }
22
+ const category = (opts.ppoCategory?.toUpperCase() ?? 'ATM');
23
+ if (category !== 'ATM' && category !== 'OTM') {
24
+ exitWithError(`--ppo-category must be ATM or OTM (got "${opts.ppoCategory}")`, EXIT_CODES.CONFIG_ERROR);
25
+ }
26
+ const ppoSettings = {
27
+ optionExpireTime: expireSeconds,
28
+ optionCategory: category,
29
+ };
30
+ if (category === 'OTM') {
31
+ if (!opts.ppoTier) {
32
+ exitWithError('OTM requires --ppo-tier (1-5)', EXIT_CODES.CONFIG_ERROR);
33
+ }
34
+ const tier = parseInt(opts.ppoTier, 10);
35
+ if (!(tier >= 1 && tier <= 5)) {
36
+ exitWithError(`--ppo-tier must be 1-5 (got "${opts.ppoTier}")`, EXIT_CODES.CONFIG_ERROR);
37
+ }
38
+ ppoSettings.ratio = PPO_TIER_RATIOS[tier];
39
+ }
40
+ else if (opts.ppoTier) {
41
+ console.error('Warning: --ppo-tier is ignored for ATM options');
42
+ }
43
+ return { limitType: 1, ppoSettings };
44
+ }
45
+ //# sourceMappingURL=ppo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ppo.js","sourceRoot":"","sources":["../../../src/utils/ppo.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,CAAC,MAAM,eAAe,GAA2B;IACrD,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;IACR,CAAC,EAAE,KAAK;CACT,CAAC;AAEF,MAAM,cAAc,GAA2B;IAC7C,KAAK,EAAE,MAAM;IACb,IAAI,EAAE,OAAO;CACd,CAAC;AAOF,MAAM,UAAU,eAAe,CAAC,IAK/B;IACC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC;QACd,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE,gBAAgB,EAAE,GAAG,EAAE,EAAE,CAAC;IAClE,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC;IACvC,MAAM,aAAa,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,aAAa,CAAC,wCAAwC,MAAM,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAC7F,CAAC;IAED,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,KAAK,CAAkB,CAAC;IAC7E,IAAI,QAAQ,KAAK,KAAK,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QAC7C,aAAa,CAAC,2CAA2C,IAAI,CAAC,WAAW,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;IAC1G,CAAC;IAED,MAAM,WAAW,GAAgB;QAC/B,gBAAgB,EAAE,aAAa;QAC/B,cAAc,EAAE,QAAQ;KACzB,CAAC;IAEF,IAAI,QAAQ,KAAK,KAAK,EAAE,CAAC;QACvB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,aAAa,CAAC,+BAA+B,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QAC1E,CAAC;QACD,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACxC,IAAI,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC;YAC9B,aAAa,CAAC,gCAAgC,IAAI,CAAC,OAAO,IAAI,EAAE,UAAU,CAAC,YAAY,CAAC,CAAC;QAC3F,CAAC;QACD,WAAW,CAAC,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;SAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;QACxB,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC;AACvC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jaspervault_cli",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "JasperVault CLI for interacting with the JasperVault Manager API",
5
5
  "type": "module",
6
6
  "bin": {