@aiquants/markdown-explorer 0.34.0 → 0.36.0
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 +608 -0
- package/README.md +121 -41
- package/dist/EditSurface-B70iRFkG.cjs +6 -0
- package/dist/EditSurface-BCFJRyIM.js +990 -0
- package/dist/ExplorerSplit-BNrHrIus.cjs +2 -0
- package/dist/ExplorerSplit-Bgccz2nm.js +1589 -0
- package/dist/MultiLayout-Bo9LAXiY.cjs +1 -0
- package/dist/{MultiLayout-kcZyVnvK.js → MultiLayout-Dy5TIC2t.js} +249 -248
- package/dist/{NativeScrollBar-pUbA4Zq3.cjs → NativeScrollBar-Bj-LKej0.cjs} +1 -1
- package/dist/{NativeScrollBar-UNed10Na.js → NativeScrollBar-DpZMYhmf.js} +2 -2
- package/dist/TreeLayout-DsSKW_Qj.js +103 -0
- package/dist/TreeLayout-T8sc_wg7.cjs +1 -0
- package/dist/client/MarkdownExplorer.d.cts +14 -1
- package/dist/client/MarkdownExplorer.d.ts +14 -1
- package/dist/client/edit/lineEndings.d.cts +4 -0
- package/dist/client/edit/lineEndings.d.ts +4 -0
- package/dist/client/hostContract.d.cts +67 -0
- package/dist/client/hostContract.d.ts +67 -0
- package/dist/core/config.d.cts +13 -0
- package/dist/core/config.d.ts +13 -0
- package/dist/core/contracts.d.cts +31 -4
- package/dist/core/contracts.d.ts +31 -4
- package/dist/core/dataRoute.d.cts +5 -1
- package/dist/core/dataRoute.d.ts +5 -1
- package/dist/core/documentId.d.cts +6 -0
- package/dist/core/documentId.d.ts +6 -0
- package/dist/core/draftAnswer.d.cts +23 -0
- package/dist/core/draftAnswer.d.ts +23 -0
- package/dist/core/labels.d.cts +78 -0
- package/dist/core/labels.d.ts +78 -0
- package/dist/core/location.d.cts +22 -2
- package/dist/core/location.d.ts +22 -2
- package/dist/core/ownUrls.d.cts +15 -0
- package/dist/core/ownUrls.d.ts +15 -0
- package/dist/core/treeSettings.d.cts +3 -2
- package/dist/core/treeSettings.d.ts +3 -2
- package/dist/core/viewSettings.d.cts +3 -1
- package/dist/core/viewSettings.d.ts +3 -1
- package/dist/describeValue-CLlVRO8d.js +17 -0
- package/dist/describeValue-Ccvhbt36.cjs +1 -0
- package/dist/explorerCore-B3RGmMG6.js +1083 -0
- package/dist/explorerCore-CUkyKtm8.cjs +1 -0
- package/dist/index-D0l_BJqb.js +5980 -0
- package/dist/index-lpL7GltU.cjs +18 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +8 -4
- package/dist/index.d.ts +8 -4
- package/dist/index.js +53 -43
- package/dist/licenses/@heroicons/react/LICENSE +21 -0
- package/dist/licenses/entities/LICENSE +11 -0
- package/dist/licenses/parse5/LICENSE +19 -0
- package/dist/location-Dh6K-y7w.js +761 -0
- package/dist/location-DrOP6t1F.cjs +1 -0
- package/dist/lru-DC8GBmkX.js +39 -0
- package/dist/lru-SGmUyBQU.cjs +1 -0
- package/dist/{merge-C1MWvhCS.js → merge-BwcqBd4c.js} +1 -1
- package/dist/{merge-BziXxZkE.cjs → merge-Dckw7r9T.cjs} +1 -1
- package/dist/nestingGuardWorker.js +5511 -0
- package/dist/ownUrls-BTPGNhBt.cjs +1 -0
- package/dist/ownUrls-DD0cSCsF.js +409 -0
- package/dist/sanitizeJob-BYqzjFJC.js +21 -0
- package/dist/sanitizeJob-CudE1RUP.cjs +1 -0
- package/dist/sanitizePolicy-C-ehd0J_.cjs +2 -0
- package/dist/sanitizePolicy-DAPnUUVm.js +139 -0
- package/dist/sanitizeWorker.cjs +1 -1
- package/dist/sanitizeWorker.js +134 -139
- package/dist/sanitizerService-B8v4ap9t.js +240 -0
- package/dist/sanitizerService-DomN7lwC.cjs +1 -0
- package/dist/server/assetResponse.d.cts +60 -0
- package/dist/server/assetResponse.d.ts +60 -0
- package/dist/server/browser/browserPlatform.d.cts +12 -0
- package/dist/server/browser/browserPlatform.d.ts +12 -0
- package/dist/server/createMarkdownExplorer.d.cts +0 -10
- package/dist/server/createMarkdownExplorer.d.ts +0 -10
- package/dist/server/errors.d.cts +1 -1
- package/dist/server/errors.d.ts +1 -1
- package/dist/server/explorerCore.d.cts +12 -0
- package/dist/server/explorerCore.d.ts +12 -0
- package/dist/server/fileSystemSource.d.cts +1 -0
- package/dist/server/fileSystemSource.d.ts +1 -0
- package/dist/server/inProcessFetch.d.cts +5 -0
- package/dist/server/inProcessFetch.d.ts +5 -0
- package/dist/server/platform.d.cts +18 -0
- package/dist/server/platform.d.ts +18 -0
- package/dist/server/ports.d.cts +55 -5
- package/dist/server/ports.d.ts +55 -5
- package/dist/server/sanitizeProtocol.d.cts +3 -0
- package/dist/server/sanitizeProtocol.d.ts +3 -0
- package/dist/server/sanitizer.d.cts +5 -40
- package/dist/server/sanitizer.d.ts +5 -40
- package/dist/server/sanitizerOptions.d.cts +24 -0
- package/dist/server/sanitizerOptions.d.ts +24 -0
- package/dist/server/sanitizerService.d.cts +41 -0
- package/dist/server/sanitizerService.d.ts +41 -0
- package/dist/server/{workerPool.d.cts → workerJobs.d.cts} +0 -16
- package/dist/server/{workerPool.d.ts → workerJobs.d.ts} +0 -16
- package/dist/server.cjs +1 -1
- package/dist/server.d.cts +3 -1
- package/dist/server.d.ts +3 -1
- package/dist/server.js +270 -1343
- package/dist/serverBrowser.cjs +1 -0
- package/dist/serverBrowser.d.cts +1 -0
- package/dist/serverBrowser.d.ts +1 -0
- package/dist/serverBrowser.js +120 -0
- package/dist/serverCore.cjs +1 -0
- package/dist/serverCore.d.cts +14 -0
- package/dist/serverCore.d.ts +14 -0
- package/dist/serverCore.js +46 -0
- package/dist/storage-BpYsprog.cjs +1 -0
- package/dist/{storage-CmGHg7OA.js → storage-D1uSw-xj.js} +19 -18
- package/dist/storage.cjs +1 -1
- package/dist/storage.js +1 -1
- package/dist/styles/markdown-explorer.css +1 -1
- package/dist/{tapScrollCircle-DigcJCsu.cjs → tapScrollCircle-DyLInGck.cjs} +1 -1
- package/dist/{tapScrollCircle-D_BpaLwY.js → tapScrollCircle-smKLgRa2.js} +1 -1
- package/dist/testing.cjs +1 -0
- package/dist/testing.d.cts +11 -0
- package/dist/testing.d.ts +11 -0
- package/dist/testing.js +82 -0
- package/dist/useSplitPersistence-BUa_KMsV.cjs +1 -0
- package/dist/useSplitPersistence-pnb21dsr.js +44 -0
- package/docs/behavior/dom-hooks.md +5 -1
- package/docs/behavior/hosting.md +123 -0
- package/docs/behavior/layout.md +5 -3
- package/docs/behavior/localization.md +25 -8
- package/docs/behavior/security.md +55 -15
- package/docs/behavior/url-contract.md +30 -3
- package/package.json +48 -10
- package/dist/EditSurface-CF82jZQg.cjs +0 -6
- package/dist/EditSurface-CqHk2R3k.js +0 -982
- package/dist/ExplorerSplit-D325YGEf.cjs +0 -1
- package/dist/ExplorerSplit-DGH9bckm.js +0 -1500
- package/dist/MultiLayout-CzR7yJ0m.cjs +0 -1
- package/dist/TreeLayout-BnIU87HX.js +0 -96
- package/dist/TreeLayout-DtvIpuOe.cjs +0 -1
- package/dist/dataRoute-D6KiSHIc.js +0 -298
- package/dist/dataRoute-DwYtgyt6.cjs +0 -1
- package/dist/index-BDCbvHDs.cjs +0 -15
- package/dist/index-DR31S_-4.js +0 -5012
- package/dist/location-C44b9H1S.js +0 -676
- package/dist/location-hGLhCCg4.cjs +0 -1
- package/dist/sanitizePolicy-CwvyPpp5.js +0 -98
- package/dist/sanitizePolicy-T5T-3vV5.cjs +0 -1
- package/dist/storage-DM0EvkVf.cjs +0 -1
- package/dist/useSplitPersistence-DCeYbJMx.js +0 -38
- package/dist/useSplitPersistence-QGcvyMAa.cjs +0 -1
package/dist/server/ports.d.cts
CHANGED
|
@@ -5,6 +5,7 @@ import { ExplorerAssetDisplay } from "../core/dataRoute.cjs";
|
|
|
5
5
|
import { ExplorerPathRules } from "../core/paths.cjs";
|
|
6
6
|
import { ExplorerLogger } from "./errors.cjs";
|
|
7
7
|
import { HtmlSanitizerOptions } from "./sanitizer.cjs";
|
|
8
|
+
import { SanitizerLimitsInput } from "./sanitizerOptions.cjs";
|
|
8
9
|
export type ExplorerAuthentication<P> = {
|
|
9
10
|
readonly status: "signed-in";
|
|
10
11
|
readonly principal: P;
|
|
@@ -57,6 +58,11 @@ export type ExplorerAssetFile = {
|
|
|
57
58
|
readonly size: number | null;
|
|
58
59
|
readonly version: string;
|
|
59
60
|
readonly open: (range: ExplorerByteRange | null) => Promise<ReadableStream<Uint8Array>>;
|
|
61
|
+
readonly bridge?: {
|
|
62
|
+
readonly uri: string;
|
|
63
|
+
readonly storageVersion: string | null;
|
|
64
|
+
readonly readFailure: (error: unknown) => unknown;
|
|
65
|
+
};
|
|
60
66
|
};
|
|
61
67
|
export type ExplorerAssetRedirect = {
|
|
62
68
|
readonly kind: "redirect";
|
|
@@ -70,12 +76,14 @@ export type ExplorerHostDocument = {
|
|
|
70
76
|
readonly name: string;
|
|
71
77
|
readonly htmlContent: string;
|
|
72
78
|
readonly headings: readonly ExplorerHeading[];
|
|
79
|
+
readonly lang: string;
|
|
73
80
|
readonly edit: ExplorerDocumentEdit | null;
|
|
74
81
|
} | {
|
|
75
82
|
readonly kind: "text";
|
|
76
83
|
readonly name: string;
|
|
77
84
|
readonly text: string;
|
|
78
85
|
readonly truncated: boolean;
|
|
86
|
+
readonly lang: string;
|
|
79
87
|
readonly version: string;
|
|
80
88
|
} | {
|
|
81
89
|
readonly kind: "image";
|
|
@@ -108,7 +116,7 @@ export type ExplorerHostEditSource = {
|
|
|
108
116
|
readonly kind: "draft";
|
|
109
117
|
readonly text: string;
|
|
110
118
|
} | ExplorerGrantRequired;
|
|
111
|
-
export type
|
|
119
|
+
export type ExplorerHostSaveDraft = {
|
|
112
120
|
readonly text: string;
|
|
113
121
|
readonly baseVersion: string;
|
|
114
122
|
};
|
|
@@ -126,16 +134,33 @@ export type ExplorerHostPreview = {
|
|
|
126
134
|
};
|
|
127
135
|
export type ExplorerEditPorts<P> = {
|
|
128
136
|
readonly source: (context: ExplorerSourceContext<P>, path: string, readPath: string) => Promise<ExplorerHostEditSource>;
|
|
129
|
-
readonly save: (context: ExplorerSourceContext<P>, path: string, readPath: string, draft:
|
|
137
|
+
readonly save: (context: ExplorerSourceContext<P>, path: string, readPath: string, draft: ExplorerHostSaveDraft) => Promise<ExplorerHostSaveResult>;
|
|
130
138
|
readonly preview: (context: ExplorerSourceContext<P>, path: string, readPath: string, text: string) => Promise<ExplorerHostPreview>;
|
|
131
139
|
readonly revisions: (context: ExplorerSourceContext<P>, path: string, readPath: string) => Promise<readonly ExplorerRevision[]>;
|
|
132
140
|
readonly revision: (context: ExplorerSourceContext<P>, path: string, readPath: string, revisionId: string) => Promise<string>;
|
|
133
141
|
};
|
|
134
|
-
export type
|
|
142
|
+
export type ExplorerDocumentIdIssue = {
|
|
143
|
+
readonly kind: "issued";
|
|
144
|
+
} | {
|
|
145
|
+
readonly kind: "existing";
|
|
146
|
+
readonly id: string;
|
|
147
|
+
} | {
|
|
148
|
+
readonly kind: "taken";
|
|
149
|
+
};
|
|
150
|
+
export type ExplorerDocumentIdBinding = {
|
|
151
|
+
readonly kind: "bound";
|
|
152
|
+
readonly path: string;
|
|
153
|
+
} | {
|
|
154
|
+
readonly kind: "unbound";
|
|
155
|
+
};
|
|
156
|
+
export type ExplorerDocumentIdPorts<P> = {
|
|
157
|
+
readonly issue: (context: ExplorerSourceContext<P>, path: string, candidate: string) => Promise<ExplorerDocumentIdIssue>;
|
|
158
|
+
readonly resolve: (context: ExplorerSourceContext<P>, id: string) => Promise<ExplorerDocumentIdBinding>;
|
|
159
|
+
};
|
|
160
|
+
export type ExplorerServerSharedConfig<P> = {
|
|
135
161
|
readonly config: ExplorerConfig;
|
|
136
162
|
readonly authenticate: (request: Request, mode: ExplorerAuthenticationMode) => Promise<ExplorerAuthentication<P>>;
|
|
137
163
|
readonly principalKey: (principal: P) => string;
|
|
138
|
-
readonly scopeSecret: string;
|
|
139
164
|
readonly sources: readonly ExplorerSource<P>[];
|
|
140
165
|
readonly document: (context: ExplorerSourceContext<P>, path: string, readPath: string) => Promise<ExplorerHostDocument>;
|
|
141
166
|
readonly asset: (context: ExplorerSourceContext<P>, path: string, readPath: string, options: ExplorerAssetOptions) => Promise<ExplorerAssetFile | ExplorerAssetRedirect>;
|
|
@@ -148,19 +173,44 @@ export type MarkdownExplorerServerConfig<P> = {
|
|
|
148
173
|
readonly maxEntries?: number;
|
|
149
174
|
readonly maxBytes?: number;
|
|
150
175
|
} | false;
|
|
151
|
-
readonly sanitizer?: HtmlSanitizerOptions;
|
|
152
176
|
readonly deferredTimeoutMs?: number;
|
|
153
177
|
readonly textMaxBytes?: number;
|
|
154
178
|
readonly edit?: ExplorerEditPorts<P>;
|
|
155
179
|
readonly editMaxBytes?: number;
|
|
180
|
+
readonly documentIds?: ExplorerDocumentIdPorts<P>;
|
|
156
181
|
readonly logger?: ExplorerLogger;
|
|
157
182
|
readonly onTreeRefreshed?: (key: string) => void;
|
|
158
183
|
};
|
|
184
|
+
export type MarkdownExplorerServerConfig<P> = ExplorerServerSharedConfig<P> & {
|
|
185
|
+
readonly scopeSecret: string;
|
|
186
|
+
readonly sanitizer?: HtmlSanitizerOptions;
|
|
187
|
+
};
|
|
188
|
+
export type ExplorerServerCoreConfig<P> = ExplorerServerSharedConfig<P> & {
|
|
189
|
+
readonly sanitizer?: SanitizerLimitsInput & Readonly<Record<string, unknown>>;
|
|
190
|
+
readonly readSettings: (request: Request) => string | undefined;
|
|
191
|
+
readonly assetMaxRangeBytes: number | null;
|
|
192
|
+
};
|
|
159
193
|
export type ExplorerPageLoaderResult = ReturnType<typeof data<ExplorerPageData>>;
|
|
194
|
+
export type ExplorerDataPlan = {
|
|
195
|
+
readonly kind: "response";
|
|
196
|
+
readonly response: Response;
|
|
197
|
+
} | {
|
|
198
|
+
readonly kind: "file";
|
|
199
|
+
readonly status: 200 | 206;
|
|
200
|
+
readonly headers: Headers;
|
|
201
|
+
readonly bridge: {
|
|
202
|
+
readonly uri: string;
|
|
203
|
+
readonly storageVersion: string | null;
|
|
204
|
+
};
|
|
205
|
+
readonly range: ExplorerByteRange | null;
|
|
206
|
+
readonly length: number | null;
|
|
207
|
+
readonly fail: (error: unknown) => Response;
|
|
208
|
+
};
|
|
160
209
|
export type MarkdownExplorerServer = {
|
|
161
210
|
readonly loader: (args: LoaderFunctionArgs) => Promise<ExplorerPageLoaderResult>;
|
|
162
211
|
readonly headers: HeadersFunction;
|
|
163
212
|
readonly dataLoader: (args: LoaderFunctionArgs) => Promise<Response>;
|
|
164
213
|
readonly dataAction: (args: ActionFunctionArgs) => Promise<Response>;
|
|
214
|
+
readonly planData: (args: LoaderFunctionArgs) => Promise<ExplorerDataPlan>;
|
|
165
215
|
readonly forgetTree: (key: string) => void;
|
|
166
216
|
};
|
package/dist/server/ports.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { ExplorerAssetDisplay } from "../core/dataRoute.js";
|
|
|
5
5
|
import { ExplorerPathRules } from "../core/paths.js";
|
|
6
6
|
import { ExplorerLogger } from "./errors.js";
|
|
7
7
|
import { HtmlSanitizerOptions } from "./sanitizer.js";
|
|
8
|
+
import { SanitizerLimitsInput } from "./sanitizerOptions.js";
|
|
8
9
|
export type ExplorerAuthentication<P> = {
|
|
9
10
|
readonly status: "signed-in";
|
|
10
11
|
readonly principal: P;
|
|
@@ -57,6 +58,11 @@ export type ExplorerAssetFile = {
|
|
|
57
58
|
readonly size: number | null;
|
|
58
59
|
readonly version: string;
|
|
59
60
|
readonly open: (range: ExplorerByteRange | null) => Promise<ReadableStream<Uint8Array>>;
|
|
61
|
+
readonly bridge?: {
|
|
62
|
+
readonly uri: string;
|
|
63
|
+
readonly storageVersion: string | null;
|
|
64
|
+
readonly readFailure: (error: unknown) => unknown;
|
|
65
|
+
};
|
|
60
66
|
};
|
|
61
67
|
export type ExplorerAssetRedirect = {
|
|
62
68
|
readonly kind: "redirect";
|
|
@@ -70,12 +76,14 @@ export type ExplorerHostDocument = {
|
|
|
70
76
|
readonly name: string;
|
|
71
77
|
readonly htmlContent: string;
|
|
72
78
|
readonly headings: readonly ExplorerHeading[];
|
|
79
|
+
readonly lang: string;
|
|
73
80
|
readonly edit: ExplorerDocumentEdit | null;
|
|
74
81
|
} | {
|
|
75
82
|
readonly kind: "text";
|
|
76
83
|
readonly name: string;
|
|
77
84
|
readonly text: string;
|
|
78
85
|
readonly truncated: boolean;
|
|
86
|
+
readonly lang: string;
|
|
79
87
|
readonly version: string;
|
|
80
88
|
} | {
|
|
81
89
|
readonly kind: "image";
|
|
@@ -108,7 +116,7 @@ export type ExplorerHostEditSource = {
|
|
|
108
116
|
readonly kind: "draft";
|
|
109
117
|
readonly text: string;
|
|
110
118
|
} | ExplorerGrantRequired;
|
|
111
|
-
export type
|
|
119
|
+
export type ExplorerHostSaveDraft = {
|
|
112
120
|
readonly text: string;
|
|
113
121
|
readonly baseVersion: string;
|
|
114
122
|
};
|
|
@@ -126,16 +134,33 @@ export type ExplorerHostPreview = {
|
|
|
126
134
|
};
|
|
127
135
|
export type ExplorerEditPorts<P> = {
|
|
128
136
|
readonly source: (context: ExplorerSourceContext<P>, path: string, readPath: string) => Promise<ExplorerHostEditSource>;
|
|
129
|
-
readonly save: (context: ExplorerSourceContext<P>, path: string, readPath: string, draft:
|
|
137
|
+
readonly save: (context: ExplorerSourceContext<P>, path: string, readPath: string, draft: ExplorerHostSaveDraft) => Promise<ExplorerHostSaveResult>;
|
|
130
138
|
readonly preview: (context: ExplorerSourceContext<P>, path: string, readPath: string, text: string) => Promise<ExplorerHostPreview>;
|
|
131
139
|
readonly revisions: (context: ExplorerSourceContext<P>, path: string, readPath: string) => Promise<readonly ExplorerRevision[]>;
|
|
132
140
|
readonly revision: (context: ExplorerSourceContext<P>, path: string, readPath: string, revisionId: string) => Promise<string>;
|
|
133
141
|
};
|
|
134
|
-
export type
|
|
142
|
+
export type ExplorerDocumentIdIssue = {
|
|
143
|
+
readonly kind: "issued";
|
|
144
|
+
} | {
|
|
145
|
+
readonly kind: "existing";
|
|
146
|
+
readonly id: string;
|
|
147
|
+
} | {
|
|
148
|
+
readonly kind: "taken";
|
|
149
|
+
};
|
|
150
|
+
export type ExplorerDocumentIdBinding = {
|
|
151
|
+
readonly kind: "bound";
|
|
152
|
+
readonly path: string;
|
|
153
|
+
} | {
|
|
154
|
+
readonly kind: "unbound";
|
|
155
|
+
};
|
|
156
|
+
export type ExplorerDocumentIdPorts<P> = {
|
|
157
|
+
readonly issue: (context: ExplorerSourceContext<P>, path: string, candidate: string) => Promise<ExplorerDocumentIdIssue>;
|
|
158
|
+
readonly resolve: (context: ExplorerSourceContext<P>, id: string) => Promise<ExplorerDocumentIdBinding>;
|
|
159
|
+
};
|
|
160
|
+
export type ExplorerServerSharedConfig<P> = {
|
|
135
161
|
readonly config: ExplorerConfig;
|
|
136
162
|
readonly authenticate: (request: Request, mode: ExplorerAuthenticationMode) => Promise<ExplorerAuthentication<P>>;
|
|
137
163
|
readonly principalKey: (principal: P) => string;
|
|
138
|
-
readonly scopeSecret: string;
|
|
139
164
|
readonly sources: readonly ExplorerSource<P>[];
|
|
140
165
|
readonly document: (context: ExplorerSourceContext<P>, path: string, readPath: string) => Promise<ExplorerHostDocument>;
|
|
141
166
|
readonly asset: (context: ExplorerSourceContext<P>, path: string, readPath: string, options: ExplorerAssetOptions) => Promise<ExplorerAssetFile | ExplorerAssetRedirect>;
|
|
@@ -148,19 +173,44 @@ export type MarkdownExplorerServerConfig<P> = {
|
|
|
148
173
|
readonly maxEntries?: number;
|
|
149
174
|
readonly maxBytes?: number;
|
|
150
175
|
} | false;
|
|
151
|
-
readonly sanitizer?: HtmlSanitizerOptions;
|
|
152
176
|
readonly deferredTimeoutMs?: number;
|
|
153
177
|
readonly textMaxBytes?: number;
|
|
154
178
|
readonly edit?: ExplorerEditPorts<P>;
|
|
155
179
|
readonly editMaxBytes?: number;
|
|
180
|
+
readonly documentIds?: ExplorerDocumentIdPorts<P>;
|
|
156
181
|
readonly logger?: ExplorerLogger;
|
|
157
182
|
readonly onTreeRefreshed?: (key: string) => void;
|
|
158
183
|
};
|
|
184
|
+
export type MarkdownExplorerServerConfig<P> = ExplorerServerSharedConfig<P> & {
|
|
185
|
+
readonly scopeSecret: string;
|
|
186
|
+
readonly sanitizer?: HtmlSanitizerOptions;
|
|
187
|
+
};
|
|
188
|
+
export type ExplorerServerCoreConfig<P> = ExplorerServerSharedConfig<P> & {
|
|
189
|
+
readonly sanitizer?: SanitizerLimitsInput & Readonly<Record<string, unknown>>;
|
|
190
|
+
readonly readSettings: (request: Request) => string | undefined;
|
|
191
|
+
readonly assetMaxRangeBytes: number | null;
|
|
192
|
+
};
|
|
159
193
|
export type ExplorerPageLoaderResult = ReturnType<typeof data<ExplorerPageData>>;
|
|
194
|
+
export type ExplorerDataPlan = {
|
|
195
|
+
readonly kind: "response";
|
|
196
|
+
readonly response: Response;
|
|
197
|
+
} | {
|
|
198
|
+
readonly kind: "file";
|
|
199
|
+
readonly status: 200 | 206;
|
|
200
|
+
readonly headers: Headers;
|
|
201
|
+
readonly bridge: {
|
|
202
|
+
readonly uri: string;
|
|
203
|
+
readonly storageVersion: string | null;
|
|
204
|
+
};
|
|
205
|
+
readonly range: ExplorerByteRange | null;
|
|
206
|
+
readonly length: number | null;
|
|
207
|
+
readonly fail: (error: unknown) => Response;
|
|
208
|
+
};
|
|
160
209
|
export type MarkdownExplorerServer = {
|
|
161
210
|
readonly loader: (args: LoaderFunctionArgs) => Promise<ExplorerPageLoaderResult>;
|
|
162
211
|
readonly headers: HeadersFunction;
|
|
163
212
|
readonly dataLoader: (args: LoaderFunctionArgs) => Promise<Response>;
|
|
164
213
|
readonly dataAction: (args: ActionFunctionArgs) => Promise<Response>;
|
|
214
|
+
readonly planData: (args: LoaderFunctionArgs) => Promise<ExplorerDataPlan>;
|
|
165
215
|
readonly forgetTree: (key: string) => void;
|
|
166
216
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ExplorerOwnUrls } from "../core/ownUrls.cjs";
|
|
1
2
|
export type SanitizeJobInput = {
|
|
2
3
|
readonly html: string;
|
|
3
4
|
readonly iframeHosts: readonly string[];
|
|
4
5
|
readonly dataPath: string;
|
|
6
|
+
readonly ownUrls: ExplorerOwnUrls;
|
|
5
7
|
readonly maxNodes: number;
|
|
6
8
|
readonly maxAttributeChars: number;
|
|
7
9
|
readonly maxSanitizedChars: number;
|
|
@@ -15,3 +17,4 @@ export type SanitizeJobOutput = {
|
|
|
15
17
|
readonly status: "error";
|
|
16
18
|
readonly message: string;
|
|
17
19
|
};
|
|
20
|
+
export declare const describeJobError: (error: unknown) => string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { ExplorerOwnUrls } from "../core/ownUrls.js";
|
|
1
2
|
export type SanitizeJobInput = {
|
|
2
3
|
readonly html: string;
|
|
3
4
|
readonly iframeHosts: readonly string[];
|
|
4
5
|
readonly dataPath: string;
|
|
6
|
+
readonly ownUrls: ExplorerOwnUrls;
|
|
5
7
|
readonly maxNodes: number;
|
|
6
8
|
readonly maxAttributeChars: number;
|
|
7
9
|
readonly maxSanitizedChars: number;
|
|
@@ -15,3 +17,4 @@ export type SanitizeJobOutput = {
|
|
|
15
17
|
readonly status: "error";
|
|
16
18
|
readonly message: string;
|
|
17
19
|
};
|
|
20
|
+
export declare const describeJobError: (error: unknown) => string;
|
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export type HtmlSanitizerOptions = {
|
|
1
|
+
import { SanitizerLimitsInput } from "./sanitizerOptions.cjs";
|
|
2
|
+
import { HtmlMeasure, SanitizerCrash, SanitizerPool } from "./sanitizerService.cjs";
|
|
3
|
+
export type HtmlSanitizerOptions = SanitizerLimitsInput & {
|
|
4
4
|
readonly workers?: number;
|
|
5
|
-
readonly deadlineMs?: number;
|
|
6
|
-
readonly maxHtmlBytes?: number;
|
|
7
|
-
readonly cacheBytes?: number;
|
|
8
5
|
readonly workerHeapMb?: number;
|
|
9
|
-
readonly jobsPerScope?: number;
|
|
10
|
-
readonly maxQueuedJobs?: number;
|
|
11
6
|
};
|
|
12
7
|
export type ResolvedHtmlSanitizerOptions = Required<HtmlSanitizerOptions>;
|
|
13
|
-
export declare const SANITIZER_SCOPE_HEADROOM = 3;
|
|
14
8
|
export declare const DEFAULT_SANITIZER_WORKERS = 2;
|
|
15
|
-
export declare const defaultSanitizerJobsPerScope: (maxPanels: number, workers: number) => number;
|
|
16
|
-
export declare const SANITIZER_QUEUED_READERS = 4;
|
|
17
9
|
export declare const SANITIZER_YOUNG_GENERATION_MB = 32;
|
|
18
|
-
export declare const DEFAULT_SANITIZER_WORKER_HEAP_MB = 512;
|
|
19
|
-
export declare const SANITIZER_WORKER_BASE_HEAP_MB = 64;
|
|
20
|
-
export declare const SANITIZER_HEAP_BYTES_PER_NODE = 4096;
|
|
21
|
-
export declare const SANITIZER_HEAP_BYTES_PER_HTML_BYTE = 32;
|
|
22
|
-
export declare const MIN_HTML_NODE_BUDGET = 4096;
|
|
23
|
-
export declare const SANITIZED_HTML_CHARS_PER_HTML_BYTE = 4;
|
|
24
10
|
export declare const htmlNodeBudget: ({ workerHeapMb, maxHtmlBytes }: Pick<ResolvedHtmlSanitizerOptions, "workerHeapMb" | "maxHtmlBytes">) => number;
|
|
25
|
-
export declare const htmlAttributeCharBudget: ({ maxHtmlBytes }: Pick<ResolvedHtmlSanitizerOptions, "maxHtmlBytes">) => number;
|
|
26
|
-
export declare const sanitizedHtmlLimit: ({ maxHtmlBytes }: Pick<ResolvedHtmlSanitizerOptions, "maxHtmlBytes">) => number;
|
|
27
11
|
export declare const defaultHtmlSanitizerOptions: (maxPanels: number) => ResolvedHtmlSanitizerOptions;
|
|
28
|
-
export declare const SANITIZED_HTML_CACHE_ENTRIES = 1024;
|
|
29
|
-
export type SanitizedHtml = {
|
|
30
|
-
readonly status: "sanitized";
|
|
31
|
-
readonly html: string;
|
|
32
|
-
} | {
|
|
33
|
-
readonly status: "rejected";
|
|
34
|
-
readonly reason: "too-large" | "failed";
|
|
35
|
-
readonly cause: Error | null;
|
|
36
|
-
};
|
|
37
|
-
export type SanitizeRequest = {
|
|
38
|
-
readonly scope: string;
|
|
39
|
-
readonly signal: AbortSignal;
|
|
40
|
-
};
|
|
41
|
-
export type HtmlSanitizerService = (html: string, request: SanitizeRequest) => Promise<SanitizedHtml>;
|
|
42
|
-
export type SanitizerPool = WorkerPool<SanitizeJobInput, SanitizeJobOutput>;
|
|
43
12
|
export declare const resolveHtmlSanitizerOptions: (value: unknown, maxPanels: number) => ResolvedHtmlSanitizerOptions;
|
|
44
13
|
export declare const sanitizerWorkerUrl: () => URL;
|
|
45
14
|
export declare const sharedSanitizerPool: (url: URL, options: Pick<ResolvedHtmlSanitizerOptions, "workers" | "deadlineMs" | "workerHeapMb" | "jobsPerScope" | "maxQueuedJobs">) => SanitizerPool;
|
|
46
|
-
export declare const
|
|
47
|
-
|
|
48
|
-
readonly dataPath: string;
|
|
49
|
-
readonly options: ResolvedHtmlSanitizerOptions;
|
|
50
|
-
readonly pool: SanitizerPool;
|
|
51
|
-
}) => HtmlSanitizerService;
|
|
15
|
+
export declare const nodeHtmlMeasure: (html: string) => HtmlMeasure;
|
|
16
|
+
export declare const nodeCrashClassifier: (workerHeapMb: number) => (error: unknown) => SanitizerCrash | null;
|
|
@@ -1,51 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export type HtmlSanitizerOptions = {
|
|
1
|
+
import { SanitizerLimitsInput } from "./sanitizerOptions.js";
|
|
2
|
+
import { HtmlMeasure, SanitizerCrash, SanitizerPool } from "./sanitizerService.js";
|
|
3
|
+
export type HtmlSanitizerOptions = SanitizerLimitsInput & {
|
|
4
4
|
readonly workers?: number;
|
|
5
|
-
readonly deadlineMs?: number;
|
|
6
|
-
readonly maxHtmlBytes?: number;
|
|
7
|
-
readonly cacheBytes?: number;
|
|
8
5
|
readonly workerHeapMb?: number;
|
|
9
|
-
readonly jobsPerScope?: number;
|
|
10
|
-
readonly maxQueuedJobs?: number;
|
|
11
6
|
};
|
|
12
7
|
export type ResolvedHtmlSanitizerOptions = Required<HtmlSanitizerOptions>;
|
|
13
|
-
export declare const SANITIZER_SCOPE_HEADROOM = 3;
|
|
14
8
|
export declare const DEFAULT_SANITIZER_WORKERS = 2;
|
|
15
|
-
export declare const defaultSanitizerJobsPerScope: (maxPanels: number, workers: number) => number;
|
|
16
|
-
export declare const SANITIZER_QUEUED_READERS = 4;
|
|
17
9
|
export declare const SANITIZER_YOUNG_GENERATION_MB = 32;
|
|
18
|
-
export declare const DEFAULT_SANITIZER_WORKER_HEAP_MB = 512;
|
|
19
|
-
export declare const SANITIZER_WORKER_BASE_HEAP_MB = 64;
|
|
20
|
-
export declare const SANITIZER_HEAP_BYTES_PER_NODE = 4096;
|
|
21
|
-
export declare const SANITIZER_HEAP_BYTES_PER_HTML_BYTE = 32;
|
|
22
|
-
export declare const MIN_HTML_NODE_BUDGET = 4096;
|
|
23
|
-
export declare const SANITIZED_HTML_CHARS_PER_HTML_BYTE = 4;
|
|
24
10
|
export declare const htmlNodeBudget: ({ workerHeapMb, maxHtmlBytes }: Pick<ResolvedHtmlSanitizerOptions, "workerHeapMb" | "maxHtmlBytes">) => number;
|
|
25
|
-
export declare const htmlAttributeCharBudget: ({ maxHtmlBytes }: Pick<ResolvedHtmlSanitizerOptions, "maxHtmlBytes">) => number;
|
|
26
|
-
export declare const sanitizedHtmlLimit: ({ maxHtmlBytes }: Pick<ResolvedHtmlSanitizerOptions, "maxHtmlBytes">) => number;
|
|
27
11
|
export declare const defaultHtmlSanitizerOptions: (maxPanels: number) => ResolvedHtmlSanitizerOptions;
|
|
28
|
-
export declare const SANITIZED_HTML_CACHE_ENTRIES = 1024;
|
|
29
|
-
export type SanitizedHtml = {
|
|
30
|
-
readonly status: "sanitized";
|
|
31
|
-
readonly html: string;
|
|
32
|
-
} | {
|
|
33
|
-
readonly status: "rejected";
|
|
34
|
-
readonly reason: "too-large" | "failed";
|
|
35
|
-
readonly cause: Error | null;
|
|
36
|
-
};
|
|
37
|
-
export type SanitizeRequest = {
|
|
38
|
-
readonly scope: string;
|
|
39
|
-
readonly signal: AbortSignal;
|
|
40
|
-
};
|
|
41
|
-
export type HtmlSanitizerService = (html: string, request: SanitizeRequest) => Promise<SanitizedHtml>;
|
|
42
|
-
export type SanitizerPool = WorkerPool<SanitizeJobInput, SanitizeJobOutput>;
|
|
43
12
|
export declare const resolveHtmlSanitizerOptions: (value: unknown, maxPanels: number) => ResolvedHtmlSanitizerOptions;
|
|
44
13
|
export declare const sanitizerWorkerUrl: () => URL;
|
|
45
14
|
export declare const sharedSanitizerPool: (url: URL, options: Pick<ResolvedHtmlSanitizerOptions, "workers" | "deadlineMs" | "workerHeapMb" | "jobsPerScope" | "maxQueuedJobs">) => SanitizerPool;
|
|
46
|
-
export declare const
|
|
47
|
-
|
|
48
|
-
readonly dataPath: string;
|
|
49
|
-
readonly options: ResolvedHtmlSanitizerOptions;
|
|
50
|
-
readonly pool: SanitizerPool;
|
|
51
|
-
}) => HtmlSanitizerService;
|
|
15
|
+
export declare const nodeHtmlMeasure: (html: string) => HtmlMeasure;
|
|
16
|
+
export declare const nodeCrashClassifier: (workerHeapMb: number) => (error: unknown) => SanitizerCrash | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type SanitizerLimitsInput = {
|
|
2
|
+
readonly deadlineMs?: number;
|
|
3
|
+
readonly maxHtmlBytes?: number;
|
|
4
|
+
readonly cacheBytes?: number;
|
|
5
|
+
readonly jobsPerScope?: number;
|
|
6
|
+
readonly maxQueuedJobs?: number;
|
|
7
|
+
};
|
|
8
|
+
export type SanitizerLimits = Required<SanitizerLimitsInput>;
|
|
9
|
+
export declare const DEFAULT_SANITIZER_DEADLINE_MS = 30000;
|
|
10
|
+
export declare const DEFAULT_SANITIZER_MAX_HTML_BYTES: number;
|
|
11
|
+
export declare const DEFAULT_SANITIZER_CACHE_BYTES: number;
|
|
12
|
+
export declare const MAX_HTML_BYTES: number;
|
|
13
|
+
export declare const SANITIZER_SCOPE_HEADROOM = 3;
|
|
14
|
+
export declare const defaultSanitizerJobsPerScope: (maxPanels: number, workers: number) => number;
|
|
15
|
+
export declare const SANITIZER_QUEUED_READERS = 4;
|
|
16
|
+
export declare const DEFAULT_SANITIZER_WORKER_HEAP_MB = 512;
|
|
17
|
+
export declare const SANITIZER_WORKER_BASE_HEAP_MB = 64;
|
|
18
|
+
export declare const SANITIZER_HEAP_BYTES_PER_NODE = 4096;
|
|
19
|
+
export declare const SANITIZER_HEAP_BYTES_PER_HTML_BYTE = 32;
|
|
20
|
+
export declare const MIN_HTML_NODE_BUDGET = 4096;
|
|
21
|
+
export declare const htmlNodeBudgetOf: (maxHtmlBytes: number, workerHeapMb: number) => number;
|
|
22
|
+
export declare const readLimit: (name: string, value: unknown, defaultValue: number, max: number) => number;
|
|
23
|
+
export declare const assertAdmissionCoversPanels: (limits: Pick<SanitizerLimits, "jobsPerScope" | "maxQueuedJobs">, maxPanels: number) => void;
|
|
24
|
+
export declare const resolveBrowserSanitizerLimits: (value: unknown, maxPanels: number) => SanitizerLimits;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type SanitizerLimitsInput = {
|
|
2
|
+
readonly deadlineMs?: number;
|
|
3
|
+
readonly maxHtmlBytes?: number;
|
|
4
|
+
readonly cacheBytes?: number;
|
|
5
|
+
readonly jobsPerScope?: number;
|
|
6
|
+
readonly maxQueuedJobs?: number;
|
|
7
|
+
};
|
|
8
|
+
export type SanitizerLimits = Required<SanitizerLimitsInput>;
|
|
9
|
+
export declare const DEFAULT_SANITIZER_DEADLINE_MS = 30000;
|
|
10
|
+
export declare const DEFAULT_SANITIZER_MAX_HTML_BYTES: number;
|
|
11
|
+
export declare const DEFAULT_SANITIZER_CACHE_BYTES: number;
|
|
12
|
+
export declare const MAX_HTML_BYTES: number;
|
|
13
|
+
export declare const SANITIZER_SCOPE_HEADROOM = 3;
|
|
14
|
+
export declare const defaultSanitizerJobsPerScope: (maxPanels: number, workers: number) => number;
|
|
15
|
+
export declare const SANITIZER_QUEUED_READERS = 4;
|
|
16
|
+
export declare const DEFAULT_SANITIZER_WORKER_HEAP_MB = 512;
|
|
17
|
+
export declare const SANITIZER_WORKER_BASE_HEAP_MB = 64;
|
|
18
|
+
export declare const SANITIZER_HEAP_BYTES_PER_NODE = 4096;
|
|
19
|
+
export declare const SANITIZER_HEAP_BYTES_PER_HTML_BYTE = 32;
|
|
20
|
+
export declare const MIN_HTML_NODE_BUDGET = 4096;
|
|
21
|
+
export declare const htmlNodeBudgetOf: (maxHtmlBytes: number, workerHeapMb: number) => number;
|
|
22
|
+
export declare const readLimit: (name: string, value: unknown, defaultValue: number, max: number) => number;
|
|
23
|
+
export declare const assertAdmissionCoversPanels: (limits: Pick<SanitizerLimits, "jobsPerScope" | "maxQueuedJobs">, maxPanels: number) => void;
|
|
24
|
+
export declare const resolveBrowserSanitizerLimits: (value: unknown, maxPanels: number) => SanitizerLimits;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ExplorerOwnUrls } from "../core/ownUrls.cjs";
|
|
2
|
+
import { SanitizeJobInput, SanitizeJobOutput } from "./sanitizeProtocol.cjs";
|
|
3
|
+
import { SanitizerLimits } from "./sanitizerOptions.cjs";
|
|
4
|
+
import { WorkerPool } from "./workerJobs.cjs";
|
|
5
|
+
export declare const SANITIZED_HTML_CHARS_PER_HTML_BYTE = 4;
|
|
6
|
+
export declare const htmlAttributeCharBudget: ({ maxHtmlBytes }: Pick<SanitizerLimits, "maxHtmlBytes">) => number;
|
|
7
|
+
export declare const sanitizedHtmlLimit: ({ maxHtmlBytes }: Pick<SanitizerLimits, "maxHtmlBytes">) => number;
|
|
8
|
+
export declare const SANITIZED_HTML_CACHE_ENTRIES = 1024;
|
|
9
|
+
export type SanitizedHtml = {
|
|
10
|
+
readonly status: "sanitized";
|
|
11
|
+
readonly html: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly status: "rejected";
|
|
14
|
+
readonly reason: "too-large" | "failed";
|
|
15
|
+
readonly cause: Error | null;
|
|
16
|
+
};
|
|
17
|
+
export type SanitizeRequest = {
|
|
18
|
+
readonly scope: string;
|
|
19
|
+
readonly signal: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
export type HtmlSanitizerService = (html: string, request: SanitizeRequest) => Promise<SanitizedHtml>;
|
|
22
|
+
export type SanitizerPool = WorkerPool<SanitizeJobInput, SanitizeJobOutput>;
|
|
23
|
+
export type HtmlMeasure = {
|
|
24
|
+
readonly utf8Bytes: number;
|
|
25
|
+
readonly hash: string;
|
|
26
|
+
};
|
|
27
|
+
export type SanitizerCrash = {
|
|
28
|
+
readonly reason: "too-large";
|
|
29
|
+
readonly message: string;
|
|
30
|
+
};
|
|
31
|
+
export type HtmlSanitizerServiceSettings = {
|
|
32
|
+
readonly iframeHosts: readonly string[];
|
|
33
|
+
readonly dataPath: string;
|
|
34
|
+
readonly ownUrls: ExplorerOwnUrls;
|
|
35
|
+
readonly limits: SanitizerLimits;
|
|
36
|
+
readonly nodeBudget: number;
|
|
37
|
+
readonly measureHtml: (html: string) => HtmlMeasure | Promise<HtmlMeasure>;
|
|
38
|
+
readonly classifyCrash: (error: unknown) => SanitizerCrash | null;
|
|
39
|
+
readonly pool: SanitizerPool;
|
|
40
|
+
};
|
|
41
|
+
export declare const createHtmlSanitizerService: ({ iframeHosts, dataPath, ownUrls, limits, nodeBudget, measureHtml, classifyCrash, pool }: HtmlSanitizerServiceSettings) => HtmlSanitizerService;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { ExplorerOwnUrls } from "../core/ownUrls.js";
|
|
2
|
+
import { SanitizeJobInput, SanitizeJobOutput } from "./sanitizeProtocol.js";
|
|
3
|
+
import { SanitizerLimits } from "./sanitizerOptions.js";
|
|
4
|
+
import { WorkerPool } from "./workerJobs.js";
|
|
5
|
+
export declare const SANITIZED_HTML_CHARS_PER_HTML_BYTE = 4;
|
|
6
|
+
export declare const htmlAttributeCharBudget: ({ maxHtmlBytes }: Pick<SanitizerLimits, "maxHtmlBytes">) => number;
|
|
7
|
+
export declare const sanitizedHtmlLimit: ({ maxHtmlBytes }: Pick<SanitizerLimits, "maxHtmlBytes">) => number;
|
|
8
|
+
export declare const SANITIZED_HTML_CACHE_ENTRIES = 1024;
|
|
9
|
+
export type SanitizedHtml = {
|
|
10
|
+
readonly status: "sanitized";
|
|
11
|
+
readonly html: string;
|
|
12
|
+
} | {
|
|
13
|
+
readonly status: "rejected";
|
|
14
|
+
readonly reason: "too-large" | "failed";
|
|
15
|
+
readonly cause: Error | null;
|
|
16
|
+
};
|
|
17
|
+
export type SanitizeRequest = {
|
|
18
|
+
readonly scope: string;
|
|
19
|
+
readonly signal: AbortSignal;
|
|
20
|
+
};
|
|
21
|
+
export type HtmlSanitizerService = (html: string, request: SanitizeRequest) => Promise<SanitizedHtml>;
|
|
22
|
+
export type SanitizerPool = WorkerPool<SanitizeJobInput, SanitizeJobOutput>;
|
|
23
|
+
export type HtmlMeasure = {
|
|
24
|
+
readonly utf8Bytes: number;
|
|
25
|
+
readonly hash: string;
|
|
26
|
+
};
|
|
27
|
+
export type SanitizerCrash = {
|
|
28
|
+
readonly reason: "too-large";
|
|
29
|
+
readonly message: string;
|
|
30
|
+
};
|
|
31
|
+
export type HtmlSanitizerServiceSettings = {
|
|
32
|
+
readonly iframeHosts: readonly string[];
|
|
33
|
+
readonly dataPath: string;
|
|
34
|
+
readonly ownUrls: ExplorerOwnUrls;
|
|
35
|
+
readonly limits: SanitizerLimits;
|
|
36
|
+
readonly nodeBudget: number;
|
|
37
|
+
readonly measureHtml: (html: string) => HtmlMeasure | Promise<HtmlMeasure>;
|
|
38
|
+
readonly classifyCrash: (error: unknown) => SanitizerCrash | null;
|
|
39
|
+
readonly pool: SanitizerPool;
|
|
40
|
+
};
|
|
41
|
+
export declare const createHtmlSanitizerService: ({ iframeHosts, dataPath, ownUrls, limits, nodeBudget, measureHtml, classifyCrash, pool }: HtmlSanitizerServiceSettings) => HtmlSanitizerService;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
export type WorkerHeapLimits = {
|
|
2
|
-
readonly maxOldGenerationSizeMb: number;
|
|
3
|
-
readonly maxYoungGenerationSizeMb: number;
|
|
4
|
-
};
|
|
5
|
-
export type WorkerPoolOptions = {
|
|
6
|
-
readonly url: URL;
|
|
7
|
-
readonly size: number;
|
|
8
|
-
readonly deadlineMs: number;
|
|
9
|
-
readonly jobsPerScope: number;
|
|
10
|
-
readonly maxQueuedJobs: number;
|
|
11
|
-
readonly heapLimits: WorkerHeapLimits;
|
|
12
|
-
};
|
|
13
1
|
export type WorkerJobTicket = {
|
|
14
2
|
readonly scope: string;
|
|
15
3
|
readonly signal: AbortSignal;
|
|
@@ -35,8 +23,4 @@ export type WorkerPool<I, O> = {
|
|
|
35
23
|
readonly run: (input: I, ticket: WorkerJobTicket) => Promise<WorkerJobResult<O>>;
|
|
36
24
|
readonly workers: () => number;
|
|
37
25
|
};
|
|
38
|
-
export declare const WORKER_READY_MESSAGE: Readonly<{
|
|
39
|
-
ready: true;
|
|
40
|
-
}>;
|
|
41
26
|
export declare const jobsRunningPerScope: (size: number) => number;
|
|
42
|
-
export declare const createWorkerPool: <I, O>({ url, size, deadlineMs, jobsPerScope, maxQueuedJobs, heapLimits }: WorkerPoolOptions) => WorkerPool<I, O>;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
export type WorkerHeapLimits = {
|
|
2
|
-
readonly maxOldGenerationSizeMb: number;
|
|
3
|
-
readonly maxYoungGenerationSizeMb: number;
|
|
4
|
-
};
|
|
5
|
-
export type WorkerPoolOptions = {
|
|
6
|
-
readonly url: URL;
|
|
7
|
-
readonly size: number;
|
|
8
|
-
readonly deadlineMs: number;
|
|
9
|
-
readonly jobsPerScope: number;
|
|
10
|
-
readonly maxQueuedJobs: number;
|
|
11
|
-
readonly heapLimits: WorkerHeapLimits;
|
|
12
|
-
};
|
|
13
1
|
export type WorkerJobTicket = {
|
|
14
2
|
readonly scope: string;
|
|
15
3
|
readonly signal: AbortSignal;
|
|
@@ -35,8 +23,4 @@ export type WorkerPool<I, O> = {
|
|
|
35
23
|
readonly run: (input: I, ticket: WorkerJobTicket) => Promise<WorkerJobResult<O>>;
|
|
36
24
|
readonly workers: () => number;
|
|
37
25
|
};
|
|
38
|
-
export declare const WORKER_READY_MESSAGE: Readonly<{
|
|
39
|
-
ready: true;
|
|
40
|
-
}>;
|
|
41
26
|
export declare const jobsRunningPerScope: (size: number) => number;
|
|
42
|
-
export declare const createWorkerPool: <I, O>({ url, size, deadlineMs, jobsPerScope, maxQueuedJobs, heapLimits }: WorkerPoolOptions) => WorkerPool<I, O>;
|