Skip to content

Commit 4b87640

Browse files
committed
feat: Enables configurable packs (pre2 schema)
1 parent 38da75b commit 4b87640

20 files changed

+631
-928
lines changed

examples/programatic.ts

+9-13
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,19 @@ const file = readFileSync(
2727
);
2828

2929
const manifest: Manifest = {
30-
schema: "pre1",
30+
schema: "pre2",
3131
name: "@taskless/example",
3232
version: "1.0.0",
3333
description: "Basic telemetry example, showing a programatic manifest",
34-
capture: {
35-
durationMs: {
36-
type: "number",
37-
description: "The duration of the request in milliseconds",
34+
permissions: {},
35+
fields: [
36+
{
37+
name: "enableStatus",
38+
type: "boolean",
39+
description: "Enable status logging",
40+
default: true,
3841
},
39-
status: {
40-
type: "number",
41-
description: "The status code of the request",
42-
},
43-
},
44-
permissions: {
45-
domains: [".+"], // runs on all domains
46-
},
42+
],
4743
};
4844

4945
const t = taskless(process.env.TASKLESS_API_KEY);

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
],
4444
"dependencies": {
4545
"@extism/extism": "2.0.0-rc9",
46-
"fets": "^0.8.2",
47-
"msw": "^2.3.5",
46+
"fets": "^0.8.5",
47+
"msw": "^2.7.3",
4848
"pkg-dir": "^8.0.0",
4949
"uint8array-extras": "^1.4.0",
50-
"uuid": "^10.0.0"
50+
"uuid": "^11.1.0"
5151
},
5252
"devDependencies": {
5353
"@changesets/cli": "^2.27.7",

pnpm-lock.yaml

+282-135
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

scripts/generate.ts

+15-14
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,35 @@ await Promise.all(
5858
}
5959
),
6060
downloadFile(
61-
new URL(`${base}/.well-known/schema/pre1/pack.json`),
61+
new URL(`${base}/.well-known/schema/pre2/pack.json`),
6262
"pack.ts",
6363
async (contents) => {
6464
const ts = await compile(JSON.parse(contents) as JSONSchema, "Pack");
6565
return prettier.format(ts, prettierOptions);
6666
}
6767
),
6868
downloadFile(
69-
new URL(`${base}/.well-known/schema/pre1/manifest.json`),
70-
"manifest.ts",
69+
new URL(`${base}/.well-known/schema/pre2/schema.json`),
70+
"schema.ts",
7171
async (contents) => {
72-
const ts = await compile(
73-
JSON.parse(contents) as JSONSchema,
74-
"Manifest"
75-
);
72+
const ts = await compile(JSON.parse(contents) as JSONSchema, "Schema");
7673
return prettier.format(ts, prettierOptions);
7774
}
7875
),
7976
downloadFile(
80-
new URL(`${base}/.well-known/schema/pre1/schema.json`),
81-
"config.ts",
77+
new URL(`${base}/.well-known/schema/pre2/manifest.json`),
78+
"manifest.ts",
8279
async (contents) => {
83-
const ts = await compile(JSON.parse(contents) as JSONSchema, "Config");
80+
const ts = await compile(
81+
JSON.parse(contents) as JSONSchema,
82+
"Manifest"
83+
);
8484
return prettier.format(ts, prettierOptions);
8585
}
8686
),
8787
downloadFile(
88-
new URL(`${base}/public/config`),
89-
"public.ts",
88+
new URL(`${base}/public/pre2/config`),
89+
"publicConfig.ts",
9090
async (contents) => {
9191
const configuration = JSON.parse(contents);
9292

@@ -115,9 +115,10 @@ await Promise.all(
115115
return prettier.format(
116116
`
117117
/* eslint-disable */
118-
import { type Config } from "./config.js";
118+
import { type Schema } from "./schema.js";
119+
120+
const publicConfig: Schema = ${JSON.stringify(configuration, null, 2)};
119121
120-
const publicConfig:Config = ${JSON.stringify(configuration, null, 2)};
121122
export { publicConfig };
122123
`,
123124
prettierOptions

src/__generated__/manifest.ts

+45-40
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)