@sf-kmods/kdataforgejs 2026.4.20 → 2026.4.24
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 +179 -13
- 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,9 +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.conditions.evaluate": true;
|
|
9
8
|
readonly "kdf.config.read": true;
|
|
9
|
+
readonly "kdf.conditions.evaluate": true;
|
|
10
|
+
readonly "kdf.diagnostics.write": true;
|
|
10
11
|
readonly "kdf.documents.apply": true;
|
|
12
|
+
readonly "kdf.events.custom": true;
|
|
11
13
|
readonly "kdf.imports.read": true;
|
|
12
14
|
readonly "kdf.items.define": true;
|
|
13
15
|
readonly "kdf.items.read": true;
|
|
@@ -84,7 +86,12 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
84
86
|
}[keyof NativeClassPathMap & string];
|
|
85
87
|
export interface ClassSearchParams {
|
|
86
88
|
readonly pathPrefix?: string;
|
|
89
|
+
readonly pathContains?: string;
|
|
90
|
+
readonly namePrefix?: string;
|
|
87
91
|
readonly nameContains?: string;
|
|
92
|
+
readonly exactName?: string;
|
|
93
|
+
readonly exactClass?: boolean;
|
|
94
|
+
readonly caseSensitive?: boolean;
|
|
88
95
|
readonly includeNative?: boolean;
|
|
89
96
|
readonly includeBlueprints?: boolean;
|
|
90
97
|
readonly limit?: number;
|
|
@@ -184,26 +191,79 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
184
191
|
all(conditions: readonly boolean[]): boolean;
|
|
185
192
|
any(conditions: readonly boolean[]): boolean;
|
|
186
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;
|
|
187
196
|
}
|
|
188
197
|
export type ConfigScalar = boolean | number | bigint | string;
|
|
189
198
|
export type ConfigValue = ConfigScalar | readonly ConfigScalar[];
|
|
190
199
|
export interface ConfigValueMap { }
|
|
191
200
|
export interface ConfigChange<T = ConfigValue> { readonly id: string; readonly value: T; readonly previous: T; }
|
|
192
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;
|
|
193
205
|
get<K extends keyof ConfigValueMap & string>(id: K): ConfigValueMap[K] | null;
|
|
194
206
|
get(id: string): ConfigValue | null;
|
|
195
207
|
onChange<K extends keyof ConfigValueMap & string>(id: K, callback: (change: ConfigChange<ConfigValueMap[K]>) => void): Subscription;
|
|
196
208
|
onChange(id: string, callback: (change: ConfigChange) => void): Subscription;
|
|
197
209
|
}
|
|
198
|
-
export interface
|
|
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; }
|
|
199
217
|
export interface ActorPage<T extends UObject> { readonly actors: readonly T[]; readonly nextCursor: string | null; }
|
|
200
218
|
export type ActorChange<T extends UObject> = Readonly<{ kind: "added"; actor: T; path: string }> | Readonly<{ kind: "removed"; actor: null; path: string }>;
|
|
201
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; }
|
|
202
258
|
export type Comparable = string | number | bigint;
|
|
203
259
|
export type Falsy = false | 0 | 0n | "" | null | undefined;
|
|
204
260
|
export type Truthy<T> = T extends Falsy ? never : T;
|
|
205
261
|
export type OmitKeys<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
|
206
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[][];
|
|
207
267
|
chunk<T>(values: readonly T[], size: number): T[][];
|
|
208
268
|
compact<T>(values: readonly T[]): Array<Truthy<T>>;
|
|
209
269
|
unique<T>(values: readonly T[]): T[];
|
|
@@ -251,7 +311,9 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
251
311
|
remap(value: number, sourceStart: number, sourceEnd: number, targetStart: number, targetEnd: number): number;
|
|
252
312
|
wrap(value: number, minimum: number, maximum: number): number; roundTo(value: number, step?: number): number;
|
|
253
313
|
floorTo(value: number, step?: number): number; ceilTo(value: number, step?: number): number;
|
|
254
|
-
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;
|
|
255
317
|
median(values: readonly number[]): number | undefined; mode(values: readonly number[]): number | undefined;
|
|
256
318
|
min(values: readonly number[]): number | undefined; max(values: readonly number[]): number | undefined;
|
|
257
319
|
product(values: readonly number[]): number; percentage(value: number, total: number): number;
|
|
@@ -311,6 +373,13 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
311
373
|
times<T>(count: number, callback: (index: number) => T): T[];
|
|
312
374
|
tryOr<T>(callback: () => T, fallback: T | ((error: unknown) => T)): T;
|
|
313
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
|
+
}
|
|
314
383
|
export interface SemVer {
|
|
315
384
|
readonly major: number; readonly minor: number; readonly patch: number;
|
|
316
385
|
readonly prerelease: readonly (string | number)[]; readonly build: readonly string[];
|
|
@@ -338,6 +407,7 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
338
407
|
export const guards: Readonly<GuardHelpers>;
|
|
339
408
|
export const collections: Readonly<CollectionHelpers>;
|
|
340
409
|
export const functions: Readonly<FunctionHelpers>;
|
|
410
|
+
export const promises: Readonly<PromiseHelpers>;
|
|
341
411
|
export const semver: Readonly<SemVerHelpers>;
|
|
342
412
|
/** Canonical descriptor identity. `id` names authored content; `classPath` names an existing soft class path. */
|
|
343
413
|
export type ItemReference = Readonly<{ id: string }> | Readonly<{ classPath: string }>;
|
|
@@ -361,11 +431,14 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
361
431
|
/** Anything the export does not describe, such as sub categories as class handles. */
|
|
362
432
|
readonly extra?: ExtraWrites;
|
|
363
433
|
}
|
|
364
|
-
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;
|
|
365
437
|
readonly id: string; readonly ingredients: readonly ItemAmount[]; readonly products: readonly ItemAmount[];
|
|
366
438
|
readonly producedIn: readonly ItemReference[]; readonly durationSeconds: number;
|
|
367
439
|
readonly displayName?: LocalizedText; readonly manualMultiplier?: number; readonly menuPriority?: number | bigint;
|
|
368
440
|
readonly register?: boolean; readonly categories?: readonly string[];
|
|
441
|
+
readonly properties?: PropertyWrites<ClassValue<C>>;
|
|
369
442
|
/** Property writes on the generated recipe class that the fixed fields do not cover. */
|
|
370
443
|
readonly extra?: ExtraWrites;
|
|
371
444
|
}
|
|
@@ -375,17 +448,28 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
375
448
|
/** One bounded handler-owned map entry. Handler validation still enforces its detailed native schema. */
|
|
376
449
|
export type KDFDocumentEntry = Readonly<Record<string, StructuredInputValue>>;
|
|
377
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;
|
|
378
462
|
export interface KDFCdoPatch extends KDFDocumentEntry { readonly target?: string; readonly properties: readonly KDFPropertyOperation[]; }
|
|
379
463
|
export interface CdoDocument extends KDFDocument { readonly type: "cdo"; readonly patches: readonly KDFCdoPatch[]; }
|
|
380
464
|
export interface AssetDocument extends KDFDocument { readonly type: "asset"; readonly assets: readonly KDFDocumentEntry[]; }
|
|
381
465
|
export interface DataAssetDocument extends KDFDocument { readonly type: "dataasset"; readonly assets: readonly KDFDocumentEntry[]; }
|
|
382
|
-
export interface ItemDocument extends KDFDocument { readonly type: "item"; readonly items: readonly
|
|
383
|
-
export interface ResourceDocument extends KDFDocument { readonly type: "resource"; readonly resources: readonly
|
|
384
|
-
export interface BuildingDocument extends KDFDocument { readonly type: "building"; readonly buildings: readonly
|
|
385
|
-
export interface UnlockDocument extends KDFDocument { readonly type: "unlock"; readonly unlocks: readonly
|
|
386
|
-
export interface RecipeDocument extends KDFDocument { readonly type: "recipe"; readonly recipes
|
|
387
|
-
export interface SchematicDocument extends KDFDocument { readonly type: "schematic"; readonly schematics
|
|
388
|
-
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[]; }
|
|
389
473
|
export interface CurveDocument extends KDFDocument { readonly type: "curve"; readonly curveType: "float" | "vector"; readonly curves: readonly KDFDocumentEntry[]; }
|
|
390
474
|
export interface LocalizationDocument extends KDFDocument { readonly type: "localization"; readonly namespace: string; readonly culture?: string; readonly entries: Readonly<Record<string, StructuredInputValue>>; }
|
|
391
475
|
export interface GameTagDocument extends KDFDocument { readonly type: "gametag"; readonly tags: readonly StructuredInputValue[]; }
|
|
@@ -416,8 +500,90 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
416
500
|
export type HandlerDocument<K extends HandlerKey> = HandlerDocumentMap[K];
|
|
417
501
|
|
|
418
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
|
+
|
|
419
566
|
export interface Context {
|
|
420
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;
|
|
421
587
|
/** Lowercase MD5 digest of UTF-8 text. */
|
|
422
588
|
readonly md5: (text: string) => string;
|
|
423
589
|
/** Lowercase SHA-1 digest of UTF-8 text. */
|
|
@@ -456,8 +622,8 @@ declare module "@sf-kmods/kdataforgejs" {
|
|
|
456
622
|
readonly createItem: <C extends Class<UObject> = Class<UObject>>(definition: ItemDefinition<C>) => ContentRef<"item">;
|
|
457
623
|
readonly updateItem: <C extends Class<UObject> = Class<UObject>>(definition: ItemDefinition<C>) => ContentRef<"item">;
|
|
458
624
|
readonly removeItem: (id: string) => ContentRef<"item">;
|
|
459
|
-
readonly createRecipe: (definition: RecipeDefinition) => ContentRef<"recipe">;
|
|
460
|
-
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">;
|
|
461
627
|
readonly removeRecipe: (id: string) => ContentRef<"recipe">;
|
|
462
628
|
readonly applyDocument: <K extends HandlerKey>(handlerId: K, document: HandlerDocumentMap[NoInfer<K>]) => void;
|
|
463
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.24",
|
|
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",
|