@rbxts/scribe 2.7.0 → 2.8.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 +1 -1
- package/Scribe-source-map.json +1 -1
- package/package.json +1 -1
- package/src/Client/init.luau +46 -18
- package/src/Internal/Store/ProfileStore.luau +20 -0
- package/src/Internal/Template.luau +2 -1
- package/src/Internal/Version.luau +1 -1
- package/src/Server/Monetization.luau +249 -87
- package/src/Server/Persistence.luau +3 -1
- package/src/Server/init.luau +6 -2
- package/src/Types.luau +8 -0
- package/src/init.luau +285 -116
- package/types/api.d.ts +10 -5
- package/types/common.d.ts +6 -0
- package/types/index.d.ts +1 -0
package/types/api.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Accessor, PlayerData, ValueOf, InputOf, ClientSchema, SharedSchema, ReadonlyAccessor, NumericPaths, Disconnect, Datatype, BigValue, BigOperand } from "./schema";
|
|
2
|
-
import type { UnknownRecord, ScribeTransport, Signal, LifecycleReason, SessionState, LoadPhase, Status, ProductState, RequestFailure, RequestFailedMarker, OperationResult, SaveInfo, SaveEvent, Anomaly, GiftReceived, VersionRecord, SchemaViolation, FlushOptions, UpdateOfflineOptions, RestoreOptions, CooldownOptions, MigrationContext, LeaderboardEntry, LeaderboardStatusInfo, PassConfig, PurchaseFilter, PurchaseEntry, PurchaseLogOptions, ProductInfo, PolicyInfo, ReceiptInfo, EconomyConfig, ExchangeableSpec, ExchangeAPI, LogLevel, StatusThresholds, PeriodResetOptions, MockState } from "./common";
|
|
2
|
+
import type { UnknownRecord, ScribeTransport, Signal, LifecycleReason, SessionState, LoadPhase, Status, ProductState, RequestFailure, RequestFailedMarker, OperationResult, SaveInfo, SaveEvent, Anomaly, GiftReceived, VersionRecord, SchemaViolation, FlushOptions, UpdateOfflineOptions, RestoreOptions, CooldownOptions, MigrationContext, LeaderboardEntry, LeaderboardStatusInfo, PassConfig, PassTrial, PurchaseFilter, PurchaseEntry, PurchaseLogOptions, ProductInfo, PolicyInfo, ReceiptInfo, EconomyConfig, ExchangeableSpec, ExchangeAPI, LogLevel, StatusThresholds, PeriodResetOptions, MockState } from "./common";
|
|
3
3
|
|
|
4
4
|
export interface LeaderboardConfig<T = unknown> {
|
|
5
5
|
Stat: NumericPaths<T, true>;
|
|
@@ -122,8 +122,10 @@ export interface ServerAPI<T, C = {}> {
|
|
|
122
122
|
readonly Owns: (this: void, player: Player, key: string) => boolean;
|
|
123
123
|
/** Verifies uncached pass ownership with Roblox before returning. */
|
|
124
124
|
readonly OwnsAsync: (this: void, player: Player, key: string, timeout?: number) => boolean;
|
|
125
|
+
/** Returns the cached trial if it alone grants access, otherwise `undefined`. */
|
|
126
|
+
readonly GetTrial: (this: void, player: Player, key: string) => PassTrial | undefined;
|
|
125
127
|
/** Reports ownership now and on changes; returns a disconnect function. */
|
|
126
|
-
readonly ObserveOwned: (this: void, player: Player, key: string, callback: (this: void, owned: boolean) => void) => Disconnect;
|
|
128
|
+
readonly ObserveOwned: (this: void, player: Player, key: string, callback: (this: void, owned: boolean, trial: boolean) => void) => Disconnect;
|
|
127
129
|
/** Grants a perk through Scribe's ownership state. */
|
|
128
130
|
readonly GrantPerk: (this: void, player: Player, key: string) => void;
|
|
129
131
|
/** Removes a granted perk from Scribe's ownership state. */
|
|
@@ -155,7 +157,7 @@ export interface ServerAPI<T, C = {}> {
|
|
|
155
157
|
/** Fires when a player receives an unassigned gift credit. */
|
|
156
158
|
readonly OnGiftCredit: Signal<[Player, string]>;
|
|
157
159
|
/** Fires when effective ownership changes after load. */
|
|
158
|
-
readonly OnOwnershipChanged: Signal<[Player, string, boolean]>;
|
|
160
|
+
readonly OnOwnershipChanged: Signal<[Player, string, boolean, boolean]>;
|
|
159
161
|
/** Fires when a cooldown expires during an active session. */
|
|
160
162
|
readonly OnCooldownEnded: Signal<[Player, string]>;
|
|
161
163
|
/** Fires when cached board contents change. */
|
|
@@ -202,10 +204,12 @@ export interface ClientAPI<T, C = {}> {
|
|
|
202
204
|
readonly Owns: (this: void, key: string) => boolean;
|
|
203
205
|
/** Waits for the server's initial ownership sync before reading the mirror. */
|
|
204
206
|
readonly OwnsAsync: (this: void, key: string, timeout?: number) => boolean;
|
|
207
|
+
/** Reads trial-only access from the local mirror after load. */
|
|
208
|
+
readonly GetTrial: (this: void, key: string) => PassTrial | undefined;
|
|
205
209
|
/** Returns a disconnect immediately. Reports current ownership once loaded and on changes. */
|
|
206
|
-
readonly ObserveOwned: (this: void, key: string, callback: (this: void, owned: boolean) => void) => Disconnect;
|
|
210
|
+
readonly ObserveOwned: (this: void, key: string, callback: (this: void, owned: boolean, trial: boolean) => void) => Disconnect;
|
|
207
211
|
/** Fires for ownership changes after the initial baseline. */
|
|
208
|
-
readonly OnOwnershipChanged: Signal<[string, boolean]>;
|
|
212
|
+
readonly OnOwnershipChanged: Signal<[string, boolean, boolean]>;
|
|
209
213
|
/** Reads cached player-specific marketplace info, fetching on demand. */
|
|
210
214
|
readonly GetProductInfo: (this: void, name: string) => ProductInfo | undefined;
|
|
211
215
|
/** Reads the local player's cached Robux price, or `undefined` while loading. */
|
|
@@ -254,6 +258,7 @@ export interface ScribeOptions<T, S = {}, C = {}> {
|
|
|
254
258
|
Transport?: ScribeTransport | "Default";
|
|
255
259
|
Migrations?: { [version: number]: (this: void, data: UnknownRecord) => void };
|
|
256
260
|
UserOwnsGamePassAsync?: (this: void, userId: number, passId: number) => boolean;
|
|
261
|
+
GetPassOwnershipAsync?: (this: void, player: Player, passId: number) => UnknownRecord;
|
|
257
262
|
GetProductInfoAsync?: (this: void, assetId: number, infoType: Enum.InfoType) => ProductInfo | undefined;
|
|
258
263
|
GetPolicyInfoAsync?: (this: void, player: Player) => PolicyInfo | undefined;
|
|
259
264
|
DevMode?: boolean;
|
package/types/common.d.ts
CHANGED
|
@@ -146,6 +146,9 @@ export type LogCode =
|
|
|
146
146
|
| "RECEIPT_HISTORY_FULL"
|
|
147
147
|
| "OWNERSHIP_CHECK_FAIL"
|
|
148
148
|
| "PASS_PURCHASE_UNCONFIRMED"
|
|
149
|
+
| "PASS_TRIAL_STARTED"
|
|
150
|
+
| "PASS_TRIAL_ENDED"
|
|
151
|
+
| "PASS_TRIAL_READ_FAIL"
|
|
149
152
|
| "PERK_GRANTED"
|
|
150
153
|
| "PERK_REVOKED"
|
|
151
154
|
| "PRODUCT_INFO_FAIL"
|
|
@@ -285,6 +288,8 @@ export interface LeaderboardStatusInfo {
|
|
|
285
288
|
export interface LeaderboardSnapshotEntry extends LeaderboardStatusInfo { BundleId: number; Name: string; }
|
|
286
289
|
export interface PassConfig { Id: number; Category?: string; }
|
|
287
290
|
export interface PurchaseFilter { Kind?: "Robux" | "InGame"; Category?: string; ItemId?: string; Since?: number; Limit?: number; }
|
|
291
|
+
/** Expected trial end in Unix seconds, absent if unknown. */
|
|
292
|
+
export interface PassTrial { EndsAt?: number; }
|
|
288
293
|
/** RecordPurchase accepts game-defined fields, so only Kind is universally present. */
|
|
289
294
|
export interface PurchaseEntry extends UnknownRecord {
|
|
290
295
|
Kind: "Robux" | "InGame";
|
|
@@ -371,6 +376,7 @@ export interface PeriodResetOptions { UtcOffset?: number; WeekStart?: "Monday" |
|
|
|
371
376
|
|
|
372
377
|
export interface MockState {
|
|
373
378
|
Perks?: ReadonlyArray<string>;
|
|
379
|
+
Trials?: { [pass: string]: number };
|
|
374
380
|
GiftCredits?: { [product: string]: number };
|
|
375
381
|
PurchaseLogs?: { Robux?: ReadonlyArray<UnknownRecord>; InGame?: ReadonlyArray<UnknownRecord> };
|
|
376
382
|
Leaderboards?: { [name: string]: ReadonlyArray<LeaderboardEntry> };
|
package/types/index.d.ts
CHANGED
|
@@ -234,6 +234,7 @@ declare namespace Scribe {
|
|
|
234
234
|
export type LeaderboardSnapshotEntry = Common.LeaderboardSnapshotEntry;
|
|
235
235
|
export type PassConfig = Common.PassConfig;
|
|
236
236
|
export type PurchaseFilter = Common.PurchaseFilter;
|
|
237
|
+
export type PassTrial = Common.PassTrial;
|
|
237
238
|
export type PurchaseEntry = Common.PurchaseEntry;
|
|
238
239
|
export type PurchaseLogOptions = Common.PurchaseLogOptions;
|
|
239
240
|
export type ProductInfo = Common.ProductInfo;
|