@kubohiroya/turbowarp-http-server 0.2.0 → 0.3.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/README.ja.md +32 -14
- package/README.md +104 -43
- package/assets/block-icon.svg +1 -0
- package/dist/cli.js +131 -17
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapters/cloudflare.d.ts +2 -0
- package/dist/compiler/adapters/cloudflare.js +477 -0
- package/dist/compiler/adapters/cloudflare.js.map +1 -0
- package/dist/compiler/adapters/firebase.d.ts +2 -0
- package/dist/compiler/adapters/firebase.js +489 -0
- package/dist/compiler/adapters/firebase.js.map +1 -0
- package/dist/compiler/adapters/index.d.ts +2 -0
- package/dist/compiler/adapters/index.js +3 -0
- package/dist/compiler/adapters/index.js.map +1 -0
- package/dist/compiler/binary/codec.d.ts +4 -0
- package/dist/compiler/binary/codec.js +45 -0
- package/dist/compiler/binary/codec.js.map +1 -0
- package/dist/compiler/binary/error.d.ts +3 -0
- package/dist/compiler/binary/error.js +21 -0
- package/dist/compiler/binary/error.js.map +1 -0
- package/dist/compiler/binary/index.d.ts +4 -0
- package/dist/compiler/binary/index.js +5 -0
- package/dist/compiler/binary/index.js.map +1 -0
- package/dist/compiler/binary/runtime.d.ts +18 -0
- package/dist/compiler/binary/runtime.js +123 -0
- package/dist/compiler/binary/runtime.js.map +1 -0
- package/dist/compiler/binary/types.d.ts +17 -0
- package/dist/compiler/binary/types.js +2 -0
- package/dist/compiler/binary/types.js.map +1 -0
- package/dist/compiler/feature-flags.d.ts +4 -0
- package/dist/compiler/feature-flags.js +4 -0
- package/dist/compiler/feature-flags.js.map +1 -0
- package/dist/compiler/index.d.ts +35 -0
- package/dist/compiler/index.js +84 -0
- package/dist/compiler/index.js.map +1 -0
- package/dist/compiler/ir-v2/canonical.d.ts +3 -0
- package/dist/compiler/ir-v2/canonical.js +50 -0
- package/dist/compiler/ir-v2/canonical.js.map +1 -0
- package/dist/compiler/ir-v2/index.d.ts +4 -0
- package/dist/compiler/ir-v2/index.js +5 -0
- package/dist/compiler/ir-v2/index.js.map +1 -0
- package/dist/compiler/ir-v2/parse.d.ts +10 -0
- package/dist/compiler/ir-v2/parse.js +753 -0
- package/dist/compiler/ir-v2/parse.js.map +1 -0
- package/dist/compiler/ir-v2/strict-json.d.ts +4 -0
- package/dist/compiler/ir-v2/strict-json.js +133 -0
- package/dist/compiler/ir-v2/strict-json.js.map +1 -0
- package/dist/compiler/ir-v2/types.d.ts +412 -0
- package/dist/compiler/ir-v2/types.js +84 -0
- package/dist/compiler/ir-v2/types.js.map +1 -0
- package/dist/compiler/kvs/lowering.d.ts +13 -0
- package/dist/compiler/kvs/lowering.js +77 -0
- package/dist/compiler/kvs/lowering.js.map +1 -0
- package/dist/compiler/manifest/error.d.ts +7 -0
- package/dist/compiler/manifest/error.js +9 -0
- package/dist/compiler/manifest/error.js.map +1 -0
- package/dist/compiler/manifest/index.d.ts +6 -0
- package/dist/compiler/manifest/index.js +7 -0
- package/dist/compiler/manifest/index.js.map +1 -0
- package/dist/compiler/manifest/operations.d.ts +12 -0
- package/dist/compiler/manifest/operations.js +60 -0
- package/dist/compiler/manifest/operations.js.map +1 -0
- package/dist/compiler/manifest/parse.d.ts +9 -0
- package/dist/compiler/manifest/parse.js +280 -0
- package/dist/compiler/manifest/parse.js.map +1 -0
- package/dist/compiler/manifest/registry.d.ts +3 -0
- package/dist/compiler/manifest/registry.js +48 -0
- package/dist/compiler/manifest/registry.js.map +1 -0
- package/dist/compiler/manifest/resolve.d.ts +14 -0
- package/dist/compiler/manifest/resolve.js +116 -0
- package/dist/compiler/manifest/resolve.js.map +1 -0
- package/dist/compiler/manifest/types.d.ts +95 -0
- package/dist/compiler/manifest/types.js +3 -0
- package/dist/compiler/manifest/types.js.map +1 -0
- package/dist/compiler/named-body/index.d.ts +1 -0
- package/dist/compiler/named-body/index.js +2 -0
- package/dist/compiler/named-body/index.js.map +1 -0
- package/dist/compiler/named-body/lowering.d.ts +18 -0
- package/dist/compiler/named-body/lowering.js +83 -0
- package/dist/compiler/named-body/lowering.js.map +1 -0
- package/dist/compiler/pipeline/compiler.d.ts +18 -0
- package/dist/compiler/pipeline/compiler.js +105 -0
- package/dist/compiler/pipeline/compiler.js.map +1 -0
- package/dist/compiler/pipeline/core-generator.d.ts +3 -0
- package/dist/compiler/pipeline/core-generator.js +483 -0
- package/dist/compiler/pipeline/core-generator.js.map +1 -0
- package/dist/compiler/pipeline/index.d.ts +5 -0
- package/dist/compiler/pipeline/index.js +6 -0
- package/dist/compiler/pipeline/index.js.map +1 -0
- package/dist/compiler/pipeline/registry.d.ts +7 -0
- package/dist/compiler/pipeline/registry.js +17 -0
- package/dist/compiler/pipeline/registry.js.map +1 -0
- package/dist/compiler/pipeline/requirements.d.ts +9 -0
- package/dist/compiler/pipeline/requirements.js +135 -0
- package/dist/compiler/pipeline/requirements.js.map +1 -0
- package/dist/compiler/pipeline/types.d.ts +65 -0
- package/dist/compiler/pipeline/types.js +2 -0
- package/dist/compiler/pipeline/types.js.map +1 -0
- package/dist/compiler/runtime/error.d.ts +6 -0
- package/dist/compiler/runtime/error.js +9 -0
- package/dist/compiler/runtime/error.js.map +1 -0
- package/dist/compiler/runtime/index.d.ts +1 -0
- package/dist/compiler/runtime/index.js +2 -0
- package/dist/compiler/runtime/index.js.map +1 -0
- package/dist/compiler/structured-data/index.d.ts +3 -0
- package/dist/compiler/structured-data/index.js +4 -0
- package/dist/compiler/structured-data/index.js.map +1 -0
- package/dist/compiler/structured-data/lowering.d.ts +30 -0
- package/dist/compiler/structured-data/lowering.js +202 -0
- package/dist/compiler/structured-data/lowering.js.map +1 -0
- package/dist/compiler/structured-data/path.d.ts +2 -0
- package/dist/compiler/structured-data/path.js +60 -0
- package/dist/compiler/structured-data/path.js.map +1 -0
- package/dist/compiler/structured-data/runtime.d.ts +20 -0
- package/dist/compiler/structured-data/runtime.js +210 -0
- package/dist/compiler/structured-data/runtime.js.map +1 -0
- package/dist/compiler/turbowarp-v2.d.ts +8 -0
- package/dist/compiler/turbowarp-v2.js +479 -0
- package/dist/compiler/turbowarp-v2.js.map +1 -0
- package/dist/compiler/validator/index.d.ts +4 -0
- package/dist/compiler/validator/index.js +5 -0
- package/dist/compiler/validator/index.js.map +1 -0
- package/dist/compiler/validator/ir-validator.d.ts +10 -0
- package/dist/compiler/validator/ir-validator.js +463 -0
- package/dist/compiler/validator/ir-validator.js.map +1 -0
- package/dist/compiler/validator/resource-lifetime.d.ts +18 -0
- package/dist/compiler/validator/resource-lifetime.js +106 -0
- package/dist/compiler/validator/resource-lifetime.js.map +1 -0
- package/dist/compiler/validator/turbowarp-subset.d.ts +3 -0
- package/dist/compiler/validator/turbowarp-subset.js +241 -0
- package/dist/compiler/validator/turbowarp-subset.js.map +1 -0
- package/dist/compiler/validator/types.d.ts +30 -0
- package/dist/compiler/validator/types.js +7 -0
- package/dist/compiler/validator/types.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/digest-cli.js +0 -0
- package/dist/extension-manifest.json +102 -0
- package/dist/named-body.d.ts +57 -0
- package/dist/named-body.js +396 -0
- package/dist/named-body.js.map +1 -0
- package/dist/named-data-namespace.d.ts +3 -0
- package/dist/named-data-namespace.js +6 -0
- package/dist/named-data-namespace.js.map +1 -0
- package/dist/protocol.d.ts +13 -1
- package/dist/protocol.js +34 -0
- package/dist/protocol.js.map +1 -1
- package/dist/resource-named-body-provider.d.ts +8 -0
- package/dist/resource-named-body-provider.js +88 -0
- package/dist/resource-named-body-provider.js.map +1 -0
- package/dist/server.d.ts +10 -1
- package/dist/server.js +37 -7
- package/dist/server.js.map +1 -1
- package/dist/turbowarp-http-server.js +1614 -1099
- package/docs/binary-resource-semantics.ja.md +84 -0
- package/docs/cloudflare-worker-compiler.ja.md +90 -0
- package/docs/compiler-manifest-registry.ja.md +79 -0
- package/docs/compiler-platform-pipeline.ja.md +94 -0
- package/docs/deploy-ir-v2.ja.md +123 -0
- package/docs/fixed-input-editors.ja.md +23 -0
- package/docs/index.html +86 -0
- package/docs/ir-v2-conformance.ja.md +65 -0
- package/docs/named-response-body.ja.md +120 -0
- package/docs/platform-storage-adapters.ja.md +99 -0
- package/docs/server-executable-subset.ja.md +88 -0
- package/docs/structured-data-lowering.ja.md +63 -0
- package/docs/turbowarp-http-server.architecture.html +4 -0
- package/examples/compiler/message-app.v2.ir.json +41 -0
- package/package.json +45 -20
- package/schemas/block-editor-fixed-inputs.schema.json +85 -0
- package/schemas/compiler-extension-manifest.schema.json +126 -0
- package/schemas/compiler-manifest-lock-v1.schema.json +48 -0
- package/schemas/deploy-ir-v2.schema.json +835 -0
- package/schemas/ir-v2-conformance-fixture.schema.json +44 -0
- package/src/block-definitions.json +76 -0
- package/src/cli.ts +136 -23
- package/src/compiler/adapters/cloudflare.ts +510 -0
- package/src/compiler/adapters/firebase.ts +538 -0
- package/src/compiler/adapters/index.ts +2 -0
- package/src/compiler/binary/codec.ts +61 -0
- package/src/compiler/binary/error.ts +25 -0
- package/src/compiler/binary/index.ts +4 -0
- package/src/compiler/binary/runtime.ts +133 -0
- package/src/compiler/binary/types.ts +26 -0
- package/src/compiler/feature-flags.ts +7 -0
- package/src/compiler/index.ts +114 -0
- package/src/compiler/ir-v2/canonical.ts +46 -0
- package/src/compiler/ir-v2/index.ts +9 -0
- package/src/compiler/ir-v2/parse.ts +921 -0
- package/src/compiler/ir-v2/strict-json.ts +129 -0
- package/src/compiler/ir-v2/types.ts +462 -0
- package/src/compiler/kvs/lowering.ts +88 -0
- package/src/compiler/manifest/error.ts +29 -0
- package/src/compiler/manifest/index.ts +17 -0
- package/src/compiler/manifest/operations.ts +175 -0
- package/src/compiler/manifest/parse.ts +390 -0
- package/src/compiler/manifest/registry.ts +74 -0
- package/src/compiler/manifest/resolve.ts +159 -0
- package/src/compiler/manifest/types.ts +112 -0
- package/src/compiler/named-body/index.ts +1 -0
- package/src/compiler/named-body/lowering.ts +186 -0
- package/src/compiler/pipeline/compiler.ts +138 -0
- package/src/compiler/pipeline/core-generator.ts +486 -0
- package/src/compiler/pipeline/index.ts +5 -0
- package/src/compiler/pipeline/registry.ts +18 -0
- package/src/compiler/pipeline/requirements.ts +139 -0
- package/src/compiler/pipeline/types.ts +59 -0
- package/src/compiler/runtime/error.ts +11 -0
- package/src/compiler/runtime/index.ts +1 -0
- package/src/compiler/structured-data/index.ts +3 -0
- package/src/compiler/structured-data/lowering.ts +314 -0
- package/src/compiler/structured-data/path.ts +53 -0
- package/src/compiler/structured-data/runtime.ts +221 -0
- package/src/compiler/turbowarp-v2.ts +610 -0
- package/src/compiler/validator/index.ts +4 -0
- package/src/compiler/validator/ir-validator.ts +812 -0
- package/src/compiler/validator/resource-lifetime.ts +153 -0
- package/src/compiler/validator/turbowarp-subset.ts +387 -0
- package/src/compiler/validator/types.ts +68 -0
- package/src/config.ts +1 -1
- package/src/extension.ts +87 -1
- package/src/fixed-input-editors.ts +181 -0
- package/src/fixed-input-schema.ts +15 -0
- package/src/named-body.ts +495 -0
- package/src/named-data-namespace.ts +6 -0
- package/src/protocol.ts +50 -1
- package/src/resource-named-body-provider.ts +106 -0
- package/src/server.ts +88 -8
- package/docs/turbowarp-http-server.architecture.visual-check.1440x900.dark.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.1440x900.light.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.2048x1320.dark.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.2048x1320.light.png +0 -0
- package/docs/turbowarp-http-server.architecture.visual-check.html +0 -32
- package/docs/turbowarp-http-server.architecture.visual-check.json +0 -547
- package/schemas/extension-manifest.schema.json +0 -49
- package/src/extension-manifest.ts +0 -149
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Structured Data lowering
|
|
2
|
+
|
|
3
|
+
Deploy IR v2 frontendは、lockされた`@kubohiroya/turbowarp-structured-data` 0.4.0/manifest format 2のserver operationを、platform-neutralなIRとruntime helperへ変換します。Cloudflare Workers、Firebase等のSDKはこの層から参照しません。
|
|
4
|
+
|
|
5
|
+
この機能はmanifest lockのversion・integrity・signature検証が成功した場合だけ利用します。未対応versionやoperationを類似処理へfallbackしません。
|
|
6
|
+
|
|
7
|
+
## Operation mapping
|
|
8
|
+
|
|
9
|
+
| manifest operation | IR v2 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| `structuredData.normalizeJson` | parse済みJSON + `json-stringify` |
|
|
12
|
+
| `structuredData.isValidJson` | `json-is-valid` |
|
|
13
|
+
| `structuredData.get` | `json-get` + `json-stringify` |
|
|
14
|
+
| `structuredData.has` | `json-has` |
|
|
15
|
+
| `structuredData.set` | `json-set` + `json-stringify` |
|
|
16
|
+
| `structuredData.delete` | `json-delete` + `json-stringify` |
|
|
17
|
+
| `structuredData.keys` | `json-keys` + `json-stringify` |
|
|
18
|
+
| `structuredData.length` | `json-length` |
|
|
19
|
+
| `structuredData.forEach` | bounded `json-for-each` |
|
|
20
|
+
| `structuredData.currentKey` | lexical `iteration-key` |
|
|
21
|
+
| `structuredData.currentIndex` | lexical `iteration-index` |
|
|
22
|
+
| `structuredData.currentValue` | lexical `iteration-value` + `json-stringify` |
|
|
23
|
+
|
|
24
|
+
TurboWarp blockのJSON入出力は実体がstringのnominal `json-text`です。動的な通常string入力には`json-text-coerce`を置き、その後`json-parse`で内部`JsonValue`へ変換します。JSON literalはcompile時に検証してtyped literalへfoldします。既知の不正literalは`TW2_STRUCTURED_INVALID_LITERAL`で停止し、動的入力の失敗だけをruntime `INVALID_JSON`にします。reporterがJSONを返す場合は`json-stringify`で`json-text`へ戻します。
|
|
25
|
+
|
|
26
|
+
## Path
|
|
27
|
+
|
|
28
|
+
MVPのgrammar IDは`tw-structured-path@1`です。compiler自身が次のliteral grammarだけを解析し、manifestからparser codeを読み込みません。
|
|
29
|
+
|
|
30
|
+
- root `$`
|
|
31
|
+
- identifier key `.name`
|
|
32
|
+
- array index `[0]`
|
|
33
|
+
- JSON quoted key `["name.with.dots"]`
|
|
34
|
+
|
|
35
|
+
`["0"]`はkey、`[0]`はindexとして異なるtyped segmentになります。dynamic pathは`TW2_STRUCTURED_DYNAMIC_PATH`、不正literalは`TW2_STRUCTURED_INVALID_PATH`です。diagnosticの`sourceRef.input`には`PATH`等の入力名を保持します。
|
|
36
|
+
|
|
37
|
+
`set`はroot置換、既存objectへのkey追加、既存array indexの置換だけを行います。中間container生成、sparse array、appendは行いません。`delete`はrootをcompile時に拒否し、array要素削除時は後続要素を左へ詰めます。すべての更新は入力を変更せず、新しいJSON値を返します。
|
|
38
|
+
|
|
39
|
+
## Iteration
|
|
40
|
+
|
|
41
|
+
`forEach`の`MAX`は1以上1000以下のinteger literalだけを受理します。IR validatorでは通常loopと共通のnesting上限8とroute worst-case work上限10000も適用します。
|
|
42
|
+
|
|
43
|
+
各loopはsource blockから決定的な`loopId`を作ります。current key/index/valueは構文木上で最も内側のactive `json-for-each`へ束縛され、nested loop終了後は外側contextへ戻ります。loop外またはscope終了後の参照は`TW2_ITERATION_CONTEXT_REQUIRED`です。objectはUnicode code point順、arrayはindex順で反復します。
|
|
44
|
+
|
|
45
|
+
## Runtime errors
|
|
46
|
+
|
|
47
|
+
runtime helperは次のcodeを持つ`IrRuntimeError`をHTTP status 422として送出します。
|
|
48
|
+
|
|
49
|
+
- `INVALID_JSON`
|
|
50
|
+
- `INVALID_PATH`(malformed IR防御。正常なgenerated codeでは発生しない)
|
|
51
|
+
- `PATH_NOT_FOUND`
|
|
52
|
+
- `TYPE_MISMATCH`
|
|
53
|
+
- `INDEX_OUT_OF_RANGE`
|
|
54
|
+
- `ITERATION_LIMIT_EXCEEDED`
|
|
55
|
+
- `ITERATION_CONTEXT_REQUIRED`(adapter側防御用)
|
|
56
|
+
|
|
57
|
+
helperのmessageに入力JSON、path、keyを埋め込みません。HTTP responseへの安定したerror envelope化はadapter error boundaryの責務です。
|
|
58
|
+
|
|
59
|
+
application JSONのobject keyはUnicode code point順に再帰的にserializeします。IR documentのcanonical serialization規則とは別であり、platform native object/mapの順序には依存しません。
|
|
60
|
+
|
|
61
|
+
## ロールバック
|
|
62
|
+
|
|
63
|
+
問題時は該当manifest lockを使う生成を停止します。manifest version不一致時はcompileを停止し、旧意味論へfallbackしません。
|
|
@@ -15145,5 +15145,9 @@
|
|
|
15145
15145
|
}
|
|
15146
15146
|
});
|
|
15147
15147
|
</script>
|
|
15148
|
+
<!-- The shared TurboWarp Plus header. It inserts itself at the top of the
|
|
15149
|
+
page in a shadow root, so it cannot disturb the styles below. -->
|
|
15150
|
+
<script type="module"
|
|
15151
|
+
src="https://kubohiroya.github.io/turbowarp-plus-site-header/dist/auto.js"></script>
|
|
15148
15152
|
</body>
|
|
15149
15153
|
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"name": "turbowarp-message-app",
|
|
4
|
+
"auth": {"kind": "none"},
|
|
5
|
+
"capabilities": [{"kind": "record-store"}],
|
|
6
|
+
"routes": [
|
|
7
|
+
{
|
|
8
|
+
"id": "home",
|
|
9
|
+
"method": "GET",
|
|
10
|
+
"path": "/",
|
|
11
|
+
"auth": "public",
|
|
12
|
+
"body": [
|
|
13
|
+
{
|
|
14
|
+
"kind": "respond",
|
|
15
|
+
"format": "text",
|
|
16
|
+
"body": {"kind": "literal", "valueType": "string", "value": "TurboWarp message API"}
|
|
17
|
+
}
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"id": "create-message",
|
|
22
|
+
"method": "POST",
|
|
23
|
+
"path": "/messages",
|
|
24
|
+
"auth": "public",
|
|
25
|
+
"body": [
|
|
26
|
+
{
|
|
27
|
+
"kind": "record-create",
|
|
28
|
+
"collection": "messages",
|
|
29
|
+
"data": {"kind": "request", "valueType": "string", "source": "body-text"},
|
|
30
|
+
"result": {"id": "created", "type": {"kind": "value", "valueType": "json-object"}}
|
|
31
|
+
},
|
|
32
|
+
{"kind": "set-status", "status": 201},
|
|
33
|
+
{
|
|
34
|
+
"kind": "respond",
|
|
35
|
+
"format": "json",
|
|
36
|
+
"body": {"kind": "binding", "valueType": "json-object", "binding": "created"}
|
|
37
|
+
}
|
|
38
|
+
]
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubohiroya/turbowarp-http-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "A TurboWarp extension for connecting block programs to an HTTP bridge server.",
|
|
5
5
|
"author": "Hiroya Kubo <hiroya@cuc.ac.jp>",
|
|
6
6
|
"license": "MPL-2.0",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"turbowarp-http-server": "dist/cli.js"
|
|
28
28
|
},
|
|
29
29
|
"files": [
|
|
30
|
+
"assets/",
|
|
30
31
|
"dist/",
|
|
31
32
|
"docs/",
|
|
32
33
|
"examples/",
|
|
@@ -37,33 +38,22 @@
|
|
|
37
38
|
"README.ja.md",
|
|
38
39
|
"LICENSE"
|
|
39
40
|
],
|
|
41
|
+
"packageManager": "pnpm@11.11.0",
|
|
40
42
|
"engines": {
|
|
41
43
|
"node": ">=22.18.0"
|
|
42
44
|
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"@hono/node-server": "^1.19.6",
|
|
45
|
-
"hono": "^4.10.7",
|
|
46
|
-
"ws": "^8.18.3"
|
|
47
|
-
},
|
|
48
|
-
"devDependencies": {
|
|
49
|
-
"@eslint/js": "^9.39.5",
|
|
50
|
-
"@kubohiroya/vite-plugin-turbowarp-extension": "0.4.0",
|
|
51
|
-
"@types/node": "^24.13.3",
|
|
52
|
-
"@types/ws": "^8.18.1",
|
|
53
|
-
"eslint": "^9.39.5",
|
|
54
|
-
"tsx": "^4.21.0",
|
|
55
|
-
"typescript": "^5.9.3",
|
|
56
|
-
"typescript-eslint": "^8.66.0",
|
|
57
|
-
"vite": "^8.2.2",
|
|
58
|
-
"vitest": "^4.1.10"
|
|
59
|
-
},
|
|
60
45
|
"scripts": {
|
|
61
46
|
"dev": "vite build --watch",
|
|
62
47
|
"dev:server": "tsx watch src/cli.ts",
|
|
63
48
|
"typecheck": "tsc --noEmit",
|
|
64
49
|
"build": "vite build && tsc -p tsconfig.cli.json",
|
|
65
|
-
"lint": "eslint src tests vite.config.ts",
|
|
50
|
+
"lint": "eslint src tests scripts/check-target-runtimes.mts vite.config.ts",
|
|
66
51
|
"test": "vitest run",
|
|
52
|
+
"test:conformance": "vitest run tests/conformance",
|
|
53
|
+
"test:conformance:frontend": "vitest run tests/conformance/frontend.test.ts",
|
|
54
|
+
"test:conformance:core": "vitest run tests/conformance/core-runtime.test.ts",
|
|
55
|
+
"test:conformance:target": "vitest run tests/conformance/target.test.ts",
|
|
56
|
+
"test:conformance:target-runtime": "tsx scripts/check-target-runtimes.mts",
|
|
67
57
|
"examples:check": "node scripts/check-examples.ts",
|
|
68
58
|
"docs": "node scripts/generate-readme.ts",
|
|
69
59
|
"docs:check": "node scripts/generate-readme.ts --check",
|
|
@@ -71,5 +61,40 @@
|
|
|
71
61
|
"start": "node dist/cli.js",
|
|
72
62
|
"check:dist": "pnpm run build && node scripts/check-dist.ts",
|
|
73
63
|
"check": "pnpm run typecheck && pnpm run lint && pnpm run test && pnpm run examples:check && pnpm run docs:check && pnpm run check:dist && pnpm run pack:check"
|
|
64
|
+
},
|
|
65
|
+
"dependencies": {
|
|
66
|
+
"@hono/node-server": "^2.1.1",
|
|
67
|
+
"hono": "^4.13.8",
|
|
68
|
+
"ws": "^8.18.3"
|
|
69
|
+
},
|
|
70
|
+
"peerDependencies": {
|
|
71
|
+
"@kubohiroya/turbowarp-named-data": "^0.5.0"
|
|
72
|
+
},
|
|
73
|
+
"devDependencies": {
|
|
74
|
+
"@cloudflare/workers-types": "^5.20260919.1",
|
|
75
|
+
"@eslint/js": "^9.39.5",
|
|
76
|
+
"@kubohiroya/turbowarp-extension-manifest": "^0.3.2",
|
|
77
|
+
"@kubohiroya/turbowarp-named-data": "^0.5.0",
|
|
78
|
+
"@kubohiroya/vite-plugin-turbowarp-extension": "^0.8.0",
|
|
79
|
+
"@types/node": "^24.13.3",
|
|
80
|
+
"@types/ws": "^8.18.1",
|
|
81
|
+
"eslint": "^9.39.5",
|
|
82
|
+
"firebase-admin": "^14.4.0",
|
|
83
|
+
"firebase-functions": "^7.4.0",
|
|
84
|
+
"firebase-tools": "15.30.2",
|
|
85
|
+
"jose": "^6.1.0",
|
|
86
|
+
"tsx": "^4.21.0",
|
|
87
|
+
"typescript": "^5.9.3",
|
|
88
|
+
"typescript-eslint": "^8.66.0",
|
|
89
|
+
"vite": "^8.2.2",
|
|
90
|
+
"vitest": "^4.1.10",
|
|
91
|
+
"wrangler": "4.135.0",
|
|
92
|
+
"@kubohiroya/turbowarp-extension-data-editor": "^0.3.4"
|
|
93
|
+
},
|
|
94
|
+
"gitHead": "c3accb55082f9a8fe07f2d85506542faebe76b53",
|
|
95
|
+
"x-turbowarp-source": {
|
|
96
|
+
"revision": "c3accb55082f9a8fe07f2d85506542faebe76b53",
|
|
97
|
+
"revisionRole": "base-commit",
|
|
98
|
+
"sourceState": "local-release-overlay"
|
|
74
99
|
}
|
|
75
|
-
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://kubohiroya.github.io/turbowarp-http-server/schemas/block-editor-fixed-inputs.schema.json",
|
|
4
|
+
"$defs": {
|
|
5
|
+
"changeHandlerVariable": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"AMOUNT": {
|
|
9
|
+
"type": "number"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"required": [
|
|
13
|
+
"AMOUNT"
|
|
14
|
+
],
|
|
15
|
+
"additionalProperties": true
|
|
16
|
+
},
|
|
17
|
+
"setHttpStatus": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"STATUS": {
|
|
21
|
+
"type": "number"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"required": [
|
|
25
|
+
"STATUS"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": true
|
|
28
|
+
},
|
|
29
|
+
"respondWithNamedBody": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"properties": {
|
|
32
|
+
"KIND": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"enum": [
|
|
35
|
+
"structured",
|
|
36
|
+
"document",
|
|
37
|
+
"binary",
|
|
38
|
+
"asset"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"SCOPE": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"enum": [
|
|
44
|
+
"target",
|
|
45
|
+
"project"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"REPRESENTATION": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": [
|
|
51
|
+
"json",
|
|
52
|
+
"yaml",
|
|
53
|
+
"html",
|
|
54
|
+
"markdown",
|
|
55
|
+
"raw"
|
|
56
|
+
]
|
|
57
|
+
},
|
|
58
|
+
"MAX_BYTES": {
|
|
59
|
+
"type": "number",
|
|
60
|
+
"minimum": 1,
|
|
61
|
+
"exclusiveMaximum": 9007199254740992
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"required": [
|
|
65
|
+
"KIND",
|
|
66
|
+
"SCOPE",
|
|
67
|
+
"REPRESENTATION",
|
|
68
|
+
"MAX_BYTES"
|
|
69
|
+
],
|
|
70
|
+
"additionalProperties": true
|
|
71
|
+
},
|
|
72
|
+
"markdownHeading": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"properties": {
|
|
75
|
+
"LEVEL": {
|
|
76
|
+
"type": "number"
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"required": [
|
|
80
|
+
"LEVEL"
|
|
81
|
+
],
|
|
82
|
+
"additionalProperties": true
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/kubohiroya/turbowarp-http-server/main/schemas/compiler-extension-manifest.schema.json",
|
|
4
|
+
"title": "TurboWarp Server Compiler Extension Manifest",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["formatVersion", "id", "blocks"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"formatVersion": {"enum": [1, 2]},
|
|
10
|
+
"id": {"type": "string", "pattern": "^[a-z0-9]+$"},
|
|
11
|
+
"pathSegmentType": {"$ref": "#/$defs/pathSegmentType"},
|
|
12
|
+
"dataReferenceType": {"$ref": "#/$defs/dataReferenceType"},
|
|
13
|
+
"blocks": {
|
|
14
|
+
"type": "array",
|
|
15
|
+
"minItems": 1,
|
|
16
|
+
"maxItems": 2048,
|
|
17
|
+
"items": {"$ref": "#/$defs/block"}
|
|
18
|
+
},
|
|
19
|
+
"menus": {"type": "array"}
|
|
20
|
+
},
|
|
21
|
+
"allOf": [
|
|
22
|
+
{
|
|
23
|
+
"if": {"properties": {"formatVersion": {"const": 2}}, "required": ["formatVersion"]},
|
|
24
|
+
"then": {
|
|
25
|
+
"properties": {"blocks": {"items": {"$ref": "#/$defs/blockV2"}}}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
],
|
|
29
|
+
"$defs": {
|
|
30
|
+
"dataReferenceType": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": false,
|
|
33
|
+
"required": ["kind", "scope", "lifetime", "valueType"],
|
|
34
|
+
"properties": {
|
|
35
|
+
"kind": {"type": "string", "minLength": 1},
|
|
36
|
+
"scope": {"type": "string", "minLength": 1},
|
|
37
|
+
"lifetime": {"type": "string", "minLength": 1},
|
|
38
|
+
"valueType": {"type": "string", "minLength": 1}
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"pathSegmentType": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"additionalProperties": false,
|
|
44
|
+
"required": ["kind", "variants"],
|
|
45
|
+
"properties": {
|
|
46
|
+
"kind": {"const": "discriminatedUnion"},
|
|
47
|
+
"variants": {
|
|
48
|
+
"type": "array",
|
|
49
|
+
"prefixItems": [
|
|
50
|
+
{
|
|
51
|
+
"type": "object",
|
|
52
|
+
"additionalProperties": false,
|
|
53
|
+
"required": ["kind", "valueType"],
|
|
54
|
+
"properties": {"kind": {"const": "key"}, "valueType": {"const": "string"}}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": false,
|
|
59
|
+
"required": ["kind", "valueType"],
|
|
60
|
+
"properties": {"kind": {"const": "index"}, "valueType": {"const": "nonNegativeInteger"}}
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"items": false,
|
|
64
|
+
"minItems": 2,
|
|
65
|
+
"maxItems": 2
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"argument": {
|
|
70
|
+
"type": "object",
|
|
71
|
+
"additionalProperties": false,
|
|
72
|
+
"required": ["id", "type"],
|
|
73
|
+
"properties": {
|
|
74
|
+
"id": {"type": "string", "minLength": 1},
|
|
75
|
+
"type": {"enum": ["STRING", "NUMBER", "BOOLEAN"]},
|
|
76
|
+
"menu": {"type": "string", "minLength": 1},
|
|
77
|
+
"normalizesTo": {"const": "pathSegments"},
|
|
78
|
+
"staticLiteral": {"type": "boolean"},
|
|
79
|
+
"minimum": {"type": "number"},
|
|
80
|
+
"maximum": {"type": "number"}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"server": {
|
|
84
|
+
"type": "object",
|
|
85
|
+
"additionalProperties": false,
|
|
86
|
+
"required": ["supported"],
|
|
87
|
+
"properties": {
|
|
88
|
+
"supported": {"type": "boolean"},
|
|
89
|
+
"irOperation": {"type": "string", "minLength": 1}
|
|
90
|
+
},
|
|
91
|
+
"allOf": [
|
|
92
|
+
{
|
|
93
|
+
"if": {"properties": {"supported": {"const": true}}, "required": ["supported"]},
|
|
94
|
+
"then": {"required": ["irOperation"]}
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"block": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"additionalProperties": false,
|
|
101
|
+
"required": ["opcode", "blockType", "arguments"],
|
|
102
|
+
"properties": {
|
|
103
|
+
"opcode": {"type": "string", "pattern": "^[A-Za-z][A-Za-z0-9_]*$"},
|
|
104
|
+
"blockType": {"enum": ["COMMAND", "REPORTER", "BOOLEAN", "HAT", "LOOP"]},
|
|
105
|
+
"arguments": {"type": "array", "items": {"$ref": "#/$defs/argument"}},
|
|
106
|
+
"resultType": {"enum": ["json", "boolean", "number", "string", "void", "jsonText", "yamlText"]},
|
|
107
|
+
"effect": {
|
|
108
|
+
"enum": ["pure", "immutable", "control", "request-read", "response-write", "storage-read", "storage-write", "binary-read", "binary-write", "state"]
|
|
109
|
+
},
|
|
110
|
+
"immutable": {"type": "boolean"},
|
|
111
|
+
"errors": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"uniqueItems": true,
|
|
114
|
+
"items": {"type": "string", "pattern": "^[A-Z][A-Z0-9_]*$"}
|
|
115
|
+
},
|
|
116
|
+
"server": {"$ref": "#/$defs/server"}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
"blockV2": {
|
|
120
|
+
"allOf": [
|
|
121
|
+
{"$ref": "#/$defs/block"},
|
|
122
|
+
{"required": ["resultType", "effect", "immutable", "errors", "server"]}
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://raw.githubusercontent.com/kubohiroya/turbowarp-http-server/main/schemas/compiler-manifest-lock-v1.schema.json",
|
|
4
|
+
"title": "TurboWarp Server Compiler Manifest Lock v1",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": false,
|
|
7
|
+
"required": ["lockVersion", "extensions"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"lockVersion": {"const": 1},
|
|
10
|
+
"extensions": {
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {"$ref": "#/$defs/entry"}
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"$defs": {
|
|
16
|
+
"entry": {
|
|
17
|
+
"type": "object",
|
|
18
|
+
"additionalProperties": false,
|
|
19
|
+
"required": ["extensionId", "packageName", "packageVersion", "manifestFormatVersion", "integrity", "source"],
|
|
20
|
+
"properties": {
|
|
21
|
+
"extensionId": {"type": "string", "pattern": "^[a-z0-9]+$"},
|
|
22
|
+
"packageName": {"type": "string", "minLength": 1},
|
|
23
|
+
"packageVersion": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$"
|
|
26
|
+
},
|
|
27
|
+
"manifestFormatVersion": {"enum": [1, 2]},
|
|
28
|
+
"integrity": {"type": "string", "pattern": "^sha256-[A-Za-z0-9+/]{43}=$"},
|
|
29
|
+
"source": {
|
|
30
|
+
"oneOf": [
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["kind", "id"],
|
|
35
|
+
"properties": {"kind": {"const": "bundled"}, "id": {"type": "string", "minLength": 1}}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"type": "object",
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["kind", "path"],
|
|
41
|
+
"properties": {"kind": {"const": "local"}, "path": {"type": "string", "minLength": 1}}
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|