mirror of
https://github.com/koush/scrypted.git
synced 2026-06-20 16:40:30 +01:00
server/sdk: decouple sdk and types
This commit is contained in:
2
external/werift
vendored
2
external/werift
vendored
Submodule external/werift updated: bb7d569f45...6cdd007c7b
@@ -56,7 +56,7 @@ export const ScryptedInterfaceDescriptors: { [scryptedInterface: string]: Scrypt
|
||||
${fs.readFileSync(path.join(__dirname, './types.input.ts'))}
|
||||
`;
|
||||
|
||||
fs.writeFileSync(path.join(__dirname, '../types.ts'), contents);
|
||||
fs.writeFileSync(path.join(__dirname, '../types/index.ts'), contents);
|
||||
|
||||
const dictionaryTypes = new Set<string>();
|
||||
dictionaryTypes.add('EventDetails');
|
||||
|
||||
4
sdk/package-lock.json
generated
4
sdk/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.0.161",
|
||||
"version": "0.0.163",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.0.161",
|
||||
"version": "0.0.163",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@babel/plugin-proposal-class-properties": "^7.14.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/sdk",
|
||||
"version": "0.0.161",
|
||||
"version": "0.0.163",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"declaration": true,
|
||||
},
|
||||
"exclude": [
|
||||
"gen"
|
||||
"gen",
|
||||
"types"
|
||||
]
|
||||
}
|
||||
0
sdk/types.d.ts → sdk/types/index.d.ts
vendored
0
sdk/types.d.ts → sdk/types/index.d.ts
vendored
@@ -700,4 +700,4 @@ var ScryptedMimeTypes;
|
||||
ScryptedMimeTypes["SchemePrefix"] = "x-scrypted/x-scrypted-scheme-";
|
||||
ScryptedMimeTypes["MediaObject"] = "x-scrypted/x-scrypted-media-object";
|
||||
})(ScryptedMimeTypes = exports.ScryptedMimeTypes || (exports.ScryptedMimeTypes = {}));
|
||||
//# sourceMappingURL=types.js.map
|
||||
//# sourceMappingURL=index.js.map
|
||||
11
sdk/types/package.json
Normal file
11
sdk/types/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "@scrypted/types",
|
||||
"version": "0.0.2",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {},
|
||||
"devDependencies": {},
|
||||
"types": "index.d.ts"
|
||||
}
|
||||
3444
server/package-lock.json
generated
3444
server/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,9 +3,9 @@
|
||||
"version": "0.0.134",
|
||||
"description": "",
|
||||
"dependencies": {
|
||||
"@mapbox/node-pre-gyp": "^1.0.5",
|
||||
"@mapbox/node-pre-gyp": "^1.0.8",
|
||||
"@scrypted/ffmpeg": "^1.0.9",
|
||||
"@scrypted/sdk": "^0.0.161",
|
||||
"@scrypted/types": "^0.0.2",
|
||||
"adm-zip": "^0.5.3",
|
||||
"axios": "^0.21.1",
|
||||
"body-parser": "^1.19.0",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { LevelDocument } from "./level";
|
||||
import { ScryptedNativeId, SystemDeviceState } from "@scrypted/sdk/types";
|
||||
import { ScryptedNativeId, SystemDeviceState } from "@scrypted/types";
|
||||
|
||||
export class ScryptedDocument implements LevelDocument {
|
||||
_id?: string;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EventDetails, EventListenerOptions, EventListenerRegister, ScryptedInterface, SystemDeviceState } from "@scrypted/sdk/types";
|
||||
import { EventDetails, EventListenerOptions, EventListenerRegister, ScryptedInterface, SystemDeviceState } from "@scrypted/types";
|
||||
|
||||
export class EventListenerRegisterImpl implements EventListenerRegister {
|
||||
removeListener: () => void;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { HttpResponse, HttpResponseOptions } from "@scrypted/sdk/types";
|
||||
import { HttpResponse, HttpResponseOptions } from "@scrypted/types";
|
||||
import { Response } from "express";
|
||||
import mime from "mime";
|
||||
import { PROPERTY_PROXY_ONEWAY_METHODS } from "./rpc";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedDeviceType, ScryptedInterface, ScryptedInterfaceProperty } from "@scrypted/sdk/types";
|
||||
import { ScryptedDeviceType, ScryptedInterface, ScryptedInterfaceProperty } from "@scrypted/types";
|
||||
import { PluginDevice } from "./db-types";
|
||||
import { getState } from "./state";
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedInterface, ScryptedInterfaceDescriptors } from "@scrypted/sdk/types";
|
||||
import { ScryptedInterface, ScryptedInterfaceDescriptors } from "@scrypted/types";
|
||||
|
||||
export const allInterfaceMethods: string[] = [].concat(...Object.values(ScryptedInterfaceDescriptors).map((type: any) => type.methods));
|
||||
export const allInterfaceProperties: string[] = [].concat(...Object.values(ScryptedInterfaceDescriptors).map((type: any) => type.properties));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedInterfaceProperty, SystemDeviceState, MediaStreamUrl, VideoCamera, Camera, BufferConverter, FFMpegInput, MediaManager, MediaObject, ScryptedDevice, ScryptedInterface, ScryptedMimeTypes, SystemManager } from "@scrypted/sdk/types";
|
||||
import { ScryptedInterfaceProperty, SystemDeviceState, MediaStreamUrl, VideoCamera, Camera, BufferConverter, FFMpegInput, MediaManager, MediaObject, ScryptedDevice, ScryptedInterface, ScryptedMimeTypes, SystemManager } from "@scrypted/types";
|
||||
import { MediaObjectRemote } from "./plugin-api";
|
||||
import mimeType from 'mime'
|
||||
import child_process from 'child_process';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedNativeId, ScryptedDevice, Device, DeviceManifest, EventDetails, EventListenerOptions, EventListenerRegister, ScryptedInterfaceProperty, MediaObject, SystemDeviceState, MediaManager, HttpRequest } from '@scrypted/sdk/types'
|
||||
import { ScryptedNativeId, ScryptedDevice, Device, DeviceManifest, EventDetails, EventListenerOptions, EventListenerRegister, ScryptedInterfaceProperty, MediaObject, SystemDeviceState, MediaManager, HttpRequest } from '@scrypted/types'
|
||||
|
||||
export interface PluginLogger {
|
||||
log(level: string, message: string): Promise<void>;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedNativeId } from '@scrypted/sdk/types'
|
||||
import { ScryptedNativeId } from '@scrypted/types'
|
||||
import { listenZero } from './listen-zero';
|
||||
import { Server } from 'net';
|
||||
import { once } from 'events';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { DeviceProvider, EventDetails, EventListenerOptions, EventListenerRegister, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, ScryptedInterfaceDescriptors, ScryptedInterfaceProperty } from "@scrypted/sdk/types";
|
||||
import { DeviceProvider, EventDetails, EventListenerOptions, EventListenerRegister, ScryptedDevice, ScryptedDeviceType, ScryptedInterface, ScryptedInterfaceDescriptors, ScryptedInterfaceProperty } from "@scrypted/types";
|
||||
import { ScryptedRuntime } from "../runtime";
|
||||
import { PluginDevice } from "../db-types";
|
||||
import { MixinProvider } from "@scrypted/sdk/types";
|
||||
import { MixinProvider } from "@scrypted/types";
|
||||
import { handleFunctionInvocations, PrimitiveProxyHandler } from "../rpc";
|
||||
import { getState } from "../state";
|
||||
import { getDisplayType } from "../infer-defaults";
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedNativeId, ScryptedDevice, Device, DeviceManifest, EventDetails, EventListenerOptions, EventListenerRegister, ScryptedInterfaceProperty, MediaManager, HttpRequest } from '@scrypted/sdk/types'
|
||||
import { ScryptedNativeId, ScryptedDevice, Device, DeviceManifest, EventDetails, EventListenerOptions, EventListenerRegister, ScryptedInterfaceProperty, MediaManager, HttpRequest } from '@scrypted/types'
|
||||
import { ScryptedRuntime } from '../runtime';
|
||||
import { Plugin } from '../db-types';
|
||||
import { PluginAPI, PluginAPIManagedListeners } from './plugin-api';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { RpcPeer } from '../rpc';
|
||||
import AdmZip from 'adm-zip';
|
||||
import { Device, EngineIOHandler } from '@scrypted/sdk/types'
|
||||
import { Device, EngineIOHandler } from '@scrypted/types'
|
||||
import { ScryptedRuntime } from '../runtime';
|
||||
import { Plugin } from '../db-types';
|
||||
import io, { Socket } from 'engine.io';
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Request, Response, Router } from 'express';
|
||||
import bodyParser from 'body-parser';
|
||||
import { HttpRequest } from '@scrypted/sdk/types';
|
||||
import { HttpRequest } from '@scrypted/types';
|
||||
import WebSocket, { Server as WebSocketServer } from "ws";
|
||||
import { ServerResponse } from 'http';
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedNativeId, SystemDeviceState } from '@scrypted/sdk/types'
|
||||
import { ScryptedNativeId, SystemDeviceState } from '@scrypted/types'
|
||||
import { PluginRemote, PluginRemoteLoadZipOptions } from './plugin-api';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { RpcMessage, RpcPeer } from '../rpc';
|
||||
import { SystemManager, DeviceManager, ScryptedNativeId } from '@scrypted/sdk/types'
|
||||
import { SystemManager, DeviceManager, ScryptedNativeId } from '@scrypted/types'
|
||||
import { attachPluginRemote, PluginReader } from './plugin-remote';
|
||||
import { PluginAPI } from './plugin-api';
|
||||
import { MediaManagerImpl } from './media';
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import AdmZip from 'adm-zip';
|
||||
import { Volume } from 'memfs';
|
||||
import path from 'path';
|
||||
import { ScryptedNativeId, DeviceManager, Logger, Device, DeviceManifest, DeviceState, EndpointManager, SystemDeviceState, ScryptedStatic, SystemManager, MediaManager, ScryptedMimeTypes, ScryptedInterface, ScryptedInterfaceProperty, HttpRequest } from '@scrypted/sdk/types'
|
||||
import { ScryptedNativeId, DeviceManager, Logger, Device, DeviceManifest, DeviceState, EndpointManager, SystemDeviceState, ScryptedStatic, SystemManager, MediaManager, ScryptedMimeTypes, ScryptedInterface, ScryptedInterfaceProperty, HttpRequest } from '@scrypted/types'
|
||||
import { PluginAPI, PluginLogger, PluginRemote, PluginRemoteLoadZipOptions } from './plugin-api';
|
||||
import { SystemManagerImpl } from './system';
|
||||
import { RpcPeer, RPCResultError, PROPERTY_PROXY_ONEWAY_METHODS, PROPERTY_JSON_DISABLE_SERIALIZATION } from '../rpc';
|
||||
|
||||
@@ -2,7 +2,7 @@ import { listenZero } from './listen-zero';
|
||||
import { Server } from 'net';
|
||||
import { once } from 'events';
|
||||
import repl from 'repl';
|
||||
import { ScryptedStatic } from '@scrypted/sdk';
|
||||
import { ScryptedStatic } from '@scrypted/types';
|
||||
|
||||
export async function createREPLServer(scrypted: ScryptedStatic, params: any, plugin: any): Promise<number> {
|
||||
const { deviceManager, systemManager } = scrypted;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { EventListenerOptions, EventDetails, EventListenerRegister, ScryptedDevice, ScryptedInterface, ScryptedInterfaceDescriptors, SystemDeviceState, SystemManager, ScryptedInterfaceProperty, ScryptedDeviceType, Logger } from "@scrypted/sdk/types";
|
||||
import { EventListenerOptions, EventDetails, EventListenerRegister, ScryptedDevice, ScryptedInterface, ScryptedInterfaceDescriptors, SystemDeviceState, SystemManager, ScryptedInterfaceProperty, ScryptedDeviceType, Logger } from "@scrypted/types";
|
||||
import { PluginAPI } from "./plugin-api";
|
||||
import { handleFunctionInvocations, PrimitiveProxyHandler, PROPERTY_PROXY_ONEWAY_METHODS } from '../rpc';
|
||||
import { EventRegistry } from "../event-registry";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Level } from './level';
|
||||
import { PluginHost } from './plugin/plugin-host';
|
||||
import { ScryptedNativeId, Device, EngineIOHandler, HttpRequest, HttpRequestHandler, OauthClient, PushHandler, ScryptedDevice, ScryptedInterface, ScryptedInterfaceProperty } from '@scrypted/sdk/types';
|
||||
import { ScryptedNativeId, Device, EngineIOHandler, HttpRequest, HttpRequestHandler, OauthClient, PushHandler, ScryptedDevice, ScryptedInterface, ScryptedInterfaceProperty } from '@scrypted/types';
|
||||
import { PluginDeviceProxyHandler } from './plugin/plugin-device';
|
||||
import { Plugin, PluginDevice, ScryptedAlert } from './db-types';
|
||||
import { getState, ScryptedStateManager, setState } from './state';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ScryptedInterfaceProperty, ScryptedNativeId } from "@scrypted/sdk/types";
|
||||
import { ScryptedInterfaceProperty, ScryptedNativeId } from "@scrypted/types";
|
||||
import { ScryptedRuntime } from "../runtime";
|
||||
import { Plugin } from '../db-types';
|
||||
import { getState } from "../state";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ScryptedRuntime } from "./runtime";
|
||||
import { ScryptedNativeId, EventDetails, EventListenerOptions, EventListenerRegister, Refresh, ScryptedInterface, ScryptedInterfaceProperty, SystemDeviceState } from "@scrypted/sdk/types";
|
||||
import { ScryptedNativeId, EventDetails, EventListenerOptions, EventListenerRegister, Refresh, ScryptedInterface, ScryptedInterfaceProperty, SystemDeviceState } from "@scrypted/types";
|
||||
import { RefreshSymbol } from "./plugin/plugin-device";
|
||||
import throttle from 'lodash/throttle';
|
||||
import { sleep } from "./sleep";
|
||||
|
||||
Reference in New Issue
Block a user