@smartico/public-api 0.0.419 → 0.0.420
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/ActivityLog/GetActivityLogRequest.d.ts +1 -1
- package/dist/ActivityLog/PointChangeSourceType.d.ts +1 -0
- package/dist/SmarticoAPI.d.ts +4 -4
- package/dist/WSAPI/WSAPIUser.d.ts +20 -6
- package/dist/index.js +44 -21
- package/dist/index.js.map +1 -1
- package/dist/index.modern.mjs +44 -21
- package/dist/index.modern.mjs.map +1 -1
- package/package.json +1 -1
- package/src/ActivityLog/GetActivityLogRequest.ts +1 -3
- package/src/ActivityLog/PointChangeSourceType.ts +1 -0
- package/src/SmarticoAPI.ts +11 -2
- package/src/WSAPI/WSAPIUser.ts +37 -11
package/dist/index.modern.mjs
CHANGED
|
@@ -2969,13 +2969,18 @@ class WSAPIUser extends WSAPIBase {
|
|
|
2969
2969
|
* `from` by 50 between calls. Both `startTimeSeconds` and `endTimeSeconds`
|
|
2970
2970
|
* are epoch seconds bounding the window the server scans.
|
|
2971
2971
|
*
|
|
2972
|
+
* **Filtering** — optional server-side filters (SMR-52608):
|
|
2973
|
+
* - `types` — {@link ActivityLogActivities} / `type_id` values (e.g. Points=3, Gems=1)
|
|
2974
|
+
* - `src_types` — {@link PointChangeSourceType} / `source_type_id` values
|
|
2975
|
+
* Omit both for an unfiltered window.
|
|
2976
|
+
*
|
|
2972
2977
|
* **Subscription model (`onUpdate`)**
|
|
2973
2978
|
* The callback fires when the user's `ach_points_balance`,
|
|
2974
2979
|
* `ach_gems_balance`, or `ach_diamonds_balance` changes (i.e. whenever a
|
|
2975
2980
|
* wallet event lands). The pushed payload is a FIXED re-fetch of the
|
|
2976
2981
|
* **last 10 minutes / first 50 entries** — it does NOT honor the original
|
|
2977
|
-
* call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to
|
|
2978
|
-
* maintaining a long historical view must re-call `getActivityLog` with
|
|
2982
|
+
* call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to` / filters.
|
|
2983
|
+
* Consumers maintaining a long historical view must re-call `getActivityLog` with
|
|
2979
2984
|
* their own params after receiving an `onUpdate` notification.
|
|
2980
2985
|
*
|
|
2981
2986
|
* **Refresh**
|
|
@@ -2999,6 +3004,8 @@ class WSAPIUser extends WSAPIBase {
|
|
|
2999
3004
|
* endTimeSeconds: now,
|
|
3000
3005
|
* from: 0,
|
|
3001
3006
|
* to: 50,
|
|
3007
|
+
* types: [1], // Gems only (ActivityLogActivities.Gems)
|
|
3008
|
+
* src_types: [11], // Tournament wins only (PointChangeSourceType.Tournament)
|
|
3002
3009
|
* onUpdate: (refreshed) => {
|
|
3003
3010
|
* console.log('[smartico] wallet changed — refreshed payload is last 10 min / 50 entries:', refreshed.length, 'rows');
|
|
3004
3011
|
* // If the consumer is showing a full 30-day view, re-call getActivityLog with the original params here.
|
|
@@ -3016,9 +3023,12 @@ class WSAPIUser extends WSAPIBase {
|
|
|
3016
3023
|
endTimeSeconds,
|
|
3017
3024
|
from,
|
|
3018
3025
|
to,
|
|
3026
|
+
types,
|
|
3027
|
+
src_types,
|
|
3019
3028
|
onUpdate
|
|
3020
3029
|
}) {
|
|
3021
|
-
|
|
3030
|
+
var _types$join, _src_types$join;
|
|
3031
|
+
const cacheKey = `${onUpdateContextKey.ActivityLog}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$join = types == null ? void 0 : types.join(',')) != null ? _types$join : ''}:${(_src_types$join = src_types == null ? void 0 : src_types.join(',')) != null ? _src_types$join : ''}`;
|
|
3022
3032
|
if (typeof onUpdate === 'function') {
|
|
3023
3033
|
this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
|
|
3024
3034
|
// Remember the requested window so a push refresh re-fetches THIS window
|
|
@@ -3027,19 +3037,22 @@ class WSAPIUser extends WSAPIBase {
|
|
|
3027
3037
|
startTimeSeconds,
|
|
3028
3038
|
endTimeSeconds,
|
|
3029
3039
|
from,
|
|
3030
|
-
to
|
|
3040
|
+
to,
|
|
3041
|
+
types,
|
|
3042
|
+
src_types
|
|
3031
3043
|
};
|
|
3032
3044
|
}
|
|
3033
|
-
return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to), CACHE_DATA_SEC);
|
|
3045
|
+
return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types), CACHE_DATA_SEC);
|
|
3034
3046
|
}
|
|
3035
3047
|
async notifyActivityLogUpdate() {
|
|
3048
|
+
var _params$types$join, _params$types, _params$src_types$joi, _params$src_types;
|
|
3036
3049
|
const params = this.activityLogOnUpdateParams;
|
|
3037
3050
|
// No consumer has subscribed to a specific window yet — nothing to refresh.
|
|
3038
3051
|
if (!params) {
|
|
3039
3052
|
return;
|
|
3040
3053
|
}
|
|
3041
|
-
const payload = await this.api.getActivityLogT(this.userExtId, params.startTimeSeconds, params.endTimeSeconds, params.from, params.to);
|
|
3042
|
-
const cacheKey = `${onUpdateContextKey.ActivityLog}:${params.startTimeSeconds}:${params.endTimeSeconds}:${params.from}:${params.to}`;
|
|
3054
|
+
const payload = await this.api.getActivityLogT(this.userExtId, params.startTimeSeconds, params.endTimeSeconds, params.from, params.to, params.types, params.src_types);
|
|
3055
|
+
const cacheKey = `${onUpdateContextKey.ActivityLog}:${params.startTimeSeconds}:${params.endTimeSeconds}:${params.from}:${params.to}:${(_params$types$join = (_params$types = params.types) == null ? void 0 : _params$types.join(',')) != null ? _params$types$join : ''}:${(_params$src_types$joi = (_params$src_types = params.src_types) == null ? void 0 : _params$src_types.join(',')) != null ? _params$src_types$joi : ''}`;
|
|
3043
3056
|
OCache.set(cacheKey, payload, ECacheContext.WSAPI);
|
|
3044
3057
|
const onUpdate = this.onUpdateCallback.get(onUpdateContextKey.ActivityLog);
|
|
3045
3058
|
if (typeof onUpdate === 'function') {
|
|
@@ -3057,8 +3070,10 @@ class WSAPIUser extends WSAPIBase {
|
|
|
3057
3070
|
* **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
|
|
3058
3071
|
* (server caps a single response at 50 entries).
|
|
3059
3072
|
*
|
|
3060
|
-
* **Filtering** —
|
|
3061
|
-
*
|
|
3073
|
+
* **Filtering** — optional server-side filters:
|
|
3074
|
+
* - `types` — {@link ActivityLogActivities} values (`type_id`)
|
|
3075
|
+
* - `src_types` — {@link PointChangeSourceType} values (`source_type_id`)
|
|
3076
|
+
* Omit both for all activity types / sources.
|
|
3062
3077
|
*
|
|
3063
3078
|
* @returns Array of {@link TActivityLogEntry} ordered newest-first.
|
|
3064
3079
|
*/
|
|
@@ -3067,11 +3082,12 @@ class WSAPIUser extends WSAPIBase {
|
|
|
3067
3082
|
endTimeSeconds,
|
|
3068
3083
|
from,
|
|
3069
3084
|
to,
|
|
3070
|
-
types
|
|
3085
|
+
types,
|
|
3086
|
+
src_types
|
|
3071
3087
|
}) {
|
|
3072
|
-
var _types$
|
|
3073
|
-
const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$
|
|
3074
|
-
return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types), CACHE_DATA_SEC);
|
|
3088
|
+
var _types$join2, _src_types$join2;
|
|
3089
|
+
const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${(_types$join2 = types == null ? void 0 : types.join(',')) != null ? _types$join2 : ''}:${(_src_types$join2 = src_types == null ? void 0 : src_types.join(',')) != null ? _src_types$join2 : ''}`;
|
|
3090
|
+
return await OCache.use(cacheKey, ECacheContext.WSAPI, () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types), CACHE_DATA_SEC);
|
|
3075
3091
|
}
|
|
3076
3092
|
}
|
|
3077
3093
|
|
|
@@ -9703,6 +9719,7 @@ var PointChangeSourceType;
|
|
|
9703
9719
|
PointChangeSourceType[PointChangeSourceType["WinMiniGame"] = 17] = "WinMiniGame";
|
|
9704
9720
|
PointChangeSourceType[PointChangeSourceType["API"] = 18] = "API";
|
|
9705
9721
|
PointChangeSourceType[PointChangeSourceType["DynamicFormula"] = 19] = "DynamicFormula";
|
|
9722
|
+
PointChangeSourceType[PointChangeSourceType["Jackpot"] = 20] = "Jackpot";
|
|
9706
9723
|
PointChangeSourceType[PointChangeSourceType["Raffle"] = 21] = "Raffle";
|
|
9707
9724
|
PointChangeSourceType[PointChangeSourceType["Avatars"] = 22] = "Avatars";
|
|
9708
9725
|
PointChangeSourceType[PointChangeSourceType["Clan"] = 23] = "Clan";
|
|
@@ -10881,16 +10898,20 @@ class SmarticoAPI {
|
|
|
10881
10898
|
const message = this.buildMessage(user_ext_id, ClassId.RAF_GET_WON_PRIZES_REQUEST, props);
|
|
10882
10899
|
return await this.send(message, ClassId.RAF_GET_WON_PRIZES_RESPONSE);
|
|
10883
10900
|
}
|
|
10884
|
-
async getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset) {
|
|
10885
|
-
const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, {
|
|
10901
|
+
async getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types) {
|
|
10902
|
+
const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, _extends({
|
|
10886
10903
|
startTimeSeconds: Math.floor(startTimeSeconds),
|
|
10887
10904
|
endTimeSeconds: Math.floor(endTimeSeconds),
|
|
10888
10905
|
limit,
|
|
10889
10906
|
offset
|
|
10890
|
-
}
|
|
10907
|
+
}, types ? {
|
|
10908
|
+
types
|
|
10909
|
+
} : {}, src_types ? {
|
|
10910
|
+
src_types
|
|
10911
|
+
} : {}));
|
|
10891
10912
|
return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
|
|
10892
10913
|
}
|
|
10893
|
-
async getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types) {
|
|
10914
|
+
async getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types) {
|
|
10894
10915
|
const message = this.buildMessage(user_ext_id, ClassId.GET_POINT_HISTORY_REQUEST, _extends({
|
|
10895
10916
|
startTimeSeconds: Math.floor(startTimeSeconds),
|
|
10896
10917
|
endTimeSeconds: Math.floor(endTimeSeconds),
|
|
@@ -10898,18 +10919,20 @@ class SmarticoAPI {
|
|
|
10898
10919
|
offset
|
|
10899
10920
|
}, types ? {
|
|
10900
10921
|
types
|
|
10922
|
+
} : {}, src_types ? {
|
|
10923
|
+
src_types
|
|
10901
10924
|
} : {}));
|
|
10902
10925
|
return await this.send(message, ClassId.GET_POINT_HISTORY_RESPONSE);
|
|
10903
10926
|
}
|
|
10904
|
-
async getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50) {
|
|
10927
|
+
async getActivityLogT(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types, src_types) {
|
|
10905
10928
|
const limit = to - from > 50 ? 50 : to - from;
|
|
10906
10929
|
const offset = from;
|
|
10907
|
-
return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).logHistory);
|
|
10930
|
+
return ActivityLogTransform((await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory);
|
|
10908
10931
|
}
|
|
10909
|
-
async getActivityLogV2T(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types) {
|
|
10932
|
+
async getActivityLogV2T(user_ext_id, startTimeSeconds, endTimeSeconds, from = 0, to = 50, types, src_types) {
|
|
10910
10933
|
const limit = to - from > 50 ? 50 : to - from;
|
|
10911
10934
|
const offset = from;
|
|
10912
|
-
return ActivityLogV2Transform((await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types)).logHistory);
|
|
10935
|
+
return ActivityLogV2Transform((await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory);
|
|
10913
10936
|
}
|
|
10914
10937
|
}
|
|
10915
10938
|
|