Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .luaurc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"languageMode": "strict",
"aliases": {
"std": "~/.lute/typedefs/0.1.0/std",
"lint": "~/.lute/typedefs/0.1.0/lint",
"lute": "~/.lute/typedefs/0.1.0/lute",
"std": "~/.lute/typedefs/1.0.0/std",
"lint": "~/.lute/typedefs/1.0.0/lint",
"lute": "~/.lute/typedefs/1.0.0/lute",
"batteries": "./src/batteries"
}
}
2 changes: 1 addition & 1 deletion foreman-release.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[tools]
lute = { source = "luau-lang/lute", version = "=0.1.0-nightly.20260303" }
lute = { source = "luau-lang/lute", version = "=1.0.0" }
2 changes: 1 addition & 1 deletion foreman.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[tools]
lute = { source = "luau-lang/lute", version = "=0.1.0-nightly.20260303" }
lute = { source = "luau-lang/lute", version = "=1.0.0" }
stylua = { source = "JohnnyMorganz/StyLua", version = "2.0.1" }
rojo = { source = "rojo-rbx/rojo", version = "7.3.0" }
2 changes: 1 addition & 1 deletion scripts/build.luau
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ log.setLevel("debug")
local runProcess = require("../src/util/runProcess")

if not fs.exists("build") then
fs.createdirectory("build")
fs.createDirectory("build")
end

local output_path = "build/rocale-cli"
Expand Down
2 changes: 1 addition & 1 deletion scripts/test.luau
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ runProcess({
"--verbose",
})

local testOutput = fs.readfiletostring("build/testOutput.txt")
local testOutput = fs.readFileToString("build/testOutput.txt")
fs.remove("build/testOutput.txt")
assert(testOutput == "hello world!", `Expected binary output to be "hello world!"`)

Expand Down
2 changes: 1 addition & 1 deletion src/commands/run.luau
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ return function(...)
if enableBinaryOutput and completedTask.binaryOutputUri then
local binaryOutput = ocaleSdk.getBinaryOutput(completedTask.binaryOutputUri)
assert(binaryOutputPath, "Binary output path should be a valid file path")
fs.writestringtofile(binaryOutputPath, binaryOutput)
fs.writeStringToFile(binaryOutputPath, binaryOutput)
log.info(`{richterm.green("✓", log.noColor())} Binary output saved to '{binaryOutputPath}'`)
end

Expand Down
30 changes: 16 additions & 14 deletions src/core/ocaleSdk.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
local net = require("@lute/net")
local client = require("@lute/net/client")
local json = require("@std/json")
local fs = require("@std/fs")
local task = require("@lute/task")
Expand All @@ -10,9 +10,9 @@ local OcaleSDK = {}

export type BinaryInputResponse = { path: string, size: number, uploadUri: string }
function OcaleSDK.createBinaryInput(apiKey: string, universeId: number, filePath: string): BinaryInputResponse
local fileSize = #fs.readfiletostring(filePath)
local fileSize = #fs.readFileToString(filePath)

local response = net.request(
local response = client.request(
`https://apis.roblox.com/cloud/v2/universes/{universeId}/luau-execution-session-task-binary-inputs`,
{
method = "POST",
Expand All @@ -25,10 +25,10 @@ function OcaleSDK.createBinaryInput(apiKey: string, universeId: number, filePath
end

function OcaleSDK.uploadBinaryFile(uploadUri: string, filePath: string)
local response = net.request(uploadUri, {
local response = client.request(uploadUri, {
method = "PUT",
headers = { ["content-type"] = "application/octet-stream" },
body = fs.readfiletostring(filePath),
body = fs.readFileToString(filePath),
})
log.fatalif(not response.ok, `{response.status} - {response.body}`)
end
Expand All @@ -44,14 +44,16 @@ function OcaleSDK.uploadPlaceFile(filePath: string, placeInfo: PlaceInfo, apiKey
local url =
`https://apis.roblox.com/universes/v1/{placeInfo.universeId}/places/{placeInfo.placeId}/versions?versionType=Saved`
log.debug(`Request URL: {url}`)
local response = net.request(url, {
local isXml = string.match(filePath, "%.rbxlx$") ~= nil
local contentType = if isXml then "application/xml" else "application/octet-stream"
local response = client.request(url, {
method = "POST",
headers = {
["x-api-key"] = apiKey,
["content-type"] = "application/xml",
["content-type"] = contentType,
["Accept"] = "application/json",
},
body = fs.readfiletostring(filePath),
body = fs.readFileToString(filePath),
})
log.fatalif(not response.ok, `{response.status} - {response.body}`)
log.debug(`Response body: {log.pretty(response.body)}`)
Expand Down Expand Up @@ -98,7 +100,7 @@ function OcaleSDK.createTask(
): TaskResponse
log.info(`{richterm.blue("→", log.noColor())} Creating the OCALE task...`)
local url = getCreateTaskPath(placeInfo)
local entryScript = fs.readfiletostring(scriptPath)
local entryScript = fs.readFileToString(scriptPath)

-- inject globals at the top of the entry script
if luaGlobals and next(luaGlobals) then
Expand All @@ -112,7 +114,7 @@ function OcaleSDK.createTask(
entryScript = assignGlobals .. entryScript
end

local req: net.Metadata = {
local req: client.Metadata = {
method = "POST",
headers = { ["x-api-key"] = apiKey, ["content-type"] = "application/json" },
body = json.serialize({
Expand All @@ -124,7 +126,7 @@ function OcaleSDK.createTask(
}

log.debug(`Request URL: {url}`)
local response = net.request(url, req)
local response = client.request(url, req)
log.fatalif(not response.ok, `{response.status} - {response.body}`)
local taskResponse = json.deserialize(response.body) :: TaskResponse
log.debug(`Task path: {taskResponse.path}`)
Expand Down Expand Up @@ -164,7 +166,7 @@ function OcaleSDK.pollTaskCompletion(
while timeRemaining > 0 do
timeRemaining = timeRemaining - interval

local response = net.request(`https://apis.roblox.com/cloud/v2/{taskPath}`, {
local response = client.request(`https://apis.roblox.com/cloud/v2/{taskPath}`, {
method = "GET",
headers = { ["x-api-key"] = apiKey },
})
Expand Down Expand Up @@ -196,15 +198,15 @@ end

function OcaleSDK.getBinaryOutput(binaryOutputUri: string): string
log.debug(`Binary output URI: {binaryOutputUri}`)
local response = net.request(binaryOutputUri, {
local response = client.request(binaryOutputUri, {
method = "GET",
})
log.fatalif(not response.ok, `{response.status} - {response.body}`)
return response.body
end

function OcaleSDK.getTaskLogs(apiKey: string, taskPath: string): { string }
local response = net.request(`https://apis.roblox.com/cloud/v2/{taskPath}/logs`, {
local response = client.request(`https://apis.roblox.com/cloud/v2/{taskPath}/logs`, {
method = "GET",
headers = { ["x-api-key"] = apiKey },
})
Expand Down
Loading