@fiction/sdk 1.0.19 → 1.0.20
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/demo/index.d.ts +5 -5
- package/dist/demo.js.map +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/modules/self/schema.ts +4 -90
- package/dist/modules/user/schema.ts +28 -137
- package/dist/sdk.css +1 -1
- package/dist/sdk.js +4 -2813
- package/dist/sdk.js.map +1 -1
- package/dist/sdkClient-C9BL_Op4.js.map +1 -1
- package/dist/sdkClient.d.ts +10 -11
- package/dist/sdkStorage.d.ts +1 -1
- package/dist/self/ClientAudio.d.ts +1 -1
- package/dist/self/SelfController.d.ts +1 -1
- package/dist/self/schema.d.ts +1 -1
- package/dist/self/ui/ElModeHeader.vue.d.ts +1 -1
- package/dist/self/ui/ElSelfAbout.vue.d.ts +1 -1
- package/dist/self/ui/ElSelfChat.vue.d.ts +1 -1
- package/dist/self/ui/ElSelfHeader.vue.d.ts +1 -1
- package/dist/self/ui/ElSidebar.vue.d.ts +1 -1
- package/dist/self/ui/SelfAgent.vue.d.ts +2 -2
- package/dist/self/ui/SelfWrap.vue.d.ts +1 -1
- package/dist/self/utils.d.ts +1 -1
- package/dist/self.js.map +1 -1
- package/dist/types/media.ts +28 -104
- package/package.json +4 -3
- package/dist/types/SDKAppType.stub.d.ts +0 -6
package/dist/types/media.ts
CHANGED
|
@@ -1,106 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const MediaContextSchema = z.enum(['avatar', 'cover', 'voice', 'general'])
|
|
8
|
-
export type MediaContext = z.infer<typeof MediaContextSchema>
|
|
9
|
-
|
|
10
|
-
export const MediaStatusSchema = z.enum(['processing', 'active', 'failed', 'deleted'])
|
|
11
|
-
export type MediaStatus = z.infer<typeof MediaStatusSchema>
|
|
12
|
-
|
|
13
|
-
// Format-specific enums for file extensions
|
|
14
|
-
export const ImageFormatSchema = z.enum(['jpg', 'jpeg', 'png', 'gif', 'webp', 'svg'])
|
|
15
|
-
export type ImageFormat = z.infer<typeof ImageFormatSchema>
|
|
16
|
-
|
|
17
|
-
export const VideoFormatSchema = z.enum(['mp4', 'webm', 'ogg', 'mov', 'avi'])
|
|
18
|
-
export type VideoFormat = z.infer<typeof VideoFormatSchema>
|
|
19
|
-
|
|
20
|
-
export const AudioFormatSchema = z.enum(['mp3', 'wav', 'ogg', 'aac', 'flac'])
|
|
21
|
-
export type AudioFormat = z.infer<typeof AudioFormatSchema>
|
|
22
|
-
|
|
23
|
-
// Base media schema - independent definition
|
|
24
|
-
const baseMediaSchema = z.object({
|
|
25
|
-
mediaId: z.string(),
|
|
26
|
-
userId: z.string(),
|
|
27
|
-
orgId: z.string(),
|
|
28
|
-
selfId: z.string().nullable().optional(),
|
|
29
|
-
filename: z.string(),
|
|
30
|
-
mimeType: z.string(),
|
|
31
|
-
size: z.number(),
|
|
32
|
-
src: z.string(),
|
|
33
|
-
alt: z.string().optional(),
|
|
34
|
-
context: MediaContextSchema.default('general'),
|
|
35
|
-
status: MediaStatusSchema.default('processing'),
|
|
36
|
-
createdAt: z.string().optional(), // ISO string for JSON compatibility
|
|
37
|
-
updatedAt: z.string().optional(), // ISO string for JSON compatibility
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
// Extended MediaObject for UI use - with UI-friendly field names
|
|
41
|
-
export const MediaSchema = baseMediaSchema.extend({
|
|
42
|
-
// Additional UI fields not in database
|
|
43
|
-
format: MediaFormatSchema.optional(), // Derived from mimeType
|
|
44
|
-
className: z.string().optional(), // CSS classes for rendering
|
|
45
|
-
|
|
46
|
-
// Image/video dimensions
|
|
47
|
-
width: z.number().optional(),
|
|
48
|
-
height: z.number().optional(),
|
|
49
|
-
|
|
50
|
-
// Audio/video duration
|
|
51
|
-
duration: z.number().optional(),
|
|
52
|
-
|
|
53
|
-
// Image blur hash for loading placeholders
|
|
54
|
-
blurhash: z.string().optional(),
|
|
55
|
-
}).partial() // Make all fields optional for UI flexibility
|
|
56
|
-
|
|
57
|
-
// Video-specific properties
|
|
58
|
-
export const VideoPropertiesSchema = z.object({
|
|
59
|
-
duration: z.number().optional(), // in seconds
|
|
60
|
-
thumbnail: z.string().optional(),
|
|
61
|
-
autoplay: z.boolean().optional(),
|
|
62
|
-
loop: z.boolean().optional(),
|
|
63
|
-
muted: z.boolean().optional(),
|
|
64
|
-
controls: z.boolean().optional(),
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// Audio-specific properties
|
|
68
|
-
export const AudioPropertiesSchema = z.object({
|
|
69
|
-
duration: z.number().optional(), // in seconds
|
|
70
|
-
autoplay: z.boolean().optional(),
|
|
71
|
-
loop: z.boolean().optional(),
|
|
72
|
-
muted: z.boolean().optional(),
|
|
73
|
-
controls: z.boolean().optional(),
|
|
74
|
-
})
|
|
75
|
-
|
|
76
|
-
// Extended media schemas with format-specific properties
|
|
77
|
-
export const ImageMediaSchema = MediaSchema.extend({
|
|
78
|
-
format: z.literal('image'),
|
|
79
|
-
imageFormat: ImageFormatSchema,
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
export const VideoMediaSchema = MediaSchema.extend({
|
|
83
|
-
format: z.literal('video'),
|
|
84
|
-
videoFormat: VideoFormatSchema,
|
|
85
|
-
video: VideoPropertiesSchema.optional(),
|
|
86
|
-
})
|
|
87
|
-
|
|
88
|
-
export const AudioMediaSchema = MediaSchema.extend({
|
|
89
|
-
format: z.literal('audio'),
|
|
90
|
-
audioFormat: AudioFormatSchema,
|
|
91
|
-
audio: AudioPropertiesSchema.optional(),
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
// Union type for all media
|
|
95
|
-
export const MediaUnionSchema = z.discriminatedUnion('format', [
|
|
1
|
+
// Re-export media types from @fiction/types (single source of truth)
|
|
2
|
+
export {
|
|
3
|
+
AudioFormatSchema,
|
|
4
|
+
AudioMediaSchema,
|
|
5
|
+
AudioPropertiesSchema,
|
|
6
|
+
ImageFormatSchema,
|
|
96
7
|
ImageMediaSchema,
|
|
8
|
+
MediaContextSchema,
|
|
9
|
+
MediaFormatSchema,
|
|
10
|
+
MediaSchema,
|
|
11
|
+
MediaStatusSchema,
|
|
12
|
+
MediaUnionSchema,
|
|
13
|
+
VideoFormatSchema,
|
|
97
14
|
VideoMediaSchema,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
15
|
+
VideoPropertiesSchema,
|
|
16
|
+
} from '@fiction/types'
|
|
17
|
+
|
|
18
|
+
export type {
|
|
19
|
+
AudioFormat,
|
|
20
|
+
AudioMedia,
|
|
21
|
+
ImageFormat,
|
|
22
|
+
ImageMedia,
|
|
23
|
+
MediaContext,
|
|
24
|
+
MediaFormat,
|
|
25
|
+
MediaObject,
|
|
26
|
+
MediaStatus,
|
|
27
|
+
MediaUnion,
|
|
28
|
+
VideoFormat,
|
|
29
|
+
VideoMedia,
|
|
30
|
+
} from '@fiction/types'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fiction/sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.20",
|
|
4
4
|
"description": "SDK for Fiction app authentication and user management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/sdk.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"repository": {
|
|
34
34
|
"type": "git",
|
|
35
35
|
"url": "https://github.com/fictionco/fiction-app.git",
|
|
36
|
-
"directory": "
|
|
36
|
+
"directory": "packages/sdk"
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://fiction.com",
|
|
39
39
|
"bugs": {
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"registry": "https://registry.npmjs.org/"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
+
"@fiction/types": "^1.0.0",
|
|
47
48
|
"vue": "^3.5.0"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
@@ -54,7 +55,7 @@
|
|
|
54
55
|
"nanoid": "^5.1.6",
|
|
55
56
|
"nanostores": "^1.0.1",
|
|
56
57
|
"zod": "^4.1.11",
|
|
57
|
-
"@fiction/
|
|
58
|
+
"@fiction/types": "1.0.1"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|
|
60
61
|
"@antfu/eslint-config": "^5.4.1",
|