@wavehouse/chtypes 0.2.2 → 0.3.1
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 +57 -0
- package/dist/discover.d.ts +12 -4
- package/dist/discover.d.ts.map +1 -1
- package/dist/discover.js +13 -16
- package/dist/discover.js.map +1 -1
- package/dist/errors.d.ts +11 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +11 -6
- package/dist/errors.js.map +1 -1
- package/dist/fetch.d.ts +19 -0
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +104 -33
- package/dist/fetch.js.map +1 -1
- package/dist/ffi.d.ts +39 -3
- package/dist/ffi.d.ts.map +1 -1
- package/dist/ffi.js +132 -7
- package/dist/ffi.js.map +1 -1
- package/dist/format.d.ts +27 -8
- package/dist/format.d.ts.map +1 -1
- package/dist/format.js +27 -8
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/library.d.ts +66 -3
- package/dist/library.d.ts.map +1 -1
- package/dist/library.js +79 -3
- package/dist/library.js.map +1 -1
- package/dist/registry.d.ts +109 -30
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +175 -67
- package/dist/registry.js.map +1 -1
- package/dist/results.d.ts +84 -3
- package/dist/results.d.ts.map +1 -1
- package/dist/results.js +96 -19
- package/dist/results.js.map +1 -1
- package/dist/schema.d.ts +99 -12
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +45 -9
- package/dist/schema.js.map +1 -1
- package/dist/transform.d.ts.map +1 -1
- package/dist/transform.js +6 -0
- package/dist/transform.js.map +1 -1
- package/package.json +1 -1
package/dist/format.d.ts
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
* `Schema#row` / `Schema#rows`. These numbers are part of the C ABI
|
|
4
4
|
* (the C ABI contract §Types and schemas) and MUST NOT be renumbered.
|
|
5
5
|
*
|
|
6
|
-
* Name-addressed: `JSONEachRow
|
|
7
|
-
*
|
|
8
|
-
* `CSV`, `TSV`,
|
|
9
|
-
* `
|
|
6
|
+
* Name-addressed: `JSONEachRow`, and `CSVWithNames` / `TSVWithNames` through
|
|
7
|
+
* their header row. Positional (the k-th field lands in the k-th insertable
|
|
8
|
+
* column; MATERIALIZED / ALIAS / EPHEMERAL occupy no position): `CSV`, `TSV`,
|
|
9
|
+
* `Values`, `JSONCompactEachRow`, the RowBinary family, and `Buffers`.
|
|
10
|
+
* `Native` is column-oriented and name-addressed.
|
|
10
11
|
*
|
|
11
|
-
* The RowBinary family, `Native
|
|
12
|
-
* ARTIFACT was linked, not on this
|
|
13
|
-
* (feed it one payload) rather than
|
|
14
|
-
* binding must accept and
|
|
12
|
+
* The RowBinary family, `Native`, `Buffers`, `CSVWithNames` and
|
|
13
|
+
* `TSVWithNames` depend on when the loaded ARTIFACT was linked, not on this
|
|
14
|
+
* package's version — probe the artifact (feed it one payload) rather than
|
|
15
|
+
* assuming (docs/reference/bindings.md §Values a binding must accept and
|
|
16
|
+
* reject).
|
|
15
17
|
*/
|
|
16
18
|
export declare const Format: {
|
|
17
19
|
/** One JSON object per line, fields matched to columns by name. */
|
|
@@ -59,6 +61,23 @@ export declare const Format: {
|
|
|
59
61
|
* package's version.
|
|
60
62
|
*/
|
|
61
63
|
readonly Buffers: 9;
|
|
64
|
+
/**
|
|
65
|
+
* CSV whose first row is a header naming the columns, so the data is
|
|
66
|
+
* addressed by NAME. With a column list as well (`columns`), the list decides
|
|
67
|
+
* the block and the header decides the layout. Header names match EXACTLY
|
|
68
|
+
* through ClickHouse 26.4 and case-insensitively from 26.5, exactly as those
|
|
69
|
+
* servers do. It joined `enum chs_format` inside ABI revision 5, so a
|
|
70
|
+
* revision-5 artifact built before it existed does not know it — the
|
|
71
|
+
* revision check cannot tell. Probe it, do not assume it from this package's
|
|
72
|
+
* version.
|
|
73
|
+
*/
|
|
74
|
+
readonly CSVWithNames: 10;
|
|
75
|
+
/**
|
|
76
|
+
* TSV whose first row is a header naming the columns. Everything
|
|
77
|
+
* `CSVWithNames` says about the header, a column list, header matching and
|
|
78
|
+
* probing the artifact applies unchanged.
|
|
79
|
+
*/
|
|
80
|
+
readonly TSVWithNames: 11;
|
|
62
81
|
};
|
|
63
82
|
/** One of the `chs_format` integer codes — see the `Format` constant object. */
|
|
64
83
|
export type Format = (typeof Format)[keyof typeof Format];
|
package/dist/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,MAAM;IACjB,mEAAmE;aACnE,WAAW,EAAE,CAAC;IACd,yEAAyE;aACzE,GAAG,EAAE,CAAC;IACN,qHAAqH;aACrH,GAAG,EAAE,CAAC;IACN,iDAAiD;aACjD,MAAM,EAAE,CAAC;IACT,2CAA2C;aAC3C,kBAAkB,EAAE,CAAC;IACrB,8EAA8E;aAC9E,SAAS,EAAE,CAAC;IACZ,yEAAyE;aACzE,qBAAqB,EAAE,CAAC;IACxB;;;;OAIG;aACH,qCAAqC,EAAE,CAAC;IACxC;;;;;;;OAOG;aACH,MAAM,EAAE,CAAC;IACT;;;;;;;;;;;;;;OAcG;aACH,OAAO,EAAE,CAAC;IACV;;;;;;;;;OASG;aACH,YAAY,EAAE,EAAE;IAChB;;;;OAIG;aACH,YAAY,EAAE,EAAE;CACR,CAAC;AAEX,gFAAgF;AAChF,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;AAE1D;;;;;GAKG;AACH,eAAO,MAAM,WAAW,KAAK,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,UAAU,IAAM,CAAC;AAC9B,yEAAyE;AACzE,eAAO,MAAM,cAAc,IAAM,CAAC;AAClC,iFAAiF;AACjF,eAAO,MAAM,YAAY,IAAM,CAAC;AAChC,0EAA0E;AAC1E,eAAO,MAAM,OAAO,QAA6C,CAAC;AAElE;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAK5C"}
|
package/dist/format.js
CHANGED
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
* `Schema#row` / `Schema#rows`. These numbers are part of the C ABI
|
|
4
4
|
* (the C ABI contract §Types and schemas) and MUST NOT be renumbered.
|
|
5
5
|
*
|
|
6
|
-
* Name-addressed: `JSONEachRow
|
|
7
|
-
*
|
|
8
|
-
* `CSV`, `TSV`,
|
|
9
|
-
* `
|
|
6
|
+
* Name-addressed: `JSONEachRow`, and `CSVWithNames` / `TSVWithNames` through
|
|
7
|
+
* their header row. Positional (the k-th field lands in the k-th insertable
|
|
8
|
+
* column; MATERIALIZED / ALIAS / EPHEMERAL occupy no position): `CSV`, `TSV`,
|
|
9
|
+
* `Values`, `JSONCompactEachRow`, the RowBinary family, and `Buffers`.
|
|
10
|
+
* `Native` is column-oriented and name-addressed.
|
|
10
11
|
*
|
|
11
|
-
* The RowBinary family, `Native
|
|
12
|
-
* ARTIFACT was linked, not on this
|
|
13
|
-
* (feed it one payload) rather than
|
|
14
|
-
* binding must accept and
|
|
12
|
+
* The RowBinary family, `Native`, `Buffers`, `CSVWithNames` and
|
|
13
|
+
* `TSVWithNames` depend on when the loaded ARTIFACT was linked, not on this
|
|
14
|
+
* package's version — probe the artifact (feed it one payload) rather than
|
|
15
|
+
* assuming (docs/reference/bindings.md §Values a binding must accept and
|
|
16
|
+
* reject).
|
|
15
17
|
*/
|
|
16
18
|
export const Format = {
|
|
17
19
|
/** One JSON object per line, fields matched to columns by name. */
|
|
@@ -59,6 +61,23 @@ export const Format = {
|
|
|
59
61
|
* package's version.
|
|
60
62
|
*/
|
|
61
63
|
Buffers: 9,
|
|
64
|
+
/**
|
|
65
|
+
* CSV whose first row is a header naming the columns, so the data is
|
|
66
|
+
* addressed by NAME. With a column list as well (`columns`), the list decides
|
|
67
|
+
* the block and the header decides the layout. Header names match EXACTLY
|
|
68
|
+
* through ClickHouse 26.4 and case-insensitively from 26.5, exactly as those
|
|
69
|
+
* servers do. It joined `enum chs_format` inside ABI revision 5, so a
|
|
70
|
+
* revision-5 artifact built before it existed does not know it — the
|
|
71
|
+
* revision check cannot tell. Probe it, do not assume it from this package's
|
|
72
|
+
* version.
|
|
73
|
+
*/
|
|
74
|
+
CSVWithNames: 10,
|
|
75
|
+
/**
|
|
76
|
+
* TSV whose first row is a header naming the columns. Everything
|
|
77
|
+
* `CSVWithNames` says about the header, a column list, header matching and
|
|
78
|
+
* probing the artifact applies unchanged.
|
|
79
|
+
*/
|
|
80
|
+
TSVWithNames: 11,
|
|
62
81
|
};
|
|
63
82
|
/**
|
|
64
83
|
* The `chs_rows` export sentinel: no export requested (`CHS_EXPORT_NONE`,
|
package/dist/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,mEAAmE;IACnE,WAAW,EAAE,CAAC;IACd,yEAAyE;IACzE,GAAG,EAAE,CAAC;IACN,qHAAqH;IACrH,GAAG,EAAE,CAAC;IACN,iDAAiD;IACjD,MAAM,EAAE,CAAC;IACT,2CAA2C;IAC3C,kBAAkB,EAAE,CAAC;IACrB,8EAA8E;IAC9E,SAAS,EAAE,CAAC;IACZ,yEAAyE;IACzE,qBAAqB,EAAE,CAAC;IACxB;;;;OAIG;IACH,qCAAqC,EAAE,CAAC;IACxC;;;;;;;OAOG;IACH,MAAM,EAAE,CAAC;IACT;;;;;;;;;;;;;;OAcG;IACH,OAAO,EAAE,CAAC;IACV;;;;;;;;;OASG;IACH,YAAY,EAAE,EAAE;IAChB;;;;OAIG;IACH,YAAY,EAAE,EAAE;CACR,CAAC;AAKX;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAC;AAC9B,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAChC,0EAA0E;AAC1E,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,GAAG,cAAc,GAAG,YAAY,CAAC;AAElE;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,CAAS;IAClC,KAAK,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAClD,IAAI,IAAI,KAAK,CAAC;YAAE,OAAO,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,UAAU,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;AAChC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* vendored per release behind the frozen `chs_*` C ABI. The one derived answer is
|
|
12
12
|
* `transformed`, and it is the reason the product exists.
|
|
13
13
|
*/
|
|
14
|
-
export { parseChangedSettingsResult, parseColumnsResult, parseVersionResult, QUERY_CHANGED_SETTINGS, QUERY_SERVER_VERSION, QUERY_TABLE_COLUMNS,
|
|
14
|
+
export { parseChangedSettingsResult, parseColumnsResult, parseVersionResult, QUERY_CHANGED_SETTINGS, QUERY_SERVER_VERSION, QUERY_TABLE_COLUMNS, type DiscoveredColumn, type ServerProfile, } from './discover.js';
|
|
15
15
|
export { ABI_REVISION, ArtifactCorruptError, ArtifactError, ArtifactMissingError, ArtifactPinnedError, ArtifactUnpublishedError, ArtifactUntrustedError, artifactMissingMessage, ChtypesError, CODE_ARTIFACT_CORRUPT, CODE_ARTIFACT_MISSING, CODE_ARTIFACT_PINNED, CODE_ARTIFACT_UNPUBLISHED, CODE_ARTIFACT_UNTRUSTED, CODE_SOURCE_UNREACHABLE, CODE_UNSUPPORTED, FETCH_COMMAND, FetchError, RegistryError, SchemaError, SourceUnreachableError, UnsupportedError, type ArtifactErrorCode, } from './errors.js';
|
|
16
16
|
export { compareVersions, DEFAULT_ARTIFACTS_URL, DEFAULT_LOCK_FILE, DEFAULT_RELEASE_TAG, ensure, ensureAll, keyId, listArtifacts, LOCK_SCHEMA, parseSignatureFile, parseVersionSpelling, readLock, RELEASE_KEY_ID, RELEASE_PUBLIC_KEYS, resolvePlatform, selectAll, selectArtifact, sha256File, trustedKeys, verifyEd25519, verifyInstalled, type EnsureOptions, type EnsureResult, type FetchEvent, type IndexArtifact, type InstalledArtifact, type ListResult, type LockEntry, type LockFile, type ReleaseIndex, type VersionRequest, } from './fetch.js';
|
|
17
17
|
export { cacheRegistryDir, ENV_AUTOFETCH, ENV_REGISTRY, fetchDestination, hostPlatform, isPlatformKey, registrySearchPath, systemRegistryDirs, } from './paths.js';
|
|
@@ -20,8 +20,8 @@ export { DOC_ALL, DOC_DEFAULTS, DOC_TRANSFORMS, DOC_VALUES, EXPORT_NONE, Format,
|
|
|
20
20
|
export { CompileMode, Library, minorOf, type CompileOptions } from './library.js';
|
|
21
21
|
export { nativeStats } from './ffi.js';
|
|
22
22
|
export { compareMinor, defaultRegistryDir, looksLikeRegistry, Registry, resolveRegistryDir, type Manifest, type RegistryOptions, } from './registry.js';
|
|
23
|
-
export { DefaultKind, FilterOutcome, isAnswer, Outcome, Verdict, type BatchResult, type ColumnDoc, type Computed, type FilterResult, type FilterRowError, type RowResult, type Span, type Substitution, type Transform, type Value, } from './results.js';
|
|
24
|
-
export { Block, Filter, Schema, type ColumnInfo, type CompileFilterOptions, type EngineOptions, type RowsOptions, } from './schema.js';
|
|
23
|
+
export { DefaultKind, FilterOutcome, isAnswer, Outcome, Source, Verdict, type BatchResult, type ColumnDoc, type Computed, type FilterResult, type FilterRowError, type RowResult, type Span, type Substitution, type Transform, type Value, } from './results.js';
|
|
24
|
+
export { Block, Filter, Schema, type ColumnInfo, type CompileFilterOptions, type EngineOptions, type RowOptions, type RowsOptions, } from './schema.js';
|
|
25
25
|
export { encodeSettings, type Settings, type SettingValue } from './settings.js';
|
|
26
26
|
export { isLossyReason, Reason } from './transform.js';
|
|
27
27
|
export { isValidUtf8, Json, parseDocument, parseJsonValue, rawBytes, rawText, repairBareDenormals, type JsonKind, } from './json.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,a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AM,EACN,OAAO,EACP,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,SAAS,EACd,KAAK,KAAK,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,UAAU,EACf,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,WAAW,EACX,IAAI,EACJ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,OAAO,EACP,mBAAmB,EACnB,KAAK,QAAQ,GACd,MAAM,WAAW,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
* vendored per release behind the frozen `chs_*` C ABI. The one derived answer is
|
|
12
12
|
* `transformed`, and it is the reason the product exists.
|
|
13
13
|
*/
|
|
14
|
-
export { parseChangedSettingsResult, parseColumnsResult, parseVersionResult, QUERY_CHANGED_SETTINGS, QUERY_SERVER_VERSION, QUERY_TABLE_COLUMNS,
|
|
14
|
+
export { parseChangedSettingsResult, parseColumnsResult, parseVersionResult, QUERY_CHANGED_SETTINGS, QUERY_SERVER_VERSION, QUERY_TABLE_COLUMNS, } from './discover.js';
|
|
15
15
|
export { ABI_REVISION, ArtifactCorruptError, ArtifactError, ArtifactMissingError, ArtifactPinnedError, ArtifactUnpublishedError, ArtifactUntrustedError, artifactMissingMessage, ChtypesError, CODE_ARTIFACT_CORRUPT, CODE_ARTIFACT_MISSING, CODE_ARTIFACT_PINNED, CODE_ARTIFACT_UNPUBLISHED, CODE_ARTIFACT_UNTRUSTED, CODE_SOURCE_UNREACHABLE, CODE_UNSUPPORTED, FETCH_COMMAND, FetchError, RegistryError, SchemaError, SourceUnreachableError, UnsupportedError, } from './errors.js';
|
|
16
16
|
export { compareVersions, DEFAULT_ARTIFACTS_URL, DEFAULT_LOCK_FILE, DEFAULT_RELEASE_TAG, ensure, ensureAll, keyId, listArtifacts, LOCK_SCHEMA, parseSignatureFile, parseVersionSpelling, readLock, RELEASE_KEY_ID, RELEASE_PUBLIC_KEYS, resolvePlatform, selectAll, selectArtifact, sha256File, trustedKeys, verifyEd25519, verifyInstalled, } from './fetch.js';
|
|
17
17
|
export { cacheRegistryDir, ENV_AUTOFETCH, ENV_REGISTRY, fetchDestination, hostPlatform, isPlatformKey, registrySearchPath, systemRegistryDirs, } from './paths.js';
|
|
@@ -20,7 +20,7 @@ export { DOC_ALL, DOC_DEFAULTS, DOC_TRANSFORMS, DOC_VALUES, EXPORT_NONE, Format,
|
|
|
20
20
|
export { CompileMode, Library, minorOf } from './library.js';
|
|
21
21
|
export { nativeStats } from './ffi.js';
|
|
22
22
|
export { compareMinor, defaultRegistryDir, looksLikeRegistry, Registry, resolveRegistryDir, } from './registry.js';
|
|
23
|
-
export { DefaultKind, FilterOutcome, isAnswer, Outcome, Verdict, } from './results.js';
|
|
23
|
+
export { DefaultKind, FilterOutcome, isAnswer, Outcome, Source, Verdict, } from './results.js';
|
|
24
24
|
export { Block, Filter, Schema, } from './schema.js';
|
|
25
25
|
export { encodeSettings } from './settings.js';
|
|
26
26
|
export { isLossyReason, Reason } from './transform.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,0BAA0B,EAC1B,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,GAGpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EACtB,sBAAsB,EACtB,YAAY,EACZ,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,yBAAyB,EACzB,uBAAuB,EACvB,uBAAuB,EACvB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,gBAAgB,GAEjB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,mBAAmB,EACnB,MAAM,EACN,SAAS,EACT,KAAK,EACL,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,oBAAoB,EACpB,QAAQ,EACR,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,cAAc,EACd,UAAU,EACV,WAAW,EACX,aAAa,EACb,eAAe,GAWhB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,aAAa,EACb,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,YAAY,EAAuB,MAAM,UAAU,CAAC;AAC7D,OAAO,EACL,OAAO,EACP,YAAY,EACZ,cAAc,EACd,UAAU,EACV,WAAW,EACX,MAAM,EACN,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,GAGnB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,aAAa,EACb,QAAQ,EACR,OAAO,EACP,MAAM,EACN,OAAO,GAWR,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,EACL,MAAM,EACN,MAAM,GAMP,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,cAAc,EAAoC,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EACL,WAAW,EACX,IAAI,EACJ,aAAa,EACb,cAAc,EACd,QAAQ,EACR,OAAO,EACP,mBAAmB,GAEpB,MAAM,WAAW,CAAC"}
|
package/dist/library.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* One loaded ClickHouse build. It names itself — `chs_clickhouse_version()` —
|
|
3
3
|
* and nothing is ever inferred from the directory or the file name.
|
|
4
4
|
*/
|
|
5
|
+
import { type DiscoveredColumn } from './discover.js';
|
|
5
6
|
import type { NativeLibrary } from './ffi.js';
|
|
6
7
|
import { Schema } from './schema.js';
|
|
7
8
|
import { type Settings } from './settings.js';
|
|
@@ -128,8 +129,10 @@ export declare class Library {
|
|
|
128
129
|
* unknown setting name in `options.settings` carries the server's own 115
|
|
129
130
|
* (with its did-you-mean hint), and nothing is compiled; a type gate
|
|
130
131
|
* declared at a refusing value fails with the server's own 455/44, exactly
|
|
131
|
-
* as that server's CREATE; an Enum DEFAULT outside the declared domain
|
|
132
|
-
*
|
|
132
|
+
* as that server's CREATE; an Enum DEFAULT outside the declared domain
|
|
133
|
+
* follows that server's CREATE too — 691 (or 70 for an out-of-range
|
|
134
|
+
* literal) where it refuses the table (26.x); on 24.8–25.10 it compiles,
|
|
135
|
+
* and a row relying on the default answers `accepted_poisoned`.
|
|
133
136
|
* @throws {UnsupportedError} when this build DECLINES rather than guesses —
|
|
134
137
|
* a `mode` other than `CompileMode.Declared`, or a DEFAULT it refuses to
|
|
135
138
|
* evaluate (server-property functions like `hostName()`, `sleep`, an
|
|
@@ -185,6 +188,66 @@ export declare class Library {
|
|
|
185
188
|
* @throws {UnsupportedError} when the artifact predates `chs_reference_type`.
|
|
186
189
|
*/
|
|
187
190
|
referenceType(typeExpr: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* Spell `name` as a back-quoted identifier — ALWAYS quoted, which is the
|
|
193
|
+
* safe default and the one to reach for without thinking
|
|
194
|
+
* (`chs_quote_identifier`, the vendored `backQuote`).
|
|
195
|
+
*
|
|
196
|
+
* The bytes are this library's own: an embedded back-quote comes back in the
|
|
197
|
+
* spelling the server's formatter prints, not in a spelling of ours. Reach
|
|
198
|
+
* for `quoteIdentifierIfNeeded` only when the bare spelling matters to
|
|
199
|
+
* something downstream.
|
|
200
|
+
*
|
|
201
|
+
* @param name - a table, column or alias name.
|
|
202
|
+
* @returns the quoted identifier.
|
|
203
|
+
* @throws {UnsupportedError} when the artifact predates
|
|
204
|
+
* `chs_quote_identifier`.
|
|
205
|
+
*/
|
|
206
|
+
quoteIdentifier(name: string): string;
|
|
207
|
+
/**
|
|
208
|
+
* Spell `name` bare where THIS library's ClickHouse says a bare spelling is
|
|
209
|
+
* legal, and back-quote it otherwise (`chs_quote_identifier_if_needed`, the
|
|
210
|
+
* vendored `backQuoteIfNeed`).
|
|
211
|
+
*
|
|
212
|
+
* Which names it leaves bare is a property of the vendored build, not of
|
|
213
|
+
* this package, and it CHANGES between builds — ask the library you will
|
|
214
|
+
* compile against rather than caching an answer across versions.
|
|
215
|
+
*
|
|
216
|
+
* @param name - a table, column or alias name.
|
|
217
|
+
* @returns the identifier, bare or quoted.
|
|
218
|
+
* @throws {UnsupportedError} when the artifact predates
|
|
219
|
+
* `chs_quote_identifier_if_needed`.
|
|
220
|
+
*/
|
|
221
|
+
quoteIdentifierIfNeeded(name: string): string;
|
|
222
|
+
/**
|
|
223
|
+
* Spell `text` as a ClickHouse string literal, quotes and escapes included
|
|
224
|
+
* (`chs_quote_literal`, the vendored `quoteString`) — the call to reach for
|
|
225
|
+
* when a value is spliced into DDL, e.g. a DEFAULT expression.
|
|
226
|
+
*
|
|
227
|
+
* The input is counted, so a value carrying a NUL byte is quoted correctly;
|
|
228
|
+
* the answer is escaped and therefore NUL-free.
|
|
229
|
+
*
|
|
230
|
+
* @param text - the string value.
|
|
231
|
+
* @returns the ClickHouse string literal.
|
|
232
|
+
* @throws {UnsupportedError} when the artifact predates `chs_quote_literal`.
|
|
233
|
+
*/
|
|
234
|
+
quoteLiteral(text: string): string;
|
|
235
|
+
private quote;
|
|
236
|
+
/**
|
|
237
|
+
* Turn `QUERY_TABLE_COLUMNS`' rows back into the column-declaration list
|
|
238
|
+
* `compileDdl` takes.
|
|
239
|
+
*
|
|
240
|
+
* It hangs off a Library because the one thing it spells — the column NAME —
|
|
241
|
+
* is spelled by this library's own `quoteIdentifier`; see `discover.ts` for
|
|
242
|
+
* what reconstruction does and does not promise.
|
|
243
|
+
*
|
|
244
|
+
* @param cols - the discovered columns, e.g. from `parseColumnsResult`.
|
|
245
|
+
* @returns the column-declaration list for `compileDdl`.
|
|
246
|
+
* @throws {ChtypesError} when a column is inconsistent, or there are none.
|
|
247
|
+
* @throws {UnsupportedError} when the artifact predates
|
|
248
|
+
* `chs_quote_identifier`.
|
|
249
|
+
*/
|
|
250
|
+
reconstructDdl(cols: readonly DiscoveredColumn[]): string;
|
|
188
251
|
/**
|
|
189
252
|
* Every type family in this build's own runtime registry (139 entries on
|
|
190
253
|
* 25.8) — the answer to "does this build track upstream type families?"
|
|
@@ -202,7 +265,7 @@ export declare class Library {
|
|
|
202
265
|
* tab-separated fields — `name`, `deterministic`, `deterministic_in_query`,
|
|
203
266
|
* `server_constant`, `stateful`, `resolver_error_code`. ClickHouse's own
|
|
204
267
|
* answers off this build's own registry, and the input to the statelessness
|
|
205
|
-
* gate (
|
|
268
|
+
* gate (the build's function-flags generator). Part of the three-question
|
|
206
269
|
* introspection surface every SDK exposes (docs/reference/bindings.md
|
|
207
270
|
* §Introspection).
|
|
208
271
|
*
|
package/dist/library.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAE1E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAkB,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAI/C;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;IACtB;;;;;;;OAOG;aACH,QAAQ,EAAE,CAAC;CACH,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAEzE;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;OAQG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC;IACzC;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,OAAO;IAgBN,OAAO,CAAC,QAAQ,CAAC,MAAM;IAfnC,2DAA2D;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;I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ouse_version()` —
|
|
3
3
|
* and nothing is ever inferred from the directory or the file name.
|
|
4
4
|
*/
|
|
5
|
+
import { reconstructDdlWith } from './discover.js';
|
|
5
6
|
import { schemaErrorFor } from './errors.js';
|
|
6
7
|
import { Schema } from './schema.js';
|
|
7
8
|
import { encodeSettings } from './settings.js';
|
|
@@ -121,8 +122,10 @@ export class Library {
|
|
|
121
122
|
* unknown setting name in `options.settings` carries the server's own 115
|
|
122
123
|
* (with its did-you-mean hint), and nothing is compiled; a type gate
|
|
123
124
|
* declared at a refusing value fails with the server's own 455/44, exactly
|
|
124
|
-
* as that server's CREATE; an Enum DEFAULT outside the declared domain
|
|
125
|
-
*
|
|
125
|
+
* as that server's CREATE; an Enum DEFAULT outside the declared domain
|
|
126
|
+
* follows that server's CREATE too — 691 (or 70 for an out-of-range
|
|
127
|
+
* literal) where it refuses the table (26.x); on 24.8–25.10 it compiles,
|
|
128
|
+
* and a row relying on the default answers `accepted_poisoned`.
|
|
126
129
|
* @throws {UnsupportedError} when this build DECLINES rather than guesses —
|
|
127
130
|
* a `mode` other than `CompileMode.Declared`, or a DEFAULT it refuses to
|
|
128
131
|
* evaluate (server-property functions like `hostName()`, `sleep`, an
|
|
@@ -188,6 +191,79 @@ export class Library {
|
|
|
188
191
|
referenceType(typeExpr) {
|
|
189
192
|
return this.native.referenceType(typeExpr);
|
|
190
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Spell `name` as a back-quoted identifier — ALWAYS quoted, which is the
|
|
196
|
+
* safe default and the one to reach for without thinking
|
|
197
|
+
* (`chs_quote_identifier`, the vendored `backQuote`).
|
|
198
|
+
*
|
|
199
|
+
* The bytes are this library's own: an embedded back-quote comes back in the
|
|
200
|
+
* spelling the server's formatter prints, not in a spelling of ours. Reach
|
|
201
|
+
* for `quoteIdentifierIfNeeded` only when the bare spelling matters to
|
|
202
|
+
* something downstream.
|
|
203
|
+
*
|
|
204
|
+
* @param name - a table, column or alias name.
|
|
205
|
+
* @returns the quoted identifier.
|
|
206
|
+
* @throws {UnsupportedError} when the artifact predates
|
|
207
|
+
* `chs_quote_identifier`.
|
|
208
|
+
*/
|
|
209
|
+
quoteIdentifier(name) {
|
|
210
|
+
return this.quote('chs_quote_identifier', name);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Spell `name` bare where THIS library's ClickHouse says a bare spelling is
|
|
214
|
+
* legal, and back-quote it otherwise (`chs_quote_identifier_if_needed`, the
|
|
215
|
+
* vendored `backQuoteIfNeed`).
|
|
216
|
+
*
|
|
217
|
+
* Which names it leaves bare is a property of the vendored build, not of
|
|
218
|
+
* this package, and it CHANGES between builds — ask the library you will
|
|
219
|
+
* compile against rather than caching an answer across versions.
|
|
220
|
+
*
|
|
221
|
+
* @param name - a table, column or alias name.
|
|
222
|
+
* @returns the identifier, bare or quoted.
|
|
223
|
+
* @throws {UnsupportedError} when the artifact predates
|
|
224
|
+
* `chs_quote_identifier_if_needed`.
|
|
225
|
+
*/
|
|
226
|
+
quoteIdentifierIfNeeded(name) {
|
|
227
|
+
return this.quote('chs_quote_identifier_if_needed', name);
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Spell `text` as a ClickHouse string literal, quotes and escapes included
|
|
231
|
+
* (`chs_quote_literal`, the vendored `quoteString`) — the call to reach for
|
|
232
|
+
* when a value is spliced into DDL, e.g. a DEFAULT expression.
|
|
233
|
+
*
|
|
234
|
+
* The input is counted, so a value carrying a NUL byte is quoted correctly;
|
|
235
|
+
* the answer is escaped and therefore NUL-free.
|
|
236
|
+
*
|
|
237
|
+
* @param text - the string value.
|
|
238
|
+
* @returns the ClickHouse string literal.
|
|
239
|
+
* @throws {UnsupportedError} when the artifact predates `chs_quote_literal`.
|
|
240
|
+
*/
|
|
241
|
+
quoteLiteral(text) {
|
|
242
|
+
return this.quote('chs_quote_literal', text);
|
|
243
|
+
}
|
|
244
|
+
quote(symbol, text) {
|
|
245
|
+
const r = this.native.quote(symbol, text);
|
|
246
|
+
if (!r.ok)
|
|
247
|
+
throw schemaErrorFor(r.code, r.message || `${symbol} refused the input`);
|
|
248
|
+
return r.quoted;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Turn `QUERY_TABLE_COLUMNS`' rows back into the column-declaration list
|
|
252
|
+
* `compileDdl` takes.
|
|
253
|
+
*
|
|
254
|
+
* It hangs off a Library because the one thing it spells — the column NAME —
|
|
255
|
+
* is spelled by this library's own `quoteIdentifier`; see `discover.ts` for
|
|
256
|
+
* what reconstruction does and does not promise.
|
|
257
|
+
*
|
|
258
|
+
* @param cols - the discovered columns, e.g. from `parseColumnsResult`.
|
|
259
|
+
* @returns the column-declaration list for `compileDdl`.
|
|
260
|
+
* @throws {ChtypesError} when a column is inconsistent, or there are none.
|
|
261
|
+
* @throws {UnsupportedError} when the artifact predates
|
|
262
|
+
* `chs_quote_identifier`.
|
|
263
|
+
*/
|
|
264
|
+
reconstructDdl(cols) {
|
|
265
|
+
return reconstructDdlWith(cols, (name) => this.quoteIdentifier(name));
|
|
266
|
+
}
|
|
191
267
|
/**
|
|
192
268
|
* Every type family in this build's own runtime registry (139 entries on
|
|
193
269
|
* 25.8) — the answer to "does this build track upstream type families?"
|
|
@@ -207,7 +283,7 @@ export class Library {
|
|
|
207
283
|
* tab-separated fields — `name`, `deterministic`, `deterministic_in_query`,
|
|
208
284
|
* `server_constant`, `stateful`, `resolver_error_code`. ClickHouse's own
|
|
209
285
|
* answers off this build's own registry, and the input to the statelessness
|
|
210
|
-
* gate (
|
|
286
|
+
* gate (the build's function-flags generator). Part of the three-question
|
|
211
287
|
* introspection surface every SDK exposes (docs/reference/bindings.md
|
|
212
288
|
* §Introspection).
|
|
213
289
|
*
|
package/dist/library.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"library.js","sourceRoot":"","sources":["../src/library.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,E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QAClC,OAAO,IAAI,CAAC,KAAK,CAAC,gCAAgC,EAAE,IAAI,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,IAAY;QACvB,OAAO,IAAI,CAAC,KAAK,CAAC,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAC/C,CAAC;IAEO,KAAK,CACX,MAAuF,EACvF,IAAY;QAEZ,MAAM,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1C,IAAI,CAAC,CAAC,CAAC,EAAE;YAAE,MAAM,cAAc,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,OAAO,IAAI,GAAG,MAAM,oBAAoB,CAAC,CAAC;QACpF,OAAO,CAAC,CAAC,MAAM,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,IAAiC;QAC9C,OAAO,kBAAkB,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IACxE,CAAC;IAED;;;;;;;;;OASG;IACH,kBAAkB;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC;IAC1C,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAC;IACrC,CAAC;IAED;;;;;;;;OAQG;IACH,QAAQ;QACN,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;CACF"}
|
package/dist/registry.d.ts
CHANGED
|
@@ -20,11 +20,10 @@
|
|
|
20
20
|
*
|
|
21
21
|
* Where a registry IS follows the search path of docs/guides/fetch.md §1 (`paths.ts`):
|
|
22
22
|
* the explicit directory, `CHTYPES_REGISTRY`, the per-user cache, then the
|
|
23
|
-
* reserved system locations.
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `open()`.
|
|
23
|
+
* reserved system locations. Construction READS THE MANIFESTS on that path and
|
|
24
|
+
* `dlopen`s nothing; a line is taken, on request, from the first directory that
|
|
25
|
+
* has it. A line no directory has is the one §7 error,
|
|
26
|
+
* `ArtifactMissingError` — or, with `autofetch`, a fetch on first `open()`.
|
|
28
27
|
*/
|
|
29
28
|
import { type EnsureOptions } from './fetch.js';
|
|
30
29
|
import { Library } from './library.js';
|
|
@@ -52,8 +51,40 @@ export interface RegistryOptions {
|
|
|
52
51
|
* Re-hash each library and compare against `manifest.library_sha256` before
|
|
53
52
|
* loading. SHOULD be on for an artifact that came from anywhere but a local
|
|
54
53
|
* build, and MUST be on for one that came over a network.
|
|
54
|
+
*
|
|
55
|
+
* A policy on the REGISTRY, not a property of `preload`: a library's
|
|
56
|
+
* checksum is computed immediately before that library is `dlopen`ed and at
|
|
57
|
+
* no other time — at construction for the preloaded lines, at first use for
|
|
58
|
+
* the rest, never for a line nobody asks for.
|
|
59
|
+
*
|
|
60
|
+
* What this option ADDS is the sha256 comparison. The cheaper
|
|
61
|
+
* `manifest.library_bytes` size check that runs just before it is NOT
|
|
62
|
+
* conditional on this option — `load()` below always makes it, on every
|
|
63
|
+
* open, regardless (issue #82). Its timing is the same as the checksum's:
|
|
64
|
+
* at construction for the preloaded lines, at first use for the rest.
|
|
55
65
|
*/
|
|
56
66
|
verifyChecksums?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Open these lines AT CONSTRUCTION — the one eager path, and the same option
|
|
69
|
+
* Go spells `WithPreload(...)`, Python `preload=[...]` and Rust
|
|
70
|
+
* `RegistryOptions::preload`.
|
|
71
|
+
*
|
|
72
|
+
* Each entry is a version spelling resolved exactly as `for()` resolves one:
|
|
73
|
+
* a minor line (`'25.8'`) or an exact patch (`'25.8.28.1-lts'`), never a
|
|
74
|
+
* path. They are opened in the order given, before the constructor returns,
|
|
75
|
+
* and an entry no directory on the §1 search path holds is
|
|
76
|
+
* `ArtifactMissingError` — the same §7 error the first `for()` would have
|
|
77
|
+
* thrown, thrown earlier.
|
|
78
|
+
*
|
|
79
|
+
* It NEVER fetches, even with `autofetch` on: this constructor is
|
|
80
|
+
* synchronous and `ensure()` is not, and autofetch is a first-use behavior
|
|
81
|
+
* in all four bindings. An empty list is exactly the default.
|
|
82
|
+
*
|
|
83
|
+
* Deliberately a list of lines rather than "everything in the directory": a
|
|
84
|
+
* registry directory is whatever a fetch left behind, and each open costs
|
|
85
|
+
* about 120 MB resident.
|
|
86
|
+
*/
|
|
87
|
+
preload?: readonly string[] | undefined;
|
|
57
88
|
/**
|
|
58
89
|
* Lazy fetch on first open (docs/guides/fetch.md §6): `open()` of a line no
|
|
59
90
|
* directory on the search path holds runs `ensure()` first, into the
|
|
@@ -68,13 +99,20 @@ export interface RegistryOptions {
|
|
|
68
99
|
}
|
|
69
100
|
/**
|
|
70
101
|
* The artifact-directory loader — the multi-version entry point of this
|
|
71
|
-
* package.
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* `
|
|
77
|
-
*
|
|
102
|
+
* package.
|
|
103
|
+
*
|
|
104
|
+
* **Construction reads `manifest.json` files and `dlopen`s nothing**, with or
|
|
105
|
+
* without a directory. Nothing in this package opens an artifact except a
|
|
106
|
+
* request for a specific version (`for()` / `open()`) or an explicit
|
|
107
|
+
* `preload` — not `versions()`, not `libraries()`, not `has()`. An open costs
|
|
108
|
+
* about 120 MB resident per version, which a listing call must not spend on a
|
|
109
|
+
* caller's behalf.
|
|
110
|
+
*
|
|
111
|
+
* An open dlopens the artifact into its own symbol scope (`RTLD_LOCAL`),
|
|
112
|
+
* verifies its ABI revision against this binding's `ABI_REVISION` (a different
|
|
113
|
+
* nonzero revision is refused; 0 means the artifact predates the probe and
|
|
114
|
+
* degrades per symbol), and runs that library's one-time `chs_init` with the
|
|
115
|
+
* registry's timezone and the artifact's own `unsafe_families.txt`.
|
|
78
116
|
*
|
|
79
117
|
* Libraries are never dlclosed; `close()` joins background threads only.
|
|
80
118
|
* Loading the same artifact path from two `Registry` instances shares one
|
|
@@ -82,9 +120,9 @@ export interface RegistryOptions {
|
|
|
82
120
|
*/
|
|
83
121
|
export declare class Registry {
|
|
84
122
|
/**
|
|
85
|
-
* The primary registry directory: the first on the search path that
|
|
86
|
-
* artifacts
|
|
87
|
-
*
|
|
123
|
+
* The primary registry directory: the first on the search path that holds
|
|
124
|
+
* artifacts — or, with `autofetch` and nothing installed anywhere, the
|
|
125
|
+
* directory the first fetch will create.
|
|
88
126
|
*/
|
|
89
127
|
readonly dir: string;
|
|
90
128
|
/** The §1 search path, in order, every candidate whether or not it exists. */
|
|
@@ -94,47 +132,88 @@ export declare class Registry {
|
|
|
94
132
|
private readonly byId;
|
|
95
133
|
private readonly byPath;
|
|
96
134
|
private readonly loaded;
|
|
135
|
+
/**
|
|
136
|
+
* Minor line -> the FIRST directory on the search path that holds it, as the
|
|
137
|
+
* construction-time manifest scan found it. What `versions()` answers from,
|
|
138
|
+
* and what makes "no artifact anywhere" and a bad `preload` entry decidable
|
|
139
|
+
* at construction without a single `dlopen`.
|
|
140
|
+
*/
|
|
141
|
+
private readonly known;
|
|
97
142
|
private readonly timezone;
|
|
98
143
|
private readonly verifyChecksums;
|
|
99
144
|
private readonly autofetch;
|
|
100
145
|
private readonly fetchOptions;
|
|
101
146
|
private readonly explicit;
|
|
102
147
|
/**
|
|
103
|
-
* Scan
|
|
148
|
+
* Scan a registry. Reads manifests; opens nothing unless `preload` names a
|
|
149
|
+
* line.
|
|
104
150
|
*
|
|
105
151
|
* @param dir - the registry root; the head of the search path. Absent, the
|
|
106
152
|
* path is `CHTYPES_REGISTRY`, the per-user artifact cache, then the system
|
|
107
153
|
* locations (see `registrySearchPath` / `defaultRegistryDir`).
|
|
108
|
-
* @param options - timezone, checksum verification, autofetch — see
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
* directory
|
|
112
|
-
*
|
|
113
|
-
*
|
|
114
|
-
*
|
|
154
|
+
* @param options - timezone, checksum verification, autofetch, preload — see
|
|
155
|
+
* `RegistryOptions`.
|
|
156
|
+
* @throws {RegistryError} for what manifests can decide, and only that: a
|
|
157
|
+
* directory named explicitly (the argument or `CHTYPES_REGISTRY`) that does
|
|
158
|
+
* not exist, and no directory on the search path holding a readable
|
|
159
|
+
* `<minor>/manifest.json` — both suppressed when autofetch is on. A
|
|
160
|
+
* `preload` entry no directory holds is `ArtifactMissingError`. Everything
|
|
161
|
+
* a bad artifact can be wrong about — a failed checksum, a load failure, a
|
|
162
|
+
* library whose ClickHouse version disagrees with its manifest — is
|
|
163
|
+
* reported by the call that opens it, which is `preload`'s open at
|
|
164
|
+
* construction or the first `for()` otherwise.
|
|
115
165
|
* @throws {ChtypesError} when an artifact reports a different nonzero ABI
|
|
116
166
|
* revision than this binding speaks, or `chs_init` fails (e.g. an unknown
|
|
117
|
-
* timezone — the message names it).
|
|
167
|
+
* timezone — the message names it); again, from the call that opens it.
|
|
118
168
|
*/
|
|
119
169
|
constructor(dir?: string, options?: RegistryOptions);
|
|
170
|
+
/**
|
|
171
|
+
* Open one `preload` entry, before the constructor returns, without
|
|
172
|
+
* fetching. Resolution is `for()`'s, and so is the failure: a line no
|
|
173
|
+
* directory holds is the same `ArtifactMissingError`, raised earlier.
|
|
174
|
+
*/
|
|
175
|
+
private preloadLine;
|
|
120
176
|
/** dlopen one artifact directory, cross-check it, `chs_init` it, index it. */
|
|
121
177
|
private load;
|
|
122
178
|
/** Load `<dir>/<minor>/` if it is an artifact directory; null when it is not. */
|
|
123
179
|
private loadLine;
|
|
124
180
|
private lookup;
|
|
125
|
-
/**
|
|
181
|
+
/**
|
|
182
|
+
* Resolve without fetching: what is already open, then the line's directory
|
|
183
|
+
* as the construction-time scan recorded it, then a fresh walk of the search
|
|
184
|
+
* path for a line installed since. `undefined` means no directory holds it,
|
|
185
|
+
* which is a fetch's cue on `open()` and the §7 error everywhere else —
|
|
186
|
+
* `preload` never fetches, and this is the one function that makes the
|
|
187
|
+
* preload path and the first-use path identical in everything else.
|
|
188
|
+
*/
|
|
189
|
+
private resolve;
|
|
190
|
+
/**
|
|
191
|
+
* Every ClickHouse minor line this registry CAN ANSWER FOR, oldest first —
|
|
192
|
+
* the ones it has opened plus the ones its construction-time manifest scan
|
|
193
|
+
* discovered on the search path.
|
|
194
|
+
*
|
|
195
|
+
* That is one meaning in all four bindings, and it is the meaning that
|
|
196
|
+
* survives lazy loading: "the lines that happen to be open" would read as an
|
|
197
|
+
* empty registry until the first `for()`. It opens nothing.
|
|
198
|
+
*/
|
|
126
199
|
versions(): string[];
|
|
127
|
-
/**
|
|
200
|
+
/**
|
|
201
|
+
* The libraries this registry has OPENED, in release order (oldest minor
|
|
202
|
+
* line first) — what is open right now, never what could be. A discovered
|
|
203
|
+
* line that no `for()` and no `preload` has opened appears in `versions()`
|
|
204
|
+
* and not here. It opens nothing.
|
|
205
|
+
*/
|
|
128
206
|
libraries(): readonly Library[];
|
|
129
207
|
/**
|
|
130
208
|
* Resolve a version to its library. A minor line ("25.8") or an exact patch
|
|
131
209
|
* ("25.8.28.1-lts") both work, and an unknown patch inside a loaded minor line
|
|
132
210
|
* resolves to that line — asking for "25.8.30.16" finds the loaded 25.8.
|
|
133
211
|
*
|
|
134
|
-
*
|
|
135
|
-
* directory on the search path that holds it
|
|
136
|
-
*
|
|
137
|
-
* synchronous; `open()` is the one that
|
|
212
|
+
* **This is what opens an artifact.** Construction does not: the line is
|
|
213
|
+
* taken from the first directory on the search path that holds it
|
|
214
|
+
* (docs/guides/fetch.md §1), `dlopen`ed once, and joins `libraries()` from
|
|
215
|
+
* then on. Never a fetch: this call is synchronous; `open()` is the one that
|
|
216
|
+
* may fetch.
|
|
138
217
|
*
|
|
139
218
|
* Failure is the one §7 error, never a fallback to the nearest version:
|
|
140
219
|
* answering 26.7 semantics from a 25.8 artifact is a lie, and silent
|