@drawcall/market 0.1.5 → 0.1.7
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/asset-implementation.d.ts +88 -0
- package/dist/asset-implementation.d.ts.map +1 -0
- package/dist/asset-implementation.js +2 -0
- package/dist/asset-implementation.js.map +1 -0
- package/dist/cli-client.d.ts +2 -2
- package/dist/cli-client.d.ts.map +1 -1
- package/dist/cli-client.js +4 -4
- package/dist/cli-client.js.map +1 -1
- package/dist/cli.js +106 -22
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +1 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -12
- package/dist/client.js.map +1 -1
- package/dist/commands/generate.d.ts.map +1 -1
- package/dist/commands/generate.js +9 -4
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/install.d.ts.map +1 -1
- package/dist/commands/install.js +30 -28
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/logout.js +3 -3
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/preview.d.ts +9 -0
- package/dist/commands/preview.d.ts.map +1 -0
- package/dist/commands/preview.js +50 -0
- package/dist/commands/preview.js.map +1 -0
- package/dist/commands/search.d.ts +4 -1
- package/dist/commands/search.d.ts.map +1 -1
- package/dist/commands/search.js +20 -10
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/upload.d.ts +9 -0
- package/dist/commands/upload.d.ts.map +1 -0
- package/dist/commands/upload.js +220 -0
- package/dist/commands/upload.js.map +1 -0
- package/dist/config.d.ts +4 -7
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +8 -4
- package/dist/config.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -10
- package/dist/constants.js.map +1 -1
- package/dist/contract.d.ts +37 -134
- package/dist/contract.d.ts.map +1 -1
- package/dist/contract.js +10 -48
- package/dist/contract.js.map +1 -1
- package/dist/generate.d.ts +0 -2
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +5 -22
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +5 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/install.d.ts +1 -1
- package/dist/install.d.ts.map +1 -1
- package/dist/install.js +14 -11
- package/dist/install.js.map +1 -1
- package/dist/output.d.ts +26 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +52 -0
- package/dist/output.js.map +1 -0
- package/dist/resolve.d.ts.map +1 -1
- package/dist/resolve.js +15 -26
- package/dist/resolve.js.map +1 -1
- package/dist/schemas.d.ts +31 -39
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +23 -25
- package/dist/schemas.js.map +1 -1
- package/package.json +13 -4
- package/src/asset-implementation.ts +114 -0
- package/src/cli-client.ts +7 -6
- package/src/cli.ts +146 -29
- package/src/client.ts +5 -15
- package/src/commands/generate.ts +9 -6
- package/src/commands/install.ts +34 -31
- package/src/commands/logout.ts +3 -3
- package/src/commands/preview.ts +69 -0
- package/src/commands/search.ts +27 -11
- package/src/commands/upload.ts +262 -0
- package/src/config.ts +11 -5
- package/src/constants.ts +2 -10
- package/src/contract.ts +22 -120
- package/src/generate.ts +5 -29
- package/src/index.ts +23 -14
- package/src/install.ts +24 -14
- package/src/output.ts +76 -0
- package/src/resolve.ts +22 -38
- package/src/schemas.ts +26 -27
- package/tsconfig.json +2 -1
- package/dist/commands/login.d.ts +0 -10
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -92
- package/dist/commands/login.js.map +0 -1
- package/dist/internal-contract.d.ts +0 -19
- package/dist/internal-contract.d.ts.map +0 -1
- package/dist/internal-contract.js +0 -19
- package/dist/internal-contract.js.map +0 -1
- package/src/commands/login.ts +0 -113
- package/src/internal-contract.ts +0 -26
package/dist/contract.d.ts
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export interface AssetVersion {
|
|
3
|
-
id:
|
|
4
|
-
assetId:
|
|
3
|
+
id: string;
|
|
4
|
+
assetId: string;
|
|
5
5
|
version: string;
|
|
6
6
|
approved: boolean;
|
|
7
7
|
npmDependencies: string;
|
|
8
8
|
assetDependencies: string;
|
|
9
9
|
sourceKey: string;
|
|
10
|
-
buildOutputKey: string | null;
|
|
11
|
-
thumbnailKey: string | null;
|
|
12
|
-
buildError: string | null;
|
|
13
|
-
readme: string | null;
|
|
14
10
|
createdAt: Date;
|
|
15
11
|
}
|
|
16
12
|
export interface Asset {
|
|
17
|
-
id:
|
|
13
|
+
id: string;
|
|
18
14
|
name: string;
|
|
19
15
|
type: string;
|
|
20
16
|
description: string | null;
|
|
@@ -22,12 +18,8 @@ export interface Asset {
|
|
|
22
18
|
createdAt: Date;
|
|
23
19
|
updatedAt: Date;
|
|
24
20
|
}
|
|
25
|
-
export interface
|
|
26
|
-
|
|
27
|
-
tags: string[];
|
|
28
|
-
}
|
|
29
|
-
export interface AssetListItem {
|
|
30
|
-
id: number;
|
|
21
|
+
export interface AssetSearchResult {
|
|
22
|
+
id: string;
|
|
31
23
|
name: string;
|
|
32
24
|
type: string;
|
|
33
25
|
description: string | null;
|
|
@@ -35,8 +27,9 @@ export interface AssetListItem {
|
|
|
35
27
|
createdAt: Date;
|
|
36
28
|
updatedAt: Date;
|
|
37
29
|
latestVersion: string;
|
|
38
|
-
thumbnailKey: string | null;
|
|
39
30
|
approved: boolean;
|
|
31
|
+
npmDependencies: string;
|
|
32
|
+
assetDependencies: string;
|
|
40
33
|
}
|
|
41
34
|
export interface PaginatedList<T> {
|
|
42
35
|
items: T[];
|
|
@@ -52,132 +45,63 @@ export interface User {
|
|
|
52
45
|
emailVerified: boolean;
|
|
53
46
|
image: string | null;
|
|
54
47
|
role: string;
|
|
48
|
+
isAdmin: boolean;
|
|
55
49
|
createdAt: Date;
|
|
56
50
|
updatedAt: Date;
|
|
57
51
|
}
|
|
58
|
-
export interface
|
|
59
|
-
versions: AssetVersion[];
|
|
60
|
-
}
|
|
61
|
-
export interface UnapprovedItem {
|
|
62
|
-
versionId: number;
|
|
63
|
-
assetId: number;
|
|
52
|
+
export interface GenerateAssetResult {
|
|
64
53
|
assetName: string;
|
|
65
|
-
assetType: string;
|
|
66
54
|
version: string;
|
|
67
|
-
buildError: string | null;
|
|
68
|
-
buildOutputKey: string | null;
|
|
69
|
-
thumbnailKey: string | null;
|
|
70
|
-
createdAt: Date;
|
|
71
|
-
ownerName: string;
|
|
72
|
-
ownerEmail: string;
|
|
73
|
-
}
|
|
74
|
-
export interface TagWithCount {
|
|
75
|
-
id: number;
|
|
76
|
-
name: string;
|
|
77
|
-
count: number;
|
|
78
|
-
}
|
|
79
|
-
export interface FileTreeEntry {
|
|
80
|
-
path: string;
|
|
81
|
-
size: number;
|
|
82
|
-
}
|
|
83
|
-
export interface GenerateJobStatus {
|
|
84
|
-
jobId: string;
|
|
85
|
-
state: 'queued' | 'running' | 'done' | 'failed';
|
|
86
|
-
message: string | null;
|
|
87
|
-
assetName: string | null;
|
|
88
|
-
version: string | null;
|
|
89
|
-
error: string | null;
|
|
90
55
|
}
|
|
91
56
|
export declare const contract: {
|
|
92
57
|
asset: {
|
|
93
|
-
|
|
94
|
-
name: z.ZodString;
|
|
95
|
-
}, z.core.$strip>, z.ZodCustom<AssetWithVersionsAndTags | null, AssetWithVersionsAndTags | null>, Record<never, never>, Record<never, never>>;
|
|
96
|
-
list: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
58
|
+
search: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
97
59
|
page: z.ZodDefault<z.ZodNumber>;
|
|
98
60
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
99
61
|
type: z.ZodOptional<z.ZodEnum<{
|
|
100
|
-
generic: "generic";
|
|
101
62
|
model: "model";
|
|
102
|
-
hdri: "hdri";
|
|
103
|
-
material: "material";
|
|
104
|
-
music: "music";
|
|
105
63
|
}>>;
|
|
106
|
-
|
|
107
|
-
|
|
64
|
+
query: z.ZodOptional<z.ZodString>;
|
|
65
|
+
includeUnapproved: z.ZodDefault<z.ZodBoolean>;
|
|
108
66
|
sort: z.ZodDefault<z.ZodEnum<{
|
|
109
67
|
newest: "newest";
|
|
110
68
|
alphabetical: "alphabetical";
|
|
111
69
|
relevance: "relevance";
|
|
112
70
|
}>>;
|
|
113
|
-
}, z.core.$strip>, z.ZodCustom<PaginatedList<
|
|
114
|
-
|
|
115
|
-
name: z.ZodString;
|
|
116
|
-
version: z.ZodString;
|
|
117
|
-
}, z.core.$strip>, z.ZodCustom<FileTreeEntry[], FileTreeEntry[]>, Record<never, never>, Record<never, never>>;
|
|
118
|
-
getRawFile: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
71
|
+
}, z.core.$strip>, z.ZodCustom<PaginatedList<AssetSearchResult>, PaginatedList<AssetSearchResult>>, Record<never, never>, Record<never, never>>;
|
|
72
|
+
exact: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
119
73
|
name: z.ZodString;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
74
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
75
|
+
model: "model";
|
|
76
|
+
}>>;
|
|
77
|
+
includeUnapproved: z.ZodDefault<z.ZodBoolean>;
|
|
78
|
+
}, z.core.$strip>, z.ZodCustom<AssetSearchResult | null, AssetSearchResult | null>, Record<never, never>, Record<never, never>>;
|
|
79
|
+
uploadZip: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
126
80
|
name: z.ZodString;
|
|
81
|
+
type: z.ZodEnum<{
|
|
82
|
+
model: "model";
|
|
83
|
+
}>;
|
|
127
84
|
version: z.ZodString;
|
|
128
85
|
description: z.ZodOptional<z.ZodString>;
|
|
129
86
|
npmDependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
130
87
|
assetDependencies: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
131
88
|
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
132
|
-
|
|
89
|
+
zip: z.ZodCustom<File, File>;
|
|
133
90
|
}, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
|
|
134
|
-
|
|
91
|
+
downloadZip: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
135
92
|
name: z.ZodString;
|
|
136
93
|
version: z.ZodString;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
file: z.ZodCustom<File, File>;
|
|
140
|
-
}, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
|
|
141
|
-
hdri: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
142
|
-
name: z.ZodString;
|
|
143
|
-
version: z.ZodString;
|
|
144
|
-
description: z.ZodOptional<z.ZodString>;
|
|
145
|
-
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
146
|
-
file: z.ZodCustom<File, File>;
|
|
147
|
-
}, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
|
|
148
|
-
music: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
149
|
-
name: z.ZodString;
|
|
150
|
-
version: z.ZodString;
|
|
151
|
-
description: z.ZodOptional<z.ZodString>;
|
|
152
|
-
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
153
|
-
file: z.ZodCustom<File, File>;
|
|
154
|
-
}, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
|
|
155
|
-
material: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
94
|
+
}, z.core.$strip>, z.ZodCustom<Blob, Blob>, Record<never, never>, Record<never, never>>;
|
|
95
|
+
downloadPreviewImage: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
156
96
|
name: z.ZodString;
|
|
157
97
|
version: z.ZodString;
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
emissive: z.ZodDefault<z.ZodString>;
|
|
166
|
-
emissiveIntensity: z.ZodDefault<z.ZodNumber>;
|
|
167
|
-
}, z.core.$strip>;
|
|
168
|
-
}, z.core.$strip>, z.ZodCustom<AssetVersion, AssetVersion>, Record<never, never>, Record<never, never>>;
|
|
169
|
-
};
|
|
170
|
-
admin: {
|
|
171
|
-
listUnapproved: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<UnapprovedItem[], UnapprovedItem[]>, Record<never, never>, Record<never, never>>;
|
|
172
|
-
approve: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
173
|
-
assetName: z.ZodString;
|
|
174
|
-
version: z.ZodString;
|
|
175
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
176
|
-
success: z.ZodBoolean;
|
|
177
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
178
|
-
backfillEmbeddings: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
179
|
-
indexed: z.ZodNumber;
|
|
180
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
98
|
+
}, z.core.$strip>, z.ZodCustom<Blob, Blob>, Record<never, never>, Record<never, never>>;
|
|
99
|
+
generate: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
100
|
+
description: z.ZodString;
|
|
101
|
+
type: z.ZodOptional<z.ZodEnum<{
|
|
102
|
+
model: "model";
|
|
103
|
+
}>>;
|
|
104
|
+
}, z.core.$strip>, z.ZodCustom<GenerateAssetResult, GenerateAssetResult>, Record<never, never>, Record<never, never>>;
|
|
181
105
|
};
|
|
182
106
|
user: {
|
|
183
107
|
getProfile: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<User | null, User | null>, Record<never, never>, Record<never, never>>;
|
|
@@ -185,38 +109,17 @@ export declare const contract: {
|
|
|
185
109
|
name: z.ZodOptional<z.ZodString>;
|
|
186
110
|
image: z.ZodOptional<z.ZodString>;
|
|
187
111
|
}, z.core.$strip>, z.ZodCustom<User, User>, Record<never, never>, Record<never, never>>;
|
|
188
|
-
|
|
112
|
+
getAuthToken: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<{
|
|
189
113
|
prefix: string;
|
|
190
114
|
createdAt: Date;
|
|
191
115
|
} | null, {
|
|
192
116
|
prefix: string;
|
|
193
117
|
createdAt: Date;
|
|
194
118
|
} | null>, Record<never, never>, Record<never, never>>;
|
|
195
|
-
|
|
196
|
-
|
|
119
|
+
createAuthToken: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodObject<{
|
|
120
|
+
token: z.ZodString;
|
|
197
121
|
prefix: z.ZodString;
|
|
198
122
|
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
199
|
-
myAssets: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<AssetWithVersions[], AssetWithVersions[]>, Record<never, never>, Record<never, never>>;
|
|
200
|
-
};
|
|
201
|
-
tag: {
|
|
202
|
-
list: import("@orpc/contract").ContractProcedureBuilderWithOutput<import("@orpc/contract").Schema<unknown, unknown>, z.ZodCustom<TagWithCount[], TagWithCount[]>, Record<never, never>, Record<never, never>>;
|
|
203
|
-
};
|
|
204
|
-
generate: {
|
|
205
|
-
start: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
206
|
-
description: z.ZodString;
|
|
207
|
-
type: z.ZodOptional<z.ZodEnum<{
|
|
208
|
-
generic: "generic";
|
|
209
|
-
model: "model";
|
|
210
|
-
hdri: "hdri";
|
|
211
|
-
material: "material";
|
|
212
|
-
music: "music";
|
|
213
|
-
}>>;
|
|
214
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
215
|
-
jobId: z.ZodString;
|
|
216
|
-
}, z.core.$strip>, Record<never, never>, Record<never, never>>;
|
|
217
|
-
status: import("@orpc/contract").ContractProcedureBuilderWithInputOutput<z.ZodObject<{
|
|
218
|
-
jobId: z.ZodString;
|
|
219
|
-
}, z.core.$strip>, z.ZodCustom<GenerateJobStatus, GenerateJobStatus>, Record<never, never>, Record<never, never>>;
|
|
220
123
|
};
|
|
221
124
|
};
|
|
222
125
|
export type AppContract = typeof contract;
|
package/dist/contract.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,EAAE,MAAM,CAAA;IACvB,iBAAiB,EAAE,MAAM,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,IAAI,CAAA;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;I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;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,QAAQ,CAAA"}
|
package/dist/contract.js
CHANGED
|
@@ -1,60 +1,22 @@
|
|
|
1
1
|
import { oc } from '@orpc/contract';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import {
|
|
4
|
-
// ─── Contract ─────────────────────────────────────────────────────────────────
|
|
3
|
+
import { downloadZipSchema, exactAssetSchema, generateAssetSchema, listAssetsSchema, updateProfileSchema, uploadZipSchema, } from './schemas.js';
|
|
5
4
|
export const contract = {
|
|
6
5
|
asset: {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
search: oc.input(listAssetsSchema).output(z.custom()),
|
|
7
|
+
exact: oc.input(exactAssetSchema).output(z.custom()),
|
|
8
|
+
uploadZip: oc
|
|
9
|
+
.input(uploadZipSchema.extend({ zip: z.instanceof(File) }))
|
|
9
10
|
.output(z.custom()),
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
.output(z.custom()),
|
|
14
|
-
getRawFile: oc
|
|
15
|
-
.input(z.object({ name: z.string(), version: semverSchema, path: z.string() }))
|
|
16
|
-
.output(z.instanceof(Blob)),
|
|
17
|
-
},
|
|
18
|
-
upload: {
|
|
19
|
-
generic: oc
|
|
20
|
-
.input(uploadGenericSchema.extend({ file: z.instanceof(File) }))
|
|
21
|
-
.output(z.custom()),
|
|
22
|
-
model: oc
|
|
23
|
-
.input(uploadTypedSchema.extend({ file: z.instanceof(File) }))
|
|
24
|
-
.output(z.custom()),
|
|
25
|
-
hdri: oc
|
|
26
|
-
.input(uploadTypedSchema.extend({ file: z.instanceof(File) }))
|
|
27
|
-
.output(z.custom()),
|
|
28
|
-
music: oc
|
|
29
|
-
.input(uploadTypedSchema.extend({ file: z.instanceof(File) }))
|
|
30
|
-
.output(z.custom()),
|
|
31
|
-
material: oc.input(uploadMaterialSchema).output(z.custom()),
|
|
32
|
-
},
|
|
33
|
-
admin: {
|
|
34
|
-
listUnapproved: oc.output(z.custom()),
|
|
35
|
-
approve: oc
|
|
36
|
-
.input(z.object({ assetName: z.string(), version: z.string() }))
|
|
37
|
-
.output(z.object({ success: z.boolean() })),
|
|
38
|
-
backfillEmbeddings: oc.output(z.object({ indexed: z.number() })),
|
|
11
|
+
downloadZip: oc.input(downloadZipSchema).output(z.instanceof(Blob)),
|
|
12
|
+
downloadPreviewImage: oc.input(downloadZipSchema).output(z.instanceof(Blob)),
|
|
13
|
+
generate: oc.input(generateAssetSchema).output(z.custom()),
|
|
39
14
|
},
|
|
40
15
|
user: {
|
|
41
16
|
getProfile: oc.output(z.custom()),
|
|
42
17
|
updateProfile: oc.input(updateProfileSchema).output(z.custom()),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
myAssets: oc.output(z.custom()),
|
|
46
|
-
},
|
|
47
|
-
tag: {
|
|
48
|
-
list: oc.output(z.custom()),
|
|
49
|
-
},
|
|
50
|
-
generate: {
|
|
51
|
-
start: oc
|
|
52
|
-
.input(z.object({
|
|
53
|
-
description: z.string().min(3).max(1000),
|
|
54
|
-
type: assetTypeSchema.optional(),
|
|
55
|
-
}))
|
|
56
|
-
.output(z.object({ jobId: z.string() })),
|
|
57
|
-
status: oc.input(z.object({ jobId: z.string() })).output(z.custom()),
|
|
18
|
+
getAuthToken: oc.output(z.custom()),
|
|
19
|
+
createAuthToken: oc.output(z.object({ token: z.string(), prefix: z.string() })),
|
|
58
20
|
},
|
|
59
21
|
};
|
|
60
22
|
//# sourceMappingURL=contract.js.map
|
package/dist/contract.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../src/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAA8C,CAAC;QAE/E,eAAe,EAAE,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;KAChF;CACF,CAAA"}
|
package/dist/generate.d.ts
CHANGED
|
@@ -13,8 +13,6 @@ export interface GenerateResult {
|
|
|
13
13
|
}
|
|
14
14
|
export interface GenerateOptions {
|
|
15
15
|
onProgress?: (message: string) => void;
|
|
16
|
-
pollIntervalMs?: number;
|
|
17
|
-
timeoutMs?: number;
|
|
18
16
|
}
|
|
19
17
|
export declare function generateAndWait(client: MarketClient, input: GenerateInput, opts?: GenerateOptions): Promise<GenerateResult>;
|
|
20
18
|
//# sourceMappingURL=generate.d.ts.map
|
package/dist/generate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAED,wBAAsB,eAAe,CACnC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,aAAa,EACpB,IAAI,GAAE,eAAoB,GACzB,OAAO,CAAC,cAAc,CAAC,CASzB"}
|
package/dist/generate.js
CHANGED
|
@@ -5,29 +5,12 @@ export class GenerateError extends Error {
|
|
|
5
5
|
}
|
|
6
6
|
}
|
|
7
7
|
export async function generateAndWait(client, input, opts = {}) {
|
|
8
|
-
const pollIntervalMs = opts.pollIntervalMs ?? 1500;
|
|
9
|
-
const timeoutMs = opts.timeoutMs ?? 60_000;
|
|
10
8
|
const report = opts.onProgress ?? (() => { });
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (status.message)
|
|
16
|
-
report(status.message);
|
|
17
|
-
if (status.state === 'done') {
|
|
18
|
-
if (!status.assetName || !status.version) {
|
|
19
|
-
throw new GenerateError('Generation completed without an asset name.');
|
|
20
|
-
}
|
|
21
|
-
return { assetName: status.assetName, version: status.version };
|
|
22
|
-
}
|
|
23
|
-
if (status.state === 'failed') {
|
|
24
|
-
throw new GenerateError(status.error ?? 'Generation failed.');
|
|
25
|
-
}
|
|
26
|
-
await sleep(pollIntervalMs);
|
|
9
|
+
report('Generating asset');
|
|
10
|
+
const result = await client.asset.generate(input);
|
|
11
|
+
if (!result.assetName || !result.version) {
|
|
12
|
+
throw new GenerateError('Generation completed without an asset name.');
|
|
27
13
|
}
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
function sleep(ms) {
|
|
31
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
14
|
+
return result;
|
|
32
15
|
}
|
|
33
16
|
//# sourceMappingURL=generate.js.map
|
package/dist/generate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"generate.js","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,aAAc,SAAQ,KAAK;IACtC,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AAgBD,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAoB,EACpB,KAAoB,EACpB,OAAwB,EAAE;IAE1B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAE5C,MAAM,CAAC,kBAAkB,CAAC,CAAA;IAC1B,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;IACjD,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACzC,MAAM,IAAI,aAAa,CAAC,6CAA6C,CAAC,CAAA;IACxE,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
export { createMarketClient
|
|
2
|
-
export type { MarketClient,
|
|
1
|
+
export { createMarketClient } from './client.js';
|
|
2
|
+
export type { MarketClient, MarketClientOptions } from './client.js';
|
|
3
3
|
export { contract } from './contract.js';
|
|
4
4
|
export type { AppContract } from './contract.js';
|
|
5
|
-
export {
|
|
6
|
-
export type {
|
|
7
|
-
export type { Asset, AssetVersion, AssetWithVersionsAndTags, AssetWithVersions, AssetListItem, PaginatedList, User, UnapprovedItem, TagWithCount, FileTreeEntry, GenerateJobStatus, } from './contract.js';
|
|
5
|
+
export type { Asset, AssetVersion, AssetSearchResult, PaginatedList, User, GenerateAssetResult, } from './contract.js';
|
|
6
|
+
export type { AssetCatalog, AssetDownloadZipInput, AssetExactInput, AssetGenerateInput, AssetImplementation, AssetImplementationContext, AssetSearchIndex, AssetSearchIndexEntry, AssetSearchInput, AssetUploadZipInput, BlobStore, SaveAssetVersionInput, } from './asset-implementation.js';
|
|
8
7
|
export { resolve, ResolutionError } from './resolve.js';
|
|
9
8
|
export type { ResolvedAsset, ResolveResult } from './resolve.js';
|
|
10
9
|
export { generateAndWait, GenerateError } from './generate.js';
|
|
11
10
|
export type { GenerateInput, GenerateResult, GenerateOptions } from './generate.js';
|
|
12
|
-
export { ASSET_TYPES, assetTypeSchema, semverSchema, assetNameSchema, npmDependenciesSchema, assetDependenciesSchema,
|
|
11
|
+
export { ASSET_TYPES, assetTypeSchema, semverSchema, assetNameSchema, npmDependenciesSchema, assetDependenciesSchema, uploadZipSchema, downloadZipSchema, exactAssetSchema, generateAssetSchema, updateProfileSchema, listAssetsSchema, } from './schemas.js';
|
|
13
12
|
export type { AssetType } from './schemas.js';
|
|
14
13
|
export { MAX_FILE_SIZE, ALLOWED_EXTENSIONS, ASSET_TYPE_LABELS } from './constants.js';
|
|
15
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAChD,YAAY,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAGpE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,YAAY,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAGhD,YAAY,EACV,KAAK,EACL,YAAY,EACZ,iBAAiB,EACjB,aAAa,EACb,IAAI,EACJ,mBAAmB,GACpB,MAAM,eAAe,CAAA;AAEtB,YAAY,EACV,YAAY,EACZ,qBAAqB,EACrB,eAAe,EACf,kBAAkB,EAClB,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,mBAAmB,EACnB,SAAS,EACT,qBAAqB,GACtB,MAAM,2BAA2B,CAAA;AAGlC,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AACvD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAGhE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAC9D,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAGnF,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AACrB,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAG7C,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Client
|
|
2
|
-
export { createMarketClient
|
|
2
|
+
export { createMarketClient } from './client.js';
|
|
3
3
|
// Contracts
|
|
4
4
|
export { contract } from './contract.js';
|
|
5
|
-
export { internalContract } from './internal-contract.js';
|
|
6
5
|
// Resolve
|
|
7
6
|
export { resolve, ResolutionError } from './resolve.js';
|
|
8
7
|
// Generate
|
|
9
8
|
export { generateAndWait, GenerateError } from './generate.js';
|
|
10
9
|
// Schemas
|
|
11
|
-
export { ASSET_TYPES, assetTypeSchema, semverSchema, assetNameSchema, npmDependenciesSchema, assetDependenciesSchema,
|
|
10
|
+
export { ASSET_TYPES, assetTypeSchema, semverSchema, assetNameSchema, npmDependenciesSchema, assetDependenciesSchema, uploadZipSchema, downloadZipSchema, exactAssetSchema, generateAssetSchema, updateProfileSchema, listAssetsSchema, } from './schemas.js';
|
|
12
11
|
// Constants
|
|
13
12
|
export { MAX_FILE_SIZE, ALLOWED_EXTENSIONS, ASSET_TYPE_LABELS } from './constants.js';
|
|
14
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,SAAS;AACT,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD,YAAY;AACZ,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AA4BxC,UAAU;AACV,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAGvD,WAAW;AACX,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAG9D,UAAU;AACV,OAAO,EACL,WAAW,EACX,eAAe,EACf,YAAY,EACZ,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,cAAc,CAAA;AAGrB,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA"}
|
package/dist/install.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 3. Runs the package manager to install npm deps.
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This module uses Node.js APIs (fs, path, nypm) and is only
|
|
9
|
-
* used by the CLI binary
|
|
9
|
+
* used by the CLI binary; it is NOT exported from the package index.
|
|
10
10
|
*/
|
|
11
11
|
import type { MarketClient } from './client.js';
|
|
12
12
|
import type { ResolveResult } from './resolve.js';
|
package/dist/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AASjD,MAAM,WAAW,cAAc;IAC7B,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,mBAAmB;IACnB,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CACvC;AAED,wBAAsB,OAAO,CAC3B,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,aAAa,EACzB,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,IAAI,CAAC,CASf"}
|
package/dist/install.js
CHANGED
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
* 3. Runs the package manager to install npm deps.
|
|
7
7
|
*
|
|
8
8
|
* NOTE: This module uses Node.js APIs (fs, path, nypm) and is only
|
|
9
|
-
* used by the CLI binary
|
|
9
|
+
* used by the CLI binary; it is NOT exported from the package index.
|
|
10
10
|
*/
|
|
11
11
|
import * as fs from 'fs/promises';
|
|
12
12
|
import * as path from 'path';
|
|
13
|
+
import { unzipSync } from 'fflate';
|
|
13
14
|
import { detectPackageManager, installDependencies } from 'nypm';
|
|
14
15
|
export async function install(client, resolution, opts = {}) {
|
|
15
16
|
const cwd = opts.cwd ?? process.cwd();
|
|
@@ -25,21 +26,23 @@ async function downloadAssets(client, resolution, cwd, log) {
|
|
|
25
26
|
const destDir = path.join(cwd, 'src', asset.name);
|
|
26
27
|
await fs.mkdir(destDir, { recursive: true });
|
|
27
28
|
log(`Downloading ${asset.name}@${asset.version}...`);
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const zip = await client.asset.downloadZip({ name: asset.name, version: asset.version });
|
|
30
|
+
const files = unzipSync(new Uint8Array(await zip.arrayBuffer()));
|
|
31
|
+
for (const [relativePath, content] of Object.entries(files)) {
|
|
32
|
+
const filePath = path.join(destDir, relativePath);
|
|
33
|
+
if (!isInside(destDir, filePath)) {
|
|
34
|
+
throw new Error(`Zip contains an unsafe path: ${relativePath}`);
|
|
35
|
+
}
|
|
31
36
|
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
32
|
-
const blob = await client.asset.getRawFile({
|
|
33
|
-
name: asset.name,
|
|
34
|
-
version: asset.version,
|
|
35
|
-
path: file.path,
|
|
36
|
-
});
|
|
37
|
-
const content = Buffer.from(await blob.arrayBuffer());
|
|
38
37
|
await fs.writeFile(filePath, content);
|
|
39
38
|
}
|
|
40
|
-
log(`
|
|
39
|
+
log(`Downloaded ${Object.keys(files).length} files to src/${asset.name}/`);
|
|
41
40
|
}
|
|
42
41
|
}
|
|
42
|
+
function isInside(root, target) {
|
|
43
|
+
const relative = path.relative(root, target);
|
|
44
|
+
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
45
|
+
}
|
|
43
46
|
async function installNpmDeps(resolution, cwd, log) {
|
|
44
47
|
const deps = resolution.npmDependencies;
|
|
45
48
|
if (Object.keys(deps).length === 0)
|
package/dist/install.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,aAAa,CAAA;AACjC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAClC,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,MAAM,CAAA;AAkBhE,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,MAAoB,EACpB,UAAyB,EACzB,OAAuB,EAAE;IAEzB,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE,CAAA;IACrC,MAAM,GAAG,GAAG,IAAI,CAAC,UAAU,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;IAEzC,gEAAgE;IAChE,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC;QAC5C,cAAc,CAAC,UAAU,EAAE,GAAG,EAAE,GAAG,CAAC;KACrC,CAA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C,CAAA;IAEhE,GAAG,CAAC,gCAAgC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;IAEnE,2CAA2C;IAC3C,MAAM,EAAE,GAAG,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAA;IAC5D,MAAM,MAAM,GAAG,EAAE,EAAE,IAAI,IAAI,KAAK,CAAA;IAEhC,GAAG,CAAC,SAAS,MAAM,KAAK,CAAC,CAAA;IACzB,MAAM,mBAAmB,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;IACrF,GAAG,CAAC,6BAA6B,CAAC,CAAA;AACpC,CAAC"}
|
package/dist/output.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { AssetSearchResult } from './contract.js';
|
|
2
|
+
export declare function assetVersionRef(name: string, version?: string): string;
|
|
3
|
+
export declare function assetApproval(approved: boolean): 'approved' | 'unapproved';
|
|
4
|
+
export declare function searchSummary(input: {
|
|
5
|
+
query: string;
|
|
6
|
+
type: string;
|
|
7
|
+
includeUnapproved: boolean;
|
|
8
|
+
count: number;
|
|
9
|
+
total: number;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function assetSearchResultLine(item: AssetSearchResult, opts?: {
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function installResult(assetVersions: Array<{
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
}>): string;
|
|
18
|
+
export declare function generatedInstallResult(name: string, version: string): string;
|
|
19
|
+
export declare function uploadResult(name: string, version: string): string;
|
|
20
|
+
export declare function unchangedUploadResult(name: string, version: string): string;
|
|
21
|
+
export declare function previewResult(name: string, version: string, out: string): string;
|
|
22
|
+
export declare function loginResult(email: string, configPath: string): string;
|
|
23
|
+
export declare function logoutResult(configPath?: string): string;
|
|
24
|
+
export declare function errorResult(message: string): string;
|
|
25
|
+
export declare function compact(value: string, max?: number): string;
|
|
26
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAEtD,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,GAAG,UAAU,GAAG,YAAY,CAE1E;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,iBAAiB,EAAE,OAAO,CAAA;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;CACd,GAAG,MAAM,CAOT;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,iBAAiB,EACvB,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO,GAC/B,MAAM,CAOR;AAED,wBAAgB,aAAa,CAAC,aAAa,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,MAAM,CAK7F;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,wBAAgB,aAA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