Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return Most.drain(Most.map(_handleEngineState, Most.flatMap((function (engineState) {
return Most.fromPromise(fetch("./config/editor/setting.json").then((function (response) {
return response.json().then((function (json) {
var __x = ParseSettingService$WonderEditor.convertToRecord(json);
StateEditorService$WonderEditor.setState(SetSettingEditorService$WonderEditor.setSetting(__x, StateEditorService$WonderEditor.getState(/* () */0)));
return Promise.resolve(engineState);
}));
})));
}), Most.flatMap((function (engineState) {
return Most.fromPromise(LoaderManagerEngineService$WonderEditor.loadIMGUIAsset("./public/font/empty.fnt", "./public/font/empty.png", /* array */[
return Log$WonderLog.fatal(LogUtils$WonderEditor.buildFatalMessage("shouldn\'t has unsupport gltf data file", "", "", ""));
default:
return /* () */0;
}
if (exit === 1) {
ArrayService$WonderEditor.push(Most.fromPromise(ZipObject$WonderBsJszip.asyncUint8(zipEntry, undefined, /* () */0).then((function (content) {
MutableHashMapService$WonderCommonlib.set(FileNameService$WonderEditor.getBaseName(relativePath), content.buffer, outerDataMap);
return Promise.resolve(/* () */0);
}))), streamArr);
return /* () */0;
}
}
}));
return MostUtils$Wonderjs.concatArray(streamArr);
}), Most.fromPromise(Zip$WonderBsJszip.loadAsync(Curry._1(createJsZipFunc, /* () */0), undefined, /* `blob */[
-1055310499,
jsZipBlob
])))).then((function (param) {
var match = gltfJson[0];
if (match !== undefined) {
return _convert(Caml_option.valFromOption(match), outerDataMap, FileNameService$WonderEditor.getBaseName);
} else {
return Log$WonderLog.fatal(LogUtils$WonderEditor.buildFatalMessage("gltf file should exist", "", "", ""));
}
}));
}
Most.drain(Most.flatMap(handleSceneWdb, Most.flatMap((function (wdbInfo) {
return Most.fromPromise(new Promise((function (resolve, _) {
var reader = new FileReader();
Curry._2(FileReader$WonderEditor.onload, reader, (function (result) {
return resolve(/* record */[
/* name */wdbInfo[/* name */0],
/* type_ */AssetTreeNodeUtils$WonderEditor.getUploadFileType(wdbInfo[/* name */0]),
/* result */result
]);
}));
return AssetTreeNodeUtils$WonderEditor.readFileByTypeSync(reader, wdbInfo);
})));
}), Most.just(wdbInfo)))).then((function () {
Curry._1(dispatchFunc, [
var match$1 = _buildMaterialData(resourceAssetBundleContent, match[1], match[2]);
var match$2 = _buildGeometryData(resourceAssetBundleContent, allDependencyRABRelativePath, buffer, match$1[2]);
var match$3 = _buildScriptEventFunctionData(resourceAssetBundleContent, match$2[1]);
var match$4 = _buildScriptAttributeData(resourceAssetBundleContent, match$3[1]);
var state$1 = OperateRABAssetBundleMainService$Wonderjs.setAssembleRABData(rabRelativePath, /* tuple */[
param[0],
match[0],
match$1[0],
match$1[1],
match$2[0],
match$3[0],
match$4[0]
], match$4[1]);
StateDataMainService$Wonderjs.setState(StateDataMain$Wonderjs.stateData, OperateRABAssetBundleMainService$Wonderjs.markAssembled(rabRelativePath, state$1));
return /* () */0;
}), Most.fromPromise(_buildImageData(resourceAssetBundleContent, buffer, allDependencyRABRelativePath, state)));
}
function buildManifestData(dependencyRelation, param, buildManifestFunc) {
var abRelativePath = param[0];
return Most.fromPromise(_getHashId(param[1]).then((function (hashId) {
return Promise.resolve(Curry._2(buildManifestFunc, hashId, Js_option.getWithDefault(ArrayService$WonderCommonlib.createEmpty(/* () */0), ImmutableHashMapService$WonderCommonlib.get(abRelativePath, dependencyRelation))));
})));
}
}))), streamArr);
return /* () */0;
case ".bin" :
case ".jpeg" :
case ".jpg" :
case ".png" :
exit = 1;
break;
case ".dds" :
case ".wav" :
return Log$WonderLog.fatal(LogUtils$WonderEditor.buildFatalMessage("shouldn\'t has unsupport gltf data file", "", "", ""));
default:
return /* () */0;
}
if (exit === 1) {
ArrayService$WonderEditor.push(Most.fromPromise(ZipObject$WonderBsJszip.asyncUint8(zipEntry, undefined, /* () */0).then((function (content) {
MutableHashMapService$WonderCommonlib.set(FileNameService$WonderEditor.getBaseName(relativePath), content.buffer, outerDataMap);
return Promise.resolve(/* () */0);
}))), streamArr);
return /* () */0;
}
}
}));
return MostUtils$Wonderjs.concatArray(streamArr);
.map(search =>
fromPromise(
fetch(
`https://api.github.com/search/users?q=${search}&sort=followers`
)
)
)
const concatFiles = path =>
most.fromPromise (readFile (path ('index.txt')))
.map (S.lines)
.map (S.map (path))
.map (S.map (readFile))
.map (Promise.all.bind (Promise))
.awaitPromises ()
.map (S.joinWith (''))
.reduce ((x, y) => x + y, '');
function createFetchBlobStream(filePath, fetchFunc) {
return Most.fromPromise(fetchFunc(filePath).then((function (prim) {
return prim.blob();
})));
}
}), Most.flatMap((function (zip) {
return Most.fromPromise(loadAndWriteIndexHtmlData(useWorker, sceneGraphArrayBuffer, fetchFunc, zip));
}), createZipStream))));
}