@tx5dr/contracts 1.2.0 → 1.2.1
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/schema/__tests__/plugin-market.schema.test.d.ts +2 -0
- package/dist/schema/__tests__/plugin-market.schema.test.d.ts.map +1 -0
- package/dist/schema/__tests__/plugin-market.schema.test.js +77 -0
- package/dist/schema/__tests__/plugin-market.schema.test.js.map +1 -0
- package/dist/schema/plugin.schema.d.ts +778 -6
- package/dist/schema/plugin.schema.d.ts.map +1 -1
- package/dist/schema/plugin.schema.js +82 -1
- package/dist/schema/plugin.schema.js.map +1 -1
- package/dist/schema/websocket.schema.d.ts +302 -20
- package/dist/schema/websocket.schema.d.ts.map +1 -1
- package/dist/schema/websocket.schema.js +1 -0
- package/dist/schema/websocket.schema.js.map +1 -1
- package/package.json +1 -1
- package/src/schema/__tests__/plugin-market.schema.test.ts +88 -0
- package/src/schema/plugin.schema.ts +108 -1
- package/src/schema/websocket.schema.ts +2 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-market.schema.test.d.ts","sourceRoot":"","sources":["../../../src/schema/__tests__/plugin-market.schema.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { PluginMarketCatalogResponseSchema, PluginMarketCatalogSchema, PluginMarketChannelSchema, PluginSourceSchema, } from '../../index.js';
|
|
3
|
+
describe('plugin market schema', () => {
|
|
4
|
+
it('accepts a valid stable catalog', () => {
|
|
5
|
+
const catalog = PluginMarketCatalogSchema.parse({
|
|
6
|
+
schemaVersion: 1,
|
|
7
|
+
generatedAt: '2026-04-22T12:00:00.000Z',
|
|
8
|
+
channel: 'stable',
|
|
9
|
+
plugins: [
|
|
10
|
+
{
|
|
11
|
+
name: 'heartbeat-demo',
|
|
12
|
+
title: 'Heartbeat Demo',
|
|
13
|
+
description: 'Example timer and quick-action plugin.',
|
|
14
|
+
locales: {
|
|
15
|
+
en: {
|
|
16
|
+
pluginName: 'Heartbeat Demo',
|
|
17
|
+
pluginDescription: 'Example timer and quick-action plugin.',
|
|
18
|
+
},
|
|
19
|
+
zh: {
|
|
20
|
+
pluginName: '心跳演示',
|
|
21
|
+
pluginDescription: '定时器与快捷操作演示插件。',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
latestVersion: '1.2.3',
|
|
25
|
+
minHostVersion: '1.0.0',
|
|
26
|
+
author: 'TX-5DR',
|
|
27
|
+
license: 'GPL-3.0-only',
|
|
28
|
+
repository: 'https://github.com/boybook/tx-5dr-plugins',
|
|
29
|
+
homepage: 'https://tx5dr.example/plugins/heartbeat-demo',
|
|
30
|
+
categories: ['demo'],
|
|
31
|
+
keywords: ['timer', 'example'],
|
|
32
|
+
permissions: [],
|
|
33
|
+
screenshots: [
|
|
34
|
+
{
|
|
35
|
+
src: 'https://cdn.example.com/heartbeat-demo/cover.png',
|
|
36
|
+
alt: 'Heartbeat Demo screenshot',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
artifactUrl: 'https://cdn.example.com/plugins/heartbeat-demo-1.2.3.zip',
|
|
40
|
+
sha256: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
|
|
41
|
+
size: 12345,
|
|
42
|
+
publishedAt: '2026-04-22T12:00:00.000Z',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
});
|
|
46
|
+
expect(catalog.channel).toBe('stable');
|
|
47
|
+
expect(catalog.plugins[0]?.name).toBe('heartbeat-demo');
|
|
48
|
+
});
|
|
49
|
+
it('rejects unsupported channels', () => {
|
|
50
|
+
expect(() => PluginMarketChannelSchema.parse('beta')).toThrow();
|
|
51
|
+
});
|
|
52
|
+
it('accepts the route response envelope', () => {
|
|
53
|
+
const response = PluginMarketCatalogResponseSchema.parse({
|
|
54
|
+
sourceUrl: 'https://tx5dr.oss-cn-hangzhou.aliyuncs.com/tx-5dr/plugins/market/stable/index.json',
|
|
55
|
+
catalog: {
|
|
56
|
+
schemaVersion: 1,
|
|
57
|
+
generatedAt: '2026-04-22T12:00:00.000Z',
|
|
58
|
+
channel: 'stable',
|
|
59
|
+
plugins: [],
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
expect(response.catalog.plugins).toHaveLength(0);
|
|
63
|
+
});
|
|
64
|
+
it('accepts marketplace plugin source metadata', () => {
|
|
65
|
+
const source = PluginSourceSchema.parse({
|
|
66
|
+
kind: 'marketplace',
|
|
67
|
+
version: '1.2.3',
|
|
68
|
+
channel: 'nightly',
|
|
69
|
+
artifactUrl: 'https://dl.tx5dr.com/plugins/market/nightly/heartbeat-demo.zip',
|
|
70
|
+
sha256: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef',
|
|
71
|
+
installedAt: 1_777_000_000_000,
|
|
72
|
+
});
|
|
73
|
+
expect(source.kind).toBe('marketplace');
|
|
74
|
+
expect(source.channel).toBe('nightly');
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
//# sourceMappingURL=plugin-market.schema.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin-market.schema.test.js","sourceRoot":"","sources":["../../../src/schema/__tests__/plugin-market.schema.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,iCAAiC,EACjC,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,GACnB,MAAM,gBAAgB,CAAC;AAExB,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;QACxC,MAAM,OAAO,GAAG,yBAAyB,CAAC,KAAK,CAAC;YAC9C,aAAa,EAAE,CAAC;YAChB,WAAW,EAAE,0BAA0B;YACvC,OAAO,EAAE,QAAQ;YACjB,OAAO,EAAE;gBACP;oBACE,IAAI,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