@milaboratories/pl-model-middle-layer 1.11.3 → 1.11.5
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/dist/author_marker.d.ts +1 -1
- package/dist/block_meta/block_components.cjs +4 -4
- package/dist/block_meta/block_components.cjs.map +1 -1
- package/dist/block_meta/block_components.d.ts +1 -1
- package/dist/block_meta/block_components.js +4 -4
- package/dist/block_meta/block_components.js.map +1 -1
- package/dist/block_meta/block_description.cjs +6 -3
- package/dist/block_meta/block_description.cjs.map +1 -1
- package/dist/block_meta/block_description.d.ts +4 -4
- package/dist/block_meta/block_description.d.ts.map +1 -1
- package/dist/block_meta/block_description.js +6 -3
- package/dist/block_meta/block_description.js.map +1 -1
- package/dist/block_meta/block_id.cjs.map +1 -1
- package/dist/block_meta/block_id.d.ts +1 -1
- package/dist/block_meta/block_id.js.map +1 -1
- package/dist/block_meta/block_manifest.cjs +6 -4
- package/dist/block_meta/block_manifest.cjs.map +1 -1
- package/dist/block_meta/block_manifest.d.ts +2 -2
- package/dist/block_meta/block_manifest.d.ts.map +1 -1
- package/dist/block_meta/block_manifest.js +6 -4
- package/dist/block_meta/block_manifest.js.map +1 -1
- package/dist/block_meta/block_meta.cjs +10 -8
- package/dist/block_meta/block_meta.cjs.map +1 -1
- package/dist/block_meta/block_meta.d.ts +1 -1
- package/dist/block_meta/block_meta.d.ts.map +1 -1
- package/dist/block_meta/block_meta.js +10 -8
- package/dist/block_meta/block_meta.js.map +1 -1
- package/dist/block_meta/common.d.ts +2 -2
- package/dist/block_meta/content_conversion.cjs +6 -6
- package/dist/block_meta/content_conversion.cjs.map +1 -1
- package/dist/block_meta/content_conversion.d.ts +1 -1
- package/dist/block_meta/content_conversion.js +6 -6
- package/dist/block_meta/content_conversion.js.map +1 -1
- package/dist/block_meta/content_types.cjs +35 -35
- package/dist/block_meta/content_types.cjs.map +1 -1
- package/dist/block_meta/content_types.d.ts +1 -1
- package/dist/block_meta/content_types.js +35 -35
- package/dist/block_meta/content_types.js.map +1 -1
- package/dist/block_meta/index.d.ts +9 -9
- package/dist/block_meta/semver.cjs +1 -1
- package/dist/block_meta/semver.cjs.map +1 -1
- package/dist/block_meta/semver.d.ts +1 -1
- package/dist/block_meta/semver.js +1 -1
- package/dist/block_meta/semver.js.map +1 -1
- package/dist/block_registry/block_pack_spec.cjs +5 -5
- package/dist/block_registry/block_pack_spec.cjs.map +1 -1
- package/dist/block_registry/block_pack_spec.d.ts +1 -1
- package/dist/block_registry/block_pack_spec.js +5 -5
- package/dist/block_registry/block_pack_spec.js.map +1 -1
- package/dist/block_registry/index.d.ts +3 -3
- package/dist/block_registry/overview.cjs +18 -10
- package/dist/block_registry/overview.cjs.map +1 -1
- package/dist/block_registry/overview.d.ts +1 -1
- package/dist/block_registry/overview.d.ts.map +1 -1
- package/dist/block_registry/overview.js +18 -10
- package/dist/block_registry/overview.js.map +1 -1
- package/dist/block_registry/registry_spec.cjs +4 -4
- package/dist/block_registry/registry_spec.cjs.map +1 -1
- package/dist/block_registry/registry_spec.d.ts +1 -1
- package/dist/block_registry/registry_spec.js +4 -4
- package/dist/block_registry/registry_spec.js.map +1 -1
- package/dist/block_settings.cjs.map +1 -1
- package/dist/block_settings.d.ts +1 -1
- package/dist/block_settings.js.map +1 -1
- package/dist/block_state.d.ts +4 -4
- package/dist/block_state.d.ts.map +1 -1
- package/dist/index.d.ts +11 -11
- package/dist/json.cjs +4 -4
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +1 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +4 -4
- package/dist/json.js.map +1 -1
- package/dist/pframe/index.d.ts +1 -1
- package/dist/pframe/internal_api/api_factory.cjs +2 -2
- package/dist/pframe/internal_api/api_factory.cjs.map +1 -1
- package/dist/pframe/internal_api/api_factory.d.ts +3 -3
- package/dist/pframe/internal_api/api_factory.js +2 -2
- package/dist/pframe/internal_api/api_factory.js.map +1 -1
- package/dist/pframe/internal_api/api_read.d.ts +6 -6
- package/dist/pframe/internal_api/api_read.d.ts.map +1 -1
- package/dist/pframe/internal_api/api_wasm.d.ts +4 -4
- package/dist/pframe/internal_api/api_wasm.d.ts.map +1 -1
- package/dist/pframe/internal_api/common.d.ts +3 -3
- package/dist/pframe/internal_api/common.d.ts.map +1 -1
- package/dist/pframe/internal_api/create_table.d.ts +9 -9
- package/dist/pframe/internal_api/create_table.d.ts.map +1 -1
- package/dist/pframe/internal_api/delete_column.d.ts +1 -1
- package/dist/pframe/internal_api/find_columns.d.ts +2 -2
- package/dist/pframe/internal_api/http_helpers.cjs +4 -4
- package/dist/pframe/internal_api/http_helpers.cjs.map +1 -1
- package/dist/pframe/internal_api/http_helpers.d.ts +43 -43
- package/dist/pframe/internal_api/http_helpers.d.ts.map +1 -1
- package/dist/pframe/internal_api/http_helpers.js +4 -4
- package/dist/pframe/internal_api/http_helpers.js.map +1 -1
- package/dist/pframe/internal_api/index.d.ts +11 -11
- package/dist/pframe/internal_api/pframe.d.ts +4 -4
- package/dist/pframe/internal_api/table.d.ts +2 -2
- package/dist/pframe/internal_api/table.d.ts.map +1 -1
- package/dist/project_list.d.ts +1 -1
- package/dist/project_overview.d.ts +7 -7
- package/dist/project_overview.d.ts.map +1 -1
- package/dist/update_info.d.ts +2 -2
- package/package.json +18 -17
- package/src/author_marker.ts +1 -1
- package/src/block_meta/block_components.ts +7 -7
- package/src/block_meta/block_description.ts +17 -14
- package/src/block_meta/block_id.ts +3 -3
- package/src/block_meta/block_manifest.ts +16 -14
- package/src/block_meta/block_meta.ts +17 -21
- package/src/block_meta/common.ts +2 -2
- package/src/block_meta/content_conversion.ts +7 -7
- package/src/block_meta/content_types.ts +35 -35
- package/src/block_meta/index.ts +9 -9
- package/src/block_meta/semver.ts +2 -2
- package/src/block_registry/block_pack_spec.ts +7 -7
- package/src/block_registry/index.ts +3 -3
- package/src/block_registry/overview.ts +34 -26
- package/src/block_registry/registry_spec.ts +5 -5
- package/src/block_settings.ts +1 -1
- package/src/block_state.ts +10 -4
- package/src/index.ts +11 -11
- package/src/json.ts +17 -11
- package/src/pframe/index.ts +1 -1
- package/src/pframe/internal_api/api_factory.ts +6 -6
- package/src/pframe/internal_api/api_read.ts +20 -14
- package/src/pframe/internal_api/api_wasm.ts +9 -20
- package/src/pframe/internal_api/common.ts +5 -7
- package/src/pframe/internal_api/create_table.ts +14 -9
- package/src/pframe/internal_api/delete_column.ts +1 -1
- package/src/pframe/internal_api/find_columns.ts +2 -2
- package/src/pframe/internal_api/http_helpers.ts +52 -52
- package/src/pframe/internal_api/index.ts +11 -11
- package/src/pframe/internal_api/pframe.ts +5 -5
- package/src/pframe/internal_api/table.ts +4 -8
- package/src/project_list.ts +1 -1
- package/src/project_overview.ts +14 -7
- package/src/update_info.ts +2 -2
package/dist/json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sources":["../src/json.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type JsonCompatible,\n type JsonSerializable,\n type StringifiedJson,\n} from
|
|
1
|
+
{"version":3,"file":"json.js","sources":["../src/json.ts"],"sourcesContent":["import {\n canonicalizeJson,\n parseJson,\n type JsonCompatible,\n type JsonSerializable,\n type StringifiedJson,\n} from \"@milaboratories/pl-model-common\";\nimport { createHash } from \"node:crypto\";\nimport fs from \"node:fs\";\n\nexport type HashedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_hashed: T;\n };\n\nexport function hashJson<T>(value: JsonCompatible<T>): HashedJson<T>;\nexport function hashJson<T extends JsonSerializable>(value: T): string;\nexport function hashJson(value: unknown): string {\n const hash = createHash(\"sha256\");\n hash.update(canonicalizeJson(value));\n return hash.digest().toString(\"hex\");\n}\n\nexport async function readJson<T extends JsonSerializable>(\n filePath: string,\n signal?: AbortSignal,\n): Promise<T> {\n const content = await fs.promises.readFile(filePath, { encoding: \"utf8\", signal });\n return parseJson(content as StringifiedJson<T>);\n}\n\nexport function readJsonSync<T extends JsonSerializable>(filePath: string): T {\n const content = fs.readFileSync(filePath, { encoding: \"utf8\" });\n return parseJson(content as StringifiedJson<T>);\n}\n"],"names":[],"mappings":";;;;AAmBM,SAAU,QAAQ,CAAC,KAAc,EAAA;AACrC,IAAA,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC;IACjC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACpC,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC;AACtC;AAEO,eAAe,QAAQ,CAC5B,QAAgB,EAChB,MAAoB,EAAA;AAEpB,IAAA,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAClF,IAAA,OAAO,SAAS,CAAC,OAA6B,CAAC;AACjD;AAEM,SAAU,YAAY,CAA6B,QAAgB,EAAA;AACvE,IAAA,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC/D,IAAA,OAAO,SAAS,CAAC,OAA6B,CAAC;AACjD;;;;"}
|
package/dist/pframe/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * as PFrameInternal from
|
|
1
|
+
export * as PFrameInternal from "./internal_api";
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/** PColumn spec file extension */
|
|
4
|
-
const SpecExtension =
|
|
4
|
+
const SpecExtension = ".spec";
|
|
5
5
|
/** PColumn data info file extension */
|
|
6
|
-
const DataInfoExtension =
|
|
6
|
+
const DataInfoExtension = ".datainfo";
|
|
7
7
|
|
|
8
8
|
exports.DataInfoExtension = DataInfoExtension;
|
|
9
9
|
exports.SpecExtension = SpecExtension;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_factory.cjs","sources":["../../../src/pframe/internal_api/api_factory.ts"],"sourcesContent":["import type {\n BinaryPartitionedDataInfo,\n Branded,\n JsonDataInfo,\n JsonPartitionedDataInfo,\n ParquetChunk,\n ParquetPartitionedDataInfo,\n PColumnSpec,\n PObjectId,\n} from
|
|
1
|
+
{"version":3,"file":"api_factory.cjs","sources":["../../../src/pframe/internal_api/api_factory.ts"],"sourcesContent":["import type {\n BinaryPartitionedDataInfo,\n Branded,\n JsonDataInfo,\n JsonPartitionedDataInfo,\n ParquetChunk,\n ParquetPartitionedDataInfo,\n PColumnSpec,\n PObjectId,\n} from \"@milaboratories/pl-model-common\";\nimport type { HttpServerInfo } from \"./http_helpers\";\n\n/** PColumn spec file extension */\nexport const SpecExtension = \".spec\" as const;\n\n/** PColumn data info file extension */\nexport const DataInfoExtension = \".datainfo\" as const;\n\n/** Abstract identifier of a data blob that can be requested from the storage backend */\nexport type PFrameBlobId = Branded<string, \"PFrameInternal.PFrameBlobId\">;\n\n/** Path of the file containing requested data (blob). This path is returned by\n * {@link BlobPathResolver} as soon as blob materialized in the file system. */\nexport type FilePath = string;\n\n/** Data source allows PFrame to retrieve the data blobs for columns with assigned data info. */\nexport interface PFrameDataSourceV2 {\n /**\n * PFrame may notify storage backend about its plans to use particular blobs in the future.\n * Storage backend will do its best to preload specified blob so the subsequent\n * {@link resolveBlob} will quickly return preloaded file path.\n */\n preloadBlob(blobIds: PFrameBlobId[]): Promise<void>;\n\n /** Returns raw blob data given the blob id from {@link DataInfo}. */\n resolveBlobContent(blobId: PFrameBlobId): Promise<Uint8Array>;\n\n /**\n * Parquet HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer}\n * When not provided, parquet BlobIds would be treated as local file paths.\n */\n parquetServer?: HttpServerInfo;\n}\n\n/**\n * Union type representing all possible data storage formats for PColumn data.\n * The specific format used depends on data size, access patterns, and performance requirements.\n *\n * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)\n */\nexport type DataInfo<Blob> =\n | JsonDataInfo\n | JsonPartitionedDataInfo<Blob>\n | BinaryPartitionedDataInfo<Blob>\n | ParquetPartitionedDataInfo<ParquetChunk<Blob>>;\n\n/** API exposed by PFrames library allowing to create and provide data for\n * PFrame objects */\nexport interface PFrameFactoryAPIV4 extends Disposable {\n /** Associates data source with this PFrame */\n setDataSource(dataSource: PFrameDataSourceV2): void;\n\n /** Adds PColumn without data info */\n addColumnSpec(columnId: PObjectId, columnSpec: PColumnSpec): void;\n\n /**\n * Assign data info to the specified PColumn.\n * For parquet data info, schema resolution via network is performed during this call.\n */\n setColumnData(\n columnId: PObjectId,\n dataInfo: DataInfo<PFrameBlobId>,\n options?: {\n signal?: AbortSignal;\n },\n ): Promise<void>;\n\n /** Releases all the data previously added to PFrame using methods above,\n * any interactions with disposed PFrame will result in exception */\n dispose(): void;\n}\n"],"names":[],"mappings":";;AAYA;AACO,MAAM,aAAa,GAAG;AAE7B;AACO,MAAM,iBAAiB,GAAG;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { BinaryPartitionedDataInfo, Branded, JsonDataInfo, JsonPartitionedDataInfo, ParquetChunk, ParquetPartitionedDataInfo, PColumnSpec, PObjectId } from
|
|
2
|
-
import type { HttpServerInfo } from
|
|
1
|
+
import type { BinaryPartitionedDataInfo, Branded, JsonDataInfo, JsonPartitionedDataInfo, ParquetChunk, ParquetPartitionedDataInfo, PColumnSpec, PObjectId } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { HttpServerInfo } from "./http_helpers";
|
|
3
3
|
/** PColumn spec file extension */
|
|
4
4
|
export declare const SpecExtension: ".spec";
|
|
5
5
|
/** PColumn data info file extension */
|
|
6
6
|
export declare const DataInfoExtension: ".datainfo";
|
|
7
7
|
/** Abstract identifier of a data blob that can be requested from the storage backend */
|
|
8
|
-
export type PFrameBlobId = Branded<string,
|
|
8
|
+
export type PFrameBlobId = Branded<string, "PFrameInternal.PFrameBlobId">;
|
|
9
9
|
/** Path of the file containing requested data (blob). This path is returned by
|
|
10
10
|
* {@link BlobPathResolver} as soon as blob materialized in the file system. */
|
|
11
11
|
export type FilePath = string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** PColumn spec file extension */
|
|
2
|
-
const SpecExtension =
|
|
2
|
+
const SpecExtension = ".spec";
|
|
3
3
|
/** PColumn data info file extension */
|
|
4
|
-
const DataInfoExtension =
|
|
4
|
+
const DataInfoExtension = ".datainfo";
|
|
5
5
|
|
|
6
6
|
export { DataInfoExtension, SpecExtension };
|
|
7
7
|
//# sourceMappingURL=api_factory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_factory.js","sources":["../../../src/pframe/internal_api/api_factory.ts"],"sourcesContent":["import type {\n BinaryPartitionedDataInfo,\n Branded,\n JsonDataInfo,\n JsonPartitionedDataInfo,\n ParquetChunk,\n ParquetPartitionedDataInfo,\n PColumnSpec,\n PObjectId,\n} from
|
|
1
|
+
{"version":3,"file":"api_factory.js","sources":["../../../src/pframe/internal_api/api_factory.ts"],"sourcesContent":["import type {\n BinaryPartitionedDataInfo,\n Branded,\n JsonDataInfo,\n JsonPartitionedDataInfo,\n ParquetChunk,\n ParquetPartitionedDataInfo,\n PColumnSpec,\n PObjectId,\n} from \"@milaboratories/pl-model-common\";\nimport type { HttpServerInfo } from \"./http_helpers\";\n\n/** PColumn spec file extension */\nexport const SpecExtension = \".spec\" as const;\n\n/** PColumn data info file extension */\nexport const DataInfoExtension = \".datainfo\" as const;\n\n/** Abstract identifier of a data blob that can be requested from the storage backend */\nexport type PFrameBlobId = Branded<string, \"PFrameInternal.PFrameBlobId\">;\n\n/** Path of the file containing requested data (blob). This path is returned by\n * {@link BlobPathResolver} as soon as blob materialized in the file system. */\nexport type FilePath = string;\n\n/** Data source allows PFrame to retrieve the data blobs for columns with assigned data info. */\nexport interface PFrameDataSourceV2 {\n /**\n * PFrame may notify storage backend about its plans to use particular blobs in the future.\n * Storage backend will do its best to preload specified blob so the subsequent\n * {@link resolveBlob} will quickly return preloaded file path.\n */\n preloadBlob(blobIds: PFrameBlobId[]): Promise<void>;\n\n /** Returns raw blob data given the blob id from {@link DataInfo}. */\n resolveBlobContent(blobId: PFrameBlobId): Promise<Uint8Array>;\n\n /**\n * Parquet HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer}\n * When not provided, parquet BlobIds would be treated as local file paths.\n */\n parquetServer?: HttpServerInfo;\n}\n\n/**\n * Union type representing all possible data storage formats for PColumn data.\n * The specific format used depends on data size, access patterns, and performance requirements.\n *\n * @template Blob - Type parameter representing the storage reference type (could be ResourceInfo, PFrameBlobId, etc.)\n */\nexport type DataInfo<Blob> =\n | JsonDataInfo\n | JsonPartitionedDataInfo<Blob>\n | BinaryPartitionedDataInfo<Blob>\n | ParquetPartitionedDataInfo<ParquetChunk<Blob>>;\n\n/** API exposed by PFrames library allowing to create and provide data for\n * PFrame objects */\nexport interface PFrameFactoryAPIV4 extends Disposable {\n /** Associates data source with this PFrame */\n setDataSource(dataSource: PFrameDataSourceV2): void;\n\n /** Adds PColumn without data info */\n addColumnSpec(columnId: PObjectId, columnSpec: PColumnSpec): void;\n\n /**\n * Assign data info to the specified PColumn.\n * For parquet data info, schema resolution via network is performed during this call.\n */\n setColumnData(\n columnId: PObjectId,\n dataInfo: DataInfo<PFrameBlobId>,\n options?: {\n signal?: AbortSignal;\n },\n ): Promise<void>;\n\n /** Releases all the data previously added to PFrame using methods above,\n * any interactions with disposed PFrame will result in exception */\n dispose(): void;\n}\n"],"names":[],"mappings":"AAYA;AACO,MAAM,aAAa,GAAG;AAE7B;AACO,MAAM,iBAAiB,GAAG;;;;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import type { FindColumnsRequest, FindColumnsResponse } from
|
|
2
|
-
import type { DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse } from
|
|
3
|
-
import type { PColumnInfo, PColumnSpec, PObjectId, UniqueValuesRequest, UniqueValuesResponse, QueryData, AxisId, PColumnIdAndSpec } from
|
|
4
|
-
import type { CreateTableRequestV4 } from
|
|
5
|
-
import type { PTableV8 } from
|
|
6
|
-
import type { PTableId } from
|
|
1
|
+
import type { FindColumnsRequest, FindColumnsResponse } from "./find_columns";
|
|
2
|
+
import type { DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse } from "./delete_column";
|
|
3
|
+
import type { PColumnInfo, PColumnSpec, PObjectId, UniqueValuesRequest, UniqueValuesResponse, QueryData, AxisId, PColumnIdAndSpec } from "@milaboratories/pl-model-common";
|
|
4
|
+
import type { CreateTableRequestV4 } from "./create_table";
|
|
5
|
+
import type { PTableV8 } from "./table";
|
|
6
|
+
import type { PTableId } from "./common";
|
|
7
7
|
/** Read interface exposed by PFrames library */
|
|
8
8
|
export interface PFrameReadAPIV11 {
|
|
9
9
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_read.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/api_read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"api_read.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/api_read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,MAAM,EACN,gBAAgB,EACjB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEzC,gDAAgD;AAChD,MAAM,WAAW,gBAAgB;IAC/B;;;;;;;SAOK;IACL,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAEvE;;;OAGG;IACH,YAAY,CAAC,OAAO,EAAE,8BAA8B,GAAG,OAAO,CAAC,+BAA+B,CAAC,CAAC;IAEhG,kCAAkC;IAClC,aAAa,CAAC,QAAQ,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEhE,2EAA2E;IAC3E,WAAW,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAEtC,uEAAuE;IACvE,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,oBAAoB,GAAG,QAAQ,CAAC;IAExE,uEAAuE;IACvE,sBAAsB,CACpB,OAAO,EAAE,QAAQ,EACjB,OAAO,EAAE;QACP,SAAS,EAAE;YACT,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,OAAO,EAAE,gBAAgB,EAAE,CAAC;SAC7B,CAAC;QACF,SAAS,EAAE,SAAS,CAAC;KACtB,GACA,QAAQ,CAAC;IAEZ,yFAAyF;IACzF,eAAe,CACb,OAAO,EAAE,mBAAmB,EAC5B,GAAG,CAAC,EAAE;QACJ,MAAM,CAAC,EAAE,WAAW,CAAC;KACtB,GACA,OAAO,CAAC,oBAAoB,CAAC,CAAC;CAClC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { AxesId, AxesSpec, JoinEntry, PColumnSpec, PObjectId, PTableColumnSpec, PTableRecordFilter, PTableSorting, QueryData, QuerySpec, SingleAxisSelector } from
|
|
2
|
-
import type { DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse } from
|
|
3
|
-
import type { FindColumnsRequest, FindColumnsResponse } from
|
|
1
|
+
import type { AxesId, AxesSpec, JoinEntry, PColumnSpec, PObjectId, PTableColumnSpec, PTableRecordFilter, PTableSorting, QueryData, QuerySpec, SingleAxisSelector } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { DeleteColumnFromColumnsRequest, DeleteColumnFromColumnsResponse } from "./delete_column";
|
|
3
|
+
import type { FindColumnsRequest, FindColumnsResponse } from "./find_columns";
|
|
4
4
|
export interface PFrameWasmAPI {
|
|
5
5
|
/**
|
|
6
6
|
* Creates a new PFrame from a map of column IDs to column specifications.
|
|
@@ -62,7 +62,7 @@ export type EvaluateQueryResponse = {
|
|
|
62
62
|
* The data layer query representation with numeric indices,
|
|
63
63
|
* suitable for execution by the data processing engine.
|
|
64
64
|
*/
|
|
65
|
-
|
|
65
|
+
dataQuery: QueryData;
|
|
66
66
|
};
|
|
67
67
|
/**
|
|
68
68
|
* Represents a legacy (V4) query format used before the unified QuerySpec.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api_wasm.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/api_wasm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,SAAS,EACT,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"api_wasm.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/api_wasm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,SAAS,EACT,WAAW,EACX,SAAS,EACT,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,SAAS,EACT,SAAS,EACT,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EACV,8BAA8B,EAC9B,+BAA+B,EAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE9E,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,UAAU,CAAC;IAE5D;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAAC;IAEnC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,QAAQ,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAAC;CAChE;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,UAAU;IAC5C;;OAEG;IACH,aAAa,CAAC,OAAO,EAAE,8BAA8B,GAAG,+BAA+B,CAAC;IAExF;;OAEG;IACH,WAAW,CAAC,OAAO,EAAE,kBAAkB,GAAG,mBAAmB,CAAC;IAC9D;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,SAAS,GAAG,qBAAqB,CAAC;IAEzD;;;;;;OAMG;IACH,kBAAkB,CAAC,OAAO,EAAE,WAAW,GAAG,SAAS,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC;;;OAGG;IACH,SAAS,EAAE,gBAAgB,EAAE,CAAC;IAC9B;;;OAGG;IACH,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,WAAW,GAAG;IACxB,0EAA0E;IAC1E,GAAG,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC1B,mEAAmE;IACnE,OAAO,CAAC,EAAE,kBAAkB,EAAE,CAAC;IAC/B,gEAAgE;IAChE,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { AxisSpec, PFrameHandle, PTableHandle, SingleAxisSelector } from
|
|
2
|
-
export type Logger = (level:
|
|
1
|
+
import type { AxisSpec, PFrameHandle, PTableHandle, SingleAxisSelector } from "@milaboratories/pl-model-common";
|
|
2
|
+
export type Logger = (level: "info" | "warn" | "error", message: string) => void;
|
|
3
3
|
export type PFrameId = PFrameHandle;
|
|
4
4
|
export type PTableId = PTableHandle;
|
|
5
5
|
export interface AxisQualification {
|
|
@@ -11,7 +11,7 @@ export interface ColumnAxesWithQualifications {
|
|
|
11
11
|
qualifications: AxisQualification[];
|
|
12
12
|
}
|
|
13
13
|
export type ConstantAxisFilter = {
|
|
14
|
-
type:
|
|
14
|
+
type: "constant";
|
|
15
15
|
axisIndex: number;
|
|
16
16
|
constant: string | number;
|
|
17
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/common.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAEjF,MAAM,MAAM,QAAQ,GAAG,YAAY,CAAC;AAEpC,MAAM,MAAM,QAAQ,GAAG,YAAY,CAAC;AAEpC,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,kBAAkB,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,QAAQ,EAAE,CAAC;IACrB,cAAc,EAAE,iBAAiB,EAAE,CAAC;CACrC;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B,CAAC"}
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
import type { ConstantAxisFilter } from
|
|
2
|
-
import type { JsonDataInfo, PColumnSpec, PObjectId, PTableRecordFilter } from
|
|
1
|
+
import type { ConstantAxisFilter } from "./common";
|
|
2
|
+
import type { JsonDataInfo, PColumnSpec, PObjectId, PTableRecordFilter } from "@milaboratories/pl-model-common";
|
|
3
3
|
export interface ColumnJoinEntry {
|
|
4
|
-
type:
|
|
4
|
+
type: "column";
|
|
5
5
|
columnId: PObjectId;
|
|
6
6
|
}
|
|
7
7
|
export interface SlicedColumnJoinEntry {
|
|
8
|
-
readonly type:
|
|
8
|
+
readonly type: "slicedColumn";
|
|
9
9
|
readonly columnId: PObjectId;
|
|
10
10
|
readonly newId: PObjectId;
|
|
11
11
|
readonly axisFilters: ConstantAxisFilter[];
|
|
12
12
|
}
|
|
13
13
|
export interface ArtificialColumnJoinEntry {
|
|
14
|
-
readonly type:
|
|
14
|
+
readonly type: "artificialColumn";
|
|
15
15
|
readonly columnId: PObjectId;
|
|
16
16
|
readonly newId: PObjectId;
|
|
17
17
|
readonly axesIndices: number[];
|
|
18
18
|
}
|
|
19
19
|
export interface InlineColumnJoinEntry {
|
|
20
|
-
readonly type:
|
|
20
|
+
readonly type: "inlineColumn";
|
|
21
21
|
readonly newId: PObjectId;
|
|
22
22
|
readonly spec: PColumnSpec;
|
|
23
23
|
readonly dataInfo: JsonDataInfo;
|
|
24
24
|
}
|
|
25
25
|
export interface InnerJoinV4 {
|
|
26
|
-
type:
|
|
26
|
+
type: "inner";
|
|
27
27
|
entries: JoinEntryV4[];
|
|
28
28
|
}
|
|
29
29
|
export interface FullJoinV4 {
|
|
30
|
-
type:
|
|
30
|
+
type: "full";
|
|
31
31
|
entries: JoinEntryV4[];
|
|
32
32
|
}
|
|
33
33
|
export interface OuterJoinV4 {
|
|
34
|
-
type:
|
|
34
|
+
type: "outer";
|
|
35
35
|
primary: JoinEntryV4;
|
|
36
36
|
secondary: JoinEntryV4[];
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_table.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/create_table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"create_table.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/create_table.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,KAAK,EACV,YAAY,EACZ,WAAW,EACX,SAAS,EACT,kBAAkB,EACnB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,QAAQ,CAAC;IACf,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,kBAAkB,EAAE,CAAC;CAC5C;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;CACjC;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,WAAW,EAAE,CAAC;CAC1B;AAED,MAAM,MAAM,WAAW,GACnB,eAAe,GACf,qBAAqB,GACrB,yBAAyB,GACzB,qBAAqB,GACrB,WAAW,GACX,UAAU,GACV,WAAW,CAAC;AAEhB,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,WAAW,CAAC;IACjB,OAAO,EAAE,kBAAkB,EAAE,CAAC;CAC/B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ColumnFilter, PColumnIdAndSpec } from
|
|
2
|
-
import type { AxisQualification, ColumnAxesWithQualifications } from
|
|
1
|
+
import type { ColumnFilter, PColumnIdAndSpec } from "@milaboratories/pl-model-common";
|
|
2
|
+
import type { AxisQualification, ColumnAxesWithQualifications } from "./common";
|
|
3
3
|
export interface FindColumnsRequest {
|
|
4
4
|
columnFilter: ColumnFilter;
|
|
5
5
|
compatibleWith: ColumnAxesWithQualifications[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
/** Parquet file extension */
|
|
4
|
-
const ParquetExtension =
|
|
4
|
+
const ParquetExtension = ".parquet";
|
|
5
5
|
/** File system abstraction for request handler factory, @see HttpHelpers.createRequestHandler */
|
|
6
6
|
class BaseObjectStore {
|
|
7
7
|
logger;
|
|
@@ -13,15 +13,15 @@ class BaseObjectStore {
|
|
|
13
13
|
if (!range)
|
|
14
14
|
return { start: 0, end: fileSize - 1 };
|
|
15
15
|
switch (range.type) {
|
|
16
|
-
case
|
|
16
|
+
case "bounded":
|
|
17
17
|
if (range.end >= fileSize)
|
|
18
18
|
return null;
|
|
19
19
|
return { start: range.start, end: range.end };
|
|
20
|
-
case
|
|
20
|
+
case "offset":
|
|
21
21
|
if (range.offset >= fileSize)
|
|
22
22
|
return null;
|
|
23
23
|
return { start: range.offset, end: fileSize - 1 };
|
|
24
|
-
case
|
|
24
|
+
case "suffix":
|
|
25
25
|
if (range.suffix > fileSize)
|
|
26
26
|
return null;
|
|
27
27
|
return { start: fileSize - range.suffix, end: fileSize - 1 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_helpers.cjs","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"sourcesContent":["import type { Readable } from 'node:stream';\nimport type { RequestListener } from 'node:http';\nimport type { Branded, Base64Encoded } from '@milaboratories/pl-model-common';\nimport type { Logger } from './common';\n\n/** Parquet file extension */\nexport const ParquetExtension = '.parquet' as const;\n\n/** Parquet file name */\nexport type ParquetFileName = Branded<`${string}.parquet`, 'PFrameInternal.ParquetFileName'>;\n\nexport type FileRange = {\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n};\n\n/** HTTP range as of RFC 9110 <https://datatracker.ietf.org/doc/html/rfc9110#name-range> */\nexport type HttpRange =\n | {\n /**\n * Get file content in the specified byte range\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=0-1023\n * ```\n */\n type: 'bounded';\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n }\n | {\n /**\n * Get byte range starting from the specified offset\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=1024-\n * ```\n */\n type: 'offset';\n /** Start byte position (inclusive) */\n offset: number;\n }\n | {\n /**\n * Get byte range starting from the specified suffix\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=-1024\n * ```\n */\n type: 'suffix';\n /** End byte position (inclusive) */\n suffix: number;\n };\n\n/** HTTP method passed to object store */\nexport type HttpMethod = 'GET' | 'HEAD';\n\n/** HTTP response from object store */\nexport type ObjectStoreResponse =\n | {\n /**\n * Will be translated to 500 Internal Server Error by the handler\n * or 408 Request Timeout if the request was aborted\n */\n type: 'InternalError';\n }\n | {\n /** Will be translated to 404 Not Found by the handler */\n type: 'NotFound';\n }\n | {\n /** Will be translated to 416 Range Not Satisfiable by the handler */\n type: 'RangeNotSatisfiable';\n /** Total file size in bytes */\n size: number;\n }\n | {\n /** Will be translated to 200 OK or 206 Partial Content by the handler */\n type: 'Ok';\n /** Total file size in bytes */\n size: number;\n /** File range translated from HTTP range */\n range: FileRange;\n /** Stream of file content, undefined for HEAD requests */\n data?: Readable;\n };\n\n/** Common options for object store creation */\nexport interface ObjectStoreOptions {\n /** Logger instance, no logging is performed when not provided */\n logger?: Logger;\n}\n\n/** Options for file system object store creation */\nexport interface FsStoreOptions extends ObjectStoreOptions {\n /** Local directory to serve files from */\n rootDir: string;\n}\n\nexport interface ObjectStore {\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n }\n ): void;\n}\n\n/** File system abstraction for request handler factory, @see HttpHelpers.createRequestHandler */\nexport abstract class BaseObjectStore implements ObjectStore {\n protected readonly logger: Logger;\n\n constructor(options: ObjectStoreOptions) {\n this.logger = options.logger ?? (() => {});\n }\n\n /** Translate HTTP range to file range, @returns null if the range is not satisfiable */\n protected translate(fileSize: number, range?: HttpRange): FileRange | null {\n if (!range) return { start: 0, end: fileSize - 1 };\n switch (range.type) {\n case 'bounded':\n if (range.end >= fileSize) return null;\n return { start: range.start, end: range.end };\n case 'offset':\n if (range.offset >= fileSize) return null;\n return { start: range.offset, end: fileSize - 1 };\n case 'suffix':\n if (range.suffix > fileSize) return null;\n return { start: fileSize - range.suffix, end: fileSize - 1 };\n }\n }\n\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n abstract request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n }\n ): Promise<void>;\n}\n\n/** Object store base URL in format accepted by Apache DataFusion and DuckDB */\nexport type ObjectStoreUrl = Branded<string, 'PFrameInternal.ObjectStoreUrl'>;\n\n/** HTTP(S) request handler creation options */\nexport type RequestHandlerOptions = {\n /** Object store to serve files from, @see HttpHelpers.createFsStore */\n store: ObjectStore;\n /** Here will go caching options... */\n};\n\n/** Server configuration options */\nexport type HttpServerOptions = {\n /** HTTP(S) request handler function, @see HttpHelpers.createRequestHandler */\n handler: RequestListener;\n /** Port to bind to, @default 0 for auto-assignment */\n port?: number;\n /** Do not apply authorization middleware to @param handler */\n noAuth?: true;\n /** Downgrade default HTTPS server to plain HTTP, @warning use only for testing */\n noHttps?: true;\n};\n\n/**\n * Long unique opaque string for use in Bearer authorization header\n *\n * @example\n * ```ts\n * request.setHeader('Authorization', `Bearer ${authToken}`);\n * ```\n */\nexport type HttpAuthorizationToken = Branded<string, 'PFrameInternal.HttpAuthorizationToken'>;\n\n/**\n * TLS certificate in PEM format\n *\n * @example\n * ```txt\n * -----BEGIN CERTIFICATE-----\n * MIIC2zCCAcOgAwIBAgIJaVW7...\n * ...\n * ...Yf9CRK8fgnukKM7TJ\n * -----END CERTIFICATE-----\n * ```\n */\nexport type PemCertificate = Branded<string, 'PFrameInternal.PemCertificate'>;\n\n/** HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */\nexport type HttpServerInfo = {\n /** URL of the HTTP(S) server formatted as `http{s}://<host>:<port>/` */\n url: ObjectStoreUrl;\n /** Authorization token for Bearer scheme, undefined when @see HttpServerOptions.noAuth flag is set */\n authToken?: HttpAuthorizationToken;\n /** Encoded CA certificate of HTTPS server, undefined when @see HttpServerOptions.noHttps flag is set */\n encodedCaCert?: Base64Encoded<PemCertificate>;\n};\n\n/** HTTP(S) server information and controls, @see HttpHelpers.createHttpServer */\nexport interface HttpServer {\n /** Server configuration information for initiating connections from clients */\n get info(): HttpServerInfo;\n /** Promise that resolves when the server is stopped */\n get stopped(): Promise<void>;\n /** Request server stop, returns the same promise as @see HttpServer.stopped */\n stop(): Promise<void>;\n}\n\n/** List of HTTP(S) related helper functions exposed by PFrame module */\nexport interface HttpHelpers {\n /**\n * Create an object store for serving files from a local directory.\n * Rejects if the provided path does not exist or is not a directory.\n */\n createFsStore(options: FsStoreOptions): Promise<ObjectStore>;\n\n /**\n * Create an HTTP request handler for serving files from an object store.\n * Accepts only paths of the form `/<filename>.parquet`, returns 410 otherwise.\n * Assumes that files are immutable (and sets cache headers accordingly).\n */\n createRequestHandler(options: RequestHandlerOptions): RequestListener;\n\n /**\n * Serve HTTP(S) requests using the provided handler on localhost port.\n * @returns promise that resolves when the server has stopped.\n *\n * @example\n * ```ts\n * const rootDir = '/path/to/directory/with/parquet/files';\n *\n * let store = await HttpHelpers.createFsStore({ rootDir }).catch((err: unknown) => {\n * throw new Error(`Failed to create file store for ${rootDir} - ${ensureError(err)}`);\n * });\n *\n * const server = await HttpHelpers.createHttpServer({\n * handler: HttpHelpers.createRequestHandler({ store }),\n * }).catch((err: unknown) => {\n * throw new Error(`Failed to start HTTPS server - ${ensureError(err)}`);\n * });\n *\n * const { url, authToken, encodedCaCert } = server.info;\n *\n * await server.stop();\n * ```\n */\n createHttpServer(options: HttpServerOptions): Promise<HttpServer>;\n}\n"],"names":[],"mappings":";;AAKA;AACO,MAAM,gBAAgB,GAAG;AAyHhC;MACsB,eAAe,CAAA;AAChB,IAAA,MAAM;AAEzB,IAAA,WAAA,CAAY,OAA2B,EAAA;AACrC,QAAA,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,MAAK,EAAE,CAAC,CAAC;IAC5C;;IAGU,SAAS,CAAC,QAAgB,EAAE,KAAiB,EAAA;AACrD,QAAA,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AAClD,QAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,SAAS;AACZ,gBAAA,IAAI,KAAK,CAAC,GAAG,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACtC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC/C,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACzC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACxC,gBAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;;IAElE;AAgBD;;;;;"}
|
|
1
|
+
{"version":3,"file":"http_helpers.cjs","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"sourcesContent":["import type { Readable } from \"node:stream\";\nimport type { RequestListener } from \"node:http\";\nimport type { Branded, Base64Encoded } from \"@milaboratories/pl-model-common\";\nimport type { Logger } from \"./common\";\n\n/** Parquet file extension */\nexport const ParquetExtension = \".parquet\" as const;\n\n/** Parquet file name */\nexport type ParquetFileName = Branded<`${string}.parquet`, \"PFrameInternal.ParquetFileName\">;\n\nexport type FileRange = {\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n};\n\n/** HTTP range as of RFC 9110 <https://datatracker.ietf.org/doc/html/rfc9110#name-range> */\nexport type HttpRange =\n | {\n /**\n * Get file content in the specified byte range\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=0-1023\n * ```\n */\n type: \"bounded\";\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n }\n | {\n /**\n * Get byte range starting from the specified offset\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=1024-\n * ```\n */\n type: \"offset\";\n /** Start byte position (inclusive) */\n offset: number;\n }\n | {\n /**\n * Get byte range starting from the specified suffix\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=-1024\n * ```\n */\n type: \"suffix\";\n /** End byte position (inclusive) */\n suffix: number;\n };\n\n/** HTTP method passed to object store */\nexport type HttpMethod = \"GET\" | \"HEAD\";\n\n/** HTTP response from object store */\nexport type ObjectStoreResponse =\n | {\n /**\n * Will be translated to 500 Internal Server Error by the handler\n * or 408 Request Timeout if the request was aborted\n */\n type: \"InternalError\";\n }\n | {\n /** Will be translated to 404 Not Found by the handler */\n type: \"NotFound\";\n }\n | {\n /** Will be translated to 416 Range Not Satisfiable by the handler */\n type: \"RangeNotSatisfiable\";\n /** Total file size in bytes */\n size: number;\n }\n | {\n /** Will be translated to 200 OK or 206 Partial Content by the handler */\n type: \"Ok\";\n /** Total file size in bytes */\n size: number;\n /** File range translated from HTTP range */\n range: FileRange;\n /** Stream of file content, undefined for HEAD requests */\n data?: Readable;\n };\n\n/** Common options for object store creation */\nexport interface ObjectStoreOptions {\n /** Logger instance, no logging is performed when not provided */\n logger?: Logger;\n}\n\n/** Options for file system object store creation */\nexport interface FsStoreOptions extends ObjectStoreOptions {\n /** Local directory to serve files from */\n rootDir: string;\n}\n\nexport interface ObjectStore {\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n },\n ): void;\n}\n\n/** File system abstraction for request handler factory, @see HttpHelpers.createRequestHandler */\nexport abstract class BaseObjectStore implements ObjectStore {\n protected readonly logger: Logger;\n\n constructor(options: ObjectStoreOptions) {\n this.logger = options.logger ?? (() => {});\n }\n\n /** Translate HTTP range to file range, @returns null if the range is not satisfiable */\n protected translate(fileSize: number, range?: HttpRange): FileRange | null {\n if (!range) return { start: 0, end: fileSize - 1 };\n switch (range.type) {\n case \"bounded\":\n if (range.end >= fileSize) return null;\n return { start: range.start, end: range.end };\n case \"offset\":\n if (range.offset >= fileSize) return null;\n return { start: range.offset, end: fileSize - 1 };\n case \"suffix\":\n if (range.suffix > fileSize) return null;\n return { start: fileSize - range.suffix, end: fileSize - 1 };\n }\n }\n\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n abstract request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n },\n ): Promise<void>;\n}\n\n/** Object store base URL in format accepted by Apache DataFusion and DuckDB */\nexport type ObjectStoreUrl = Branded<string, \"PFrameInternal.ObjectStoreUrl\">;\n\n/** HTTP(S) request handler creation options */\nexport type RequestHandlerOptions = {\n /** Object store to serve files from, @see HttpHelpers.createFsStore */\n store: ObjectStore;\n /** Here will go caching options... */\n};\n\n/** Server configuration options */\nexport type HttpServerOptions = {\n /** HTTP(S) request handler function, @see HttpHelpers.createRequestHandler */\n handler: RequestListener;\n /** Port to bind to, @default 0 for auto-assignment */\n port?: number;\n /** Do not apply authorization middleware to @param handler */\n noAuth?: true;\n /** Downgrade default HTTPS server to plain HTTP, @warning use only for testing */\n noHttps?: true;\n};\n\n/**\n * Long unique opaque string for use in Bearer authorization header\n *\n * @example\n * ```ts\n * request.setHeader('Authorization', `Bearer ${authToken}`);\n * ```\n */\nexport type HttpAuthorizationToken = Branded<string, \"PFrameInternal.HttpAuthorizationToken\">;\n\n/**\n * TLS certificate in PEM format\n *\n * @example\n * ```txt\n * -----BEGIN CERTIFICATE-----\n * MIIC2zCCAcOgAwIBAgIJaVW7...\n * ...\n * ...Yf9CRK8fgnukKM7TJ\n * -----END CERTIFICATE-----\n * ```\n */\nexport type PemCertificate = Branded<string, \"PFrameInternal.PemCertificate\">;\n\n/** HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */\nexport type HttpServerInfo = {\n /** URL of the HTTP(S) server formatted as `http{s}://<host>:<port>/` */\n url: ObjectStoreUrl;\n /** Authorization token for Bearer scheme, undefined when @see HttpServerOptions.noAuth flag is set */\n authToken?: HttpAuthorizationToken;\n /** Encoded CA certificate of HTTPS server, undefined when @see HttpServerOptions.noHttps flag is set */\n encodedCaCert?: Base64Encoded<PemCertificate>;\n};\n\n/** HTTP(S) server information and controls, @see HttpHelpers.createHttpServer */\nexport interface HttpServer {\n /** Server configuration information for initiating connections from clients */\n get info(): HttpServerInfo;\n /** Promise that resolves when the server is stopped */\n get stopped(): Promise<void>;\n /** Request server stop, returns the same promise as @see HttpServer.stopped */\n stop(): Promise<void>;\n}\n\n/** List of HTTP(S) related helper functions exposed by PFrame module */\nexport interface HttpHelpers {\n /**\n * Create an object store for serving files from a local directory.\n * Rejects if the provided path does not exist or is not a directory.\n */\n createFsStore(options: FsStoreOptions): Promise<ObjectStore>;\n\n /**\n * Create an HTTP request handler for serving files from an object store.\n * Accepts only paths of the form `/<filename>.parquet`, returns 410 otherwise.\n * Assumes that files are immutable (and sets cache headers accordingly).\n */\n createRequestHandler(options: RequestHandlerOptions): RequestListener;\n\n /**\n * Serve HTTP(S) requests using the provided handler on localhost port.\n * @returns promise that resolves when the server has stopped.\n *\n * @example\n * ```ts\n * const rootDir = '/path/to/directory/with/parquet/files';\n *\n * let store = await HttpHelpers.createFsStore({ rootDir }).catch((err: unknown) => {\n * throw new Error(`Failed to create file store for ${rootDir} - ${ensureError(err)}`);\n * });\n *\n * const server = await HttpHelpers.createHttpServer({\n * handler: HttpHelpers.createRequestHandler({ store }),\n * }).catch((err: unknown) => {\n * throw new Error(`Failed to start HTTPS server - ${ensureError(err)}`);\n * });\n *\n * const { url, authToken, encodedCaCert } = server.info;\n *\n * await server.stop();\n * ```\n */\n createHttpServer(options: HttpServerOptions): Promise<HttpServer>;\n}\n"],"names":[],"mappings":";;AAKA;AACO,MAAM,gBAAgB,GAAG;AAyHhC;MACsB,eAAe,CAAA;AAChB,IAAA,MAAM;AAEzB,IAAA,WAAA,CAAY,OAA2B,EAAA;AACrC,QAAA,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,MAAK,EAAE,CAAC,CAAC;IAC5C;;IAGU,SAAS,CAAC,QAAgB,EAAE,KAAiB,EAAA;AACrD,QAAA,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AAClD,QAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,SAAS;AACZ,gBAAA,IAAI,KAAK,CAAC,GAAG,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACtC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC/C,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACzC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACxC,gBAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;;IAElE;AAgBD;;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { Readable } from
|
|
2
|
-
import type { RequestListener } from
|
|
3
|
-
import type { Branded, Base64Encoded } from
|
|
4
|
-
import type { Logger } from
|
|
1
|
+
import type { Readable } from "node:stream";
|
|
2
|
+
import type { RequestListener } from "node:http";
|
|
3
|
+
import type { Branded, Base64Encoded } from "@milaboratories/pl-model-common";
|
|
4
|
+
import type { Logger } from "./common";
|
|
5
5
|
/** Parquet file extension */
|
|
6
6
|
export declare const ParquetExtension: ".parquet";
|
|
7
7
|
/** Parquet file name */
|
|
8
|
-
export type ParquetFileName = Branded<`${string}.parquet`,
|
|
8
|
+
export type ParquetFileName = Branded<`${string}.parquet`, "PFrameInternal.ParquetFileName">;
|
|
9
9
|
export type FileRange = {
|
|
10
10
|
/** Start byte position (inclusive) */
|
|
11
11
|
start: number;
|
|
@@ -15,66 +15,66 @@ export type FileRange = {
|
|
|
15
15
|
/** HTTP range as of RFC 9110 <https://datatracker.ietf.org/doc/html/rfc9110#name-range> */
|
|
16
16
|
export type HttpRange = {
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type:
|
|
18
|
+
* Get file content in the specified byte range
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```
|
|
22
|
+
* GET /file.parquet HTTP/1.1
|
|
23
|
+
* Range: bytes=0-1023
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
type: "bounded";
|
|
27
27
|
/** Start byte position (inclusive) */
|
|
28
28
|
start: number;
|
|
29
29
|
/** End byte position (inclusive) */
|
|
30
30
|
end: number;
|
|
31
31
|
} | {
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
type:
|
|
33
|
+
* Get byte range starting from the specified offset
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```
|
|
37
|
+
* GET /file.parquet HTTP/1.1
|
|
38
|
+
* Range: bytes=1024-
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
type: "offset";
|
|
42
42
|
/** Start byte position (inclusive) */
|
|
43
43
|
offset: number;
|
|
44
44
|
} | {
|
|
45
45
|
/**
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
type:
|
|
46
|
+
* Get byte range starting from the specified suffix
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```
|
|
50
|
+
* GET /file.parquet HTTP/1.1
|
|
51
|
+
* Range: bytes=-1024
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
type: "suffix";
|
|
55
55
|
/** End byte position (inclusive) */
|
|
56
56
|
suffix: number;
|
|
57
57
|
};
|
|
58
58
|
/** HTTP method passed to object store */
|
|
59
|
-
export type HttpMethod =
|
|
59
|
+
export type HttpMethod = "GET" | "HEAD";
|
|
60
60
|
/** HTTP response from object store */
|
|
61
61
|
export type ObjectStoreResponse = {
|
|
62
62
|
/**
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
type:
|
|
63
|
+
* Will be translated to 500 Internal Server Error by the handler
|
|
64
|
+
* or 408 Request Timeout if the request was aborted
|
|
65
|
+
*/
|
|
66
|
+
type: "InternalError";
|
|
67
67
|
} | {
|
|
68
68
|
/** Will be translated to 404 Not Found by the handler */
|
|
69
|
-
type:
|
|
69
|
+
type: "NotFound";
|
|
70
70
|
} | {
|
|
71
71
|
/** Will be translated to 416 Range Not Satisfiable by the handler */
|
|
72
|
-
type:
|
|
72
|
+
type: "RangeNotSatisfiable";
|
|
73
73
|
/** Total file size in bytes */
|
|
74
74
|
size: number;
|
|
75
75
|
} | {
|
|
76
76
|
/** Will be translated to 200 OK or 206 Partial Content by the handler */
|
|
77
|
-
type:
|
|
77
|
+
type: "Ok";
|
|
78
78
|
/** Total file size in bytes */
|
|
79
79
|
size: number;
|
|
80
80
|
/** File range translated from HTTP range */
|
|
@@ -124,7 +124,7 @@ export declare abstract class BaseObjectStore implements ObjectStore {
|
|
|
124
124
|
}): Promise<void>;
|
|
125
125
|
}
|
|
126
126
|
/** Object store base URL in format accepted by Apache DataFusion and DuckDB */
|
|
127
|
-
export type ObjectStoreUrl = Branded<string,
|
|
127
|
+
export type ObjectStoreUrl = Branded<string, "PFrameInternal.ObjectStoreUrl">;
|
|
128
128
|
/** HTTP(S) request handler creation options */
|
|
129
129
|
export type RequestHandlerOptions = {
|
|
130
130
|
/** Object store to serve files from, @see HttpHelpers.createFsStore */
|
|
@@ -149,7 +149,7 @@ export type HttpServerOptions = {
|
|
|
149
149
|
* request.setHeader('Authorization', `Bearer ${authToken}`);
|
|
150
150
|
* ```
|
|
151
151
|
*/
|
|
152
|
-
export type HttpAuthorizationToken = Branded<string,
|
|
152
|
+
export type HttpAuthorizationToken = Branded<string, "PFrameInternal.HttpAuthorizationToken">;
|
|
153
153
|
/**
|
|
154
154
|
* TLS certificate in PEM format
|
|
155
155
|
*
|
|
@@ -162,7 +162,7 @@ export type HttpAuthorizationToken = Branded<string, 'PFrameInternal.HttpAuthori
|
|
|
162
162
|
* -----END CERTIFICATE-----
|
|
163
163
|
* ```
|
|
164
164
|
*/
|
|
165
|
-
export type PemCertificate = Branded<string,
|
|
165
|
+
export type PemCertificate = Branded<string, "PFrameInternal.PemCertificate">;
|
|
166
166
|
/** HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */
|
|
167
167
|
export type HttpServerInfo = {
|
|
168
168
|
/** URL of the HTTP(S) server formatted as `http{s}://<host>:<port>/` */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_helpers.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB,YAAsB,CAAC;AAEpD,wBAAwB;AACxB,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,GAAG,MAAM,UAAU,EAAE,gCAAgC,CAAC,CAAC;AAE7F,MAAM,MAAM,SAAS,GAAG;IACtB,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GACjB;
|
|
1
|
+
{"version":3,"file":"http_helpers.d.ts","sourceRoot":"","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Parquet file extension */
|
|
2
|
-
const ParquetExtension =
|
|
2
|
+
const ParquetExtension = ".parquet";
|
|
3
3
|
/** File system abstraction for request handler factory, @see HttpHelpers.createRequestHandler */
|
|
4
4
|
class BaseObjectStore {
|
|
5
5
|
logger;
|
|
@@ -11,15 +11,15 @@ class BaseObjectStore {
|
|
|
11
11
|
if (!range)
|
|
12
12
|
return { start: 0, end: fileSize - 1 };
|
|
13
13
|
switch (range.type) {
|
|
14
|
-
case
|
|
14
|
+
case "bounded":
|
|
15
15
|
if (range.end >= fileSize)
|
|
16
16
|
return null;
|
|
17
17
|
return { start: range.start, end: range.end };
|
|
18
|
-
case
|
|
18
|
+
case "offset":
|
|
19
19
|
if (range.offset >= fileSize)
|
|
20
20
|
return null;
|
|
21
21
|
return { start: range.offset, end: fileSize - 1 };
|
|
22
|
-
case
|
|
22
|
+
case "suffix":
|
|
23
23
|
if (range.suffix > fileSize)
|
|
24
24
|
return null;
|
|
25
25
|
return { start: fileSize - range.suffix, end: fileSize - 1 };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http_helpers.js","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"sourcesContent":["import type { Readable } from 'node:stream';\nimport type { RequestListener } from 'node:http';\nimport type { Branded, Base64Encoded } from '@milaboratories/pl-model-common';\nimport type { Logger } from './common';\n\n/** Parquet file extension */\nexport const ParquetExtension = '.parquet' as const;\n\n/** Parquet file name */\nexport type ParquetFileName = Branded<`${string}.parquet`, 'PFrameInternal.ParquetFileName'>;\n\nexport type FileRange = {\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n};\n\n/** HTTP range as of RFC 9110 <https://datatracker.ietf.org/doc/html/rfc9110#name-range> */\nexport type HttpRange =\n | {\n /**\n * Get file content in the specified byte range\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=0-1023\n * ```\n */\n type: 'bounded';\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n }\n | {\n /**\n * Get byte range starting from the specified offset\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=1024-\n * ```\n */\n type: 'offset';\n /** Start byte position (inclusive) */\n offset: number;\n }\n | {\n /**\n * Get byte range starting from the specified suffix\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=-1024\n * ```\n */\n type: 'suffix';\n /** End byte position (inclusive) */\n suffix: number;\n };\n\n/** HTTP method passed to object store */\nexport type HttpMethod = 'GET' | 'HEAD';\n\n/** HTTP response from object store */\nexport type ObjectStoreResponse =\n | {\n /**\n * Will be translated to 500 Internal Server Error by the handler\n * or 408 Request Timeout if the request was aborted\n */\n type: 'InternalError';\n }\n | {\n /** Will be translated to 404 Not Found by the handler */\n type: 'NotFound';\n }\n | {\n /** Will be translated to 416 Range Not Satisfiable by the handler */\n type: 'RangeNotSatisfiable';\n /** Total file size in bytes */\n size: number;\n }\n | {\n /** Will be translated to 200 OK or 206 Partial Content by the handler */\n type: 'Ok';\n /** Total file size in bytes */\n size: number;\n /** File range translated from HTTP range */\n range: FileRange;\n /** Stream of file content, undefined for HEAD requests */\n data?: Readable;\n };\n\n/** Common options for object store creation */\nexport interface ObjectStoreOptions {\n /** Logger instance, no logging is performed when not provided */\n logger?: Logger;\n}\n\n/** Options for file system object store creation */\nexport interface FsStoreOptions extends ObjectStoreOptions {\n /** Local directory to serve files from */\n rootDir: string;\n}\n\nexport interface ObjectStore {\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n }\n ): void;\n}\n\n/** File system abstraction for request handler factory, @see HttpHelpers.createRequestHandler */\nexport abstract class BaseObjectStore implements ObjectStore {\n protected readonly logger: Logger;\n\n constructor(options: ObjectStoreOptions) {\n this.logger = options.logger ?? (() => {});\n }\n\n /** Translate HTTP range to file range, @returns null if the range is not satisfiable */\n protected translate(fileSize: number, range?: HttpRange): FileRange | null {\n if (!range) return { start: 0, end: fileSize - 1 };\n switch (range.type) {\n case 'bounded':\n if (range.end >= fileSize) return null;\n return { start: range.start, end: range.end };\n case 'offset':\n if (range.offset >= fileSize) return null;\n return { start: range.offset, end: fileSize - 1 };\n case 'suffix':\n if (range.suffix > fileSize) return null;\n return { start: fileSize - range.suffix, end: fileSize - 1 };\n }\n }\n\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n abstract request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n }\n ): Promise<void>;\n}\n\n/** Object store base URL in format accepted by Apache DataFusion and DuckDB */\nexport type ObjectStoreUrl = Branded<string, 'PFrameInternal.ObjectStoreUrl'>;\n\n/** HTTP(S) request handler creation options */\nexport type RequestHandlerOptions = {\n /** Object store to serve files from, @see HttpHelpers.createFsStore */\n store: ObjectStore;\n /** Here will go caching options... */\n};\n\n/** Server configuration options */\nexport type HttpServerOptions = {\n /** HTTP(S) request handler function, @see HttpHelpers.createRequestHandler */\n handler: RequestListener;\n /** Port to bind to, @default 0 for auto-assignment */\n port?: number;\n /** Do not apply authorization middleware to @param handler */\n noAuth?: true;\n /** Downgrade default HTTPS server to plain HTTP, @warning use only for testing */\n noHttps?: true;\n};\n\n/**\n * Long unique opaque string for use in Bearer authorization header\n *\n * @example\n * ```ts\n * request.setHeader('Authorization', `Bearer ${authToken}`);\n * ```\n */\nexport type HttpAuthorizationToken = Branded<string, 'PFrameInternal.HttpAuthorizationToken'>;\n\n/**\n * TLS certificate in PEM format\n *\n * @example\n * ```txt\n * -----BEGIN CERTIFICATE-----\n * MIIC2zCCAcOgAwIBAgIJaVW7...\n * ...\n * ...Yf9CRK8fgnukKM7TJ\n * -----END CERTIFICATE-----\n * ```\n */\nexport type PemCertificate = Branded<string, 'PFrameInternal.PemCertificate'>;\n\n/** HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */\nexport type HttpServerInfo = {\n /** URL of the HTTP(S) server formatted as `http{s}://<host>:<port>/` */\n url: ObjectStoreUrl;\n /** Authorization token for Bearer scheme, undefined when @see HttpServerOptions.noAuth flag is set */\n authToken?: HttpAuthorizationToken;\n /** Encoded CA certificate of HTTPS server, undefined when @see HttpServerOptions.noHttps flag is set */\n encodedCaCert?: Base64Encoded<PemCertificate>;\n};\n\n/** HTTP(S) server information and controls, @see HttpHelpers.createHttpServer */\nexport interface HttpServer {\n /** Server configuration information for initiating connections from clients */\n get info(): HttpServerInfo;\n /** Promise that resolves when the server is stopped */\n get stopped(): Promise<void>;\n /** Request server stop, returns the same promise as @see HttpServer.stopped */\n stop(): Promise<void>;\n}\n\n/** List of HTTP(S) related helper functions exposed by PFrame module */\nexport interface HttpHelpers {\n /**\n * Create an object store for serving files from a local directory.\n * Rejects if the provided path does not exist or is not a directory.\n */\n createFsStore(options: FsStoreOptions): Promise<ObjectStore>;\n\n /**\n * Create an HTTP request handler for serving files from an object store.\n * Accepts only paths of the form `/<filename>.parquet`, returns 410 otherwise.\n * Assumes that files are immutable (and sets cache headers accordingly).\n */\n createRequestHandler(options: RequestHandlerOptions): RequestListener;\n\n /**\n * Serve HTTP(S) requests using the provided handler on localhost port.\n * @returns promise that resolves when the server has stopped.\n *\n * @example\n * ```ts\n * const rootDir = '/path/to/directory/with/parquet/files';\n *\n * let store = await HttpHelpers.createFsStore({ rootDir }).catch((err: unknown) => {\n * throw new Error(`Failed to create file store for ${rootDir} - ${ensureError(err)}`);\n * });\n *\n * const server = await HttpHelpers.createHttpServer({\n * handler: HttpHelpers.createRequestHandler({ store }),\n * }).catch((err: unknown) => {\n * throw new Error(`Failed to start HTTPS server - ${ensureError(err)}`);\n * });\n *\n * const { url, authToken, encodedCaCert } = server.info;\n *\n * await server.stop();\n * ```\n */\n createHttpServer(options: HttpServerOptions): Promise<HttpServer>;\n}\n"],"names":[],"mappings":"AAKA;AACO,MAAM,gBAAgB,GAAG;AAyHhC;MACsB,eAAe,CAAA;AAChB,IAAA,MAAM;AAEzB,IAAA,WAAA,CAAY,OAA2B,EAAA;AACrC,QAAA,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,MAAK,EAAE,CAAC,CAAC;IAC5C;;IAGU,SAAS,CAAC,QAAgB,EAAE,KAAiB,EAAA;AACrD,QAAA,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AAClD,QAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,SAAS;AACZ,gBAAA,IAAI,KAAK,CAAC,GAAG,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACtC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC/C,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACzC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACxC,gBAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;;IAElE;AAgBD;;;;"}
|
|
1
|
+
{"version":3,"file":"http_helpers.js","sources":["../../../src/pframe/internal_api/http_helpers.ts"],"sourcesContent":["import type { Readable } from \"node:stream\";\nimport type { RequestListener } from \"node:http\";\nimport type { Branded, Base64Encoded } from \"@milaboratories/pl-model-common\";\nimport type { Logger } from \"./common\";\n\n/** Parquet file extension */\nexport const ParquetExtension = \".parquet\" as const;\n\n/** Parquet file name */\nexport type ParquetFileName = Branded<`${string}.parquet`, \"PFrameInternal.ParquetFileName\">;\n\nexport type FileRange = {\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n};\n\n/** HTTP range as of RFC 9110 <https://datatracker.ietf.org/doc/html/rfc9110#name-range> */\nexport type HttpRange =\n | {\n /**\n * Get file content in the specified byte range\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=0-1023\n * ```\n */\n type: \"bounded\";\n /** Start byte position (inclusive) */\n start: number;\n /** End byte position (inclusive) */\n end: number;\n }\n | {\n /**\n * Get byte range starting from the specified offset\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=1024-\n * ```\n */\n type: \"offset\";\n /** Start byte position (inclusive) */\n offset: number;\n }\n | {\n /**\n * Get byte range starting from the specified suffix\n *\n * @example\n * ```\n * GET /file.parquet HTTP/1.1\n * Range: bytes=-1024\n * ```\n */\n type: \"suffix\";\n /** End byte position (inclusive) */\n suffix: number;\n };\n\n/** HTTP method passed to object store */\nexport type HttpMethod = \"GET\" | \"HEAD\";\n\n/** HTTP response from object store */\nexport type ObjectStoreResponse =\n | {\n /**\n * Will be translated to 500 Internal Server Error by the handler\n * or 408 Request Timeout if the request was aborted\n */\n type: \"InternalError\";\n }\n | {\n /** Will be translated to 404 Not Found by the handler */\n type: \"NotFound\";\n }\n | {\n /** Will be translated to 416 Range Not Satisfiable by the handler */\n type: \"RangeNotSatisfiable\";\n /** Total file size in bytes */\n size: number;\n }\n | {\n /** Will be translated to 200 OK or 206 Partial Content by the handler */\n type: \"Ok\";\n /** Total file size in bytes */\n size: number;\n /** File range translated from HTTP range */\n range: FileRange;\n /** Stream of file content, undefined for HEAD requests */\n data?: Readable;\n };\n\n/** Common options for object store creation */\nexport interface ObjectStoreOptions {\n /** Logger instance, no logging is performed when not provided */\n logger?: Logger;\n}\n\n/** Options for file system object store creation */\nexport interface FsStoreOptions extends ObjectStoreOptions {\n /** Local directory to serve files from */\n rootDir: string;\n}\n\nexport interface ObjectStore {\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n },\n ): void;\n}\n\n/** File system abstraction for request handler factory, @see HttpHelpers.createRequestHandler */\nexport abstract class BaseObjectStore implements ObjectStore {\n protected readonly logger: Logger;\n\n constructor(options: ObjectStoreOptions) {\n this.logger = options.logger ?? (() => {});\n }\n\n /** Translate HTTP range to file range, @returns null if the range is not satisfiable */\n protected translate(fileSize: number, range?: HttpRange): FileRange | null {\n if (!range) return { start: 0, end: fileSize - 1 };\n switch (range.type) {\n case \"bounded\":\n if (range.end >= fileSize) return null;\n return { start: range.start, end: range.end };\n case \"offset\":\n if (range.offset >= fileSize) return null;\n return { start: range.offset, end: fileSize - 1 };\n case \"suffix\":\n if (range.suffix > fileSize) return null;\n return { start: fileSize - range.suffix, end: fileSize - 1 };\n }\n }\n\n /**\n * Proxy HTTP(S) request for parquet file to object store.\n * Callback promise resolves when stream is closed by handler @see HttpHelpers.createRequestHandler\n * Callback API is used so that ObjectStore can limit the number of concurrent requests.\n */\n abstract request(\n filename: ParquetFileName,\n params: {\n method: HttpMethod;\n range?: HttpRange;\n signal: AbortSignal;\n callback: (response: ObjectStoreResponse) => Promise<void>;\n },\n ): Promise<void>;\n}\n\n/** Object store base URL in format accepted by Apache DataFusion and DuckDB */\nexport type ObjectStoreUrl = Branded<string, \"PFrameInternal.ObjectStoreUrl\">;\n\n/** HTTP(S) request handler creation options */\nexport type RequestHandlerOptions = {\n /** Object store to serve files from, @see HttpHelpers.createFsStore */\n store: ObjectStore;\n /** Here will go caching options... */\n};\n\n/** Server configuration options */\nexport type HttpServerOptions = {\n /** HTTP(S) request handler function, @see HttpHelpers.createRequestHandler */\n handler: RequestListener;\n /** Port to bind to, @default 0 for auto-assignment */\n port?: number;\n /** Do not apply authorization middleware to @param handler */\n noAuth?: true;\n /** Downgrade default HTTPS server to plain HTTP, @warning use only for testing */\n noHttps?: true;\n};\n\n/**\n * Long unique opaque string for use in Bearer authorization header\n *\n * @example\n * ```ts\n * request.setHeader('Authorization', `Bearer ${authToken}`);\n * ```\n */\nexport type HttpAuthorizationToken = Branded<string, \"PFrameInternal.HttpAuthorizationToken\">;\n\n/**\n * TLS certificate in PEM format\n *\n * @example\n * ```txt\n * -----BEGIN CERTIFICATE-----\n * MIIC2zCCAcOgAwIBAgIJaVW7...\n * ...\n * ...Yf9CRK8fgnukKM7TJ\n * -----END CERTIFICATE-----\n * ```\n */\nexport type PemCertificate = Branded<string, \"PFrameInternal.PemCertificate\">;\n\n/** HTTP(S) server connection settings, {@link HttpHelpers.createHttpServer} */\nexport type HttpServerInfo = {\n /** URL of the HTTP(S) server formatted as `http{s}://<host>:<port>/` */\n url: ObjectStoreUrl;\n /** Authorization token for Bearer scheme, undefined when @see HttpServerOptions.noAuth flag is set */\n authToken?: HttpAuthorizationToken;\n /** Encoded CA certificate of HTTPS server, undefined when @see HttpServerOptions.noHttps flag is set */\n encodedCaCert?: Base64Encoded<PemCertificate>;\n};\n\n/** HTTP(S) server information and controls, @see HttpHelpers.createHttpServer */\nexport interface HttpServer {\n /** Server configuration information for initiating connections from clients */\n get info(): HttpServerInfo;\n /** Promise that resolves when the server is stopped */\n get stopped(): Promise<void>;\n /** Request server stop, returns the same promise as @see HttpServer.stopped */\n stop(): Promise<void>;\n}\n\n/** List of HTTP(S) related helper functions exposed by PFrame module */\nexport interface HttpHelpers {\n /**\n * Create an object store for serving files from a local directory.\n * Rejects if the provided path does not exist or is not a directory.\n */\n createFsStore(options: FsStoreOptions): Promise<ObjectStore>;\n\n /**\n * Create an HTTP request handler for serving files from an object store.\n * Accepts only paths of the form `/<filename>.parquet`, returns 410 otherwise.\n * Assumes that files are immutable (and sets cache headers accordingly).\n */\n createRequestHandler(options: RequestHandlerOptions): RequestListener;\n\n /**\n * Serve HTTP(S) requests using the provided handler on localhost port.\n * @returns promise that resolves when the server has stopped.\n *\n * @example\n * ```ts\n * const rootDir = '/path/to/directory/with/parquet/files';\n *\n * let store = await HttpHelpers.createFsStore({ rootDir }).catch((err: unknown) => {\n * throw new Error(`Failed to create file store for ${rootDir} - ${ensureError(err)}`);\n * });\n *\n * const server = await HttpHelpers.createHttpServer({\n * handler: HttpHelpers.createRequestHandler({ store }),\n * }).catch((err: unknown) => {\n * throw new Error(`Failed to start HTTPS server - ${ensureError(err)}`);\n * });\n *\n * const { url, authToken, encodedCaCert } = server.info;\n *\n * await server.stop();\n * ```\n */\n createHttpServer(options: HttpServerOptions): Promise<HttpServer>;\n}\n"],"names":[],"mappings":"AAKA;AACO,MAAM,gBAAgB,GAAG;AAyHhC;MACsB,eAAe,CAAA;AAChB,IAAA,MAAM;AAEzB,IAAA,WAAA,CAAY,OAA2B,EAAA;AACrC,QAAA,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,MAAK,EAAE,CAAC,CAAC;IAC5C;;IAGU,SAAS,CAAC,QAAgB,EAAE,KAAiB,EAAA;AACrD,QAAA,IAAI,CAAC,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AAClD,QAAA,QAAQ,KAAK,CAAC,IAAI;AAChB,YAAA,KAAK,SAAS;AACZ,gBAAA,IAAI,KAAK,CAAC,GAAG,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACtC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC/C,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACzC,gBAAA,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;AACnD,YAAA,KAAK,QAAQ;AACX,gBAAA,IAAI,KAAK,CAAC,MAAM,GAAG,QAAQ;AAAE,oBAAA,OAAO,IAAI;AACxC,gBAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,GAAG,KAAK,CAAC,MAAM,EAAE,GAAG,EAAE,QAAQ,GAAG,CAAC,EAAE;;IAElE;AAgBD;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
3
|
-
export * from
|
|
4
|
-
export * from
|
|
5
|
-
export * from
|
|
6
|
-
export * from
|
|
7
|
-
export * from
|
|
8
|
-
export * from
|
|
9
|
-
export * from
|
|
10
|
-
export * from
|
|
11
|
-
export type { SingleAxisSelector } from
|
|
1
|
+
export * from "./api_read";
|
|
2
|
+
export * from "./api_factory";
|
|
3
|
+
export * from "./api_wasm";
|
|
4
|
+
export * from "./common";
|
|
5
|
+
export * from "./create_table";
|
|
6
|
+
export * from "./delete_column";
|
|
7
|
+
export * from "./find_columns";
|
|
8
|
+
export * from "./table";
|
|
9
|
+
export * from "./pframe";
|
|
10
|
+
export * from "./http_helpers";
|
|
11
|
+
export type { SingleAxisSelector } from "@milaboratories/pl-model-common";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|