@osdk/api 2.6.0-beta.9 → 2.7.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/build/browser/objectSet/ObjectSet.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +8 -8
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/ontology/QueryDefinition.js.map +1 -1
- package/build/cjs/{ObjectSet-D7jdSkmi.d.cts → ObjectSet-Dtb6G0ll.d.cts} +3 -3
- package/build/cjs/index.d.cts +5 -3
- package/build/cjs/public/unstable.d.cts +2 -2
- package/build/esm/objectSet/ObjectSet.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +8 -8
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/ontology/QueryDefinition.js.map +1 -1
- package/build/types/objectSet/ObjectSet.d.ts +3 -3
- package/build/types/objectSet/ObjectSet.d.ts.map +1 -1
- package/build/types/ontology/QueryDefinition.d.ts +3 -1
- package/build/types/ontology/QueryDefinition.d.ts.map +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryDefinition.js","names":[],"sources":["QueryDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { OsdkMetadata } from \"../OsdkMetadata.js\";\nimport type { ObjectOrInterfaceDefinition } from \"./ObjectOrInterface.js\";\nimport type { ObjectTypeDefinition } from \"./ObjectTypeDefinition.js\";\n\nexport interface QueryMetadata {\n type: \"query\";\n apiName: string;\n description?: string;\n displayName?: string;\n version: string;\n parameters: Record<string, QueryParameterDefinition<any>>;\n output: QueryDataTypeDefinition;\n rid: string;\n}\n\nexport interface QueryCompileTimeMetadata<T> {\n signature: T;\n}\n\nexport interface QueryDefinition<T = any> {\n type: \"query\";\n apiName: string;\n version?: string;\n isFixedVersion?: boolean;\n osdkMetadata?: OsdkMetadata;\n __DefinitionMetadata?:\n & QueryCompileTimeMetadata<T>\n & QueryMetadata;\n}\n\nexport type QueryParameterDefinition<\n T_Target extends ObjectTypeDefinition = any,\n> = {\n description?: string;\n} & QueryDataTypeDefinition<T_Target>;\n\nexport type QueryDataTypeDefinition<\n T_Target extends ObjectOrInterfaceDefinition = any,\n> =\n | PrimitiveDataType\n | ObjectQueryDataType<T_Target>\n | InterfaceQueryDataType<T_Target>\n | ObjectSetQueryDataType<T_Target>\n | InterfaceObjectSetQueryDataType<T_Target>\n | SetQueryDataType\n | UnionQueryDataType\n | StructQueryDataType\n | TwoDimensionalAggregationDataType\n | ThreeDimensionalAggregationDataType\n | MapDataType\n | ArrayQueryDataType;\n\nexport type BaseQueryDataTypeDefinition<T extends string> = {\n multiplicity?: boolean;\n nullable?: boolean;\n type: T;\n};\n\nexport type WireQueryDataTypes =\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"boolean\"\n | \"string\"\n | \"date\"\n | \"timestamp\"\n | \"attachment\";\n\nexport type PrimitiveDataType<\n Q extends WireQueryDataTypes = WireQueryDataTypes,\n> = BaseQueryDataTypeDefinition<Q>;\n\nexport interface ObjectQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"object\"> {\n object: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface InterfaceQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"interface\"> {\n interface: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface ObjectSetQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"objectSet\"> {\n objectSet: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface InterfaceObjectSetQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"interfaceObjectSet\"> {\n objectSet: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface SetQueryDataType extends BaseQueryDataTypeDefinition<\"set\"> {\n set: QueryDataTypeDefinition;\n}\n\nexport interface ArrayQueryDataType\n extends BaseQueryDataTypeDefinition<\"array\">\n{\n array: QueryDataTypeDefinition;\n multiplicity
|
|
1
|
+
{"version":3,"file":"QueryDefinition.js","names":[],"sources":["QueryDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { OsdkMetadata } from \"../OsdkMetadata.js\";\nimport type { ObjectOrInterfaceDefinition } from \"./ObjectOrInterface.js\";\nimport type { ObjectTypeDefinition } from \"./ObjectTypeDefinition.js\";\n\nexport interface QueryMetadata {\n type: \"query\";\n apiName: string;\n description?: string;\n displayName?: string;\n version: string;\n parameters: Record<string, QueryParameterDefinition<any>>;\n output: QueryDataTypeDefinition;\n rid: string;\n}\n\nexport interface QueryCompileTimeMetadata<T> {\n signature: T;\n}\n\nexport interface QueryDefinition<T = any> {\n type: \"query\";\n apiName: string;\n version?: string;\n isFixedVersion?: boolean;\n osdkMetadata?: OsdkMetadata;\n __DefinitionMetadata?:\n & QueryCompileTimeMetadata<T>\n & QueryMetadata;\n}\n\nexport type QueryParameterDefinition<\n T_Target extends ObjectTypeDefinition = any,\n> = {\n description?: string;\n} & QueryDataTypeDefinition<T_Target>;\n\nexport type QueryDataTypeDefinition<\n T_Target extends ObjectOrInterfaceDefinition = any,\n> =\n | PrimitiveDataType\n | ObjectQueryDataType<T_Target>\n | InterfaceQueryDataType<T_Target>\n | ObjectSetQueryDataType<T_Target>\n | InterfaceObjectSetQueryDataType<T_Target>\n | SetQueryDataType\n | UnionQueryDataType\n | StructQueryDataType\n | TwoDimensionalAggregationDataType\n | ThreeDimensionalAggregationDataType\n | MapDataType\n | ArrayQueryDataType;\n\nexport type BaseQueryDataTypeDefinition<T extends string> = {\n /** @deprecated use T[\"type\"] extends \"array\" instead */\n multiplicity?: boolean;\n nullable?: boolean;\n type: T;\n};\n\nexport type WireQueryDataTypes =\n | \"double\"\n | \"float\"\n | \"integer\"\n | \"long\"\n | \"boolean\"\n | \"string\"\n | \"date\"\n | \"timestamp\"\n | \"attachment\";\n\nexport type PrimitiveDataType<\n Q extends WireQueryDataTypes = WireQueryDataTypes,\n> = BaseQueryDataTypeDefinition<Q>;\n\nexport interface ObjectQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"object\"> {\n object: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface InterfaceQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"interface\"> {\n interface: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface ObjectSetQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"objectSet\"> {\n objectSet: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface InterfaceObjectSetQueryDataType<\n T_Target extends ObjectOrInterfaceDefinition = never,\n> extends BaseQueryDataTypeDefinition<\"interfaceObjectSet\"> {\n objectSet: string;\n __OsdkTargetType?: T_Target;\n}\n\nexport interface SetQueryDataType extends BaseQueryDataTypeDefinition<\"set\"> {\n set: QueryDataTypeDefinition;\n}\n\nexport interface ArrayQueryDataType\n extends BaseQueryDataTypeDefinition<\"array\">\n{\n array: QueryDataTypeDefinition;\n /** @deprecated use T[\"type\"] extends \"array\" instead */\n multiplicity?: true;\n}\nexport interface UnionQueryDataType\n extends BaseQueryDataTypeDefinition<\"union\">\n{\n union: ReadonlyArray<QueryDataTypeDefinition>;\n}\n\nexport interface StructQueryDataType\n extends BaseQueryDataTypeDefinition<\"struct\">\n{\n struct: Record<string, QueryDataTypeDefinition>;\n}\n\nexport interface TwoDimensionalAggregationDataType\n extends BaseQueryDataTypeDefinition<\"twoDimensionalAggregation\">\n{\n twoDimensionalAggregation: TwoDimensionalQueryAggregationDefinition;\n}\n\nexport interface ThreeDimensionalAggregationDataType\n extends BaseQueryDataTypeDefinition<\"threeDimensionalAggregation\">\n{\n threeDimensionalAggregation: ThreeDimensionalQueryAggregationDefinition;\n}\n\nexport interface MapDataType extends BaseQueryDataTypeDefinition<\"map\"> {\n keyType: QueryDataTypeDefinition;\n valueType: QueryDataTypeDefinition;\n}\n\nexport type AggregationKeyDataType<V = any> =\n | SimpleAggregationKeyDataType<V>\n | RangeAggregationKeyDataType<V>;\n\nexport interface SimpleAggregationKeyDataType<V = any> {\n keyType: Exclude<AggregationKeyTypes, \"range\">;\n valueType: V;\n}\nexport interface RangeAggregationKeyDataType<V = any> {\n keyType: \"range\";\n keySubtype: AggregationRangeKeyTypes;\n valueType: V;\n}\n\nexport type TwoDimensionalQueryAggregationDefinition = AggregationKeyDataType<\n AggregationValueTypes\n>;\n\nexport type ThreeDimensionalQueryAggregationDefinition = AggregationKeyDataType<\n TwoDimensionalQueryAggregationDefinition\n>;\n\nexport type AggregationKeyTypes =\n | \"boolean\"\n | \"string\"\n | \"date\"\n | \"double\"\n | \"integer\"\n | \"timestamp\"\n | \"range\";\n\nexport type AggregationRangeKeyTypes =\n | \"date\"\n | \"double\"\n | \"integer\"\n | \"timestamp\";\n\nexport type AggregationValueTypes = \"date\" | \"double\" | \"timestamp\";\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1575,7 +1575,7 @@ interface Subscribe<Q extends ObjectOrInterfaceDefinition> {
|
|
|
1575
1575
|
unsubscribe: () => void;
|
|
1576
1576
|
};
|
|
1577
1577
|
}
|
|
1578
|
-
interface
|
|
1578
|
+
interface NarrowToType<Q extends ObjectOrInterfaceDefinition> {
|
|
1579
1579
|
/**
|
|
1580
1580
|
* Casts the object set to the specified object type or interface type.
|
|
1581
1581
|
* Any downstream object set operations (e.g. where, fetchPage, aggregate) will be
|
|
@@ -1584,7 +1584,7 @@ interface AsType<Q extends ObjectOrInterfaceDefinition> {
|
|
|
1584
1584
|
* @param type - The object type you want to cast to.
|
|
1585
1585
|
* @returns an object set of the specified type.
|
|
1586
1586
|
*/
|
|
1587
|
-
readonly
|
|
1587
|
+
readonly narrowToType: <CONVERT_TO extends RestrictToImplementingObjectTypes<Q>>(type: CONVERT_TO) => ObjectSet<CONVERT_TO>;
|
|
1588
1588
|
}
|
|
1589
1589
|
type RestrictToImplementingObjectTypes<T extends ObjectOrInterfaceDefinition> = T extends ObjectTypeDefinition ? ExtractImplementedInterfaces<T> : T extends InterfaceDefinition ? ExtractImplementingTypes<T> : never;
|
|
1590
1590
|
type ExtractImplementedInterfaces<T extends ObjectTypeDefinition> = CompileTimeMetadata<T> extends {
|
|
@@ -1597,7 +1597,7 @@ type ExtractImplementingTypes<T extends InterfaceDefinition> = CompileTimeMetada
|
|
|
1597
1597
|
} ? (ObjectTypeDefinition & {
|
|
1598
1598
|
apiName: API_NAME;
|
|
1599
1599
|
}) | InterfaceDefinition : InterfaceDefinition;
|
|
1600
|
-
interface ObjectSetCleanedTypes<Q extends ObjectOrInterfaceDefinition, D extends Record<string, SimplePropertyDef>, MERGED extends ObjectOrInterfaceDefinition & Q, ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {}> extends MinimalObjectSet<Q, D, ORDER_BY_OPTIONS>, WithProperties<Q, D>, Aggregate<MERGED>, SetArithmetic<MERGED>, PivotTo<Q>, FetchOne<Q, D>, Subscribe<MERGED>, NearestNeighbors<Q>,
|
|
1600
|
+
interface ObjectSetCleanedTypes<Q extends ObjectOrInterfaceDefinition, D extends Record<string, SimplePropertyDef>, MERGED extends ObjectOrInterfaceDefinition & Q, ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {}> extends MinimalObjectSet<Q, D, ORDER_BY_OPTIONS>, WithProperties<Q, D>, Aggregate<MERGED>, SetArithmetic<MERGED>, PivotTo<Q>, FetchOne<Q, D>, Subscribe<MERGED>, NearestNeighbors<Q>, NarrowToType<Q> {
|
|
1601
1601
|
}
|
|
1602
1602
|
|
|
1603
1603
|
export { isOk as $, type AttachmentUpload as A, type GroupByClause as B, type CompileTimeMetadata as C, DistanceUnitMapping as D, type GroupByRange as E, type AsyncIterArgs as F, type GeoFilterOptions as G, type Augment as H, type InterfaceDefinition as I, type Augments as J, type FetchPageArgs as K, NullabilityAdherence as L, type MediaReference as M, type NotWhereClause as N, type ObjectTypeDefinition as O, type PropertyValueWireToClient as P, ObjectSetArgs as Q, type ReleaseStatus as R, type SingleLinkAccessor as S, type SelectArg as T, type SelectArgToKeys as U, type ValidAggregationKeys as V, type WhereClause as W, type FetchPageResult as X, type SingleOsdkResult as Y, type Media as Z, type MediaMetadata as _, type MediaUpload as a, type ExtractOptions as a$, type Result as a0, type BaseObjectSet as a1, ObjectSetSubscription as a2, InterfaceMetadata as a3, PropertyKeys as a4, type ObjectSpecifier as a5, ObjectMetadata as a6, type PropertyDef as a7, type VersionBound as a8, SimplePropertyDef as a9, type NumberFormatScale as aA, type NumberFormatStandard as aB, type NumberFormatStandardUnit as aC, type NumberRatioType as aD, type NumberRoundingMode as aE, type NumberScaleType as aF, type PropertyNumberFormattingRule as aG, type PropertyNumberFormattingRuleType as aH, type TimeCodeFormat as aI, type PropertyValueFormattingRule as aJ, type PropertyTypeReference as aK, type PropertyTypeReferenceOrStringConstant as aL, type StringConstant as aM, type BaseWirePropertyTypes as aN, type WirePropertyTypes as aO, type PrimaryKeyType as aP, type ConvertProps as aQ, type MaybeScore as aR, Osdk as aS, type PageResult as aT, TimeseriesDurationMapping as aU, type GeotimeSeriesProperty as aV, type TimeSeriesPoint as aW, type TimeSeriesProperty as aX, type TimeSeriesQuery as aY, type LinkedType as aZ, type LinkNames as a_, type PropertyBooleanFormattingRule as aa, type DatetimeFormat as ab, type DatetimeLocalizedFormat as ac, type DatetimeLocalizedFormatType as ad, type DatetimeStringFormat as ae, type DatetimeTimezone as af, type DatetimeTimezoneStatic as ag, type DatetimeTimezoneUser as ah, type PropertyDateFormattingRule as ai, type PropertyTimestampFormattingRule as aj, type KnownType as ak, type PropertyKnownTypeFormattingRule as al, type Affix as am, type DurationBaseValue as an, type DurationFormatStyle as ao, type DurationPrecision as ap, type HumanReadableFormat as aq, type NumberFormatAffix as ar, type NumberFormatCurrency as as, type NumberFormatCurrencyStyle as at, type NumberFormatCustomUnit as au, type NumberFormatDuration as av, type NumberFormatFixedValues as aw, type NumberFormatNotation as ax, type NumberFormatOptions as ay, type NumberFormatRatio as az, type Attachment as b, type MinimalObjectSet as b0, type ObjectIdentifiers as c, type OsdkObjectPrimaryKeyType as d, type ObjectSet as e, type OsdkMetadata as f, type ObjectOrInterfaceDefinition as g, type PrimaryKeyTypes as h, type OsdkBase as i, type AggregateOpts as j, type AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as k, type AggregationResultsWithGroups as l, type AggregationResultsWithoutGroups as m, type AggregationClause as n, type AggregationsResults as o, type AndWhereClause as p, type GeoFilter_Intersects as q, type GeoFilter_Within as r, type OrWhereClause as s, type PossibleWhereClauseFilters as t, type OsdkObjectCreatePropertyType as u, type OsdkObjectPropertyType as v, type OsdkObjectLinksObject as w, DerivedProperty as x, DurationMapping as y, type AllGroupByValues as z };
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AttachmentUpload, M as MediaReference, a as MediaUpload, b as Attachment, O as ObjectTypeDefinition, c as ObjectIdentifiers, d as OsdkObjectPrimaryKeyType, e as ObjectSet, I as InterfaceDefinition, C as CompileTimeMetadata, f as OsdkMetadata, R as ReleaseStatus, g as ObjectOrInterfaceDefinition, P as PropertyValueWireToClient, h as PrimaryKeyTypes, i as OsdkBase } from './ObjectSet-
|
|
2
|
-
export { am as Affix, j as AggregateOpts, k as AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy, n as AggregationClause, l as AggregationResultsWithGroups, m as AggregationResultsWithoutGroups, o as AggregationsResults, z as AllGroupByValues, p as AndWhereClause, F as AsyncIterArgs, H as Augment, J as Augments, a1 as BaseObjectSet, aN as BaseWirePropertyTypes, aQ as ConvertProps, ab as DatetimeFormat, ac as DatetimeLocalizedFormat, ad as DatetimeLocalizedFormatType, ae as DatetimeStringFormat, af as DatetimeTimezone, ag as DatetimeTimezoneStatic, ah as DatetimeTimezoneUser, x as DerivedProperty, D as DistanceUnitMapping, an as DurationBaseValue, ao as DurationFormatStyle, y as DurationMapping, ap as DurationPrecision, K as FetchPageArgs, X as FetchPageResult, G as GeoFilterOptions, q as GeoFilter_Intersects, r as GeoFilter_Within, aV as GeotimeSeriesProperty, B as GroupByClause, E as GroupByRange, aq as HumanReadableFormat, a3 as InterfaceMetadata, ak as KnownType, a_ as LinkNames, aZ as LinkedType, aR as MaybeScore, Z as Media, _ as MediaMetadata, N as NotWhereClause, L as NullabilityAdherence, ar as NumberFormatAffix, as as NumberFormatCurrency, at as NumberFormatCurrencyStyle, au as NumberFormatCustomUnit, av as NumberFormatDuration, aw as NumberFormatFixedValues, ax as NumberFormatNotation, ay as NumberFormatOptions, az as NumberFormatRatio, aA as NumberFormatScale, aB as NumberFormatStandard, aC as NumberFormatStandardUnit, aD as NumberRatioType, aE as NumberRoundingMode, aF as NumberScaleType, a6 as ObjectMetadata, Q as ObjectSetArgs, a2 as ObjectSetSubscription, a5 as ObjectSpecifier, s as OrWhereClause, aS as Osdk, u as OsdkObjectCreatePropertyType, w as OsdkObjectLinksObject, v as OsdkObjectPropertyType, aT as PageResult, t as PossibleWhereClauseFilters, aP as PrimaryKeyType, aa as PropertyBooleanFormattingRule, ai as PropertyDateFormattingRule, a7 as PropertyDef, a4 as PropertyKeys, al as PropertyKnownTypeFormattingRule, aG as PropertyNumberFormattingRule, aH as PropertyNumberFormattingRuleType, aj as PropertyTimestampFormattingRule, aK as PropertyTypeReference, aL as PropertyTypeReferenceOrStringConstant, aJ as PropertyValueFormattingRule, a0 as Result, T as SelectArg, U as SelectArgToKeys, a9 as SimplePropertyDef, S as SingleLinkAccessor, Y as SingleOsdkResult, aM as StringConstant, aI as TimeCodeFormat, aW as TimeSeriesPoint, aX as TimeSeriesProperty, aY as TimeSeriesQuery, aU as TimeseriesDurationMapping, V as ValidAggregationKeys, a8 as VersionBound, W as WhereClause, aO as WirePropertyTypes, $ as isOk } from './ObjectSet-
|
|
1
|
+
import { A as AttachmentUpload, M as MediaReference, a as MediaUpload, b as Attachment, O as ObjectTypeDefinition, c as ObjectIdentifiers, d as OsdkObjectPrimaryKeyType, e as ObjectSet, I as InterfaceDefinition, C as CompileTimeMetadata, f as OsdkMetadata, R as ReleaseStatus, g as ObjectOrInterfaceDefinition, P as PropertyValueWireToClient, h as PrimaryKeyTypes, i as OsdkBase } from './ObjectSet-Dtb6G0ll.cjs';
|
|
2
|
+
export { am as Affix, j as AggregateOpts, k as AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy, n as AggregationClause, l as AggregationResultsWithGroups, m as AggregationResultsWithoutGroups, o as AggregationsResults, z as AllGroupByValues, p as AndWhereClause, F as AsyncIterArgs, H as Augment, J as Augments, a1 as BaseObjectSet, aN as BaseWirePropertyTypes, aQ as ConvertProps, ab as DatetimeFormat, ac as DatetimeLocalizedFormat, ad as DatetimeLocalizedFormatType, ae as DatetimeStringFormat, af as DatetimeTimezone, ag as DatetimeTimezoneStatic, ah as DatetimeTimezoneUser, x as DerivedProperty, D as DistanceUnitMapping, an as DurationBaseValue, ao as DurationFormatStyle, y as DurationMapping, ap as DurationPrecision, K as FetchPageArgs, X as FetchPageResult, G as GeoFilterOptions, q as GeoFilter_Intersects, r as GeoFilter_Within, aV as GeotimeSeriesProperty, B as GroupByClause, E as GroupByRange, aq as HumanReadableFormat, a3 as InterfaceMetadata, ak as KnownType, a_ as LinkNames, aZ as LinkedType, aR as MaybeScore, Z as Media, _ as MediaMetadata, N as NotWhereClause, L as NullabilityAdherence, ar as NumberFormatAffix, as as NumberFormatCurrency, at as NumberFormatCurrencyStyle, au as NumberFormatCustomUnit, av as NumberFormatDuration, aw as NumberFormatFixedValues, ax as NumberFormatNotation, ay as NumberFormatOptions, az as NumberFormatRatio, aA as NumberFormatScale, aB as NumberFormatStandard, aC as NumberFormatStandardUnit, aD as NumberRatioType, aE as NumberRoundingMode, aF as NumberScaleType, a6 as ObjectMetadata, Q as ObjectSetArgs, a2 as ObjectSetSubscription, a5 as ObjectSpecifier, s as OrWhereClause, aS as Osdk, u as OsdkObjectCreatePropertyType, w as OsdkObjectLinksObject, v as OsdkObjectPropertyType, aT as PageResult, t as PossibleWhereClauseFilters, aP as PrimaryKeyType, aa as PropertyBooleanFormattingRule, ai as PropertyDateFormattingRule, a7 as PropertyDef, a4 as PropertyKeys, al as PropertyKnownTypeFormattingRule, aG as PropertyNumberFormattingRule, aH as PropertyNumberFormattingRuleType, aj as PropertyTimestampFormattingRule, aK as PropertyTypeReference, aL as PropertyTypeReferenceOrStringConstant, aJ as PropertyValueFormattingRule, a0 as Result, T as SelectArg, U as SelectArgToKeys, a9 as SimplePropertyDef, S as SingleLinkAccessor, Y as SingleOsdkResult, aM as StringConstant, aI as TimeCodeFormat, aW as TimeSeriesPoint, aX as TimeSeriesProperty, aY as TimeSeriesQuery, aU as TimeseriesDurationMapping, V as ValidAggregationKeys, a8 as VersionBound, W as WhereClause, aO as WirePropertyTypes, $ as isOk } from './ObjectSet-Dtb6G0ll.cjs';
|
|
3
3
|
import 'type-fest';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
|
|
@@ -332,6 +332,7 @@ type QueryParameterDefinition<T_Target extends ObjectTypeDefinition = any> = {
|
|
|
332
332
|
} & QueryDataTypeDefinition<T_Target>;
|
|
333
333
|
type QueryDataTypeDefinition<T_Target extends ObjectOrInterfaceDefinition = any> = PrimitiveDataType | ObjectQueryDataType<T_Target> | InterfaceQueryDataType<T_Target> | ObjectSetQueryDataType<T_Target> | InterfaceObjectSetQueryDataType<T_Target> | SetQueryDataType | UnionQueryDataType | StructQueryDataType | TwoDimensionalAggregationDataType | ThreeDimensionalAggregationDataType | MapDataType | ArrayQueryDataType;
|
|
334
334
|
type BaseQueryDataTypeDefinition<T extends string> = {
|
|
335
|
+
/** @deprecated use T["type"] extends "array" instead */
|
|
335
336
|
multiplicity?: boolean;
|
|
336
337
|
nullable?: boolean;
|
|
337
338
|
type: T;
|
|
@@ -359,7 +360,8 @@ interface SetQueryDataType extends BaseQueryDataTypeDefinition<"set"> {
|
|
|
359
360
|
}
|
|
360
361
|
interface ArrayQueryDataType extends BaseQueryDataTypeDefinition<"array"> {
|
|
361
362
|
array: QueryDataTypeDefinition;
|
|
362
|
-
|
|
363
|
+
/** @deprecated use T["type"] extends "array" instead */
|
|
364
|
+
multiplicity?: true;
|
|
363
365
|
}
|
|
364
366
|
interface UnionQueryDataType extends BaseQueryDataTypeDefinition<"union"> {
|
|
365
367
|
union: ReadonlyArray<QueryDataTypeDefinition>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as ObjectOrInterfaceDefinition, a4 as PropertyKeys, M as MediaReference, O as ObjectTypeDefinition, L as NullabilityAdherence, T as SelectArg, aS as Osdk, a$ as ExtractOptions, K as FetchPageArgs, X as FetchPageResult, i as OsdkBase } from '../ObjectSet-
|
|
2
|
-
export { b0 as MinimalObjectSet } from '../ObjectSet-
|
|
1
|
+
import { g as ObjectOrInterfaceDefinition, a4 as PropertyKeys, M as MediaReference, O as ObjectTypeDefinition, L as NullabilityAdherence, T as SelectArg, aS as Osdk, a$ as ExtractOptions, K as FetchPageArgs, X as FetchPageResult, i as OsdkBase } from '../ObjectSet-Dtb6G0ll.cjs';
|
|
2
|
+
export { b0 as MinimalObjectSet } from '../ObjectSet-Dtb6G0ll.cjs';
|
|
3
3
|
import 'type-fest';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectSet.js","names":[],"sources":["ObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AggregateOpts } from \"../aggregate/AggregateOpts.js\";\nimport type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from \"../aggregate/AggregateOptsThatErrors.js\";\nimport type { AggregationsResults } from \"../aggregate/AggregationsResults.js\";\nimport type { WhereClause } from \"../aggregate/WhereClause.js\";\nimport type { DerivedProperty } from \"../derivedProperties/DerivedProperty.js\";\nimport type {\n AsyncIterArgs,\n Augments,\n FetchPageArgs,\n NullabilityAdherence,\n ObjectSetArgs,\n SelectArg,\n} from \"../object/FetchPageArgs.js\";\nimport type { Result } from \"../object/Result.js\";\nimport type { InterfaceDefinition } from \"../ontology/InterfaceDefinition.js\";\nimport type {\n DerivedObjectOrInterfaceDefinition,\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n} from \"../ontology/ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { PrimaryKeyType } from \"../OsdkBase.js\";\nimport type {\n ExtractAllPropertiesOption,\n ExtractOptions,\n ExtractRidOption,\n MaybeScore,\n Osdk,\n} from \"../OsdkObjectFrom.js\";\nimport type { PageResult } from \"../PageResult.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport type { BaseObjectSet } from \"./BaseObjectSet.js\";\nimport type { ObjectSetSubscription } from \"./ObjectSetListener.js\";\n\ntype MergeObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef> = {},\n> = DerivedObjectOrInterfaceDefinition.WithDerivedProperties<Q, D>;\n\ntype ExtractRdp<\n D extends\n | BaseObjectSet<any>\n | Record<string, SimplePropertyDef>,\n> = [D] extends [never] ? {}\n : D extends BaseObjectSet<any> ? {}\n : D extends Record<string, SimplePropertyDef> ? D\n : {};\n\ntype MaybeSimplifyPropertyKeys<\n Q extends ObjectOrInterfaceDefinition,\n L extends PropertyKeys<Q>,\n> = PropertyKeys<Q> extends L ? PropertyKeys<Q> : L & PropertyKeys<Q>;\n\ntype SubSelectKeysHelper<\n Q extends ObjectOrInterfaceDefinition,\n L extends string,\n> = [L] extends [never] ? PropertyKeys<Q>\n : PropertyKeys<Q> extends L ? PropertyKeys<Q>\n : L & PropertyKeys<Q>;\n\ntype SubSelectKeys<\n Q extends ObjectOrInterfaceDefinition,\n X extends SelectArg<Q, PropertyKeys<Q>, any, any> = never,\n> = SubSelectKeysHelper<Q, Extract$Select<X>>;\n\ntype NOOP<T> = T extends (...args: any[]) => any ? T\n : T extends abstract new(...args: any[]) => any ? T\n : { [K in keyof T]: T[K] };\n\ntype SubSelectRDPsHelper<\n X extends ValidFetchPageArgs<any, any, any> | ValidAsyncIterArgs<any, any>,\n DEFAULT extends string,\n> = [X] extends [never] ? DEFAULT\n : (X[\"$select\"] & string[])[number] & DEFAULT;\n\ntype SubSelectRDPs<\n RDPs extends Record<string, SimplePropertyDef>,\n X extends ValidFetchPageArgs<any, RDPs, any> | ValidAsyncIterArgs<any, RDPs>,\n> = [RDPs] extends [never] ? never\n : NOOP<{ [K in SubSelectRDPsHelper<X, string & keyof RDPs>]: RDPs[K] }>;\n\nexport interface MinimalObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> extends\n BaseObjectSet<Q>,\n FetchPage<Q, RDPs>,\n AsyncIter<Q, RDPs, ORDER_BY_OPTIONS>,\n Where<Q, RDPs>\n{\n}\n\nexport type ExtractOptions2<\n X extends FetchPageArgs<any, any, any, any, any, any, any>,\n> = [X] extends [never] ? never\n :\n | ExtractRidOption<X[\"$includeRid\"] extends true ? true : false>\n | ExtractAllPropertiesOption<\n X[\"$includeAllBaseObjectProperties\"] extends true ? true : false\n >;\n\ntype Extract$Select<X extends FetchPageArgs<any, any>> = NonNullable<\n X[\"$select\"]\n>[number];\n\ninterface FetchPage<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n readonly fetchPage: FetchPageSignature<Q, RDPs>;\n readonly fetchPageWithErrors: FetchPageWithErrorsSignature<Q, RDPs>;\n}\n\ntype ValidFetchPageArgs<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>>,\n> = ObjectSetArgs.FetchPage<\n Q,\n PropertyKeys<Q>,\n boolean,\n string & keyof RDPs,\n ORDER_BY_OPTIONS\n>;\n\ntype ValidAsyncIterArgs<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> =\n | ObjectSetArgs.AsyncIter<\n Q,\n PropertyKeys<Q>,\n false,\n string & keyof RDPs\n >\n | AsyncIterArgs<\n Q,\n never,\n any,\n any,\n any,\n true,\n string & keyof RDPs\n >;\n\ninterface FetchPageSignature<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Gets a page of objects of this type, with a result wrapper\n * @param args - Args to specify next page token and page size, if applicable\n * @example\n * const myObjs = await objectSet.fetchPage({\n $pageSize: 10,\n $nextPageToken: \"nextPage\"\n });\n const myObjsResult = myObjs.data;\n\n * @returns a page of objects\n */\n <\n L extends PropertyKeys<Q> | (string & keyof RDPs),\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<L> = {},\n >(\n args?: FetchPageArgs<Q, L, R, A, S, T, never, ORDER_BY_OPTIONS>,\n ): Promise<\n PageResult<\n MaybeScore<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>,\n SubSelectRDPs<RDPs, NonNullable<typeof args>>\n >,\n ORDER_BY_OPTIONS\n >\n >\n >;\n}\n\ninterface NearestNeighbors<Q extends ObjectOrInterfaceDefinition> {\n /**\n * Finds the nearest neighbors for a given text or vector within the object set.\n *\n * @param query - Queries support either a vector matching the embedding model defined on the property, or text that is\n automatically embedded.\n * @param numNeighbors - The number of objects to return. If the number of documents in the objectType is less than the provided\n value, all objects will be returned. This value is limited to 1 ≤ numNeighbors ≥ 500.\n * @param property - The property key with a defined embedding model to search over.\n *\n * @returns An object set containing the `numNeighbors` nearest neighbors. To return the objects ordered by relevance and each\n * objects associated score, specify \"relevance\" in the orderBy.\n */\n\n readonly nearestNeighbors: (\n query: string | number[],\n numNeighbors: number,\n property: PropertyKeys.Filtered<Q, \"vector\">,\n ) => this;\n}\n\ninterface FetchPageWithErrorsSignature<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Gets a page of objects of this type, with a result wrapper\n * @param args - Args to specify next page token and page size, if applicable\n * @example\n * const myObjs = await objectSet.fetchPage({\n $pageSize: 10,\n $nextPageToken: \"nextPage\"\n });\n\n if(isOk(myObjs)){\n const myObjsResult = myObjs.value.data;\n }\n * @returns a page of objects, wrapped in a result wrapper\n */\n <\n L extends PropertyKeys<Q> | (string & keyof RDPs),\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<L> = {},\n >(\n args?: FetchPageArgs<Q, L, R, A, S, T, never, ORDER_BY_OPTIONS>,\n ): Promise<\n Result<\n PageResult<\n MaybeScore<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>,\n SubSelectRDPs<RDPs, NonNullable<typeof args>>\n >,\n ORDER_BY_OPTIONS\n >\n >\n >\n >;\n}\n\n// TODO MOVE THIS\ninterface Where<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Allows you to filter an object set with a given clause\n * @param clause - Takes a filter clause\n * @example\n * await client(Office).where({\n meetingRooms: { $contains: \"Grand Central\" },\n meetingRoomCapacities: { $contains: 30 },\n});\n* @returns an objectSet\n */\n readonly where: (\n clause: WhereClause<MergeObjectSet<Q, RDPs>>,\n ) => this;\n}\n\ninterface AsyncIterSignature<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> {\n /**\n * Returns an async iterator to load all objects of this type\n * @example\n * for await (const obj of myObjectSet.asyncIter()){\n * // Handle obj\n * }\n * @returns an async iterator to load all objects\n */\n <X extends ValidAsyncIterArgs<Q, RDPs> = never>(\n args?: X,\n ): AsyncIterableIterator<\n Osdk.Instance<\n Q,\n ExtractOptions2<X>,\n SubSelectKeys<Q, X>,\n SubSelectRDPs<RDPs, X>\n >\n >;\n\n /**\n * Returns an async iterator to load all objects of this type\n * @example\n * for await (const obj of myObjectSet.asyncIter()){\n * // Handle obj\n * }\n * @returns an async iterator to load all objects\n */\n <\n L extends PropertyKeys<Q> | (string & keyof RDPs),\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n >(\n args?: AsyncIterArgs<Q, L, R, A, S, T, never, ORDER_BY_OPTIONS>,\n ): AsyncIterableIterator<\n MaybeScore<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>,\n SubSelectRDPs<RDPs, NonNullable<typeof args>>\n >,\n ORDER_BY_OPTIONS\n >\n >;\n}\n\ninterface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> {\n asyncIter: AsyncIterSignature<Q, RDPs, ORDER_BY_OPTIONS>;\n}\n\ninterface WithProperties<\n Q extends ObjectOrInterfaceDefinition = any,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n readonly withProperties: <\n NEW extends Record<string, SimplePropertyDef>,\n >(\n clause: { [K in keyof NEW]: DerivedProperty.Creator<Q, NEW[K]> },\n ) => ObjectSet<\n Q,\n {\n [NN in keyof NEW | keyof RDPs]: NN extends keyof NEW ? NEW[NN]\n : NN extends keyof RDPs ? RDPs[NN]\n : never;\n }\n >;\n}\n\nexport interface ObjectSet<\n Q extends ObjectOrInterfaceDefinition = any,\n // Generated code has what is basically ObjectSet<Q> set in here\n // but we never used it so I am repurposing it for RDP\n UNUSED_OR_RDP extends\n | BaseObjectSet<Q>\n | Record<string, SimplePropertyDef> = never,\n> extends\n ObjectSetCleanedTypes<\n Q,\n ExtractRdp<UNUSED_OR_RDP>,\n MergeObjectSet<Q, ExtractRdp<UNUSED_OR_RDP>>\n >\n{\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface Aggregate<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Aggregate on a field in an object type\n * @param req - an aggregation request where you can select fields and choose how to aggregate, e.g., max, min, avg, and also choose\n * whether or not you order your results. You can also specify a groupBy field to group your aggregations\n * @example\n * const testAggregateCountWithGroups = await client(BoundariesUsState)\n .aggregate({\n $select: {\n $count: \"unordered\",\n \"latitude:max\": \"unordered\",\n \"latitude:min\": \"unordered\",\n \"latitude:avg\": \"unordered\",\n },\n $groupBy: {\n usState: \"exact\",\n longitude: {\n $fixedWidth: 10,\n },\n },\n });\n\n * @returns aggregation results, sorted in the groups based on the groupBy clause (if applicable)\n */\n readonly aggregate: <AO extends AggregateOpts<Q>>(\n req: AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<Q, AO>,\n ) => Promise<AggregationsResults<Q, AO>>;\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface SetArithmetic<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Unions object sets together\n * @param objectSets - objectSets you want to union with\n * @example\n * const unionObjectSet = complexFilteredEmployeeObjectSet.union(\n simpleFilteredEmployeeObjectSet,\n );\n * @returns the unioned object set\n */\n readonly union: (\n ...objectSets: ReadonlyArray<CompileTimeMetadata<Q>[\"objectSet\"]>\n ) => this;\n\n /**\n * Computes the intersection of object sets\n * @param objectSets - objectSets you want to intersect with\n * @example\n * const intersectedObjectSet = complexFilteredEmployeeObjectSet.intersect(\n simpleFilteredEmployeeObjectSet,\n );\n * @returns the intersected object set\n */\n readonly intersect: (\n ...objectSets: ReadonlyArray<CompileTimeMetadata<Q>[\"objectSet\"]>\n ) => this;\n\n /**\n * Computes the subtraction of object sets\n * @param objectSets - objectSets you want to subtract from\n * @example\n * const subtractObjectSet = complexFilteredEmployeeObjectSet.subtract(\n simpleFilteredEmployeeObjectSet,\n );\n * @returns the subtract object set\n */\n readonly subtract: (\n ...objectSets: ReadonlyArray<CompileTimeMetadata<Q>[\"objectSet\"]>\n ) => this;\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface PivotTo<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Pivots the object set over to all its linked objects of the specified type\n * @param type - The linked object type you want to pivot to\n * @returns an object set of the specified linked type\n */\n readonly pivotTo: <L extends LinkNames<Q>>(\n type: L,\n ) => ObjectSet<LinkedType<Q, L>>;\n}\n\ninterface FetchOneSignature<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> {\n /**\n * Fetches one object with the specified primary key, without a result wrapper\n */\n <\n const L extends PropertyKeys<Q> | (string & keyof RDPs),\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n primaryKey: PrimaryKeyType<Q>,\n options?: SelectArg<Q, L, R, S>,\n ): Promise<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S>,\n NoInfer<SubSelectKeys<Q, { $select: Array<L> }>>,\n SubSelectRDPs<RDPs, { $select: Array<L> }>\n >\n >;\n}\n\ninterface FetchOneWithErrorsSignature<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> {\n /**\n * Fetches one object with the specified primary key, with a result wrapper\n */\n <\n const L extends PropertyKeys<Q> | (string & keyof RDPs),\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n primaryKey: PrimaryKeyType<Q>,\n options?: SelectArg<Q, L, R, S>,\n ): Promise<\n Result<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S>,\n NoInfer<SubSelectKeys<Q, { $select: Array<L> }>>,\n SubSelectRDPs<RDPs, { $select: Array<L> }>\n >\n >\n >;\n}\n\ninterface FetchOne<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> {\n fetchOne: Q extends ObjectTypeDefinition ? FetchOneSignature<Q, RDPs> : never;\n fetchOneWithErrors: Q extends ObjectTypeDefinition\n ? FetchOneWithErrorsSignature<Q, RDPs>\n : never;\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface Subscribe<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Request updates when the objects in an object set are added, updated, or removed.\n * @param listener - The handlers to be executed during the lifecycle of the subscription.\n * @param opts - Options to modify what properties are returned on subscription updates.\n * @returns an object containing a function to unsubscribe.\n */\n readonly subscribe: <\n const P extends PropertyKeys<Q>,\n >(\n listener: ObjectSetSubscription.Listener<Q, P>,\n opts?: ObjectSetSubscription.Options<Q, P>,\n ) => { unsubscribe: () => void };\n}\n\ninterface AsType<Q extends ObjectOrInterfaceDefinition> {\n /**\n * Casts the object set to the specified object type or interface type.\n * Any downstream object set operations (e.g. where, fetchPage, aggregate) will be\n * performed on the specified type. Objects from the original object set that do not\n * implement the specified interface or match the specified object set will be filtered out.\n * @param type - The object type you want to cast to.\n * @returns an object set of the specified type.\n */\n readonly asType: <CONVERT_TO extends RestrictToImplementingObjectTypes<Q>>(\n type: CONVERT_TO,\n ) => ObjectSet<CONVERT_TO>;\n}\n\ntype RestrictToImplementingObjectTypes<T extends ObjectOrInterfaceDefinition> =\n T extends ObjectTypeDefinition ? ExtractImplementedInterfaces<T>\n : T extends InterfaceDefinition ? ExtractImplementingTypes<T>\n : never;\n\ntype ExtractImplementedInterfaces<T extends ObjectTypeDefinition> =\n CompileTimeMetadata<T> extends { implements: ReadonlyArray<infer API_NAME> }\n ? API_NAME extends string ? InterfaceDefinition & { apiName: API_NAME }\n : never\n : never;\n\ntype ExtractImplementingTypes<T extends InterfaceDefinition> =\n CompileTimeMetadata<T> extends\n { implementedBy: ReadonlyArray<infer API_NAME extends string> }\n ? (ObjectTypeDefinition & { apiName: API_NAME }) | InterfaceDefinition\n : InterfaceDefinition;\n\ninterface ObjectSetCleanedTypes<\n Q extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n MERGED extends ObjectOrInterfaceDefinition & Q,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> extends\n MinimalObjectSet<Q, D, ORDER_BY_OPTIONS>,\n WithProperties<Q, D>,\n Aggregate<MERGED>,\n SetArithmetic<MERGED>,\n PivotTo<Q>,\n FetchOne<Q, D>,\n Subscribe<MERGED>,\n NearestNeighbors<Q>,\n AsType<Q>\n{\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectSet.js","names":[],"sources":["ObjectSet.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { AggregateOpts } from \"../aggregate/AggregateOpts.js\";\nimport type { AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy } from \"../aggregate/AggregateOptsThatErrors.js\";\nimport type { AggregationsResults } from \"../aggregate/AggregationsResults.js\";\nimport type { WhereClause } from \"../aggregate/WhereClause.js\";\nimport type { DerivedProperty } from \"../derivedProperties/DerivedProperty.js\";\nimport type {\n AsyncIterArgs,\n Augments,\n FetchPageArgs,\n NullabilityAdherence,\n ObjectSetArgs,\n SelectArg,\n} from \"../object/FetchPageArgs.js\";\nimport type { Result } from \"../object/Result.js\";\nimport type { InterfaceDefinition } from \"../ontology/InterfaceDefinition.js\";\nimport type {\n DerivedObjectOrInterfaceDefinition,\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n} from \"../ontology/ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"../ontology/SimplePropertyDef.js\";\nimport type { PrimaryKeyType } from \"../OsdkBase.js\";\nimport type {\n ExtractAllPropertiesOption,\n ExtractOptions,\n ExtractRidOption,\n MaybeScore,\n Osdk,\n} from \"../OsdkObjectFrom.js\";\nimport type { PageResult } from \"../PageResult.js\";\nimport type { LinkedType, LinkNames } from \"../util/LinkUtils.js\";\nimport type { BaseObjectSet } from \"./BaseObjectSet.js\";\nimport type { ObjectSetSubscription } from \"./ObjectSetListener.js\";\n\ntype MergeObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef> = {},\n> = DerivedObjectOrInterfaceDefinition.WithDerivedProperties<Q, D>;\n\ntype ExtractRdp<\n D extends\n | BaseObjectSet<any>\n | Record<string, SimplePropertyDef>,\n> = [D] extends [never] ? {}\n : D extends BaseObjectSet<any> ? {}\n : D extends Record<string, SimplePropertyDef> ? D\n : {};\n\ntype MaybeSimplifyPropertyKeys<\n Q extends ObjectOrInterfaceDefinition,\n L extends PropertyKeys<Q>,\n> = PropertyKeys<Q> extends L ? PropertyKeys<Q> : L & PropertyKeys<Q>;\n\ntype SubSelectKeysHelper<\n Q extends ObjectOrInterfaceDefinition,\n L extends string,\n> = [L] extends [never] ? PropertyKeys<Q>\n : PropertyKeys<Q> extends L ? PropertyKeys<Q>\n : L & PropertyKeys<Q>;\n\ntype SubSelectKeys<\n Q extends ObjectOrInterfaceDefinition,\n X extends SelectArg<Q, PropertyKeys<Q>, any, any> = never,\n> = SubSelectKeysHelper<Q, Extract$Select<X>>;\n\ntype NOOP<T> = T extends (...args: any[]) => any ? T\n : T extends abstract new(...args: any[]) => any ? T\n : { [K in keyof T]: T[K] };\n\ntype SubSelectRDPsHelper<\n X extends ValidFetchPageArgs<any, any, any> | ValidAsyncIterArgs<any, any>,\n DEFAULT extends string,\n> = [X] extends [never] ? DEFAULT\n : (X[\"$select\"] & string[])[number] & DEFAULT;\n\ntype SubSelectRDPs<\n RDPs extends Record<string, SimplePropertyDef>,\n X extends ValidFetchPageArgs<any, RDPs, any> | ValidAsyncIterArgs<any, RDPs>,\n> = [RDPs] extends [never] ? never\n : NOOP<{ [K in SubSelectRDPsHelper<X, string & keyof RDPs>]: RDPs[K] }>;\n\nexport interface MinimalObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> extends\n BaseObjectSet<Q>,\n FetchPage<Q, RDPs>,\n AsyncIter<Q, RDPs, ORDER_BY_OPTIONS>,\n Where<Q, RDPs>\n{\n}\n\nexport type ExtractOptions2<\n X extends FetchPageArgs<any, any, any, any, any, any, any>,\n> = [X] extends [never] ? never\n :\n | ExtractRidOption<X[\"$includeRid\"] extends true ? true : false>\n | ExtractAllPropertiesOption<\n X[\"$includeAllBaseObjectProperties\"] extends true ? true : false\n >;\n\ntype Extract$Select<X extends FetchPageArgs<any, any>> = NonNullable<\n X[\"$select\"]\n>[number];\n\ninterface FetchPage<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n readonly fetchPage: FetchPageSignature<Q, RDPs>;\n readonly fetchPageWithErrors: FetchPageWithErrorsSignature<Q, RDPs>;\n}\n\ntype ValidFetchPageArgs<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>>,\n> = ObjectSetArgs.FetchPage<\n Q,\n PropertyKeys<Q>,\n boolean,\n string & keyof RDPs,\n ORDER_BY_OPTIONS\n>;\n\ntype ValidAsyncIterArgs<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> =\n | ObjectSetArgs.AsyncIter<\n Q,\n PropertyKeys<Q>,\n false,\n string & keyof RDPs\n >\n | AsyncIterArgs<\n Q,\n never,\n any,\n any,\n any,\n true,\n string & keyof RDPs\n >;\n\ninterface FetchPageSignature<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Gets a page of objects of this type, with a result wrapper\n * @param args - Args to specify next page token and page size, if applicable\n * @example\n * const myObjs = await objectSet.fetchPage({\n $pageSize: 10,\n $nextPageToken: \"nextPage\"\n });\n const myObjsResult = myObjs.data;\n\n * @returns a page of objects\n */\n <\n L extends PropertyKeys<Q> | (string & keyof RDPs),\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<L> = {},\n >(\n args?: FetchPageArgs<Q, L, R, A, S, T, never, ORDER_BY_OPTIONS>,\n ): Promise<\n PageResult<\n MaybeScore<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>,\n SubSelectRDPs<RDPs, NonNullable<typeof args>>\n >,\n ORDER_BY_OPTIONS\n >\n >\n >;\n}\n\ninterface NearestNeighbors<Q extends ObjectOrInterfaceDefinition> {\n /**\n * Finds the nearest neighbors for a given text or vector within the object set.\n *\n * @param query - Queries support either a vector matching the embedding model defined on the property, or text that is\n automatically embedded.\n * @param numNeighbors - The number of objects to return. If the number of documents in the objectType is less than the provided\n value, all objects will be returned. This value is limited to 1 ≤ numNeighbors ≥ 500.\n * @param property - The property key with a defined embedding model to search over.\n *\n * @returns An object set containing the `numNeighbors` nearest neighbors. To return the objects ordered by relevance and each\n * objects associated score, specify \"relevance\" in the orderBy.\n */\n\n readonly nearestNeighbors: (\n query: string | number[],\n numNeighbors: number,\n property: PropertyKeys.Filtered<Q, \"vector\">,\n ) => this;\n}\n\ninterface FetchPageWithErrorsSignature<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Gets a page of objects of this type, with a result wrapper\n * @param args - Args to specify next page token and page size, if applicable\n * @example\n * const myObjs = await objectSet.fetchPage({\n $pageSize: 10,\n $nextPageToken: \"nextPage\"\n });\n\n if(isOk(myObjs)){\n const myObjsResult = myObjs.value.data;\n }\n * @returns a page of objects, wrapped in a result wrapper\n */\n <\n L extends PropertyKeys<Q> | (string & keyof RDPs),\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<L> = {},\n >(\n args?: FetchPageArgs<Q, L, R, A, S, T, never, ORDER_BY_OPTIONS>,\n ): Promise<\n Result<\n PageResult<\n MaybeScore<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>,\n SubSelectRDPs<RDPs, NonNullable<typeof args>>\n >,\n ORDER_BY_OPTIONS\n >\n >\n >\n >;\n}\n\n// TODO MOVE THIS\ninterface Where<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n /**\n * Allows you to filter an object set with a given clause\n * @param clause - Takes a filter clause\n * @example\n * await client(Office).where({\n meetingRooms: { $contains: \"Grand Central\" },\n meetingRoomCapacities: { $contains: 30 },\n});\n* @returns an objectSet\n */\n readonly where: (\n clause: WhereClause<MergeObjectSet<Q, RDPs>>,\n ) => this;\n}\n\ninterface AsyncIterSignature<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> {\n /**\n * Returns an async iterator to load all objects of this type\n * @example\n * for await (const obj of myObjectSet.asyncIter()){\n * // Handle obj\n * }\n * @returns an async iterator to load all objects\n */\n <X extends ValidAsyncIterArgs<Q, RDPs> = never>(\n args?: X,\n ): AsyncIterableIterator<\n Osdk.Instance<\n Q,\n ExtractOptions2<X>,\n SubSelectKeys<Q, X>,\n SubSelectRDPs<RDPs, X>\n >\n >;\n\n /**\n * Returns an async iterator to load all objects of this type\n * @example\n * for await (const obj of myObjectSet.asyncIter()){\n * // Handle obj\n * }\n * @returns an async iterator to load all objects\n */\n <\n L extends PropertyKeys<Q> | (string & keyof RDPs),\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n >(\n args?: AsyncIterArgs<Q, L, R, A, S, T, never, ORDER_BY_OPTIONS>,\n ): AsyncIterableIterator<\n MaybeScore<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>,\n SubSelectRDPs<RDPs, NonNullable<typeof args>>\n >,\n ORDER_BY_OPTIONS\n >\n >;\n}\n\ninterface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> {\n asyncIter: AsyncIterSignature<Q, RDPs, ORDER_BY_OPTIONS>;\n}\n\ninterface WithProperties<\n Q extends ObjectOrInterfaceDefinition = any,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n readonly withProperties: <\n NEW extends Record<string, SimplePropertyDef>,\n >(\n clause: { [K in keyof NEW]: DerivedProperty.Creator<Q, NEW[K]> },\n ) => ObjectSet<\n Q,\n {\n [NN in keyof NEW | keyof RDPs]: NN extends keyof NEW ? NEW[NN]\n : NN extends keyof RDPs ? RDPs[NN]\n : never;\n }\n >;\n}\n\nexport interface ObjectSet<\n Q extends ObjectOrInterfaceDefinition = any,\n // Generated code has what is basically ObjectSet<Q> set in here\n // but we never used it so I am repurposing it for RDP\n UNUSED_OR_RDP extends\n | BaseObjectSet<Q>\n | Record<string, SimplePropertyDef> = never,\n> extends\n ObjectSetCleanedTypes<\n Q,\n ExtractRdp<UNUSED_OR_RDP>,\n MergeObjectSet<Q, ExtractRdp<UNUSED_OR_RDP>>\n >\n{\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface Aggregate<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Aggregate on a field in an object type\n * @param req - an aggregation request where you can select fields and choose how to aggregate, e.g., max, min, avg, and also choose\n * whether or not you order your results. You can also specify a groupBy field to group your aggregations\n * @example\n * const testAggregateCountWithGroups = await client(BoundariesUsState)\n .aggregate({\n $select: {\n $count: \"unordered\",\n \"latitude:max\": \"unordered\",\n \"latitude:min\": \"unordered\",\n \"latitude:avg\": \"unordered\",\n },\n $groupBy: {\n usState: \"exact\",\n longitude: {\n $fixedWidth: 10,\n },\n },\n });\n\n * @returns aggregation results, sorted in the groups based on the groupBy clause (if applicable)\n */\n readonly aggregate: <AO extends AggregateOpts<Q>>(\n req: AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<Q, AO>,\n ) => Promise<AggregationsResults<Q, AO>>;\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface SetArithmetic<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Unions object sets together\n * @param objectSets - objectSets you want to union with\n * @example\n * const unionObjectSet = complexFilteredEmployeeObjectSet.union(\n simpleFilteredEmployeeObjectSet,\n );\n * @returns the unioned object set\n */\n readonly union: (\n ...objectSets: ReadonlyArray<CompileTimeMetadata<Q>[\"objectSet\"]>\n ) => this;\n\n /**\n * Computes the intersection of object sets\n * @param objectSets - objectSets you want to intersect with\n * @example\n * const intersectedObjectSet = complexFilteredEmployeeObjectSet.intersect(\n simpleFilteredEmployeeObjectSet,\n );\n * @returns the intersected object set\n */\n readonly intersect: (\n ...objectSets: ReadonlyArray<CompileTimeMetadata<Q>[\"objectSet\"]>\n ) => this;\n\n /**\n * Computes the subtraction of object sets\n * @param objectSets - objectSets you want to subtract from\n * @example\n * const subtractObjectSet = complexFilteredEmployeeObjectSet.subtract(\n simpleFilteredEmployeeObjectSet,\n );\n * @returns the subtract object set\n */\n readonly subtract: (\n ...objectSets: ReadonlyArray<CompileTimeMetadata<Q>[\"objectSet\"]>\n ) => this;\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface PivotTo<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Pivots the object set over to all its linked objects of the specified type\n * @param type - The linked object type you want to pivot to\n * @returns an object set of the specified linked type\n */\n readonly pivotTo: <L extends LinkNames<Q>>(\n type: L,\n ) => ObjectSet<LinkedType<Q, L>>;\n}\n\ninterface FetchOneSignature<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> {\n /**\n * Fetches one object with the specified primary key, without a result wrapper\n */\n <\n const L extends PropertyKeys<Q> | (string & keyof RDPs),\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n primaryKey: PrimaryKeyType<Q>,\n options?: SelectArg<Q, L, R, S>,\n ): Promise<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S>,\n NoInfer<SubSelectKeys<Q, { $select: Array<L> }>>,\n SubSelectRDPs<RDPs, { $select: Array<L> }>\n >\n >;\n}\n\ninterface FetchOneWithErrorsSignature<\n Q extends ObjectTypeDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> {\n /**\n * Fetches one object with the specified primary key, with a result wrapper\n */\n <\n const L extends PropertyKeys<Q> | (string & keyof RDPs),\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n primaryKey: PrimaryKeyType<Q>,\n options?: SelectArg<Q, L, R, S>,\n ): Promise<\n Result<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S>,\n NoInfer<SubSelectKeys<Q, { $select: Array<L> }>>,\n SubSelectRDPs<RDPs, { $select: Array<L> }>\n >\n >\n >;\n}\n\ninterface FetchOne<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef>,\n> {\n fetchOne: Q extends ObjectTypeDefinition ? FetchOneSignature<Q, RDPs> : never;\n fetchOneWithErrors: Q extends ObjectTypeDefinition\n ? FetchOneWithErrorsSignature<Q, RDPs>\n : never;\n}\n\n// Q is the merged type here! Not renaming to keep diff small. Rename in follow up\ninterface Subscribe<\n Q extends ObjectOrInterfaceDefinition,\n> {\n /**\n * Request updates when the objects in an object set are added, updated, or removed.\n * @param listener - The handlers to be executed during the lifecycle of the subscription.\n * @param opts - Options to modify what properties are returned on subscription updates.\n * @returns an object containing a function to unsubscribe.\n */\n readonly subscribe: <\n const P extends PropertyKeys<Q>,\n >(\n listener: ObjectSetSubscription.Listener<Q, P>,\n opts?: ObjectSetSubscription.Options<Q, P>,\n ) => { unsubscribe: () => void };\n}\n\ninterface NarrowToType<Q extends ObjectOrInterfaceDefinition> {\n /**\n * Casts the object set to the specified object type or interface type.\n * Any downstream object set operations (e.g. where, fetchPage, aggregate) will be\n * performed on the specified type. Objects from the original object set that do not\n * implement the specified interface or match the specified object set will be filtered out.\n * @param type - The object type you want to cast to.\n * @returns an object set of the specified type.\n */\n readonly narrowToType: <\n CONVERT_TO extends RestrictToImplementingObjectTypes<Q>,\n >(\n type: CONVERT_TO,\n ) => ObjectSet<CONVERT_TO>;\n}\n\ntype RestrictToImplementingObjectTypes<T extends ObjectOrInterfaceDefinition> =\n T extends ObjectTypeDefinition ? ExtractImplementedInterfaces<T>\n : T extends InterfaceDefinition ? ExtractImplementingTypes<T>\n : never;\n\ntype ExtractImplementedInterfaces<T extends ObjectTypeDefinition> =\n CompileTimeMetadata<T> extends { implements: ReadonlyArray<infer API_NAME> }\n ? API_NAME extends string ? InterfaceDefinition & { apiName: API_NAME }\n : never\n : never;\n\ntype ExtractImplementingTypes<T extends InterfaceDefinition> =\n CompileTimeMetadata<T> extends\n { implementedBy: ReadonlyArray<infer API_NAME extends string> }\n ? (ObjectTypeDefinition & { apiName: API_NAME }) | InterfaceDefinition\n : InterfaceDefinition;\n\ninterface ObjectSetCleanedTypes<\n Q extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n MERGED extends ObjectOrInterfaceDefinition & Q,\n ORDER_BY_OPTIONS extends ObjectSetArgs.OrderByOptions<PropertyKeys<Q>> = {},\n> extends\n MinimalObjectSet<Q, D, ORDER_BY_OPTIONS>,\n WithProperties<Q, D>,\n Aggregate<MERGED>,\n SetArithmetic<MERGED>,\n PivotTo<Q>,\n FetchOne<Q, D>,\n Subscribe<MERGED>,\n NearestNeighbors<Q>,\n NarrowToType<Q>\n{\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -656,20 +656,20 @@ describe("ObjectSet", () => {
|
|
|
656
656
|
expectTypeOf(nearestNeighborsObjectSetWithErrors.value?.data[0]).not.toHaveProperty("$score");
|
|
657
657
|
});
|
|
658
658
|
});
|
|
659
|
-
describe("
|
|
659
|
+
describe("narrowToType", () => {
|
|
660
660
|
it("restricts casting from interface to object type", () => {
|
|
661
661
|
const objectSet = {
|
|
662
|
-
|
|
662
|
+
narrowToType: () => {}
|
|
663
663
|
};
|
|
664
|
-
objectSet.
|
|
665
|
-
objectSet.
|
|
666
|
-
objectSet.
|
|
664
|
+
objectSet.narrowToType(EmployeeApiTest);
|
|
665
|
+
objectSet.narrowToType(FooInterfaceApiTest);
|
|
666
|
+
objectSet.narrowToType({
|
|
667
667
|
type: "interface",
|
|
668
668
|
apiName: "AnyInterface :)"
|
|
669
669
|
});
|
|
670
670
|
|
|
671
671
|
// @ts-expect-error
|
|
672
|
-
objectSet.
|
|
672
|
+
objectSet.narrowToType({
|
|
673
673
|
type: "object",
|
|
674
674
|
apiName: "NotImplemented"
|
|
675
675
|
});
|
|
@@ -677,8 +677,8 @@ describe("ObjectSet", () => {
|
|
|
677
677
|
// Interfaces that don't have any implementedBy fields should still accept any interface
|
|
678
678
|
|
|
679
679
|
({
|
|
680
|
-
|
|
681
|
-
}).
|
|
680
|
+
narrowToType: () => {}
|
|
681
|
+
}).narrowToType({
|
|
682
682
|
type: "interface",
|
|
683
683
|
apiName: "NotImplemented"
|
|
684
684
|
});
|