@sf-kmods/kdataforgejs 2026.4.19 → 2026.4.23
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/declarations.json +1 -1
- package/index.d.ts +210 -12
- package/lib/kdfjs-es2020.d.ts +2 -2
- package/package.json +1 -1
package/declarations.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"package": "@sf-kmods/kdataforgejs",
|
|
4
4
|
"baseDeclaration": "@sf-kmods/kdataforgejs/index.d.ts",
|
|
5
5
|
"typeGenerator": {
|
|
6
|
-
"formatVersion":
|
|
6
|
+
"formatVersion": 10,
|
|
7
7
|
"outputPrefix": "typescript/kdataforgejs",
|
|
8
8
|
"generatedDeclaration": "typescript/kdataforgejs/kdataforge.generated.d.ts",
|
|
9
9
|
"artifacts": [
|
package/index.d.ts
CHANGED
|
@@ -5,7 +5,11 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
5
5
|
export interface CapabilityMap {
|
|
6
6
|
readonly "kdf.behavior.runtime": true;
|
|
7
7
|
readonly "kdf.classes.define": true;
|
|
8
|
+
readonly "kdf.config.read": true;
|
|
9
|
+
readonly "kdf.conditions.evaluate": true;
|
|
10
|
+
readonly "kdf.diagnostics.write": true;
|
|
8
11
|
readonly "kdf.documents.apply": true;
|
|
12
|
+
readonly "kdf.events.custom": true;
|
|
9
13
|
readonly "kdf.imports.read": true;
|
|
10
14
|
readonly "kdf.items.define": true;
|
|
11
15
|
readonly "kdf.items.read": true;
|
|
@@ -19,6 +23,7 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
19
23
|
readonly "kdf.reflection.read": true;
|
|
20
24
|
readonly "kdf.reflection.write": true;
|
|
21
25
|
readonly "kdf.script.admin": true;
|
|
26
|
+
readonly "kdf.world.read": true;
|
|
22
27
|
}
|
|
23
28
|
export type Capability = keyof CapabilityMap & string;
|
|
24
29
|
export interface Meta { readonly capabilities: readonly Capability[]; }
|
|
@@ -81,7 +86,12 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
81
86
|
}[keyof NativeClassPathMap & string];
|
|
82
87
|
export interface ClassSearchParams {
|
|
83
88
|
readonly pathPrefix?: string;
|
|
89
|
+
readonly pathContains?: string;
|
|
90
|
+
readonly namePrefix?: string;
|
|
84
91
|
readonly nameContains?: string;
|
|
92
|
+
readonly exactName?: string;
|
|
93
|
+
readonly exactClass?: boolean;
|
|
94
|
+
readonly caseSensitive?: boolean;
|
|
85
95
|
readonly includeNative?: boolean;
|
|
86
96
|
readonly includeBlueprints?: boolean;
|
|
87
97
|
readonly limit?: number;
|
|
@@ -169,12 +179,91 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
169
179
|
readonly authors: string; readonly docsUrl: string; readonly supportUrl: string;
|
|
170
180
|
}
|
|
171
181
|
export interface PackMeta { readonly reference: string; readonly name: string; readonly version: string; readonly priority: number; }
|
|
172
|
-
export interface
|
|
182
|
+
export interface ConditionMap {
|
|
183
|
+
readonly gameVersion?: string;
|
|
184
|
+
readonly hasMod?: string | readonly string[];
|
|
185
|
+
readonly modVersion?: Readonly<Record<string, string>>;
|
|
186
|
+
readonly hasClass?: string | readonly string[];
|
|
187
|
+
readonly config?: string | readonly string[];
|
|
188
|
+
readonly ifNotMatch?: boolean;
|
|
189
|
+
}
|
|
190
|
+
export interface Conditions {
|
|
191
|
+
all(conditions: readonly boolean[]): boolean;
|
|
192
|
+
any(conditions: readonly boolean[]): boolean;
|
|
193
|
+
evaluate(conditions: ConditionMap | readonly ConditionMap[], behavior?: "AND" | "OR"): boolean;
|
|
194
|
+
evaluate(conditions: ConditionMap | readonly ConditionMap[], any: boolean): ConditionResult;
|
|
195
|
+
evaluateResult(conditions: ConditionMap | readonly ConditionMap[], any?: boolean): ConditionResult;
|
|
196
|
+
}
|
|
197
|
+
export type ConfigScalar = boolean | number | bigint | string;
|
|
198
|
+
export type ConfigValue = ConfigScalar | readonly ConfigScalar[];
|
|
199
|
+
export interface ConfigValueMap { }
|
|
200
|
+
export interface ConfigChange<T = ConfigValue> { readonly id: string; readonly value: T; readonly previous: T; }
|
|
201
|
+
export interface PackConfig {
|
|
202
|
+
has(id: string): boolean;
|
|
203
|
+
snapshot(id: string): ConfigSnapshot;
|
|
204
|
+
onChange(id: string, key: string, callback: (snapshot: ConfigSnapshot) => void): Subscription;
|
|
205
|
+
get<K extends keyof ConfigValueMap & string>(id: K): ConfigValueMap[K] | null;
|
|
206
|
+
get(id: string): ConfigValue | null;
|
|
207
|
+
onChange<K extends keyof ConfigValueMap & string>(id: K, callback: (change: ConfigChange<ConfigValueMap[K]>) => void): Subscription;
|
|
208
|
+
onChange(id: string, callback: (change: ConfigChange) => void): Subscription;
|
|
209
|
+
}
|
|
210
|
+
export interface ActorFilter {
|
|
211
|
+
readonly nameContains?: string; readonly pathPrefix?: string;
|
|
212
|
+
readonly tags?: string | readonly string[]; readonly tagMatch?: "all" | "any";
|
|
213
|
+
readonly exactClass?: boolean; readonly caseSensitive?: boolean;
|
|
214
|
+
}
|
|
215
|
+
export interface ActorQuery extends ActorFilter { readonly limit?: number; readonly after?: string; }
|
|
216
|
+
export interface WorldActorQuery extends ActorFilter { readonly limit?: number; }
|
|
217
|
+
export interface ActorPage<T extends UObject> { readonly actors: readonly T[]; readonly nextCursor: string | null; }
|
|
218
|
+
export type ActorChange<T extends UObject> = Readonly<{ kind: "added"; actor: T; path: string }> | Readonly<{ kind: "removed"; actor: null; path: string }>;
|
|
219
|
+
export interface ActorObservationOptions { readonly includeExisting?: boolean; }
|
|
220
|
+
export interface ConditionResult {
|
|
221
|
+
readonly outcome: "match" | "noMatch" | "deferred" | "invalid";
|
|
222
|
+
readonly readConfigKeys: readonly string[];
|
|
223
|
+
}
|
|
224
|
+
export interface ConfigSnapshot {
|
|
225
|
+
readonly found: boolean; readonly value: ConfigValue | undefined; readonly revision: bigint;
|
|
226
|
+
readonly cold: boolean; readonly hostMismatch: boolean;
|
|
227
|
+
}
|
|
228
|
+
export type ConfigAccess = PackConfig;
|
|
229
|
+
export interface KDFError extends Error {
|
|
230
|
+
readonly name: "KDFError"; readonly code: string;
|
|
231
|
+
readonly details: { readonly source: string; readonly line: number; readonly column: number };
|
|
232
|
+
}
|
|
233
|
+
export interface RuntimeStats {
|
|
234
|
+
/** Actual native authoring binding wall time; diagnostics only, not deterministic gameplay input. */
|
|
235
|
+
readonly authoringBindingCalls: bigint; readonly authoringBindingSeconds: number;
|
|
236
|
+
readonly suppressedConsoleMessages: bigint; readonly consoleMessages: number; readonly consoleBytes: number;
|
|
237
|
+
readonly maxConsoleMessages: number; readonly maxConsoleBytes: number;
|
|
238
|
+
readonly subscriptions: number; readonly maxSubscriptions: number;
|
|
239
|
+
}
|
|
240
|
+
export interface SeededRandom { next(): number; nextUInt32(): number; }
|
|
241
|
+
export interface WorldQueryResult<T extends UObject> {
|
|
242
|
+
readonly items: readonly T[]; readonly visited: number; readonly truncated: boolean;
|
|
243
|
+
}
|
|
244
|
+
export interface WorldAccess {
|
|
245
|
+
info(): { readonly mapName: string; readonly dedicatedServer: boolean; readonly gameTimeSeconds: number };
|
|
246
|
+
findActors<C extends Class<UObject>>(type: C, query?: number | WorldActorQuery): WorldQueryResult<ClassValue<C>>;
|
|
247
|
+
/** Requires an imported PlayerState-derived class and runtime server authority. */
|
|
248
|
+
players(query?: number | WorldActorQuery): WorldQueryResult<UObject>;
|
|
249
|
+
}
|
|
250
|
+
export type EventScalarType = "boolean" | "int64" | "uint64" | "number" | "string";
|
|
251
|
+
export type EventSchema = Readonly<Record<string, EventScalarType>>;
|
|
252
|
+
export type EventPayload<S extends EventSchema> = {
|
|
253
|
+
readonly [K in keyof S]: S[K] extends "boolean" ? boolean :
|
|
254
|
+
S[K] extends "int64" | "uint64" ? bigint : S[K] extends "number" ? number : string;
|
|
255
|
+
};
|
|
256
|
+
const customEventBrand: unique symbol;
|
|
257
|
+
export interface CustomEvent<S extends EventSchema> { readonly [customEventBrand]: S; }
|
|
173
258
|
export type Comparable = string | number | bigint;
|
|
174
259
|
export type Falsy = false | 0 | 0n | "" | null | undefined;
|
|
175
260
|
export type Truthy<T> = T extends Falsy ? never : T;
|
|
176
261
|
export type OmitKeys<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
177
262
|
export interface ArrayHelpers {
|
|
263
|
+
range(end: number): number[]; range(start: number, end: number, step?: number): number[];
|
|
264
|
+
sample<T>(values: readonly T[], random?: () => number): T | undefined;
|
|
265
|
+
shuffle<T>(values: readonly T[], random?: () => number): T[];
|
|
266
|
+
windowed<T>(values: readonly T[], size: number, step?: number): T[][];
|
|
178
267
|
chunk<T>(values: readonly T[], size: number): T[][];
|
|
179
268
|
compact<T>(values: readonly T[]): Array<Truthy<T>>;
|
|
180
269
|
unique<T>(values: readonly T[]): T[];
|
|
@@ -222,7 +311,9 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
222
311
|
remap(value: number, sourceStart: number, sourceEnd: number, targetStart: number, targetEnd: number): number;
|
|
223
312
|
wrap(value: number, minimum: number, maximum: number): number; roundTo(value: number, step?: number): number;
|
|
224
313
|
floorTo(value: number, step?: number): number; ceilTo(value: number, step?: number): number;
|
|
225
|
-
sum(values: readonly number[]): number;
|
|
314
|
+
sum(values: readonly number[]): number; sumBy<T>(values: readonly T[], select: (value: T, index: number) => number): number;
|
|
315
|
+
average(values: readonly number[]): number | undefined;
|
|
316
|
+
averageBy<T>(values: readonly T[], select: (value: T, index: number) => number): number | undefined;
|
|
226
317
|
median(values: readonly number[]): number | undefined; mode(values: readonly number[]): number | undefined;
|
|
227
318
|
min(values: readonly number[]): number | undefined; max(values: readonly number[]): number | undefined;
|
|
228
319
|
product(values: readonly number[]): number; percentage(value: number, total: number): number;
|
|
@@ -282,6 +373,13 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
282
373
|
times<T>(count: number, callback: (index: number) => T): T[];
|
|
283
374
|
tryOr<T>(callback: () => T, fallback: T | ((error: unknown) => T)): T;
|
|
284
375
|
}
|
|
376
|
+
export type Settled<T> = Readonly<{ status: "fulfilled"; value: T }> | Readonly<{ status: "rejected"; reason: unknown }>;
|
|
377
|
+
export interface PromiseHelpers {
|
|
378
|
+
mapSeries<T, R>(values: readonly T[], transform: (value: T, index: number) => R | PromiseLike<R>): Promise<R[]>;
|
|
379
|
+
filterSeries<T>(values: readonly T[], predicate: (value: T, index: number) => unknown | PromiseLike<unknown>): Promise<T[]>;
|
|
380
|
+
eachSeries<T>(values: readonly T[], effect: (value: T, index: number) => unknown | PromiseLike<unknown>): Promise<void>;
|
|
381
|
+
settle<T>(value: T | PromiseLike<T>): Promise<Settled<T>>;
|
|
382
|
+
}
|
|
285
383
|
export interface SemVer {
|
|
286
384
|
readonly major: number; readonly minor: number; readonly patch: number;
|
|
287
385
|
readonly prerelease: readonly (string | number)[]; readonly build: readonly string[];
|
|
@@ -309,6 +407,7 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
309
407
|
export const guards: Readonly<GuardHelpers>;
|
|
310
408
|
export const collections: Readonly<CollectionHelpers>;
|
|
311
409
|
export const functions: Readonly<FunctionHelpers>;
|
|
410
|
+
export const promises: Readonly<PromiseHelpers>;
|
|
312
411
|
export const semver: Readonly<SemVerHelpers>;
|
|
313
412
|
/** Canonical descriptor identity. `id` names authored content; `classPath` names an existing soft class path. */
|
|
314
413
|
export type ItemReference = Readonly<{ id: string }> | Readonly<{ classPath: string }>;
|
|
@@ -332,11 +431,14 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
332
431
|
/** Anything the export does not describe, such as sub categories as class handles. */
|
|
333
432
|
readonly extra?: ExtraWrites;
|
|
334
433
|
}
|
|
335
|
-
export interface RecipeDefinition {
|
|
434
|
+
export interface RecipeDefinition<C extends Class<UObject> = Class<UObject>> {
|
|
435
|
+
/** Defaults to FGRecipe. Non-default parent must be an authorized, loaded recipe class. */
|
|
436
|
+
readonly parent?: ItemReference | C;
|
|
336
437
|
readonly id: string; readonly ingredients: readonly ItemAmount[]; readonly products: readonly ItemAmount[];
|
|
337
438
|
readonly producedIn: readonly ItemReference[]; readonly durationSeconds: number;
|
|
338
439
|
readonly displayName?: LocalizedText; readonly manualMultiplier?: number; readonly menuPriority?: number | bigint;
|
|
339
440
|
readonly register?: boolean; readonly categories?: readonly string[];
|
|
441
|
+
readonly properties?: PropertyWrites<ClassValue<C>>;
|
|
340
442
|
/** Property writes on the generated recipe class that the fixed fields do not cover. */
|
|
341
443
|
readonly extra?: ExtraWrites;
|
|
342
444
|
}
|
|
@@ -346,17 +448,28 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
346
448
|
/** One bounded handler-owned map entry. Handler validation still enforces its detailed native schema. */
|
|
347
449
|
export type KDFDocumentEntry = Readonly<Record<string, StructuredInputValue>>;
|
|
348
450
|
export interface KDFPropertyOperation extends KDFDocumentEntry { readonly path: string; readonly op?: string; readonly value?: StructuredInputValue; }
|
|
451
|
+
/** Shared create/update schema used by the native content-class handlers. Property paths stay handler-validated. */
|
|
452
|
+
export interface GeneratedContentEntry extends KDFDocumentEntry {
|
|
453
|
+
readonly id: string; readonly parent?: string; readonly properties?: readonly KDFPropertyOperation[];
|
|
454
|
+
readonly register?: boolean;
|
|
455
|
+
}
|
|
456
|
+
export interface RegisteredContentEntry extends KDFDocumentEntry {
|
|
457
|
+
readonly class: string; readonly properties?: readonly KDFPropertyOperation[]; readonly register?: boolean;
|
|
458
|
+
}
|
|
459
|
+
export type ContentClassEntry = GeneratedContentEntry | RegisteredContentEntry;
|
|
460
|
+
/** Native removal filters are validated by the selected handler and use the same transactional document seam. */
|
|
461
|
+
export type ContentRemoval = string | KDFDocumentEntry;
|
|
349
462
|
export interface KDFCdoPatch extends KDFDocumentEntry { readonly target?: string; readonly properties: readonly KDFPropertyOperation[]; }
|
|
350
463
|
export interface CdoDocument extends KDFDocument { readonly type: "cdo"; readonly patches: readonly KDFCdoPatch[]; }
|
|
351
464
|
export interface AssetDocument extends KDFDocument { readonly type: "asset"; readonly assets: readonly KDFDocumentEntry[]; }
|
|
352
465
|
export interface DataAssetDocument extends KDFDocument { readonly type: "dataasset"; readonly assets: readonly KDFDocumentEntry[]; }
|
|
353
|
-
export interface ItemDocument extends KDFDocument { readonly type: "item"; readonly items: readonly
|
|
354
|
-
export interface ResourceDocument extends KDFDocument { readonly type: "resource"; readonly resources: readonly
|
|
355
|
-
export interface BuildingDocument extends KDFDocument { readonly type: "building"; readonly buildings: readonly
|
|
356
|
-
export interface UnlockDocument extends KDFDocument { readonly type: "unlock"; readonly unlocks: readonly
|
|
357
|
-
export interface RecipeDocument extends KDFDocument { readonly type: "recipe"; readonly recipes
|
|
358
|
-
export interface SchematicDocument extends KDFDocument { readonly type: "schematic"; readonly schematics
|
|
359
|
-
export interface ResearchDocument extends KDFDocument { readonly type: "research"; readonly research
|
|
466
|
+
export interface ItemDocument extends KDFDocument { readonly type: "item"; readonly items: readonly GeneratedContentEntry[]; }
|
|
467
|
+
export interface ResourceDocument extends KDFDocument { readonly type: "resource"; readonly resources: readonly GeneratedContentEntry[]; }
|
|
468
|
+
export interface BuildingDocument extends KDFDocument { readonly type: "building"; readonly buildings: readonly GeneratedContentEntry[]; }
|
|
469
|
+
export interface UnlockDocument extends KDFDocument { readonly type: "unlock"; readonly unlocks: readonly GeneratedContentEntry[]; }
|
|
470
|
+
export interface RecipeDocument extends KDFDocument { readonly type: "recipe"; readonly recipes?: readonly ContentClassEntry[]; readonly remove?: readonly ContentRemoval[]; }
|
|
471
|
+
export interface SchematicDocument extends KDFDocument { readonly type: "schematic"; readonly schematics?: readonly ContentClassEntry[]; readonly remove?: readonly ContentRemoval[]; }
|
|
472
|
+
export interface ResearchDocument extends KDFDocument { readonly type: "research"; readonly research?: readonly ContentClassEntry[]; readonly remove?: readonly ContentRemoval[]; }
|
|
360
473
|
export interface CurveDocument extends KDFDocument { readonly type: "curve"; readonly curveType: "float" | "vector"; readonly curves: readonly KDFDocumentEntry[]; }
|
|
361
474
|
export interface LocalizationDocument extends KDFDocument { readonly type: "localization"; readonly namespace: string; readonly culture?: string; readonly entries: Readonly<Record<string, StructuredInputValue>>; }
|
|
362
475
|
export interface GameTagDocument extends KDFDocument { readonly type: "gametag"; readonly tags: readonly StructuredInputValue[]; }
|
|
@@ -387,8 +500,90 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
387
500
|
export type HandlerDocument<K extends HandlerKey> = HandlerDocumentMap[K];
|
|
388
501
|
|
|
389
502
|
/** Frozen context supplied to default main. Every member below is installed by KDFJSRuntime. */
|
|
503
|
+
export type Promisify<F> = F extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> : never;
|
|
504
|
+
export type PromiseRootMethod =
|
|
505
|
+
"catalog" | "runtimeStats" | "lookupItem" | "lookupRecipe" | "resolve" | "removeItem" | "removeRecipe" |
|
|
506
|
+
"defineClass" | "import" | "listMods" | "getModMeta" |
|
|
507
|
+
"isModLoaded" | "listPacks" | "getPackMeta" | "isPackLoaded" | "gameVersion" |
|
|
508
|
+
"spawnActorById" | "destroyActor" | "modifyActorById" | "createBehavior" |
|
|
509
|
+
"destroyBehavior" | "unregisterBehavior" | "unregisterBehaviorClass";
|
|
510
|
+
/** Settled wrappers around immediate host calls. Calls still execute synchronously; rejection captures thrown KDF errors. */
|
|
511
|
+
export type PromiseContext = Readonly<{ [K in PromiseRootMethod]: Promisify<Context[K]> }> & {
|
|
512
|
+
readonly getClass: {
|
|
513
|
+
<C extends Class<UObject>, P extends NativeClassPathFor<C>>(type: C, path: P, options: CheckedLookupOptions): Promise<C>;
|
|
514
|
+
<C extends Class<UObject>, P extends NativeClassPathFor<C>>(type: C, path: P, options?: LookupOptions): Promise<C | null>;
|
|
515
|
+
};
|
|
516
|
+
readonly getObject: {
|
|
517
|
+
<C extends Class<UObject>>(type: C, path: string, options: CheckedLookupOptions): Promise<ClassValue<C>>;
|
|
518
|
+
<C extends Class<UObject>>(type: C, path: string, options?: LookupOptions): Promise<ClassValue<C> | null>;
|
|
519
|
+
};
|
|
520
|
+
readonly getDataAsset: {
|
|
521
|
+
<C extends Class<UObject>>(type: C, path: string, options: CheckedLookupOptions): Promise<ClassValue<C>>;
|
|
522
|
+
<C extends Class<UObject>>(type: C, path: string, options?: LookupOptions): Promise<ClassValue<C> | null>;
|
|
523
|
+
};
|
|
524
|
+
readonly cast: {
|
|
525
|
+
<C extends Class<UObject>>(type: C, value: Class<UObject>, options: CheckedLookupOptions): Promise<Class<ClassValue<C>>>;
|
|
526
|
+
<C extends Class<UObject>>(type: C, value: Class<UObject>, options?: LookupOptions): Promise<Class<ClassValue<C>> | null>;
|
|
527
|
+
<C extends Class<UObject>>(type: C, value: UObject, options: CheckedLookupOptions): Promise<ClassValue<C>>;
|
|
528
|
+
<C extends Class<UObject>>(type: C, value: UObject, options?: LookupOptions): Promise<ClassValue<C> | null>;
|
|
529
|
+
};
|
|
530
|
+
readonly findClasses: <C extends Class<UObject>>(type: C, search?: ClassSearchParams) => Promise<readonly C[]>;
|
|
531
|
+
readonly findActors: <C extends Class<UObject>>(type: C, query?: ActorQuery) => Promise<ActorPage<ClassValue<C>>>;
|
|
532
|
+
readonly batch: <T extends readonly InputValue[]>(writes: {
|
|
533
|
+
readonly [K in keyof T]: { readonly property: WritableValueRef<T[K]>; readonly value: NoInfer<T[K]> };
|
|
534
|
+
}) => Promise<void>;
|
|
535
|
+
readonly createItem: <C extends Class<UObject> = Class<UObject>>(definition: ItemDefinition<C>) => Promise<ContentRef<"item">>;
|
|
536
|
+
readonly updateItem: <C extends Class<UObject> = Class<UObject>>(definition: ItemDefinition<C>) => Promise<ContentRef<"item">>;
|
|
537
|
+
readonly createRecipe: <C extends Class<UObject> = Class<UObject>>(definition: RecipeDefinition<C>) => Promise<ContentRef<"recipe">>;
|
|
538
|
+
readonly updateRecipe: <C extends Class<UObject> = Class<UObject>>(definition: RecipeDefinition<C>) => Promise<ContentRef<"recipe">>;
|
|
539
|
+
readonly applyDocument: <K extends HandlerKey>(handlerId: K, document: HandlerDocumentMap[NoInfer<K>]) => Promise<void>;
|
|
540
|
+
readonly spawnActor: <K extends ActorClassKey>(
|
|
541
|
+
classDescriptorId: K, initialWrites?: ActorInitialWrites<K>
|
|
542
|
+
) => Promise<CatalogActor<K>>;
|
|
543
|
+
readonly modifyActor: <K extends ActorClassKey, P extends ActorPropertyKey<K>>(
|
|
544
|
+
actor: CatalogActor<K>, propertyId: P, value: ActorPropertyValue<K, P>
|
|
545
|
+
) => Promise<void>;
|
|
546
|
+
readonly config: Readonly<{
|
|
547
|
+
has(id: string): Promise<boolean>; snapshot(id: string): Promise<ConfigSnapshot>;
|
|
548
|
+
get<K extends keyof ConfigValueMap & string>(id: K): Promise<ConfigValueMap[K] | null>;
|
|
549
|
+
get(id: string): Promise<ConfigValue | null>;
|
|
550
|
+
}>;
|
|
551
|
+
readonly world: Readonly<{
|
|
552
|
+
info(): Promise<{ readonly mapName: string; readonly dedicatedServer: boolean; readonly gameTimeSeconds: number }>;
|
|
553
|
+
findActors<C extends Class<UObject>>(type: C, query?: number | WorldActorQuery): Promise<WorldQueryResult<ClassValue<C>>>;
|
|
554
|
+
players(query?: number | WorldActorQuery): Promise<WorldQueryResult<UObject>>;
|
|
555
|
+
}>;
|
|
556
|
+
readonly conditions: Readonly<{
|
|
557
|
+
evaluate(conditions: ConditionMap | readonly ConditionMap[], behavior?: "AND" | "OR"): Promise<boolean>;
|
|
558
|
+
evaluate(conditions: ConditionMap | readonly ConditionMap[], any: boolean): Promise<ConditionResult>;
|
|
559
|
+
evaluateResult(conditions: ConditionMap | readonly ConditionMap[], any?: boolean): Promise<ConditionResult>;
|
|
560
|
+
}>;
|
|
561
|
+
readonly diagnostics: Readonly<{
|
|
562
|
+
add(severity: "info" | "warning" | "error", message: string, authoredPath?: string): Promise<void>;
|
|
563
|
+
}>;
|
|
564
|
+
};
|
|
565
|
+
|
|
390
566
|
export interface Context {
|
|
391
567
|
readonly catalog: () => Catalog;
|
|
568
|
+
/** Bounded, side-effect-free summary: no getters, proxies, toJSON or object coercion. */
|
|
569
|
+
readonly inspect: (value: unknown) => string;
|
|
570
|
+
readonly runtimeStats: () => RuntimeStats;
|
|
571
|
+
readonly diagnostics: { add(severity: "info" | "warning" | "error", message: string, authoredPath?: string): void; };
|
|
572
|
+
readonly world: WorldAccess;
|
|
573
|
+
readonly promises: PromiseContext;
|
|
574
|
+
/** Local game time, affected by pause/dilation; never a cross-peer deterministic clock. */
|
|
575
|
+
readonly now: () => number;
|
|
576
|
+
readonly random: (seed: string) => SeededRandom;
|
|
577
|
+
readonly defineEvent: <const S extends EventSchema>(id: string, schema: S) => CustomEvent<S>;
|
|
578
|
+
readonly onCustom: <S extends EventSchema>(event: CustomEvent<S>, key: string, callback: (payload: EventPayload<NoInfer<S>>) => void) => Subscription;
|
|
579
|
+
readonly emit: <S extends EventSchema>(event: CustomEvent<S>, payload: EventPayload<NoInfer<S>>) => void;
|
|
580
|
+
/** Atomic, bounded property transaction. Tracked refs and function calls are rejected. */
|
|
581
|
+
readonly batch: <T extends readonly InputValue[]>(writes: {
|
|
582
|
+
readonly [K in keyof T]: { readonly property: WritableValueRef<T[K]>; readonly value: NoInfer<T[K]> };
|
|
583
|
+
}) => void;
|
|
584
|
+
readonly lookupItem: (id: string, pack?: string) => Class<UObject> | null;
|
|
585
|
+
readonly lookupRecipe: (id: string, pack?: string) => Class<UObject> | null;
|
|
586
|
+
readonly resolve: (reference: ContentRef<"item" | "recipe">, pack?: string) => Class<UObject> | null;
|
|
392
587
|
/** Lowercase MD5 digest of UTF-8 text. */
|
|
393
588
|
readonly md5: (text: string) => string;
|
|
394
589
|
/** Lowercase SHA-1 digest of UTF-8 text. */
|
|
@@ -421,11 +616,14 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
421
616
|
<C extends Class<UObject>>(type: C, value: UObject, options?: LookupOptions): ClassValue<C> | null;
|
|
422
617
|
};
|
|
423
618
|
readonly findClasses: <C extends Class<UObject>>(type: C, search?: ClassSearchParams) => readonly C[];
|
|
619
|
+
readonly config: PackConfig;
|
|
620
|
+
readonly findActors: <C extends Class<UObject>>(type: C, query?: ActorQuery) => ActorPage<ClassValue<C>>;
|
|
621
|
+
readonly observeActors: <C extends Class<UObject>>(type: C, callback: (change: ActorChange<ClassValue<C>>) => void, options?: ActorObservationOptions) => Subscription;
|
|
424
622
|
readonly createItem: <C extends Class<UObject> = Class<UObject>>(definition: ItemDefinition<C>) => ContentRef<"item">;
|
|
425
623
|
readonly updateItem: <C extends Class<UObject> = Class<UObject>>(definition: ItemDefinition<C>) => ContentRef<"item">;
|
|
426
624
|
readonly removeItem: (id: string) => ContentRef<"item">;
|
|
427
|
-
readonly createRecipe: (definition: RecipeDefinition) => ContentRef<"recipe">;
|
|
428
|
-
readonly updateRecipe: (definition: RecipeDefinition) => ContentRef<"recipe">;
|
|
625
|
+
readonly createRecipe: <C extends Class<UObject> = Class<UObject>>(definition: RecipeDefinition<C>) => ContentRef<"recipe">;
|
|
626
|
+
readonly updateRecipe: <C extends Class<UObject> = Class<UObject>>(definition: RecipeDefinition<C>) => ContentRef<"recipe">;
|
|
429
627
|
readonly removeRecipe: (id: string) => ContentRef<"recipe">;
|
|
430
628
|
readonly applyDocument: <K extends HandlerKey>(handlerId: K, document: HandlerDocumentMap[NoInfer<K>]) => void;
|
|
431
629
|
readonly defineClass: (definition: ClassDefinition) => DynamicClassHandle;
|
package/lib/kdfjs-es2020.d.ts
CHANGED
|
@@ -82,6 +82,6 @@ interface CallSite { isNative(): boolean; isConstructor(): boolean; getFileName(
|
|
|
82
82
|
interface DOMException extends Error { readonly name: string; readonly message: string; readonly code: number; readonly INDEX_SIZE_ERR: 1; readonly DOMSTRING_SIZE_ERR: 2; readonly HIERARCHY_REQUEST_ERR: 3; readonly WRONG_DOCUMENT_ERR: 4; readonly INVALID_CHARACTER_ERR: 5; readonly NO_DATA_ALLOWED_ERR: 6; readonly NO_MODIFICATION_ALLOWED_ERR: 7; readonly NOT_FOUND_ERR: 8; readonly NOT_SUPPORTED_ERR: 9; readonly INUSE_ATTRIBUTE_ERR: 10; readonly INVALID_STATE_ERR: 11; readonly SYNTAX_ERR: 12; readonly INVALID_MODIFICATION_ERR: 13; readonly NAMESPACE_ERR: 14; readonly INVALID_ACCESS_ERR: 15; readonly VALIDATION_ERR: 16; readonly TYPE_MISMATCH_ERR: 17; readonly SECURITY_ERR: 18; readonly NETWORK_ERR: 19; readonly ABORT_ERR: 20; readonly URL_MISMATCH_ERR: 21; readonly QUOTA_EXCEEDED_ERR: 22; readonly TIMEOUT_ERR: 23; readonly INVALID_NODE_TYPE_ERR: 24; readonly DATA_CLONE_ERR: 25; } interface DOMExceptionConstructor extends DOMException { new(message?: string, name?: string): DOMException; readonly prototype: DOMException; } declare const DOMException: DOMExceptionConstructor;
|
|
83
83
|
declare function atob(value: string): string; declare function btoa(value: string): string; declare function escape(value: string): string; declare function unescape(value: string): string;
|
|
84
84
|
interface Performance { readonly timeOrigin: number; now(): number; } declare const performance: Performance;
|
|
85
|
-
/** Bounded KDataForgeJS logging. No
|
|
86
|
-
interface Console { log(...data: readonly unknown[]): void; info(...data: readonly unknown[]): void; warn(...data: readonly unknown[]): void; error(...data: readonly unknown[]): void; debug(...data: readonly unknown[]): void; }
|
|
85
|
+
/** Bounded KDataForgeJS logging. No grouping, timing, or trace APIs; table output is safely summarized. */
|
|
86
|
+
interface Console { log(...data: readonly unknown[]): void; info(...data: readonly unknown[]): void; warn(...data: readonly unknown[]): void; error(...data: readonly unknown[]): void; debug(...data: readonly unknown[]): void; table(data: unknown): void; }
|
|
87
87
|
declare const console: Console;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sf-kmods/kdataforgejs",
|
|
3
|
-
"version": "2026.4.
|
|
3
|
+
"version": "2026.4.23",
|
|
4
4
|
"description": "TypeScript types for KDataForgeJS packs: declarations of the built-in @sf-kmods/kdataforgejs module plus a strict tsconfig base.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Kyri123/Kyrium",
|