@fett/synology-api 0.0.1 → 0.0.2-beta.1

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/README.md CHANGED
@@ -1,9 +1,13 @@
1
- # Synology Api
1
+ <p align="center">
2
+ <a >
3
+ <img width="100" src="assets/logo.png">
4
+ </a>
5
+ </p>
6
+ <h1 align="center">Javascript Synology Api</h1>
2
7
 
3
8
  ⚠️ The project is under development ...
4
9
 
5
- [中文文档](./README-zh_CN.md)
6
- Synology Api Node.js wrapper, can be used in Browser、CLI or Nodejs to interact with Synology NAS.
10
+ Synology Api Javascript wrapper, can be used in Browser、CLI or Nodejs to interact with Synology NAS.
7
11
  You can use domain or ip address, also supports Synology Quick Connect connect Synology server.
8
12
  All apis from [https://kb.synology.cn](https://kb.synology.cn/zh-cn/search?query=API&services%5B%5D=File_Station)
9
13
 
@@ -13,25 +17,10 @@ All apis from [https://kb.synology.cn](https://kb.synology.cn/zh-cn/search?query
13
17
  npm install @fett/synology-api
14
18
  ```
15
19
 
16
- ## Use In Browser
20
+ ## Use In Browser or Node.js
17
21
 
18
22
  First you need to confirm that you can access across domains,for example in the React Native environment
19
23
 
20
- ```js
21
- import { SynologyApi } from "@fett/synology-api/browser";
22
- // Create a new instance
23
- const api = new SynologyApi({
24
- server: "https://192.168.1.1:5001",
25
- username: "username",
26
- password: "password",
27
- });
28
- // you can now use the api by calling the methods
29
- const info = await api.fs.getInfo();
30
- console.log(info);
31
- ```
32
-
33
- ## Use In Node.js
34
-
35
24
  ```js
36
25
  import SynologyApi from '@fett/synology-api';
37
26
 
@@ -94,4 +83,5 @@ syno fs getInfo --pretty # print file system info
94
83
  ```
95
84
 
96
85
  ## License
97
- [MIT](https://github.com/ChrisSong1994/synology-api/blob/main/LICENSE)
86
+
87
+ [MIT](https://github.com/ChrisSong1994/synology-api/blob/main/LICENSE)
package/lib/cli/apis.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export type MethodOptions = {
2
2
  params?: string;
3
3
  pretty?: boolean;
4
+ list?: boolean;
4
5
  };
5
- export declare const onMethodsCall: (module: string) => (method: string, options: MethodOptions) => Promise<never>;
6
+ export declare const onMethodCall: (module: string) => (method: string, options: MethodOptions) => Promise<void>;
6
7
  export declare const apiCmdRegister: () => void;
package/lib/cli/apis.js CHANGED
@@ -1,47 +1,57 @@
1
1
  import { program } from "commander";
2
+ import chalk from "chalk";
2
3
  import { loadConfig } from "./config.js";
3
4
  import { SynologyApi } from "../core.js";
4
- import { SynologyApiKeys } from "../modules/index.js";
5
- export const onMethodsCall = (module) => async (method, options) => {
5
+ import { SynologyApiModules, SynologyApiMethods } from "../modules/index.js";
6
+ import { printMessages } from "./helper.js";
7
+ export const onMethodCall = (module) => async (method, options) => {
6
8
  const config = await loadConfig();
7
9
  const params = JSON.parse(options.params || "{}");
8
10
  const pretty = options.pretty;
9
- const synologyApi = new SynologyApi(config.connections[config.used]);
10
- if (synologyApi[module]?.[method]) {
11
- const result = await synologyApi[module]?.[method](params);
12
- if (pretty) {
13
- console.log(JSON.stringify(result, null, 2));
14
- }
15
- else {
16
- console.log(JSON.stringify(result));
17
- }
11
+ const connection = config.connections?.[config.used];
12
+ if (!connection) {
13
+ throw new Error("Connection undefined");
14
+ }
15
+ if (!SynologyApiMethods[module]) {
16
+ throw new Error(`Module ${module} not found`);
17
+ }
18
+ // list all module methods
19
+ if (!method && options.list) {
20
+ const methods = SynologyApiMethods[module];
21
+ console.log(chalk.greenBright(`${module} methods list:`));
22
+ return printMessages(Object.keys(methods));
23
+ }
24
+ if (!SynologyApiMethods[module]?.[method]) {
25
+ throw new Error(`Module method ${module} not found`);
26
+ }
27
+ if (typeof SynologyApiMethods[module][method] !== "function") {
28
+ throw new Error(`Module method ${module} is not a function`);
29
+ }
30
+ const synologyApi = new SynologyApi(connection);
31
+ const result = await synologyApi[module]?.[method](params);
32
+ if (pretty) {
33
+ console.log(JSON.stringify(result, null, 2));
34
+ }
35
+ else {
36
+ console.log(JSON.stringify(result));
18
37
  }
19
38
  synologyApi.disconnect();
20
39
  process.exit(0);
21
40
  };
22
41
  // register all modules
23
- const apisCmdRegisterInfo = [
24
- {
25
- cmd: SynologyApiKeys.FileStation,
26
- alias: SynologyApiKeys.fs,
27
- },
28
- {
29
- cmd: SynologyApiKeys.AudioStation,
30
- alias: SynologyApiKeys.as,
31
- },
32
- {
33
- cmd: SynologyApiKeys.VideoStation,
34
- alias: SynologyApiKeys.vs,
35
- },
36
- ];
42
+ const apisCmdRegisterInfo = SynologyApiModules.map((module) => ({
43
+ cmd: module.KEY,
44
+ alias: module.ALIAS_KEY,
45
+ }));
37
46
  export const apiCmdRegister = () => {
38
47
  apisCmdRegisterInfo.forEach((info) => {
39
48
  program
40
- .command(`${info.cmd} [methods]`)
49
+ .command(`${info.cmd} [method]`)
41
50
  .alias(info.alias)
42
- .option("-p,--params <params>", `${info.cmd} methods params`)
51
+ .option("-p,--params <params>", `${info.cmd} method params`)
43
52
  .option("--pretty", "Prettyprint JSON Output")
53
+ .option("-l,--list", `list all ${info.cmd} methods`)
44
54
  .description(`Synology ${info.cmd} method call`)
45
- .action(onMethodsCall(info.cmd));
55
+ .action(onMethodCall(info.cmd));
46
56
  });
47
57
  };
@@ -9,5 +9,4 @@ export type Config = {
9
9
  };
10
10
  export declare const loadConfig: () => Promise<Config>;
11
11
  export declare const updateConfig: (config: Config) => Promise<void>;
12
- export declare const checkConfig: () => Promise<void>;
13
12
  export declare const configCmdRegister: () => void;
package/lib/cli/config.js CHANGED
@@ -23,8 +23,6 @@ export const loadConfig = async () => {
23
23
  export const updateConfig = async (config) => {
24
24
  await fse.writeJSON(CONFIG_FILE_PATH, config);
25
25
  };
26
- // check config
27
- export const checkConfig = async () => { };
28
26
  export const configCmdRegister = () => {
29
27
  const configCmd = program.command("config").description("synology api config management");
30
28
  // list connection config
@@ -51,7 +49,7 @@ export const configCmdRegister = () => {
51
49
  });
52
50
  // add connection
53
51
  configCmd
54
- .command("add [name]")
52
+ .command("add <name>")
55
53
  .description("Add connection config")
56
54
  .requiredOption("-s, --server <server>", "Synology server domain or QuickConnect ID ")
57
55
  .requiredOption("-u, --username <username>", "username")
@@ -62,7 +60,7 @@ export const configCmdRegister = () => {
62
60
  // 实际代码中应保存配置到文件
63
61
  const config = await loadConfig();
64
62
  const newConfig = {
65
- ...config,
63
+ used: config.used || name,
66
64
  connections: {
67
65
  ...config.connections,
68
66
  [name]: {
@@ -76,7 +74,7 @@ export const configCmdRegister = () => {
76
74
  });
77
75
  // use connection
78
76
  configCmd
79
- .command("use [name]")
77
+ .command("use <name>")
80
78
  .description("Change current connection")
81
79
  .action(async (name) => {
82
80
  const config = await loadConfig();
@@ -91,7 +89,7 @@ export const configCmdRegister = () => {
91
89
  });
92
90
  // del connection
93
91
  configCmd
94
- .command("del [name]")
92
+ .command("del <name>")
95
93
  .description("Remove a connection")
96
94
  .action(async (name) => {
97
95
  console.log("Remove a connection", name);
@@ -0,0 +1,5 @@
1
+ /**
2
+ * bind methods to BaseSynologyApi prototype
3
+ * @param source
4
+ */
5
+ export declare function BindMethods<T extends object>(source: T): ClassDecorator;
@@ -1,45 +1,29 @@
1
- // export type Method = (...args: any[]) => Promise<any>;
2
- // type MethodKeys<T> = {
3
- // [K in keyof T]: {
4
- // [M in keyof T[K]]: Method;
5
- // };
6
- // }[keyof T];
7
- // /**
8
- // * 将源对象的方法绑定到目标类的原型上,并确保方法的 this 指向类实例
9
- // * @param source 包含要绑定方法的对象
10
- // */
11
- // export function BindMethods<T extends object>(source: T): ClassDecorator {
12
- // return function (target: { prototype: any }) {
13
- // // 获取源对象的所有方法键
14
- // const methodKeys = Object.getOwnPropertyNames(source).filter(
15
- // (key): key is MethodKeys<T> => typeof source[key] === "function"
16
- // );
17
- // // 为每个方法创建绑定版本并定义到原型上
18
- // methodKeys.forEach((methodName) => {
19
- // const originalMethod = source[methodName] as Function;
20
- // // 创建绑定方法的描述符
21
- // const descriptor: PropertyDescriptor = {
22
- // configurable: true,
23
- // enumerable: false, // 使方法不可枚举
24
- // // 使用 getter 确保每个实例都有自己的绑定函数
25
- // get() {
26
- // // 跳过原型访问,直接返回原始方法
27
- // if (this === target.prototype || this === undefined) {
28
- // return originalMethod;
29
- // }
30
- // // 为实例创建绑定方法并缓存
31
- // const boundMethod = originalMethod.bind(this);
32
- // Object.defineProperty(this, methodName, {
33
- // value: boundMethod,
34
- // configurable: true,
35
- // writable: true,
36
- // enumerable: false,
37
- // });
38
- // return boundMethod;
39
- // },
40
- // };
41
- // // 将绑定方法定义到类原型上
42
- // Object.defineProperty(target.prototype, methodName, descriptor);
43
- // });
44
- // };
45
- // }
1
+ // bind methods to context
2
+ function methodsBundler(cxt, methods) {
3
+ const output = {};
4
+ for (const key in methods) {
5
+ output[key] = methods[key].bind(cxt);
6
+ }
7
+ return output;
8
+ }
9
+ /**
10
+ * bind methods to BaseSynologyApi prototype
11
+ * @param source
12
+ */
13
+ export function BindMethods(source) {
14
+ return function (target) {
15
+ const modulesKeys = Object.getOwnPropertyNames(source);
16
+ modulesKeys.forEach((moduleName) => {
17
+ const methods = source[moduleName];
18
+ const descriptor = {
19
+ configurable: false,
20
+ enumerable: true,
21
+ get() {
22
+ return methodsBundler(this, methods);
23
+ },
24
+ set() { },
25
+ };
26
+ Object.defineProperty(target.prototype, moduleName, descriptor);
27
+ });
28
+ };
29
+ }
@@ -0,0 +1 @@
1
+ export * from "./bindMethods.js";
@@ -0,0 +1 @@
1
+ export * from "./bindMethods.js";
package/lib/helpers.js CHANGED
@@ -1,10 +1,20 @@
1
1
  import ky from "ky";
2
2
  import { GLOBAL_QUICK_CONNECT_URL, QUICK_CONNECT_PINGPANG_API } from "./constants.js";
3
3
  const getServersFromServerInfo = async (serverInfo) => {
4
+ // first lan ip
5
+ // lan ip
6
+ if (serverInfo?.server?.interface?.[0]) {
7
+ const server = `http://${serverInfo.server.interface?.[0].ip}:${serverInfo.service.port}`;
8
+ const res = await pingpang(server);
9
+ if (res) {
10
+ return server;
11
+ }
12
+ }
4
13
  // WAN IP
5
14
  if (serverInfo?.server?.external?.ip) {
6
15
  const server = `http://${serverInfo.server.external.ip}:${serverInfo.service.port}`;
7
- if (await pingpang(server)) {
16
+ const res = await pingpang(server);
17
+ if (res) {
8
18
  return server;
9
19
  }
10
20
  }
@@ -16,13 +26,6 @@ const getServersFromServerInfo = async (serverInfo) => {
16
26
  return server;
17
27
  }
18
28
  }
19
- // lan ip
20
- if (serverInfo?.server?.interface?.[0]) {
21
- const server = `http://${serverInfo.server.interface?.[0].ip}:${serverInfo.service.port}`;
22
- if (await pingpang(server)) {
23
- return server;
24
- }
25
- }
26
29
  };
27
30
  export const getServerInfo = async (quickConnectId) => {
28
31
  const params = {
@@ -18,6 +18,6 @@ export declare const METHODS: {
18
18
  searchLyrics: typeof searchLyrics;
19
19
  getInfo: typeof getInfo;
20
20
  };
21
- export declare const SPELLING_KEY = "AudioStation";
22
- export declare const SIMPLIFY_KEY = "as";
21
+ export declare const KEY = "AudioStation";
22
+ export declare const ALIAS_KEY = "as";
23
23
  export type TMethods = typeof METHODS;
@@ -19,5 +19,5 @@ export const METHODS = {
19
19
  getInfo,
20
20
  };
21
21
  // name space
22
- export const SPELLING_KEY = "AudioStation";
23
- export const SIMPLIFY_KEY = "as";
22
+ export const KEY = "AudioStation";
23
+ export const ALIAS_KEY = "as";
@@ -2,6 +2,6 @@ import { getAuthKeyGrant } from "./AuthKey.js";
2
2
  export declare const METHODS: {
3
3
  getAuthKeyGrant: typeof getAuthKeyGrant;
4
4
  };
5
- export declare const SPELLING_KEY = "Auth";
6
- export declare const SIMPLIFY_KEY = "au";
5
+ export declare const KEY = "Auth";
6
+ export declare const ALIAS_KEY = "au";
7
7
  export type TMethods = typeof METHODS;
@@ -4,5 +4,5 @@ export const METHODS = {
4
4
  getAuthKeyGrant,
5
5
  };
6
6
  // name space
7
- export const SPELLING_KEY = "Auth";
8
- export const SIMPLIFY_KEY = "au";
7
+ export const KEY = "Auth";
8
+ export const ALIAS_KEY = "au";
@@ -8,6 +8,6 @@ export declare const METHODS: {
8
8
  getFileList: typeof getFileList;
9
9
  getFileListShare: typeof getFileListShare;
10
10
  };
11
- export declare const SPELLING_KEY = "FileStation";
12
- export declare const SIMPLIFY_KEY = "fs";
11
+ export declare const KEY = "FileStation";
12
+ export declare const ALIAS_KEY = "fs";
13
13
  export type TMethods = typeof METHODS;
@@ -10,5 +10,5 @@ export const METHODS = {
10
10
  getFileListShare,
11
11
  };
12
12
  // name space
13
- export const SPELLING_KEY = "FileStation";
14
- export const SIMPLIFY_KEY = "fs";
13
+ export const KEY = "FileStation";
14
+ export const ALIAS_KEY = "fs";
@@ -10,6 +10,6 @@ export declare const METHODS: {
10
10
  getMoiveInfo: typeof getMoiveInfo;
11
11
  getStreamId: typeof getStreamId;
12
12
  };
13
- export declare const SPELLING_KEY = "VideoStation";
14
- export declare const SIMPLIFY_KEY = "vs";
13
+ export declare const KEY = "VideoStation";
14
+ export declare const ALIAS_KEY = "vs";
15
15
  export type TMethods = typeof METHODS;
@@ -12,5 +12,5 @@ export const METHODS = {
12
12
  getStreamId,
13
13
  };
14
14
  // name space
15
- export const SPELLING_KEY = "VideoStation";
16
- export const SIMPLIFY_KEY = "vs";
15
+ export const KEY = "VideoStation";
16
+ export const ALIAS_KEY = "vs";
@@ -2,6 +2,7 @@ import * as AudioStation from "./AudioStation/index.js";
2
2
  import * as FileStation from "./FileStation/index.js";
3
3
  import * as VideoStation from "./VideoStation/index.js";
4
4
  import * as Auth from "./Auth/index.js";
5
+ export declare const SynologyApiModules: (typeof AudioStation | typeof FileStation | typeof VideoStation | typeof Auth)[];
5
6
  export declare const SynologyApiKeys: {
6
7
  FileStation: string;
7
8
  fs: string;
@@ -12,15 +13,15 @@ export declare const SynologyApiKeys: {
12
13
  Auth: string;
13
14
  au: string;
14
15
  };
15
- export type SynologyApiMethods = FileStation.TMethods | AudioStation.TMethods | VideoStation.TMethods | Auth.TMethods;
16
+ export declare const SynologyApiMethods: {};
16
17
  export declare class BaseSynologyApi {
17
- [AudioStation.SPELLING_KEY]: AudioStation.TMethods;
18
- [AudioStation.SIMPLIFY_KEY]: AudioStation.TMethods;
19
- [FileStation.SPELLING_KEY]: FileStation.TMethods;
20
- [FileStation.SIMPLIFY_KEY]: FileStation.TMethods;
21
- [VideoStation.SPELLING_KEY]: VideoStation.TMethods;
22
- [VideoStation.SIMPLIFY_KEY]: VideoStation.TMethods;
23
- [Auth.SPELLING_KEY]: Auth.TMethods;
24
- [Auth.SIMPLIFY_KEY]: Auth.TMethods;
18
+ [AudioStation.KEY]: AudioStation.TMethods;
19
+ [AudioStation.ALIAS_KEY]: AudioStation.TMethods;
20
+ [FileStation.KEY]: FileStation.TMethods;
21
+ [FileStation.ALIAS_KEY]: FileStation.TMethods;
22
+ [VideoStation.KEY]: VideoStation.TMethods;
23
+ [VideoStation.ALIAS_KEY]: VideoStation.TMethods;
24
+ [Auth.KEY]: Auth.TMethods;
25
+ [Auth.ALIAS_KEY]: Auth.TMethods;
25
26
  constructor();
26
27
  }
@@ -1,74 +1,75 @@
1
+ var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
2
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
3
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
4
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
5
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
6
+ var _, done = false;
7
+ for (var i = decorators.length - 1; i >= 0; i--) {
8
+ var context = {};
9
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
10
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
11
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
12
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
13
+ if (kind === "accessor") {
14
+ if (result === void 0) continue;
15
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
16
+ if (_ = accept(result.get)) descriptor.get = _;
17
+ if (_ = accept(result.set)) descriptor.set = _;
18
+ if (_ = accept(result.init)) initializers.unshift(_);
19
+ }
20
+ else if (_ = accept(result)) {
21
+ if (kind === "field") initializers.unshift(_);
22
+ else descriptor[key] = _;
23
+ }
24
+ }
25
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
26
+ done = true;
27
+ };
28
+ var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
29
+ var useValue = arguments.length > 2;
30
+ for (var i = 0; i < initializers.length; i++) {
31
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
32
+ }
33
+ return useValue ? value : void 0;
34
+ };
1
35
  import * as AudioStation from "./AudioStation/index.js";
2
36
  import * as FileStation from "./FileStation/index.js";
3
37
  import * as VideoStation from "./VideoStation/index.js";
4
38
  import * as Auth from "./Auth/index.js";
39
+ import { BindMethods } from "../decorators/index.js";
40
+ export const SynologyApiModules = [FileStation, AudioStation, VideoStation, Auth];
5
41
  export const SynologyApiKeys = {
6
- FileStation: FileStation.SPELLING_KEY,
7
- fs: FileStation.SIMPLIFY_KEY,
8
- AudioStation: AudioStation.SPELLING_KEY,
9
- as: AudioStation.SIMPLIFY_KEY,
10
- VideoStation: VideoStation.SPELLING_KEY,
11
- vs: VideoStation.SIMPLIFY_KEY,
12
- Auth: Auth.SPELLING_KEY,
13
- au: Auth.SIMPLIFY_KEY,
42
+ FileStation: FileStation.KEY,
43
+ fs: FileStation.ALIAS_KEY,
44
+ AudioStation: AudioStation.KEY,
45
+ as: AudioStation.ALIAS_KEY,
46
+ VideoStation: VideoStation.KEY,
47
+ vs: VideoStation.ALIAS_KEY,
48
+ Auth: Auth.KEY,
49
+ au: Auth.ALIAS_KEY,
14
50
  };
15
- // export type BaseSynologyApiKeyMethods = FileStation.IKeyMethods
16
- export class BaseSynologyApi {
17
- static { AudioStation.SPELLING_KEY, AudioStation.SIMPLIFY_KEY, FileStation.SPELLING_KEY, FileStation.SIMPLIFY_KEY, VideoStation.SPELLING_KEY, VideoStation.SIMPLIFY_KEY, Auth.SPELLING_KEY, Auth.SIMPLIFY_KEY; }
18
- constructor() { }
19
- }
20
- // bind methods to BaseSynologyApi instance
21
- function methodsBundler(instance, methods) {
22
- const output = {};
23
- for (const key in methods) {
24
- output[key] = methods[key].bind(instance);
25
- }
26
- return output;
27
- }
28
- // proxy methods namespace to BaseSynologyApi instance
29
- Object.defineProperties(BaseSynologyApi.prototype, {
30
- // FileStation
31
- [SynologyApiKeys.FileStation]: {
32
- get() {
33
- return methodsBundler(this, FileStation.METHODS);
34
- },
35
- },
36
- [SynologyApiKeys.fs]: {
37
- get() {
38
- return methodsBundler(this, FileStation.METHODS);
39
- },
40
- },
41
- // AudioStation
42
- [SynologyApiKeys.AudioStation]: {
43
- get() {
44
- return methodsBundler(this, AudioStation.METHODS);
45
- },
46
- },
47
- [SynologyApiKeys.as]: {
48
- get() {
49
- return methodsBundler(this, AudioStation.METHODS);
50
- },
51
- },
52
- // VideoStation
53
- [SynologyApiKeys.VideoStation]: {
54
- get() {
55
- return methodsBundler(this, VideoStation.METHODS);
56
- },
57
- },
58
- [SynologyApiKeys.vs]: {
59
- get() {
60
- return methodsBundler(this, VideoStation.METHODS);
61
- },
62
- },
63
- // Auth
64
- [SynologyApiKeys.Auth]: {
65
- get() {
66
- return methodsBundler(this, Auth.METHODS);
67
- },
68
- },
69
- [SynologyApiKeys.au]: {
70
- get() {
71
- return methodsBundler(this, Auth.METHODS);
72
- },
73
- },
74
- });
51
+ export const SynologyApiMethods = SynologyApiModules.reduce((acc, module) => {
52
+ acc[module.KEY] = module.METHODS;
53
+ acc[module.ALIAS_KEY] = module.METHODS;
54
+ return acc;
55
+ }, {});
56
+ let BaseSynologyApi = (() => {
57
+ let _classDecorators = [BindMethods(SynologyApiMethods)];
58
+ let _classDescriptor;
59
+ let _classExtraInitializers = [];
60
+ let _classThis;
61
+ var BaseSynologyApi = class {
62
+ static { _classThis = this; }
63
+ static { AudioStation.KEY, AudioStation.ALIAS_KEY, FileStation.KEY, FileStation.ALIAS_KEY, VideoStation.KEY, VideoStation.ALIAS_KEY, Auth.KEY, Auth.ALIAS_KEY; }
64
+ static {
65
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
66
+ __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
67
+ BaseSynologyApi = _classThis = _classDescriptor.value;
68
+ if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
69
+ __runInitializers(_classThis, _classExtraInitializers);
70
+ }
71
+ constructor() { }
72
+ };
73
+ return BaseSynologyApi = _classThis;
74
+ })();
75
+ export { BaseSynologyApi };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fett/synology-api",
3
- "version": "0.0.1",
3
+ "version": "0.0.2-beta.1",
4
4
  "description": "synology api for nodejs",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -28,11 +28,14 @@
28
28
  "nodejs",
29
29
  "browser",
30
30
  "typescript",
31
- "esmodule"
31
+ "esmodule",
32
+ "cli",
33
+ "vitest"
32
34
  ],
33
35
  "scripts": {
34
- "dev:esm": "tsc --sourceMap --watch && tsc-alias",
36
+ "dev": "npm run clean && concurrently --kill-others \"tsc --sourceMap -w\" \"tsc-alias -w\"",
35
37
  "build": "npm run clean && tsc && tsc-alias",
38
+ "build:dev": "cross-env NODE_ENV=development npm run build",
36
39
  "docs:dev": "rspress dev",
37
40
  "docs:build": "cross-env BASE_PATH=/synology-api/ rspress build",
38
41
  "docs:preview": "rspress preview",
@@ -48,6 +51,7 @@
48
51
  },
49
52
  "devDependencies": {
50
53
  "@eslint/js": "^9.26.0",
54
+ "concurrently": "^9.2.0",
51
55
  "cross-env": "^7.0.3",
52
56
  "eslint": "9.25.1",
53
57
  "execa": "^9.6.0",