@krak-stack/assets 0.1.4 → 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/CHANGELOG.md +81 -0
- package/README.md +174 -20
- package/dist/access.d.ts +44 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +56 -0
- package/dist/access.js.map +1 -0
- package/dist/api.builder.d.ts +100 -0
- package/dist/api.builder.d.ts.map +1 -0
- package/dist/api.builder.js +233 -0
- package/dist/api.builder.js.map +1 -0
- package/dist/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.group.d.ts +222 -0
- package/dist/api.group.d.ts.map +1 -0
- package/dist/api.group.js +83 -0
- package/dist/api.group.js.map +1 -0
- package/dist/api.js +2 -0
- package/dist/api.js.map +1 -0
- package/dist/catalog.d.ts +91 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +52 -0
- package/dist/catalog.js.map +1 -0
- package/dist/client.d.ts +245 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +8 -0
- package/dist/client.js.map +1 -0
- package/dist/commands.d.ts +55 -0
- package/dist/commands.d.ts.map +1 -0
- package/dist/commands.js +127 -0
- package/dist/commands.js.map +1 -0
- package/dist/components/asset-input/html.d.ts +72 -0
- package/dist/components/asset-input/html.d.ts.map +1 -0
- package/dist/components/asset-input/html.js +1574 -0
- package/dist/components/asset-input/html.js.map +1 -0
- package/dist/components/asset-input/index.d.ts +331 -0
- package/dist/components/asset-input/react.d.ts +32 -0
- package/dist/components/asset-input/react.d.ts.map +1 -0
- package/dist/components/asset-input/react.js +2297 -0
- package/dist/components/asset-input/react.js.map +1 -0
- package/dist/components/asset-input/schema.d.ts +108 -0
- package/dist/components/asset-input/upload.d.ts +15 -0
- package/dist/components/asset-table/html.d.ts +110 -0
- package/dist/components/asset-table/html.d.ts.map +1 -0
- package/dist/components/asset-table/html.js +4994 -0
- package/dist/components/asset-table/html.js.map +1 -0
- package/dist/components/asset-table/index.d.ts +324 -0
- package/dist/components/asset-table/react.d.ts +22 -0
- package/dist/components/asset-table/react.d.ts.map +1 -0
- package/dist/components/asset-table/react.js +8317 -0
- package/dist/components/asset-table/react.js.map +1 -0
- package/dist/components/asset-table/schema.d.ts +73 -0
- package/dist/index.d.ts +215 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +49 -24
- package/dist/index.js.map +1 -1
- package/dist/migrations/0004_upload_intents.d.ts +5 -0
- package/dist/migrations/0004_upload_intents.d.ts.map +1 -0
- package/dist/migrations/0004_upload_intents.js +14 -0
- package/dist/migrations/0004_upload_intents.js.map +1 -0
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js +2 -0
- package/dist/migrations.js.map +1 -1
- package/dist/queries.d.ts +6 -0
- package/dist/queries.d.ts.map +1 -0
- package/dist/queries.js +18 -0
- package/dist/queries.js.map +1 -0
- package/dist/retrieval.d.ts +6 -1
- package/dist/retrieval.d.ts.map +1 -1
- package/dist/retrieval.js +48 -17
- package/dist/retrieval.js.map +1 -1
- package/dist/schema.d.ts +116 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +88 -1
- package/dist/schema.js.map +1 -1
- package/dist/services/assets/library.d.ts +276 -0
- package/dist/services/assets/library.d.ts.map +1 -0
- package/dist/services/assets/library.js +122 -0
- package/dist/services/assets/library.js.map +1 -0
- package/dist/services/assets/schema.d.ts +3 -0
- package/dist/services/assets/url.d.ts +12 -0
- package/dist/services/assets/use-library.d.ts +20 -0
- package/dist/workflows.d.ts +2 -0
- package/dist/workflows.d.ts.map +1 -1
- package/dist/workflows.js +2 -0
- package/dist/workflows.js.map +1 -1
- package/package.json +44 -8
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html.js","sourceRoot":"","sources":["../../../src/components/asset-input/html.ts"],"names":[],"mappings":"AAAA,cAAc,uCAAuC,CAAC"}
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import { Redacted, Schema } from "effect";
|
|
2
|
+
import { Command, Component, UiSchema } from "effect/ui";
|
|
3
|
+
import { type AssetLibraryRuntime, type AssetStagedUpload } from "../../services/assets/library.js";
|
|
4
|
+
import { AssetUploadJobSchema, type AssetInputSharedProps, type AssetKind, type AssetUploadProps } from "./schema.js";
|
|
5
|
+
export declare const assetInputPickerOptions: {
|
|
6
|
+
readonly name: "AssetInputPicker";
|
|
7
|
+
readonly props: Schema.Struct<{
|
|
8
|
+
readonly assets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
9
|
+
readonly id: Schema.String;
|
|
10
|
+
readonly name: Schema.String;
|
|
11
|
+
readonly mimeType: Schema.String;
|
|
12
|
+
readonly url: Schema.optionalKey<Schema.String>;
|
|
13
|
+
readonly updatedAt: Schema.optionalKey<Schema.Date>;
|
|
14
|
+
}>>>;
|
|
15
|
+
readonly access: Schema.optionalKey<Schema.Struct<{
|
|
16
|
+
readonly scopeKey: Schema.NonEmptyString;
|
|
17
|
+
readonly permissions: Schema.$Array<Schema.Literals<readonly ["list", "read", "create", "update", "delete"]>>;
|
|
18
|
+
}>>;
|
|
19
|
+
readonly value: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>>;
|
|
20
|
+
}>;
|
|
21
|
+
readonly model: Schema.Null;
|
|
22
|
+
readonly message: Schema.Never;
|
|
23
|
+
readonly restore: false;
|
|
24
|
+
readonly queries: {
|
|
25
|
+
readonly library: {
|
|
26
|
+
query: typeof import("../../services/assets/library.js").AssetList;
|
|
27
|
+
dropPrevious: boolean;
|
|
28
|
+
args: ({ props }: {
|
|
29
|
+
props: {
|
|
30
|
+
readonly assets?: readonly {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
readonly name: string;
|
|
33
|
+
readonly mimeType: string;
|
|
34
|
+
readonly url?: string | undefined;
|
|
35
|
+
readonly updatedAt?: Date | undefined;
|
|
36
|
+
}[] | undefined;
|
|
37
|
+
readonly access?: {
|
|
38
|
+
readonly scopeKey: string;
|
|
39
|
+
readonly permissions: readonly ("create" | "delete" | "list" | "read" | "update")[];
|
|
40
|
+
} | undefined;
|
|
41
|
+
readonly value?: string | readonly string[] | undefined;
|
|
42
|
+
};
|
|
43
|
+
}) => {
|
|
44
|
+
readonly search?: string | undefined;
|
|
45
|
+
readonly kind?: "caption" | "document" | "image" | "video" | undefined;
|
|
46
|
+
readonly scopeKey: string;
|
|
47
|
+
readonly showFiles: boolean;
|
|
48
|
+
} | undefined;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export declare const assetInputPickerBehaviours: {
|
|
53
|
+
init: () => null;
|
|
54
|
+
update: () => null;
|
|
55
|
+
};
|
|
56
|
+
export declare const assetInputMessages: (locale: string, messages?: AssetInputSharedProps["messages"]) => {
|
|
57
|
+
placeholder: string;
|
|
58
|
+
multiplePlaceholder: string;
|
|
59
|
+
empty: string;
|
|
60
|
+
selected: string;
|
|
61
|
+
remove: string;
|
|
62
|
+
};
|
|
63
|
+
export declare const assetUploadMessages: (locale: string, messages?: AssetUploadProps["messages"]) => {
|
|
64
|
+
upload: string;
|
|
65
|
+
dialogTitle: string;
|
|
66
|
+
dialogDescription: string;
|
|
67
|
+
libraryDialogTitle: string;
|
|
68
|
+
libraryDialogDescription: string;
|
|
69
|
+
cancel: string;
|
|
70
|
+
close: string;
|
|
71
|
+
uploadError: string;
|
|
72
|
+
kindError: string;
|
|
73
|
+
publishError: string;
|
|
74
|
+
};
|
|
75
|
+
export declare const matchesAssetKind: (mimeType: string, kind?: AssetKind) => boolean;
|
|
76
|
+
export declare const assetUploadAccept: (kind?: AssetKind) => ".vtt,text/vtt" | "image/*" | "video/*" | undefined;
|
|
77
|
+
export declare const hasInvalidAssetFiles: (files: readonly Redacted.Redacted<File>[], kind?: AssetKind) => boolean;
|
|
78
|
+
export declare const assetSelection: (value: AssetInputSharedProps["value"]) => readonly string[];
|
|
79
|
+
export type AssetPublication = {
|
|
80
|
+
status: "published";
|
|
81
|
+
assetId: string;
|
|
82
|
+
} | {
|
|
83
|
+
status: "rejected";
|
|
84
|
+
message: string;
|
|
85
|
+
};
|
|
86
|
+
export interface AssetUploadOptions<Context> extends AssetUploadProps {
|
|
87
|
+
upload: (file: File, options: {
|
|
88
|
+
signal: AbortSignal;
|
|
89
|
+
onProgress: (percent: number) => void;
|
|
90
|
+
}) => Promise<Context>;
|
|
91
|
+
publish: (context: Context, signal: AbortSignal) => Promise<AssetPublication>;
|
|
92
|
+
onPublished?: (assetId: string, file: File) => void;
|
|
93
|
+
}
|
|
94
|
+
export declare const AssetUploadResult: UiSchema.TaggedEnum<{
|
|
95
|
+
readonly Completed: Schema.TaggedStruct<"Completed", {
|
|
96
|
+
id: Schema.Int;
|
|
97
|
+
assetId: Schema.String;
|
|
98
|
+
}>;
|
|
99
|
+
readonly Failed: Schema.TaggedStruct<"Failed", {
|
|
100
|
+
id: Schema.Int;
|
|
101
|
+
retryPublication: Schema.Boolean;
|
|
102
|
+
}>;
|
|
103
|
+
readonly Processing: Schema.TaggedStruct<"Processing", {
|
|
104
|
+
id: Schema.Int;
|
|
105
|
+
}>;
|
|
106
|
+
readonly Progress: Schema.TaggedStruct<"Progress", {
|
|
107
|
+
id: Schema.Int;
|
|
108
|
+
progress: Schema.Finite;
|
|
109
|
+
}>;
|
|
110
|
+
readonly Rejected: Schema.TaggedStruct<"Rejected", {
|
|
111
|
+
id: Schema.Int;
|
|
112
|
+
error: Schema.String;
|
|
113
|
+
}>;
|
|
114
|
+
}>;
|
|
115
|
+
declare const RunAssetUpload_base: Command.Service<RunAssetUpload, "asset-input/RunAssetUpload", {
|
|
116
|
+
readonly id: number;
|
|
117
|
+
readonly file: Redacted.Redacted<File>;
|
|
118
|
+
readonly retryPublication: boolean;
|
|
119
|
+
}, UiSchema.TaggedEnum<{
|
|
120
|
+
readonly Completed: Schema.TaggedStruct<"Completed", {
|
|
121
|
+
id: Schema.Int;
|
|
122
|
+
assetId: Schema.String;
|
|
123
|
+
}>;
|
|
124
|
+
readonly Failed: Schema.TaggedStruct<"Failed", {
|
|
125
|
+
id: Schema.Int;
|
|
126
|
+
retryPublication: Schema.Boolean;
|
|
127
|
+
}>;
|
|
128
|
+
readonly Processing: Schema.TaggedStruct<"Processing", {
|
|
129
|
+
id: Schema.Int;
|
|
130
|
+
}>;
|
|
131
|
+
readonly Progress: Schema.TaggedStruct<"Progress", {
|
|
132
|
+
id: Schema.Int;
|
|
133
|
+
progress: Schema.Finite;
|
|
134
|
+
}>;
|
|
135
|
+
readonly Rejected: Schema.TaggedStruct<"Rejected", {
|
|
136
|
+
id: Schema.Int;
|
|
137
|
+
error: Schema.String;
|
|
138
|
+
}>;
|
|
139
|
+
}>, true, Schema.Never, "id">;
|
|
140
|
+
export declare class RunAssetUpload extends RunAssetUpload_base {
|
|
141
|
+
}
|
|
142
|
+
/** Adapts app-owned browser transfers and publication to the shared UI command. */
|
|
143
|
+
export declare const assetUploadLayer: <Context>(transport: Pick<AssetUploadOptions<Context>, "upload" | "publish">) => import("effect/Layer").Layer<RunAssetUpload, never, never>;
|
|
144
|
+
export declare const libraryUpload: (run: AssetLibraryRuntime["runPromise"], locale: string, replaceId?: string) => Pick<AssetUploadOptions<AssetStagedUpload>, "upload" | "publish">;
|
|
145
|
+
export declare const AssetInputEvents: UiSchema.TaggedEnum<{
|
|
146
|
+
readonly Changed: Schema.TaggedStruct<"Changed", {
|
|
147
|
+
readonly ids: Schema.$Array<Schema.String>;
|
|
148
|
+
}>;
|
|
149
|
+
readonly Published: Schema.TaggedStruct<"Published", {
|
|
150
|
+
readonly assetId: Schema.String;
|
|
151
|
+
readonly file: Schema.Redacted<Schema.File>;
|
|
152
|
+
}>;
|
|
153
|
+
}>;
|
|
154
|
+
export declare const AssetInputMessage: UiSchema.TaggedEnum<{
|
|
155
|
+
readonly Changed: Schema.TaggedStruct<"Changed", {
|
|
156
|
+
readonly ids: Schema.$Array<Schema.String>;
|
|
157
|
+
}>;
|
|
158
|
+
readonly Closed: Schema.TaggedStruct<"Closed", {}>;
|
|
159
|
+
readonly Completed: Schema.TaggedStruct<"Completed", {
|
|
160
|
+
id: Schema.Int;
|
|
161
|
+
assetId: Schema.String;
|
|
162
|
+
}>;
|
|
163
|
+
readonly Dismiss: Schema.TaggedStruct<"Dismiss", {}>;
|
|
164
|
+
readonly Failed: Schema.TaggedStruct<"Failed", {
|
|
165
|
+
id: Schema.Int;
|
|
166
|
+
retryPublication: Schema.Boolean;
|
|
167
|
+
}>;
|
|
168
|
+
readonly Open: Schema.TaggedStruct<"Open", {}>;
|
|
169
|
+
readonly Processing: Schema.TaggedStruct<"Processing", {
|
|
170
|
+
id: Schema.Int;
|
|
171
|
+
}>;
|
|
172
|
+
readonly Progress: Schema.TaggedStruct<"Progress", {
|
|
173
|
+
id: Schema.Int;
|
|
174
|
+
progress: Schema.Finite;
|
|
175
|
+
}>;
|
|
176
|
+
readonly Rejected: Schema.TaggedStruct<"Rejected", {
|
|
177
|
+
id: Schema.Int;
|
|
178
|
+
error: Schema.String;
|
|
179
|
+
}>;
|
|
180
|
+
readonly RemoveJob: Schema.TaggedStruct<"RemoveJob", {
|
|
181
|
+
readonly id: Schema.Int;
|
|
182
|
+
}>;
|
|
183
|
+
readonly Retry: Schema.TaggedStruct<"Retry", {
|
|
184
|
+
readonly id: Schema.Int;
|
|
185
|
+
}>;
|
|
186
|
+
readonly SetFiles: Schema.TaggedStruct<"SetFiles", {
|
|
187
|
+
readonly files: Schema.$Array<Schema.Redacted<Schema.File>>;
|
|
188
|
+
}>;
|
|
189
|
+
readonly Stage: Schema.TaggedStruct<"Stage", {
|
|
190
|
+
readonly files: Schema.$Array<Schema.Redacted<Schema.File>>;
|
|
191
|
+
}>;
|
|
192
|
+
readonly Upload: Schema.TaggedStruct<"Upload", {}>;
|
|
193
|
+
}>;
|
|
194
|
+
export declare const assetInputOptions: {
|
|
195
|
+
readonly name: "AssetInput";
|
|
196
|
+
readonly props: Schema.Struct<{
|
|
197
|
+
readonly label: Schema.String;
|
|
198
|
+
readonly access: Schema.optionalKey<Schema.Struct<{
|
|
199
|
+
readonly scopeKey: Schema.NonEmptyString;
|
|
200
|
+
readonly permissions: Schema.$Array<Schema.Literals<readonly ["list", "read", "create", "update", "delete"]>>;
|
|
201
|
+
}>>;
|
|
202
|
+
readonly replaceId: Schema.optionalKey<Schema.String>;
|
|
203
|
+
readonly uploadTrigger: Schema.optionalKey<Schema.Literal<"button">>;
|
|
204
|
+
readonly assets: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
205
|
+
readonly id: Schema.String;
|
|
206
|
+
readonly name: Schema.String;
|
|
207
|
+
readonly mimeType: Schema.String;
|
|
208
|
+
readonly url: Schema.optionalKey<Schema.String>;
|
|
209
|
+
readonly updatedAt: Schema.optionalKey<Schema.Date>;
|
|
210
|
+
}>>>;
|
|
211
|
+
readonly kind: Schema.optionalKey<Schema.Literals<readonly ["document", "image", "video", "caption"]>>;
|
|
212
|
+
readonly value: Schema.optionalKey<Schema.Union<readonly [Schema.String, Schema.$Array<Schema.String>]>>;
|
|
213
|
+
readonly multiple: Schema.optionalKey<Schema.Boolean>;
|
|
214
|
+
readonly disabled: Schema.optionalKey<Schema.Boolean>;
|
|
215
|
+
readonly locale: Schema.optionalKey<Schema.String>;
|
|
216
|
+
readonly messages: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
217
|
+
readonly placeholder: Schema.optionalKey<Schema.String>;
|
|
218
|
+
readonly multiplePlaceholder: Schema.optionalKey<Schema.String>;
|
|
219
|
+
readonly empty: Schema.optionalKey<Schema.String>;
|
|
220
|
+
readonly selected: Schema.optionalKey<Schema.String>;
|
|
221
|
+
readonly remove: Schema.optionalKey<Schema.String>;
|
|
222
|
+
}>>>;
|
|
223
|
+
readonly uploader: Schema.optionalKey<Schema.Struct<{
|
|
224
|
+
readonly accept: Schema.optionalKey<Schema.String>;
|
|
225
|
+
readonly processingLabel: Schema.optionalKey<Schema.String>;
|
|
226
|
+
readonly messages: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Struct<{
|
|
227
|
+
readonly upload: Schema.optionalKey<Schema.String>;
|
|
228
|
+
readonly close: Schema.optionalKey<Schema.String>;
|
|
229
|
+
readonly cancel: Schema.optionalKey<Schema.String>;
|
|
230
|
+
readonly dialogTitle: Schema.optionalKey<Schema.String>;
|
|
231
|
+
readonly dialogDescription: Schema.optionalKey<Schema.String>;
|
|
232
|
+
readonly libraryDialogTitle: Schema.optionalKey<Schema.String>;
|
|
233
|
+
readonly libraryDialogDescription: Schema.optionalKey<Schema.String>;
|
|
234
|
+
readonly uploadError: Schema.optionalKey<Schema.String>;
|
|
235
|
+
readonly kindError: Schema.optionalKey<Schema.String>;
|
|
236
|
+
readonly publishError: Schema.optionalKey<Schema.String>;
|
|
237
|
+
}>>>;
|
|
238
|
+
}>>;
|
|
239
|
+
}>;
|
|
240
|
+
readonly model: Schema.Struct<{
|
|
241
|
+
readonly open: Schema.Boolean;
|
|
242
|
+
readonly files: Schema.$Array<Schema.Redacted<Schema.File>>;
|
|
243
|
+
readonly jobs: Schema.$Array<Schema.Struct<{
|
|
244
|
+
readonly id: Schema.Int;
|
|
245
|
+
readonly file: Schema.Redacted<Schema.File>;
|
|
246
|
+
readonly phase: Schema.Literals<readonly ["uploading", "processing", "done", "error", "rejected"]>;
|
|
247
|
+
readonly progress: Schema.optionalKey<Schema.Finite>;
|
|
248
|
+
readonly retryPublication: Schema.optionalKey<Schema.Boolean>;
|
|
249
|
+
readonly error: Schema.optionalKey<Schema.String>;
|
|
250
|
+
}>>;
|
|
251
|
+
readonly nextId: Schema.Int;
|
|
252
|
+
}>;
|
|
253
|
+
readonly message: UiSchema.TaggedEnum<{
|
|
254
|
+
readonly Changed: Schema.TaggedStruct<"Changed", {
|
|
255
|
+
readonly ids: Schema.$Array<Schema.String>;
|
|
256
|
+
}>;
|
|
257
|
+
readonly Closed: Schema.TaggedStruct<"Closed", {}>;
|
|
258
|
+
readonly Completed: Schema.TaggedStruct<"Completed", {
|
|
259
|
+
id: Schema.Int;
|
|
260
|
+
assetId: Schema.String;
|
|
261
|
+
}>;
|
|
262
|
+
readonly Dismiss: Schema.TaggedStruct<"Dismiss", {}>;
|
|
263
|
+
readonly Failed: Schema.TaggedStruct<"Failed", {
|
|
264
|
+
id: Schema.Int;
|
|
265
|
+
retryPublication: Schema.Boolean;
|
|
266
|
+
}>;
|
|
267
|
+
readonly Open: Schema.TaggedStruct<"Open", {}>;
|
|
268
|
+
readonly Processing: Schema.TaggedStruct<"Processing", {
|
|
269
|
+
id: Schema.Int;
|
|
270
|
+
}>;
|
|
271
|
+
readonly Progress: Schema.TaggedStruct<"Progress", {
|
|
272
|
+
id: Schema.Int;
|
|
273
|
+
progress: Schema.Finite;
|
|
274
|
+
}>;
|
|
275
|
+
readonly Rejected: Schema.TaggedStruct<"Rejected", {
|
|
276
|
+
id: Schema.Int;
|
|
277
|
+
error: Schema.String;
|
|
278
|
+
}>;
|
|
279
|
+
readonly RemoveJob: Schema.TaggedStruct<"RemoveJob", {
|
|
280
|
+
readonly id: Schema.Int;
|
|
281
|
+
}>;
|
|
282
|
+
readonly Retry: Schema.TaggedStruct<"Retry", {
|
|
283
|
+
readonly id: Schema.Int;
|
|
284
|
+
}>;
|
|
285
|
+
readonly SetFiles: Schema.TaggedStruct<"SetFiles", {
|
|
286
|
+
readonly files: Schema.$Array<Schema.Redacted<Schema.File>>;
|
|
287
|
+
}>;
|
|
288
|
+
readonly Stage: Schema.TaggedStruct<"Stage", {
|
|
289
|
+
readonly files: Schema.$Array<Schema.Redacted<Schema.File>>;
|
|
290
|
+
}>;
|
|
291
|
+
readonly Upload: Schema.TaggedStruct<"Upload", {}>;
|
|
292
|
+
}>;
|
|
293
|
+
readonly events: UiSchema.TaggedEnum<{
|
|
294
|
+
readonly Changed: Schema.TaggedStruct<"Changed", {
|
|
295
|
+
readonly ids: Schema.$Array<Schema.String>;
|
|
296
|
+
}>;
|
|
297
|
+
readonly Published: Schema.TaggedStruct<"Published", {
|
|
298
|
+
readonly assetId: Schema.String;
|
|
299
|
+
readonly file: Schema.Redacted<Schema.File>;
|
|
300
|
+
}>;
|
|
301
|
+
}>;
|
|
302
|
+
readonly restore: false;
|
|
303
|
+
};
|
|
304
|
+
type Model = typeof assetInputOptions.model.Type;
|
|
305
|
+
type Job = typeof AssetUploadJobSchema.Type;
|
|
306
|
+
type Message = typeof AssetInputMessage.Type;
|
|
307
|
+
type Events = typeof AssetInputEvents.Type;
|
|
308
|
+
type Update = Component.Update<Model, Message, Events, AssetInputSharedProps>;
|
|
309
|
+
export declare const canCloseAssetUpload: (jobs: readonly Job[]) => boolean;
|
|
310
|
+
export declare const assetInputBehaviours: {
|
|
311
|
+
init: () => Model;
|
|
312
|
+
update: (ctx: Update, message: Message) => Model | Component.Step<Model, Message, Events, RunAssetUpload>;
|
|
313
|
+
};
|
|
314
|
+
export declare const assetUploadState: (job: Job, copy: ReturnType<typeof assetUploadMessages>) => {
|
|
315
|
+
status: "uploading";
|
|
316
|
+
progress: number | undefined;
|
|
317
|
+
message?: undefined;
|
|
318
|
+
} | {
|
|
319
|
+
progress?: undefined;
|
|
320
|
+
status: "processing";
|
|
321
|
+
message?: undefined;
|
|
322
|
+
} | {
|
|
323
|
+
progress?: undefined;
|
|
324
|
+
status: "done";
|
|
325
|
+
message?: undefined;
|
|
326
|
+
} | {
|
|
327
|
+
progress?: undefined;
|
|
328
|
+
status: "error";
|
|
329
|
+
message: string;
|
|
330
|
+
};
|
|
331
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type AssetUploadOptions } from "./upload.js";
|
|
3
|
+
import { type AssetLibraryRuntime } from "../../services/assets/library.js";
|
|
4
|
+
import type { AssetInputSharedProps } from "./schema.js";
|
|
5
|
+
export type { AssetPublication, AssetUploadOptions } from "./upload.js";
|
|
6
|
+
export type { AssetKind, AssetInputItem } from "./schema.js";
|
|
7
|
+
type CommonProps = Pick<AssetInputSharedProps, "label" | "disabled" | "locale" | "messages" | "access" | "replaceId" | "uploadTrigger"> & {
|
|
8
|
+
runtime?: AssetLibraryRuntime;
|
|
9
|
+
onPublished?: (id: string) => void;
|
|
10
|
+
};
|
|
11
|
+
type LibraryProps<Context> = Pick<AssetInputSharedProps, "assets" | "kind"> & {
|
|
12
|
+
uploader?: AssetUploadOptions<Context>;
|
|
13
|
+
uploadAction?: ReactNode;
|
|
14
|
+
};
|
|
15
|
+
export type AssetInputProps<Context = unknown> = CommonProps & ((LibraryProps<Context> & {
|
|
16
|
+
multiple?: false;
|
|
17
|
+
value: string;
|
|
18
|
+
onChange: (id: string) => void;
|
|
19
|
+
}) | (LibraryProps<Context> & {
|
|
20
|
+
multiple: true;
|
|
21
|
+
value: readonly string[];
|
|
22
|
+
onChange: (ids: string[]) => void;
|
|
23
|
+
}) | {
|
|
24
|
+
assets?: never;
|
|
25
|
+
kind?: never;
|
|
26
|
+
value?: never;
|
|
27
|
+
onChange?: never;
|
|
28
|
+
uploadAction?: never;
|
|
29
|
+
multiple?: boolean;
|
|
30
|
+
uploader?: AssetUploadOptions<Context>;
|
|
31
|
+
});
|
|
32
|
+
export declare const AssetInput: <Context>(props: AssetInputProps<Context>) => import("react").JSX.Element;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react.d.ts","sourceRoot":"","sources":["../../../src/components/asset-input/react.ts"],"names":[],"mappings":"AAEA,cAAc,wCAAwC,CAAC"}
|