orgnote-api 0.41.20 → 0.41.22

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.
@@ -20,6 +20,11 @@ export declare enum i18n {
20
20
  EDITOR = "editor",
21
21
  FORCE_SYNC = "force sync",
22
22
  FORCE_SYNC_DESCRIPTION = "this functionality will completely clear the local cache and reload all notes from an external source. Important: Unsaved notes will be deleted.",
23
+ SYNC_PROFILE_CONFIG_DESCRIPTION = "copy this config and save it to ~/.config/orgnote/config.toml in your local CLI environment",
24
+ SYNC_PROFILE_CONFIG_EXPORTED = "local sync config copied",
25
+ SYNC_PROFILE_CONFIG_EXPORTED_DESCRIPTION = "the generated TOML config was copied to clipboard",
26
+ SYNC_PROFILE_CONFIG_DOWNLOADED = "local sync config downloaded",
27
+ SYNC_PROFILE_CONFIG_DOWNLOADED_DESCRIPTION = "the generated TOML config was downloaded as a file",
23
28
  SUBSCRIPTION_KEY = "subscription key",
24
29
  ACTIVATE = "activate",
25
30
  WANT_SUBSCRIPTION = "want to get a key for synchronization?",
@@ -233,6 +238,8 @@ export declare const I18N: {
233
238
  SELECT_FILE_PATH: DefaultCommands.SELECT_FILE_PATH;
234
239
  PICK_SYNC_DIR: DefaultCommands.PICK_SYNC_DIR;
235
240
  SYNC_FILES: DefaultCommands.SYNC_FILES;
241
+ EXPORT_LOCAL_SYNC_CONFIG: DefaultCommands.EXPORT_LOCAL_SYNC_CONFIG;
242
+ DOWNLOAD_LOCAL_SYNC_CONFIG: DefaultCommands.DOWNLOAD_LOCAL_SYNC_CONFIG;
236
243
  RELOAD_FILES: DefaultCommands.RELOAD_FILES;
237
244
  ENCRYPT_NOTE: DefaultCommands.ENCRYPT_NOTE;
238
245
  DECRYPT_NOTE: DefaultCommands.DECRYPT_NOTE;
@@ -322,6 +329,11 @@ export declare const I18N: {
322
329
  EDITOR: i18n.EDITOR;
323
330
  FORCE_SYNC: i18n.FORCE_SYNC;
324
331
  FORCE_SYNC_DESCRIPTION: i18n.FORCE_SYNC_DESCRIPTION;
332
+ SYNC_PROFILE_CONFIG_DESCRIPTION: i18n.SYNC_PROFILE_CONFIG_DESCRIPTION;
333
+ SYNC_PROFILE_CONFIG_EXPORTED: i18n.SYNC_PROFILE_CONFIG_EXPORTED;
334
+ SYNC_PROFILE_CONFIG_EXPORTED_DESCRIPTION: i18n.SYNC_PROFILE_CONFIG_EXPORTED_DESCRIPTION;
335
+ SYNC_PROFILE_CONFIG_DOWNLOADED: i18n.SYNC_PROFILE_CONFIG_DOWNLOADED;
336
+ SYNC_PROFILE_CONFIG_DOWNLOADED_DESCRIPTION: i18n.SYNC_PROFILE_CONFIG_DOWNLOADED_DESCRIPTION;
325
337
  SUBSCRIPTION_KEY: i18n.SUBSCRIPTION_KEY;
326
338
  ACTIVATE: i18n.ACTIVATE;
327
339
  WANT_SUBSCRIPTION: i18n.WANT_SUBSCRIPTION;
@@ -21,6 +21,11 @@ export var i18n;
21
21
  i18n["EDITOR"] = "editor";
22
22
  i18n["FORCE_SYNC"] = "force sync";
23
23
  i18n["FORCE_SYNC_DESCRIPTION"] = "this functionality will completely clear the local cache and reload all notes from an external source. Important: Unsaved notes will be deleted.";
24
+ i18n["SYNC_PROFILE_CONFIG_DESCRIPTION"] = "copy this config and save it to ~/.config/orgnote/config.toml in your local CLI environment";
25
+ i18n["SYNC_PROFILE_CONFIG_EXPORTED"] = "local sync config copied";
26
+ i18n["SYNC_PROFILE_CONFIG_EXPORTED_DESCRIPTION"] = "the generated TOML config was copied to clipboard";
27
+ i18n["SYNC_PROFILE_CONFIG_DOWNLOADED"] = "local sync config downloaded";
28
+ i18n["SYNC_PROFILE_CONFIG_DOWNLOADED_DESCRIPTION"] = "the generated TOML config was downloaded as a file";
24
29
  i18n["SUBSCRIPTION_KEY"] = "subscription key";
25
30
  i18n["ACTIVATE"] = "activate";
26
31
  i18n["WANT_SUBSCRIPTION"] = "want to get a key for synchronization?";
@@ -56,6 +56,8 @@ export declare enum DefaultCommands {
56
56
  SELECT_FILE_PATH = "select file path",
57
57
  PICK_SYNC_DIR = "pick sync dir",
58
58
  SYNC_FILES = "sync files",
59
+ EXPORT_LOCAL_SYNC_CONFIG = "export local sync config",
60
+ DOWNLOAD_LOCAL_SYNC_CONFIG = "download local sync config",
59
61
  RELOAD_FILES = "reload files",
60
62
  ENCRYPT_NOTE = "encrypt note",
61
63
  DECRYPT_NOTE = "decrypt note",
@@ -69,6 +69,8 @@ export var DefaultCommands;
69
69
  DefaultCommands["PICK_SYNC_DIR"] = "pick sync dir";
70
70
  // File management
71
71
  DefaultCommands["SYNC_FILES"] = "sync files";
72
+ DefaultCommands["EXPORT_LOCAL_SYNC_CONFIG"] = "export local sync config";
73
+ DefaultCommands["DOWNLOAD_LOCAL_SYNC_CONFIG"] = "download local sync config";
72
74
  DefaultCommands["RELOAD_FILES"] = "reload files";
73
75
  DefaultCommands["ENCRYPT_NOTE"] = "encrypt note";
74
76
  DefaultCommands["DECRYPT_NOTE"] = "decrypt note";
@@ -22,6 +22,10 @@ export declare const ORG_NOTE_CONFIG_SCHEMA: import("valibot").SchemaWithPipe<re
22
22
  readonly system: import("valibot").ObjectSchema<{
23
23
  readonly language: import("valibot").StringSchema<undefined>;
24
24
  }, undefined>;
25
+ readonly network: import("valibot").ObjectSchema<{
26
+ readonly apiUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
27
+ readonly wsUrl: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>;
28
+ }, undefined>;
25
29
  readonly synchronization: import("valibot").ObjectSchema<{
26
30
  readonly type: import("valibot").UnionSchema<[import("valibot").LiteralSchema<"none", undefined>, import("valibot").LiteralSchema<"api", undefined>], undefined>;
27
31
  }, undefined>;
@@ -24,6 +24,10 @@ export const ORG_NOTE_CONFIG_SCHEMA = pipe(objectWithRest({
24
24
  system: object({
25
25
  language: string(),
26
26
  }),
27
+ network: object({
28
+ apiUrl: optional(string()),
29
+ wsUrl: optional(string()),
30
+ }),
27
31
  synchronization: object({
28
32
  type: union([literal('none'), literal('api')]),
29
33
  }),
@@ -1,6 +1,7 @@
1
1
  import { InferOutput } from 'valibot';
2
2
  export declare const SyncProfileSchema: import("valibot").ObjectSchema<{
3
3
  readonly name: import("valibot").StringSchema<undefined>;
4
+ readonly clientAddress: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
4
5
  readonly remoteAddress: import("valibot").StringSchema<undefined>;
5
6
  readonly token: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
6
7
  readonly rootFolder: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
@@ -12,6 +13,7 @@ export declare const SyncProfileSchema: import("valibot").ObjectSchema<{
12
13
  export declare const SyncProfileConfigSchema: import("valibot").ObjectSchema<{
13
14
  readonly accounts: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
14
15
  readonly name: import("valibot").StringSchema<undefined>;
16
+ readonly clientAddress: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
15
17
  readonly remoteAddress: import("valibot").StringSchema<undefined>;
16
18
  readonly token: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
17
19
  readonly rootFolder: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
@@ -22,6 +24,7 @@ export declare const SyncProfileConfigSchema: import("valibot").ObjectSchema<{
22
24
  }, undefined>, undefined>, readonly []>;
23
25
  readonly root: import("valibot").OptionalSchema<import("valibot").ArraySchema<import("valibot").ObjectSchema<{
24
26
  readonly name: import("valibot").StringSchema<undefined>;
27
+ readonly clientAddress: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
25
28
  readonly remoteAddress: import("valibot").StringSchema<undefined>;
26
29
  readonly token: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
27
30
  readonly rootFolder: import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, "">;
@@ -1,6 +1,7 @@
1
1
  import { array, boolean, number, object, optional, string, } from 'valibot';
2
2
  export const SyncProfileSchema = object({
3
3
  name: string(),
4
+ clientAddress: optional(string(), ''),
4
5
  remoteAddress: string(),
5
6
  token: optional(string(), ''),
6
7
  rootFolder: optional(string(), ''),
@@ -17,6 +17,11 @@ export interface EncryptionInfo {
17
17
  privateKeyProvided?: boolean;
18
18
  passphraseProvided?: boolean;
19
19
  }
20
+ export interface WebSocketInfo {
21
+ url: string;
22
+ isConnected: boolean;
23
+ socketId: string | null;
24
+ }
20
25
  export interface EnvironmentInfo {
21
26
  apiUrl: string;
22
27
  authUrl: string;
@@ -36,6 +41,7 @@ export interface SystemInfo {
36
41
  language: string;
37
42
  screen: ScreenInfo;
38
43
  encryption: EncryptionInfo;
44
+ websocket: WebSocketInfo;
39
45
  environment: EnvironmentInfo;
40
46
  platform: PlatformInfo;
41
47
  device?: DeviceInfo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orgnote-api",
3
- "version": "0.41.20",
3
+ "version": "0.41.22",
4
4
  "description": "Official API for creating extensions for OrgNote app",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -12,6 +12,7 @@ export declare class WebSocketClient {
12
12
  private handlers;
13
13
  private token;
14
14
  socketId: string | null;
15
+ get isConnected(): boolean;
15
16
  constructor(url: string, logger: Logger, webSocketImpl?: unknown);
16
17
  connect(token: string): void;
17
18
  disconnect(): void;
@@ -7,6 +7,9 @@ export class WebSocketClient {
7
7
  handlers = new Map();
8
8
  token = null;
9
9
  socketId = null;
10
+ get isConnected() {
11
+ return this.socket?.readyState === 1;
12
+ }
10
13
  constructor(url, logger, webSocketImpl) {
11
14
  this.url = url;
12
15
  this.logger = logger;