@milaboratories/pl-model-common 1.41.1 → 1.41.2
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/index.cjs +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/json.cjs +8 -0
- package/dist/json.cjs.map +1 -1
- package/dist/json.d.ts +2 -1
- package/dist/json.d.ts.map +1 -1
- package/dist/json.js +8 -1
- package/dist/json.js.map +1 -1
- package/package.json +3 -3
- package/src/json.ts +8 -1
package/dist/index.cjs
CHANGED
|
@@ -197,6 +197,7 @@ exports.parseColumnId = require_ids.parseColumnId;
|
|
|
197
197
|
exports.parseDiscoveredPColumnId = require_discovered_column.parseDiscoveredPColumnId;
|
|
198
198
|
exports.parseHttpAuth = require_httpAuth.parseHttpAuth;
|
|
199
199
|
exports.parseJson = require_json.parseJson;
|
|
200
|
+
exports.parseJsonSafely = require_json.parseJsonSafely;
|
|
200
201
|
exports.plId = require_plid.plId;
|
|
201
202
|
exports.plRefsEqual = require_ref.plRefsEqual;
|
|
202
203
|
exports.readAnnotation = require_spec.readAnnotation;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AuthorMarker } from "./author_marker.js";
|
|
2
2
|
import { AnyFunction, BlockOutputsBase, ListOptionBase, OutputWithStatus } from "./common_types.js";
|
|
3
3
|
import { BlockSection, BlockSectionDelimiter, BlockSectionLink, BlockSectionLinkAppearance, DefaultNavigationState, NavigationState } from "./navigation.js";
|
|
4
|
-
import { CanonicalizedJson, JsonCompatible, JsonSerializable, StringifiedJson, bigintReplacer, canonicalizeJson, parseJson, stringifyJson } from "./json.js";
|
|
4
|
+
import { CanonicalizedJson, JsonCompatible, JsonSerializable, StringifiedJson, bigintReplacer, canonicalizeJson, parseJson, parseJsonSafely, stringifyJson } from "./json.js";
|
|
5
5
|
import { BlockState, BlockStateV3 } from "./block_state.js";
|
|
6
6
|
import { Branded } from "./branding.js";
|
|
7
7
|
import { DialogService, FileFilter, ShowSaveDialogOptions, ShowSaveDialogResult } from "./dialog/index.js";
|
|
@@ -64,4 +64,4 @@ import { assertNever, uniqueBy } from "./util.js";
|
|
|
64
64
|
import { BasicHttpAuth, HttpAuth, parseHttpAuth, serializeHttpAuth } from "./httpAuth.js";
|
|
65
65
|
import { ResourceTypeName, ResourceTypePrefix } from "./resource_types.js";
|
|
66
66
|
import { ProjectId } from "./project_id.js";
|
|
67
|
-
export { AAxisSelector, ADomain, AbortError, AllRequiresFeatureFlags, AllSupportsFeatureFlags, AnchorAxisIdOrRefBasic, AnchorAxisRef, AnchorAxisRefByIdx, AnchorAxisRefByMatcher, AnchorAxisRefByName, AnchorDomainRef, AnchoredColumnMatchStrategy, AnchoredIdDeriver, AnchoredPColumnId, AnchoredPColumnSelector, Annotation, AnnotationDataStatus, AnnotationJson, AnyFunction, AnyLogHandle, ArchiveFormat, ArrayTypeUnion, ArtificialColumnJoinEntry, Assert, AssertKeysEqual, AuthorMarker, AxesId, AxesSpec, AxisFilter, AxisFilterByIdx, AxisFilterByName, AxisFilterValue, AxisId, AxisQualification, AxisSpec, AxisSpecNormalized, AxisTree, AxisValueType, Base64Compatible, Base64Encoded, BasicHttpAuth, BinaryChunk, BinaryPartitionedDataInfo, BinaryPartitionedDataInfoEntries, BlobDriver, BlobHandleAndSize, BlobLike, BlobToURLDriver, BlockCodeFeatureFlags, BlockCodeKnownFeatureFlags, BlockCodeWithInfo, BlockConfigContainer, BlockConfigGeneric, BlockConfigV3Generic, BlockConfigV4Generic, BlockOutputsBase, BlockRenderingMode, BlockSection, BlockSectionDelimiter, BlockSectionLink, BlockSectionLinkAppearance, BlockState, BlockStateV3, BlockUIURL, Branded, BuildQueryInput, CalculateTableDataRequest, CalculateTableDataResponse, CanonicalizedJson, ChunkedStreamReader, ChunkedStreamReaderOptions, Code, ColumnAxesWithQualifications, ColumnFilter, ColumnJoinEntry, ColumnValueType, CompositeLinkerMap, ConstantAxisFilter, ContentHandler, CreateEnrichmentRefOptions, DataExprAxisRef, DataExprColumnRef, DataInfo, DataInfoEntries, DataQuery, DataQueryBooleanExpression, DataQueryColumn, DataQueryExpression, DataQueryFilter, DataQueryInlineColumn, DataQueryJoinEntry, DataQueryLinkerJoin, DataQueryLinkerJoinLinker, DataQueryOuterJoin, DataQuerySliceAxes, DataQuerySort, DataQuerySparseToDenseColumn, DataQuerySymmetricJoin, DatasetInput, DefaultNavigationState, DeleteColumnRequest, DeleteColumnResponse, DialogService, DiscoverColumnsConstraints, DiscoverColumnsFilterStep, DiscoverColumnsLinkerStep, DiscoverColumnsMappingVariant, DiscoverColumnsRequest, DiscoverColumnsResponse, DiscoverColumnsResponseHit, DiscoverColumnsResponseQualifications, DiscoverColumnsStepInfo, DiscoveredPColumn, DiscoveredPColumnId, Domain, DomainJson, DriverKit, EnrichmentLinkerStep, EnrichmentRef, EnrichmentStep, ErrorHandlerStatus, EvaluateQueryResponse, FileFilter, FileLike, FileRange, FilterKeysByPrefix, FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, FilteredPColumn, FilteredPColumnId, FindColumnsRequest, FindColumnsResponse, FolderURL, FrontendDriver, FullJoin, FullPTableColumnData, GetContentOptions, HttpAuth, ImportFileHandle, ImportFileHandleIndex, ImportFileHandleUpload, ImportProgress, ImportStatus, IncompatibleFlagsError, InferFilterSpecCommonLeaf, InferFilterSpecCommonNode, InferFilterSpecLeaf, InferFilterSpecLeafColumn, InferServiceKind, InferServiceModel, InferServiceUi, InlineColumnJoinEntry, InnerJoin, Is, IsSubtypeOf, JoinEntry, JsonCompatible, JsonDataInfo, JsonDataInfoEntries, JsonPartitionedDataInfo, JsonPartitionedDataInfoEntries, JsonSerializable, KnownServiceName, LabeledEnrichmentRef, LabeledEnrichmentRefs, LegacyAxisSelector, LinkerMap, ListFilesResult, ListOptionBase, LiveLogHandle, LocalBlobHandle, LocalBlobHandleAndSize, LocalImportFileHandle, LogsDriver, LsDriver, LsEntry, MODEL_SERVICE_METHOD_MAP, MatcherMap, Metadata, MetadataJson, ModelServiceFactoryMap, ModelServiceRegistry, ModelServices, MultiAxisSelector, MultiColumnSelector, NativePObjectId, NavigationState, NodeServiceHandlerMap, OpenDialogFilter, OpenDialogOps, OpenMultipleFilesResponse, OpenSingleFileResponse, Option, OuterJoin, OutputWithStatus, PAxisName, PColumn, PColumnDataEntry, PColumnIdAndSpec, PColumnInfo, PColumnKey, PColumnLazy, PColumnName, PColumnSelector, PColumnSpec, PColumnSpecId, PColumnValue, PColumnValues, PColumnValuesEntry, PDataColumnSpec, PFrame, PFrameDef, PFrameDriver, PFrameDriverError, PFrameError, PFrameHandle, PFrameModelDriver, PFrameSpecDriver, PFrameSpecDriverError, PObject, PObjectId, PObjectSpec, PSpecPredicate, PTable, PTableColumnId, PTableColumnIdAxis, PTableColumnIdColumn, PTableColumnSpec, PTableColumnSpecAxis, PTableColumnSpecColumn, PTableDef, PTableDefV2, PTableDownloadCompression, PTableDownloadFormat, PTableHandle, PTableNA, PTableRecordFilter, PTableRecordSingleValueFilterV2, PTableShape, PTableSorting, PTableValue, PTableValueAxis, PTableValueBranded, PTableValueData, PTableValueDataBranded, PTableValueDouble, PTableValueFloat, PTableValueInt, PTableValueLong, PTableValueString, PTableVector, PTableVectorTyped, PUniversalColumnSpec, PVectorData, PVectorDataBytes, PVectorDataDouble, PVectorDataFloat, PVectorDataInt, PVectorDataLong, PVectorDataString, PVectorDataTyped, ParquetChunk, ParquetChunkMapping, ParquetChunkMappingAxis, ParquetChunkMappingColumn, ParquetChunkMetadata, ParquetChunkStats, ParquetPartitionedDataInfo, ParquetPartitionedDataInfoEntries, PartitionedDataInfoEntries, PlId, PlIdBytes, PlIdLength, PlRef, PoolEntry, PoolEntryGuard, PrimaryRef, ProgressLogWithInfo, ProjectId, REQUIRES_PFRAMES_VERSION, RangeBytes, ReadyLogHandle, Ref, RemoteBlobHandle, RemoteBlobHandleAndSize, RequireServices, ResolveAnchorsOptions, ResourceTypeName, ResourceTypePrefix, ResultCollection, ResultOrError, ResultPoolEntry, RootFilterSpec, RuntimeCapabilities, SERVICE_CAPABILITY_FLAGS, SERVICE_FEATURE_FLAGS, SERVICE_METHOD_MAP, SUniversalPColumnId, SerializedError, ServiceAlreadyRegisteredError, ServiceBrand, ServiceDispatch, ServiceError, ServiceInjectionError, ServiceInvalidIdError, ServiceMethodNotFoundError, ServiceName, ServiceNameLiterals, ServiceNotRegisteredError, ServiceRequireFlags, ServiceType, ServiceTypesLike, Services, ShowSaveDialogOptions, ShowSaveDialogResult, SingleAxisSelector, SingleValueAndPredicateV2, SingleValueEqualPredicate, SingleValueGreaterOrEqualPredicate, SingleValueGreaterPredicate, SingleValueIEqualPredicate, SingleValueInSetPredicate, SingleValueIsNAPredicate, SingleValueLessOrEqualPredicate, SingleValueLessPredicate, SingleValueMatchesPredicate, SingleValueNotPredicateV2, SingleValueOrPredicateV2, SingleValuePredicateV2, SingleValueStringContainsFuzzyPredicate, SingleValueStringContainsPredicate, SingleValueStringIContainsFuzzyPredicate, SingleValueStringIContainsPredicate, SlicedColumnJoinEntry, SpecExprAxisRef, SpecExprColumnRef, SpecFrameHandle, SpecQuery, SpecQueryBooleanExpression, SpecQueryColumn, SpecQueryExpression, SpecQueryFilter, SpecQueryInlineColumn, SpecQueryJoinEntry, SpecQueryLinkerJoin, SpecQueryLinkerJoinLinker, SpecQueryOuterJoin, SpecQuerySliceAxes, SpecQuerySort, SpecQuerySparseToDenseColumn, SpecQuerySymmetricJoin, StorageEntry, StorageHandle, StorageHandleLocal, StorageHandleRemote, StreamingApiResponse, StreamingApiResponseHandleOutdated, StreamingApiResponseOk, StringMatcher, StringifiedJson, SupportedRequirement, TableRange, Trace, TraceEntry, UiError, UiServiceFactoryMap, UiServiceRegistry, UiServices, UniqueValuesRequest, UniqueValuesResponse, UniversalPColumnId, ValueOrError, ValueType, ValueTypeSupported, ValueWithUTag, ValueWithUTagAndAuthor, WritePTableToFsOptions, WritePTableToFsResult, assertNever, base64Decode, base64Encode, bigintReplacer, buildServiceInfo, canonicalizeAxisId, canonicalizeAxisWithParents, canonicalizeJson, checkBlockFlag, collectSpecQueryColumns, createDiscoveredPColumnId, createEnrichmentRef, createNodeServiceHandlers, createPlRef, createPrimaryRef, dataInfoToEntries, deriveNativeId, deserializeError, deserializeResult, digestPlId, distillDiscoveredPColumn, ensureError, ensurePColumn, entriesToDataInfo, executePSpecPredicate, extractAllColumns, extractAllRequirements, extractAllSupports, extractCodeWithInfo, extractConfigGeneric, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getFileNameFromHandle, getFilePathFromHandle, getMethodNames, getNormalizedAxesList, getPColumnSpecId, getPTableColumnId, getServiceKind, getServiceModelMethods, getServiceUiMethods, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, hasAbortError, isAbortError, isAggregateError, isAnchoredPColumnId, isAnyLogHandle, isAxisId, isBlockUIURL, isBooleanExpression, isDataInfo, isDataInfoEntries, isDiscoveredPColumn, isEnrichmentRef, isFilteredPColumn, isFolderURL, isImportFileHandleIndex, isImportFileHandleUpload, isKnownServiceName, isLabelColumn, isLinkerColumn, isLiveLog, isMainService, isNodeService, isPColumn, isPColumnResult, isPColumnSpec, isPColumnSpecResult, isPFrameDriverError, isPFrameError, isPFrameSpecDriverError, isPTableNA, isPartitionedDataInfoEntries, isPlRef, isPrimaryRef, isServiceAlreadyRegisteredError, isServiceError, isServiceInjectionError, isServiceInvalidIdError, isServiceMethodNotFoundError, isServiceNotRegisteredError, isValueNA, isWasmService, legacyColumnSelectorsToPredicate, mapDataInfo, mapDataInfoEntries, mapJoinEntry, mapPObjectData, mapPTableDef, mapPTableDefV2, mapSpecQueryColumns, mapValueInVOE, matchAxis, matchAxisId, matchMultiColumnSelector, matchPColumn, multiColumnSelectorsToPredicate, newRangeBytesOpt, pTableValue, pTableValueBranded, parseColumnId, parseDiscoveredPColumnId, parseHttpAuth, parseJson, plId, plRefsEqual, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, registerServiceCapabilities, resolveAnchors, resolveAnnotationParents, resolveNodeServiceHandler, resolveRequiredServices, serializeError, serializeHttpAuth, serializeResult, service, serviceFnKey, sortJoinEntry, sortPTableDef, sortSpecQuery, stringifyColumnId, stringifyDiscoveredPColumnId, stringifyJson, traverseQuerySpec, uniqueBy, uniquePlId, unwrapResult, validateRangeBytes, visitDataInfo, withEnrichments, wrapAndSerialize, wrapAndSerializeAsync, wrapAsyncCallback, wrapCallback };
|
|
67
|
+
export { AAxisSelector, ADomain, AbortError, AllRequiresFeatureFlags, AllSupportsFeatureFlags, AnchorAxisIdOrRefBasic, AnchorAxisRef, AnchorAxisRefByIdx, AnchorAxisRefByMatcher, AnchorAxisRefByName, AnchorDomainRef, AnchoredColumnMatchStrategy, AnchoredIdDeriver, AnchoredPColumnId, AnchoredPColumnSelector, Annotation, AnnotationDataStatus, AnnotationJson, AnyFunction, AnyLogHandle, ArchiveFormat, ArrayTypeUnion, ArtificialColumnJoinEntry, Assert, AssertKeysEqual, AuthorMarker, AxesId, AxesSpec, AxisFilter, AxisFilterByIdx, AxisFilterByName, AxisFilterValue, AxisId, AxisQualification, AxisSpec, AxisSpecNormalized, AxisTree, AxisValueType, Base64Compatible, Base64Encoded, BasicHttpAuth, BinaryChunk, BinaryPartitionedDataInfo, BinaryPartitionedDataInfoEntries, BlobDriver, BlobHandleAndSize, BlobLike, BlobToURLDriver, BlockCodeFeatureFlags, BlockCodeKnownFeatureFlags, BlockCodeWithInfo, BlockConfigContainer, BlockConfigGeneric, BlockConfigV3Generic, BlockConfigV4Generic, BlockOutputsBase, BlockRenderingMode, BlockSection, BlockSectionDelimiter, BlockSectionLink, BlockSectionLinkAppearance, BlockState, BlockStateV3, BlockUIURL, Branded, BuildQueryInput, CalculateTableDataRequest, CalculateTableDataResponse, CanonicalizedJson, ChunkedStreamReader, ChunkedStreamReaderOptions, Code, ColumnAxesWithQualifications, ColumnFilter, ColumnJoinEntry, ColumnValueType, CompositeLinkerMap, ConstantAxisFilter, ContentHandler, CreateEnrichmentRefOptions, DataExprAxisRef, DataExprColumnRef, DataInfo, DataInfoEntries, DataQuery, DataQueryBooleanExpression, DataQueryColumn, DataQueryExpression, DataQueryFilter, DataQueryInlineColumn, DataQueryJoinEntry, DataQueryLinkerJoin, DataQueryLinkerJoinLinker, DataQueryOuterJoin, DataQuerySliceAxes, DataQuerySort, DataQuerySparseToDenseColumn, DataQuerySymmetricJoin, DatasetInput, DefaultNavigationState, DeleteColumnRequest, DeleteColumnResponse, DialogService, DiscoverColumnsConstraints, DiscoverColumnsFilterStep, DiscoverColumnsLinkerStep, DiscoverColumnsMappingVariant, DiscoverColumnsRequest, DiscoverColumnsResponse, DiscoverColumnsResponseHit, DiscoverColumnsResponseQualifications, DiscoverColumnsStepInfo, DiscoveredPColumn, DiscoveredPColumnId, Domain, DomainJson, DriverKit, EnrichmentLinkerStep, EnrichmentRef, EnrichmentStep, ErrorHandlerStatus, EvaluateQueryResponse, FileFilter, FileLike, FileRange, FilterKeysByPrefix, FilterSpec, FilterSpecLeaf, FilterSpecNode, FilterSpecOfType, FilterSpecType, FilteredPColumn, FilteredPColumnId, FindColumnsRequest, FindColumnsResponse, FolderURL, FrontendDriver, FullJoin, FullPTableColumnData, GetContentOptions, HttpAuth, ImportFileHandle, ImportFileHandleIndex, ImportFileHandleUpload, ImportProgress, ImportStatus, IncompatibleFlagsError, InferFilterSpecCommonLeaf, InferFilterSpecCommonNode, InferFilterSpecLeaf, InferFilterSpecLeafColumn, InferServiceKind, InferServiceModel, InferServiceUi, InlineColumnJoinEntry, InnerJoin, Is, IsSubtypeOf, JoinEntry, JsonCompatible, JsonDataInfo, JsonDataInfoEntries, JsonPartitionedDataInfo, JsonPartitionedDataInfoEntries, JsonSerializable, KnownServiceName, LabeledEnrichmentRef, LabeledEnrichmentRefs, LegacyAxisSelector, LinkerMap, ListFilesResult, ListOptionBase, LiveLogHandle, LocalBlobHandle, LocalBlobHandleAndSize, LocalImportFileHandle, LogsDriver, LsDriver, LsEntry, MODEL_SERVICE_METHOD_MAP, MatcherMap, Metadata, MetadataJson, ModelServiceFactoryMap, ModelServiceRegistry, ModelServices, MultiAxisSelector, MultiColumnSelector, NativePObjectId, NavigationState, NodeServiceHandlerMap, OpenDialogFilter, OpenDialogOps, OpenMultipleFilesResponse, OpenSingleFileResponse, Option, OuterJoin, OutputWithStatus, PAxisName, PColumn, PColumnDataEntry, PColumnIdAndSpec, PColumnInfo, PColumnKey, PColumnLazy, PColumnName, PColumnSelector, PColumnSpec, PColumnSpecId, PColumnValue, PColumnValues, PColumnValuesEntry, PDataColumnSpec, PFrame, PFrameDef, PFrameDriver, PFrameDriverError, PFrameError, PFrameHandle, PFrameModelDriver, PFrameSpecDriver, PFrameSpecDriverError, PObject, PObjectId, PObjectSpec, PSpecPredicate, PTable, PTableColumnId, PTableColumnIdAxis, PTableColumnIdColumn, PTableColumnSpec, PTableColumnSpecAxis, PTableColumnSpecColumn, PTableDef, PTableDefV2, PTableDownloadCompression, PTableDownloadFormat, PTableHandle, PTableNA, PTableRecordFilter, PTableRecordSingleValueFilterV2, PTableShape, PTableSorting, PTableValue, PTableValueAxis, PTableValueBranded, PTableValueData, PTableValueDataBranded, PTableValueDouble, PTableValueFloat, PTableValueInt, PTableValueLong, PTableValueString, PTableVector, PTableVectorTyped, PUniversalColumnSpec, PVectorData, PVectorDataBytes, PVectorDataDouble, PVectorDataFloat, PVectorDataInt, PVectorDataLong, PVectorDataString, PVectorDataTyped, ParquetChunk, ParquetChunkMapping, ParquetChunkMappingAxis, ParquetChunkMappingColumn, ParquetChunkMetadata, ParquetChunkStats, ParquetPartitionedDataInfo, ParquetPartitionedDataInfoEntries, PartitionedDataInfoEntries, PlId, PlIdBytes, PlIdLength, PlRef, PoolEntry, PoolEntryGuard, PrimaryRef, ProgressLogWithInfo, ProjectId, REQUIRES_PFRAMES_VERSION, RangeBytes, ReadyLogHandle, Ref, RemoteBlobHandle, RemoteBlobHandleAndSize, RequireServices, ResolveAnchorsOptions, ResourceTypeName, ResourceTypePrefix, ResultCollection, ResultOrError, ResultPoolEntry, RootFilterSpec, RuntimeCapabilities, SERVICE_CAPABILITY_FLAGS, SERVICE_FEATURE_FLAGS, SERVICE_METHOD_MAP, SUniversalPColumnId, SerializedError, ServiceAlreadyRegisteredError, ServiceBrand, ServiceDispatch, ServiceError, ServiceInjectionError, ServiceInvalidIdError, ServiceMethodNotFoundError, ServiceName, ServiceNameLiterals, ServiceNotRegisteredError, ServiceRequireFlags, ServiceType, ServiceTypesLike, Services, ShowSaveDialogOptions, ShowSaveDialogResult, SingleAxisSelector, SingleValueAndPredicateV2, SingleValueEqualPredicate, SingleValueGreaterOrEqualPredicate, SingleValueGreaterPredicate, SingleValueIEqualPredicate, SingleValueInSetPredicate, SingleValueIsNAPredicate, SingleValueLessOrEqualPredicate, SingleValueLessPredicate, SingleValueMatchesPredicate, SingleValueNotPredicateV2, SingleValueOrPredicateV2, SingleValuePredicateV2, SingleValueStringContainsFuzzyPredicate, SingleValueStringContainsPredicate, SingleValueStringIContainsFuzzyPredicate, SingleValueStringIContainsPredicate, SlicedColumnJoinEntry, SpecExprAxisRef, SpecExprColumnRef, SpecFrameHandle, SpecQuery, SpecQueryBooleanExpression, SpecQueryColumn, SpecQueryExpression, SpecQueryFilter, SpecQueryInlineColumn, SpecQueryJoinEntry, SpecQueryLinkerJoin, SpecQueryLinkerJoinLinker, SpecQueryOuterJoin, SpecQuerySliceAxes, SpecQuerySort, SpecQuerySparseToDenseColumn, SpecQuerySymmetricJoin, StorageEntry, StorageHandle, StorageHandleLocal, StorageHandleRemote, StreamingApiResponse, StreamingApiResponseHandleOutdated, StreamingApiResponseOk, StringMatcher, StringifiedJson, SupportedRequirement, TableRange, Trace, TraceEntry, UiError, UiServiceFactoryMap, UiServiceRegistry, UiServices, UniqueValuesRequest, UniqueValuesResponse, UniversalPColumnId, ValueOrError, ValueType, ValueTypeSupported, ValueWithUTag, ValueWithUTagAndAuthor, WritePTableToFsOptions, WritePTableToFsResult, assertNever, base64Decode, base64Encode, bigintReplacer, buildServiceInfo, canonicalizeAxisId, canonicalizeAxisWithParents, canonicalizeJson, checkBlockFlag, collectSpecQueryColumns, createDiscoveredPColumnId, createEnrichmentRef, createNodeServiceHandlers, createPlRef, createPrimaryRef, dataInfoToEntries, deriveNativeId, deserializeError, deserializeResult, digestPlId, distillDiscoveredPColumn, ensureError, ensurePColumn, entriesToDataInfo, executePSpecPredicate, extractAllColumns, extractAllRequirements, extractAllSupports, extractCodeWithInfo, extractConfigGeneric, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getFileNameFromHandle, getFilePathFromHandle, getMethodNames, getNormalizedAxesList, getPColumnSpecId, getPTableColumnId, getServiceKind, getServiceModelMethods, getServiceUiMethods, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, hasAbortError, isAbortError, isAggregateError, isAnchoredPColumnId, isAnyLogHandle, isAxisId, isBlockUIURL, isBooleanExpression, isDataInfo, isDataInfoEntries, isDiscoveredPColumn, isEnrichmentRef, isFilteredPColumn, isFolderURL, isImportFileHandleIndex, isImportFileHandleUpload, isKnownServiceName, isLabelColumn, isLinkerColumn, isLiveLog, isMainService, isNodeService, isPColumn, isPColumnResult, isPColumnSpec, isPColumnSpecResult, isPFrameDriverError, isPFrameError, isPFrameSpecDriverError, isPTableNA, isPartitionedDataInfoEntries, isPlRef, isPrimaryRef, isServiceAlreadyRegisteredError, isServiceError, isServiceInjectionError, isServiceInvalidIdError, isServiceMethodNotFoundError, isServiceNotRegisteredError, isValueNA, isWasmService, legacyColumnSelectorsToPredicate, mapDataInfo, mapDataInfoEntries, mapJoinEntry, mapPObjectData, mapPTableDef, mapPTableDefV2, mapSpecQueryColumns, mapValueInVOE, matchAxis, matchAxisId, matchMultiColumnSelector, matchPColumn, multiColumnSelectorsToPredicate, newRangeBytesOpt, pTableValue, pTableValueBranded, parseColumnId, parseDiscoveredPColumnId, parseHttpAuth, parseJson, parseJsonSafely, plId, plRefsEqual, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, registerServiceCapabilities, resolveAnchors, resolveAnnotationParents, resolveNodeServiceHandler, resolveRequiredServices, serializeError, serializeHttpAuth, serializeResult, service, serviceFnKey, sortJoinEntry, sortPTableDef, sortSpecQuery, stringifyColumnId, stringifyDiscoveredPColumnId, stringifyJson, traverseQuerySpec, uniqueBy, uniquePlId, unwrapResult, validateRangeBytes, visitDataInfo, withEnrichments, wrapAndSerialize, wrapAndSerializeAsync, wrapAsyncCallback, wrapCallback };
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { assertNever, uniqueBy } from "./util.js";
|
|
|
9
9
|
import { getFileNameFromHandle, getFilePathFromHandle, isImportFileHandleIndex, isImportFileHandleUpload } from "./drivers/ls.js";
|
|
10
10
|
import { dataInfoToEntries, entriesToDataInfo, isDataInfo, isDataInfoEntries, isPartitionedDataInfoEntries, mapDataInfo, mapDataInfoEntries, visitDataInfo } from "./drivers/pframe/data_info.js";
|
|
11
11
|
import { AbortError, PFrameDriverError, PFrameError, PFrameSpecDriverError, ServiceAlreadyRegisteredError, ServiceError, ServiceInjectionError, ServiceInvalidIdError, ServiceMethodNotFoundError, ServiceNotRegisteredError, UiError, deserializeError, deserializeResult, ensureError, hasAbortError, isAbortError, isAggregateError, isPFrameDriverError, isPFrameError, isPFrameSpecDriverError, isServiceAlreadyRegisteredError, isServiceError, isServiceInjectionError, isServiceInvalidIdError, isServiceMethodNotFoundError, isServiceNotRegisteredError, serializeError, serializeResult, unwrapResult, wrapAndSerialize, wrapAndSerializeAsync, wrapAsyncCallback, wrapCallback } from "./errors.js";
|
|
12
|
-
import { bigintReplacer, canonicalizeJson, parseJson, stringifyJson } from "./json.js";
|
|
12
|
+
import { bigintReplacer, canonicalizeJson, parseJson, parseJsonSafely, stringifyJson } from "./json.js";
|
|
13
13
|
import { Annotation, AnnotationJson, Domain, DomainJson, PAxisName, PColumnName, ValueType, canonicalizeAxisId, canonicalizeAxisWithParents, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getNormalizedAxesList, getPColumnSpecId, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, isAxisId, isLabelColumn, isLinkerColumn, matchAxisId, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, resolveAnnotationParents } from "./drivers/pframe/spec/spec.js";
|
|
14
14
|
import { PTableNA, isPTableNA, isValueNA, pTableValue, pTableValueBranded } from "./drivers/pframe/data_types.js";
|
|
15
15
|
import { collectSpecQueryColumns, isBooleanExpression, mapSpecQueryColumns, sortSpecQuery, traverseQuerySpec } from "./drivers/pframe/query/utils.js";
|
|
@@ -43,4 +43,4 @@ import { createNodeServiceHandlers } from "./services/node_service_handlers.js";
|
|
|
43
43
|
import { MODEL_SERVICE_METHOD_MAP, SERVICE_METHOD_MAP, buildServiceInfo, resolveNodeServiceHandler } from "./services/service_injectors.js";
|
|
44
44
|
import "./services/index.js";
|
|
45
45
|
import { PoolEntryGuard } from "./pool_entry.js";
|
|
46
|
-
export { AbortError, AllRequiresFeatureFlags, AllSupportsFeatureFlags, AnchoredIdDeriver, Annotation, AnnotationJson, ChunkedStreamReader, Code, DefaultNavigationState, Domain, DomainJson, IncompatibleFlagsError, LinkerMap, MODEL_SERVICE_METHOD_MAP, ModelServiceRegistry, PAxisName, PColumnName, PFrameDriverError, PFrameError, PFrameSpecDriverError, PTableNA, PlId, PlIdBytes, PlIdLength, PlRef, PoolEntryGuard, REQUIRES_PFRAMES_VERSION, RangeBytes, ResourceTypeName, ResourceTypePrefix, RuntimeCapabilities, SERVICE_CAPABILITY_FLAGS, SERVICE_FEATURE_FLAGS, SERVICE_METHOD_MAP, ServiceAlreadyRegisteredError, ServiceError, ServiceInjectionError, ServiceInvalidIdError, ServiceMethodNotFoundError, ServiceNotRegisteredError, Services, UiError, UiServiceRegistry, ValueType, assertNever, base64Decode, base64Encode, bigintReplacer, buildServiceInfo, canonicalizeAxisId, canonicalizeAxisWithParents, canonicalizeJson, checkBlockFlag, collectSpecQueryColumns, createDiscoveredPColumnId, createEnrichmentRef, createNodeServiceHandlers, createPlRef, createPrimaryRef, dataInfoToEntries, deriveNativeId, deserializeError, deserializeResult, digestPlId, distillDiscoveredPColumn, ensureError, ensurePColumn, entriesToDataInfo, executePSpecPredicate, extractAllColumns, extractAllRequirements, extractAllSupports, extractCodeWithInfo, extractConfigGeneric, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getFileNameFromHandle, getFilePathFromHandle, getMethodNames, getNormalizedAxesList, getPColumnSpecId, getPTableColumnId, getServiceKind, getServiceModelMethods, getServiceUiMethods, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, hasAbortError, isAbortError, isAggregateError, isAnchoredPColumnId, isAnyLogHandle, isAxisId, isBlockUIURL, isBooleanExpression, isDataInfo, isDataInfoEntries, isDiscoveredPColumn, isEnrichmentRef, isFilteredPColumn, isFolderURL, isImportFileHandleIndex, isImportFileHandleUpload, isKnownServiceName, isLabelColumn, isLinkerColumn, isLiveLog, isMainService, isNodeService, isPColumn, isPColumnResult, isPColumnSpec, isPColumnSpecResult, isPFrameDriverError, isPFrameError, isPFrameSpecDriverError, isPTableNA, isPartitionedDataInfoEntries, isPlRef, isPrimaryRef, isServiceAlreadyRegisteredError, isServiceError, isServiceInjectionError, isServiceInvalidIdError, isServiceMethodNotFoundError, isServiceNotRegisteredError, isValueNA, isWasmService, legacyColumnSelectorsToPredicate, mapDataInfo, mapDataInfoEntries, mapJoinEntry, mapPObjectData, mapPTableDef, mapPTableDefV2, mapSpecQueryColumns, mapValueInVOE, matchAxis, matchAxisId, matchMultiColumnSelector, matchPColumn, multiColumnSelectorsToPredicate, newRangeBytesOpt, pTableValue, pTableValueBranded, parseColumnId, parseDiscoveredPColumnId, parseHttpAuth, parseJson, plId, plRefsEqual, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, registerServiceCapabilities, resolveAnchors, resolveAnnotationParents, resolveNodeServiceHandler, resolveRequiredServices, serializeError, serializeHttpAuth, serializeResult, service, serviceFnKey, sortJoinEntry, sortPTableDef, sortSpecQuery, stringifyColumnId, stringifyDiscoveredPColumnId, stringifyJson, traverseQuerySpec, uniqueBy, uniquePlId, unwrapResult, validateRangeBytes, visitDataInfo, withEnrichments, wrapAndSerialize, wrapAndSerializeAsync, wrapAsyncCallback, wrapCallback };
|
|
46
|
+
export { AbortError, AllRequiresFeatureFlags, AllSupportsFeatureFlags, AnchoredIdDeriver, Annotation, AnnotationJson, ChunkedStreamReader, Code, DefaultNavigationState, Domain, DomainJson, IncompatibleFlagsError, LinkerMap, MODEL_SERVICE_METHOD_MAP, ModelServiceRegistry, PAxisName, PColumnName, PFrameDriverError, PFrameError, PFrameSpecDriverError, PTableNA, PlId, PlIdBytes, PlIdLength, PlRef, PoolEntryGuard, REQUIRES_PFRAMES_VERSION, RangeBytes, ResourceTypeName, ResourceTypePrefix, RuntimeCapabilities, SERVICE_CAPABILITY_FLAGS, SERVICE_FEATURE_FLAGS, SERVICE_METHOD_MAP, ServiceAlreadyRegisteredError, ServiceError, ServiceInjectionError, ServiceInvalidIdError, ServiceMethodNotFoundError, ServiceNotRegisteredError, Services, UiError, UiServiceRegistry, ValueType, assertNever, base64Decode, base64Encode, bigintReplacer, buildServiceInfo, canonicalizeAxisId, canonicalizeAxisWithParents, canonicalizeJson, checkBlockFlag, collectSpecQueryColumns, createDiscoveredPColumnId, createEnrichmentRef, createNodeServiceHandlers, createPlRef, createPrimaryRef, dataInfoToEntries, deriveNativeId, deserializeError, deserializeResult, digestPlId, distillDiscoveredPColumn, ensureError, ensurePColumn, entriesToDataInfo, executePSpecPredicate, extractAllColumns, extractAllRequirements, extractAllSupports, extractCodeWithInfo, extractConfigGeneric, getArrayFromAxisTree, getAxesId, getAxesTree, getAxisId, getColumnIdAndSpec, getDenormalizedAxesList, getFileNameFromHandle, getFilePathFromHandle, getMethodNames, getNormalizedAxesList, getPColumnSpecId, getPTableColumnId, getServiceKind, getServiceModelMethods, getServiceUiMethods, getSetFromAxisTree, getTypeFromPColumnOrAxisSpec, hasAbortError, isAbortError, isAggregateError, isAnchoredPColumnId, isAnyLogHandle, isAxisId, isBlockUIURL, isBooleanExpression, isDataInfo, isDataInfoEntries, isDiscoveredPColumn, isEnrichmentRef, isFilteredPColumn, isFolderURL, isImportFileHandleIndex, isImportFileHandleUpload, isKnownServiceName, isLabelColumn, isLinkerColumn, isLiveLog, isMainService, isNodeService, isPColumn, isPColumnResult, isPColumnSpec, isPColumnSpecResult, isPFrameDriverError, isPFrameError, isPFrameSpecDriverError, isPTableNA, isPartitionedDataInfoEntries, isPlRef, isPrimaryRef, isServiceAlreadyRegisteredError, isServiceError, isServiceInjectionError, isServiceInvalidIdError, isServiceMethodNotFoundError, isServiceNotRegisteredError, isValueNA, isWasmService, legacyColumnSelectorsToPredicate, mapDataInfo, mapDataInfoEntries, mapJoinEntry, mapPObjectData, mapPTableDef, mapPTableDefV2, mapSpecQueryColumns, mapValueInVOE, matchAxis, matchAxisId, matchMultiColumnSelector, matchPColumn, multiColumnSelectorsToPredicate, newRangeBytesOpt, pTableValue, pTableValueBranded, parseColumnId, parseDiscoveredPColumnId, parseHttpAuth, parseJson, parseJsonSafely, plId, plRefsEqual, readAnnotation, readAnnotationJson, readAnnotationJsonOrThrow, readDomain, readDomainJson, readDomainJsonOrThrow, readMetadata, readMetadataJson, readMetadataJsonOrThrow, registerServiceCapabilities, resolveAnchors, resolveAnnotationParents, resolveNodeServiceHandler, resolveRequiredServices, serializeError, serializeHttpAuth, serializeResult, service, serviceFnKey, sortJoinEntry, sortPTableDef, sortSpecQuery, stringifyColumnId, stringifyDiscoveredPColumnId, stringifyJson, traverseQuerySpec, uniqueBy, uniquePlId, unwrapResult, validateRangeBytes, visitDataInfo, withEnrichments, wrapAndSerialize, wrapAndSerializeAsync, wrapAsyncCallback, wrapCallback };
|
package/dist/json.cjs
CHANGED
|
@@ -11,6 +11,13 @@ function canonicalizeJson(value) {
|
|
|
11
11
|
function parseJson(value) {
|
|
12
12
|
return JSON.parse(value);
|
|
13
13
|
}
|
|
14
|
+
function parseJsonSafely(value, fallback) {
|
|
15
|
+
try {
|
|
16
|
+
return JSON.parse(value);
|
|
17
|
+
} catch {
|
|
18
|
+
return fallback;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
14
21
|
function bigintReplacer(_key, value) {
|
|
15
22
|
return typeof value === "bigint" ? value.toString() : value;
|
|
16
23
|
}
|
|
@@ -18,6 +25,7 @@ function bigintReplacer(_key, value) {
|
|
|
18
25
|
exports.bigintReplacer = bigintReplacer;
|
|
19
26
|
exports.canonicalizeJson = canonicalizeJson;
|
|
20
27
|
exports.parseJson = parseJson;
|
|
28
|
+
exports.parseJsonSafely = parseJsonSafely;
|
|
21
29
|
exports.stringifyJson = stringifyJson;
|
|
22
30
|
|
|
23
31
|
//# sourceMappingURL=json.cjs.map
|
package/dist/json.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.cjs","names":[],"sources":["../src/json.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\
|
|
1
|
+
{"version":3,"file":"json.cjs","names":[],"sources":["../src/json.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T\n ? unknown\n : [T] extends [JsonValue]\n ? T\n : [T] extends [NotAssignableToJson]\n ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue]\n ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson]\n ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_stringified: T;\n };\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_canonicalized: T;\n };\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function parseJsonSafely<T, F = undefined>(value: string, fallback?: F): T | F {\n try {\n return JSON.parse(value) as T;\n } catch {\n return fallback as F;\n }\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === \"bigint\" ? value.toString() : value;\n}\n"],"mappings":";;;;AAqCA,SAAgB,cAAc,OAAwB;AACpD,QAAO,KAAK,UAAU,MAAM;;AAY9B,SAAgB,iBAAiB,OAAwB;AACvD,SAAA,GAAA,aAAA,SAAoB,MAAM;;AAG5B,SAAgB,UAAa,OAAqD;AAChF,QAAO,KAAK,MAAM,MAAM;;AAG1B,SAAgB,gBAAkC,OAAe,UAAqB;AACpF,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;SAClB;AACN,SAAO;;;AAIX,SAAgB,eAAe,MAAc,OAAyB;AACpE,QAAO,OAAO,UAAU,WAAW,MAAM,UAAU,GAAG"}
|
package/dist/json.d.ts
CHANGED
|
@@ -21,7 +21,8 @@ type CanonicalizedJson<T = unknown> = JsonCompatible<T> extends never ? never :
|
|
|
21
21
|
declare function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;
|
|
22
22
|
declare function canonicalizeJson<T extends JsonSerializable>(value: T): string;
|
|
23
23
|
declare function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T;
|
|
24
|
+
declare function parseJsonSafely<T, F = undefined>(value: string, fallback?: F): T | F;
|
|
24
25
|
declare function bigintReplacer(_key: string, value: unknown): unknown;
|
|
25
26
|
//#endregion
|
|
26
|
-
export { CanonicalizedJson, JsonCompatible, JsonSerializable, StringifiedJson, bigintReplacer, canonicalizeJson, parseJson, stringifyJson };
|
|
27
|
+
export { CanonicalizedJson, JsonCompatible, JsonSerializable, StringifiedJson, bigintReplacer, canonicalizeJson, parseJson, parseJsonSafely, stringifyJson };
|
|
27
28
|
//# sourceMappingURL=json.d.ts.map
|
package/dist/json.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","names":[],"sources":["../src/json.ts"],"mappings":";KAEK,aAAA;AAAA,KAEA,SAAA,GAAY,aAAA,GAAgB,SAAA;EAAA,CAAiB,GAAA,WAAc,SAAA;AAAA;AAAA,KAEpD,gBAAA,GACR,aAAA,GACA,gBAAA;EAAA,CACG,GAAA,WAAc,gBAAA;AAAA;EACf,MAAA,IAAU,SAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"json.d.ts","names":[],"sources":["../src/json.ts"],"mappings":";KAEK,aAAA;AAAA,KAEA,SAAA,GAAY,aAAA,GAAgB,SAAA;EAAA,CAAiB,GAAA,WAAc,SAAA;AAAA;AAAA,KAEpD,gBAAA,GACR,aAAA,GACA,gBAAA;EAAA,CACG,GAAA,WAAc,gBAAA;AAAA;EACf,MAAA,IAAU,SAAA;AAAA;AAAA,KAEX,mBAAA,qBAAwC,QAAA;AAAA,KAEjC,cAAA,sBAAoC,CAAA,cAE3C,CAAA,WAAY,SAAA,IACX,CAAA,IACC,CAAA,WAAY,mBAAA,0BAGG,CAAA,IAAK,OAAA,CAAQ,CAAA,CAAE,CAAA,wBAAyB,SAAA,IAChD,CAAA,CAAE,CAAA,KACD,OAAA,CAAQ,CAAA,CAAE,CAAA,wBAAyB,mBAAA,YAElC,cAAA,CAAe,CAAA,CAAE,CAAA;AAAA,KAGrB,eAAA,gBACV,cAAA,CAAe,CAAA;EAGT,kBAAA,EAAoB,CAAA;AAAA;AAAA,iBAGZ,aAAA,GAAA,CAAiB,KAAA,EAAO,cAAA,CAAe,CAAA,IAAK,eAAA,CAAgB,CAAA;AAAA,iBAC5D,aAAA,WAAwB,gBAAA,CAAA,CAAkB,KAAA,EAAO,CAAA;AAAA,KAKrD,iBAAA,gBACV,cAAA,CAAe,CAAA;EAGT,oBAAA,EAAsB,CAAA;AAAA;AAAA,iBAGd,gBAAA,GAAA,CAAoB,KAAA,EAAO,cAAA,CAAe,CAAA,IAAK,iBAAA,CAAkB,CAAA;AAAA,iBACjE,gBAAA,WAA2B,gBAAA,CAAA,CAAkB,KAAA,EAAO,CAAA;AAAA,iBAKpD,SAAA,GAAA,CAAa,KAAA,EAAO,eAAA,CAAgB,CAAA,IAAK,iBAAA,CAAkB,CAAA,IAAK,CAAA;AAAA,iBAIhE,eAAA,kBAAA,CAAkC,KAAA,UAAe,QAAA,GAAW,CAAA,GAAI,CAAA,GAAI,CAAA;AAAA,iBAQpE,cAAA,CAAe,IAAA,UAAc,KAAA"}
|
package/dist/json.js
CHANGED
|
@@ -9,10 +9,17 @@ function canonicalizeJson(value) {
|
|
|
9
9
|
function parseJson(value) {
|
|
10
10
|
return JSON.parse(value);
|
|
11
11
|
}
|
|
12
|
+
function parseJsonSafely(value, fallback) {
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(value);
|
|
15
|
+
} catch {
|
|
16
|
+
return fallback;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
12
19
|
function bigintReplacer(_key, value) {
|
|
13
20
|
return typeof value === "bigint" ? value.toString() : value;
|
|
14
21
|
}
|
|
15
22
|
//#endregion
|
|
16
|
-
export { bigintReplacer, canonicalizeJson, parseJson, stringifyJson };
|
|
23
|
+
export { bigintReplacer, canonicalizeJson, parseJson, parseJsonSafely, stringifyJson };
|
|
17
24
|
|
|
18
25
|
//# sourceMappingURL=json.js.map
|
package/dist/json.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","names":[],"sources":["../src/json.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\
|
|
1
|
+
{"version":3,"file":"json.js","names":[],"sources":["../src/json.ts"],"sourcesContent":["import canonicalize from \"canonicalize\";\n\ntype JsonPrimitive = string | number | boolean | null;\n\ntype JsonValue = JsonPrimitive | JsonValue[] | { [key: string]: JsonValue };\n\nexport type JsonSerializable =\n | JsonPrimitive\n | JsonSerializable[]\n | { [key: string]: JsonSerializable }\n | { toJSON(): JsonValue };\n\ntype NotAssignableToJson = bigint | symbol | Function;\n\nexport type JsonCompatible<T> = unknown extends T\n ? unknown\n : [T] extends [JsonValue]\n ? T\n : [T] extends [NotAssignableToJson]\n ? never\n : {\n [P in keyof T]: [Exclude<T[P], undefined>] extends [JsonValue]\n ? T[P]\n : [Exclude<T[P], undefined>] extends [NotAssignableToJson]\n ? never\n : JsonCompatible<T[P]>;\n };\n\nexport type StringifiedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_stringified: T;\n };\n\nexport function stringifyJson<T>(value: JsonCompatible<T>): StringifiedJson<T>;\nexport function stringifyJson<T extends JsonSerializable>(value: T): string;\nexport function stringifyJson(value: unknown): string {\n return JSON.stringify(value);\n}\n\nexport type CanonicalizedJson<T = unknown> =\n JsonCompatible<T> extends never\n ? never\n : string & {\n __json_canonicalized: T;\n };\n\nexport function canonicalizeJson<T>(value: JsonCompatible<T>): CanonicalizedJson<T>;\nexport function canonicalizeJson<T extends JsonSerializable>(value: T): string;\nexport function canonicalizeJson(value: unknown): string {\n return canonicalize(value)!;\n}\n\nexport function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>): T {\n return JSON.parse(value) as T;\n}\n\nexport function parseJsonSafely<T, F = undefined>(value: string, fallback?: F): T | F {\n try {\n return JSON.parse(value) as T;\n } catch {\n return fallback as F;\n }\n}\n\nexport function bigintReplacer(_key: string, value: unknown): unknown {\n return typeof value === \"bigint\" ? value.toString() : value;\n}\n"],"mappings":";;AAqCA,SAAgB,cAAc,OAAwB;AACpD,QAAO,KAAK,UAAU,MAAM;;AAY9B,SAAgB,iBAAiB,OAAwB;AACvD,QAAO,aAAa,MAAM;;AAG5B,SAAgB,UAAa,OAAqD;AAChF,QAAO,KAAK,MAAM,MAAM;;AAG1B,SAAgB,gBAAkC,OAAe,UAAqB;AACpF,KAAI;AACF,SAAO,KAAK,MAAM,MAAM;SAClB;AACN,SAAO;;;AAIX,SAAgB,eAAe,MAAc,OAAyB;AACpE,QAAO,OAAO,UAAU,WAAW,MAAM,UAAU,GAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@milaboratories/pl-model-common",
|
|
3
|
-
"version": "1.41.
|
|
3
|
+
"version": "1.41.2",
|
|
4
4
|
"description": "Platforma SDK Model",
|
|
5
5
|
"files": [
|
|
6
6
|
"./dist/**/*",
|
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
"@vitest/coverage-istanbul": "^4.1.3",
|
|
27
27
|
"typescript": "~5.9.3",
|
|
28
28
|
"vitest": "^4.1.3",
|
|
29
|
-
"@milaboratories/ts-configs": "1.2.3",
|
|
30
29
|
"@milaboratories/build-configs": "2.0.0",
|
|
31
|
-
"@milaboratories/ts-builder": "1.4.0"
|
|
30
|
+
"@milaboratories/ts-builder": "1.4.0",
|
|
31
|
+
"@milaboratories/ts-configs": "1.2.3"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
34
34
|
"build": "ts-builder build --target node",
|
package/src/json.ts
CHANGED
|
@@ -10,7 +10,6 @@ export type JsonSerializable =
|
|
|
10
10
|
| { [key: string]: JsonSerializable }
|
|
11
11
|
| { toJSON(): JsonValue };
|
|
12
12
|
|
|
13
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
|
14
13
|
type NotAssignableToJson = bigint | symbol | Function;
|
|
15
14
|
|
|
16
15
|
export type JsonCompatible<T> = unknown extends T
|
|
@@ -57,6 +56,14 @@ export function parseJson<T>(value: StringifiedJson<T> | CanonicalizedJson<T>):
|
|
|
57
56
|
return JSON.parse(value) as T;
|
|
58
57
|
}
|
|
59
58
|
|
|
59
|
+
export function parseJsonSafely<T, F = undefined>(value: string, fallback?: F): T | F {
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(value) as T;
|
|
62
|
+
} catch {
|
|
63
|
+
return fallback as F;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
60
67
|
export function bigintReplacer(_key: string, value: unknown): unknown {
|
|
61
68
|
return typeof value === "bigint" ? value.toString() : value;
|
|
62
69
|
}
|