@superbee/core 0.2.0-pre.16 → 0.2.0-pre.19
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 +622 -5
- package/dist/blob-journal.d.ts +187 -2
- package/dist/blob-journal.d.ts.map +1 -1
- package/dist/blob-journal.js +377 -5
- package/dist/blob-journal.js.map +1 -1
- package/dist/body-replace-guards.d.ts +50 -0
- package/dist/body-replace-guards.d.ts.map +1 -0
- package/dist/body-replace-guards.js +158 -0
- package/dist/body-replace-guards.js.map +1 -0
- package/dist/builtin-recipes/content.d.ts +93 -0
- package/dist/builtin-recipes/content.d.ts.map +1 -0
- package/dist/builtin-recipes/content.js +288 -0
- package/dist/builtin-recipes/content.js.map +1 -0
- package/dist/builtin-recipes.d.ts +10 -0
- package/dist/builtin-recipes.d.ts.map +1 -0
- package/dist/builtin-recipes.js +97 -0
- package/dist/builtin-recipes.js.map +1 -0
- package/dist/bundle-health/index.d.ts +14 -0
- package/dist/bundle-health/index.d.ts.map +1 -0
- package/dist/bundle-health/index.js +12 -0
- package/dist/bundle-health/index.js.map +1 -0
- package/dist/bundle-health/kind-findings.d.ts +44 -0
- package/dist/bundle-health/kind-findings.d.ts.map +1 -0
- package/dist/bundle-health/kind-findings.js +68 -0
- package/dist/bundle-health/kind-findings.js.map +1 -0
- package/dist/bundle-health/legacy-page.d.ts +39 -0
- package/dist/bundle-health/legacy-page.d.ts.map +1 -0
- package/dist/bundle-health/legacy-page.js +50 -0
- package/dist/bundle-health/legacy-page.js.map +1 -0
- package/dist/bundle-health/report.d.ts +202 -0
- package/dist/bundle-health/report.d.ts.map +1 -0
- package/dist/bundle-health/report.js +438 -0
- package/dist/bundle-health/report.js.map +1 -0
- package/dist/code-point-order.d.ts +8 -0
- package/dist/code-point-order.d.ts.map +1 -0
- package/dist/code-point-order.js +20 -0
- package/dist/code-point-order.js.map +1 -0
- package/dist/connectors.d.ts +223 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +1143 -0
- package/dist/connectors.js.map +1 -0
- package/dist/document-field-actions.d.ts +18 -0
- package/dist/document-field-actions.d.ts.map +1 -1
- package/dist/document-field-actions.js +91 -29
- package/dist/document-field-actions.js.map +1 -1
- package/dist/document-mutation.d.ts +7 -9
- package/dist/document-mutation.d.ts.map +1 -1
- package/dist/document-mutation.js +16 -16
- package/dist/document-mutation.js.map +1 -1
- package/dist/file-journaled-backend.d.ts +31 -5
- package/dist/file-journaled-backend.d.ts.map +1 -1
- package/dist/file-journaled-backend.js +131 -118
- package/dist/file-journaled-backend.js.map +1 -1
- package/dist/hosted-client/blob-delivery.d.ts +6 -0
- package/dist/hosted-client/blob-delivery.d.ts.map +1 -1
- package/dist/hosted-client/blob-delivery.js +23 -1
- package/dist/hosted-client/blob-delivery.js.map +1 -1
- package/dist/hosted-client/blob-write.d.ts +386 -0
- package/dist/hosted-client/blob-write.d.ts.map +1 -0
- package/dist/hosted-client/blob-write.js +770 -0
- package/dist/hosted-client/blob-write.js.map +1 -0
- package/dist/hosted-client/client.d.ts +64 -0
- package/dist/hosted-client/client.d.ts.map +1 -1
- package/dist/hosted-client/client.js +31 -0
- package/dist/hosted-client/client.js.map +1 -1
- package/dist/hosted-client/directory.d.ts +46 -0
- package/dist/hosted-client/directory.d.ts.map +1 -0
- package/dist/hosted-client/directory.js +74 -0
- package/dist/hosted-client/directory.js.map +1 -0
- package/dist/hosted-client/errors.d.ts +10 -0
- package/dist/hosted-client/errors.d.ts.map +1 -1
- package/dist/hosted-client/errors.js +13 -0
- package/dist/hosted-client/errors.js.map +1 -1
- package/dist/hosted-client/inbox.d.ts +320 -0
- package/dist/hosted-client/inbox.d.ts.map +1 -0
- package/dist/hosted-client/inbox.js +379 -0
- package/dist/hosted-client/inbox.js.map +1 -0
- package/dist/hosted-client/index.d.ts +11 -4
- package/dist/hosted-client/index.d.ts.map +1 -1
- package/dist/hosted-client/index.js +11 -4
- package/dist/hosted-client/index.js.map +1 -1
- package/dist/hosted-client/journal.d.ts +103 -0
- package/dist/hosted-client/journal.d.ts.map +1 -0
- package/dist/hosted-client/journal.js +464 -0
- package/dist/hosted-client/journal.js.map +1 -0
- package/dist/hosted-client/node.d.ts +5 -1
- package/dist/hosted-client/node.d.ts.map +1 -1
- package/dist/hosted-client/node.js +6 -1
- package/dist/hosted-client/node.js.map +1 -1
- package/dist/hosted-client/write.d.ts +28 -2
- package/dist/hosted-client/write.d.ts.map +1 -1
- package/dist/hosted-client/write.js +33 -11
- package/dist/hosted-client/write.js.map +1 -1
- package/dist/hosted-transport/answer-rows.d.ts +3 -2
- package/dist/hosted-transport/answer-rows.d.ts.map +1 -1
- package/dist/hosted-transport/answer-rows.js +1 -1
- package/dist/hosted-transport/answer-rows.js.map +1 -1
- package/dist/hosted-transport/carrier.d.ts +10 -0
- package/dist/hosted-transport/carrier.d.ts.map +1 -1
- package/dist/hosted-transport/carrier.js +22 -2
- package/dist/hosted-transport/carrier.js.map +1 -1
- package/dist/hosted-transport/whole-document-transport.d.ts +1 -1
- package/dist/hosted-transport/whole-document-transport.d.ts.map +1 -1
- package/dist/hosted-transport/whole-document-transport.js +20 -12
- package/dist/hosted-transport/whole-document-transport.js.map +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/kind-authoring.d.ts +170 -0
- package/dist/kind-authoring.d.ts.map +1 -0
- package/dist/kind-authoring.js +451 -0
- package/dist/kind-authoring.js.map +1 -0
- package/dist/kind-conformance-error.d.ts +15 -0
- package/dist/kind-conformance-error.d.ts.map +1 -0
- package/dist/kind-conformance-error.js +20 -0
- package/dist/kind-conformance-error.js.map +1 -0
- package/dist/kinds-load.js +4 -4
- package/dist/kinds-load.js.map +1 -1
- package/dist/kinds.d.ts +2 -0
- package/dist/kinds.d.ts.map +1 -1
- package/dist/kinds.js +10 -2
- package/dist/kinds.js.map +1 -1
- package/dist/paths.d.ts +16 -0
- package/dist/paths.d.ts.map +1 -1
- package/dist/paths.js +25 -0
- package/dist/paths.js.map +1 -1
- package/dist/query-filter.d.ts +9 -0
- package/dist/query-filter.d.ts.map +1 -1
- package/dist/query-filter.js +19 -3
- package/dist/query-filter.js.map +1 -1
- package/dist/recipe-lifecycle/stamp.d.ts +11 -0
- package/dist/recipe-lifecycle/stamp.d.ts.map +1 -1
- package/dist/recipe-lifecycle/stamp.js +6 -0
- package/dist/recipe-lifecycle/stamp.js.map +1 -1
- package/dist/record-overlay/apply.d.ts +43 -0
- package/dist/record-overlay/apply.d.ts.map +1 -0
- package/dist/record-overlay/apply.js +527 -0
- package/dist/record-overlay/apply.js.map +1 -0
- package/dist/record-overlay/canonical.d.ts +22 -0
- package/dist/record-overlay/canonical.d.ts.map +1 -0
- package/dist/record-overlay/canonical.js +47 -0
- package/dist/record-overlay/canonical.js.map +1 -0
- package/dist/record-overlay/digest.d.ts +4 -0
- package/dist/record-overlay/digest.d.ts.map +1 -0
- package/dist/record-overlay/digest.js +11 -0
- package/dist/record-overlay/digest.js.map +1 -0
- package/dist/record-overlay/errors.d.ts +44 -0
- package/dist/record-overlay/errors.d.ts.map +1 -0
- package/dist/record-overlay/errors.js +55 -0
- package/dist/record-overlay/errors.js.map +1 -0
- package/dist/record-overlay/findings.d.ts +5 -0
- package/dist/record-overlay/findings.d.ts.map +1 -0
- package/dist/record-overlay/findings.js +83 -0
- package/dist/record-overlay/findings.js.map +1 -0
- package/dist/record-overlay/index.d.ts +23 -0
- package/dist/record-overlay/index.d.ts.map +1 -0
- package/dist/record-overlay/index.js +21 -0
- package/dist/record-overlay/index.js.map +1 -0
- package/dist/record-overlay/plan.d.ts +12 -0
- package/dist/record-overlay/plan.d.ts.map +1 -0
- package/dist/record-overlay/plan.js +285 -0
- package/dist/record-overlay/plan.js.map +1 -0
- package/dist/record-overlay/policy.d.ts +69 -0
- package/dist/record-overlay/policy.d.ts.map +1 -0
- package/dist/record-overlay/policy.js +228 -0
- package/dist/record-overlay/policy.js.map +1 -0
- package/dist/record-overlay/redact.d.ts +3 -0
- package/dist/record-overlay/redact.d.ts.map +1 -0
- package/dist/record-overlay/redact.js +27 -0
- package/dist/record-overlay/redact.js.map +1 -0
- package/dist/record-overlay/signal-kind.d.ts +30 -0
- package/dist/record-overlay/signal-kind.d.ts.map +1 -0
- package/dist/record-overlay/signal-kind.js +38 -0
- package/dist/record-overlay/signal-kind.js.map +1 -0
- package/dist/record-overlay/signal-text.d.ts +45 -0
- package/dist/record-overlay/signal-text.d.ts.map +1 -0
- package/dist/record-overlay/signal-text.js +116 -0
- package/dist/record-overlay/signal-text.js.map +1 -0
- package/dist/record-overlay/source-index.d.ts +19 -0
- package/dist/record-overlay/source-index.d.ts.map +1 -0
- package/dist/record-overlay/source-index.js +102 -0
- package/dist/record-overlay/source-index.js.map +1 -0
- package/dist/record-overlay/types.d.ts +291 -0
- package/dist/record-overlay/types.d.ts.map +1 -0
- package/dist/record-overlay/types.js +2 -0
- package/dist/record-overlay/types.js.map +1 -0
- package/dist/remote-operations.js +5 -2
- package/dist/remote-operations.js.map +1 -1
- package/dist/search/contract.d.ts +151 -0
- package/dist/search/contract.d.ts.map +1 -0
- package/dist/search/contract.js +78 -0
- package/dist/search/contract.js.map +1 -0
- package/dist/search/errors.d.ts +30 -0
- package/dist/search/errors.d.ts.map +1 -0
- package/dist/search/errors.js +50 -0
- package/dist/search/errors.js.map +1 -0
- package/dist/search/identity.d.ts +12 -0
- package/dist/search/identity.d.ts.map +1 -0
- package/dist/search/identity.js +90 -0
- package/dist/search/identity.js.map +1 -0
- package/dist/search/index.d.ts +15 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +14 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/memory-source.d.ts +25 -0
- package/dist/search/memory-source.d.ts.map +1 -0
- package/dist/search/memory-source.js +230 -0
- package/dist/search/memory-source.js.map +1 -0
- package/dist/search/rank.d.ts +34 -0
- package/dist/search/rank.d.ts.map +1 -0
- package/dist/search/rank.js +129 -0
- package/dist/search/rank.js.map +1 -0
- package/dist/search/row-text.d.ts +38 -0
- package/dist/search/row-text.d.ts.map +1 -0
- package/dist/search/row-text.js +88 -0
- package/dist/search/row-text.js.map +1 -0
- package/dist/search/search.d.ts +28 -0
- package/dist/search/search.d.ts.map +1 -0
- package/dist/search/search.js +240 -0
- package/dist/search/search.js.map +1 -0
- package/dist/search/source.d.ts +67 -0
- package/dist/search/source.d.ts.map +1 -0
- package/dist/search/source.js +2 -0
- package/dist/search/source.js.map +1 -0
- package/dist/search/text.d.ts +47 -0
- package/dist/search/text.d.ts.map +1 -0
- package/dist/search/text.js +148 -0
- package/dist/search/text.js.map +1 -0
- package/dist/source-engine/guard.d.ts +82 -0
- package/dist/source-engine/guard.d.ts.map +1 -0
- package/dist/source-engine/guard.js +396 -0
- package/dist/source-engine/guard.js.map +1 -0
- package/dist/source-engine/index.d.ts +24 -0
- package/dist/source-engine/index.d.ts.map +1 -0
- package/dist/source-engine/index.js +20 -0
- package/dist/source-engine/index.js.map +1 -0
- package/dist/source-engine/machine-state.d.ts +74 -0
- package/dist/source-engine/machine-state.d.ts.map +1 -0
- package/dist/source-engine/machine-state.js +48 -0
- package/dist/source-engine/machine-state.js.map +1 -0
- package/dist/source-engine/observe.d.ts +18 -0
- package/dist/source-engine/observe.d.ts.map +1 -0
- package/dist/source-engine/observe.js +598 -0
- package/dist/source-engine/observe.js.map +1 -0
- package/dist/source-engine/robots.d.ts +53 -0
- package/dist/source-engine/robots.d.ts.map +1 -0
- package/dist/source-engine/robots.js +158 -0
- package/dist/source-engine/robots.js.map +1 -0
- package/dist/source-engine/types.d.ts +285 -0
- package/dist/source-engine/types.d.ts.map +1 -0
- package/dist/source-engine/types.js +2 -0
- package/dist/source-engine/types.js.map +1 -0
- package/dist/source-harness/conformance.d.ts +16 -0
- package/dist/source-harness/conformance.d.ts.map +1 -0
- package/dist/source-harness/conformance.js +265 -0
- package/dist/source-harness/conformance.js.map +1 -0
- package/dist/source-harness/fixture.d.ts +95 -0
- package/dist/source-harness/fixture.d.ts.map +1 -0
- package/dist/source-harness/fixture.js +261 -0
- package/dist/source-harness/fixture.js.map +1 -0
- package/dist/source-harness/index.d.ts +22 -0
- package/dist/source-harness/index.d.ts.map +1 -0
- package/dist/source-harness/index.js +19 -0
- package/dist/source-harness/index.js.map +1 -0
- package/dist/source-harness/peer.d.ts +74 -0
- package/dist/source-harness/peer.d.ts.map +1 -0
- package/dist/source-harness/peer.js +106 -0
- package/dist/source-harness/peer.js.map +1 -0
- package/dist/storage.d.ts +2 -1
- package/dist/storage.d.ts.map +1 -1
- package/dist/storage.js +1 -1
- package/dist/storage.js.map +1 -1
- package/dist/uncertain-write.d.ts +39 -6
- package/dist/uncertain-write.d.ts.map +1 -1
- package/dist/uncertain-write.js +25 -3
- package/dist/uncertain-write.js.map +1 -1
- package/package.json +33 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../src/search/source.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEvF,qGAAqG;AACrG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;0CACsC;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE;QAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,kBAAkB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CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC;CACtH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.js","sourceRoot":"","sources":["../../src/search/source.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search text rules, one owner: normalization, tokenization, the body scanner that keeps original
|
|
3
|
+
* byte offsets, query normalization and the automatic fallback's relaxation, plus the UTF-8 helpers
|
|
4
|
+
* excerpts need. Moved unchanged from portal-webmcp 0.3.1 (`search.ts`, `text.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export declare function utf8(value: string): Uint8Array;
|
|
7
|
+
export declare function utf8ByteLength(value: string): number;
|
|
8
|
+
/**
|
|
9
|
+
* Move an index forward until it starts a UTF-8 sequence. A slice that begins on
|
|
10
|
+
* a continuation byte would decode to a replacement character, so continuations
|
|
11
|
+
* are skipped rather than replaced.
|
|
12
|
+
*/
|
|
13
|
+
export declare function forwardBoundary(bytes: Uint8Array, index: number): number;
|
|
14
|
+
/** Move an index backward until it ends a complete UTF-8 sequence. */
|
|
15
|
+
export declare function backwardBoundary(bytes: Uint8Array, index: number): number;
|
|
16
|
+
export declare function decodeUtf8(bytes: Uint8Array, start: number, end: number): string;
|
|
17
|
+
/** Collapse every maximal whitespace run to one ASCII space and trim both ends. */
|
|
18
|
+
export declare function collapseWhitespace(value: string): string;
|
|
19
|
+
/** Locale-independent normalization: Unicode NFKC then `toLowerCase()`. */
|
|
20
|
+
export declare function normalize(value: string): string;
|
|
21
|
+
/** Tokenization into maximal Unicode letter-or-number sequences of the normalized text. */
|
|
22
|
+
export declare function tokenize(value: string): string[];
|
|
23
|
+
/** A field's normalized phrase is its tokens joined by one ASCII space. */
|
|
24
|
+
export declare function phrase(value: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Visits every body token in document order with the original UTF-8 byte range of the run that
|
|
27
|
+
* produced it (every token of one run shares its range). `visit` returns `true` to stop the scan.
|
|
28
|
+
* The in-memory index and the excerpt both read the body through this one scanner, so a match's
|
|
29
|
+
* offsets are the same wherever they are computed.
|
|
30
|
+
*/
|
|
31
|
+
export declare function scanBody(body: string, visit: (term: string, start: number, end: number) => boolean | void): void;
|
|
32
|
+
export interface NormalizedQueryV1 {
|
|
33
|
+
readonly phrase: string;
|
|
34
|
+
readonly terms: readonly string[];
|
|
35
|
+
}
|
|
36
|
+
/** Duplicate query tokens collapse after their first occurrence; the phrase is the remainder. */
|
|
37
|
+
export declare function normalizeQuery(query: string): NormalizedQueryV1;
|
|
38
|
+
export interface RelaxedQueryV1 {
|
|
39
|
+
readonly query: NormalizedQueryV1;
|
|
40
|
+
readonly ignoredTerms: readonly string[];
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Removes fixed conversational terms for automatic any-term fallback. If that
|
|
44
|
+
* would remove the whole query, the original normalized query stays intact.
|
|
45
|
+
*/
|
|
46
|
+
export declare function relaxQuery(query: NormalizedQueryV1): RelaxedQueryV1;
|
|
47
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/search/text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAE9C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEpD;AAMD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIxE;AAED,sEAAsE;AACtE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIzE;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhF;AAED,mFAAmF;AACnF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAMD,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,2FAA2F;AAC3F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAEhD;AAED,2EAA2E;AAC3E,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C;AAsBD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,GAAG,IAAI,CA0BhH;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CACnC;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,iBAAiB,CAS/D;AAYD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,iBAAiB,GAAG,cAAc,CAQnE"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search text rules, one owner: normalization, tokenization, the body scanner that keeps original
|
|
3
|
+
* byte offsets, query normalization and the automatic fallback's relaxation, plus the UTF-8 helpers
|
|
4
|
+
* excerpts need. Moved unchanged from portal-webmcp 0.3.1 (`search.ts`, `text.ts`).
|
|
5
|
+
*/
|
|
6
|
+
const encoder = new TextEncoder();
|
|
7
|
+
const decoder = new TextDecoder("utf-8", { fatal: false, ignoreBOM: false });
|
|
8
|
+
export function utf8(value) {
|
|
9
|
+
return encoder.encode(value);
|
|
10
|
+
}
|
|
11
|
+
export function utf8ByteLength(value) {
|
|
12
|
+
return encoder.encode(value).byteLength;
|
|
13
|
+
}
|
|
14
|
+
function continuation(byte) {
|
|
15
|
+
return byte !== undefined && (byte & 0b1100_0000) === 0b1000_0000;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Move an index forward until it starts a UTF-8 sequence. A slice that begins on
|
|
19
|
+
* a continuation byte would decode to a replacement character, so continuations
|
|
20
|
+
* are skipped rather than replaced.
|
|
21
|
+
*/
|
|
22
|
+
export function forwardBoundary(bytes, index) {
|
|
23
|
+
let cursor = Math.max(0, Math.min(index, bytes.byteLength));
|
|
24
|
+
while (cursor < bytes.byteLength && continuation(bytes[cursor]))
|
|
25
|
+
cursor += 1;
|
|
26
|
+
return cursor;
|
|
27
|
+
}
|
|
28
|
+
/** Move an index backward until it ends a complete UTF-8 sequence. */
|
|
29
|
+
export function backwardBoundary(bytes, index) {
|
|
30
|
+
let cursor = Math.max(0, Math.min(index, bytes.byteLength));
|
|
31
|
+
while (cursor > 0 && continuation(bytes[cursor]))
|
|
32
|
+
cursor -= 1;
|
|
33
|
+
return cursor;
|
|
34
|
+
}
|
|
35
|
+
export function decodeUtf8(bytes, start, end) {
|
|
36
|
+
return decoder.decode(bytes.subarray(start, end));
|
|
37
|
+
}
|
|
38
|
+
/** Collapse every maximal whitespace run to one ASCII space and trim both ends. */
|
|
39
|
+
export function collapseWhitespace(value) {
|
|
40
|
+
return value.replace(/\s+/gu, " ").trim();
|
|
41
|
+
}
|
|
42
|
+
const TOKEN = /[\p{L}\p{N}]+/gu;
|
|
43
|
+
const LETTER_OR_NUMBER = /[\p{L}\p{N}]/u;
|
|
44
|
+
const MARK = /\p{M}/u;
|
|
45
|
+
/** Locale-independent normalization: Unicode NFKC then `toLowerCase()`. */
|
|
46
|
+
export function normalize(value) {
|
|
47
|
+
return value.normalize("NFKC").toLowerCase();
|
|
48
|
+
}
|
|
49
|
+
/** Tokenization into maximal Unicode letter-or-number sequences of the normalized text. */
|
|
50
|
+
export function tokenize(value) {
|
|
51
|
+
return [...normalize(value).matchAll(TOKEN)].map((match) => match[0]);
|
|
52
|
+
}
|
|
53
|
+
/** A field's normalized phrase is its tokens joined by one ASCII space. */
|
|
54
|
+
export function phrase(value) {
|
|
55
|
+
return tokenize(value).join(" ");
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Whether an original character can belong to a token run.
|
|
59
|
+
*
|
|
60
|
+
* Body tokens must keep original byte offsets, so the body is segmented before
|
|
61
|
+
* normalization rather than after. A character joins a run when it is a letter
|
|
62
|
+
* or number, a combining mark (so a decomposed sequence composes inside its own
|
|
63
|
+
* run), or a compatibility character whose NFKC form contains a letter or
|
|
64
|
+
* number. NFKC never composes across a character outside that set, so run-wise
|
|
65
|
+
* tokenization yields the same terms as tokenizing the whole normalized field.
|
|
66
|
+
*/
|
|
67
|
+
const runMembership = new Map();
|
|
68
|
+
function inTokenRun(character) {
|
|
69
|
+
const cached = runMembership.get(character);
|
|
70
|
+
if (cached !== undefined)
|
|
71
|
+
return cached;
|
|
72
|
+
const member = LETTER_OR_NUMBER.test(character) || MARK.test(character) || LETTER_OR_NUMBER.test(character.normalize("NFKC"));
|
|
73
|
+
runMembership.set(character, member);
|
|
74
|
+
return member;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Visits every body token in document order with the original UTF-8 byte range of the run that
|
|
78
|
+
* produced it (every token of one run shares its range). `visit` returns `true` to stop the scan.
|
|
79
|
+
* The in-memory index and the excerpt both read the body through this one scanner, so a match's
|
|
80
|
+
* offsets are the same wherever they are computed.
|
|
81
|
+
*/
|
|
82
|
+
export function scanBody(body, visit) {
|
|
83
|
+
let byteOffset = 0;
|
|
84
|
+
let runStart = 0;
|
|
85
|
+
let run = "";
|
|
86
|
+
let stopped = false;
|
|
87
|
+
const flush = () => {
|
|
88
|
+
if (run.length === 0)
|
|
89
|
+
return;
|
|
90
|
+
for (const match of normalize(run).matchAll(TOKEN)) {
|
|
91
|
+
if (visit(match[0], runStart, byteOffset) === true) {
|
|
92
|
+
stopped = true;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
run = "";
|
|
97
|
+
};
|
|
98
|
+
for (const character of body) {
|
|
99
|
+
if (inTokenRun(character)) {
|
|
100
|
+
if (run.length === 0)
|
|
101
|
+
runStart = byteOffset;
|
|
102
|
+
run += character;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
flush();
|
|
106
|
+
if (stopped)
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
byteOffset += utf8(character).byteLength;
|
|
110
|
+
}
|
|
111
|
+
flush();
|
|
112
|
+
}
|
|
113
|
+
/** Duplicate query tokens collapse after their first occurrence; the phrase is the remainder. */
|
|
114
|
+
export function normalizeQuery(query) {
|
|
115
|
+
const terms = [];
|
|
116
|
+
const seen = new Set();
|
|
117
|
+
for (const token of tokenize(query)) {
|
|
118
|
+
if (seen.has(token))
|
|
119
|
+
continue;
|
|
120
|
+
seen.add(token);
|
|
121
|
+
terms.push(token);
|
|
122
|
+
}
|
|
123
|
+
return { phrase: terms.join(" "), terms: Object.freeze(terms) };
|
|
124
|
+
}
|
|
125
|
+
// Fixed package text, deliberately not locale-sensitive. These words carry
|
|
126
|
+
// little retrieval signal in ordinary English questions. They are removed only
|
|
127
|
+
// by the automatic fallback, never by explicit `all` or `any` matching.
|
|
128
|
+
// prettier-ignore
|
|
129
|
+
const CONVERSATIONAL_TERMS = new Set([
|
|
130
|
+
"a", "an", "and", "are", "as", "at", "be", "by", "can", "did", "do", "does",
|
|
131
|
+
"for", "from", "how", "in", "is", "it", "of", "on", "or", "should", "that", "the",
|
|
132
|
+
"this", "to", "was", "what", "when", "where", "which", "who", "why", "will", "with",
|
|
133
|
+
]);
|
|
134
|
+
/**
|
|
135
|
+
* Removes fixed conversational terms for automatic any-term fallback. If that
|
|
136
|
+
* would remove the whole query, the original normalized query stays intact.
|
|
137
|
+
*/
|
|
138
|
+
export function relaxQuery(query) {
|
|
139
|
+
const terms = query.terms.filter((term) => !CONVERSATIONAL_TERMS.has(term));
|
|
140
|
+
if (terms.length === 0)
|
|
141
|
+
return { query, ignoredTerms: Object.freeze([]) };
|
|
142
|
+
const kept = new Set(terms);
|
|
143
|
+
return {
|
|
144
|
+
query: { phrase: terms.join(" "), terms: Object.freeze(terms) },
|
|
145
|
+
ignoredTerms: Object.freeze(query.terms.filter((term) => !kept.has(term))),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.js","sourceRoot":"","sources":["../../src/search/text.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,MAAM,OAAO,GAAG,IAAI,WAAW,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;AAE7E,MAAM,UAAU,IAAI,CAAC,KAAa;IAChC,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,KAAa;IAC1C,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,UAAU,CAAC;AAC1C,CAAC;AAED,SAAS,YAAY,CAAC,IAAwB;IAC5C,OAAO,IAAI,KAAK,SAAS,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC,KAAK,WAAW,CAAC;AACpE,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAiB,EAAE,KAAa;IAC9D,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU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AE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM;IAC3E,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK;IACjF,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM;CACpF,CAAC,CAAC;AAOH;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,KAAwB;IACjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC;IAC1E,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO;QACL,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE;QAC/D,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC;KAC3E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The guarded transport a profile sees. It checks every URL and every redirect hop against the
|
|
3
|
+
* run's host set (the profile's hosts within the connector's credential hosts and keyless domains)
|
|
4
|
+
* and the address rule, reads and follows robots.txt for keyless hosts, applies the method rule and
|
|
5
|
+
* the header allowlist, follows redirects itself with the guard re-run per hop, counts the request
|
|
6
|
+
* budget, honours the deadline and maps statuses to outcomes. Any refusal or error status stops
|
|
7
|
+
* the run: the call throws and the stop is recorded here, so a profile cannot swallow it.
|
|
8
|
+
*/
|
|
9
|
+
import { type Connector } from "../connectors.js";
|
|
10
|
+
import { type FetchIdentity } from "./robots.js";
|
|
11
|
+
import type { ProfileTransport, RequestRules, SourceBudget, SourceOutcome, SourceRequestRow, StatusRules, Transport } from "./types.js";
|
|
12
|
+
export declare const DEFAULT_SOURCE_BUDGET: Readonly<SourceBudget>;
|
|
13
|
+
/**
|
|
14
|
+
* The engine's status sets. 503 is not deferred: it ends `provider_unavailable` with a retry and
|
|
15
|
+
* any `retry_after`; a declaration's `errors` rows pass their own sets.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DEFAULT_STATUS_RULES: Readonly<StatusRules>;
|
|
18
|
+
/** Why a run stopped. */
|
|
19
|
+
export interface Stop {
|
|
20
|
+
outcome: SourceOutcome;
|
|
21
|
+
reason?: string;
|
|
22
|
+
detail?: string;
|
|
23
|
+
status?: number;
|
|
24
|
+
retry: boolean;
|
|
25
|
+
retry_after?: string;
|
|
26
|
+
}
|
|
27
|
+
/** Thrown through a profile when the run stops. */
|
|
28
|
+
export declare class SourceStop extends Error {
|
|
29
|
+
readonly stop: Stop;
|
|
30
|
+
constructor(stop: Stop);
|
|
31
|
+
}
|
|
32
|
+
export interface HostSet {
|
|
33
|
+
/** Every host a request may reach. */
|
|
34
|
+
allowed: ReadonlySet<string>;
|
|
35
|
+
/** Hosts a transport may send the credential to. */
|
|
36
|
+
credential: ReadonlySet<string>;
|
|
37
|
+
/** Keyless hosts: the robots.txt gate applies. */
|
|
38
|
+
keyless: ReadonlySet<string>;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The run's host set: the profile's hosts, each of which must be a credential host of the auth
|
|
42
|
+
* kind or a declared keyless domain. A host outside both is returned as undeclared.
|
|
43
|
+
*/
|
|
44
|
+
export declare function sourceHostSet(connector: Pick<Connector, "auth" | "domains">, hosts: readonly string[]): {
|
|
45
|
+
ok: true;
|
|
46
|
+
hosts: HostSet;
|
|
47
|
+
} | {
|
|
48
|
+
ok: false;
|
|
49
|
+
undeclared: string[];
|
|
50
|
+
};
|
|
51
|
+
export interface GuardContext {
|
|
52
|
+
hosts: HostSet;
|
|
53
|
+
transport: Transport;
|
|
54
|
+
identity: FetchIdentity;
|
|
55
|
+
budget: SourceBudget;
|
|
56
|
+
rules: RequestRules;
|
|
57
|
+
statuses: StatusRules;
|
|
58
|
+
now: () => Date;
|
|
59
|
+
/**
|
|
60
|
+
* Whether a request may be conditional. A complete observation must read the whole listing, so
|
|
61
|
+
* it sends no validator and a not-modified answer stops it.
|
|
62
|
+
*/
|
|
63
|
+
conditional: boolean;
|
|
64
|
+
signal?: AbortSignal;
|
|
65
|
+
/** Each request's own timeout. */
|
|
66
|
+
requestTimeoutMs?: number;
|
|
67
|
+
}
|
|
68
|
+
export interface GuardedTransport {
|
|
69
|
+
transport: ProfileTransport;
|
|
70
|
+
/** Every request, sent or refused, in order. */
|
|
71
|
+
requests: SourceRequestRow[];
|
|
72
|
+
/** The first stop, if any. */
|
|
73
|
+
stopped(): Stop | undefined;
|
|
74
|
+
/** Requests left in the run. */
|
|
75
|
+
remaining(): number;
|
|
76
|
+
/** End the run: every later request throws, from a reference the profile kept or not. */
|
|
77
|
+
close(): void;
|
|
78
|
+
}
|
|
79
|
+
/** `promise`, or a rejection once `signal` aborts; the abandoned promise's later failure is ignored. */
|
|
80
|
+
export declare function raceAbort<T>(promise: Promise<T>, signal: AbortSignal | undefined): Promise<T>;
|
|
81
|
+
export declare function guardTransport(ctx: GuardContext): GuardedTransport;
|
|
82
|
+
//# sourceMappingURL=guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"guard.d.ts","sourceRoot":"","sources":["../../src/source-engine/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