@rbxts/scribe 2.5.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/LICENSE +21 -0
- package/NOTICE +21 -0
- package/README.md +100 -0
- package/Scribe-source-map.json +1 -0
- package/licenses/ProfileStore-Apache-2.0.txt +201 -0
- package/package.json +32 -0
- package/src/Client/DebugHook.luau +457 -0
- package/src/Client/init.luau +1607 -0
- package/src/Internal/Addons.luau +68 -0
- package/src/Internal/Big.luau +582 -0
- package/src/Internal/Budget.luau +377 -0
- package/src/Internal/Clock.luau +75 -0
- package/src/Internal/Config.luau +17 -0
- package/src/Internal/Conform.luau +400 -0
- package/src/Internal/Datatypes.luau +653 -0
- package/src/Internal/Defaults.luau +12 -0
- package/src/Internal/Derived.luau +428 -0
- package/src/Internal/Exchange.luau +556 -0
- package/src/Internal/ExchangeLeg.luau +1368 -0
- package/src/Internal/ExchangeVerdict.luau +179 -0
- package/src/Internal/Failure.luau +148 -0
- package/src/Internal/Health.luau +320 -0
- package/src/Internal/LeaderboardDiagnostics.luau +36 -0
- package/src/Internal/Log.luau +378 -0
- package/src/Internal/Marker.luau +76 -0
- package/src/Internal/Metrics.luau +152 -0
- package/src/Internal/Node.luau +3954 -0
- package/src/Internal/Profile.luau +69 -0
- package/src/Internal/Rng.luau +83 -0
- package/src/Internal/Sched.luau +56 -0
- package/src/Internal/Signal.luau +199 -0
- package/src/Internal/Store/ProfileStore.luau +3019 -0
- package/src/Internal/Store/init.luau +18 -0
- package/src/Internal/StudioCodec.luau +155 -0
- package/src/Internal/Template.luau +1848 -0
- package/src/Internal/Transport.luau +169 -0
- package/src/Internal/Util.luau +517 -0
- package/src/Internal/Version.luau +4 -0
- package/src/Internal/Wire.luau +1283 -0
- package/src/Server/Analytics.luau +223 -0
- package/src/Server/Commands.luau +728 -0
- package/src/Server/DebugHook.luau +1490 -0
- package/src/Server/Exchanges.luau +737 -0
- package/src/Server/Leaderboards.luau +2143 -0
- package/src/Server/Monetization.luau +3212 -0
- package/src/Server/Persistence.luau +3775 -0
- package/src/Server/Replication.luau +1253 -0
- package/src/Server/ServerStore.luau +81 -0
- package/src/Server/Timed.luau +579 -0
- package/src/Server/init.luau +672 -0
- package/src/Types.luau +480 -0
- package/src/init.luau +2231 -0
- package/types/api.d.ts +252 -0
- package/types/common.d.ts +355 -0
- package/types/index.d.ts +226 -0
- package/types/schema.d.ts +276 -0
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import type * as Schema from "./schema";
|
|
2
|
+
import type * as API from "./api";
|
|
3
|
+
import type * as Common from "./common";
|
|
4
|
+
|
|
5
|
+
declare const Scribe: Scribe.ScribeModule;
|
|
6
|
+
|
|
7
|
+
declare namespace Scribe {
|
|
8
|
+
interface ScribeModule {
|
|
9
|
+
<T, S = {}, C = {}>(options: API.ScribeOptions<T, S, C>): API.Bundle<T, S, C>;
|
|
10
|
+
readonly new: <T, S = {}, C = {}>(this: void, options: API.ScribeOptions<T, S, C>) => API.Bundle<T, S, C>;
|
|
11
|
+
readonly Version: string;
|
|
12
|
+
readonly ServerOnly: <T>(this: void, value: T) => Schema.ServerOnly<T>;
|
|
13
|
+
readonly Shared: <T>(this: void, value: T) => Schema.Shared<T>;
|
|
14
|
+
readonly Session: <T>(this: void, value: T) => Schema.Session<T>;
|
|
15
|
+
readonly Int: (this: void, value: number, meta?: NumberMeta) => number;
|
|
16
|
+
readonly Number: (this: void, value: number, meta?: FloatMeta) => number;
|
|
17
|
+
readonly Big: (this: void, value?: number | string, meta?: BigMeta) => Schema.BigSchema;
|
|
18
|
+
readonly String: (this: void, value: string, meta?: StringMeta) => string;
|
|
19
|
+
readonly Enum: <K extends string>(this: void, value: NoInfer<K>, members: readonly K[]) => Schema.EnumValue<K>;
|
|
20
|
+
readonly Flags: <K extends string>(this: void, members: readonly K[]) => Schema.Flags<K>;
|
|
21
|
+
readonly Timed: <T>(this: void, value: T) => Schema.Timed<T>;
|
|
22
|
+
readonly Dynamic: <T>(this: void, factory: (this: void) => T) => T;
|
|
23
|
+
/** Annotate compute arguments: the enclosing template is not in scope here. */
|
|
24
|
+
readonly Derived: <T, A extends unknown[]>(this: void, output: T, inputs: readonly string[], compute: (this: void, ...args: A) => Schema.ValueOf<T>) => Schema.Derived<T>;
|
|
25
|
+
readonly Optional: <T>(this: void, value: T) => Schema.Optional<T>;
|
|
26
|
+
readonly ArrayOf: <T>(this: void, shape: T, options?: ArrayOpts) => Schema.ArrayOf<T>;
|
|
27
|
+
readonly SetOf: <T>(this: void, element: T, options?: SetOpts) => Schema.SetOf<T>;
|
|
28
|
+
readonly MapOf: <K extends "integer" | "string", T>(this: void, keyType: K, shape: T, options?: DictOpts) => Schema.MapOf<K, T>;
|
|
29
|
+
readonly DictOf: <T>(this: void, shape: T, options?: DictOpts) => Schema.DictOf<T>;
|
|
30
|
+
readonly Vector3: (this: void, value: Vector3) => Vector3;
|
|
31
|
+
readonly Vector2: (this: void, value: Vector2) => Vector2;
|
|
32
|
+
readonly Vector3int16: (this: void, value: Vector3int16) => Vector3int16;
|
|
33
|
+
readonly Vector2int16: (this: void, value: Vector2int16) => Vector2int16;
|
|
34
|
+
readonly CFrame: (this: void, value: CFrame, meta?: CFrameMeta) => CFrame;
|
|
35
|
+
readonly Color3: (this: void, value: Color3) => Color3;
|
|
36
|
+
readonly BrickColor: (this: void, value: BrickColor) => BrickColor;
|
|
37
|
+
readonly UDim: (this: void, value: UDim) => UDim;
|
|
38
|
+
readonly UDim2: (this: void, value: UDim2) => UDim2;
|
|
39
|
+
readonly Rect: (this: void, value: Rect) => Rect;
|
|
40
|
+
readonly NumberRange: (this: void, value: NumberRange) => NumberRange;
|
|
41
|
+
readonly NumberSequence: (this: void, value: NumberSequence) => NumberSequence;
|
|
42
|
+
readonly ColorSequence: (this: void, value: ColorSequence) => ColorSequence;
|
|
43
|
+
readonly DateTime: (this: void, value: DateTime) => DateTime;
|
|
44
|
+
readonly EnumItem: <T extends EnumItem>(this: void, value: T) => T;
|
|
45
|
+
readonly Font: (this: void, value: Font) => Font;
|
|
46
|
+
readonly PhysicalProperties: (this: void, value: PhysicalProperties) => PhysicalProperties;
|
|
47
|
+
readonly Short: (this: void, value?: number | Schema.BigValue, decimals?: number) => string;
|
|
48
|
+
readonly SetShortSuffixes: (this: void, suffixes: readonly string[]) => void;
|
|
49
|
+
readonly Configure: (this: void, config: Common.ConfigureOptions) => void;
|
|
50
|
+
readonly GetProfileKeyPrefix: (this: void) => string;
|
|
51
|
+
readonly GetStatus: (this: void) => Common.Status;
|
|
52
|
+
readonly OnStatusChanged: Common.Signal<[Common.Status, Common.Status]>;
|
|
53
|
+
readonly OnIssue: Common.Signal<[Common.LogEntry]>;
|
|
54
|
+
readonly AddLogSink: (this: void, callback: (this: void, entry: Common.LogEntry) => void, options?: Common.LogSinkOptions) => Schema.Disconnect;
|
|
55
|
+
readonly RegisterAddon: (this: void, name: string, actions: Common.AddonActions) => Schema.Disconnect;
|
|
56
|
+
readonly GetRecentLogs: (this: void, filter?: Common.LogFilter) => Common.LogEntry[];
|
|
57
|
+
readonly GetMetrics: (this: void) => Common.Metrics;
|
|
58
|
+
readonly GetPercentiles: (this: void) => Common.PercentileSnapshot;
|
|
59
|
+
readonly GetBudgetSnapshot: (this: void) => Common.BudgetSnapshot;
|
|
60
|
+
readonly GetLeaderboardSnapshot: (this: void) => Common.LeaderboardSnapshotEntry[];
|
|
61
|
+
readonly RequestFailed: Common.RequestFailedMarker;
|
|
62
|
+
readonly Datatypes: {
|
|
63
|
+
readonly IsSupported: (this: void, name: string) => boolean;
|
|
64
|
+
readonly PrecisionValues: (this: void, name: string) => string[] | undefined;
|
|
65
|
+
readonly Pack: <K extends keyof DatatypeValues>(this: void, name: K, value: DatatypeValues[K], precision?: K extends "CFrame" ? "exact" : never) => buffer;
|
|
66
|
+
readonly Unpack: <K extends keyof DatatypeValues>(this: void, name: K, bytes: buffer) => DatatypeValues[K];
|
|
67
|
+
readonly NONFINITE: "Scribe:nonfinite:";
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface NumberMeta { Min?: number; Max?: number; }
|
|
73
|
+
interface DatatypeValues {
|
|
74
|
+
Vector3: Vector3; Vector2: Vector2; Vector3int16: Vector3int16; Vector2int16: Vector2int16;
|
|
75
|
+
CFrame: CFrame; Color3: Color3; BrickColor: BrickColor; UDim: UDim; UDim2: UDim2;
|
|
76
|
+
Rect: Rect; NumberRange: NumberRange; NumberSequence: NumberSequence; ColorSequence: ColorSequence;
|
|
77
|
+
DateTime: DateTime; EnumItem: EnumItem; Font: Font; PhysicalProperties: PhysicalProperties;
|
|
78
|
+
}
|
|
79
|
+
interface FloatMeta extends NumberMeta { Precision?: number | "f32"; }
|
|
80
|
+
interface BigMeta { Min?: number | string; Max?: number | string; }
|
|
81
|
+
interface StringMeta { MaxLength?: number; }
|
|
82
|
+
interface CFrameMeta { Precision?: "exact"; }
|
|
83
|
+
interface ArrayOpts { MaxItems?: number; Evict?: "Front" | "Back"; }
|
|
84
|
+
interface SetOpts { MaxItems?: number; }
|
|
85
|
+
interface DictOpts { MaxKeys?: number; MaxKeyLength?: number; }
|
|
86
|
+
type MapKeyType = "integer" | "string";
|
|
87
|
+
export type ServerOnly<T> = Schema.ServerOnly<T>;
|
|
88
|
+
export type Shared<T> = Schema.Shared<T>;
|
|
89
|
+
export type Session<T> = Schema.Session<T>;
|
|
90
|
+
export type Timed<T> = Schema.Timed<T>;
|
|
91
|
+
export type Derived<T> = Schema.Derived<T>;
|
|
92
|
+
export type Optional<T> = Schema.Optional<T>;
|
|
93
|
+
export type ArrayOf<T> = Schema.ArrayOf<T>;
|
|
94
|
+
export type DictOf<T> = Schema.DictOf<T>;
|
|
95
|
+
export type MapOf<K extends "integer" | "string", T> = Schema.MapOf<K, T>;
|
|
96
|
+
export type SetOf<T> = Schema.SetOf<T>;
|
|
97
|
+
export type Flags<K extends string = string> = Schema.Flags<K>;
|
|
98
|
+
export type EnumValue<K extends string> = Schema.EnumValue<K>;
|
|
99
|
+
export type BigSchema = Schema.BigSchema;
|
|
100
|
+
export type Disconnect = Schema.Disconnect;
|
|
101
|
+
export type BigOperand = Schema.BigOperand;
|
|
102
|
+
export type BigValue = Schema.BigValue;
|
|
103
|
+
export type Datatype = Schema.Datatype;
|
|
104
|
+
export type AtomicValue = Schema.AtomicValue;
|
|
105
|
+
export type ValueOf<T> = Schema.ValueOf<T>;
|
|
106
|
+
export type DeepReadonly<T> = Schema.DeepReadonly<T>;
|
|
107
|
+
export type InputOf<T> = Schema.InputOf<T>;
|
|
108
|
+
export type ElementInput<T> = Schema.ElementInput<T>;
|
|
109
|
+
export type ClientSchema<T> = Schema.ClientSchema<T>;
|
|
110
|
+
export type SharedSchema<T> = Schema.SharedSchema<T>;
|
|
111
|
+
export type ReadableNode<T> = Schema.ReadableNode<T>;
|
|
112
|
+
export type Accessor<T, Root extends boolean = false, Missing extends boolean = false, ReadOnly extends boolean = false, Closed extends boolean = false> = Schema.Accessor<T, Root, Missing, ReadOnly, Closed>;
|
|
113
|
+
export type PlayerData<T> = Schema.PlayerData<T>;
|
|
114
|
+
export type ReadonlyAccessor<T, Root extends boolean = false> = Schema.ReadonlyAccessor<T, Root>;
|
|
115
|
+
export type NumericPaths<T, IncludeBig extends boolean = false, Depth extends unknown[] = []> = Schema.NumericPaths<T, IncludeBig, Depth>;
|
|
116
|
+
export type LeaderboardConfig<T = unknown> = API.LeaderboardConfig<T>;
|
|
117
|
+
export type ProductConfig<T = unknown> = API.ProductConfig<T>;
|
|
118
|
+
export type PurchaseSpec<T = unknown> = API.PurchaseSpec<T>;
|
|
119
|
+
export type CommandArguments<F> = API.CommandArguments<F>;
|
|
120
|
+
export type CommandReturn<F> = API.CommandReturn<F>;
|
|
121
|
+
export type CommandHandler<F> = API.CommandHandler<F>;
|
|
122
|
+
export type CommandSpec = API.CommandSpec;
|
|
123
|
+
export type RequestFunction<C> = API.RequestFunction<C>;
|
|
124
|
+
export type RequestOnceFunction<C> = API.RequestOnceFunction<C>;
|
|
125
|
+
export type RegisterCommand<C> = API.RegisterCommand<C>;
|
|
126
|
+
export type MockCommand<C> = API.MockCommand<C>;
|
|
127
|
+
export type ServerStore<S> = API.ServerStore<S>;
|
|
128
|
+
export type ClientServerStore<S> = API.ClientServerStore<S>;
|
|
129
|
+
export type SharedData<T> = API.SharedData<T>;
|
|
130
|
+
export type ServerAPI<T, C = {}> = API.ServerAPI<T, C>;
|
|
131
|
+
export type ServerData<T, S = {}, C = {}> = API.ServerData<T, S, C>;
|
|
132
|
+
export type MockValues<T> = API.MockValues<T>;
|
|
133
|
+
export type ClientAPI<T, C = {}> = API.ClientAPI<T, C>;
|
|
134
|
+
export type ClientData<T, S = {}, C = {}> = API.ClientData<T, S, C>;
|
|
135
|
+
export type Bundle<T, S = {}, C = {}> = API.Bundle<T, S, C>;
|
|
136
|
+
export type ScribeOptions<T, S = {}, C = {}> = API.ScribeOptions<T, S, C>;
|
|
137
|
+
export type UnknownRecord = Common.UnknownRecord;
|
|
138
|
+
export type PathSegment = Common.PathSegment;
|
|
139
|
+
export type Path = Common.Path;
|
|
140
|
+
export type OpKind = Common.OpKind;
|
|
141
|
+
export type Op = Common.Op;
|
|
142
|
+
export type ScribeTransport = Common.ScribeTransport;
|
|
143
|
+
export type Connection = Common.Connection;
|
|
144
|
+
export type Signal<Args extends unknown[]> = Common.Signal<Args>;
|
|
145
|
+
export type LogLevel = Common.LogLevel;
|
|
146
|
+
export type LogCategory = Common.LogCategory;
|
|
147
|
+
export type LogCode = Common.LogCode;
|
|
148
|
+
export type LogEntry = Common.LogEntry;
|
|
149
|
+
export type LogSinkOptions = Common.LogSinkOptions;
|
|
150
|
+
export type LogFilter = Common.LogFilter;
|
|
151
|
+
export type Status = Common.Status;
|
|
152
|
+
export type SessionState = Common.SessionState;
|
|
153
|
+
export type LoadPhase = Common.LoadPhase;
|
|
154
|
+
export type Visibility = Common.Visibility;
|
|
155
|
+
export type LifecycleReason = Common.LifecycleReason;
|
|
156
|
+
export type RequestReason = Common.RequestReason;
|
|
157
|
+
export type RequestFailedMarker = Common.RequestFailedMarker;
|
|
158
|
+
export type RequestFailure = Common.RequestFailure;
|
|
159
|
+
export type ProductState = Common.ProductState;
|
|
160
|
+
export type PurchaseReason = Common.PurchaseReason;
|
|
161
|
+
export type GiftReason = Common.GiftReason;
|
|
162
|
+
export type OperationResult = Common.OperationResult;
|
|
163
|
+
export type SaveInfo = Common.SaveInfo;
|
|
164
|
+
export type SaveEvent = Common.SaveEvent;
|
|
165
|
+
export type Anomaly = Common.Anomaly;
|
|
166
|
+
export type GiftReceived = Common.GiftReceived;
|
|
167
|
+
export type VersionRecord = Common.VersionRecord;
|
|
168
|
+
export type ViolationKind = Common.ViolationKind;
|
|
169
|
+
export type SchemaViolation = Common.SchemaViolation;
|
|
170
|
+
export type FlushOptions = Common.FlushOptions;
|
|
171
|
+
export type UpdateOfflineOptions = Common.UpdateOfflineOptions;
|
|
172
|
+
export type RestoreOptions = Common.RestoreOptions;
|
|
173
|
+
export type CooldownOptions = Common.CooldownOptions;
|
|
174
|
+
export type MigrationContext = Common.MigrationContext;
|
|
175
|
+
export type BigScore = Common.BigScore;
|
|
176
|
+
export type LeaderboardEntry = Common.LeaderboardEntry;
|
|
177
|
+
export type LeaderboardStatus = Common.LeaderboardStatus;
|
|
178
|
+
export type LeaderboardStatusInfo = Common.LeaderboardStatusInfo;
|
|
179
|
+
export type LeaderboardSnapshotEntry = Common.LeaderboardSnapshotEntry;
|
|
180
|
+
export type PassConfig = Common.PassConfig;
|
|
181
|
+
export type PurchaseFilter = Common.PurchaseFilter;
|
|
182
|
+
export type PurchaseEntry = Common.PurchaseEntry;
|
|
183
|
+
export type PurchaseLogOptions = Common.PurchaseLogOptions;
|
|
184
|
+
export type ProductInfo = Common.ProductInfo;
|
|
185
|
+
export type PolicyInfo = Common.PolicyInfo;
|
|
186
|
+
export type ReceiptInfo = Common.ReceiptInfo;
|
|
187
|
+
export type EconomyMeta = Common.EconomyMeta;
|
|
188
|
+
export type EconomyFieldSpec = Common.EconomyFieldSpec;
|
|
189
|
+
export type EconomyCurrencyConfig = Common.EconomyCurrencyConfig;
|
|
190
|
+
export type EconomyLogFn = Common.EconomyLogFn;
|
|
191
|
+
export type EconomyConfig = Common.EconomyConfig;
|
|
192
|
+
export type ExchangeableSpec = Common.ExchangeableSpec;
|
|
193
|
+
export type ExchangeLeg = Common.ExchangeLeg;
|
|
194
|
+
export type OpenLeg = Common.OpenLeg;
|
|
195
|
+
export type OpenExchange = Common.OpenExchange;
|
|
196
|
+
export type ExchangeAPI = Common.ExchangeAPI;
|
|
197
|
+
export type BudgetSnapshot = Common.BudgetSnapshot;
|
|
198
|
+
export type MetricObservation = Common.MetricObservation;
|
|
199
|
+
export type Metrics = Common.Metrics;
|
|
200
|
+
export type Percentiles = Common.Percentiles;
|
|
201
|
+
export type PercentileSnapshot = Common.PercentileSnapshot;
|
|
202
|
+
export type AddonAction = Common.AddonAction;
|
|
203
|
+
export type AddonActions = Common.AddonActions;
|
|
204
|
+
export type ConfigureOptions = Common.ConfigureOptions;
|
|
205
|
+
export type StatusThresholds = Common.StatusThresholds;
|
|
206
|
+
export type PeriodResetOptions = Common.PeriodResetOptions;
|
|
207
|
+
export type MockState = Common.MockState;
|
|
208
|
+
interface ScribeModule {
|
|
209
|
+
readonly Reason: { readonly LoadFailed: "load-failed"; readonly MigrationFailed: "migration-failed"; readonly Erasing: "erasing"; readonly SessionEnded: "session-ended"; readonly PlayerLeft: "player-left"; readonly Shutdown: "shutdown"; readonly StillLoading: "still-loading"; readonly Timeout: "timeout"; };
|
|
210
|
+
readonly RequestReason: { readonly RateLimited: "rate-limited"; readonly NotReady: "not-ready"; readonly UnknownCommand: "unknown-command"; readonly BadArgs: "bad-args"; readonly BadIdempotencyKey: "bad-idempotency-key"; readonly Error: "error"; readonly ReplyEncodeFailed: "reply-encode-failed"; readonly Timeout: "timeout"; readonly SendFailed: "send-failed"; readonly EditMode: "edit-mode"; readonly MockError: "mock-error"; };
|
|
211
|
+
readonly PurchaseReason: { readonly DataNotLoaded: "player data not loaded"; readonly InvalidCostSpec: "invalid Cost spec"; readonly InvalidCostAmount: "invalid Cost amount"; readonly InvalidCostPath: "invalid cost path"; readonly CostPathNotSpendable: "cost path is not a spendable number"; readonly InsufficientFunds: "insufficient funds"; readonly PaidRandomRestricted: "paid random items are not available for this account"; readonly PolicyPending: "cannot check account settings right now; try again in a moment"; };
|
|
212
|
+
readonly GiftReason: { readonly ProductRetired: "product retired"; readonly BuyerDataNotLoaded: "buyer data not loaded"; readonly InvalidRecipient: "invalid recipient"; readonly CannotGiftYourself: "cannot gift yourself"; readonly GiftCooldown: "gift cooldown"; readonly TooManyPending: "too many pending gifts"; readonly DataServicesDown: "data services are experiencing issues; try again later"; readonly RecipientAlreadyOwns: "recipient already owns this"; readonly CreditReserveFailed: "could not reserve gift credit; try again later"; readonly DeliveryFailed: "could not deliver gift; try again later"; readonly DeliveryUnconfirmed: "gift delivery could not be confirmed; do not send it again"; readonly AlreadyPending: "a gift of this item is already pending; try again shortly"; readonly IntentRecordFailed: "could not record gift intent; try again later"; readonly PaidRandomRestricted: "paid random items are not available for this account"; readonly PolicyPending: "cannot check account settings right now; try again in a moment"; };
|
|
213
|
+
readonly ProductState: { readonly Purchasable: "purchasable"; readonly Owned: "owned"; readonly PaidRandomRestricted: "paid-random-restricted"; readonly PolicyPending: "policy-pending"; readonly NotLoaded: "not-loaded"; };
|
|
214
|
+
readonly OpKind: { readonly Init: "Init"; readonly Set: "Set"; readonly Insert: "Insert"; readonly Remove: "Remove"; readonly Clear: "Clear"; };
|
|
215
|
+
readonly LogLevel: { readonly Debug: "Debug"; readonly Info: "Info"; readonly Warn: "Warn"; readonly Error: "Error"; readonly Fatal: "Fatal"; };
|
|
216
|
+
readonly LogCategory: { readonly Persistence: "Persistence"; readonly Replication: "Replication"; readonly Transport: "Transport"; readonly Commands: "Commands"; readonly Leaderboards: "Leaderboards"; readonly Monetization: "Monetization"; readonly Gifting: "Gifting"; readonly Integrity: "Integrity"; readonly Lifecycle: "Lifecycle"; readonly Derived: "Derived"; readonly Exchanges: "Exchanges"; };
|
|
217
|
+
readonly Status: { readonly Healthy: "Healthy"; readonly Degraded: "Degraded"; readonly Outage: "Outage"; };
|
|
218
|
+
readonly LeaderboardStatus: { readonly Starting: "Starting"; readonly Healthy: "Healthy"; readonly Degraded: "Degraded"; };
|
|
219
|
+
readonly SessionState: { readonly Loading: "Loading"; readonly Ready: "Ready"; readonly SessionEnded: "SessionEnded"; };
|
|
220
|
+
readonly LoadPhase: { readonly WaitingForErase: "WaitingForErase"; readonly AcquiringSession: "AcquiringSession"; readonly ReadingProfile: "ReadingProfile"; readonly Retrying: "Retrying"; readonly Initializing: "Initializing"; readonly Importing: "Importing"; readonly ImportThrottled: "ImportThrottled"; };
|
|
221
|
+
readonly Visibility: { readonly Replicated: "Replicated"; readonly ServerOnly: "ServerOnly"; readonly Shared: "Shared"; };
|
|
222
|
+
readonly LifecycleReason: ScribeModule["Reason"];
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export = Scribe;
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/** Schema declarations have no JavaScript runtime; Scribe constructs the markers in Luau. */
|
|
2
|
+
declare const declaration: unique symbol;
|
|
3
|
+
export interface Declaration<K extends string, T> {
|
|
4
|
+
readonly [declaration]: readonly [K, T];
|
|
5
|
+
}
|
|
6
|
+
export type ServerOnly<T> = Declaration<"ServerOnly", T>;
|
|
7
|
+
export type Shared<T> = Declaration<"Shared", T>;
|
|
8
|
+
export type Session<T> = Declaration<"Session", T>;
|
|
9
|
+
export type Timed<T> = Declaration<"Timed", T>;
|
|
10
|
+
export type Derived<T> = Declaration<"Derived", T>;
|
|
11
|
+
export type Optional<T> = Declaration<"Optional", T>;
|
|
12
|
+
export type ArrayOf<T> = Declaration<"ArrayOf", T>;
|
|
13
|
+
export type DictOf<T> = Declaration<"DictOf", T>;
|
|
14
|
+
export type MapOf<K extends "integer" | "string", T> = Declaration<"MapOf", readonly [K, T]>;
|
|
15
|
+
export type SetOf<T> = Declaration<"SetOf", T>;
|
|
16
|
+
export type Flags<K extends string = string> = Declaration<"Flags", K>;
|
|
17
|
+
export type EnumValue<K extends string> = Declaration<"Enum", K>;
|
|
18
|
+
export type BigSchema = Declaration<"Big", BigValue>;
|
|
19
|
+
export type Disconnect = (this: void) => void;
|
|
20
|
+
/** Numeric strings are validated at runtime and limited to 256 bytes before whitespace removal. */
|
|
21
|
+
export type BigOperand = BigValue | number | string;
|
|
22
|
+
|
|
23
|
+
/** Immutable mantissa/exponent value. These are genuine Luau self methods. */
|
|
24
|
+
export interface BigValue {
|
|
25
|
+
readonly M: number;
|
|
26
|
+
readonly E: number;
|
|
27
|
+
Add(other: BigOperand): BigValue;
|
|
28
|
+
Subtract(other: BigOperand): BigValue;
|
|
29
|
+
Multiply(other: BigOperand): BigValue;
|
|
30
|
+
Divide(other: BigOperand): BigValue;
|
|
31
|
+
Negate(): BigValue;
|
|
32
|
+
Compare(other: BigOperand): number;
|
|
33
|
+
Equals(other: BigOperand): boolean;
|
|
34
|
+
Pow(exponent: number): BigValue;
|
|
35
|
+
Log10(): number;
|
|
36
|
+
Short(decimals?: number): string;
|
|
37
|
+
ToNumber(): number;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type Datatype = Vector3 | Vector2 | Vector3int16 | Vector2int16 | CFrame | Color3 |
|
|
41
|
+
BrickColor | UDim | UDim2 | Rect | NumberRange | NumberSequence | ColorSequence |
|
|
42
|
+
DateTime | EnumItem | Font | PhysicalProperties;
|
|
43
|
+
export type AtomicValue = Datatype | buffer | BigValue;
|
|
44
|
+
type Widen<T> = T extends number ? number : T extends boolean ? boolean : T extends string ? string : T;
|
|
45
|
+
type KeyOfMap<K> = K extends "integer" ? number : string;
|
|
46
|
+
type OptionalField<T> = undefined extends T ? true : T extends Declaration<infer K, infer V>
|
|
47
|
+
? K extends "Optional" ? true : K extends "ServerOnly" | "Shared" | "Session" ? OptionalField<V> : false
|
|
48
|
+
: false;
|
|
49
|
+
type Simplify<T> = { [K in keyof T]: T[K] };
|
|
50
|
+
type ValueRecord<T> = Simplify<{
|
|
51
|
+
-readonly [K in keyof T as OptionalField<T[K]> extends true ? never : K]: ValueOf<T[K]>;
|
|
52
|
+
} & {
|
|
53
|
+
-readonly [K in keyof T as OptionalField<T[K]> extends true ? K : never]?: ValueOf<T[K]>;
|
|
54
|
+
}>;
|
|
55
|
+
type InputRecord<T> = Simplify<{
|
|
56
|
+
readonly [K in keyof T as OptionalField<T[K]> extends true ? never : K]: InputOf<T[K]>;
|
|
57
|
+
} & {
|
|
58
|
+
readonly [K in keyof T as OptionalField<T[K]> extends true ? K : never]?: InputOf<T[K]>;
|
|
59
|
+
}>;
|
|
60
|
+
|
|
61
|
+
/** Plain, detached value shape; marker wrappers never appear in saved/read values. */
|
|
62
|
+
export type ValueOf<T> = T extends Declaration<infer K, infer V>
|
|
63
|
+
? K extends "Big" ? BigValue
|
|
64
|
+
: K extends "Enum" ? V
|
|
65
|
+
: K extends "Optional" ? ValueOf<V> | undefined
|
|
66
|
+
: K extends "Flags" ? Extract<V, string>[]
|
|
67
|
+
: K extends "ArrayOf" | "SetOf" ? ValueOf<V>[]
|
|
68
|
+
: K extends "DictOf" ? { [key: string]: ValueOf<V> | undefined }
|
|
69
|
+
: K extends "MapOf" ? V extends readonly [infer MK, infer MV] ? Map<KeyOfMap<MK>, ValueOf<MV>> : never
|
|
70
|
+
: ValueOf<V>
|
|
71
|
+
: T extends AtomicValue ? T
|
|
72
|
+
: T extends ReadonlyArray<infer E> ? ValueOf<E>[]
|
|
73
|
+
: T extends ReadonlyMap<infer K, infer V> ? Map<K, ValueOf<V>>
|
|
74
|
+
: T extends object ? ValueRecord<T>
|
|
75
|
+
: Widen<T>;
|
|
76
|
+
|
|
77
|
+
export type DeepReadonly<T> = T extends AtomicValue ? T
|
|
78
|
+
: T extends ReadonlyArray<infer V> ? ReadonlyArray<DeepReadonly<V>>
|
|
79
|
+
: T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, DeepReadonly<V>>
|
|
80
|
+
: T extends object ? { readonly [K in keyof T]: DeepReadonly<T[K]> } : T;
|
|
81
|
+
|
|
82
|
+
/** Accepted writes. Big values additionally accept numbers and decimal strings. */
|
|
83
|
+
export type InputOf<T> = T extends Declaration<infer K, infer V>
|
|
84
|
+
? K extends "Big" ? BigOperand
|
|
85
|
+
: K extends "Enum" ? V
|
|
86
|
+
: K extends "Optional" ? InputOf<V> | undefined
|
|
87
|
+
: K extends "Flags" ? ReadonlyArray<Extract<V, string>>
|
|
88
|
+
: K extends "ArrayOf" ? ReadonlyArray<ElementInput<V>>
|
|
89
|
+
: K extends "SetOf" ? ReadonlyArray<InputOf<V>>
|
|
90
|
+
: K extends "DictOf" ? { readonly [key: string]: ElementInput<V> | undefined }
|
|
91
|
+
: K extends "MapOf" ? V extends readonly [infer MK, infer MV] ? ReadonlyMap<KeyOfMap<MK>, ElementInput<MV>> : never
|
|
92
|
+
: InputOf<V>
|
|
93
|
+
: T extends Datatype | buffer ? T
|
|
94
|
+
: T extends BigValue ? BigOperand
|
|
95
|
+
: T extends ReadonlyArray<infer E> ? ReadonlyArray<InputOf<E>>
|
|
96
|
+
: T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, InputOf<V>>
|
|
97
|
+
: T extends object ? InputRecord<T>
|
|
98
|
+
: Widen<T>;
|
|
99
|
+
|
|
100
|
+
/** Declared container elements fill omitted record fields from their defaults. */
|
|
101
|
+
export type ElementInput<T> = T extends Declaration<infer K, infer V>
|
|
102
|
+
? K extends "ServerOnly" | "Shared" | "Session" | "Timed" | "Derived" ? ElementInput<V>
|
|
103
|
+
: K extends "Optional" ? ElementInput<V> | undefined
|
|
104
|
+
: InputOf<T>
|
|
105
|
+
: T extends AtomicValue ? InputOf<T>
|
|
106
|
+
: T extends ReadonlyArray<infer E> ? ReadonlyArray<InputOf<E>>
|
|
107
|
+
: T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<K, InputOf<V>>
|
|
108
|
+
: T extends object ? string extends keyof T ? InputOf<T>
|
|
109
|
+
: number extends keyof T ? InputOf<T>
|
|
110
|
+
: { readonly [K in keyof T]?: ElementInput<T[K]> }
|
|
111
|
+
: InputOf<T>;
|
|
112
|
+
type WriteInput<T, Closed extends boolean> = Closed extends true ? ElementInput<T> : InputOf<T>;
|
|
113
|
+
|
|
114
|
+
type Hidden<T> = T extends ServerOnly<unknown> ? true
|
|
115
|
+
: T extends Declaration<"Shared" | "Session" | "Timed" | "Optional" | "Derived", infer V> ? Hidden<V> : false;
|
|
116
|
+
export type ClientSchema<T> = T extends Declaration<infer K, infer V>
|
|
117
|
+
? K extends "ServerOnly" ? never
|
|
118
|
+
: K extends "MapOf" ? V extends readonly [infer MK, infer MV] ? MapOf<Extract<MK, "integer" | "string">, ClientSchema<MV>> : never
|
|
119
|
+
: K extends "Big" | "Flags" | "Enum" ? T
|
|
120
|
+
: Declaration<K, ClientSchema<V>>
|
|
121
|
+
: T extends AtomicValue ? T
|
|
122
|
+
: T extends ReadonlyArray<infer E> ? ClientSchema<E>[]
|
|
123
|
+
: T extends object ? { [K in keyof T as Hidden<T[K]> extends true ? never : K]: ClientSchema<T[K]> }
|
|
124
|
+
: T;
|
|
125
|
+
type IsShared<T> = T extends Shared<unknown> ? true
|
|
126
|
+
: T extends Session<infer V> ? IsShared<V> : false;
|
|
127
|
+
export type SharedSchema<T> = { [K in keyof T as IsShared<T[K]> extends true ? K : never]: ClientSchema<T[K]> };
|
|
128
|
+
|
|
129
|
+
/** Adapters can depend on this small structural interface without knowing a schema. */
|
|
130
|
+
export interface ReadableNode<T> {
|
|
131
|
+
readonly Get: (this: void) => T;
|
|
132
|
+
readonly Observe: (this: void, callback: (this: void, value: T) => void) => Disconnect;
|
|
133
|
+
readonly Changed: (this: void, callback: (this: void, value: T, previous: T) => void) => Disconnect;
|
|
134
|
+
}
|
|
135
|
+
type Maybe<T, Missing extends boolean> = Missing extends true ? T | undefined : T;
|
|
136
|
+
type Read<T, Missing extends boolean> = Maybe<DeepReadonly<ValueOf<T>>, Missing>;
|
|
137
|
+
interface ReadOperations<T, Missing extends boolean, Closed extends boolean> extends ReadableNode<Read<T, Missing>> {
|
|
138
|
+
/** Calling an accessor without arguments is its Get shorthand. */
|
|
139
|
+
(this: void): Read<T, Missing>;
|
|
140
|
+
readonly Clone: (this: void) => Maybe<ValueOf<T>, Missing>;
|
|
141
|
+
readonly Default: (this: void) => Missing extends true ? Closed extends true ? ValueOf<T> : ValueOf<T> | undefined : ValueOf<T>;
|
|
142
|
+
}
|
|
143
|
+
interface WriteOperations<T, Missing extends boolean, Closed extends boolean> {
|
|
144
|
+
(this: void, value: WriteInput<T, Closed>, replicate?: boolean): ValueOf<T>;
|
|
145
|
+
(this: void, update: (this: void, current: Read<T, Missing>) => WriteInput<T, Closed>, replicate?: boolean): ValueOf<T>;
|
|
146
|
+
readonly Set: (this: void, value: WriteInput<T, Closed>, replicate?: boolean) => ValueOf<T>;
|
|
147
|
+
readonly Update: (this: void, update: (this: void, current: Read<T, Missing>) => WriteInput<T, Closed>, replicate?: boolean) => ValueOf<T>;
|
|
148
|
+
}
|
|
149
|
+
type Unwrap<T> = T extends Declaration<"ServerOnly" | "Shared" | "Session" | "Timed" | "Derived" | "Optional", infer V> ? Unwrap<V> : Exclude<T, undefined>;
|
|
150
|
+
type HasKind<T, Kind extends string> = T extends Declaration<infer K, infer V>
|
|
151
|
+
? K extends Kind ? true : K extends "ServerOnly" | "Shared" | "Session" | "Timed" | "Derived" | "Optional" ? HasKind<V, Kind> : false
|
|
152
|
+
: false;
|
|
153
|
+
type IsReadOnly<T, ReadOnly extends boolean> = ReadOnly extends true ? true : HasKind<T, "Derived">;
|
|
154
|
+
type Mutate<T, Root extends boolean, Missing extends boolean, ReadOnly extends boolean, Closed extends boolean> = Root extends true ? {}
|
|
155
|
+
: IsReadOnly<T, ReadOnly> extends true ? {} : WriteOperations<T, Missing, Closed>;
|
|
156
|
+
type Bound = number | string;
|
|
157
|
+
type AmountOptions = boolean | import("./common").EconomyMeta;
|
|
158
|
+
interface NumberRead {
|
|
159
|
+
readonly Min: (this: void) => number | undefined;
|
|
160
|
+
readonly Max: (this: void) => number | undefined;
|
|
161
|
+
}
|
|
162
|
+
interface NumberWrite {
|
|
163
|
+
readonly Increment: (this: void, amount: number, options?: AmountOptions) => number;
|
|
164
|
+
readonly Decrement: (this: void, amount: number, options?: AmountOptions) => number;
|
|
165
|
+
}
|
|
166
|
+
interface BigRead {
|
|
167
|
+
readonly Min: (this: void) => Bound | undefined;
|
|
168
|
+
readonly Max: (this: void) => Bound | undefined;
|
|
169
|
+
}
|
|
170
|
+
interface BigWrite {
|
|
171
|
+
readonly Increment: (this: void, amount: BigOperand, options?: AmountOptions) => BigValue;
|
|
172
|
+
readonly Decrement: (this: void, amount: BigOperand, options?: AmountOptions) => BigValue;
|
|
173
|
+
readonly Multiply: (this: void, amount: BigOperand, replicate?: boolean) => BigValue;
|
|
174
|
+
readonly Divide: (this: void, amount: BigOperand, replicate?: boolean) => BigValue;
|
|
175
|
+
}
|
|
176
|
+
type WritableOnly<T, ReadOnly extends boolean, Methods> = IsReadOnly<T, ReadOnly> extends true ? {} : Methods;
|
|
177
|
+
type ScalarMethods<T, ReadOnly extends boolean> = Unwrap<T> extends number ? NumberRead & WritableOnly<T, ReadOnly, NumberWrite>
|
|
178
|
+
: Unwrap<T> extends boolean ? WritableOnly<T, ReadOnly, { readonly Toggle: (this: void, replicate?: boolean) => boolean }>
|
|
179
|
+
: Unwrap<T> extends BigSchema | BigValue ? BigRead & WritableOnly<T, ReadOnly, BigWrite> : {};
|
|
180
|
+
|
|
181
|
+
type ChildEvents<K, V> = {
|
|
182
|
+
readonly OnChildChanged: (this: void, callback: (this: void, key: K, value: DeepReadonly<V> | undefined, previous: DeepReadonly<V> | undefined) => void) => Disconnect;
|
|
183
|
+
};
|
|
184
|
+
type CollectionRead<K, E, ReadOnly extends boolean, Closed extends boolean> = ChildEvents<K, ValueOf<E>> & {
|
|
185
|
+
/** Exact Luau key. Array positions start at 1; map keys are never shifted. */
|
|
186
|
+
readonly Child: (this: void, key: K) => Accessor<E, false, true, ReadOnly, Closed>;
|
|
187
|
+
readonly Count: (this: void) => number;
|
|
188
|
+
};
|
|
189
|
+
type ArrayMethods<T, E, ReadOnly extends boolean, Closed extends boolean> = CollectionRead<number, E, ReadOnly, Closed> & {
|
|
190
|
+
readonly [index: number]: Accessor<E, false, true, ReadOnly, Closed>;
|
|
191
|
+
readonly Find: (this: void, value: InputOf<E>) => number | undefined;
|
|
192
|
+
readonly Has: (this: void, value: InputOf<E>) => boolean;
|
|
193
|
+
readonly OnInsert: (this: void, callback: (this: void, value: DeepReadonly<ValueOf<E>>, index: number) => void) => Disconnect;
|
|
194
|
+
readonly OnRemove: (this: void, callback: (this: void, value: DeepReadonly<ValueOf<E>>, index: number) => void) => Disconnect;
|
|
195
|
+
} & WritableOnly<T, ReadOnly, {
|
|
196
|
+
readonly Insert: (this: void, value: WriteInput<E, Closed>, position?: number, replicate?: boolean) => void;
|
|
197
|
+
readonly Remove: (this: void, position?: number, replicate?: boolean) => ValueOf<E> | undefined;
|
|
198
|
+
readonly RemoveValue: (this: void, value: InputOf<E>, replicate?: boolean) => LuaTuple<[ValueOf<E> | undefined, number | undefined]>;
|
|
199
|
+
readonly Clear: (this: void, replicate?: boolean) => void;
|
|
200
|
+
}>;
|
|
201
|
+
type DictMethods<T, K extends string | number, E, ReadOnly extends boolean, Closed extends boolean> = CollectionRead<K, E, ReadOnly, Closed> & {
|
|
202
|
+
readonly [P in K]: Accessor<E, false, true, ReadOnly, Closed>;
|
|
203
|
+
} & {
|
|
204
|
+
readonly OnKeyAdded: (this: void, callback: (this: void, key: K, value: DeepReadonly<ValueOf<E>>) => void) => Disconnect;
|
|
205
|
+
readonly OnKeyRemoved: (this: void, callback: (this: void, key: K, value: DeepReadonly<ValueOf<E>>) => void) => Disconnect;
|
|
206
|
+
} & WritableOnly<T, ReadOnly, {
|
|
207
|
+
readonly Remove: (this: void, key: K, replicate?: boolean) => ValueOf<E> | undefined;
|
|
208
|
+
readonly Clear: (this: void, replicate?: boolean) => void;
|
|
209
|
+
}>;
|
|
210
|
+
type SetMethods<T, E, ReadOnly extends boolean> = {
|
|
211
|
+
readonly Has: (this: void, value: InputOf<E>) => boolean;
|
|
212
|
+
readonly Find: (this: void, value: InputOf<E>) => number | undefined;
|
|
213
|
+
readonly Count: (this: void) => number;
|
|
214
|
+
} & WritableOnly<T, ReadOnly, {
|
|
215
|
+
readonly Add: (this: void, value: InputOf<E>, replicate?: boolean) => boolean;
|
|
216
|
+
readonly Remove: (this: void, value: InputOf<E>, replicate?: boolean) => boolean;
|
|
217
|
+
readonly Clear: (this: void, replicate?: boolean) => void;
|
|
218
|
+
}>;
|
|
219
|
+
type FlagsMethods<T, K extends string, ReadOnly extends boolean> = {
|
|
220
|
+
readonly Has: (this: void, member: K) => boolean;
|
|
221
|
+
} & WritableOnly<T, ReadOnly, {
|
|
222
|
+
readonly Enable: (this: void, member: K, replicate?: boolean) => void;
|
|
223
|
+
readonly Disable: (this: void, member: K, replicate?: boolean) => void;
|
|
224
|
+
readonly Toggle: (this: void, member: K, replicate?: boolean) => boolean;
|
|
225
|
+
readonly Clear: (this: void, replicate?: boolean) => void;
|
|
226
|
+
}>;
|
|
227
|
+
type ReservedMethod = "Get" | "Set" | "Update" | "Clone" | "Default" | "Changed" | "Observe" | "Child" |
|
|
228
|
+
"OnChildChanged" | "Count" | "Clear" | "Insert" | "Remove" | "RemoveValue" | "Find" | "Has" |
|
|
229
|
+
"OnInsert" | "OnRemove" | "OnKeyAdded" | "OnKeyRemoved" | "Increment" | "Decrement" | "Min" | "Max" |
|
|
230
|
+
"Toggle" | "Enable" | "Disable" | "Add" | "Multiply" | "Divide" | "SetTimed" | "ExtendTimed" | "Active";
|
|
231
|
+
type ChildMissing<T, Missing extends boolean> = Missing extends true ? true : OptionalField<T>;
|
|
232
|
+
type RecordMethods<T, S, Missing extends boolean, ReadOnly extends boolean, Closed extends boolean> = {
|
|
233
|
+
readonly [K in keyof S as K extends ReservedMethod ? never : K]-?: Accessor<S[K], false, ChildMissing<T, Missing>, IsReadOnly<T, ReadOnly>, Closed>;
|
|
234
|
+
} & {
|
|
235
|
+
readonly Child: <K extends Extract<keyof S, string | number>>(this: void, key: K) => Accessor<S[K], false, ChildMissing<T, Missing>, IsReadOnly<T, ReadOnly>, Closed>;
|
|
236
|
+
} & ChildEvents<Extract<keyof S, string | number>, ValueOf<S[keyof S]>>;
|
|
237
|
+
|
|
238
|
+
type ShapeMethods<T, S, Missing extends boolean, ReadOnly extends boolean, Closed extends boolean> = S extends ArrayOf<infer E>
|
|
239
|
+
? ArrayMethods<T, E, ReadOnly, true>
|
|
240
|
+
: S extends DictOf<infer E> ? DictMethods<T, string, E, ReadOnly, true>
|
|
241
|
+
: S extends MapOf<infer K, infer E> ? DictMethods<T, KeyOfMap<K>, E, ReadOnly, true>
|
|
242
|
+
: S extends SetOf<infer E> ? SetMethods<T, E, ReadOnly>
|
|
243
|
+
: S extends Flags<infer K> ? FlagsMethods<T, K, ReadOnly>
|
|
244
|
+
: S extends Declaration<string, unknown> | AtomicValue ? {}
|
|
245
|
+
: S extends ReadonlyArray<infer E> ? ArrayMethods<T, E, ReadOnly, false>
|
|
246
|
+
: S extends object ? string extends keyof S ? DictMethods<T, string, S[string & keyof S], ReadOnly, false>
|
|
247
|
+
: number extends keyof S ? ArrayMethods<T, S[number & keyof S], ReadOnly, false>
|
|
248
|
+
: RecordMethods<T, S, Missing, ReadOnly, Closed>
|
|
249
|
+
: {};
|
|
250
|
+
type TimedMethods<T, ReadOnly extends boolean> = HasKind<T, "Timed"> extends true ? {
|
|
251
|
+
/** Timer state and seconds left. Clients read replicated deadlines; inactive returns false, undefined. */
|
|
252
|
+
readonly Active: (this: void) => LuaTuple<[boolean, number | undefined]>;
|
|
253
|
+
} & WritableOnly<T, ReadOnly, {
|
|
254
|
+
readonly SetTimed: (this: void, value: InputOf<T>, seconds: number, replicate?: boolean) => void;
|
|
255
|
+
readonly ExtendTimed: (this: void, seconds: number, replicate?: boolean) => void;
|
|
256
|
+
}> : {};
|
|
257
|
+
|
|
258
|
+
/** Accessors are proxy objects, never native Array/Map instances. */
|
|
259
|
+
export type Accessor<T, Root extends boolean = false, Missing extends boolean = false, ReadOnly extends boolean = false, Closed extends boolean = false> =
|
|
260
|
+
ReadOperations<T, Missing, Closed> & Mutate<T, Root, Missing, ReadOnly, Closed> & ScalarMethods<T, ReadOnly> &
|
|
261
|
+
ShapeMethods<T, Unwrap<T>, Missing, ReadOnly, Closed> & TimedMethods<T, ReadOnly>;
|
|
262
|
+
export type PlayerData<T> = Accessor<T, true>;
|
|
263
|
+
export type ReadonlyAccessor<T, Root extends boolean = false> = Accessor<T, Root, false, true>;
|
|
264
|
+
|
|
265
|
+
type Join<K extends string, P> = P extends string ? `${K}.${P}` : never;
|
|
266
|
+
/** Static numeric leaf paths only. Dynamic keys require a runtime-validated path. */
|
|
267
|
+
export type NumericPaths<T, IncludeBig extends boolean = false, Depth extends unknown[] = []> =
|
|
268
|
+
Depth extends [unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown] ? never
|
|
269
|
+
: Unwrap<T> extends number ? ""
|
|
270
|
+
: Unwrap<T> extends BigSchema | BigValue ? IncludeBig extends true ? "" : never
|
|
271
|
+
: Unwrap<T> extends AtomicValue | Declaration<string, unknown> | ReadonlyArray<unknown> ? never
|
|
272
|
+
: Unwrap<T> extends object ? {
|
|
273
|
+
[K in Extract<keyof Unwrap<T>, string>]: string extends K ? never :
|
|
274
|
+
NumericPaths<Unwrap<T>[K], IncludeBig, [...Depth, unknown]> extends infer P
|
|
275
|
+
? P extends "" ? K : Join<K, P> : never
|
|
276
|
+
}[Extract<keyof Unwrap<T>, string>] : never;
|