@lapis-notes/api 0.1.0 → 0.1.2
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/CHANGELOG.md +18 -0
- package/README.md +5 -0
- package/dist/app-database-host.d.ts +1 -0
- package/dist/app-database-host.js +1 -0
- package/dist/browser-sync-security.d.ts +45 -0
- package/dist/browser-sync-security.js +189 -0
- package/dist/build-tools/vite.d.ts +15 -0
- package/dist/build-tools/vite.js +36 -0
- package/dist/cache.svelte.d.ts +1 -1
- package/dist/cache.svelte.js +4 -1
- package/dist/components/editor/editor.css +54 -2
- package/dist/components/editor/extensions/lint/lapis-lint-tooltip.svelte +18 -5
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.d.ts +0 -2
- package/dist/components/editor/extensions/lint/lint-tooltip-actions.js +0 -14
- package/dist/components/editor/language-service/index.js +23 -2
- package/dist/components/icon/icon-list.svelte.d.ts +1 -1
- package/dist/components/select/select.svelte.d.ts +1 -1
- package/dist/context.svelte.d.ts +11 -1
- package/dist/context.svelte.js +38 -1
- package/dist/docs-api.d.ts +2 -0
- package/dist/docs-api.js +1 -0
- package/dist/generated/plugin-host-modules.schema.generated.d.ts +443 -13
- package/dist/generated/plugin-host-modules.schema.generated.js +970 -306
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/language-service/manager.d.ts +5 -0
- package/dist/language-service/manager.js +58 -14
- package/dist/lapis-extension.d.ts +1 -1
- package/dist/lapis-extension.js +12 -0
- package/dist/nostr-signer.d.ts +68 -0
- package/dist/nostr-signer.js +49 -0
- package/dist/plugin-asset-server.d.ts +1 -0
- package/dist/plugin-asset-server.js +3 -0
- package/dist/plugin-capability-facade.d.ts +1 -1
- package/dist/plugin-capability-facade.js +6 -0
- package/dist/plugin-distribution/catalog-media.d.ts +4 -0
- package/dist/plugin-distribution/catalog-media.js +40 -0
- package/dist/plugin-distribution/download-stats.d.ts +4 -0
- package/dist/plugin-distribution/download-stats.js +19 -0
- package/dist/plugin-distribution/index.d.ts +4 -0
- package/dist/plugin-distribution/index.js +4 -0
- package/dist/plugin-distribution/installer.d.ts +3 -0
- package/dist/plugin-distribution/installer.js +9 -2
- package/dist/plugin-distribution/manager.d.ts +71 -5
- package/dist/plugin-distribution/manager.js +376 -37
- package/dist/plugin-distribution/nostr-registry-adapter.d.ts +29 -0
- package/dist/plugin-distribution/nostr-registry-adapter.js +152 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.d.ts +43 -0
- package/dist/plugin-distribution/plugin-bundle-verifier.js +64 -1
- package/dist/plugin-distribution/plugin-bundle.d.ts +14 -0
- package/dist/plugin-distribution/plugin-bundle.js +46 -7
- package/dist/plugin-distribution/plugin-markdown.d.ts +6 -0
- package/dist/plugin-distribution/plugin-markdown.js +94 -0
- package/dist/plugin-distribution/registry-client.d.ts +6 -1
- package/dist/plugin-distribution/registry-client.js +32 -10
- package/dist/plugin-distribution/registry-source-state.d.ts +15 -0
- package/dist/plugin-distribution/registry-source-state.js +42 -0
- package/dist/plugin-distribution/schemas.d.ts +2511 -2824
- package/dist/plugin-distribution/schemas.js +111 -42
- package/dist/plugin-distribution/types.d.ts +116 -5
- package/dist/plugin-distribution-host.d.ts +4 -0
- package/dist/plugin-distribution-host.js +2 -0
- package/dist/plugin-install-progress.js +1 -1
- package/dist/plugin-manager.d.ts +3 -0
- package/dist/plugin-manager.js +21 -13
- package/dist/plugin-settings.d.ts +21 -0
- package/dist/plugin-settings.js +41 -0
- package/dist/plugin.d.ts +13 -0
- package/dist/plugin.js +56 -0
- package/dist/registry-schema/catalog-v1.d.ts +4143 -0
- package/dist/registry-schema/catalog-v1.js +172 -0
- package/dist/registry-schema/catalog-v2.d.ts +5275 -0
- package/dist/registry-schema/catalog-v2.js +137 -0
- package/dist/registry-schema/index.d.ts +1 -0
- package/dist/registry-schema/index.js +1 -0
- package/dist/registry-schema/release-notes.d.ts +5 -0
- package/dist/registry-schema/release-notes.js +21 -0
- package/dist/server-host.d.ts +28 -0
- package/dist/server-host.js +17 -0
- package/dist/storage/app-database.d.ts +37 -2
- package/dist/storage/app-database.js +41 -1
- package/dist/storage/browser-coordinated-app-database.d.ts +3 -1
- package/dist/storage/browser-coordinated-app-database.js +8 -0
- package/dist/storage/browser.d.ts +4 -1
- package/dist/storage/browser.js +84 -0
- package/dist/storage/desktop-native.d.ts +4 -2
- package/dist/storage/desktop-native.js +90 -1
- package/dist/storage/fs.d.ts +17 -0
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +1 -0
- package/dist/storage/memory-vault-adapter.d.ts +3 -1
- package/dist/storage/memory-vault-adapter.js +60 -0
- package/dist/storage/remote-app-database.d.ts +19 -0
- package/dist/storage/remote-app-database.js +130 -0
- package/dist/storage/task-projection.d.ts +2 -1
- package/dist/storage/task-projection.js +7 -2
- package/dist/storage/turso-app-database.d.ts +3 -1
- package/dist/storage/turso-app-database.js +45 -0
- package/dist/storage/vault-session.js +11 -0
- package/dist/storage/vault-state.d.ts +1 -1
- package/dist/storage/vault.svelte.d.ts +3 -1
- package/dist/storage/vault.svelte.js +76 -3
- package/dist/sync-host-security.d.ts +285 -0
- package/dist/sync-host-security.js +2237 -0
- package/dist/sync-host.d.ts +179 -0
- package/dist/sync-host.js +769 -0
- package/dist/workspace.svelte.d.ts +1 -1
- package/dist/workspace.svelte.js +1 -1
- package/package.json +48 -10
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import type { AppDatabase } from "./storage/app-database";
|
|
2
|
+
import { TFile } from "./storage/fs";
|
|
3
|
+
import type { VaultReadHandle } from "./storage/fs";
|
|
4
|
+
import type { Vault } from "./storage/vault.svelte";
|
|
5
|
+
import type { HostedPluginCapability } from "./plugin-capability-facade";
|
|
6
|
+
import { type PluginNetworkCapability, type SyncCryptoCapability, type SyncCryptoEnrollmentRequest, type SyncCryptoStatus, type SyncIdentityCapability, type SyncHostSecurityOptions, type SyncMembershipCapability, type SyncPairingCapability, type SyncRecoveryCapability, type SyncWrappingKeyDescriptor } from "./sync-host-security";
|
|
7
|
+
export type HostFileIdentityState = "present" | "tombstoned";
|
|
8
|
+
export type HostFileChangeKind = "create" | "modify" | "rename" | "delete";
|
|
9
|
+
export interface HostFileIdentity {
|
|
10
|
+
fileId: string;
|
|
11
|
+
currentPath: string;
|
|
12
|
+
state: HostFileIdentityState;
|
|
13
|
+
createdAt: number;
|
|
14
|
+
updatedAt: number;
|
|
15
|
+
tombstonedAt?: number;
|
|
16
|
+
lastObservedMtime?: number;
|
|
17
|
+
lastObservedSize?: number;
|
|
18
|
+
contentGeneration: number;
|
|
19
|
+
lastChangeSequence: number;
|
|
20
|
+
contentFingerprint?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface HostFilePathAlias {
|
|
23
|
+
fileId: string;
|
|
24
|
+
path: string;
|
|
25
|
+
firstSeenAt: number;
|
|
26
|
+
lastSeenAt?: number;
|
|
27
|
+
reason: "create" | "rename" | "move" | "scan-reconciliation" | "restore";
|
|
28
|
+
}
|
|
29
|
+
export interface HostChangeCursor {
|
|
30
|
+
databaseGenerationId: string;
|
|
31
|
+
sequence: number;
|
|
32
|
+
}
|
|
33
|
+
export interface HostFileChange {
|
|
34
|
+
file: HostFileIdentity;
|
|
35
|
+
kind: HostFileChangeKind;
|
|
36
|
+
previousPath?: string;
|
|
37
|
+
selfOriginated: boolean;
|
|
38
|
+
}
|
|
39
|
+
export interface HostChangedFileBatch {
|
|
40
|
+
status: "ok" | "reset-required";
|
|
41
|
+
databaseGenerationId: string;
|
|
42
|
+
changes: HostFileChange[];
|
|
43
|
+
nextCursor: HostChangeCursor;
|
|
44
|
+
hasMore: boolean;
|
|
45
|
+
}
|
|
46
|
+
export interface ExternalFileIdentityBinding {
|
|
47
|
+
namespace: string;
|
|
48
|
+
externalFileId: string;
|
|
49
|
+
localFileId: string;
|
|
50
|
+
boundAt: number;
|
|
51
|
+
updatedAt: number;
|
|
52
|
+
}
|
|
53
|
+
export interface OperationOrigin {
|
|
54
|
+
readonly token: string;
|
|
55
|
+
}
|
|
56
|
+
export interface GeneratedStateRecord<T = unknown> {
|
|
57
|
+
key: string;
|
|
58
|
+
value: T;
|
|
59
|
+
version: number;
|
|
60
|
+
updatedAt: number;
|
|
61
|
+
}
|
|
62
|
+
export interface GeneratedStateMutation {
|
|
63
|
+
type: "set" | "delete";
|
|
64
|
+
key: string;
|
|
65
|
+
value?: unknown;
|
|
66
|
+
}
|
|
67
|
+
export interface GeneratedStateTransaction {
|
|
68
|
+
expectedRevision?: number;
|
|
69
|
+
expectedSchemaVersion?: number;
|
|
70
|
+
schemaVersion?: number;
|
|
71
|
+
mutations: GeneratedStateMutation[];
|
|
72
|
+
}
|
|
73
|
+
export interface GeneratedStateTransactionResult {
|
|
74
|
+
applied: boolean;
|
|
75
|
+
revision: number;
|
|
76
|
+
schemaVersion: number;
|
|
77
|
+
}
|
|
78
|
+
export interface GeneratedStatePage<T = unknown> {
|
|
79
|
+
records: GeneratedStateRecord<T>[];
|
|
80
|
+
nextCursor?: string;
|
|
81
|
+
}
|
|
82
|
+
export interface PluginGeneratedState {
|
|
83
|
+
get<T = unknown>(key: string): Promise<GeneratedStateRecord<T> | null>;
|
|
84
|
+
scan<T = unknown>(options?: {
|
|
85
|
+
prefix?: string;
|
|
86
|
+
after?: string;
|
|
87
|
+
limit?: number;
|
|
88
|
+
}): Promise<GeneratedStatePage<T>>;
|
|
89
|
+
getRevision(): Promise<number>;
|
|
90
|
+
getSchemaVersion(): Promise<number>;
|
|
91
|
+
transact(transaction: GeneratedStateTransaction): Promise<GeneratedStateTransactionResult>;
|
|
92
|
+
clear(): Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
export interface SyncHostCapabilities {
|
|
95
|
+
readonly files: {
|
|
96
|
+
getIdentity(path: string): Promise<HostFileIdentity | null>;
|
|
97
|
+
resolveIdentity(fileId: string): Promise<HostFileIdentity | null>;
|
|
98
|
+
listChangedSince(cursor?: HostChangeCursor, options?: {
|
|
99
|
+
limit?: number;
|
|
100
|
+
}): Promise<HostChangedFileBatch>;
|
|
101
|
+
getExternalBinding(externalFileId: string): Promise<ExternalFileIdentityBinding | null>;
|
|
102
|
+
bindExternalIdentity(localFileId: string, externalFileId: string): Promise<ExternalFileIdentityBinding>;
|
|
103
|
+
};
|
|
104
|
+
readonly origins: {
|
|
105
|
+
create(): Promise<OperationOrigin>;
|
|
106
|
+
};
|
|
107
|
+
readonly vault: {
|
|
108
|
+
flushOpenEditor(path?: string): Promise<{
|
|
109
|
+
flushed: boolean;
|
|
110
|
+
path?: string;
|
|
111
|
+
}>;
|
|
112
|
+
openRead(path: string): Promise<VaultReadHandle & {
|
|
113
|
+
fileId: string;
|
|
114
|
+
contentGeneration: number;
|
|
115
|
+
}>;
|
|
116
|
+
atomicWrite(path: string, source: ReadableStream<Uint8Array>, options?: {
|
|
117
|
+
origin?: OperationOrigin;
|
|
118
|
+
expectedFileId?: string;
|
|
119
|
+
expectedContentGeneration?: number;
|
|
120
|
+
signal?: AbortSignal;
|
|
121
|
+
}): Promise<HostFileIdentity>;
|
|
122
|
+
remove(path: string, options?: {
|
|
123
|
+
origin?: OperationOrigin;
|
|
124
|
+
expectedFileId?: string;
|
|
125
|
+
expectedContentGeneration?: number;
|
|
126
|
+
}): Promise<HostFileIdentity>;
|
|
127
|
+
};
|
|
128
|
+
readonly network: PluginNetworkCapability;
|
|
129
|
+
readonly crypto: SyncCryptoCapability;
|
|
130
|
+
readonly syncIdentity: SyncIdentityCapability;
|
|
131
|
+
readonly pairing: SyncPairingCapability;
|
|
132
|
+
readonly membership: SyncMembershipCapability;
|
|
133
|
+
readonly recovery: SyncRecoveryCapability;
|
|
134
|
+
readonly generatedState: PluginGeneratedState;
|
|
135
|
+
}
|
|
136
|
+
export interface SyncHostServiceOptions {
|
|
137
|
+
flushOpenEditor?: (path?: string) => Promise<{
|
|
138
|
+
flushed: boolean;
|
|
139
|
+
path?: string;
|
|
140
|
+
}>;
|
|
141
|
+
security?: SyncHostSecurityOptions;
|
|
142
|
+
/** Host UI/native adapter callback. It never becomes part of a plugin facade. */
|
|
143
|
+
requestCryptoUnlock?: (pluginId: string, status: SyncCryptoStatus, enrollment?: SyncCryptoEnrollmentRequest) => Promise<void>;
|
|
144
|
+
/** Host-owned passphrase or equivalent recovery-bundle interaction. */
|
|
145
|
+
requestRecoveryPassphrase?: (pluginId: string, mode: "export" | "import") => Promise<string | null>;
|
|
146
|
+
/** Host consent callback for an exact plugin network origin. */
|
|
147
|
+
requestNetworkOriginGrant?: (request: {
|
|
148
|
+
pluginId: string;
|
|
149
|
+
origin: string;
|
|
150
|
+
allowPrivateNetwork: boolean;
|
|
151
|
+
}) => Promise<boolean>;
|
|
152
|
+
}
|
|
153
|
+
export declare class SyncHostService {
|
|
154
|
+
#private;
|
|
155
|
+
readonly database: AppDatabase;
|
|
156
|
+
readonly vault: Vault;
|
|
157
|
+
readonly clock: () => number;
|
|
158
|
+
readonly options: SyncHostServiceOptions;
|
|
159
|
+
constructor(database: AppDatabase, vault: Vault, clock?: () => number, options?: SyncHostServiceOptions);
|
|
160
|
+
ready(): Promise<void>;
|
|
161
|
+
forPlugin(pluginId: string, grantedCapabilities?: readonly HostedPluginCapability[]): SyncHostCapabilities;
|
|
162
|
+
revokePlugin(pluginId: string): void;
|
|
163
|
+
/** Host-controlled enrollment; this operation is intentionally absent from plugin facades. */
|
|
164
|
+
enrollPluginCrypto(pluginId: string, passphrase: string, request?: SyncCryptoEnrollmentRequest): Promise<SyncCryptoStatus>;
|
|
165
|
+
/** Host-controlled unlock; plugins can only observe locked state. */
|
|
166
|
+
unlockPluginCrypto(pluginId: string, passphrase: string): Promise<SyncCryptoStatus>;
|
|
167
|
+
/** Host-controlled passkey or OS-credential enrollment. */
|
|
168
|
+
enrollPluginCryptoWithWrappingKey(pluginId: string, wrappingKey: Uint8Array, descriptor: Extract<SyncWrappingKeyDescriptor, {
|
|
169
|
+
name: "external";
|
|
170
|
+
}>, request?: SyncCryptoEnrollmentRequest): Promise<SyncCryptoStatus>;
|
|
171
|
+
/** Host-controlled passkey or OS-credential unlock. */
|
|
172
|
+
unlockPluginCryptoWithWrappingKey(pluginId: string, wrappingKey: Uint8Array): Promise<SyncCryptoStatus>;
|
|
173
|
+
lockPluginCrypto(pluginId: string): void;
|
|
174
|
+
grantPluginNetworkOrigin(pluginId: string, origin: string, options?: {
|
|
175
|
+
allowPrivateNetwork?: boolean;
|
|
176
|
+
}): Promise<void>;
|
|
177
|
+
revokePluginNetworkOrigin(pluginId: string, origin: string): Promise<void>;
|
|
178
|
+
recordOriginatedChange(pluginId: string, origin: OperationOrigin, kind: HostFileChangeKind, file: TFile, previousPath?: string): Promise<void>;
|
|
179
|
+
}
|