2023-07-27 07:31:52 +02:00
|
|
|
/*
|
|
|
|
* SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2024-01-30 11:53:53 +01:00
|
|
|
const blockBaseSchema = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
type: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
const textBlockSchema = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
...blockBaseSchema.properties,
|
|
|
|
type: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
enum: ['text'],
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
const sectionBlockSchema = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
...blockBaseSchema.properties,
|
|
|
|
type: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
enum: ['section'],
|
|
|
|
},
|
|
|
|
title: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
children: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
ref: 'PageBlock',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
const imageBlockSchema = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
...blockBaseSchema.properties,
|
|
|
|
type: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
enum: ['image'],
|
|
|
|
},
|
|
|
|
fileId: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
const noteBlockSchema = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
...blockBaseSchema.properties,
|
|
|
|
type: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
enum: ['note'],
|
|
|
|
},
|
|
|
|
detailed: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
note: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
export const packedPageBlockSchema = {
|
|
|
|
type: 'object',
|
|
|
|
oneOf: [
|
|
|
|
textBlockSchema,
|
|
|
|
sectionBlockSchema,
|
|
|
|
imageBlockSchema,
|
|
|
|
noteBlockSchema,
|
|
|
|
],
|
|
|
|
} as const;
|
|
|
|
|
2022-01-18 14:27:10 +01:00
|
|
|
export const packedPageSchema = {
|
|
|
|
type: 'object',
|
|
|
|
properties: {
|
|
|
|
id: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'id',
|
|
|
|
example: 'xxxxxxxxxx',
|
|
|
|
},
|
|
|
|
createdAt: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'date-time',
|
|
|
|
},
|
|
|
|
updatedAt: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'date-time',
|
|
|
|
},
|
2023-11-21 03:13:56 +01:00
|
|
|
userId: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
format: 'id',
|
|
|
|
},
|
|
|
|
user: {
|
|
|
|
type: 'object',
|
|
|
|
ref: 'UserLite',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
content: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
2024-01-30 11:53:53 +01:00
|
|
|
ref: 'PageBlock',
|
2023-11-21 03:13:56 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
variables: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
},
|
2022-01-18 14:27:10 +01:00
|
|
|
title: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
name: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
summary: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
2023-11-21 03:13:56 +01:00
|
|
|
hideTitleWhenPinned: {
|
|
|
|
type: 'boolean',
|
2022-01-18 14:27:10 +01:00
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
2023-11-21 03:13:56 +01:00
|
|
|
alignCenter: {
|
|
|
|
type: 'boolean',
|
2022-01-18 14:27:10 +01:00
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
2023-11-21 03:13:56 +01:00
|
|
|
font: {
|
2022-01-18 14:27:10 +01:00
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
2023-11-21 03:13:56 +01:00
|
|
|
script: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
|
|
|
eyeCatchingImageId: {
|
|
|
|
type: 'string',
|
|
|
|
optional: false, nullable: true,
|
|
|
|
},
|
|
|
|
eyeCatchingImage: {
|
2022-01-18 14:27:10 +01:00
|
|
|
type: 'object',
|
2023-11-21 03:13:56 +01:00
|
|
|
optional: false, nullable: true,
|
|
|
|
ref: 'DriveFile',
|
|
|
|
},
|
|
|
|
attachedFiles: {
|
|
|
|
type: 'array',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
items: {
|
|
|
|
type: 'object',
|
|
|
|
optional: false, nullable: false,
|
|
|
|
ref: 'DriveFile',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
likedCount: {
|
|
|
|
type: 'number',
|
2022-01-18 14:27:10 +01:00
|
|
|
optional: false, nullable: false,
|
|
|
|
},
|
2023-11-21 03:13:56 +01:00
|
|
|
isLiked: {
|
|
|
|
type: 'boolean',
|
|
|
|
optional: true, nullable: false,
|
|
|
|
},
|
2022-01-18 14:27:10 +01:00
|
|
|
},
|
|
|
|
} as const;
|