@mailwoman/core 2.0.6 → 2.2.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/out/api/APIClient.d.ts +57 -0
- package/out/api/APIClient.d.ts.map +1 -0
- package/out/api/APIClient.js +108 -0
- package/out/api/APIClient.js.map +1 -0
- package/out/api/headless.d.ts +17 -0
- package/out/api/headless.d.ts.map +1 -0
- package/out/api/headless.js +18 -0
- package/out/api/headless.js.map +1 -0
- package/out/api/index.d.ts +11 -0
- package/out/api/index.d.ts.map +1 -0
- package/out/api/index.js +11 -0
- package/out/api/index.js.map +1 -0
- package/out/api/responses.d.ts +48 -0
- package/out/api/responses.d.ts.map +1 -0
- package/out/api/responses.js +68 -0
- package/out/api/responses.js.map +1 -0
- package/out/collections.d.ts +66 -0
- package/out/collections.d.ts.map +1 -0
- package/out/collections.js +97 -0
- package/out/collections.js.map +1 -0
- package/out/db/schema.d.ts +21 -0
- package/out/db/schema.d.ts.map +1 -0
- package/out/db/schema.js +16 -0
- package/out/db/schema.js.map +1 -0
- package/out/decoder/build-tree.d.ts +14 -1
- package/out/decoder/build-tree.d.ts.map +1 -1
- package/out/decoder/build-tree.js +37 -9
- package/out/decoder/build-tree.js.map +1 -1
- package/out/decoder/proposals-to-tree.d.ts.map +1 -1
- package/out/decoder/proposals-to-tree.js +2 -0
- package/out/decoder/proposals-to-tree.js.map +1 -1
- package/out/decoder/serialize-xml.d.ts +22 -1
- package/out/decoder/serialize-xml.d.ts.map +1 -1
- package/out/decoder/serialize-xml.js +64 -4
- package/out/decoder/serialize-xml.js.map +1 -1
- package/out/decoder/types.d.ts +45 -0
- package/out/decoder/types.d.ts.map +1 -1
- package/out/decoder/types.js +6 -0
- package/out/decoder/types.js.map +1 -1
- package/out/errors/index.d.ts +9 -0
- package/out/errors/index.d.ts.map +1 -0
- package/out/errors/index.js +9 -0
- package/out/errors/index.js.map +1 -0
- package/out/errors/schema.d.ts +69 -0
- package/out/errors/schema.d.ts.map +1 -0
- package/out/errors/schema.js +102 -0
- package/out/errors/schema.js.map +1 -0
- package/out/identifiers.d.ts +18 -0
- package/out/identifiers.d.ts.map +1 -0
- package/out/identifiers.js +49 -0
- package/out/identifiers.js.map +1 -0
- package/out/index.d.ts +3 -0
- package/out/index.d.ts.map +1 -1
- package/out/index.js +3 -4
- package/out/index.js.map +1 -1
- package/out/kysley/adapter.d.ts +13 -0
- package/out/kysley/adapter.d.ts.map +1 -0
- package/out/kysley/adapter.js +25 -0
- package/out/kysley/adapter.js.map +1 -0
- package/out/kysley/client.d.ts +16 -0
- package/out/kysley/client.d.ts.map +1 -0
- package/out/kysley/client.js +22 -0
- package/out/kysley/client.js.map +1 -0
- package/out/kysley/dialect-config.d.ts +27 -0
- package/out/kysley/dialect-config.d.ts.map +1 -0
- package/out/kysley/dialect-config.js +7 -0
- package/out/kysley/dialect-config.js.map +1 -0
- package/out/kysley/dialect.d.ts +39 -0
- package/out/kysley/dialect.d.ts.map +1 -0
- package/out/kysley/dialect.js +49 -0
- package/out/kysley/dialect.js.map +1 -0
- package/out/kysley/driver.d.ts +22 -0
- package/out/kysley/driver.d.ts.map +1 -0
- package/out/kysley/driver.js +114 -0
- package/out/kysley/driver.js.map +1 -0
- package/out/lifecycle/ServiceSymbol.d.ts +59 -0
- package/out/lifecycle/ServiceSymbol.d.ts.map +1 -0
- package/out/lifecycle/ServiceSymbol.js +62 -0
- package/out/lifecycle/ServiceSymbol.js.map +1 -0
- package/out/lifecycle/index.d.ts +11 -0
- package/out/lifecycle/index.d.ts.map +1 -0
- package/out/lifecycle/index.js +11 -0
- package/out/lifecycle/index.js.map +1 -0
- package/out/lifecycle/lru-cache.d.ts +22 -0
- package/out/lifecycle/lru-cache.d.ts.map +1 -0
- package/out/lifecycle/lru-cache.js +31 -0
- package/out/lifecycle/lru-cache.js.map +1 -0
- package/out/lifecycle/services.d.ts +145 -0
- package/out/lifecycle/services.d.ts.map +1 -0
- package/out/lifecycle/services.js +190 -0
- package/out/lifecycle/services.js.map +1 -0
- package/out/logging/index.d.ts +7 -0
- package/out/logging/index.d.ts.map +1 -0
- package/out/logging/index.js +7 -0
- package/out/logging/index.js.map +1 -0
- package/out/logging/shared.d.ts +60 -0
- package/out/logging/shared.d.ts.map +1 -0
- package/out/logging/shared.js +100 -0
- package/out/logging/shared.js.map +1 -0
- package/out/logging/tables.d.ts +7 -0
- package/out/logging/tables.d.ts.map +1 -0
- package/out/logging/tables.js +75 -0
- package/out/logging/tables.js.map +1 -0
- package/out/objects.d.ts +96 -0
- package/out/objects.d.ts.map +1 -0
- package/out/objects.js +96 -0
- package/out/objects.js.map +1 -0
- package/out/parser/proposal-pipeline.d.ts.map +1 -1
- package/out/parser/proposal-pipeline.js +0 -1
- package/out/parser/proposal-pipeline.js.map +1 -1
- package/out/pipeline/index.d.ts +14 -0
- package/out/pipeline/index.d.ts.map +1 -0
- package/out/pipeline/index.js +11 -0
- package/out/pipeline/index.js.map +1 -0
- package/out/pipeline/reconcile.d.ts +135 -0
- package/out/pipeline/reconcile.d.ts.map +1 -0
- package/out/pipeline/reconcile.js +355 -0
- package/out/pipeline/reconcile.js.map +1 -0
- package/out/pipeline/runtime-pipeline.d.ts +29 -0
- package/out/pipeline/runtime-pipeline.d.ts.map +1 -0
- package/out/pipeline/runtime-pipeline.js +288 -0
- package/out/pipeline/runtime-pipeline.js.map +1 -0
- package/out/pipeline/span-logit-aggregation.d.ts +57 -0
- package/out/pipeline/span-logit-aggregation.d.ts.map +1 -0
- package/out/pipeline/span-logit-aggregation.js +105 -0
- package/out/pipeline/span-logit-aggregation.js.map +1 -0
- package/out/pipeline/types.d.ts +189 -0
- package/out/pipeline/types.d.ts.map +1 -0
- package/out/pipeline/types.js +16 -0
- package/out/pipeline/types.js.map +1 -0
- package/out/resolver/index.d.ts +9 -0
- package/out/resolver/index.d.ts.map +1 -0
- package/out/resolver/index.js +8 -0
- package/out/resolver/index.js.map +1 -0
- package/out/resolver/resolve.d.ts +21 -0
- package/out/resolver/resolve.d.ts.map +1 -0
- package/out/resolver/resolve.js +118 -0
- package/out/resolver/resolve.js.map +1 -0
- package/out/resolver/types.d.ts +118 -0
- package/out/resolver/types.d.ts.map +1 -0
- package/out/resolver/types.js +24 -0
- package/out/resolver/types.js.map +1 -0
- package/out/resources/git.d.ts +1 -1
- package/out/resources/index.d.ts +0 -1
- package/out/resources/index.d.ts.map +1 -1
- package/out/resources/index.js +0 -1
- package/out/resources/index.js.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts +0 -1
- package/out/resources/whosonfirst/DataSourceCache.d.ts.map +1 -1
- package/out/resources/whosonfirst/DataSourceCache.js +0 -1
- package/out/resources/whosonfirst/DataSourceCache.js.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts +2 -2
- package/out/resources/whosonfirst/PlacetypeDataSource.d.ts.map +1 -1
- package/out/resources/whosonfirst/PlacetypeDataSource.js +9 -6
- package/out/resources/whosonfirst/PlacetypeDataSource.js.map +1 -1
- package/out/routing/index.d.ts +67 -0
- package/out/routing/index.d.ts.map +1 -0
- package/out/routing/index.js +114 -0
- package/out/routing/index.js.map +1 -0
- package/out/sets.d.ts +2 -0
- package/out/sets.d.ts.map +1 -0
- package/out/sets.js +2 -0
- package/out/sets.js.map +1 -0
- package/package.json +28 -2
- package/out/resources/db/index.d.ts +0 -57
- package/out/resources/db/index.d.ts.map +0 -1
- package/out/resources/db/index.js +0 -57
- package/out/resources/db/index.js.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
// import * as Colorette from "colorette"
|
|
8
|
+
// import jsonColorizer from "json-colorizer"
|
|
9
|
+
// import { table, type TableUserConfig } from "table"
|
|
10
|
+
// /**
|
|
11
|
+
// * Options for formatting a JSON object as a table.
|
|
12
|
+
// *
|
|
13
|
+
// * @category Logging
|
|
14
|
+
// */
|
|
15
|
+
// export interface TableFormatOptions extends TableUserConfig {
|
|
16
|
+
// alphabetize?: boolean
|
|
17
|
+
// }
|
|
18
|
+
// export type TableDataEntry = [string | number, ...unknown[]]
|
|
19
|
+
// /**
|
|
20
|
+
// * Convert a JSON object to a loggable table.
|
|
21
|
+
// *
|
|
22
|
+
// * @category Logging
|
|
23
|
+
// */
|
|
24
|
+
// export function printJSONAsTable(json: object, options?: TableFormatOptions) {
|
|
25
|
+
// const entries = Object.entries(json)
|
|
26
|
+
// return printEntriesAsTable(entries, options)
|
|
27
|
+
// }
|
|
28
|
+
// /**
|
|
29
|
+
// * Convert a map of key-value pairs to a loggable table.
|
|
30
|
+
// *
|
|
31
|
+
// * @category Logging
|
|
32
|
+
// */
|
|
33
|
+
// export function printEntriesAsTable(
|
|
34
|
+
// dataRow: Iterable<TableDataEntry>,
|
|
35
|
+
// { alphabetize, ...options }: TableFormatOptions = {}
|
|
36
|
+
// ) {
|
|
37
|
+
// let formattedRows: unknown[][] = []
|
|
38
|
+
// for (const cells of dataRow) {
|
|
39
|
+
// if (cells.length === 0) continue
|
|
40
|
+
// const formattedRow: unknown[] = []
|
|
41
|
+
// if (cells.length === 1) {
|
|
42
|
+
// formattedRow.push(Colorette.bold(Colorette.bgRed(cells[0])))
|
|
43
|
+
// formattedRows.push(formattedRow)
|
|
44
|
+
// continue
|
|
45
|
+
// }
|
|
46
|
+
// if (cells.length === 2 && (typeof cells[1] === "undefined" || cells[1] === null)) {
|
|
47
|
+
// continue
|
|
48
|
+
// }
|
|
49
|
+
// formattedRow.push(Colorette.magenta(cells[0]))
|
|
50
|
+
// for (const cell of cells.slice(1)) {
|
|
51
|
+
// if (typeof cell === "undefined" || cell === null) continue
|
|
52
|
+
// if (Array.isArray(cell)) {
|
|
53
|
+
// formattedRow.push(Colorette.yellow(cell.join(", ")))
|
|
54
|
+
// } else if (typeof cell === "object") {
|
|
55
|
+
// formattedRow.push(jsonColorizer.colorize(cell))
|
|
56
|
+
// } else {
|
|
57
|
+
// formattedRow.push(Colorette.yellow(String(cell)))
|
|
58
|
+
// }
|
|
59
|
+
// }
|
|
60
|
+
// formattedRows.push(formattedRow)
|
|
61
|
+
// }
|
|
62
|
+
// // Table must have a consistent number of cells...
|
|
63
|
+
// const maxCells = Math.max(...formattedRows.map((row) => row.length))
|
|
64
|
+
// formattedRows = formattedRows.map((row) => {
|
|
65
|
+
// if (row.length < maxCells) {
|
|
66
|
+
// return [...row, ...new Array(maxCells - row.length).fill("")]
|
|
67
|
+
// }
|
|
68
|
+
// return row
|
|
69
|
+
// })
|
|
70
|
+
// if (alphabetize) {
|
|
71
|
+
// formattedRows = formattedRows.sort(([a], [b]) => String(a).localeCompare(String(b)))
|
|
72
|
+
// }
|
|
73
|
+
// return "\n" + table(formattedRows, options)
|
|
74
|
+
// }
|
|
75
|
+
//# sourceMappingURL=tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../logging/tables.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;AAEH,yCAAyC;AACzC,6CAA6C;AAC7C,sDAAsD;AAEtD,MAAM;AACN,sDAAsD;AACtD,KAAK;AACL,uBAAuB;AACvB,MAAM;AACN,gEAAgE;AAChE,yBAAyB;AACzB,IAAI;AAEJ,+DAA+D;AAE/D,MAAM;AACN,gDAAgD;AAChD,KAAK;AACL,uBAAuB;AACvB,MAAM;AACN,iFAAiF;AACjF,wCAAwC;AAExC,gDAAgD;AAChD,IAAI;AAEJ,MAAM;AACN,2DAA2D;AAC3D,KAAK;AACL,uBAAuB;AACvB,MAAM;AACN,uCAAuC;AACvC,sCAAsC;AACtC,wDAAwD;AACxD,MAAM;AACN,uCAAuC;AAEvC,kCAAkC;AAClC,qCAAqC;AAErC,uCAAuC;AAEvC,8BAA8B;AAC9B,kEAAkE;AAClE,sCAAsC;AACtC,cAAc;AACd,MAAM;AAEN,wFAAwF;AACxF,cAAc;AACd,MAAM;AAEN,mDAAmD;AAEnD,yCAAyC;AACzC,gEAAgE;AAEhE,gCAAgC;AAChC,2DAA2D;AAC3D,4CAA4C;AAC5C,sDAAsD;AACtD,cAAc;AACd,wDAAwD;AACxD,OAAO;AACP,MAAM;AAEN,qCAAqC;AACrC,KAAK;AAEL,sDAAsD;AACtD,wEAAwE;AACxE,gDAAgD;AAChD,iCAAiC;AACjC,mEAAmE;AACnE,MAAM;AAEN,eAAe;AACf,MAAM;AAEN,sBAAsB;AACtB,yFAAyF;AACzF,KAAK;AAEL,+CAA+C;AAC/C,IAAI"}
|
package/out/objects.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Utility functions for working with objects.
|
|
7
|
+
*/
|
|
8
|
+
import type { JsonObject } from "type-fest";
|
|
9
|
+
type SetLike<T> = {
|
|
10
|
+
has(value: T): boolean;
|
|
11
|
+
} | Iterable<T>;
|
|
12
|
+
/**
|
|
13
|
+
* Type-utility for extracting the string keys of an object.
|
|
14
|
+
*
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
export type StringKeyOf<O> = Extract<keyof O, string>;
|
|
18
|
+
/**
|
|
19
|
+
* @param input Source object.
|
|
20
|
+
* @param scalarEnum Unconstrained scalar enum whose values present in `input` will be used as keys,
|
|
21
|
+
* such as an enum-like object.
|
|
22
|
+
*
|
|
23
|
+
* @returns A subset of the source object with only properties present in `scalarEnum`.
|
|
24
|
+
*/
|
|
25
|
+
export declare function pick<O extends object, K extends string>(input: O, scalarEnum: Record<K, K>, transform?: (value: O[keyof O], key: keyof O, input: O) => never): Pick<O, StringKeyOf<O>>;
|
|
26
|
+
/**
|
|
27
|
+
* @param input Source object.
|
|
28
|
+
* @param setLike Set-like object whose members represent the subset of keys to pick.
|
|
29
|
+
*
|
|
30
|
+
* @returns A subset of the source object with only properties present in `scalarEnum`.
|
|
31
|
+
*/
|
|
32
|
+
export declare function pick<O extends object, K extends keyof O>(input: O, setLike: SetLike<K>, transform?: (value: O[keyof O], key: keyof O, input: O) => never): Pick<O, K>;
|
|
33
|
+
/**
|
|
34
|
+
* @param input Source object.
|
|
35
|
+
* @param scalarEnum Enum-like object whose members represent the subset of keys to pick.
|
|
36
|
+
*
|
|
37
|
+
* @returns A subset of the source object with only properties present in `scalarEnum`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function pick<O extends object, K extends keyof O>(input: O, scalarEnum: Record<K, K>, transform?: (value: O[keyof O], key: keyof O, input: O) => never): Pick<O, StringKeyOf<O>>;
|
|
40
|
+
/**
|
|
41
|
+
* @param input Source object.
|
|
42
|
+
* @param constraints Unconstrained iterable of keys to pick, such as in array or Map.
|
|
43
|
+
*
|
|
44
|
+
* @returns A subset of the source object with only properties present in `constraints`.
|
|
45
|
+
*/
|
|
46
|
+
export declare function pick<O extends object, K extends keyof O = StringKeyOf<O>>(input: O, constraints: Iterable<K>, transform?: (value: O[keyof O], key: keyof O, input: O) => never): Pick<O, K>;
|
|
47
|
+
/**
|
|
48
|
+
* @param input Source object.
|
|
49
|
+
* @param constraints Enum-like object whose members represent the subset of keys to pick.
|
|
50
|
+
*
|
|
51
|
+
* @returns A subset of the source object with only properties present in `constraints`.
|
|
52
|
+
*/
|
|
53
|
+
export declare function pick<O extends object, K extends keyof O = StringKeyOf<O>>(input: O, constraints: Record<K, K>, transform?: (value: O[keyof O], key: keyof O, input: O) => never): Pick<O, K>;
|
|
54
|
+
/**
|
|
55
|
+
* @param input Source object.
|
|
56
|
+
* @param keys Unconstrained iterable of keys to pick, such as in array or Map.
|
|
57
|
+
*
|
|
58
|
+
* @returns A subset of the source object with only properties present in `keys`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function pick<O extends object, K extends string>(input: O, keys: Iterable<K>, transform?: (value: O[keyof O], key: keyof O, input: O) => never): Pick<O, StringKeyOf<O>>;
|
|
61
|
+
/**
|
|
62
|
+
* Type-predicate for checking if a value appears to be a record, i.e. an object that is not an
|
|
63
|
+
* array.
|
|
64
|
+
*
|
|
65
|
+
* @category Type Guard
|
|
66
|
+
* @category Object
|
|
67
|
+
*/
|
|
68
|
+
export declare function isRecordLike(input: unknown): input is object;
|
|
69
|
+
/**
|
|
70
|
+
* Type-helper to remove nullability from an object's properties.
|
|
71
|
+
*
|
|
72
|
+
* @category Object
|
|
73
|
+
*/
|
|
74
|
+
export type NonNullableObject<T> = {
|
|
75
|
+
[P in keyof T]-?: NonNullable<T[P]>;
|
|
76
|
+
} & NonNullable<T>;
|
|
77
|
+
/**
|
|
78
|
+
* Given an object, returns a new object with all nullable properties removed.
|
|
79
|
+
*
|
|
80
|
+
* This is useful for cleaning up objects before serializing them to JSON.
|
|
81
|
+
*
|
|
82
|
+
* @category Object
|
|
83
|
+
*/
|
|
84
|
+
export declare function omitNullable<T extends object>(input: T): NonNullableObject<T>;
|
|
85
|
+
/**
|
|
86
|
+
* Given serialized JSON, attempt to parse it.
|
|
87
|
+
*/
|
|
88
|
+
export declare function tryParsingJSON<T = unknown>(input: unknown, fallback?: undefined): T | undefined;
|
|
89
|
+
export declare function tryParsingJSON<T = unknown>(input: unknown, fallback: null): T | null;
|
|
90
|
+
export type FlattenObjectKeys<T extends JsonObject, Key = keyof T> = Key extends string ? T[Key] extends JsonObject ? `${Key}.${FlattenObjectKeys<T[Key]>}` : `${Key}` : never;
|
|
91
|
+
/**
|
|
92
|
+
* Flattens an object into a single-level object with dot-separated keys.
|
|
93
|
+
*/
|
|
94
|
+
export declare function flattenObject<T extends JsonObject>(obj: T, prefix?: string[], current?: Record<string, unknown>): Record<FlattenObjectKeys<T>, unknown>;
|
|
95
|
+
export {};
|
|
96
|
+
//# sourceMappingURL=objects.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.d.ts","sourceRoot":"","sources":["../objects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C,CAcvC"}
|
package/out/objects.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Utility functions for working with objects.
|
|
7
|
+
*/
|
|
8
|
+
import { isIterable } from "./collections.js";
|
|
9
|
+
/**
|
|
10
|
+
* @param input Source object.
|
|
11
|
+
* @param constraints Unconstrained iterable of keys to pick, such as in array or Map.
|
|
12
|
+
*
|
|
13
|
+
* @returns A subset of the source object with only properties present in `constraints`.
|
|
14
|
+
*/
|
|
15
|
+
export function pick(input, constraints, transform) {
|
|
16
|
+
const picked = {};
|
|
17
|
+
if (!input)
|
|
18
|
+
return picked;
|
|
19
|
+
if (!constraints)
|
|
20
|
+
return input;
|
|
21
|
+
const keys = isIterable(constraints) ? Array.from(constraints) : Object.values(constraints);
|
|
22
|
+
for (const key of keys) {
|
|
23
|
+
const value = input[key];
|
|
24
|
+
picked[key] = transform ? transform(value, key, input) : value;
|
|
25
|
+
}
|
|
26
|
+
return picked;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Type-predicate for checking if a value appears to be a record, i.e. an object that is not an
|
|
30
|
+
* array.
|
|
31
|
+
*
|
|
32
|
+
* @category Type Guard
|
|
33
|
+
* @category Object
|
|
34
|
+
*/
|
|
35
|
+
export function isRecordLike(input) {
|
|
36
|
+
return typeof input === "object" && input !== null && !Array.isArray(input);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Given an object, returns a new object with all nullable properties removed.
|
|
40
|
+
*
|
|
41
|
+
* This is useful for cleaning up objects before serializing them to JSON.
|
|
42
|
+
*
|
|
43
|
+
* @category Object
|
|
44
|
+
*/
|
|
45
|
+
export function omitNullable(input) {
|
|
46
|
+
const result = {};
|
|
47
|
+
for (const [key, currentValue] of Object.entries(input)) {
|
|
48
|
+
if (isRecordLike(currentValue)) {
|
|
49
|
+
const childResult = omitNullable(currentValue);
|
|
50
|
+
if (Object.keys(childResult).length > 0) {
|
|
51
|
+
result[key] = childResult;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
else if (Array.isArray(currentValue)) {
|
|
55
|
+
const arr = currentValue
|
|
56
|
+
.map((entryValue) => (isRecordLike(entryValue) ? omitNullable(entryValue) : entryValue))
|
|
57
|
+
.filter((val) => val != null);
|
|
58
|
+
if (arr.length > 0) {
|
|
59
|
+
result[key] = arr;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
else if (currentValue !== null) {
|
|
63
|
+
result[key] = currentValue;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
export function tryParsingJSON(input, fallback) {
|
|
69
|
+
if (typeof input !== "string")
|
|
70
|
+
return (fallback ?? null);
|
|
71
|
+
try {
|
|
72
|
+
return JSON.parse(input);
|
|
73
|
+
}
|
|
74
|
+
catch {
|
|
75
|
+
return (fallback ?? null);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Flattens an object into a single-level object with dot-separated keys.
|
|
80
|
+
*/
|
|
81
|
+
export function flattenObject(obj, prefix = [], current = {}) {
|
|
82
|
+
prefix = prefix || [];
|
|
83
|
+
current = current || {};
|
|
84
|
+
// Remember kids, null is also an object!
|
|
85
|
+
if (typeof obj === "object" && obj !== null) {
|
|
86
|
+
Object.keys(obj).forEach((key) => {
|
|
87
|
+
;
|
|
88
|
+
flattenObject(obj[key], prefix.concat(key), current);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
current[prefix.join(".")] = obj;
|
|
93
|
+
}
|
|
94
|
+
return current;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=objects.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objects.js","sourceRoot":"","sources":["../objects.ts"],"names":[],"mappings":"AAA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A;IAEvB,yCAAyC;IACzC,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,IAAI,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAChC,CAAC;YAAC,aAAsC,CAAC,GAAG,CAAC,GAAG,CAAe,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,OAAO,CAAC,CAAA;QAC9F,CAAC,CAAC,CAAA;IACH,CAAC;SAAM,CAAC;QACP,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAA;IAChC,CAAC;IAED,OAAO,OAAO,CAAA;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-pipeline.d.ts","sourceRoot":"","sources":["../../parser/proposal-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAClE,OAAO,EACN,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EAGtB,KAAK,kBAAkB,EACvB,MAAM,mBAAmB,CAAA;AAE1B;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACrC,QAAQ,EAAE,SAAS,IAAI,EAAE,EACzB,WAAW,EAAE,SAAS,kBAAkB,EAAE,EAC1C,OAAO,GAAE,iBAAsB,GAC7B,OAAO,CAAC,sBAAsB,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"proposal-pipeline.d.ts","sourceRoot":"","sources":["../../parser/proposal-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,KAAK,EAAE,IAAI,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AO,CAAC;IAAE,SAAS,EAAE,sBAAsB,EAAE,CAAC;IAAC,SAAS,EAAE,eAAe,CAAA;CAAE,CAAC,CAK9E"}
|
|
@@ -27,7 +27,6 @@ export async function collectProposals(sections, classifiers, context = {}) {
|
|
|
27
27
|
for (const classifier of classifiers) {
|
|
28
28
|
for (const section of sections) {
|
|
29
29
|
tasks.push(classifier.classify(section, context).catch((err) => {
|
|
30
|
-
// eslint-disable-next-line no-console
|
|
31
30
|
console.warn(`[proposal-pipeline] ${classifier.id} threw on section "${section.body}":`, err);
|
|
32
31
|
return [];
|
|
33
32
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-pipeline.js","sourceRoot":"","sources":["../../parser/proposal-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAIN,kCAAkC,GAElC,MAAM,mBAAmB,CAAA;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,QAAyB,EACzB,WAA0C,EAC1C,UAA6B,EAAE;IAE/B,MAAM,KAAK,GAA6C,EAAE,CAAA;IAC1D,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACtC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAChC,KAAK,CAAC,IAAI,CACT,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;gBACnD,
|
|
1
|
+
{"version":3,"file":"proposal-pipeline.js","sourceRoot":"","sources":["../../parser/proposal-pipeline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAIN,kCAAkC,GAElC,MAAM,mBAAmB,CAAA;AAE1B;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACrC,QAAyB,EACzB,WAA0C,EAC1C,UAA6B,EAAE;IAE/B,MAAM,KAAK,GAA6C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` for the full contract.
|
|
7
|
+
*/
|
|
8
|
+
export { reconcileSpans } from "./reconcile.js";
|
|
9
|
+
export type { ClassifierCandidate, ParentChainLookup, ParseTree, ReconcileInputs, ReconcileOpts, ResolverCandidatesLookup, ScoreBreakdown, } from "./reconcile.js";
|
|
10
|
+
export { runPipeline } from "./runtime-pipeline.js";
|
|
11
|
+
export { aggregateSpanLogits } from "./span-logit-aggregation.js";
|
|
12
|
+
export type { SpanBounds, TokenPiece } from "./span-logit-aggregation.js";
|
|
13
|
+
export type { AddressClassifier, LocaleHint, LocaleTag, NormalizedInputLite, PhraseGrouper, PhraseKind, PhraseProposal, PipelineOpts, PipelineResult, PipelineTiming, QueryKind, QueryKindResult, QueryShapeLite, RuntimePipelineStages, UserLocation, } from "./types.js";
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAC/C,YAAY,EACX,mBAAmB,EACnB,iBAAiB,EACjB,SAAS,EACT,eAAe,EACf,aAAa,EACb,wBAAwB,EACxB,cAAc,GACd,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AACjE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAA;AACzE,YAAY,EACX,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,mBAAmB,EACnB,aAAa,EACb,UAAU,EACV,cAAc,EACd,YAAY,EACZ,cAAc,EACd,cAAc,EACd,SAAS,EACT,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,YAAY,GACZ,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* Runtime pipeline coordinator — see `STAGES.md` for the full contract.
|
|
7
|
+
*/
|
|
8
|
+
export { reconcileSpans } from "./reconcile.js";
|
|
9
|
+
export { runPipeline } from "./runtime-pipeline.js";
|
|
10
|
+
export { aggregateSpanLogits } from "./span-logit-aggregation.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../pipeline/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAA;AAU/C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @copyright Sister Software
|
|
3
|
+
* @license AGPL-3.0
|
|
4
|
+
* @author Teffen Ellis, et al.
|
|
5
|
+
*
|
|
6
|
+
* `reconcileSpans` — Stage 5 joint-decoding path.
|
|
7
|
+
*
|
|
8
|
+
* Today's runtime Stage 5 (in `runtime-pipeline.ts`) just keeps the classifier-emitted spans in
|
|
9
|
+
* start order. That fallback covers callers who don't yet have top-k inputs from Stages 2.7 / 3 /
|
|
10
|
+
* 6. This file is the **opt-in** joint-decoding path that turns Stage 5 from a sort into a
|
|
11
|
+
* reconciler: pick the parse tree that maximizes
|
|
12
|
+
*
|
|
13
|
+
* ```
|
|
14
|
+
* ∏ phrase_grouper_confidence
|
|
15
|
+
* × classifier_confidence
|
|
16
|
+
* × resolver_score
|
|
17
|
+
* × concordance_bonus(parent_id chain)
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Closes the kryptonite catalogue (`NY-NY Steakhouse, Houston, TX`, `Paris, Texas`, `Saint
|
|
21
|
+
* Petersburg, FL`, `Buffalo Buffalo`) where today's argmax-per-stage produces internally-
|
|
22
|
+
* inconsistent parses that the layer above can't repair.
|
|
23
|
+
*
|
|
24
|
+
* The implementation is a beam search over candidate slots — each slot is one `(phrase_span,
|
|
25
|
+
* classifier_tag, resolver_place)` triple. Three knobs prune the cross product: `kSpan` (de-duped
|
|
26
|
+
* phrase span proposals), `kTag` (classifier tag interpretations per span), and `kResolver`
|
|
27
|
+
* (resolver candidates per `(span, tag)`). Concordance scoring is incremental — when a slot is
|
|
28
|
+
* added, we check the new place's `parent_id` chain against the running admin assignment and
|
|
29
|
+
* adjust the running score before pruning.
|
|
30
|
+
*
|
|
31
|
+
* The Thread C-s classifier top-k contract is mocked locally for v0.5.0 (see `ClassifierCandidate`
|
|
32
|
+
* below). The real classifier output adapter ships with `@mailwoman/neural` once Thread C-s
|
|
33
|
+
* lands; the existing `ResolvedPlace` shape from `@mailwoman/core/resolver` is what backs the
|
|
34
|
+
* resolver-candidates axis (parent_id chains live there).
|
|
35
|
+
*
|
|
36
|
+
* See `docs/articles/plan/phases/PHASE_8_v0_5_0_fresh_slate.md` § D for the v0.5.0 context and
|
|
37
|
+
* `docs/articles/concepts/the-knowledge-ladder.md` § Reconcile for the design rationale.
|
|
38
|
+
*/
|
|
39
|
+
import type { AddressTree, ComponentTag } from "../decoder/types.js";
|
|
40
|
+
import type { ResolvedPlace } from "../resolver/types.js";
|
|
41
|
+
import type { PhraseProposal } from "./types.js";
|
|
42
|
+
/**
|
|
43
|
+
* One classifier interpretation for one input span. Pins the Thread C-s contract for the reconciler
|
|
44
|
+
* — the real classifier emits this directly once that thread lands. Until then, tests hand-build a
|
|
45
|
+
* list of these to simulate top-k output.
|
|
46
|
+
*
|
|
47
|
+
* The classifier may emit multiple candidates for the same span (different tag hypotheses); the
|
|
48
|
+
* reconciler treats those as the top-k tag axis. Candidates whose `span` does not exactly match a
|
|
49
|
+
* phrase proposal's span are ignored — the phrase grouper is the boundary-discovery authority.
|
|
50
|
+
*/
|
|
51
|
+
export interface ClassifierCandidate {
|
|
52
|
+
span: {
|
|
53
|
+
start: number;
|
|
54
|
+
end: number;
|
|
55
|
+
};
|
|
56
|
+
tag: ComponentTag;
|
|
57
|
+
/** Calibrated confidence in [0, 1]. */
|
|
58
|
+
score: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Resolver lookup for the (span, tag) axis. In production wraps a `ResolverBackend` (Stage 6); in
|
|
62
|
+
* tests an in-memory table built per fixture. Returned candidates must already be sorted descending
|
|
63
|
+
* by score — the reconciler takes the top `kResolver` as-is.
|
|
64
|
+
*/
|
|
65
|
+
export interface ResolverCandidatesLookup {
|
|
66
|
+
candidatesFor(span: {
|
|
67
|
+
start: number;
|
|
68
|
+
end: number;
|
|
69
|
+
}, tag: ComponentTag): ReadonlyArray<ResolvedPlace>;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parent-chain lookup for concordance scoring. WOF SQLite is the source of truth in production
|
|
73
|
+
* (Stage 6); tests pass a `Map`-backed mock. Returns the place's ancestors (order unimportant — the
|
|
74
|
+
* reconciler only checks membership).
|
|
75
|
+
*/
|
|
76
|
+
export interface ParentChainLookup {
|
|
77
|
+
parentsOf(place: ResolvedPlace): ReadonlyArray<ResolvedPlace>;
|
|
78
|
+
}
|
|
79
|
+
export interface ReconcileInputs {
|
|
80
|
+
/** Raw input text — used to materialize `value` strings on the resulting tree. */
|
|
81
|
+
raw: string;
|
|
82
|
+
phraseProposals: ReadonlyArray<PhraseProposal>;
|
|
83
|
+
/** Sorted descending by score. May be empty (returns an empty tree). */
|
|
84
|
+
classifierTopK: ReadonlyArray<ClassifierCandidate>;
|
|
85
|
+
resolverCandidates?: ResolverCandidatesLookup;
|
|
86
|
+
parentChain?: ParentChainLookup;
|
|
87
|
+
opts?: ReconcileOpts;
|
|
88
|
+
}
|
|
89
|
+
export interface ReconcileOpts {
|
|
90
|
+
/** Top-k phrase span proposals retained per (start, end) — default 3. */
|
|
91
|
+
kSpan?: number;
|
|
92
|
+
/** Top-k classifier tag interpretations retained per span — default 3. */
|
|
93
|
+
kTag?: number;
|
|
94
|
+
/** Top-k resolver candidates retained per (span, tag) — default 5. */
|
|
95
|
+
kResolver?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Concordance bonus multiplier. 1.0 weights chain-consistency equal to one classifier-score
|
|
98
|
+
* factor; lower values trust the classifier more, higher values trust the gazetteer more. Default
|
|
99
|
+
* 1.0.
|
|
100
|
+
*/
|
|
101
|
+
concordanceWeight?: number;
|
|
102
|
+
/** Beam width during search — default 16. */
|
|
103
|
+
beamWidth?: number;
|
|
104
|
+
/** Runner-up parses returned alongside the winner — default 3. */
|
|
105
|
+
runnersUp?: number;
|
|
106
|
+
}
|
|
107
|
+
export interface ScoreBreakdown {
|
|
108
|
+
phrase: number;
|
|
109
|
+
classifier: number;
|
|
110
|
+
resolver: number;
|
|
111
|
+
concordance: number;
|
|
112
|
+
/** Composite multiplicative score in real space, [0, ∞). */
|
|
113
|
+
total: number;
|
|
114
|
+
}
|
|
115
|
+
export interface ParseTree {
|
|
116
|
+
tree: AddressTree;
|
|
117
|
+
/** Softmaxed confidence in [0, 1] over the finalized beam. */
|
|
118
|
+
confidence: number;
|
|
119
|
+
runnersUp: AddressTree[];
|
|
120
|
+
scoreBreakdown: ScoreBreakdown;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Joint-decode the best parse tree from Stage 2.7 phrase proposals, Stage 3 classifier top-k, and
|
|
124
|
+
* Stage 6 resolver candidates. See file header for the scoring formula.
|
|
125
|
+
*
|
|
126
|
+
* The result tree's roots are the winning `(span, tag, place)` triples in source order. Each node's
|
|
127
|
+
* `placeId`, `lat`, `lon` come from the chosen resolver candidate; `confidence` reflects the per-
|
|
128
|
+
* factor score for that slot. `runnersUp` are the next-best parses for caller inspection.
|
|
129
|
+
*
|
|
130
|
+
* Empty `classifierTopK` short-circuits to an empty tree at confidence 0 — no joint decode is
|
|
131
|
+
* possible without tag interpretations. Callers without top-k should use the runtime-pipeline
|
|
132
|
+
* fallback (which keeps classifier-emitted spans sorted by start).
|
|
133
|
+
*/
|
|
134
|
+
export declare function reconcileSpans(inputs: ReconcileInputs): ParseTree;
|
|
135
|
+
//# sourceMappingURL=reconcile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../pipeline/reconcile.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAe,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAEhD;;;;;;;;GAQG;AACH,MAAM,WAAW,mBAAmB;IACnC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAA;IACpC,GAAG,EAAE,YAAY,CAAA;IACjB,uCAAuC;IACvC,KAAK,EAAE,MAAM,CAAA;CACb;AAED;;;;GAIG;AACH,MAAM,WAAW,wBAAwB;IACxC,aAAa,CAAC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,EAAE,GAAG,EAAE,YAAY,GAAG,aAAa,CAAC,aAAa,CAAC,CAAA;CACpG;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC,SAAS,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,CAAA;CAC7D;AAED,MAAM,WAAW,eAAe;IAC/B,kFAAkF;IAClF,GAAG,EAAE,MAAM,CAAA;IACX,eAAe,EAAE,aAAa,CAAC,cAAc,CAAC,CAAA;IAC9C,wEAAwE;IACxE,c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