@arcadia-eternity/schema 0.0.0-stage → 4.2.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Arcadia Eternity contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js ADDED
@@ -0,0 +1,571 @@
1
+ import { Value } from "@sinclair/typebox/value";
2
+ import { Type } from "@sinclair/typebox";
3
+ import { AttackTargetOpinion, Category, ELEMENT_CHART, ELEMENT_MAP, Element, Element as Element$1, Gender, IgnoreStageStrategy, Nature, StackStrategy } from "@arcadia-eternity/const";
4
+ import { nanoid } from "nanoid";
5
+ //#region src/utils.ts
6
+ /**
7
+ * 解析并验证数据,类似 Zod 的 parse 行为
8
+ * 1. 填充默认值
9
+ * 2. 清理多余字段
10
+ * 3. 验证数据
11
+ */
12
+ function parseWithErrors(schema, data) {
13
+ const cloned = Value.Clone(data);
14
+ const withDefaults = Value.Default(schema, cloned);
15
+ const cleaned = Value.Clean(schema, withDefaults);
16
+ const converted = Value.Convert(schema, cleaned);
17
+ if (Value.Check(schema, converted)) return converted;
18
+ const message = [...Value.Errors(schema, converted)].map((e) => `${e.path}: ${e.message}`).join("; ");
19
+ throw new Error(`Validation failed: ${message}`);
20
+ }
21
+ /**
22
+ * 将 TypeScript native enum 转为 TypeBox Union of Literal
23
+ * 适用于 string enum(如 Element, Category 等)
24
+ * 保留字面量类型信息
25
+ */
26
+ function StringEnum(values) {
27
+ return Type.Union(values.map((v) => Type.Literal(v)));
28
+ }
29
+ /**
30
+ * 将 TypeScript native enum (numeric or string) 转为 TypeBox schema
31
+ * 适用于 nativeEnum 场景(如 StackStrategy)
32
+ */
33
+ function NativeEnum(enumObj) {
34
+ const values = Object.values(enumObj).filter((v) => typeof v === "string");
35
+ if (values.length === 0) {
36
+ const numValues = Object.values(enumObj).filter((v) => typeof v === "number");
37
+ return Type.Union(numValues.map((v) => Type.Literal(v)));
38
+ }
39
+ return Type.Union(values.map((v) => Type.Literal(v)));
40
+ }
41
+ //#endregion
42
+ //#region src/element.ts
43
+ const ElementSchema = StringEnum(Object.values(Element));
44
+ //#endregion
45
+ //#region src/presentation.ts
46
+ const ResourceReferenceSchema = Type.Union([Type.String({ minLength: 1 }), Type.Object({
47
+ namespace: Type.String({ minLength: 1 }),
48
+ id: Type.String({ minLength: 1 })
49
+ }, { additionalProperties: false })]);
50
+ const ContentPresentationSchema = Type.Object({
51
+ icon: Type.Optional(ResourceReferenceSchema),
52
+ portrait: Type.Optional(ResourceReferenceSchema),
53
+ cry: Type.Optional(ResourceReferenceSchema),
54
+ sfx: Type.Optional(ResourceReferenceSchema),
55
+ background: Type.Optional(ResourceReferenceSchema),
56
+ music: Type.Optional(ResourceReferenceSchema),
57
+ battle: Type.Optional(Type.Object({
58
+ renderer: Type.Union([Type.Literal("image"), Type.Literal("seer2-swf")]),
59
+ source: ResourceReferenceSchema,
60
+ fallback: Type.Optional(ResourceReferenceSchema)
61
+ }, { additionalProperties: false }))
62
+ }, { additionalProperties: false });
63
+ const ResourceMimeSchema = Type.Union([
64
+ "image/png",
65
+ "image/jpeg",
66
+ "image/webp",
67
+ "audio/ogg",
68
+ "audio/mpeg",
69
+ "application/x-shockwave-flash"
70
+ ].map((value) => Type.Literal(value)));
71
+ const PresentationResourceSchema = Type.Union([Type.Object({
72
+ kind: Type.Literal("file"),
73
+ tags: Type.Optional(Type.Array(Type.String())),
74
+ id: Type.String({ minLength: 1 }),
75
+ source: Type.String({ minLength: 1 }),
76
+ sha256: Type.String({ pattern: "^[a-f0-9]{64}$" }),
77
+ bytes: Type.Integer({
78
+ minimum: 1,
79
+ maximum: 64 * 1024 * 1024
80
+ }),
81
+ mime: ResourceMimeSchema
82
+ }, { additionalProperties: false }), Type.Object({
83
+ kind: Type.Literal("http"),
84
+ tags: Type.Optional(Type.Array(Type.String())),
85
+ id: Type.String({ minLength: 1 }),
86
+ source: Type.String({ pattern: "^https?://" }),
87
+ mime: Type.Optional(ResourceMimeSchema)
88
+ }, { additionalProperties: false })]);
89
+ const ResourceDefinitionSchema = Type.Object({
90
+ id: Type.String({ pattern: "^[a-zA-Z0-9][a-zA-Z0-9_.:-]*$" }),
91
+ kind: Type.Union([
92
+ Type.Literal("image"),
93
+ Type.Literal("audio"),
94
+ Type.Literal("swf")
95
+ ]),
96
+ source: Type.String({ minLength: 1 }),
97
+ name: Type.Optional(Type.String()),
98
+ tags: Type.Optional(Type.Array(Type.String()))
99
+ }, { additionalProperties: false });
100
+ const PresentationBindingSchema = Type.Object({
101
+ id: Type.String({ minLength: 1 }),
102
+ target: Type.Object({
103
+ kind: Type.Union([
104
+ Type.Literal("species"),
105
+ Type.Literal("skills"),
106
+ Type.Literal("marks")
107
+ ]),
108
+ id: Type.String({ minLength: 1 })
109
+ }, { additionalProperties: false }),
110
+ ...ContentPresentationSchema.properties
111
+ }, { additionalProperties: false });
112
+ const ResourceDataSetSchema = Type.Array(ResourceDefinitionSchema);
113
+ const PresentationDataSetSchema = Type.Array(PresentationBindingSchema);
114
+ const PresentationManifestSchema = Type.Object({
115
+ version: Type.Literal(2),
116
+ bindings: PresentationDataSetSchema,
117
+ defaultLocale: Type.String({ minLength: 1 }),
118
+ resources: Type.Array(PresentationResourceSchema, { maxItems: 4096 }),
119
+ locales: Type.Record(Type.String(), Type.Record(Type.String(), Type.Record(Type.String(), Type.Unknown())))
120
+ }, { additionalProperties: false });
121
+ //#endregion
122
+ //#region src/mark.ts
123
+ const StackStrategySchema = NativeEnum(StackStrategy);
124
+ const MarkConfigSchema = Type.Object({
125
+ duration: Type.Number({ default: -1 }),
126
+ persistent: Type.Boolean({ default: true }),
127
+ maxStacks: Type.Integer({ default: 1 }),
128
+ stackable: Type.Boolean({ default: false }),
129
+ stackStrategy: Type.Union(Object.values(StackStrategy).map((v) => Type.Literal(v)), { default: StackStrategy.extend }),
130
+ destroyable: Type.Boolean({ default: true }),
131
+ isShield: Type.Boolean({ default: false }),
132
+ keepOnSwitchOut: Type.Boolean({ default: false }),
133
+ transferOnSwitch: Type.Boolean({ default: false }),
134
+ inheritOnFaint: Type.Boolean({ default: false }),
135
+ mutexGroup: Type.Optional(Type.String())
136
+ }, { additionalProperties: true });
137
+ const MarkSchema = Type.Object({
138
+ presentation: Type.Optional(ContentPresentationSchema),
139
+ id: Type.String({ minLength: 1 }),
140
+ config: Type.Optional(MarkConfigSchema),
141
+ tags: Type.Optional(Type.Array(Type.String(), { default: [] })),
142
+ effect: Type.Optional(Type.Array(Type.String(), { default: [] }))
143
+ });
144
+ function validateMark(data) {
145
+ return parseWithErrors(MarkSchema, data);
146
+ }
147
+ /** Editable rules exclude display metadata; runtime UI schemas above accept the resolved view. */
148
+ const MarkDefinitionSchema = Type.Omit(MarkSchema, ["presentation"]);
149
+ const MarkDataSetSchema = Type.Array(MarkDefinitionSchema);
150
+ //#endregion
151
+ //#region src/markImage.ts
152
+ const MarkImageSchema = Type.Record(Type.String(), Type.String({ format: "uri" }));
153
+ //#endregion
154
+ //#region src/metadata.ts
155
+ const MetadataSchema = Type.Object({
156
+ metaType: Type.Union([
157
+ Type.Literal("effect"),
158
+ Type.Literal("mark"),
159
+ Type.Literal("skill"),
160
+ Type.Literal("species")
161
+ ]),
162
+ version: Type.String({ pattern: "^\\d+\\.\\d+\\.\\d+$" })
163
+ });
164
+ function extractMetadata(content) {
165
+ return parseWithErrors(MetadataSchema, content.split("\n").filter((line) => line.startsWith("# @")).reduce((acc, line) => {
166
+ const [key, ...values] = line.slice(3).split(/\s+/);
167
+ if (key && values.length) acc[key] = values.join(" ");
168
+ return acc;
169
+ }, {}));
170
+ }
171
+ //#endregion
172
+ //#region src/pet.ts
173
+ const NANOID_PATTERN$1 = "^[A-Za-z0-9_-]{21}$";
174
+ const StatOutBattleEVSSchema = Type.Object({
175
+ hp: Type.Integer({
176
+ minimum: 0,
177
+ maximum: 255
178
+ }),
179
+ atk: Type.Integer({
180
+ minimum: 0,
181
+ maximum: 255
182
+ }),
183
+ def: Type.Integer({
184
+ minimum: 0,
185
+ maximum: 255
186
+ }),
187
+ spa: Type.Integer({
188
+ minimum: 0,
189
+ maximum: 255
190
+ }),
191
+ spd: Type.Integer({
192
+ minimum: 0,
193
+ maximum: 255
194
+ }),
195
+ spe: Type.Integer({
196
+ minimum: 0,
197
+ maximum: 255
198
+ })
199
+ });
200
+ const StatOutBattleIVSSchema = Type.Object({
201
+ hp: Type.Integer({
202
+ minimum: 0,
203
+ maximum: 31
204
+ }),
205
+ atk: Type.Integer({
206
+ minimum: 0,
207
+ maximum: 31
208
+ }),
209
+ def: Type.Integer({
210
+ minimum: 0,
211
+ maximum: 31
212
+ }),
213
+ spa: Type.Integer({
214
+ minimum: 0,
215
+ maximum: 31
216
+ }),
217
+ spd: Type.Integer({
218
+ minimum: 0,
219
+ maximum: 31
220
+ }),
221
+ spe: Type.Integer({
222
+ minimum: 0,
223
+ maximum: 31
224
+ })
225
+ });
226
+ const PetSchema = Type.Object({
227
+ name: Type.String({ minLength: 1 }),
228
+ id: Type.String({
229
+ pattern: NANOID_PATTERN$1,
230
+ default: nanoid()
231
+ }),
232
+ species: Type.String({ pattern: "^(?:pet_.*|[a-z0-9][a-z0-9_.-]{0,79}:[a-z0-9][a-z0-9_./-]{0,119})$" }),
233
+ level: Type.Integer({ minimum: 1 }),
234
+ evs: StatOutBattleEVSSchema,
235
+ ivs: StatOutBattleIVSSchema,
236
+ nature: StringEnum(Object.values(Nature)),
237
+ gender: Type.Optional(StringEnum(Object.values(Gender))),
238
+ height: Type.Optional(Type.Number()),
239
+ weight: Type.Optional(Type.Number()),
240
+ skills: Type.Array(Type.String(), {
241
+ minItems: 0,
242
+ maxItems: 5
243
+ }),
244
+ maxHp: Type.Optional(Type.Integer({ exclusiveMinimum: 0 })),
245
+ ability: Type.Optional(Type.String()),
246
+ emblem: Type.Optional(Type.String())
247
+ });
248
+ const PetSetSchema = Type.Array(PetSchema);
249
+ function validatePet(data) {
250
+ return parseWithErrors(PetSchema, data);
251
+ }
252
+ function validatePetSet(data) {
253
+ return parseWithErrors(PetSetSchema, data);
254
+ }
255
+ const PlayerSchema = Type.Object({
256
+ name: Type.String({ minLength: 1 }),
257
+ id: Type.String({
258
+ pattern: "^[A-Za-z0-9_-]{21}$",
259
+ default: nanoid()
260
+ }),
261
+ team: Type.Array(PetSchema, {
262
+ minItems: 1,
263
+ maxItems: 6
264
+ })
265
+ });
266
+ //#endregion
267
+ //#region src/skill.ts
268
+ const CategorySchema = StringEnum(Object.values(Category));
269
+ const AttackTargetOpinionSchema = StringEnum(Object.values(AttackTargetOpinion));
270
+ const ignoreStageStrategySchema = StringEnum(Object.values(IgnoreStageStrategy));
271
+ const SkillSchema = Type.Object({
272
+ presentation: Type.Optional(ContentPresentationSchema),
273
+ id: Type.String({ minLength: 1 }),
274
+ element: Type.Union(Object.values(Element$1).map((v) => Type.Literal(v)), { default: Element$1.Normal }),
275
+ category: Type.Union(Object.values(Category).map((v) => Type.Literal(v)), { default: Category.Physical }),
276
+ power: Type.Integer({
277
+ minimum: 0,
278
+ default: 0
279
+ }),
280
+ rage: Type.Integer({
281
+ minimum: 0,
282
+ default: 0
283
+ }),
284
+ accuracy: Type.Number({
285
+ minimum: 0,
286
+ maximum: 100,
287
+ default: 100
288
+ }),
289
+ priority: Type.Optional(Type.Integer({ default: 0 })),
290
+ target: Type.Optional(Type.Union(Object.values(AttackTargetOpinion).map((v) => Type.Literal(v)), { default: AttackTargetOpinion.opponent })),
291
+ multihit: Type.Optional(Type.Union([Type.Number(), Type.Tuple([Type.Number(), Type.Number()])])),
292
+ sureHit: Type.Boolean({ default: false }),
293
+ sureCrit: Type.Boolean({ default: false }),
294
+ ignoreShield: Type.Boolean({ default: false }),
295
+ ignoreOpponentStageStrategy: Type.Union(Object.values(IgnoreStageStrategy).map((v) => Type.Literal(v)), { default: IgnoreStageStrategy.none }),
296
+ tags: Type.Array(Type.String(), { default: [] }),
297
+ effect: Type.Optional(Type.Array(Type.String(), { default: [] }))
298
+ });
299
+ /** Editable rules exclude display metadata; runtime UI schemas above accept the resolved view. */
300
+ const SkillDefinitionSchema = Type.Omit(SkillSchema, ["presentation"]);
301
+ const SkillDataSetSchema = Type.Array(SkillDefinitionSchema);
302
+ //#endregion
303
+ //#region src/uiMetadata.ts
304
+ const UIHintKey = "uiHint";
305
+ function withUIHint(schema, hint) {
306
+ schema[UIHintKey] = hint;
307
+ return schema;
308
+ }
309
+ function getUIHint(schema) {
310
+ return schema[UIHintKey];
311
+ }
312
+ function getArrayUIHint(schema) {
313
+ const hint = getUIHint(schema);
314
+ return {
315
+ display: hint?.display ?? "drilldown",
316
+ itemLabel: hint?.itemLabel,
317
+ collapsible: hint?.collapsible ?? true,
318
+ collapsed: hint?.collapsed ?? false
319
+ };
320
+ }
321
+ function getObjectUIHint(schema) {
322
+ const hint = getUIHint(schema);
323
+ return {
324
+ display: hint?.display ?? "drilldown",
325
+ order: hint?.order,
326
+ hidden: hint?.hidden,
327
+ collapsible: hint?.collapsible ?? false,
328
+ collapsed: hint?.collapsed ?? false
329
+ };
330
+ }
331
+ function getFieldUIHint(schema) {
332
+ const hint = getUIHint(schema);
333
+ return {
334
+ label: hint?.label,
335
+ helpText: hint?.helpText,
336
+ prominent: hint?.prominent ?? false
337
+ };
338
+ }
339
+ //#endregion
340
+ //#region src/species.ts
341
+ const LearnableSkillSchema = Type.Object({
342
+ skill_id: Type.String(),
343
+ level: Type.Number({ default: 1 }),
344
+ hidden: Type.Boolean({ default: false })
345
+ });
346
+ const SpeciesSchema = Type.Object({
347
+ id: Type.String({ minLength: 1 }),
348
+ num: Type.Number({ default: 0 }),
349
+ presentation: Type.Optional(ContentPresentationSchema),
350
+ element: Type.Union(Object.values(Element).map((v) => Type.Literal(v)), { default: Element.Normal }),
351
+ baseStats: withUIHint(Type.Object({
352
+ hp: Type.Number({ default: 100 }),
353
+ atk: Type.Number({ default: 100 }),
354
+ spa: Type.Number({ default: 100 }),
355
+ def: Type.Number({ default: 100 }),
356
+ spd: Type.Number({ default: 100 }),
357
+ spe: Type.Number({ default: 100 })
358
+ }, { default: {
359
+ hp: 100,
360
+ atk: 100,
361
+ spa: 100,
362
+ def: 100,
363
+ spd: 100,
364
+ spe: 100
365
+ } }), { display: "inline" }),
366
+ genderRatio: Type.Union([Type.Tuple([Type.Number(), Type.Number()]), Type.Null()], { default: [50, 50] }),
367
+ heightRange: Type.Tuple([Type.Number(), Type.Number()], { default: [10, 20] }),
368
+ weightRange: Type.Tuple([Type.Number(), Type.Number()], { default: [10, 20] }),
369
+ learnable_skills: withUIHint(Type.Array(LearnableSkillSchema, { default: [] }), {
370
+ display: "inline",
371
+ itemLabel: "skill_id",
372
+ collapsible: true,
373
+ collapsed: true
374
+ }),
375
+ ability: withUIHint(Type.Array(Type.String(), { default: [] }), { display: "inline" }),
376
+ emblem: withUIHint(Type.Array(Type.String(), { default: [] }), { display: "inline" })
377
+ });
378
+ /** Editable rules exclude display metadata; runtime UI schemas above accept the resolved view. */
379
+ const SpeciesDefinitionSchema = Type.Omit(SpeciesSchema, ["presentation"]);
380
+ const SpeciesDataSetSchema = Type.Array(SpeciesDefinitionSchema);
381
+ //#endregion
382
+ //#region src/schema.ts
383
+ const DATA_SCHEMA_MAP = {
384
+ mark: MarkDataSetSchema,
385
+ skill: SkillDataSetSchema,
386
+ species: SpeciesDataSetSchema
387
+ };
388
+ const SCHEMA_MAP = {
389
+ mark: MarkDefinitionSchema,
390
+ skill: SkillDefinitionSchema,
391
+ species: SpeciesDefinitionSchema
392
+ };
393
+ //#endregion
394
+ //#region src/selection.ts
395
+ const RuntimeEntityIdSchema = Type.String({
396
+ minLength: 1,
397
+ pattern: "^[A-Za-z0-9_-]+$"
398
+ });
399
+ const UseSkillSelectionSchema = Type.Object({
400
+ type: Type.Literal("use-skill"),
401
+ player: RuntimeEntityIdSchema,
402
+ skill: Type.String(),
403
+ target: AttackTargetOpinionSchema
404
+ }, { additionalProperties: false });
405
+ const SwitchPetSelectionSchema = Type.Object({
406
+ type: Type.Literal("switch-pet"),
407
+ player: RuntimeEntityIdSchema,
408
+ pet: RuntimeEntityIdSchema
409
+ }, { additionalProperties: false });
410
+ const DoNothingSelectionSchema = Type.Object({
411
+ type: Type.Literal("do-nothing"),
412
+ player: RuntimeEntityIdSchema
413
+ }, { additionalProperties: false });
414
+ const SurrenderSelectionSchema = Type.Object({
415
+ type: Type.Literal("surrender"),
416
+ player: RuntimeEntityIdSchema
417
+ }, { additionalProperties: false });
418
+ const TeamSelectionSchema = Type.Object({
419
+ type: Type.Literal("team-selection"),
420
+ player: RuntimeEntityIdSchema,
421
+ selectedPets: Type.Array(RuntimeEntityIdSchema),
422
+ starterPetId: RuntimeEntityIdSchema
423
+ }, { additionalProperties: false });
424
+ const PlayerSelectionSchema = Type.Union([
425
+ UseSkillSelectionSchema,
426
+ SwitchPetSelectionSchema,
427
+ DoNothingSelectionSchema,
428
+ SurrenderSelectionSchema,
429
+ TeamSelectionSchema
430
+ ]);
431
+ const PlayerSelectionsSchema = Type.Object({
432
+ playerId: RuntimeEntityIdSchema,
433
+ selections: PlayerSelectionSchema
434
+ });
435
+ //#endregion
436
+ //#region src/pack.ts
437
+ const PackEngineSchema = Type.Literal("seer2-v2");
438
+ const PackDependencySchema = Type.Object({
439
+ path: Type.String({ minLength: 1 }),
440
+ id: Type.Optional(Type.String({ minLength: 1 })),
441
+ optional: Type.Optional(Type.Boolean())
442
+ });
443
+ const PackPathsSchema = Type.Object({
444
+ dataDir: Type.Optional(Type.String({ minLength: 1 })),
445
+ localesDir: Type.Optional(Type.String({ minLength: 1 }))
446
+ });
447
+ const PackDataFilesSchema = Type.Object({
448
+ effects: Type.Array(Type.String({ minLength: 1 })),
449
+ marks: Type.Array(Type.String({ minLength: 1 })),
450
+ skills: Type.Array(Type.String({ minLength: 1 })),
451
+ species: Type.Array(Type.String({ minLength: 1 }))
452
+ });
453
+ const PackLocaleEntrySchema = Type.Object({
454
+ locale: Type.String({ minLength: 1 }),
455
+ files: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
456
+ namespaces: Type.Optional(Type.Array(Type.String({ minLength: 1 })))
457
+ });
458
+ const PackLocalesSchema = Type.Union([Type.Record(Type.String({ minLength: 1 }), Type.Array(Type.String({ minLength: 1 }))), Type.Array(PackLocaleEntrySchema)]);
459
+ const PackManifestSchema = Type.Object({
460
+ id: Type.String({ minLength: 1 }),
461
+ version: Type.String({ minLength: 1 }),
462
+ engine: PackEngineSchema,
463
+ engineRange: Type.Optional(Type.String({ minLength: 1 })),
464
+ content: Type.Optional(Type.String({ minLength: 1 })),
465
+ presentation: Type.Optional(Type.String({ minLength: 1 })),
466
+ assetsRef: Type.Optional(Type.Union([Type.String({ minLength: 1 }), Type.Array(Type.String({ minLength: 1 }), { minItems: 1 })])),
467
+ layoutVersion: Type.Optional(Type.Literal(1)),
468
+ dependencies: Type.Optional(Type.Array(PackDependencySchema)),
469
+ paths: Type.Optional(PackPathsSchema),
470
+ data: PackDataFilesSchema,
471
+ locales: Type.Optional(PackLocalesSchema)
472
+ });
473
+ const PackLockEntrySchema = Type.Object({
474
+ id: Type.String({ minLength: 1 }),
475
+ version: Type.String({ minLength: 1 }),
476
+ integrity: Type.String({ minLength: 1 }),
477
+ source: Type.String({ minLength: 1 })
478
+ });
479
+ const PackLockSchema = Type.Object({
480
+ lockVersion: Type.Literal(1),
481
+ engine: PackEngineSchema,
482
+ packs: Type.Array(PackLockEntrySchema, { minItems: 1 })
483
+ });
484
+ //#endregion
485
+ //#region src/packLock.ts
486
+ const LockProvenanceSchema = Type.Union([
487
+ Type.Literal("npm"),
488
+ Type.Literal("workspace"),
489
+ Type.Literal("file"),
490
+ Type.Literal("git"),
491
+ Type.Literal("http"),
492
+ Type.Literal("builtin"),
493
+ Type.Literal("unknown")
494
+ ]);
495
+ const LockPackageKindSchema = Type.Union([Type.Literal("data"), Type.Literal("asset")]);
496
+ const LockResolutionSchema = Type.Object({
497
+ integrity: Type.Optional(Type.String({ minLength: 1 })),
498
+ resolved: Type.Optional(Type.String({ minLength: 1 })),
499
+ tarball: Type.Optional(Type.String({ minLength: 1 })),
500
+ path: Type.Optional(Type.String({ minLength: 1 })),
501
+ commit: Type.Optional(Type.String({ minLength: 1 }))
502
+ });
503
+ const LockImporterDependencySchema = Type.Object({
504
+ specifier: Type.String({ minLength: 1 }),
505
+ version: Type.String({ minLength: 1 }),
506
+ packageKey: Type.String({ minLength: 1 })
507
+ });
508
+ const LockImporterSnapshotSchema = Type.Object({
509
+ specifiers: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String({ minLength: 1 }))),
510
+ dependencies: Type.Optional(Type.Record(Type.String({ minLength: 1 }), LockImporterDependencySchema))
511
+ });
512
+ const LockPackageSnapshotSchema = Type.Object({
513
+ name: Type.String({ minLength: 1 }),
514
+ version: Type.String({ minLength: 1 }),
515
+ kind: LockPackageKindSchema,
516
+ engine: Type.String({ minLength: 1 }),
517
+ source: Type.String({ minLength: 1 }),
518
+ entry: Type.String({ minLength: 1 }),
519
+ provenance: LockProvenanceSchema,
520
+ resolution: Type.Optional(LockResolutionSchema),
521
+ dependencies: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.String({ minLength: 1 })))
522
+ });
523
+ const PackLockfileSchema = Type.Object({
524
+ lockfileVersion: Type.Literal(1),
525
+ generatedAt: Type.String({ minLength: 1 }),
526
+ importers: Type.Record(Type.String({ minLength: 1 }), LockImporterSnapshotSchema),
527
+ packages: Type.Record(Type.String({ minLength: 1 }), LockPackageSnapshotSchema)
528
+ });
529
+ //#endregion
530
+ //#region src/assets.ts
531
+ const AssetEngineSchema = Type.Literal("seer2-v2");
532
+ const AssetTypeSchema = Type.Union([
533
+ Type.Literal("petSwf"),
534
+ Type.Literal("petSfx"),
535
+ Type.Literal("petSprite"),
536
+ Type.Literal("petPortrait"),
537
+ Type.Literal("markIcon"),
538
+ Type.Literal("skillSfx"),
539
+ Type.Literal("bgm"),
540
+ Type.Literal("uiImage"),
541
+ Type.Literal("misc")
542
+ ]);
543
+ const AssetEntrySchema = Type.Object({
544
+ id: Type.String({ minLength: 1 }),
545
+ type: AssetTypeSchema,
546
+ uri: Type.String({ minLength: 1 }),
547
+ integrity: Type.Optional(Type.String({ minLength: 1 })),
548
+ mimeType: Type.Optional(Type.String({ minLength: 1 })),
549
+ tags: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
550
+ meta: Type.Optional(Type.Record(Type.String({ minLength: 1 }), Type.Unknown()))
551
+ });
552
+ const AssetManifestSchema = Type.Object({
553
+ id: Type.String({ minLength: 1 }),
554
+ version: Type.String({ minLength: 1 }),
555
+ engine: AssetEngineSchema,
556
+ dependencies: Type.Optional(Type.Array(Type.String({ minLength: 1 }))),
557
+ assets: Type.Array(AssetEntrySchema)
558
+ }, { additionalProperties: false });
559
+ const AssetLockEntrySchema = Type.Object({
560
+ id: Type.String({ minLength: 1 }),
561
+ version: Type.String({ minLength: 1 }),
562
+ integrity: Type.String({ minLength: 1 }),
563
+ source: Type.String({ minLength: 1 })
564
+ });
565
+ const AssetLockSchema = Type.Object({
566
+ lockVersion: Type.Literal(1),
567
+ engine: AssetEngineSchema,
568
+ assets: Type.Array(AssetLockEntrySchema, { minItems: 1 })
569
+ });
570
+ //#endregion
571
+ export { AssetEngineSchema, AssetEntrySchema, AssetLockEntrySchema, AssetLockSchema, AssetManifestSchema, AssetTypeSchema, AttackTargetOpinionSchema, CategorySchema, ContentPresentationSchema, DATA_SCHEMA_MAP, DoNothingSelectionSchema, ELEMENT_CHART, ELEMENT_MAP, Element, ElementSchema, LearnableSkillSchema, LockImporterDependencySchema, LockImporterSnapshotSchema, LockPackageKindSchema, LockPackageSnapshotSchema, LockProvenanceSchema, LockResolutionSchema, MarkConfigSchema, MarkDataSetSchema, MarkDefinitionSchema, MarkImageSchema, MarkSchema, MetadataSchema, NativeEnum, PackDataFilesSchema, PackDependencySchema, PackEngineSchema, PackLocaleEntrySchema, PackLocalesSchema, PackLockEntrySchema, PackLockSchema, PackLockfileSchema, PackManifestSchema, PackPathsSchema, PetSchema, PetSetSchema, PlayerSchema, PlayerSelectionSchema, PlayerSelectionsSchema, PresentationBindingSchema, PresentationDataSetSchema, PresentationManifestSchema, PresentationResourceSchema, ResourceDataSetSchema, ResourceDefinitionSchema, ResourceReferenceSchema, SCHEMA_MAP, SkillDataSetSchema, SkillDefinitionSchema, SkillSchema, SpeciesDataSetSchema, SpeciesDefinitionSchema, SpeciesSchema, StackStrategySchema, StatOutBattleEVSSchema, StatOutBattleIVSSchema, StringEnum, SurrenderSelectionSchema, SwitchPetSelectionSchema, TeamSelectionSchema, UIHintKey, UseSkillSelectionSchema, extractMetadata, getArrayUIHint, getFieldUIHint, getObjectUIHint, getUIHint, ignoreStageStrategySchema, parseWithErrors, validateMark, validatePet, validatePetSet, withUIHint };
@@ -0,0 +1,48 @@
1
+ import { type Static } from '@sinclair/typebox';
2
+ export declare const AssetEngineSchema: import("@sinclair/typebox").TLiteral<"seer2-v2">;
3
+ export declare const AssetTypeSchema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"petSwf">, import("@sinclair/typebox").TLiteral<"petSfx">, import("@sinclair/typebox").TLiteral<"petSprite">, import("@sinclair/typebox").TLiteral<"petPortrait">, import("@sinclair/typebox").TLiteral<"markIcon">, import("@sinclair/typebox").TLiteral<"skillSfx">, import("@sinclair/typebox").TLiteral<"bgm">, import("@sinclair/typebox").TLiteral<"uiImage">, import("@sinclair/typebox").TLiteral<"misc">]>;
4
+ export declare const AssetEntrySchema: import("@sinclair/typebox").TObject<{
5
+ id: import("@sinclair/typebox").TString;
6
+ type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"petSwf">, import("@sinclair/typebox").TLiteral<"petSfx">, import("@sinclair/typebox").TLiteral<"petSprite">, import("@sinclair/typebox").TLiteral<"petPortrait">, import("@sinclair/typebox").TLiteral<"markIcon">, import("@sinclair/typebox").TLiteral<"skillSfx">, import("@sinclair/typebox").TLiteral<"bgm">, import("@sinclair/typebox").TLiteral<"uiImage">, import("@sinclair/typebox").TLiteral<"misc">]>;
7
+ uri: import("@sinclair/typebox").TString;
8
+ integrity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
9
+ mimeType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
10
+ tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
11
+ meta: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
12
+ }>;
13
+ export declare const AssetManifestSchema: import("@sinclair/typebox").TObject<{
14
+ id: import("@sinclair/typebox").TString;
15
+ version: import("@sinclair/typebox").TString;
16
+ engine: import("@sinclair/typebox").TLiteral<"seer2-v2">;
17
+ dependencies: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
18
+ assets: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
19
+ id: import("@sinclair/typebox").TString;
20
+ type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"petSwf">, import("@sinclair/typebox").TLiteral<"petSfx">, import("@sinclair/typebox").TLiteral<"petSprite">, import("@sinclair/typebox").TLiteral<"petPortrait">, import("@sinclair/typebox").TLiteral<"markIcon">, import("@sinclair/typebox").TLiteral<"skillSfx">, import("@sinclair/typebox").TLiteral<"bgm">, import("@sinclair/typebox").TLiteral<"uiImage">, import("@sinclair/typebox").TLiteral<"misc">]>;
21
+ uri: import("@sinclair/typebox").TString;
22
+ integrity: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
23
+ mimeType: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
24
+ tags: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
25
+ meta: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>>;
26
+ }>>;
27
+ }>;
28
+ export declare const AssetLockEntrySchema: import("@sinclair/typebox").TObject<{
29
+ id: import("@sinclair/typebox").TString;
30
+ version: import("@sinclair/typebox").TString;
31
+ integrity: import("@sinclair/typebox").TString;
32
+ source: import("@sinclair/typebox").TString;
33
+ }>;
34
+ export declare const AssetLockSchema: import("@sinclair/typebox").TObject<{
35
+ lockVersion: import("@sinclair/typebox").TLiteral<1>;
36
+ engine: import("@sinclair/typebox").TLiteral<"seer2-v2">;
37
+ assets: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
38
+ id: import("@sinclair/typebox").TString;
39
+ version: import("@sinclair/typebox").TString;
40
+ integrity: import("@sinclair/typebox").TString;
41
+ source: import("@sinclair/typebox").TString;
42
+ }>>;
43
+ }>;
44
+ export type AssetEntry = Static<typeof AssetEntrySchema>;
45
+ export type AssetManifest = Static<typeof AssetManifestSchema>;
46
+ export type AssetLockEntry = Static<typeof AssetLockEntrySchema>;
47
+ export type AssetLock = Static<typeof AssetLockSchema>;
48
+ //# sourceMappingURL=assets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/assets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAA;AAErD,eAAO,MAAM,iBAAiB,kDAA2B,CAAA;AAEzD,eAAO,MAAM,eAAe,8dAU1B,CAAA;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;EAQ3B,CAAA;AAEF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;EAS/B,CAAA;AAED,eAAO,MAAM,oBAAoB;;;;;EAK/B,CAAA;AAEF,eAAO,MAAM,eAAe;;;;;;;;;EAI1B,CAAA;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACxD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC9D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAChE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -0,0 +1,4 @@
1
+ import { Element, ELEMENT_MAP, ELEMENT_CHART } from '@arcadia-eternity/const';
2
+ export { Element, ELEMENT_MAP, ELEMENT_CHART };
3
+ export declare const ElementSchema: import("@sinclair/typebox").TUnion<import("@sinclair/typebox").TLiteral<Element>[]>;
4
+ //# sourceMappingURL=element.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAG7E,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,CAAA;AAE9C,eAAO,MAAM,aAAa,qFAAqC,CAAA"}
@@ -0,0 +1,17 @@
1
+ export * from './utils';
2
+ export * from './element';
3
+ export * from './mark';
4
+ export * from './markImage';
5
+ export * from './metadata';
6
+ export * from './pet';
7
+ export * from './player';
8
+ export * from './schema';
9
+ export * from './selection';
10
+ export * from './skill';
11
+ export * from './species';
12
+ export * from './pack';
13
+ export * from './packLock';
14
+ export * from './assets';
15
+ export * from './presentation';
16
+ export * from './uiMetadata';
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,UAAU,CAAA;AACxB,cAAc,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA;AACzB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,UAAU,CAAA;AACxB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,cAAc,CAAA"}