@stripchatdev/ext-helper 0.1.6 → 0.1.8

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 (2) hide show
  1. package/dist/index.d.ts +170 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -11,6 +11,8 @@ declare class ExtHelper {
11
11
  bootstrap(): void;
12
12
  }
13
13
 
14
+ export declare type IV1IntIncrementFailureReason = 'INT_INCREMENT_FAILURE_REASON_NONE' | 'INT_INCREMENT_FAILURE_REASON_VALIDATION_DENIED';
15
+
14
16
  export declare type IV1ResolveSlotPage = (slotType: string, context: TV1ExtContext, extSettings: TV1ExtSettings) => void;
15
17
 
16
18
  export declare type TAnyApiEventData<D = unknown> = D;
@@ -248,7 +250,7 @@ export declare type TV1ExtUser = {
248
250
 
249
251
  export declare type TV1Genders = 'male' | 'female' | 'group' | 'tranny';
250
252
 
251
- export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods;
253
+ export declare type TV1Methods = TV1ExtMethods & TV1SystemMethods & TV1PaymentMethods & TV1ModelMethods & TV1ChatMethods & TV1PrivateMethods & TV1MonitoringMethods & TV1StorageMethods;
252
254
 
253
255
  declare type TV1ModelEvents = {
254
256
  'v1.model.ext.settings.set.requested': null;
@@ -342,6 +344,164 @@ declare type TV1SerializedError = {
342
344
  stack?: string;
343
345
  };
344
346
 
347
+ declare type TV1StorageMethods = {
348
+ 'v1.storage.int.get': {
349
+ params: {
350
+ key: string;
351
+ };
352
+ result: {
353
+ /** `false` when the key has never been set (value will be 0). */
354
+ exists?: boolean;
355
+ /** @format int64 */
356
+ value: string;
357
+ };
358
+ };
359
+ /**
360
+ * Add `delta` to an integer counter. Negative delta subtracts.
361
+ * When the key is configured with a payment policy, pass `paymentContext`
362
+ * so the server can validate the transaction before applying the change.
363
+ */
364
+ 'v1.storage.int.increment': {
365
+ params: {
366
+ /** Amount to add (may be negative). Must not be zero. */
367
+ delta: string;
368
+ key: string;
369
+ /** Opaque payload forwarded to server-side payment/policy validation. */
370
+ paymentContext?: string;
371
+ };
372
+ result: {
373
+ failureReason?: IV1IntIncrementFailureReason;
374
+ /** New counter value after the increment (present when `success` is true). */
375
+ success: boolean;
376
+ value?: string;
377
+ };
378
+ };
379
+ /** Reset an integer counter to 0. */
380
+ 'v1.storage.int.reset': {
381
+ params: {
382
+ key: string;
383
+ };
384
+ result: {
385
+ success: boolean;
386
+ /** Stored value after reset; always 0 when `success` is true. */
387
+ value?: string;
388
+ };
389
+ };
390
+ 'v1.storage.mutex.getState': {
391
+ params: {
392
+ mutexName: string;
393
+ };
394
+ result: {
395
+ /** `true` if the mutex is currently locked. */
396
+ held: boolean;
397
+ };
398
+ };
399
+ 'v1.storage.mutex.lock': {
400
+ params: {
401
+ mutexName: string;
402
+ /** Auto-release after this many seconds. Omit or 0 = hold until explicit unlock. */
403
+ /** @format int64 */
404
+ ttlSeconds?: string;
405
+ };
406
+ result: {
407
+ success: boolean;
408
+ };
409
+ };
410
+ 'v1.storage.mutex.unlock': {
411
+ params: {
412
+ mutexName: string;
413
+ };
414
+ result: {
415
+ success: boolean;
416
+ };
417
+ };
418
+ 'v1.storage.string.append': {
419
+ params: {
420
+ key: string;
421
+ /** Auto-delete the key after this many seconds. Omit or 0 = no expiry. */
422
+ /** @format int64 */
423
+ ttlSeconds?: string;
424
+ value: string;
425
+ };
426
+ result: {
427
+ success: boolean;
428
+ };
429
+ };
430
+ 'v1.storage.string.get': {
431
+ params: {
432
+ key: string;
433
+ };
434
+ result: {
435
+ value: string;
436
+ };
437
+ };
438
+ 'v1.storage.string.set': {
439
+ params: {
440
+ key: string;
441
+ /** Auto-delete the key after this many seconds. Omit or 0 = no expiry. */
442
+ /** @format int64 */
443
+ ttlSeconds?: string;
444
+ value: string;
445
+ };
446
+ result: {
447
+ success: boolean;
448
+ };
449
+ };
450
+ /**
451
+ * Read a top counter: total sum in the window, last incrementer,
452
+ * top-N users by total, and per-day breakdown.
453
+ */
454
+ 'v1.storage.top.get': {
455
+ params: {
456
+ key: string;
457
+ /** How many users to return in `topUsers`. 0 = default 10; max 100. */
458
+ topN?: number;
459
+ /** Sliding time horizon for summing increments. */
460
+ window: TV1TopWindow;
461
+ };
462
+ result: {
463
+ topUsers?: TV1TopUserEntry[];
464
+ };
465
+ };
466
+ /** Append an increment to a top counter for the current model session. */
467
+ 'v1.storage.top.increment': {
468
+ params: {
469
+ /**
470
+ * Positive amount to add.
471
+ * @format int64
472
+ */
473
+ amount: string;
474
+ key: string;
475
+ /**
476
+ * User id credited for this increment (appears in `top/get` top_users).
477
+ * @format int64
478
+ */
479
+ userId: string;
480
+ };
481
+ result: {
482
+ success: boolean;
483
+ /** Sum within 1-day window after this increment. */
484
+ /** @format int64 */
485
+ value1d?: string;
486
+ /** Sum within 30-day window after this increment. */
487
+ /** @format int64 */
488
+ value30d?: string;
489
+ /** Sum within 7-day window after this increment. */
490
+ /** @format int64 */
491
+ value7d?: string;
492
+ };
493
+ };
494
+ /** Clear all increments for a top counter key. */
495
+ 'v1.storage.top.reset': {
496
+ params: {
497
+ key: string;
498
+ };
499
+ result: {
500
+ success: boolean;
501
+ };
502
+ };
503
+ };
504
+
345
505
  declare type TV1SystemMethods = {
346
506
  'v1.system.report.crash': {
347
507
  params: {
@@ -419,6 +579,15 @@ declare type TV1TipSource = 'console' | 'tipMenu' | 'goal' | 'epicGoal' | 'fulls
419
579
  /** Custom data that you can pass when requesting token spend. You will receive it on successful payment */
420
580
  export declare type TV1TokenSpendData = TUnknownDictionary;
421
581
 
582
+ export declare type TV1TopUserEntry = {
583
+ /** Sum of increment amounts within the sliding window for this user. */
584
+ total: string;
585
+ /** User ID recorded as incrementer. */
586
+ userId: string;
587
+ };
588
+
589
+ export declare type TV1TopWindow = 'TOP_1D' | 'TOP_7D' | 'TOP_30D';
590
+
422
591
  /**
423
592
  * User activity league. Ordered from lowest to highest activity rank:
424
593
  * - `grey` — new or low-activity users (level 1–9)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stripchatdev/ext-helper",
3
3
  "private": false,
4
- "version": "0.1.6",
4
+ "version": "0.1.8",
5
5
  "type": "module",
6
6
  "module": "./dist/ext-helper.js",
7
7
  "types": "./dist/index.d.ts",