Schema: add typed set and map types (ReadonlySet / ReadonlyMap)
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 57/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- typescript
调研方向
Start with ecs/packages/ecs/src/interface/schema/schema.ts, the existing reference implementation mentioned in the issue, then trace this repository’s Schema, schemaTypes, Schema.ToType, toTypeScript, validation, and createCoerceFunction entry points. Add typed set and map support across those areas and pin the inferred types with type tests. Done means values validate and coerce their typed elements, render as ReadonlySet<T> and ReadonlyMap<K, V>, and round-trip through Data.stringify and Data.parse.
由索引模型根据 Issue 内容生成。
描述
Problem
Data includes ReadonlySet<Data> and ReadonlyMap<Data, Data>, and Data.stringify / Data.parse round-trip both, but Schema has no way to describe either with typed elements.
typeacceptsnumber | integer | string | boolean | null | array | object | typed-buffer | blob | observe | promise | generator | function. There's nosetormap.- The only escape hatch is
typeName:Schema.ToType<{ typeName: 'Set' }>isReadonlySet<any>, which loses the element type.toTypeScriptrenders it as a bareSet.{ typeName: 'ReadonlySet' }resolves toany, becauseReadonlySetisn't a runtime global. uniqueItemson an array doesn't map to a set either.
So a schema-described value that's naturally a set, such as an observable set of ids exposed to an agent, has to be modeled as an array.
Proposal
Port the set and map forms that @adobe/ecs already has (ecs/packages/ecs/src/interface/schema/schema.ts):
{ type: 'set', items: S } // ToType → ReadonlySet<ToType<S>>
{ type: 'map', keys: K, values: V } // ToType → ReadonlyMap<ToType<K>, ToType<V>>
Covering:
Schema/schemaTypes: addsetandmap.Schema.ToType: map them toReadonlySet/ReadonlyMapwith typed elements.toTypeScript: renderReadonlySet<T>/ReadonlyMap<K, V>.- Validation and
createCoerceFunction: check elements againstitems, andkeys/values. - Type-tests pinning
ToTypefor both, plus a round-trip test throughData.stringify/Data.parse.
Motivation
Firefly Platform's agentic surface types (Agentic.State<S> derives its value type from Schema.ToType<S>) need an Observe<ReadonlySet<AppId>> state. Until this lands it uses ReadonlyArray<AppId>.
- 主要语言
- TypeScript
- 星标
- 12
- 派生
- 8
- 平均合并
- 9 小时 2 分钟
- 30 天内合并 PR
- 25
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
adobe/data 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 38/100
维护者通常 1 天内回复
-
ecs: let kernels issue commands through helpers (component lists, symbol-keyed values, void helpers)未关闭
难度 5/5 一周以上 新手友好度 15/100
维护者通常 1 天内回复
-
createLazy: wrap nested service groups and accept partial (subset) schemas可能已有人在做 @krisnye 于 2 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 30/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
langchain-ai/langchainjs#12157 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 86/100
activescott/home-infra-k8s-flux#511 ·
维护者通常 1 天内回复
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 72/100
lingdojo/kana-dojo#33753 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复
-
android:player
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
follow-up needs-triage S3: minor
难度 1/5 1-3 小时 新手友好度 85/100
manaflow-ai/cmux#38032 · 1 条评论 ·
维护者通常 1 天内回复