wip
This commit is contained in:
parent
ad6c5275ec
commit
56a1e436f3
3 changed files with 192 additions and 196 deletions
|
@ -64,19 +64,19 @@ export const refs = {
|
||||||
EmojiSimple: packedEmojiSimpleSchema,
|
EmojiSimple: packedEmojiSimpleSchema,
|
||||||
EmojiDetailed: packedEmojiDetailedSchema,
|
EmojiDetailed: packedEmojiDetailedSchema,
|
||||||
Flash: packedFlashSchema,
|
Flash: packedFlashSchema,
|
||||||
} as const /*satisfies { [x: string]: JSONSchema7Definition }*/;
|
} as const satisfies { [x: string]: JSONSchema7Definition };
|
||||||
|
|
||||||
type Refs = typeof packedAntennaSchema | typeof packedNoteSchema; // TODO: typeof refs[keyof typeof refs];
|
type Refs = typeof refs[keyof typeof refs];
|
||||||
|
|
||||||
export type References = [
|
export type References = [
|
||||||
typeof IdSchema,
|
typeof IdSchema,
|
||||||
typeof packedAntennaSchema,
|
...UnionToArray<Refs>,
|
||||||
typeof packedNoteSchema,
|
|
||||||
];
|
];
|
||||||
|
|
||||||
export type Packed<x extends GetKeys<References, 'https://misskey-hub.net/api/schemas/'>> = GetDef<References, x, 'https://misskey-hub.net/api/schemas/'>;
|
export type Packed<x extends GetKeys<References, 'https://misskey-hub.net/api/schemas/'>> = GetDef<References, x, 'https://misskey-hub.net/api/schemas/'>;
|
||||||
export type Def<x extends GetKeys<References>> = GetDef<References, x>;
|
export type Def<x extends GetKeys<References>> = GetDef<References, x>;
|
||||||
|
|
||||||
export type PackedNote = Packed<'Note'>;
|
export type PackedNote = Packed<'Note'>;
|
||||||
|
export type PackedUser = Packed<'User'>;
|
||||||
export type DefNote = Def<'https://misskey-hub.net/api/schemas/Note'>;
|
export type DefNote = Def<'https://misskey-hub.net/api/schemas/Note'>;
|
||||||
let renote: PackedNote['reply'];
|
let renote: PackedNote['reply'];
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { JSONSchema7Definition } from 'schema-type';
|
import type { JSONSchema7, JSONSchema7Definition } from 'schema-type';
|
||||||
|
|
||||||
export const packedUserLiteSchema = {
|
export const packedUserLiteSchema = {
|
||||||
$id: 'https://misskey-hub.net/api/schemas/UserLite',
|
$id: 'https://misskey-hub.net/api/schemas/UserLite',
|
||||||
|
@ -63,6 +63,7 @@ export const packedUserLiteSchema = {
|
||||||
export const packedUserDetailedNotMeOnlySchema = {
|
export const packedUserDetailedNotMeOnlySchema = {
|
||||||
$id: 'https://misskey-hub.net/api/schemas/UserDetailedNotMeOnly',
|
$id: 'https://misskey-hub.net/api/schemas/UserDetailedNotMeOnly',
|
||||||
|
|
||||||
|
type: 'object',
|
||||||
oneOf: [{
|
oneOf: [{
|
||||||
$ref: '#/$defs/base',
|
$ref: '#/$defs/base',
|
||||||
}, {
|
}, {
|
||||||
|
@ -297,204 +298,199 @@ export const packedUserDetailedNotMeOnlySchema = {
|
||||||
} as const satisfies JSONSchema7Definition;
|
} as const satisfies JSONSchema7Definition;
|
||||||
|
|
||||||
export const packedMeDetailedOnlySchema = {
|
export const packedMeDetailedOnlySchema = {
|
||||||
|
$id: 'https://misskey-hub.net/api/schemas/MeDetailedOnly',
|
||||||
|
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
oneOf: [{
|
||||||
avatarId: {
|
$ref: '#/$defs/base',
|
||||||
type: 'string',
|
}, {
|
||||||
nullable: true, optional: false,
|
allOf: [{ $ref: '#/$defs/base' }, { $ref: '#/$defs/secrets' }],
|
||||||
format: 'id',
|
}],
|
||||||
},
|
$defs: {
|
||||||
bannerId: {
|
base: {
|
||||||
type: 'string',
|
type: 'object',
|
||||||
nullable: true, optional: false,
|
properties: {
|
||||||
format: 'id',
|
avatarId: {
|
||||||
},
|
oneOf: [{
|
||||||
injectFeaturedNote: {
|
$ref: 'https://misskey-hub.net/api/schemas/Id',
|
||||||
type: 'boolean',
|
}, {
|
||||||
nullable: true, optional: false,
|
type: 'null',
|
||||||
},
|
}],
|
||||||
receiveAnnouncementEmail: {
|
},
|
||||||
type: 'boolean',
|
bannerId: {
|
||||||
nullable: true, optional: false,
|
oneOf: [{
|
||||||
},
|
$ref: 'https://misskey-hub.net/api/schemas/Id',
|
||||||
alwaysMarkNsfw: {
|
}, {
|
||||||
type: 'boolean',
|
type: 'null',
|
||||||
nullable: true, optional: false,
|
}],
|
||||||
},
|
},
|
||||||
autoSensitive: {
|
injectFeaturedNote: {
|
||||||
type: 'boolean',
|
type: ['boolean', 'null'],
|
||||||
nullable: true, optional: false,
|
},
|
||||||
},
|
receiveAnnouncementEmail: {
|
||||||
carefulBot: {
|
type: ['boolean', 'null'],
|
||||||
type: 'boolean',
|
},
|
||||||
nullable: true, optional: false,
|
alwaysMarkNsfw: {
|
||||||
},
|
type: ['boolean', 'null'],
|
||||||
autoAcceptFollowed: {
|
},
|
||||||
type: 'boolean',
|
autoSensitive: {
|
||||||
nullable: true, optional: false,
|
type: ['boolean', 'null'],
|
||||||
},
|
},
|
||||||
noCrawle: {
|
carefulBot: {
|
||||||
type: 'boolean',
|
type: ['boolean', 'null'],
|
||||||
nullable: true, optional: false,
|
},
|
||||||
},
|
autoAcceptFollowed: {
|
||||||
preventAiLarning: {
|
type: ['boolean', 'null'],
|
||||||
type: 'boolean',
|
},
|
||||||
nullable: false, optional: false,
|
noCrawle: {
|
||||||
},
|
type: ['boolean', 'null'],
|
||||||
isExplorable: {
|
},
|
||||||
type: 'boolean',
|
preventAiLarning: {
|
||||||
nullable: false, optional: false,
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
isDeleted: {
|
isExplorable: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
},
|
||||||
},
|
isDeleted: {
|
||||||
hideOnlineStatus: {
|
type: 'boolean',
|
||||||
type: 'boolean',
|
},
|
||||||
nullable: false, optional: false,
|
hideOnlineStatus: {
|
||||||
},
|
type: 'boolean',
|
||||||
hasUnreadSpecifiedNotes: {
|
},
|
||||||
type: 'boolean',
|
hasUnreadSpecifiedNotes: {
|
||||||
nullable: false, optional: false,
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
hasUnreadMentions: {
|
hasUnreadMentions: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
},
|
||||||
},
|
hasUnreadAnnouncement: {
|
||||||
hasUnreadAnnouncement: {
|
type: 'boolean',
|
||||||
type: 'boolean',
|
},
|
||||||
nullable: false, optional: false,
|
hasUnreadAntenna: {
|
||||||
},
|
type: 'boolean',
|
||||||
hasUnreadAntenna: {
|
},
|
||||||
type: 'boolean',
|
hasUnreadNotification: {
|
||||||
nullable: false, optional: false,
|
type: 'boolean',
|
||||||
},
|
},
|
||||||
hasUnreadNotification: {
|
hasPendingReceivedFollowRequest: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
nullable: false, optional: false,
|
},
|
||||||
},
|
mutedWords: {
|
||||||
hasPendingReceivedFollowRequest: {
|
type: 'array',
|
||||||
type: 'boolean',
|
items: {
|
||||||
nullable: false, optional: false,
|
type: 'array',
|
||||||
},
|
items: {
|
||||||
mutedWords: {
|
type: 'string',
|
||||||
type: 'array',
|
},
|
||||||
nullable: false, optional: false,
|
},
|
||||||
items: {
|
},
|
||||||
type: 'array',
|
mutedInstances: {
|
||||||
nullable: false, optional: false,
|
oneOf: [{
|
||||||
items: {
|
type: 'array',
|
||||||
type: 'string',
|
items: {
|
||||||
nullable: false, optional: false,
|
type: 'string',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
type: 'null',
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
mutingNotificationTypes: {
|
||||||
|
oneOf: [{
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
type: 'null',
|
||||||
|
}],
|
||||||
|
},
|
||||||
|
emailNotificationTypes: {
|
||||||
|
oneOf: [{
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'string',
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
type: 'null',
|
||||||
|
}],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mutedInstances: {
|
secrets: {
|
||||||
type: 'array',
|
type: 'object',
|
||||||
nullable: true, optional: false,
|
properties: {
|
||||||
items: {
|
email: {
|
||||||
type: 'string',
|
type: ['string', 'null'],
|
||||||
nullable: false, optional: false,
|
},
|
||||||
|
emailVerified: {
|
||||||
|
type: ['boolean', 'null'],
|
||||||
|
},
|
||||||
|
securityKeysList: {
|
||||||
|
type: 'array',
|
||||||
|
items: {
|
||||||
|
type: 'object',
|
||||||
|
additionalProperties: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
required: [
|
||||||
|
'email',
|
||||||
|
'emailVerified',
|
||||||
|
'securityKeysList',
|
||||||
|
],
|
||||||
},
|
},
|
||||||
mutingNotificationTypes: {
|
|
||||||
type: 'array',
|
|
||||||
nullable: true, optional: false,
|
|
||||||
items: {
|
|
||||||
type: 'string',
|
|
||||||
nullable: false, optional: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
emailNotificationTypes: {
|
|
||||||
type: 'array',
|
|
||||||
nullable: true, optional: false,
|
|
||||||
items: {
|
|
||||||
type: 'string',
|
|
||||||
nullable: false, optional: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
//#region secrets
|
|
||||||
email: {
|
|
||||||
type: 'string',
|
|
||||||
nullable: true, optional: true,
|
|
||||||
},
|
|
||||||
emailVerified: {
|
|
||||||
type: 'boolean',
|
|
||||||
nullable: true, optional: true,
|
|
||||||
},
|
|
||||||
securityKeysList: {
|
|
||||||
type: 'array',
|
|
||||||
nullable: false, optional: true,
|
|
||||||
items: {
|
|
||||||
type: 'object',
|
|
||||||
nullable: false, optional: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
//#endregion
|
|
||||||
},
|
},
|
||||||
} as const;
|
} as const satisfies JSONSchema7Definition;
|
||||||
|
|
||||||
export const packedUserDetailedNotMeSchema = {
|
export const packedUserDetailedNotMeSchema = {
|
||||||
|
$id: 'https://misskey-hub.net/api/schemas/UserDetailedNotMe',
|
||||||
|
|
||||||
type: 'object',
|
type: 'object',
|
||||||
allOf: [
|
allOf: [{
|
||||||
{
|
$ref: 'https://misskey-hub.net/api/schemas/UserLite',
|
||||||
type: 'object',
|
}, {
|
||||||
ref: 'UserLite',
|
$ref: 'https://misskey-hub.net/api/schemas/UserDetailedNotMeOnly',
|
||||||
},
|
}],
|
||||||
{
|
} as const satisfies JSONSchema7Definition;
|
||||||
type: 'object',
|
|
||||||
ref: 'UserDetailedNotMeOnly',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const packedMeDetailedSchema = {
|
export const packedMeDetailedSchema = {
|
||||||
|
$id: 'https://misskey-hub.net/api/schemas/MeDetailed',
|
||||||
|
|
||||||
type: 'object',
|
type: 'object',
|
||||||
allOf: [
|
allOf: [{
|
||||||
{
|
$ref: 'https://misskey-hub.net/api/schemas/UserLite',
|
||||||
type: 'object',
|
}, {
|
||||||
ref: 'UserLite',
|
$ref: 'https://misskey-hub.net/api/schemas/UserDetailedNotMeOnly',
|
||||||
},
|
}, {
|
||||||
{
|
$ref: 'https://misskey-hub.net/api/schemas/MeDetailedOnly',
|
||||||
type: 'object',
|
}],
|
||||||
ref: 'UserDetailedNotMeOnly',
|
} as const satisfies JSONSchema7Definition;
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'object',
|
|
||||||
ref: 'MeDetailedOnly',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const packedUserDetailedSchema = {
|
export const packedUserDetailedSchema = {
|
||||||
oneOf: [
|
$id: 'https://misskey-hub.net/api/schemas/UserDetailed',
|
||||||
{
|
|
||||||
type: 'object',
|
type: 'object',
|
||||||
ref: 'UserDetailedNotMe',
|
oneOf: [{
|
||||||
},
|
$ref: 'https://misskey-hub.net/api/schemas/UserDetailedNotMe',
|
||||||
{
|
}, {
|
||||||
type: 'object',
|
$ref: 'https://misskey-hub.net/api/schemas/MeDetailed',
|
||||||
ref: 'MeDetailed',
|
}],
|
||||||
},
|
} as const satisfies JSONSchema7Definition;
|
||||||
],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const packedUserSchema = {
|
export const packedUserSchema = {
|
||||||
oneOf: [
|
$id: 'https://misskey-hub.net/api/schemas/User',
|
||||||
{
|
|
||||||
type: 'object',
|
|
||||||
ref: 'UserLite',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: 'object',
|
|
||||||
ref: 'UserDetailed',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const;
|
type: 'object',
|
||||||
export const passwordSchema = { type: 'string', minLength: 1 } as const;
|
oneOf: [{
|
||||||
export const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
|
$ref: 'https://misskey-hub.net/api/schemas/UserLite',
|
||||||
export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 1500 } as const;
|
}, {
|
||||||
export const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const;
|
$ref: 'https://misskey-hub.net/api/schemas/UserDetailed',
|
||||||
export const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const;
|
}],
|
||||||
|
} as const satisfies JSONSchema7Definition;
|
||||||
|
|
||||||
|
export const localUsernameSchema = { type: 'string', pattern: /^\w{1,20}$/.toString().slice(1, -1) } as const satisfies JSONSchema7;
|
||||||
|
export const passwordSchema = { type: 'string', minLength: 1 } as const satisfies JSONSchema7;
|
||||||
|
export const nameSchema = { type: 'string', minLength: 1, maxLength: 50 } as const satisfies JSONSchema7;
|
||||||
|
export const descriptionSchema = { type: 'string', minLength: 1, maxLength: 1500 } as const satisfies JSONSchema7;
|
||||||
|
export const locationSchema = { type: 'string', minLength: 1, maxLength: 50 } as const satisfies JSONSchema7;
|
||||||
|
export const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/.toString().slice(1, -1) } as const satisfies JSONSchema7;
|
||||||
|
|
|
@ -348,7 +348,7 @@ importers:
|
||||||
version: 2.1.0
|
version: 2.1.0
|
||||||
summaly:
|
summaly:
|
||||||
specifier: github:misskey-dev/summaly
|
specifier: github:misskey-dev/summaly
|
||||||
version: github.com/misskey-dev/summaly/2d63e2a0066f89871e777cc81d43c1ade8c97517
|
version: github.com/misskey-dev/summaly/77dd5654bb82280b38c1f50e51a771c33f3df503
|
||||||
systeminformation:
|
systeminformation:
|
||||||
specifier: 5.17.12
|
specifier: 5.17.12
|
||||||
version: 5.17.12
|
version: 5.17.12
|
||||||
|
@ -984,7 +984,7 @@ importers:
|
||||||
version: github.com/misskey-dev/storybook-addon-misskey-theme/cf583db098365b2ccc81a82f63ca9c93bc32b640(@storybook/blocks@7.0.7)(@storybook/components@7.0.7)(@storybook/core-events@7.0.7)(@storybook/manager-api@7.0.7)(@storybook/preview-api@7.0.7)(@storybook/theming@7.0.7)(@storybook/types@7.0.7)(react-dom@18.2.0)(react@18.2.0)
|
version: github.com/misskey-dev/storybook-addon-misskey-theme/cf583db098365b2ccc81a82f63ca9c93bc32b640(@storybook/blocks@7.0.7)(@storybook/components@7.0.7)(@storybook/core-events@7.0.7)(@storybook/manager-api@7.0.7)(@storybook/preview-api@7.0.7)(@storybook/theming@7.0.7)(@storybook/types@7.0.7)(react-dom@18.2.0)(react@18.2.0)
|
||||||
summaly:
|
summaly:
|
||||||
specifier: github:misskey-dev/summaly
|
specifier: github:misskey-dev/summaly
|
||||||
version: github.com/misskey-dev/summaly/2d63e2a0066f89871e777cc81d43c1ade8c97517
|
version: github.com/misskey-dev/summaly/77dd5654bb82280b38c1f50e51a771c33f3df503
|
||||||
vite-plugin-turbosnap:
|
vite-plugin-turbosnap:
|
||||||
specifier: 1.0.2
|
specifier: 1.0.2
|
||||||
version: 1.0.2
|
version: 1.0.2
|
||||||
|
@ -1020,7 +1020,7 @@ importers:
|
||||||
version: 4.4.0
|
version: 4.4.0
|
||||||
schema-type:
|
schema-type:
|
||||||
specifier: github:misskey-dev/schema-type
|
specifier: github:misskey-dev/schema-type
|
||||||
version: github.com/misskey-dev/schema-type/d50e5ea86b7aeb3a6ddfba0717e44c016ac42854(typescript@5.0.4)
|
version: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4)
|
||||||
ts-essentials:
|
ts-essentials:
|
||||||
specifier: ^9.3.2
|
specifier: ^9.3.2
|
||||||
version: 9.3.2(typescript@5.0.4)
|
version: 9.3.2(typescript@5.0.4)
|
||||||
|
@ -20321,9 +20321,9 @@ packages:
|
||||||
version: 2.2.1-misskey.3
|
version: 2.2.1-misskey.3
|
||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
github.com/misskey-dev/schema-type/d50e5ea86b7aeb3a6ddfba0717e44c016ac42854(typescript@5.0.4):
|
github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4):
|
||||||
resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/d50e5ea86b7aeb3a6ddfba0717e44c016ac42854}
|
resolution: {tarball: https://codeload.github.com/misskey-dev/schema-type/tar.gz/c771673a44d514658d4d5a4dd2c201b2294f225b}
|
||||||
id: github.com/misskey-dev/schema-type/d50e5ea86b7aeb3a6ddfba0717e44c016ac42854
|
id: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b
|
||||||
name: schema-type
|
name: schema-type
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -20376,8 +20376,8 @@ packages:
|
||||||
react-dom: 18.2.0(react@18.2.0)
|
react-dom: 18.2.0(react@18.2.0)
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
github.com/misskey-dev/summaly/2d63e2a0066f89871e777cc81d43c1ade8c97517:
|
github.com/misskey-dev/summaly/77dd5654bb82280b38c1f50e51a771c33f3df503:
|
||||||
resolution: {tarball: https://codeload.github.com/misskey-dev/summaly/tar.gz/2d63e2a0066f89871e777cc81d43c1ade8c97517}
|
resolution: {tarball: https://codeload.github.com/misskey-dev/summaly/tar.gz/77dd5654bb82280b38c1f50e51a771c33f3df503}
|
||||||
name: summaly
|
name: summaly
|
||||||
version: 4.0.2
|
version: 4.0.2
|
||||||
dependencies:
|
dependencies:
|
||||||
|
|
Loading…
Reference in a new issue