toilscript 0.1.13 → 0.1.15
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/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/importmap.json +2 -2
- package/dist/toilscript.js +4 -4
- package/dist/toilscript.js.map +2 -2
- package/dist/web.js +3 -3
- package/package.json +1 -1
- package/std/assembly/toilscript.d.ts +51 -0
- package/std/ts-plugin.cjs +81 -23
package/dist/importmap.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"imports": {
|
|
3
|
-
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
4
|
-
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.
|
|
3
|
+
"toilscript": "https://cdn.jsdelivr.net/npm/toilscript@0.1.15/dist/toilscript.js",
|
|
4
|
+
"toilscript/cli": "https://cdn.jsdelivr.net/npm/toilscript@0.1.15/dist/cli.js",
|
|
5
5
|
"binaryen": "https://cdn.jsdelivr.net/npm/binaryen@129.0.0-nightly.20260428/index.js",
|
|
6
6
|
"long": "https://cdn.jsdelivr.net/npm/long@5.3.2/index.js"
|
|
7
7
|
}
|
package/dist/toilscript.js
CHANGED
|
@@ -369,8 +369,7 @@ declare interface __Record`),n.push(e.id.toString()),n.push(`<TOmittable> {
|
|
|
369
369
|
`;for(let s=0,l=a.routes.length;s<l;++s){let o=a.routes[s],u=Fg(o,i);e+=" async "+o.name+"("+u.argsParam+"): "+u.ret+` {
|
|
370
370
|
`,e+=" const __url = __toilUrl("+JSON.stringify(o.pattern)+", "+(o.params.length?"args.params as any":"undefined")+`, args?.query);
|
|
371
371
|
`;let c=o.bodyType!=null?o.stream=="Binary"?"application/octet-stream":"application/json":"",_="{ ";c.length&&(_+=JSON.stringify("content-type")+": "+JSON.stringify(c)+", "),_+="...(args?.headers ?? {}) }";let f=o.bodyType!=null?o.stream=="Binary"?", body: args.body.encode()":", body: JSON.stringify(args.body)":"";e+=" const __res = await fetch(__url, { method: "+JSON.stringify(o.http)+", headers: "+_+f+` });
|
|
372
|
-
`,e+=" if (!__res.ok) throw new Error(
|
|
373
|
-
`,o.returnsResponse?e+=` return __res;
|
|
372
|
+
`,e+=" if (!__res.ok) throw new Error(`Server.REST."+a.key+"."+o.name+" ${__res.status}`);\n",o.returnsResponse?e+=` return __res;
|
|
374
373
|
`:o.returns.type=="void"?e+=` return;
|
|
375
374
|
`:o.stream=="Binary"?(e+=` const __buf = new Uint8Array(await __res.arrayBuffer());
|
|
376
375
|
`,e+=" return "+o.returns.type+`.decode(__buf);
|
|
@@ -395,8 +394,9 @@ declare interface __Record`),n.push(e.id.toString()),n.push(`<TOmittable> {
|
|
|
395
394
|
`}e+=` };
|
|
396
395
|
`}return e+=` };
|
|
397
396
|
`,e+=`}
|
|
398
|
-
`,e}function S0(t,i){let e=y0(t);if(e.data.length==0&&e.services.length==0&&e.remotes.length==0&&e.rest.length==0)return null;let r=new Set;for(let s=0,l=e.data.length;s<l;++s)r.add(e.data[s].name);let n
|
|
399
|
-
`;n+=`//
|
|
397
|
+
`,e}function S0(t,i){let e=y0(t);if(e.data.length==0&&e.services.length==0&&e.remotes.length==0&&e.rest.length==0)return null;let r=new Set;for(let s=0,l=e.data.length;s<l;++s)r.add(e.data[s].name);let n=`/* eslint-disable */
|
|
398
|
+
`;n+=`// AUTO-GENERATED by toilscript, do not edit.
|
|
399
|
+
`,n+=`// Working @data codec + the typed client-callable Server surface.
|
|
400
400
|
`,n+=`// The Server proxy + transport are provided by toiljs.
|
|
401
401
|
|
|
402
402
|
`,e.data.length&&(n+='import { DataWriter, DataReader } from "'+i+`";
|