@mterminal/marketplace-types 0.1.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 +21 -0
- package/dist/index.d.ts +112 -0
- package/dist/index.js +0 -0
- package/package.json +29 -0
- package/src/index.ts +144 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mTerminal 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.d.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
type Category = 'productivity' | 'language' | 'theme' | 'remote' | 'ai' | 'git' | 'other';
|
|
2
|
+
interface ExtSummary {
|
|
3
|
+
id: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
description: string;
|
|
6
|
+
category: Category;
|
|
7
|
+
iconUrl?: string;
|
|
8
|
+
latestVersion: string;
|
|
9
|
+
downloadTotal: number;
|
|
10
|
+
avgStars?: number;
|
|
11
|
+
ratingCount: number;
|
|
12
|
+
authorLogin: string;
|
|
13
|
+
recommended: boolean;
|
|
14
|
+
apiRange: string;
|
|
15
|
+
}
|
|
16
|
+
interface VersionInfo {
|
|
17
|
+
version: string;
|
|
18
|
+
apiRange: string;
|
|
19
|
+
sizeBytes: number;
|
|
20
|
+
publishedAt: number;
|
|
21
|
+
yanked: boolean;
|
|
22
|
+
}
|
|
23
|
+
interface RatingDto {
|
|
24
|
+
userId: string;
|
|
25
|
+
userLogin: string;
|
|
26
|
+
stars: number;
|
|
27
|
+
comment?: string;
|
|
28
|
+
helpful: number;
|
|
29
|
+
createdAt: number;
|
|
30
|
+
}
|
|
31
|
+
interface ExtensionDetail extends ExtSummary {
|
|
32
|
+
homepageUrl?: string;
|
|
33
|
+
repoUrl?: string;
|
|
34
|
+
versions: VersionInfo[];
|
|
35
|
+
manifest: unknown;
|
|
36
|
+
ratings: RatingDto[];
|
|
37
|
+
readmeMd?: string;
|
|
38
|
+
}
|
|
39
|
+
interface DownloadInfo {
|
|
40
|
+
url: string;
|
|
41
|
+
sha256: string;
|
|
42
|
+
signatureB64: string;
|
|
43
|
+
keyId: string;
|
|
44
|
+
authorId: string;
|
|
45
|
+
sizeBytes: number;
|
|
46
|
+
}
|
|
47
|
+
type PolicyErrorCode = 'manifest' | 'signature' | 'static-scan' | 'capability' | 'duplicate-version' | 'unknown-key' | 'size-limit' | 'unauthorized' | 'banned' | 'publisher-mismatch';
|
|
48
|
+
interface PolicyIssue {
|
|
49
|
+
message: string;
|
|
50
|
+
path?: string;
|
|
51
|
+
line?: number;
|
|
52
|
+
col?: number;
|
|
53
|
+
}
|
|
54
|
+
interface PolicyError {
|
|
55
|
+
code: PolicyErrorCode;
|
|
56
|
+
issues: PolicyIssue[];
|
|
57
|
+
}
|
|
58
|
+
interface PublishResult {
|
|
59
|
+
ok: boolean;
|
|
60
|
+
id?: string;
|
|
61
|
+
version?: string;
|
|
62
|
+
errors?: PolicyError[];
|
|
63
|
+
}
|
|
64
|
+
interface SearchRequest {
|
|
65
|
+
q?: string;
|
|
66
|
+
category?: Category;
|
|
67
|
+
recommended?: boolean;
|
|
68
|
+
sort?: 'downloads' | 'stars' | 'recent' | 'name';
|
|
69
|
+
page?: number;
|
|
70
|
+
pageSize?: number;
|
|
71
|
+
ids?: string[];
|
|
72
|
+
}
|
|
73
|
+
interface SearchResult {
|
|
74
|
+
items: ExtSummary[];
|
|
75
|
+
total: number;
|
|
76
|
+
page: number;
|
|
77
|
+
pageSize: number;
|
|
78
|
+
}
|
|
79
|
+
interface DeviceFlowStartResult {
|
|
80
|
+
deviceCode: string;
|
|
81
|
+
userCode: string;
|
|
82
|
+
verificationUri: string;
|
|
83
|
+
expiresIn: number;
|
|
84
|
+
interval: number;
|
|
85
|
+
}
|
|
86
|
+
interface DeviceFlowPollResult {
|
|
87
|
+
status: 'pending' | 'authorized' | 'expired' | 'denied';
|
|
88
|
+
apiKey?: string;
|
|
89
|
+
authorId?: string;
|
|
90
|
+
githubLogin?: string;
|
|
91
|
+
}
|
|
92
|
+
interface KeyRegisterRequest {
|
|
93
|
+
pubkeyB64: string;
|
|
94
|
+
name?: string;
|
|
95
|
+
}
|
|
96
|
+
interface KeyRegisterResponse {
|
|
97
|
+
keyId: string;
|
|
98
|
+
}
|
|
99
|
+
interface KeyInfo {
|
|
100
|
+
keyId: string;
|
|
101
|
+
authorId: string;
|
|
102
|
+
pubkeyB64: string;
|
|
103
|
+
revokedAt: number | null;
|
|
104
|
+
createdAt: number;
|
|
105
|
+
}
|
|
106
|
+
interface RatingSubmitRequest {
|
|
107
|
+
extensionId: string;
|
|
108
|
+
stars: number;
|
|
109
|
+
comment?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export type { Category, DeviceFlowPollResult, DeviceFlowStartResult, DownloadInfo, ExtSummary, ExtensionDetail, KeyInfo, KeyRegisterRequest, KeyRegisterResponse, PolicyError, PolicyErrorCode, PolicyIssue, PublishResult, RatingDto, RatingSubmitRequest, SearchRequest, SearchResult, VersionInfo };
|
package/dist/index.js
ADDED
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mterminal/marketplace-types",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "shared dto types for the mterminal marketplace",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src"
|
|
18
|
+
],
|
|
19
|
+
"devDependencies": {
|
|
20
|
+
"tsup": "^8.3.5",
|
|
21
|
+
"typescript": "^5.6.3",
|
|
22
|
+
"vitest": "^2.1.5"
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup",
|
|
26
|
+
"typecheck": "tsc --noEmit",
|
|
27
|
+
"test": "vitest run --passWithNoTests"
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
export type Category =
|
|
2
|
+
| 'productivity'
|
|
3
|
+
| 'language'
|
|
4
|
+
| 'theme'
|
|
5
|
+
| 'remote'
|
|
6
|
+
| 'ai'
|
|
7
|
+
| 'git'
|
|
8
|
+
| 'other'
|
|
9
|
+
|
|
10
|
+
export interface ExtSummary {
|
|
11
|
+
id: string
|
|
12
|
+
displayName: string
|
|
13
|
+
description: string
|
|
14
|
+
category: Category
|
|
15
|
+
iconUrl?: string
|
|
16
|
+
latestVersion: string
|
|
17
|
+
downloadTotal: number
|
|
18
|
+
avgStars?: number
|
|
19
|
+
ratingCount: number
|
|
20
|
+
authorLogin: string
|
|
21
|
+
recommended: boolean
|
|
22
|
+
apiRange: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface VersionInfo {
|
|
26
|
+
version: string
|
|
27
|
+
apiRange: string
|
|
28
|
+
sizeBytes: number
|
|
29
|
+
publishedAt: number
|
|
30
|
+
yanked: boolean
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface RatingDto {
|
|
34
|
+
userId: string
|
|
35
|
+
userLogin: string
|
|
36
|
+
stars: number
|
|
37
|
+
comment?: string
|
|
38
|
+
helpful: number
|
|
39
|
+
createdAt: number
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ExtensionDetail extends ExtSummary {
|
|
43
|
+
homepageUrl?: string
|
|
44
|
+
repoUrl?: string
|
|
45
|
+
versions: VersionInfo[]
|
|
46
|
+
manifest: unknown
|
|
47
|
+
ratings: RatingDto[]
|
|
48
|
+
readmeMd?: string
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface DownloadInfo {
|
|
52
|
+
url: string
|
|
53
|
+
sha256: string
|
|
54
|
+
signatureB64: string
|
|
55
|
+
keyId: string
|
|
56
|
+
authorId: string
|
|
57
|
+
sizeBytes: number
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export type PolicyErrorCode =
|
|
61
|
+
| 'manifest'
|
|
62
|
+
| 'signature'
|
|
63
|
+
| 'static-scan'
|
|
64
|
+
| 'capability'
|
|
65
|
+
| 'duplicate-version'
|
|
66
|
+
| 'unknown-key'
|
|
67
|
+
| 'size-limit'
|
|
68
|
+
| 'unauthorized'
|
|
69
|
+
| 'banned'
|
|
70
|
+
| 'publisher-mismatch'
|
|
71
|
+
|
|
72
|
+
export interface PolicyIssue {
|
|
73
|
+
message: string
|
|
74
|
+
path?: string
|
|
75
|
+
line?: number
|
|
76
|
+
col?: number
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface PolicyError {
|
|
80
|
+
code: PolicyErrorCode
|
|
81
|
+
issues: PolicyIssue[]
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface PublishResult {
|
|
85
|
+
ok: boolean
|
|
86
|
+
id?: string
|
|
87
|
+
version?: string
|
|
88
|
+
errors?: PolicyError[]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export interface SearchRequest {
|
|
92
|
+
q?: string
|
|
93
|
+
category?: Category
|
|
94
|
+
recommended?: boolean
|
|
95
|
+
sort?: 'downloads' | 'stars' | 'recent' | 'name'
|
|
96
|
+
page?: number
|
|
97
|
+
pageSize?: number
|
|
98
|
+
ids?: string[]
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface SearchResult {
|
|
102
|
+
items: ExtSummary[]
|
|
103
|
+
total: number
|
|
104
|
+
page: number
|
|
105
|
+
pageSize: number
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export interface DeviceFlowStartResult {
|
|
109
|
+
deviceCode: string
|
|
110
|
+
userCode: string
|
|
111
|
+
verificationUri: string
|
|
112
|
+
expiresIn: number
|
|
113
|
+
interval: number
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface DeviceFlowPollResult {
|
|
117
|
+
status: 'pending' | 'authorized' | 'expired' | 'denied'
|
|
118
|
+
apiKey?: string
|
|
119
|
+
authorId?: string
|
|
120
|
+
githubLogin?: string
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface KeyRegisterRequest {
|
|
124
|
+
pubkeyB64: string
|
|
125
|
+
name?: string
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
export interface KeyRegisterResponse {
|
|
129
|
+
keyId: string
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface KeyInfo {
|
|
133
|
+
keyId: string
|
|
134
|
+
authorId: string
|
|
135
|
+
pubkeyB64: string
|
|
136
|
+
revokedAt: number | null
|
|
137
|
+
createdAt: number
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface RatingSubmitRequest {
|
|
141
|
+
extensionId: string
|
|
142
|
+
stars: number
|
|
143
|
+
comment?: string
|
|
144
|
+
}
|