orgnote-api 0.40.13 → 0.40.21
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/constants/i18n-keys.d.ts +4 -0
- package/constants/i18n-keys.js +3 -0
- package/encryption/__tests__/note-encryption.spec.js +25 -44
- package/models/command.d.ts +3 -1
- package/models/completion.d.ts +2 -1
- package/models/encryption.d.ts +5 -5
- package/models/orgnote-config.d.ts +4 -4
- package/package.json +2 -2
package/constants/i18n-keys.d.ts
CHANGED
|
@@ -131,6 +131,8 @@ export declare enum i18n {
|
|
|
131
131
|
SELECT_COMMAND = "select command",
|
|
132
132
|
CONFIRM_CLEAR_LOGS = "confirm clear logs",
|
|
133
133
|
FILE_DELETED_EXTERNALLY = "file was deleted externally",
|
|
134
|
+
USED_SPACE = "used space",
|
|
135
|
+
STORAGE = "storage",
|
|
134
136
|
AUTHENTICATION_STATUS = "authentication status",
|
|
135
137
|
COMING_SOON = "coming soon",
|
|
136
138
|
AUTH_IDENTIFYING = "identifying",
|
|
@@ -351,6 +353,8 @@ export declare const I18N: {
|
|
|
351
353
|
SELECT_COMMAND: i18n.SELECT_COMMAND;
|
|
352
354
|
CONFIRM_CLEAR_LOGS: i18n.CONFIRM_CLEAR_LOGS;
|
|
353
355
|
FILE_DELETED_EXTERNALLY: i18n.FILE_DELETED_EXTERNALLY;
|
|
356
|
+
USED_SPACE: i18n.USED_SPACE;
|
|
357
|
+
STORAGE: i18n.STORAGE;
|
|
354
358
|
AUTHENTICATION_STATUS: i18n.AUTHENTICATION_STATUS;
|
|
355
359
|
COMING_SOON: i18n.COMING_SOON;
|
|
356
360
|
AUTH_IDENTIFYING: i18n.AUTH_IDENTIFYING;
|
package/constants/i18n-keys.js
CHANGED
|
@@ -135,6 +135,9 @@ export var i18n;
|
|
|
135
135
|
i18n["CONFIRM_CLEAR_LOGS"] = "confirm clear logs";
|
|
136
136
|
// Buffer
|
|
137
137
|
i18n["FILE_DELETED_EXTERNALLY"] = "file was deleted externally";
|
|
138
|
+
// Subscription limits
|
|
139
|
+
i18n["USED_SPACE"] = "used space";
|
|
140
|
+
i18n["STORAGE"] = "storage";
|
|
138
141
|
// Auth
|
|
139
142
|
i18n["AUTHENTICATION_STATUS"] = "authentication status";
|
|
140
143
|
i18n["COMING_SOON"] = "coming soon";
|
|
@@ -1,46 +1,24 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
2
|
import { decryptNote, encryptNote } from "../note-encryption.js";
|
|
3
3
|
import { armoredPublicKey, armoredPrivateKey, privateKeyPassphrase, } from "./encryption-keys.js";
|
|
4
4
|
import { EncryptionType } from "../../models/encryption.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
createdAt: faker.date.past().toISOString(),
|
|
20
|
-
updatedAt: faker.date.recent().toISOString(),
|
|
21
|
-
touchedAt: faker.date.recent().toISOString(),
|
|
22
|
-
deletedAt: faker.datatype.boolean()
|
|
23
|
-
? faker.date.recent().toISOString()
|
|
24
|
-
: undefined,
|
|
25
|
-
filePath: faker.helpers.uniqueArray(() => faker.system.filePath(), 2),
|
|
26
|
-
isMy: faker.datatype.boolean(),
|
|
27
|
-
author: faker.datatype.boolean()
|
|
28
|
-
? {
|
|
29
|
-
id: faker.string.uuid(),
|
|
30
|
-
name: faker.person.fullName(),
|
|
31
|
-
email: faker.internet.email(),
|
|
32
|
-
}
|
|
33
|
-
: undefined,
|
|
34
|
-
bookmarked: faker.datatype.boolean(),
|
|
35
|
-
encrypted: faker.datatype.boolean(),
|
|
36
|
-
...overrides,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
5
|
+
const testNote = {
|
|
6
|
+
id: 'test-note-id',
|
|
7
|
+
meta: {
|
|
8
|
+
title: 'Test note',
|
|
9
|
+
published: false,
|
|
10
|
+
},
|
|
11
|
+
createdAt: '2024-01-01T00:00:00.000Z',
|
|
12
|
+
updatedAt: '2024-01-01T00:00:00.000Z',
|
|
13
|
+
touchedAt: '2024-01-01T00:00:00.000Z',
|
|
14
|
+
filePath: ['/test/note.org'],
|
|
15
|
+
isMy: true,
|
|
16
|
+
bookmarked: false,
|
|
17
|
+
encrypted: false,
|
|
18
|
+
};
|
|
39
19
|
test('Should encrypt note via keys', async () => {
|
|
40
20
|
const noteText = '#+title: Test note\n\nBody text';
|
|
41
|
-
const
|
|
42
|
-
note.meta.published = false;
|
|
43
|
-
const [encryptedNote, encryptedNoteText] = await encryptNote(note, {
|
|
21
|
+
const [encryptedNote, encryptedNoteText] = await encryptNote(testNote, {
|
|
44
22
|
content: noteText,
|
|
45
23
|
type: EncryptionType.GpgKeys,
|
|
46
24
|
publicKey: armoredPublicKey,
|
|
@@ -49,13 +27,13 @@ test('Should encrypt note via keys', async () => {
|
|
|
49
27
|
format: 'armored',
|
|
50
28
|
});
|
|
51
29
|
expect(encryptedNoteText.startsWith('-----BEGIN PGP MESSAGE-----')).toBe(true);
|
|
52
|
-
expect(encryptedNote).
|
|
30
|
+
expect(encryptedNote.encrypted).toBe(true);
|
|
31
|
+
expect(encryptedNote.id).toBe(testNote.id);
|
|
32
|
+
expect(encryptedNote.meta.id).toBeUndefined();
|
|
53
33
|
});
|
|
54
34
|
test('Should decrypt note via keys', async () => {
|
|
55
35
|
const noteText = '#+title: Test note\n\nBody text';
|
|
56
|
-
const
|
|
57
|
-
note.meta.published = false;
|
|
58
|
-
const [, encryptedNoteText] = await encryptNote(note, {
|
|
36
|
+
const [, encryptedNoteText] = await encryptNote(testNote, {
|
|
59
37
|
content: noteText,
|
|
60
38
|
type: EncryptionType.GpgKeys,
|
|
61
39
|
publicKey: armoredPublicKey,
|
|
@@ -63,12 +41,15 @@ test('Should decrypt note via keys', async () => {
|
|
|
63
41
|
privateKeyPassphrase,
|
|
64
42
|
format: 'armored',
|
|
65
43
|
});
|
|
66
|
-
const decryptedNote = await decryptNote(
|
|
44
|
+
const [decryptedNote, decryptedText] = await decryptNote({ ...testNote, encrypted: true }, {
|
|
67
45
|
content: encryptedNoteText,
|
|
68
46
|
type: EncryptionType.GpgKeys,
|
|
69
47
|
publicKey: armoredPublicKey,
|
|
70
48
|
privateKey: armoredPrivateKey,
|
|
71
49
|
privateKeyPassphrase,
|
|
72
50
|
});
|
|
73
|
-
expect(decryptedNote).
|
|
51
|
+
expect(decryptedNote.encrypted).toBe(false);
|
|
52
|
+
expect(decryptedNote.id).toBe(testNote.id);
|
|
53
|
+
expect(decryptedNote.meta.title).toBe('Test note');
|
|
54
|
+
expect(decryptedText).toBe(noteText);
|
|
74
55
|
});
|
package/models/command.d.ts
CHANGED
|
@@ -2,8 +2,10 @@ import { MaybeRefOrGetter } from 'vue';
|
|
|
2
2
|
import { COMMAND_GROUPS } from "../constants/index.js";
|
|
3
3
|
import { DefaultCommands } from './default-commands.js';
|
|
4
4
|
import { OrgNoteApi } from "../api.js";
|
|
5
|
+
import { VueComponent } from './vue-component.js';
|
|
5
6
|
export type CommandGroup = (typeof COMMAND_GROUPS)[number] | (string & Record<never, never>);
|
|
6
7
|
export type CommandName = DefaultCommands | (string & {});
|
|
8
|
+
export type CommandIcon = string | VueComponent;
|
|
7
9
|
export interface CommandHandlerParams<T = any> {
|
|
8
10
|
event?: KeyboardEvent;
|
|
9
11
|
data?: T;
|
|
@@ -14,7 +16,7 @@ export interface CommandPreview {
|
|
|
14
16
|
description?: MaybeRefOrGetter<string | undefined>;
|
|
15
17
|
command?: CommandName;
|
|
16
18
|
title?: MaybeRefOrGetter<string | undefined>;
|
|
17
|
-
icon?: MaybeRefOrGetter<
|
|
19
|
+
icon?: MaybeRefOrGetter<CommandIcon | undefined>;
|
|
18
20
|
}
|
|
19
21
|
export interface CommandMeta<T = any> extends Partial<CommandPreview> {
|
|
20
22
|
group?: CommandGroup;
|
package/models/completion.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { MaybeRefOrGetter } from 'vue';
|
|
2
|
+
import type { CommandIcon } from './command.js';
|
|
2
3
|
export interface CompletionCandidate<T = unknown> {
|
|
3
|
-
icon?: MaybeRefOrGetter<
|
|
4
|
+
icon?: MaybeRefOrGetter<CommandIcon | undefined>;
|
|
4
5
|
group?: MaybeRefOrGetter<string | undefined>;
|
|
5
6
|
title?: MaybeRefOrGetter<string | undefined>;
|
|
6
7
|
description?: MaybeRefOrGetter<string | undefined>;
|
package/models/encryption.d.ts
CHANGED
|
@@ -14,11 +14,11 @@ export interface BaseOrgNoteDecryption {
|
|
|
14
14
|
}
|
|
15
15
|
declare const OrgNoteGpgEncryptionSchema: import("valibot").ObjectSchema<{
|
|
16
16
|
readonly type: import("valibot").LiteralSchema<"gpgKeys", undefined>;
|
|
17
|
-
readonly privateKey: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").MetadataAction<string, {
|
|
17
|
+
readonly privateKey: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MetadataAction<string, {
|
|
18
18
|
readonly textarea: true;
|
|
19
19
|
readonly upload: true;
|
|
20
20
|
}>]>;
|
|
21
|
-
readonly publicKey: import("valibot").SchemaWithPipe<[import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").MetadataAction<string, {
|
|
21
|
+
readonly publicKey: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").MetadataAction<string, {
|
|
22
22
|
readonly textarea: true;
|
|
23
23
|
readonly upload: true;
|
|
24
24
|
}>]>;
|
|
@@ -30,13 +30,13 @@ declare const OrgNotePasswordEncryptionSchema: import("valibot").ObjectSchema<{
|
|
|
30
30
|
}, undefined>;
|
|
31
31
|
export declare const OrgNoteEncryptionSchema: import("valibot").IntersectSchema<[import("valibot").ObjectSchema<{
|
|
32
32
|
readonly encryptFilesByDefault: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
33
|
-
}, undefined>, import("valibot").SchemaWithPipe<[import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
33
|
+
}, undefined>, import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
34
34
|
readonly type: import("valibot").LiteralSchema<"gpgKeys", undefined>;
|
|
35
|
-
readonly privateKey: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").MetadataAction<string, {
|
|
35
|
+
readonly privateKey: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MetadataAction<string, {
|
|
36
36
|
readonly textarea: true;
|
|
37
37
|
readonly upload: true;
|
|
38
38
|
}>]>;
|
|
39
|
-
readonly publicKey: import("valibot").SchemaWithPipe<[import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").MetadataAction<string, {
|
|
39
|
+
readonly publicKey: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").MetadataAction<string, {
|
|
40
40
|
readonly textarea: true;
|
|
41
41
|
readonly upload: true;
|
|
42
42
|
}>]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InferOutput } from 'valibot';
|
|
2
|
-
export declare const ORG_NOTE_CONFIG_SCHEMA: import("valibot").SchemaWithPipe<[import("valibot").ObjectWithRestSchema<{
|
|
2
|
+
export declare const ORG_NOTE_CONFIG_SCHEMA: import("valibot").SchemaWithPipe<readonly [import("valibot").ObjectWithRestSchema<{
|
|
3
3
|
readonly editor: import("valibot").ObjectSchema<{
|
|
4
4
|
readonly showSpecialSymbols: import("valibot").BooleanSchema<undefined>;
|
|
5
5
|
readonly showPropertyDrawer: import("valibot").BooleanSchema<undefined>;
|
|
@@ -39,13 +39,13 @@ export declare const ORG_NOTE_CONFIG_SCHEMA: import("valibot").SchemaWithPipe<[i
|
|
|
39
39
|
}, undefined>;
|
|
40
40
|
readonly encryption: import("valibot").IntersectSchema<[import("valibot").ObjectSchema<{
|
|
41
41
|
readonly encryptFilesByDefault: import("valibot").OptionalSchema<import("valibot").BooleanSchema<undefined>, undefined>;
|
|
42
|
-
}, undefined>, import("valibot").SchemaWithPipe<[import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
42
|
+
}, undefined>, import("valibot").SchemaWithPipe<readonly [import("valibot").UnionSchema<[import("valibot").ObjectSchema<{
|
|
43
43
|
readonly type: import("valibot").LiteralSchema<"gpgKeys", undefined>;
|
|
44
|
-
readonly privateKey: import("valibot").SchemaWithPipe<[import("valibot").StringSchema<undefined>, import("valibot").MetadataAction<string, {
|
|
44
|
+
readonly privateKey: import("valibot").SchemaWithPipe<readonly [import("valibot").StringSchema<undefined>, import("valibot").MetadataAction<string, {
|
|
45
45
|
readonly textarea: true;
|
|
46
46
|
readonly upload: true;
|
|
47
47
|
}>]>;
|
|
48
|
-
readonly publicKey: import("valibot").SchemaWithPipe<[import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").MetadataAction<string, {
|
|
48
|
+
readonly publicKey: import("valibot").SchemaWithPipe<readonly [import("valibot").OptionalSchema<import("valibot").StringSchema<undefined>, undefined>, import("valibot").MetadataAction<string, {
|
|
49
49
|
readonly textarea: true;
|
|
50
50
|
readonly upload: true;
|
|
51
51
|
}>]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "orgnote-api",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.21",
|
|
4
4
|
"description": "Official API for creating extensions for OrgNote app",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
},
|
|
22
22
|
"repository": {
|
|
23
23
|
"type": "git",
|
|
24
|
-
"url": "https://github.com/Artawower/orgnote-api"
|
|
24
|
+
"url": "git+https://github.com/Artawower/orgnote-api.git"
|
|
25
25
|
},
|
|
26
26
|
"exports": {
|
|
27
27
|
".": "./index.js",
|