wip
This commit is contained in:
parent
3324f3fa15
commit
ac99cdce8b
8 changed files with 20 additions and 20 deletions
|
@ -102,8 +102,8 @@
|
||||||
"jsdom": "21.1.1",
|
"jsdom": "21.1.1",
|
||||||
"json5": "2.2.3",
|
"json5": "2.2.3",
|
||||||
"jsonld": "8.1.1",
|
"jsonld": "8.1.1",
|
||||||
"meilisearch": "0.32.3",
|
|
||||||
"jsrsasign": "10.8.6",
|
"jsrsasign": "10.8.6",
|
||||||
|
"meilisearch": "0.32.3",
|
||||||
"mfm-js": "0.23.3",
|
"mfm-js": "0.23.3",
|
||||||
"mime-types": "2.1.35",
|
"mime-types": "2.1.35",
|
||||||
"misskey-js": "workspace:*",
|
"misskey-js": "workspace:*",
|
||||||
|
@ -210,6 +210,7 @@
|
||||||
"eslint-plugin-import": "2.27.5",
|
"eslint-plugin-import": "2.27.5",
|
||||||
"execa": "6.1.0",
|
"execa": "6.1.0",
|
||||||
"jest": "29.5.0",
|
"jest": "29.5.0",
|
||||||
"jest-mock": "29.5.0"
|
"jest-mock": "29.5.0",
|
||||||
|
"schema-type": "github:misskey-dev/schema-type"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
|
||||||
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
packedUserLiteSchema,
|
packedUserLiteSchema,
|
||||||
packedUserDetailedNotMeOnlySchema,
|
packedUserDetailedNotMeOnlySchema,
|
||||||
|
@ -64,8 +67,6 @@ export const refs = {
|
||||||
Flash: packedFlashSchema,
|
Flash: packedFlashSchema,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Packed<x extends keyof typeof refs> = SchemaType<typeof refs[x]>;
|
|
||||||
|
|
||||||
type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any';
|
type TypeStringef = 'null' | 'boolean' | 'integer' | 'number' | 'string' | 'array' | 'object' | 'any';
|
||||||
type StringDefToType<T extends TypeStringef> =
|
type StringDefToType<T extends TypeStringef> =
|
||||||
T extends 'null' ? null :
|
T extends 'null' ? null :
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import Ajv from 'ajv';
|
import Ajv from 'ajv';
|
||||||
import type { Schema, SchemaType } from '@/misc/json-schema.js';
|
import type { JSONSchema7, SchemaType } from 'schema-type';
|
||||||
import type { LocalUser } from '@/models/entities/User.js';
|
import type { LocalUser } from '@/models/entities/User.js';
|
||||||
import type { AccessToken } from '@/models/entities/AccessToken.js';
|
import type { AccessToken } from '@/models/entities/AccessToken.js';
|
||||||
import { ApiError } from './error.js';
|
import { ApiError } from './error.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { UsersRepository, NotesRepository } from '@/models/index.js';
|
||||||
import type { Note } from '@/models/entities/Note.js';
|
import type { Note } from '@/models/entities/Note.js';
|
||||||
import type { LocalUser, User } from '@/models/entities/User.js';
|
import type { LocalUser, User } from '@/models/entities/User.js';
|
||||||
import { isActor, isPost, getApId } from '@/core/activitypub/type.js';
|
import { isActor, isPost, getApId } from '@/core/activitypub/type.js';
|
||||||
import type { SchemaType } from '@/misc/json-schema.js';
|
import type { SchemaType } from 'schema-type';
|
||||||
import { ApResolverService } from '@/core/activitypub/ApResolverService.js';
|
import { ApResolverService } from '@/core/activitypub/ApResolverService.js';
|
||||||
import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
|
import { ApDbResolverService } from '@/core/activitypub/ApDbResolverService.js';
|
||||||
import { MetaService } from '@/core/MetaService.js';
|
import { MetaService } from '@/core/MetaService.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Schema } from '@/misc/json-schema.js';
|
import type { Schema } from '@/misc/json-schema.js';
|
||||||
import { refs } from '@/misc/json-schema.js';
|
import { refs } from 'misskey-js';
|
||||||
|
|
||||||
export function convertSchemaToOpenApiSchema(schema: Schema) {
|
export function convertSchemaToOpenApiSchema(schema: Schema) {
|
||||||
const res: any = schema;
|
const res: any = schema;
|
||||||
|
|
|
@ -2,6 +2,8 @@ import { Endpoints } from './api.types.js';
|
||||||
import Stream, { Connection } from './streaming.js';
|
import Stream, { Connection } from './streaming.js';
|
||||||
import { Channels } from './streaming.types.js';
|
import { Channels } from './streaming.types.js';
|
||||||
import { Acct } from './acct.js';
|
import { Acct } from './acct.js';
|
||||||
|
import type { Packed, Def } from './schemas.js';
|
||||||
|
import { refs as _refs } from './schemas.js';
|
||||||
import * as consts from './consts.js';
|
import * as consts from './consts.js';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
@ -10,8 +12,11 @@ export {
|
||||||
Connection as ChannelConnection,
|
Connection as ChannelConnection,
|
||||||
Channels,
|
Channels,
|
||||||
Acct,
|
Acct,
|
||||||
|
Packed, Def,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const refs = _refs;
|
||||||
|
|
||||||
export const permissions = consts.permissions;
|
export const permissions = consts.permissions;
|
||||||
export const notificationTypes = consts.notificationTypes;
|
export const notificationTypes = consts.notificationTypes;
|
||||||
export const obsoleteNotificationTypes = consts.obsoleteNotificationTypes;
|
export const obsoleteNotificationTypes = consts.obsoleteNotificationTypes;
|
||||||
|
|
|
@ -33,6 +33,8 @@ import { packedFlashSchema } from './schemas/flash.js';
|
||||||
import type { JSONSchema7, JSONSchema7Definition, GetDef, GetRefs, GetKeys, UnionToArray } from 'schema-type';
|
import type { JSONSchema7, JSONSchema7Definition, GetDef, GetRefs, GetKeys, UnionToArray } from 'schema-type';
|
||||||
|
|
||||||
export const refs = {
|
export const refs = {
|
||||||
|
Id: IdSchema,
|
||||||
|
|
||||||
UserLite: packedUserLiteSchema,
|
UserLite: packedUserLiteSchema,
|
||||||
UserDetailedNotMeOnly: packedUserDetailedNotMeOnlySchema,
|
UserDetailedNotMeOnly: packedUserDetailedNotMeOnlySchema,
|
||||||
MeDetailedOnly: packedMeDetailedOnlySchema,
|
MeDetailedOnly: packedMeDetailedOnlySchema,
|
||||||
|
@ -66,17 +68,7 @@ export const refs = {
|
||||||
Flash: packedFlashSchema,
|
Flash: packedFlashSchema,
|
||||||
} as const satisfies { [x: string]: JSONSchema7Definition };
|
} as const satisfies { [x: string]: JSONSchema7Definition };
|
||||||
|
|
||||||
type Refs = typeof refs[keyof typeof refs];
|
type References = GetRefs<typeof refs>;
|
||||||
|
|
||||||
export type References = [
|
|
||||||
typeof IdSchema,
|
|
||||||
...UnionToArray<Refs>,
|
|
||||||
];
|
|
||||||
|
|
||||||
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 PackedUser = Packed<'User'>;
|
|
||||||
export type DefNote = Def<'https://misskey-hub.net/api/schemas/Note'>;
|
|
||||||
let renote: PackedNote['reply'];
|
|
||||||
|
|
|
@ -621,6 +621,9 @@ importers:
|
||||||
jest-mock:
|
jest-mock:
|
||||||
specifier: 29.5.0
|
specifier: 29.5.0
|
||||||
version: 29.5.0
|
version: 29.5.0
|
||||||
|
schema-type:
|
||||||
|
specifier: github:misskey-dev/schema-type
|
||||||
|
version: github.com/misskey-dev/schema-type/c771673a44d514658d4d5a4dd2c201b2294f225b(typescript@5.0.4)
|
||||||
|
|
||||||
packages/frontend:
|
packages/frontend:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -18896,7 +18899,6 @@ packages:
|
||||||
typescript: '>=4.1.0'
|
typescript: '>=4.1.0'
|
||||||
dependencies:
|
dependencies:
|
||||||
typescript: 5.0.4
|
typescript: 5.0.4
|
||||||
dev: false
|
|
||||||
|
|
||||||
/ts-map@1.0.3:
|
/ts-map@1.0.3:
|
||||||
resolution: {integrity: sha512-vDWbsl26LIcPGmDpoVzjEP6+hvHZkBkLW7JpvwbCv/5IYPJlsbzCVXY3wsCeAxAUeTclNOUZxnLdGh3VBD/J6w==}
|
resolution: {integrity: sha512-vDWbsl26LIcPGmDpoVzjEP6+hvHZkBkLW7JpvwbCv/5IYPJlsbzCVXY3wsCeAxAUeTclNOUZxnLdGh3VBD/J6w==}
|
||||||
|
@ -20332,7 +20334,6 @@ packages:
|
||||||
tsd: 0.28.1
|
tsd: 0.28.1
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- typescript
|
- typescript
|
||||||
dev: false
|
|
||||||
|
|
||||||
github.com/misskey-dev/sharp-read-bmp/02d9dc189fa7df0c4bea09330be26741772dac01:
|
github.com/misskey-dev/sharp-read-bmp/02d9dc189fa7df0c4bea09330be26741772dac01:
|
||||||
resolution: {tarball: https://codeload.github.com/misskey-dev/sharp-read-bmp/tar.gz/02d9dc189fa7df0c4bea09330be26741772dac01}
|
resolution: {tarball: https://codeload.github.com/misskey-dev/sharp-read-bmp/tar.gz/02d9dc189fa7df0c4bea09330be26741772dac01}
|
||||||
|
|
Loading…
Reference in a new issue