@trioforge/crucible 0.0.0-stage → 0.2.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/client/package.json +4 -0
- package/emit/package.json +4 -0
- package/out/all.d.ts +7 -0
- package/out/all.luau +2 -0
- package/out/attribute.d.ts +7 -0
- package/out/attribute.luau +7 -0
- package/out/client/index.d.ts +10 -0
- package/out/client/init.luau +55 -0
- package/out/configs.d.ts +37 -0
- package/out/configs.luau +46 -0
- package/out/crucible-behaviour.d.ts +16 -0
- package/out/crucible-behaviour.luau +78 -0
- package/out/crucible-object.d.ts +10 -0
- package/out/crucible-object.luau +69 -0
- package/out/data.d.ts +224 -0
- package/out/data.luau +97 -0
- package/out/emit/configs.d.ts +4 -0
- package/out/emit/configs.luau +22 -0
- package/out/emit/data.d.ts +6 -0
- package/out/emit/data.luau +19 -0
- package/out/emit/index.d.ts +45 -0
- package/out/emit/init.luau +101 -0
- package/out/emit/network.d.ts +6 -0
- package/out/emit/network.luau +36 -0
- package/out/emit/replicated.d.ts +4 -0
- package/out/emit/replicated.luau +13 -0
- package/out/index.d.ts +20 -0
- package/out/init.luau +34 -0
- package/out/inject.d.ts +1 -0
- package/out/inject.luau +7 -0
- package/out/internal/binding.d.ts +1 -0
- package/out/internal/binding.luau +615 -0
- package/out/internal/boot.d.ts +1 -0
- package/out/internal/boot.luau +562 -0
- package/out/internal/configs/limits.d.ts +10 -0
- package/out/internal/configs/limits.luau +25 -0
- package/out/internal/configs/port.d.ts +29 -0
- package/out/internal/configs/port.luau +99 -0
- package/out/internal/configs/runtime.d.ts +21 -0
- package/out/internal/configs/runtime.luau +981 -0
- package/out/internal/construction-claim.d.ts +1 -0
- package/out/internal/construction-claim.luau +26 -0
- package/out/internal/data/admission.d.ts +1 -0
- package/out/internal/data/admission.luau +673 -0
- package/out/internal/data/declarations.d.ts +1 -0
- package/out/internal/data/declarations.luau +384 -0
- package/out/internal/data/envelope.d.ts +1 -0
- package/out/internal/data/envelope.luau +318 -0
- package/out/internal/data/handles.d.ts +1 -0
- package/out/internal/data/handles.luau +255 -0
- package/out/internal/data/inbox-transforms.d.ts +1 -0
- package/out/internal/data/inbox-transforms.luau +458 -0
- package/out/internal/data/inbox.d.ts +1 -0
- package/out/internal/data/inbox.luau +437 -0
- package/out/internal/data/lease.d.ts +1 -0
- package/out/internal/data/lease.luau +304 -0
- package/out/internal/data/limits.d.ts +1 -0
- package/out/internal/data/limits.luau +234 -0
- package/out/internal/data/messages.d.ts +1 -0
- package/out/internal/data/messages.luau +69 -0
- package/out/internal/data/operation-id.d.ts +1 -0
- package/out/internal/data/operation-id.luau +61 -0
- package/out/internal/data/paths.d.ts +2 -0
- package/out/internal/data/paths.luau +323 -0
- package/out/internal/data/port.d.ts +1 -0
- package/out/internal/data/port.luau +290 -0
- package/out/internal/data/profiles.d.ts +1 -0
- package/out/internal/data/profiles.luau +862 -0
- package/out/internal/data/receipts.d.ts +1 -0
- package/out/internal/data/receipts.luau +190 -0
- package/out/internal/data/record-bindings.d.ts +1 -0
- package/out/internal/data/record-bindings.luau +92 -0
- package/out/internal/data/record-declarations.d.ts +1 -0
- package/out/internal/data/record-declarations.luau +140 -0
- package/out/internal/data/records.d.ts +1 -0
- package/out/internal/data/records.luau +400 -0
- package/out/internal/data/runtime.d.ts +1 -0
- package/out/internal/data/runtime.luau +918 -0
- package/out/internal/data/scheduler.d.ts +1 -0
- package/out/internal/data/scheduler.luau +507 -0
- package/out/internal/data/session.d.ts +1 -0
- package/out/internal/data/session.luau +234 -0
- package/out/internal/data/shutdown.d.ts +1 -0
- package/out/internal/data/shutdown.luau +91 -0
- package/out/internal/data/waiters.d.ts +1 -0
- package/out/internal/data/waiters.luau +65 -0
- package/out/internal/dense-list.d.ts +1 -0
- package/out/internal/dense-list.luau +155 -0
- package/out/internal/diagnostics.d.ts +1 -0
- package/out/internal/diagnostics.luau +29 -0
- package/out/internal/hooks.d.ts +1 -0
- package/out/internal/hooks.luau +53 -0
- package/out/internal/implementers.d.ts +1 -0
- package/out/internal/implementers.luau +119 -0
- package/out/internal/lifecycle.d.ts +1 -0
- package/out/internal/lifecycle.luau +912 -0
- package/out/internal/log-output.d.ts +1 -0
- package/out/internal/log-output.luau +106 -0
- package/out/internal/network/catalog.d.ts +26 -0
- package/out/internal/network/catalog.luau +182 -0
- package/out/internal/network/claims.d.ts +1 -0
- package/out/internal/network/claims.luau +154 -0
- package/out/internal/network/client-session.d.ts +1 -0
- package/out/internal/network/client-session.luau +403 -0
- package/out/internal/network/codec.d.ts +63 -0
- package/out/internal/network/codec.luau +1183 -0
- package/out/internal/network/envelope.d.ts +1 -0
- package/out/internal/network/envelope.luau +247 -0
- package/out/internal/network/limits.d.ts +26 -0
- package/out/internal/network/limits.luau +55 -0
- package/out/internal/network/port.d.ts +1 -0
- package/out/internal/network/port.luau +19 -0
- package/out/internal/network/roblox-network-port.d.ts +1 -0
- package/out/internal/network/roblox-network-port.luau +105 -0
- package/out/internal/network/schema.d.ts +72 -0
- package/out/internal/network/schema.luau +386 -0
- package/out/internal/network/server-session.d.ts +1 -0
- package/out/internal/network/server-session.luau +393 -0
- package/out/internal/network/session.d.ts +1 -0
- package/out/internal/network/session.luau +266 -0
- package/out/internal/port.d.ts +1 -0
- package/out/internal/port.luau +12 -0
- package/out/internal/reactive/context.d.ts +1 -0
- package/out/internal/reactive/context.luau +149 -0
- package/out/internal/reactive/flush.d.ts +1 -0
- package/out/internal/reactive/flush.luau +355 -0
- package/out/internal/reactive/graph.d.ts +1 -0
- package/out/internal/reactive/graph.luau +626 -0
- package/out/internal/reactive/limits.d.ts +1 -0
- package/out/internal/reactive/limits.luau +54 -0
- package/out/internal/reactive/ownership.d.ts +1 -0
- package/out/internal/reactive/ownership.luau +626 -0
- package/out/internal/registry.d.ts +1 -0
- package/out/internal/registry.luau +455 -0
- package/out/internal/roblox-port.d.ts +1 -0
- package/out/internal/roblox-port.luau +117 -0
- package/out/internal/runner.d.ts +1 -0
- package/out/internal/runner.luau +86 -0
- package/out/internal/scheduler.d.ts +1 -0
- package/out/internal/scheduler.luau +207 -0
- package/out/internal/state.d.ts +1 -0
- package/out/internal/state.luau +41 -0
- package/out/internal/sync/client-sync.d.ts +1 -0
- package/out/internal/sync/client-sync.luau +157 -0
- package/out/internal/sync/declarations.d.ts +1 -0
- package/out/internal/sync/declarations.luau +276 -0
- package/out/internal/sync/frame.d.ts +1 -0
- package/out/internal/sync/frame.luau +91 -0
- package/out/internal/sync/server-sync.d.ts +1 -0
- package/out/internal/sync/server-sync.luau +502 -0
- package/out/internal/sync/values.d.ts +1 -0
- package/out/internal/sync/values.luau +930 -0
- package/out/log-level.d.ts +7 -0
- package/out/log-level.luau +21 -0
- package/out/logging.d.ts +34 -0
- package/out/logging.luau +233 -0
- package/out/network.d.ts +66 -0
- package/out/network.luau +24 -0
- package/out/reactive.d.ts +76 -0
- package/out/reactive.luau +136 -0
- package/out/replicated.d.ts +38 -0
- package/out/replicated.luau +45 -0
- package/out/server/data.d.ts +54 -0
- package/out/server/data.luau +44 -0
- package/out/server/index.d.ts +18 -0
- package/out/server/init.luau +62 -0
- package/out/server/publish.d.ts +20 -0
- package/out/server/publish.luau +24 -0
- package/out/subsystem.d.ts +4 -0
- package/out/subsystem.luau +30 -0
- package/out/vide/index.d.ts +7 -0
- package/out/vide/init.luau +50 -0
- package/package.json +52 -5
- package/server/package.json +4 -0
- package/transformer/data.cjs +72 -0
- package/transformer/declarations.cjs +153 -0
- package/transformer/diagnostics.cjs +19 -0
- package/transformer/index.js +741 -0
- package/transformer/network.cjs +961 -0
- package/transformer/type-id.cjs +80 -0
- package/vide/package.json +4 -0
- package/README.md +0 -3
package/out/data.luau
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _declarations = TS.import(script, script.Parent, "internal", "data", "declarations")
|
|
4
|
+
local markServerOnly = _declarations.markServerOnly
|
|
5
|
+
local replicatedPathsOf = _declarations.replicatedPathsOf
|
|
6
|
+
--* A value a save can hold: JSON, with absent keys for values that admit `undefined`.
|
|
7
|
+
--* A saved record: string keys to JSON.
|
|
8
|
+
--[[
|
|
9
|
+
*
|
|
10
|
+
* One schema step. It gets a private copy of the stored record, unknown keys included, as plain JSON, and returns a
|
|
11
|
+
* patch: an object merges into the stored object, any other value replaces the stored one, and an omitted key is kept.
|
|
12
|
+
* A step cannot delete a key. Steps are append-only and must be pure.
|
|
13
|
+
|
|
14
|
+
]]
|
|
15
|
+
--[[
|
|
16
|
+
*
|
|
17
|
+
* The identity of one logical operation, kept across its retries. Only `operationId()` makes one; a plain string does
|
|
18
|
+
* not type-check. It carries its creation time, which bounds how long it deduplicates.
|
|
19
|
+
|
|
20
|
+
]]
|
|
21
|
+
--* Why a store call did not complete.
|
|
22
|
+
--* A store call's result: narrow `ok` before reading `value`.
|
|
23
|
+
--[[
|
|
24
|
+
*
|
|
25
|
+
* A template field the owner's client never receives. The brand is phantom; `serverOnly(value)` also marks the value at
|
|
26
|
+
* runtime, and the declaration checks that the two agree.
|
|
27
|
+
|
|
28
|
+
]]
|
|
29
|
+
--* What the server reads and writes: the template's type with every `ServerOnly` unwrapped, deeply readonly.
|
|
30
|
+
--* A `ServerOnly` field, or a plain object field whose every field is server-only in turn.
|
|
31
|
+
--[[
|
|
32
|
+
*
|
|
33
|
+
* What the owner's client reads: every `ServerOnly` field removed, and every plain object left with no field, at any
|
|
34
|
+
* depth. Deeply readonly.
|
|
35
|
+
|
|
36
|
+
]]
|
|
37
|
+
--* A store's server data type, for helper signatures: `export type PlayerData = Profile<typeof PlayerData>`.
|
|
38
|
+
--* A store's client data type.
|
|
39
|
+
--[[
|
|
40
|
+
*
|
|
41
|
+
* A server handle's own members. `h()` reads, tracked and frozen; while the profile is not writable it returns the
|
|
42
|
+
* template's value at the path. `set` and `update` are one write each through the store's gate and return its result.
|
|
43
|
+
|
|
44
|
+
]]
|
|
45
|
+
--* An array handle's writes. Indices are TypeScript's, from 0.
|
|
46
|
+
--* A server handle at a position of type `V`: reads `V | A`, writes `V`, and reaches its children by key.
|
|
47
|
+
--* A client handle: the same paths and reads as the server's, and no writes.
|
|
48
|
+
--* Why a profile loaded.
|
|
49
|
+
--* Why a profile is releasing.
|
|
50
|
+
--* A developer product purchase, read from Roblox's receipt.
|
|
51
|
+
--[[
|
|
52
|
+
*
|
|
53
|
+
* A grant callback's fourth argument. It stages an effect that runs once, on a fresh thread, after the grant is durably
|
|
54
|
+
* saved and before the purchase is acknowledged; never after a refused grant.
|
|
55
|
+
|
|
56
|
+
]]
|
|
57
|
+
--* A field holding it is the claim. Not callable.
|
|
58
|
+
--* A durable message to one player's profile, declared in a server module. Invariant in `P`.
|
|
59
|
+
--* One quarantined message, for recovery tooling. The payload is the stored JSON, unknown keys included.
|
|
60
|
+
--* Why a save or handoff did not confirm.
|
|
61
|
+
--* A save or handoff result: narrow `ok` first.
|
|
62
|
+
--[[
|
|
63
|
+
*
|
|
64
|
+
* A profile store: one shared declaration, callable on both sides. The server calls it with a player for that player's
|
|
65
|
+
* writable handle; the client calls it with nothing for the local player's read-only handle.
|
|
66
|
+
|
|
67
|
+
]]
|
|
68
|
+
--* A profile store's options.
|
|
69
|
+
--* The handle member names. A template key with one of these names, at any depth, does not compile.
|
|
70
|
+
--[[
|
|
71
|
+
*
|
|
72
|
+
* Declares a profile store by its DataStore name. It must initialize an exported top-level const in a shared module.
|
|
73
|
+
* The type comes from `template`; annotate empty collections and optional fields with `as`.
|
|
74
|
+
|
|
75
|
+
]]
|
|
76
|
+
local function profileStore(_name, _options)
|
|
77
|
+
error("Crucible data needs the @trioforge/crucible/transformer plugin")
|
|
78
|
+
end
|
|
79
|
+
--* Marks a template field server-only: the owner's client never receives it.
|
|
80
|
+
local function serverOnly(value)
|
|
81
|
+
return markServerOnly(value)
|
|
82
|
+
end
|
|
83
|
+
--[[
|
|
84
|
+
*
|
|
85
|
+
* The exact field paths the owner's client receives, each an array of segments: an object field's key, "[]" for an
|
|
86
|
+
* array element and "*" for a map value. A key that is "[]" or "*", or starts with a backslash, gets one more backslash.
|
|
87
|
+
* Sorted segment by segment, by bytes.
|
|
88
|
+
|
|
89
|
+
]]
|
|
90
|
+
local function replicatedPaths(store)
|
|
91
|
+
return replicatedPathsOf(store)
|
|
92
|
+
end
|
|
93
|
+
return {
|
|
94
|
+
profileStore = profileStore,
|
|
95
|
+
serverOnly = serverOnly,
|
|
96
|
+
replicatedPaths = replicatedPaths,
|
|
97
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Config, PlayerConfig } from "../configs";
|
|
2
|
+
import type { Node } from "../internal/network/schema";
|
|
3
|
+
export declare function config<T>(name: string, fallback: T, value: Node): Config<T>;
|
|
4
|
+
export declare function playerConfig<T>(name: string, fallback: T, value: Node): PlayerConfig<T>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _runtime = TS.import(script, script.Parent.Parent, "internal", "configs", "runtime")
|
|
4
|
+
local declare = _runtime.declare
|
|
5
|
+
local readGlobal = _runtime.readGlobal
|
|
6
|
+
local readPlayer = _runtime.readPlayer
|
|
7
|
+
local function config(name, fallback, value)
|
|
8
|
+
local declaration = declare(name, "global", fallback, value)
|
|
9
|
+
return function()
|
|
10
|
+
return readGlobal(declaration)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
local function playerConfig(name, fallback, value)
|
|
14
|
+
local declaration = declare(name, "player", fallback, value)
|
|
15
|
+
return function(player)
|
|
16
|
+
return readPlayer(declaration, player)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
config = config,
|
|
21
|
+
playerConfig = playerConfig,
|
|
22
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ProfileMessage, ProfileOptions, ProfileStore } from "../data";
|
|
2
|
+
import type { Node } from "../internal/network/schema";
|
|
3
|
+
import type { DataStore, StoreOptions } from "../server/data";
|
|
4
|
+
export declare function dataStore<T extends object>(name: string, options: StoreOptions<NoInfer<T>>, value: Node): DataStore<T>;
|
|
5
|
+
export declare function profileStore<T extends object>(name: string, options: ProfileOptions<T>, persist: Node, replica: Node, serverOnlyPaths: readonly (readonly string[])[]): ProfileStore<T>;
|
|
6
|
+
export declare function profileMessage<P>(name: string, payload: Node): ProfileMessage<P>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local declareProfileStore = TS.import(script, script.Parent.Parent, "internal", "data", "declarations").declareProfileStore
|
|
4
|
+
local declareProfileMessage = TS.import(script, script.Parent.Parent, "internal", "data", "messages").declareProfileMessage
|
|
5
|
+
local declareRecords = TS.import(script, script.Parent.Parent, "internal", "data", "record-declarations").declareRecords
|
|
6
|
+
local function dataStore(name, options, value)
|
|
7
|
+
return declareRecords(name, options.defaults, options.migrations, value)
|
|
8
|
+
end
|
|
9
|
+
local function profileStore(name, options, persist, replica, serverOnlyPaths)
|
|
10
|
+
return declareProfileStore(name, options.template, options.migrations, persist, replica, serverOnlyPaths)
|
|
11
|
+
end
|
|
12
|
+
local function profileMessage(name, payload)
|
|
13
|
+
return declareProfileMessage(name, payload)
|
|
14
|
+
end
|
|
15
|
+
return {
|
|
16
|
+
dataStore = dataStore,
|
|
17
|
+
profileStore = profileStore,
|
|
18
|
+
profileMessage = profileMessage,
|
|
19
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export { n } from "../internal/network/schema";
|
|
2
|
+
export { config, playerConfig } from "./configs";
|
|
3
|
+
export { toServer, toClient, askServer, receive } from "./network";
|
|
4
|
+
export { replicated, replicatedPerPlayer } from "./replicated";
|
|
5
|
+
export { dataStore, profileStore, profileMessage } from "./data";
|
|
6
|
+
import type { All } from "../all";
|
|
7
|
+
import type { CrucibleObject } from "../crucible-object";
|
|
8
|
+
export type EmittedDep = string | {
|
|
9
|
+
readonly all: string;
|
|
10
|
+
};
|
|
11
|
+
interface EmittedBase {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly deps: readonly EmittedDep[];
|
|
14
|
+
readonly provides: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
export type EmittedClass = (EmittedBase & {
|
|
17
|
+
readonly kind: "subsystem";
|
|
18
|
+
}) | (EmittedBase & {
|
|
19
|
+
readonly kind: "behaviour";
|
|
20
|
+
readonly tag: string;
|
|
21
|
+
readonly instance: readonly (keyof Instances)[];
|
|
22
|
+
readonly attributes?: {
|
|
23
|
+
readonly [field: string]: EmittedAttribute;
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
export type Check = (value: unknown) => boolean;
|
|
27
|
+
export declare function defineClass(klass: new (...args: never[]) => CrucibleObject, emitted: EmittedClass): void;
|
|
28
|
+
export declare function resolve<T extends object>(id: string): T;
|
|
29
|
+
export declare function resolveAll<T extends object>(id: string): All<T>;
|
|
30
|
+
export declare const t: {
|
|
31
|
+
readonly string: Check;
|
|
32
|
+
readonly number: Check;
|
|
33
|
+
readonly boolean: Check;
|
|
34
|
+
readonly vector3: Check;
|
|
35
|
+
readonly color3: Check;
|
|
36
|
+
readonly literal: (expected: string | number | boolean) => Check;
|
|
37
|
+
readonly optional: (check: Check) => Check;
|
|
38
|
+
readonly union: (...checks: Check[]) => Check;
|
|
39
|
+
};
|
|
40
|
+
export interface EmittedAttribute {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
readonly check: Check;
|
|
43
|
+
readonly required: boolean;
|
|
44
|
+
}
|
|
45
|
+
export declare function attribute<T>(object: object, field: string, fallback?: T): T;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
local readClaim = TS.import(script, script.Parent, "internal", "construction-claim").readClaim
|
|
5
|
+
exports.n = TS.import(script, script.Parent, "internal", "network", "schema").n
|
|
6
|
+
local _configs = TS.import(script, script, "configs")
|
|
7
|
+
exports.config = _configs.config
|
|
8
|
+
exports.playerConfig = _configs.playerConfig
|
|
9
|
+
local _network = TS.import(script, script, "network")
|
|
10
|
+
exports.toServer = _network.toServer
|
|
11
|
+
exports.toClient = _network.toClient
|
|
12
|
+
exports.askServer = _network.askServer
|
|
13
|
+
exports.receive = _network.receive
|
|
14
|
+
local _replicated = TS.import(script, script, "replicated")
|
|
15
|
+
exports.replicated = _replicated.replicated
|
|
16
|
+
exports.replicatedPerPlayer = _replicated.replicatedPerPlayer
|
|
17
|
+
local _data = TS.import(script, script, "data")
|
|
18
|
+
exports.dataStore = _data.dataStore
|
|
19
|
+
exports.profileStore = _data.profileStore
|
|
20
|
+
exports.profileMessage = _data.profileMessage
|
|
21
|
+
local _registry = TS.import(script, script.Parent, "internal", "registry")
|
|
22
|
+
local define = _registry.define
|
|
23
|
+
local resolveOne = _registry.resolveOne
|
|
24
|
+
local setFor = _registry.setFor
|
|
25
|
+
local function defineClass(klass, emitted)
|
|
26
|
+
define(klass, emitted)
|
|
27
|
+
end
|
|
28
|
+
local function resolve(id)
|
|
29
|
+
return resolveOne(id)
|
|
30
|
+
end
|
|
31
|
+
local function resolveAll(id)
|
|
32
|
+
return setFor(id)
|
|
33
|
+
end
|
|
34
|
+
local t = {
|
|
35
|
+
string = (function(value)
|
|
36
|
+
local _value = value
|
|
37
|
+
return type(_value) == "string"
|
|
38
|
+
end),
|
|
39
|
+
number = (function(value)
|
|
40
|
+
local _value = value
|
|
41
|
+
return type(_value) == "number"
|
|
42
|
+
end),
|
|
43
|
+
boolean = (function(value)
|
|
44
|
+
local _value = value
|
|
45
|
+
return type(_value) == "boolean"
|
|
46
|
+
end),
|
|
47
|
+
vector3 = (function(value)
|
|
48
|
+
local _value = value
|
|
49
|
+
return typeof(_value) == "Vector3"
|
|
50
|
+
end),
|
|
51
|
+
color3 = (function(value)
|
|
52
|
+
local _value = value
|
|
53
|
+
return typeof(_value) == "Color3"
|
|
54
|
+
end),
|
|
55
|
+
literal = function(expected)
|
|
56
|
+
return function(value)
|
|
57
|
+
return value == expected
|
|
58
|
+
end
|
|
59
|
+
end,
|
|
60
|
+
optional = function(check)
|
|
61
|
+
return function(value)
|
|
62
|
+
return value == nil or check(value)
|
|
63
|
+
end
|
|
64
|
+
end,
|
|
65
|
+
union = function(...)
|
|
66
|
+
local checks = { ... }
|
|
67
|
+
return function(value)
|
|
68
|
+
-- ▼ ReadonlyArray.some ▼
|
|
69
|
+
local _result = false
|
|
70
|
+
local _callback = function(check)
|
|
71
|
+
return check(value)
|
|
72
|
+
end
|
|
73
|
+
for _k, _v in checks do
|
|
74
|
+
if _callback(_v, _k - 1, checks) then
|
|
75
|
+
_result = true
|
|
76
|
+
break
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
-- ▲ ReadonlyArray.some ▲
|
|
80
|
+
return _result
|
|
81
|
+
end
|
|
82
|
+
end,
|
|
83
|
+
}
|
|
84
|
+
local function attribute(object, field, fallback)
|
|
85
|
+
local claim = readClaim()
|
|
86
|
+
if claim == nil or claim.object ~= object then
|
|
87
|
+
error("attribute read outside construction claim")
|
|
88
|
+
end
|
|
89
|
+
local _value = claim.attributes
|
|
90
|
+
if _value ~= nil then
|
|
91
|
+
_value = _value[field]
|
|
92
|
+
end
|
|
93
|
+
local value = _value
|
|
94
|
+
return if value == nil then fallback else value
|
|
95
|
+
end
|
|
96
|
+
exports.defineClass = defineClass
|
|
97
|
+
exports.resolve = resolve
|
|
98
|
+
exports.resolveAll = resolveAll
|
|
99
|
+
exports.attribute = attribute
|
|
100
|
+
exports.t = t
|
|
101
|
+
return exports
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AskServer, ReceiveCallback, Receiver, ReceiveTarget, ToClient, ToServer } from "../network";
|
|
2
|
+
import type { Node } from "../internal/network/schema";
|
|
3
|
+
export declare function toServer<P>(name: string, payload: Node): ToServer<P>;
|
|
4
|
+
export declare function toClient<P>(name: string, payload: Node): ToClient<P>;
|
|
5
|
+
export declare function askServer<Request, Response>(name: string, request: Node, response: Node, timeout: number | undefined): AskServer<Request, Response>;
|
|
6
|
+
export declare function receive<T extends ReceiveTarget>(owner: object, field: string, target: T, callback: ReceiveCallback<T>): Receiver;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local define = TS.import(script, script.Parent.Parent, "internal", "network", "catalog").define
|
|
4
|
+
local claim = TS.import(script, script.Parent.Parent, "internal", "network", "claims").claim
|
|
5
|
+
local function toServer(name, payload)
|
|
6
|
+
return define({
|
|
7
|
+
kind = "to-server",
|
|
8
|
+
name = name,
|
|
9
|
+
input = payload,
|
|
10
|
+
})
|
|
11
|
+
end
|
|
12
|
+
local function toClient(name, payload)
|
|
13
|
+
return define({
|
|
14
|
+
kind = "to-client",
|
|
15
|
+
name = name,
|
|
16
|
+
input = payload,
|
|
17
|
+
})
|
|
18
|
+
end
|
|
19
|
+
local function askServer(name, request, response, timeout)
|
|
20
|
+
return define({
|
|
21
|
+
kind = "ask-server",
|
|
22
|
+
name = name,
|
|
23
|
+
input = request,
|
|
24
|
+
output = response,
|
|
25
|
+
timeout = timeout,
|
|
26
|
+
})
|
|
27
|
+
end
|
|
28
|
+
local function receive(owner, field, target, callback)
|
|
29
|
+
return claim(owner, field, target, callback)
|
|
30
|
+
end
|
|
31
|
+
return {
|
|
32
|
+
toServer = toServer,
|
|
33
|
+
toClient = toClient,
|
|
34
|
+
askServer = askServer,
|
|
35
|
+
receive = receive,
|
|
36
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Node } from "../internal/network/schema";
|
|
2
|
+
import type { Replicated, ReplicatedPerPlayer } from "../replicated";
|
|
3
|
+
export declare function replicated<T>(name: string, initial: NoInfer<T>, value: Node): Replicated<T>;
|
|
4
|
+
export declare function replicatedPerPlayer<T>(name: string, initial: NoInfer<T>, value: Node): ReplicatedPerPlayer<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local declareReplicated = TS.import(script, script.Parent.Parent, "internal", "sync", "declarations").declareReplicated
|
|
4
|
+
local function replicated(name, initial, value)
|
|
5
|
+
return declareReplicated("all", name, initial, value)
|
|
6
|
+
end
|
|
7
|
+
local function replicatedPerPlayer(name, initial, value)
|
|
8
|
+
return declareReplicated("player", name, initial, value)
|
|
9
|
+
end
|
|
10
|
+
return {
|
|
11
|
+
replicated = replicated,
|
|
12
|
+
replicatedPerPlayer = replicatedPerPlayer,
|
|
13
|
+
}
|
package/out/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { Subsystem } from "./subsystem";
|
|
2
|
+
export type { CrucibleObject } from "./crucible-object";
|
|
3
|
+
export type { All } from "./all";
|
|
4
|
+
export { inject } from "./inject";
|
|
5
|
+
export { attribute } from "./attribute";
|
|
6
|
+
export { CrucibleBehaviour, type BehaviourClass } from "./crucible-behaviour";
|
|
7
|
+
export interface BootOptions {
|
|
8
|
+
readonly load: readonly string[];
|
|
9
|
+
readonly fixedRate?: number;
|
|
10
|
+
}
|
|
11
|
+
export { Logging, LogLevel } from "./logging";
|
|
12
|
+
export type { Logger, LogRecord, LogSink, SinkSubscription, LogContext, LogProperties } from "./logging";
|
|
13
|
+
export { state, computed, effect, watch, untracked, scope, onCleanup, own } from "./reactive";
|
|
14
|
+
export type { Readable, State, Ownable } from "./reactive";
|
|
15
|
+
export { replicated, replicatedPerPlayer, syncStatus } from "./replicated";
|
|
16
|
+
export type { Replicated, ReplicatedPerPlayer, SyncStatus } from "./replicated";
|
|
17
|
+
export { toServer, toClient, askServer, receive, ClientReady } from "./network";
|
|
18
|
+
export type { ToServer, ToClient, AskServer, Receiver, ReceiveTarget, ReceiveCallback, AskResult, AskFailure, AskOptions, PayloadArgs, f32, f64, u8, u16, u32, } from "./network";
|
|
19
|
+
export { profileStore, serverOnly, replicatedPaths } from "./data";
|
|
20
|
+
export type { ProfileStore, ProfileOptions, ServerOnly, ProfileData, ClientData, Profile, ClientProfile, DataHandle, ReadHandle, WriteHandle, ArrayWrites, ReservedName, Json, JsonRecord, Migration, } from "./data";
|
package/out/init.luau
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
exports.Subsystem = TS.import(script, script, "subsystem").Subsystem
|
|
5
|
+
exports.inject = TS.import(script, script, "inject").inject
|
|
6
|
+
exports.attribute = TS.import(script, script, "attribute").attribute
|
|
7
|
+
exports.CrucibleBehaviour = TS.import(script, script, "crucible-behaviour").CrucibleBehaviour
|
|
8
|
+
local _logging = TS.import(script, script, "logging")
|
|
9
|
+
exports.Logging = _logging.Logging
|
|
10
|
+
exports.LogLevel = _logging.LogLevel
|
|
11
|
+
local _reactive = TS.import(script, script, "reactive")
|
|
12
|
+
exports.state = _reactive.state
|
|
13
|
+
exports.computed = _reactive.computed
|
|
14
|
+
exports.effect = _reactive.effect
|
|
15
|
+
exports.watch = _reactive.watch
|
|
16
|
+
exports.untracked = _reactive.untracked
|
|
17
|
+
exports.scope = _reactive.scope
|
|
18
|
+
exports.onCleanup = _reactive.onCleanup
|
|
19
|
+
exports.own = _reactive.own
|
|
20
|
+
local _replicated = TS.import(script, script, "replicated")
|
|
21
|
+
exports.replicated = _replicated.replicated
|
|
22
|
+
exports.replicatedPerPlayer = _replicated.replicatedPerPlayer
|
|
23
|
+
exports.syncStatus = _replicated.syncStatus
|
|
24
|
+
local _network = TS.import(script, script, "network")
|
|
25
|
+
exports.toServer = _network.toServer
|
|
26
|
+
exports.toClient = _network.toClient
|
|
27
|
+
exports.askServer = _network.askServer
|
|
28
|
+
exports.receive = _network.receive
|
|
29
|
+
exports.ClientReady = _network.ClientReady
|
|
30
|
+
local _data = TS.import(script, script, "data")
|
|
31
|
+
exports.profileStore = _data.profileStore
|
|
32
|
+
exports.serverOnly = _data.serverOnly
|
|
33
|
+
exports.replicatedPaths = _data.replicatedPaths
|
|
34
|
+
return exports
|
package/out/inject.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function inject<T extends object>(): T;
|
package/out/inject.luau
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|