@osdk/api 2.2.0-rc.24 → 2.2.0-rc.25
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 +6 -0
- package/build/browser/definitions/LinkDefinitions.js.map +1 -1
- package/build/browser/object/FetchPageArgs.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/ontology/ObjectOrInterface.js.map +1 -1
- package/build/cjs/{ObjectSet-1V2b-FHw.d.cts → ObjectSet-BLinzmtM.d.cts} +21 -50
- package/build/cjs/index.d.cts +2 -2
- package/build/cjs/public/unstable.d.cts +2 -2
- package/build/esm/definitions/LinkDefinitions.js.map +1 -1
- package/build/esm/object/FetchPageArgs.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/ontology/ObjectOrInterface.js.map +1 -1
- package/build/types/definitions/LinkDefinitions.d.ts +1 -1
- package/build/types/definitions/LinkDefinitions.d.ts.map +1 -1
- package/build/types/object/FetchPageArgs.d.ts +7 -6
- package/build/types/object/FetchPageArgs.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSet.d.ts +19 -51
- package/build/types/objectSet/ObjectSet.d.ts.map +1 -1
- package/build/types/ontology/ObjectOrInterface.d.ts +2 -2
- package/build/types/ontology/ObjectOrInterface.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkDefinitions.js","names":[],"sources":["LinkDefinitions.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 { FetchPageArgs, SelectArg } from \"../object/FetchPageArgs.js\";\nimport type { Result } from \"../object/Result.js\";\nimport type { ObjectSet } from \"../objectSet/ObjectSet.js\";\nimport type { PropertyKeys } from \"../ontology/ObjectOrInterface.js\";\nimport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n ObjectTypeLinkKeysFrom2,\n} from \"../ontology/ObjectTypeDefinition.js\";\nimport type { ExtractOptions, Osdk } from \"../OsdkObjectFrom.js\";\n\n/** The $link container to get from one object type to its linked objects */\nexport type OsdkObjectLinksObject<\n O extends ObjectTypeDefinition,\n> = ObjectTypeLinkKeysFrom2<O> extends never ? never : {\n readonly [L in ObjectTypeLinkKeysFrom2<O>]: OsdkObjectLinksEntry<O, L>;\n};\n\nexport type OsdkObjectLinksEntry<\n Q extends ObjectTypeDefinition,\n L extends ObjectTypeLinkKeysFrom2<Q>,\n> = CompileTimeMetadata<Q>[\"links\"][L] extends\n ObjectMetadata.Link<infer T, infer M> ? (\n M extends false ? SingleLinkAccessor<T> : ObjectSet<T>\n )\n : never;\n\nexport type DefaultToFalse<B extends boolean | undefined> = false extends B\n ? false\n : undefined extends B ? false\n : true;\n\nexport interface SingleLinkAccessor<\n T extends ObjectTypeDefinition,\n> {\n /** Load the linked object\n */\n fetchOne: <\n const A extends SelectArg<\n T,\n PropertyKeys<T>,\n boolean\n >,\n >(\n options?: A,\n ) => Promise<\n A extends FetchPageArgs<T, infer L, infer R, any, infer S>\n ? Osdk.Instance<T, ExtractOptions<R, S>, L
|
|
1
|
+
{"version":3,"file":"LinkDefinitions.js","names":[],"sources":["LinkDefinitions.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 { FetchPageArgs, SelectArg } from \"../object/FetchPageArgs.js\";\nimport type { Result } from \"../object/Result.js\";\nimport type { ObjectSet } from \"../objectSet/ObjectSet.js\";\nimport type { PropertyKeys } from \"../ontology/ObjectOrInterface.js\";\nimport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n ObjectTypeLinkKeysFrom2,\n} from \"../ontology/ObjectTypeDefinition.js\";\nimport type { ExtractOptions, Osdk } from \"../OsdkObjectFrom.js\";\n\n/** The $link container to get from one object type to its linked objects */\nexport type OsdkObjectLinksObject<\n O extends ObjectTypeDefinition,\n> = ObjectTypeLinkKeysFrom2<O> extends never ? never : {\n readonly [L in ObjectTypeLinkKeysFrom2<O>]: OsdkObjectLinksEntry<O, L>;\n};\n\nexport type OsdkObjectLinksEntry<\n Q extends ObjectTypeDefinition,\n L extends ObjectTypeLinkKeysFrom2<Q>,\n> = CompileTimeMetadata<Q>[\"links\"][L] extends\n ObjectMetadata.Link<infer T, infer M> ? (\n M extends false ? SingleLinkAccessor<T> : ObjectSet<T>\n )\n : never;\n\nexport type DefaultToFalse<B extends boolean | undefined> = false extends B\n ? false\n : undefined extends B ? false\n : true;\n\nexport interface SingleLinkAccessor<\n T extends ObjectTypeDefinition,\n> {\n /** Load the linked object\n */\n fetchOne: <\n const A extends SelectArg<\n T,\n PropertyKeys<T>,\n boolean\n >,\n >(\n options?: A,\n ) => Promise<\n A extends FetchPageArgs<T, infer L, infer R, any, infer S>\n ? Osdk.Instance<T, ExtractOptions<R, S>, L & PropertyKeys<T>>\n : Osdk.Instance<T>\n >;\n\n /** Load the linked object, with a result wrapper\n */\n fetchOneWithErrors: <\n const A extends SelectArg<\n T,\n PropertyKeys<T>,\n boolean\n >,\n >(\n options?: A,\n ) => Promise<\n Result<\n A extends FetchPageArgs<T, infer L, infer R, any, infer S>\n ? Osdk.Instance<T, ExtractOptions<R, S>, L>\n : Osdk.Instance<T>\n >\n >;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchPageArgs.js","names":["NullabilityAdherence","ObjectSetArgs"],"sources":["FetchPageArgs.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\n\nexport type NullabilityAdherence = false | \"throw\" | \"drop\";\nexport namespace NullabilityAdherence {\n export type Default = \"throw\";\n}\n\nexport namespace ObjectSetArgs {\n export interface Select<\n OBJECT_KEYS extends string = never,\n RDP_KEYS extends string = never,\n > {\n $select?: readonly (OBJECT_KEYS | RDP_KEYS)[];\n $includeRid?: boolean;\n }\n\n export interface OrderBy<\n L extends string = never,\n > {\n $orderBy?: {\n [K in L]?: \"asc\" | \"desc\";\n };\n }\n\n export interface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends Select<K, RDP_KEYS>, OrderBy<K> {\n $__UNSTABLE_useOldInterfaceApis?: boolean;\n $includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;\n }\n\n export interface FetchPage<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends AsyncIter<Q, K, T, RDP_KEYS> {\n $nextPageToken?: string;\n $pageSize?: number;\n }\n}\n\nexport interface SelectArg<\n Q extends ObjectOrInterfaceDefinition,\n L extends
|
|
1
|
+
{"version":3,"file":"FetchPageArgs.js","names":["NullabilityAdherence","ObjectSetArgs"],"sources":["FetchPageArgs.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\n\nexport type NullabilityAdherence = false | \"throw\" | \"drop\";\nexport namespace NullabilityAdherence {\n export type Default = \"throw\";\n}\n\nexport namespace ObjectSetArgs {\n export interface Select<\n OBJECT_KEYS extends string = never,\n RDP_KEYS extends string = never,\n > {\n $select?: readonly (OBJECT_KEYS | RDP_KEYS)[];\n $includeRid?: boolean;\n }\n\n export interface OrderBy<\n L extends string = never,\n > {\n $orderBy?: {\n [K in L]?: \"asc\" | \"desc\";\n };\n }\n\n export interface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends Select<K, RDP_KEYS>, OrderBy<K> {\n $__UNSTABLE_useOldInterfaceApis?: boolean;\n $includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;\n }\n\n export interface FetchPage<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends AsyncIter<Q, K, T, RDP_KEYS> {\n $nextPageToken?: string;\n $pageSize?: number;\n }\n}\n\nexport interface SelectArg<\n Q extends ObjectOrInterfaceDefinition,\n L extends string = PropertyKeys<Q>,\n R extends boolean = false,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n RDP_KEYS extends string = never,\n> {\n $select?: readonly L[];\n $includeRid?: R;\n}\n\nexport interface OrderByArg<\n Q extends ObjectOrInterfaceDefinition,\n L extends string = PropertyKeys<Q>,\n> extends ObjectSetArgs.OrderBy<L> {\n}\n\nexport type SelectArgToKeys<\n Q extends ObjectOrInterfaceDefinition,\n A extends SelectArg<Q, any, any>,\n> = A extends SelectArg<Q, never> ? PropertyKeys<Q>\n : A[\"$select\"] extends readonly string[] ? A[\"$select\"][number]\n : PropertyKeys<Q>;\n\nexport interface FetchPageArgs<\n Q extends ObjectOrInterfaceDefinition,\n K extends string = PropertyKeys<Q>,\n R extends boolean = false,\n A extends Augments = never,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n> extends AsyncIterArgs<Q, K, R, A, S, T, RDP_KEYS> {\n $nextPageToken?: string;\n $pageSize?: number;\n}\n\nexport interface AsyncIterArgs<\n Q extends ObjectOrInterfaceDefinition,\n K extends string = PropertyKeys<Q>,\n R extends boolean = false,\n A extends Augments = never,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n> extends\n SelectArg<Q, K, R, S, RDP_KEYS>,\n OrderByArg<Q, PropertyKeys<Q> | RDP_KEYS>\n{\n $__UNSTABLE_useOldInterfaceApis?: boolean;\n $includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;\n}\n\nexport type Augment<\n X extends ObjectOrInterfaceDefinition,\n T extends string,\n> = { [K in CompileTimeMetadata<X>[\"apiName\"]]: T[] };\n\nexport type Augments = Record<string, string[]>;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAuBiBA,oBAAoB;AAAA,WAIpBC,aAAa","ignoreList":[]}
|
|
@@ -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 { DerivedPropertyCreator } 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 {\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 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;\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> | 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> | 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> extends\n BaseObjectSet<Q>,\n FetchPage<Q, RDPs>,\n AsyncIter<Q, RDPs>,\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> =\n | ObjectSetArgs.FetchPage<\n Q,\n PropertyKeys<Q>,\n false,\n string & keyof RDPs\n >\n | ObjectSetArgs.FetchPage<\n Q,\n never,\n true,\n string & keyof RDPs\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 <const X extends ValidFetchPageArgs<Q, RDPs> = never>(\n args?: X,\n ): Promise<\n PageResult<\n Osdk.Instance<\n Q,\n ExtractOptions2<X>,\n SubSelectKeys<Q, X>,\n SubSelectRDPs<RDPs, X>\n >\n >\n >;\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>,\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n >(\n args?: FetchPageArgs<Q, L, R, A, S, T>,\n ): Promise<\n PageResult<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n MaybeSimplifyPropertyKeys<Q, L>\n >\n >\n >;\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 <X extends ValidFetchPageArgs<Q, RDPs> = never>(\n args?: X,\n ): Promise<\n Result<\n PageResult<\n Osdk.Instance<\n Q,\n ExtractOptions2<X>,\n SubSelectKeys<Q, X>,\n SubSelectRDPs<RDPs, X>\n >\n >\n >\n >;\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>,\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n >(\n args?: FetchPageArgs<Q, L, R, A, S, T>,\n ): Promise<\n Result<\n PageResult<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n MaybeSimplifyPropertyKeys<Q, L>\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> {\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>,\n R extends boolean,\n const A extends Augments,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n >(\n args?: AsyncIterArgs<Q, L, R, A, S, T>,\n ): AsyncIterableIterator<\n Osdk.Instance<\n Q,\n ExtractOptions<R, S, T>,\n MaybeSimplifyPropertyKeys<Q, L>\n >\n >;\n}\n\ninterface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n asyncIter: AsyncIterSignature<Q, RDPs>;\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]: DerivedPropertyCreator<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 X extends ObjectSetArgs.Select<PropertyKeys<Q>, string & keyof RDPs> =\n never,\n >(\n primaryKey: PrimaryKeyType<Q>,\n options?: X,\n ): Promise<\n Osdk.Instance<\n Q,\n ExtractOptions2<X>,\n SubSelectKeys<Q, X>,\n SubSelectRDPs<RDPs, X>\n >\n >;\n\n /**\n * Fetches one object with the specified primary key, without a result wrapper\n */\n <\n const L extends PropertyKeys<Q>,\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 MaybeSimplifyPropertyKeys<Q, 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 <X extends ObjectSetArgs.Select<PropertyKeys<Q>, string & keyof RDPs>>(\n primaryKey: PrimaryKeyType<Q>,\n options?: X,\n ): Promise<\n Result<\n Osdk.Instance<\n Q,\n ExtractOptions2<X>,\n SubSelectKeys<Q, X>,\n SubSelectRDPs<RDPs, X>\n >\n >\n >;\n\n /**\n * Fetches one object with the specified primary key, with a result wrapper\n */\n <\n const L extends PropertyKeys<Q>,\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 MaybeSimplifyPropertyKeys<Q, 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 ObjectSetCleanedTypes<\n Q extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n MERGED extends ObjectOrInterfaceDefinition & Q,\n> extends\n MinimalObjectSet<Q, D>,\n WithProperties<Q, D>,\n Aggregate<MERGED>,\n SetArithmetic<MERGED>,\n PivotTo<Q>,\n FetchOne<Q, D>,\n Subscribe<MERGED>\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 { DerivedPropertyCreator } 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 {\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 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> | 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> | 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> extends\n BaseObjectSet<Q>,\n FetchPage<Q, RDPs>,\n AsyncIter<Q, RDPs>,\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> = ObjectSetArgs.FetchPage<\n Q,\n PropertyKeys<Q>,\n boolean,\n string & keyof RDPs\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 >(\n args?: FetchPageArgs<Q, L, R, A, S, T>,\n ): Promise<\n PageResult<\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 >\n >;\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 >(\n args?: FetchPageArgs<Q, L, R, A, S, T>,\n ): Promise<\n Result<\n PageResult<\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 >\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> {\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 >(\n args?: AsyncIterArgs<Q, L, R, A, S, T>,\n ): AsyncIterableIterator<\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 >;\n}\n\ninterface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n RDPs extends Record<string, SimplePropertyDef> = {},\n> {\n asyncIter: AsyncIterSignature<Q, RDPs>;\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]: DerivedPropertyCreator<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 ObjectSetCleanedTypes<\n Q extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n MERGED extends ObjectOrInterfaceDefinition & Q,\n> extends\n MinimalObjectSet<Q, D>,\n WithProperties<Q, D>,\n Aggregate<MERGED>,\n SetArithmetic<MERGED>,\n PivotTo<Q>,\n FetchOne<Q, D>,\n Subscribe<MERGED>\n{\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectSet.test.js","names":["describe","expectTypeOf","it","test","vi","createMockObjectSet","fauxObject","fauxResults","fauxObjectSet","$link","peeps","$objectSetInternals","def","data","where","fn","withProperties","fetchPage","Promise","resolve","fetchOne","asyncIter","aggregate","pivotTo","toEqualTypeOf","fetchPageResult","class","$includeAllBaseObjectProperties","asyncIterResult","$select","x","$includeRid","subselect","withA","base","withFamily","withMom","withParents","todo","withAggregations","whereResults","aggTestObjectSet","result","maxHasSameType","minHasSameType","approximateDistinctNumberNoUndefined","exactDistinctNumberNoUndefined","countNumberNoUndefined","sumNumber","avgNumber"],"sources":["ObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { describe, expectTypeOf, it, test, vi } from \"vitest\";\n\nimport type {\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk,\n PageResult,\n PropertyKeys,\n} from \"../index.js\";\nimport type { EmployeeApiTest } from \"../test/EmployeeApiTest.js\";\n\nexport function createMockObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(): $ObjectSet<Q, never> {\n let fauxObject: Osdk.Instance<Q>,\n fauxResults: any,\n fauxObjectSet: $ObjectSet<Q>;\n\n // eslint-disable-next-line prefer-const\n fauxObject = {\n $link: {\n peeps: {\n $objectSetInternals: {\n def: {},\n },\n },\n },\n } as Osdk.Instance<Q>;\n\n fauxResults = {\n data: [fauxObject],\n };\n\n fauxObjectSet = {\n where: vi.fn(() => {\n return fauxObjectSet;\n }),\n withProperties: vi.fn(() => {\n return fauxObjectSet;\n }),\n fetchPage: vi.fn(() => Promise.resolve(fauxResults)),\n fetchOne: vi.fn(() => fauxObject),\n asyncIter: vi.fn(() => {\n return {};\n }),\n aggregate: vi.fn(() => {\n return {};\n }),\n pivotTo: vi.fn(() => {\n return fauxObjectSet;\n }),\n } as any as $ObjectSet<Q>;\n\n return fauxObjectSet;\n}\n\ndescribe(\"ObjectSet\", () => {\n const fauxObjectSet = createMockObjectSet<EmployeeApiTest>();\n\n describe(\"normal\", () => {\n test(\"select none\", async () => {\n const result = await fauxObjectSet.fetchPage();\n expectTypeOf<typeof result.data[0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>>\n >();\n\n // Do it again but be explicit about the params to be sure\n // we don't break them\n const result2 = await fauxObjectSet.fetchPage<\n PropertyKeys<EmployeeApiTest>,\n false,\n never,\n NullabilityAdherence.Default,\n false\n >();\n });\n\n test(\"select one\", async () => {\n const result = await fauxObjectSet.fetchPage({ \"$select\": [\"fullName\"] });\n expectTypeOf<typeof result.data[0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, \"fullName\">\n >();\n });\n });\n\n describe(\"includeAllBaseObjectProperties\", () => {\n it(\"has the right types if you pass true\", async () => {\n const fetchPageResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({ $includeAllBaseObjectProperties: true });\n\n expectTypeOf(fetchPageResult).toEqualTypeOf<\n PageResult<\n Osdk.Instance<EmployeeApiTest, \"$allBaseProperties\">\n >\n >();\n\n const asyncIterResult = fauxObjectSet\n .where({ class: \"idk\" })\n .asyncIter({ $includeAllBaseObjectProperties: true });\n\n expectTypeOf(asyncIterResult).toEqualTypeOf<\n AsyncIterableIterator<\n Osdk.Instance<EmployeeApiTest, \"$allBaseProperties\">\n >\n >();\n });\n\n it(\"does not let you pass partial $select and true\", async () => {\n const fetchPageResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({\n // @ts-expect-error\n $includeAllBaseObjectProperties: true,\n $select: [\"attachment\"],\n });\n\n const asyncIterResult = fauxObjectSet\n .where({ class: \"idk\" })\n .asyncIter({\n // @ts-expect-error\n $includeAllBaseObjectProperties: true,\n $select: [\"attachment\"],\n });\n });\n\n it(\"does let you pass full select options and false\", async () => {\n const fetchPageResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({\n $includeAllBaseObjectProperties: true,\n\n // this select list is intended to represent all properties on `EmployeeApiTest`,\n // so if you get an error here later and you added properties to that object,\n // be sure to add them here too.\n $select: [\n \"attachment\",\n \"class\",\n \"employeeId\",\n \"fullName\",\n \"geopoint\",\n \"geotimeSeriesReference\",\n \"isActive\",\n \"mediaReference\",\n \"timeseries\",\n \"dateOfJoining\",\n \"hourlyRate\",\n \"yearsOfExperience\",\n \"rank\",\n \"performanceScore\",\n \"mediaReference\",\n \"lastUpdated\",\n ],\n });\n\n const asyncIterResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({\n $includeAllBaseObjectProperties: true,\n\n // this select list is intended to represent all properties on `EmployeeApiTest`,\n // so if you get an error here later and you added properties to that object,\n // be sure to add them here too.\n $select: [\n \"attachment\",\n \"class\",\n \"employeeId\",\n \"fullName\",\n \"geopoint\",\n \"geotimeSeriesReference\",\n \"isActive\",\n \"mediaReference\",\n \"timeseries\",\n \"dateOfJoining\",\n \"hourlyRate\",\n \"yearsOfExperience\",\n \"rank\",\n \"performanceScore\",\n \"mediaReference\",\n \"lastUpdated\",\n ],\n });\n });\n });\n\n test(\"includeRid\", async () => {\n const x = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({ $includeRid: true });\n\n expectTypeOf(x).toEqualTypeOf<\n PageResult<\n Osdk.Instance<EmployeeApiTest, \"$rid\">\n >\n >();\n });\n\n test(\"pivotTo\", async () => {\n const noArgs = await fauxObjectSet.pivotTo(\"peeps\").fetchPage({});\n const subselect = await fauxObjectSet.pivotTo(\"peeps\").fetchPage({\n $select: [\"employeeId\", \"class\"],\n });\n\n expectTypeOf(subselect).toEqualTypeOf<\n PageResult<\n Osdk.Instance<EmployeeApiTest, never, \"employeeId\" | \"class\">\n >\n >();\n });\n\n describe(\".withProperties\", () => {\n test(\"single property\", async () => {\n const withA = fauxObjectSet.withProperties({\n \"a\": (base) => {\n return base.pivotTo(\"lead\").aggregate(\"class:exactDistinct\");\n },\n });\n\n const isWithAAssignable: $ObjectSet<EmployeeApiTest, {}> = withA;\n\n expectTypeOf(withA).toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n a: \"integer\";\n }>\n >();\n\n const withAResults = await withA.fetchPage();\n\n expectTypeOf<typeof withAResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n a: \"integer\";\n }>\n >();\n\n expectTypeOf<typeof withAResults[\"data\"][0][\"a\"]>()\n .toEqualTypeOf<number>();\n });\n\n it(\"can be sub-selected\", () => {\n const objectWithUndefinedRdp = fauxObjectSet.withProperties({\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\"),\n }).fetchOne(3, {\n $select: [\"derivedPropertyName\"],\n });\n });\n\n test(\"multiple properties\", async () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"dad\": (base) => base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\"),\n \"sister\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n });\n expectTypeOf(withFamily).toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n mom: \"integer\";\n dad: \"datetime\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n mom: \"integer\";\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"mom\"]>()\n .toEqualTypeOf<number>();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"dad\"]>()\n .toEqualTypeOf<string | undefined>();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"sister\"]>()\n .toEqualTypeOf<string[] | undefined>();\n });\n\n describe(\"called in succession\", () => {\n test(\"independently\", () => {\n const withMom = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n });\n\n const withParents = withMom.withProperties({\n \"dad\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:approximateDistinct\"),\n });\n\n expectTypeOf(withParents).toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n mom: \"integer\";\n dad: \"integer\";\n }>\n >();\n });\n\n test.todo(\"with calculated properties\");\n });\n\n describe(\"nullability\", () => {\n it(\"count, exactDistinct, and approximateDistinct aren't nullable\", async () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"dad\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:exactDistinct\"),\n \"sis\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:approximateDistinct\"),\n });\n\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n mom: \"integer\";\n dad: \"integer\";\n sis: \"integer\";\n }>\n >();\n });\n\n it(\n \"collectToSet, collectToList, selectProperty, and numeric aggregations are nullable\",\n async () => {\n const withAggregations = fauxObjectSet.withProperties({\n \"collectSet\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:collectSet\"),\n \"collectList\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n \"min\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:max\"),\n \"max\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:min\"),\n \"sum\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:sum\"),\n \"avg\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:avg\"),\n \"approximatePercentile\": (base) =>\n base.pivotTo(\"lead\").aggregate(\n \"employeeId:approximatePercentile\",\n ),\n });\n\n const withAggregationResults = await withAggregations.fetchPage();\n\n expectTypeOf<typeof withAggregationResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n collectSet: \"string\"[] | undefined;\n collectList: \"string\"[] | undefined;\n min: \"double\" | undefined;\n max: \"double\" | undefined;\n sum: \"double\" | undefined;\n avg: \"double\" | undefined;\n approximatePercentile: \"double\" | undefined;\n }\n >\n >();\n },\n );\n });\n\n describe(\"fetch functions return correct Osdk.Instance\", () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"sister\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n });\n\n it(\"works with .where\", async () => {\n const where = withFamily.where({ \"mom\": 1 });\n const whereResults = await where.fetchPage();\n\n // Checks that if you did an `await where.fetchPage()` that you can then\n // pass/assign it to something explicit.\n const _assignPreviouslyInferredPages: PageResult<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n > = whereResults;\n\n // Checks that if you did an `await where.fetchPage()` that you can then\n // pass/assign it to something explicit.\n const _assignPreviouslyInferredInstance: Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n > = whereResults.data[0];\n\n const q = whereResults.data[0].$link.peeps.$objectSetInternals.def;\n\n // same as above but with expectTypeOf\n expectTypeOf<typeof where>().toEqualTypeOf<typeof withFamily>();\n expectTypeOf<typeof whereResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n >();\n\n // Checks that when you directly assign, it infers correctly.\n // Sometimes an explicit assignment can affect how typescript infers\n // types.\n const shouldBeAssignablePage: PageResult<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n > = await where.fetchPage();\n\n const _shouldBeAssignableSingle: Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n > = await withFamily.fetchOne(1);\n await withFamily.fetchOne(1);\n });\n\n it(\"works with .async\", () => {\n const asyncIter = withFamily.asyncIter();\n expectTypeOf<typeof asyncIter>().toEqualTypeOf<\n AsyncIterableIterator<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n >\n >();\n });\n\n it(\"Works with no select\", async () => {\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n >();\n });\n\n it(\"Works with selecting all RDPs\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"mom\", \"sister\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, never, {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }>\n >();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"mom\"]>()\n .toEqualTypeOf<number>();\n });\n\n it(\"Works with selecting some RDPs\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"mom\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, never, {\n mom: \"integer\";\n }>\n >();\n });\n\n it(\"Works with selecting all non-RDP's\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\n \"employeeId\",\n \"fullName\",\n \"class\",\n \"attachment\",\n \"geopoint\",\n \"timeseries\",\n \"mediaReference\",\n \"geotimeSeriesReference\",\n \"isActive\",\n \"yearsOfExperience\",\n \"rank\",\n \"performanceScore\",\n \"hourlyRate\",\n \"dateOfJoining\",\n \"lastUpdated\",\n ],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {}\n >\n >();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"class\"]>()\n .toEqualTypeOf<\n string | undefined\n >();\n });\n\n it(\"Works with selecting some non-RDP's\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, \"class\", {}>\n >();\n });\n\n it(\"Works with selecting a mix\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\", \"mom\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n \"class\",\n { mom: \"integer\" }\n >\n >();\n });\n });\n\n it(\"allows extracting the type\", () => {\n const objectSet = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n });\n\n type ObjectSetType = typeof objectSet;\n\n expectTypeOf<ObjectSetType>().toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n mom: \"integer\";\n }>\n >();\n\n const objectSet2 = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n }) satisfies ObjectSetType;\n });\n\n it(\"Defining the Type\", () => {\n type ObjectSetType = $ObjectSet<\n EmployeeApiTest,\n {\n mom: \"integer\" | undefined;\n }\n >;\n\n fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n }) satisfies ObjectSetType;\n });\n\n it(\"has correct aggregation keys\", () => {\n fauxObjectSet.withProperties({\n \"integer\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"integerNumericAgg\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:sum\"),\n \"string\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n \"stringDoesNotHaveNumericAgg\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"class:sum\"),\n \"isActive\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"isActive:approximateDistinct\"),\n \"attachment\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"attachment:collectList\"),\n \"geopoint\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"geopoint:collectList\"),\n \"numericTimeseries\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"timeseries:sum\"),\n \"numericTimeseriesExactDistinct\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"timeseries:exactDistinct\"),\n \"mediaReference\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"mediaReference:avg\"),\n \"mediaReferenceExactDistinct\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"mediaReference:exactDistinct\"),\n \"geotimeSeriesReference\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"geotimeSeriesReference:sum\"),\n \"geotimeSeriesReferenceExactDistinct\": (base) =>\n base.pivotTo(\"lead\").aggregate(\n \"geotimeSeriesReference:exactDistinct\",\n ),\n \"lastUpdated\": (base) => {\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:approximateDistinct\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:exactDistinct\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:max\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:min\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:collectList\");\n return base.pivotTo(\"lead\").aggregate(\"lastUpdated:collectSet\");\n },\n \"dateOfJoining\": (base) => {\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:approximateDistinct\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:exactDistinct\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:min\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:collectList\");\n return base.pivotTo(\"lead\").aggregate(\"dateOfJoining:collectSet\");\n },\n });\n });\n\n it(\"has correct aggregation return types\", async () => {\n const aggTestObjectSet = fauxObjectSet.withProperties({\n \"maxHasSameType\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\"),\n \"minHasSameType\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:min\"),\n \"approximateDistinctNumberNoUndefined\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximateDistinct\"),\n \"exactDistinctNumberNoUndefined\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:exactDistinct\"),\n \"countNumberNoUndefined\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"sumNumber\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:sum\"),\n \"avgNumber\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:avg\"),\n }).fetchPage();\n\n const result = (await aggTestObjectSet).data[0];\n expectTypeOf((await aggTestObjectSet).data[0]).toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n maxHasSameType: \"datetime\" | undefined;\n minHasSameType: \"datetime\" | undefined;\n avgNumber: \"double\" | undefined;\n approximateDistinctNumberNoUndefined: \"integer\";\n exactDistinctNumberNoUndefined: \"integer\";\n countNumberNoUndefined: \"integer\";\n sumNumber: \"double\" | undefined;\n }>\n >();\n\n expectTypeOf(result.maxHasSameType).toEqualTypeOf<string | undefined>();\n expectTypeOf(result.minHasSameType).toEqualTypeOf<string | undefined>();\n expectTypeOf(result.approximateDistinctNumberNoUndefined).toEqualTypeOf<\n number\n >();\n expectTypeOf(result.exactDistinctNumberNoUndefined).toEqualTypeOf<\n number\n >();\n expectTypeOf(result.countNumberNoUndefined).toEqualTypeOf<number>();\n expectTypeOf(result.sumNumber).toEqualTypeOf<number | undefined>();\n expectTypeOf(result.avgNumber).toEqualTypeOf<number | undefined>();\n });\n });\n describe(\"aggregate\", () => {\n it(\"has correct aggregation keys\", () => {\n void fauxObjectSet.aggregate({\n \"$select\": {\n \"lastUpdated:max\": \"asc\",\n \"lastUpdated:min\": \"desc\",\n \"lastUpdated:approximateDistinct\": \"asc\",\n \"lastUpdated:exactDistinct\": \"desc\",\n \"dateOfJoining:max\": \"desc\",\n \"dateOfJoining:min\": \"asc\",\n \"dateOfJoining:approximateDistinct\": \"asc\",\n \"dateOfJoining:exactDistinct\": \"desc\",\n },\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,EAAE,EAAEC,IAAI,EAAEC,EAAE,QAAQ,QAAQ;AAY7D,OAAO,SAASC,mBAAmBA,CAAA,EAET;EACxB,IAAIC,UAA4B,EAC9BC,WAAgB,EAChBC,aAA4B;;EAE9B;EACAF,UAAU,GAAG;IACXG,KAAK,EAAE;MACLC,KAAK,EAAE;QACLC,mBAAmB,EAAE;UACnBC,GAAG,EAAE,CAAC;QACR;MACF;IACF;EACF,CAAqB;EAErBL,WAAW,GAAG;IACZM,IAAI,EAAE,CAACP,UAAU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mBAAmB,EAAE,MAAM;UAC3B,mBAAmB,EAAE,KAAK;UAC1B,mCAAmC,EAAE,KAAK;UAC1C,6BAA6B,EAAE;QACjC;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ObjectSet.test.js","names":["describe","expectTypeOf","it","test","vi","createMockObjectSet","fauxObject","fauxResults","fauxObjectSet","$link","peeps","$objectSetInternals","def","data","where","fn","withProperties","fetchPage","Promise","resolve","fetchOne","asyncIter","aggregate","pivotTo","toEqualTypeOf","fetchPageResult","class","$includeAllBaseObjectProperties","asyncIterResult","$select","x","$includeRid","subselect","withA","base","withFamily","withMom","withParents","todo","withAggregations","whereResults","aggTestObjectSet","result","maxHasSameType","minHasSameType","approximateDistinctNumberNoUndefined","exactDistinctNumberNoUndefined","countNumberNoUndefined","sumNumber","avgNumber"],"sources":["ObjectSet.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { describe, expectTypeOf, it, test, vi } from \"vitest\";\n\nimport type {\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk,\n PageResult,\n PropertyKeys,\n} from \"../index.js\";\nimport type { EmployeeApiTest } from \"../test/EmployeeApiTest.js\";\n\nexport function createMockObjectSet<\n Q extends ObjectOrInterfaceDefinition,\n>(): $ObjectSet<Q, never> {\n let fauxObject: Osdk.Instance<Q>,\n fauxResults: any,\n fauxObjectSet: $ObjectSet<Q>;\n\n // eslint-disable-next-line prefer-const\n fauxObject = {\n $link: {\n peeps: {\n $objectSetInternals: {\n def: {},\n },\n },\n },\n } as Osdk.Instance<Q>;\n\n fauxResults = {\n data: [fauxObject],\n };\n\n fauxObjectSet = {\n where: vi.fn(() => {\n return fauxObjectSet;\n }),\n withProperties: vi.fn(() => {\n return fauxObjectSet;\n }),\n fetchPage: vi.fn(() => Promise.resolve(fauxResults)),\n fetchOne: vi.fn(() => fauxObject),\n asyncIter: vi.fn(() => {\n return {};\n }),\n aggregate: vi.fn(() => {\n return {};\n }),\n pivotTo: vi.fn(() => {\n return fauxObjectSet;\n }),\n } as any as $ObjectSet<Q>;\n\n return fauxObjectSet;\n}\n\ndescribe(\"ObjectSet\", () => {\n const fauxObjectSet = createMockObjectSet<EmployeeApiTest>();\n\n describe(\"normal\", () => {\n test(\"select none\", async () => {\n const result = await fauxObjectSet.fetchPage();\n expectTypeOf<typeof result.data[0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>>\n >();\n\n // Do it again but be explicit about the params to be sure\n // we don't break them\n const result2 = await fauxObjectSet.fetchPage<\n PropertyKeys<EmployeeApiTest>,\n false,\n never,\n NullabilityAdherence.Default,\n false\n >();\n });\n\n test(\"select one\", async () => {\n const result = await fauxObjectSet.fetchPage({ \"$select\": [\"fullName\"] });\n expectTypeOf<typeof result.data[0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, \"fullName\">\n >();\n });\n });\n\n describe(\"includeAllBaseObjectProperties\", () => {\n it(\"has the right types if you pass true\", async () => {\n const fetchPageResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({ $includeAllBaseObjectProperties: true });\n\n expectTypeOf(fetchPageResult).toEqualTypeOf<\n PageResult<\n Osdk.Instance<EmployeeApiTest, \"$allBaseProperties\">\n >\n >();\n\n const asyncIterResult = fauxObjectSet\n .where({ class: \"idk\" })\n .asyncIter({ $includeAllBaseObjectProperties: true });\n\n expectTypeOf(asyncIterResult).toEqualTypeOf<\n AsyncIterableIterator<\n Osdk.Instance<EmployeeApiTest, \"$allBaseProperties\">\n >\n >();\n });\n\n it(\"does not let you pass partial $select and true\", async () => {\n const fetchPageResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({\n // @ts-expect-error\n $includeAllBaseObjectProperties: true,\n $select: [\"attachment\"],\n });\n\n const asyncIterResult = fauxObjectSet\n .where({ class: \"idk\" })\n .asyncIter({\n // @ts-expect-error\n $includeAllBaseObjectProperties: true,\n $select: [\"attachment\"],\n });\n });\n\n it(\"does let you pass full select options and false\", async () => {\n const fetchPageResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({\n $includeAllBaseObjectProperties: true,\n\n // this select list is intended to represent all properties on `EmployeeApiTest`,\n // so if you get an error here later and you added properties to that object,\n // be sure to add them here too.\n $select: [\n \"attachment\",\n \"class\",\n \"employeeId\",\n \"fullName\",\n \"geopoint\",\n \"geotimeSeriesReference\",\n \"isActive\",\n \"mediaReference\",\n \"timeseries\",\n \"dateOfJoining\",\n \"hourlyRate\",\n \"yearsOfExperience\",\n \"rank\",\n \"performanceScore\",\n \"mediaReference\",\n \"lastUpdated\",\n ],\n });\n\n const asyncIterResult = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({\n $includeAllBaseObjectProperties: true,\n\n // this select list is intended to represent all properties on `EmployeeApiTest`,\n // so if you get an error here later and you added properties to that object,\n // be sure to add them here too.\n $select: [\n \"attachment\",\n \"class\",\n \"employeeId\",\n \"fullName\",\n \"geopoint\",\n \"geotimeSeriesReference\",\n \"isActive\",\n \"mediaReference\",\n \"timeseries\",\n \"dateOfJoining\",\n \"hourlyRate\",\n \"yearsOfExperience\",\n \"rank\",\n \"performanceScore\",\n \"mediaReference\",\n \"lastUpdated\",\n ],\n });\n });\n });\n\n test(\"includeRid\", async () => {\n const x = await fauxObjectSet\n .where({ class: \"idk\" })\n .fetchPage({ $includeRid: true });\n\n expectTypeOf(x).toEqualTypeOf<\n PageResult<\n Osdk.Instance<EmployeeApiTest, \"$rid\">\n >\n >();\n });\n\n test(\"pivotTo\", async () => {\n const noArgs = await fauxObjectSet.pivotTo(\"peeps\").fetchPage({});\n const subselect = await fauxObjectSet.pivotTo(\"peeps\").fetchPage({\n $select: [\"employeeId\", \"class\"],\n });\n\n expectTypeOf(subselect).toEqualTypeOf<\n PageResult<\n Osdk.Instance<EmployeeApiTest, never, \"employeeId\" | \"class\">\n >\n >();\n });\n\n describe(\".withProperties\", () => {\n test(\"single property\", async () => {\n const withA = fauxObjectSet.withProperties({\n \"a\": (base) => {\n return base.pivotTo(\"lead\").aggregate(\"class:exactDistinct\");\n },\n });\n\n const isWithAAssignable: $ObjectSet<EmployeeApiTest, {}> = withA;\n\n expectTypeOf(withA).toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n a: \"integer\";\n }>\n >();\n\n const withAResults = await withA.fetchPage();\n\n expectTypeOf<typeof withAResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n a: \"integer\";\n }>\n >();\n\n expectTypeOf<typeof withAResults[\"data\"][0][\"a\"]>()\n .toEqualTypeOf<number>();\n });\n\n it(\"can be sub-selected\", () => {\n const objectWithUndefinedRdp = fauxObjectSet.withProperties({\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\"),\n }).fetchOne(3, {\n $select: [\"derivedPropertyName\"],\n });\n });\n\n test(\"multiple properties\", async () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"dad\": (base) => base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\"),\n \"sister\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n });\n expectTypeOf(withFamily).toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n mom: \"integer\";\n dad: \"datetime\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n mom: \"integer\";\n dad: \"string\" | undefined;\n sister: \"string\"[] | undefined;\n }>\n >();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"mom\"]>()\n .toEqualTypeOf<number>();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"dad\"]>()\n .toEqualTypeOf<string | undefined>();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"sister\"]>()\n .toEqualTypeOf<string[] | undefined>();\n });\n\n describe(\"called in succession\", () => {\n test(\"independently\", () => {\n const withMom = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n });\n\n const withParents = withMom.withProperties({\n \"dad\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:approximateDistinct\"),\n });\n\n expectTypeOf(withParents).toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n mom: \"integer\";\n dad: \"integer\";\n }>\n >();\n });\n\n test.todo(\"with calculated properties\");\n });\n\n describe(\"nullability\", () => {\n it(\"count, exactDistinct, and approximateDistinct aren't nullable\", async () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"dad\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:exactDistinct\"),\n \"sis\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:approximateDistinct\"),\n });\n\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>().toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n mom: \"integer\";\n dad: \"integer\";\n sis: \"integer\";\n }>\n >();\n });\n\n it(\n \"collectToSet, collectToList, selectProperty, and numeric aggregations are nullable\",\n async () => {\n const withAggregations = fauxObjectSet.withProperties({\n \"collectSet\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:collectSet\"),\n \"collectList\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n \"min\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:max\"),\n \"max\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:min\"),\n \"sum\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:sum\"),\n \"avg\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:avg\"),\n \"approximatePercentile\": (base) =>\n base.pivotTo(\"lead\").aggregate(\n \"employeeId:approximatePercentile\",\n ),\n });\n\n const withAggregationResults = await withAggregations.fetchPage();\n\n expectTypeOf<typeof withAggregationResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n collectSet: \"string\"[] | undefined;\n collectList: \"string\"[] | undefined;\n min: \"double\" | undefined;\n max: \"double\" | undefined;\n sum: \"double\" | undefined;\n avg: \"double\" | undefined;\n approximatePercentile: \"double\" | undefined;\n }\n >\n >();\n },\n );\n });\n\n describe(\"fetch functions return correct Osdk.Instance\", () => {\n const withFamily = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"sister\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n });\n\n it(\"works with .where\", async () => {\n const where = withFamily.where({ \"mom\": 1 });\n const whereResults = await where.fetchPage();\n\n // Checks that if you did an `await where.fetchPage()` that you can then\n // pass/assign it to something explicit.\n const _assignPreviouslyInferredPages: PageResult<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n > = whereResults;\n\n // Checks that if you did an `await where.fetchPage()` that you can then\n // pass/assign it to something explicit.\n const _assignPreviouslyInferredInstance: Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n > = whereResults.data[0];\n\n const q = whereResults.data[0].$link.peeps.$objectSetInternals.def;\n\n // same as above but with expectTypeOf\n expectTypeOf<typeof where>().toEqualTypeOf<typeof withFamily>();\n expectTypeOf<typeof whereResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n >();\n\n // Checks that when you directly assign, it infers correctly.\n // Sometimes an explicit assignment can affect how typescript infers\n // types.\n const shouldBeAssignablePage: PageResult<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n > = await where.fetchPage();\n\n const _shouldBeAssignableSingle: Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n > = await withFamily.fetchOne(1);\n await withFamily.fetchOne(1);\n });\n\n it(\"works with .async\", () => {\n const asyncIter = withFamily.asyncIter();\n expectTypeOf<typeof asyncIter>().toEqualTypeOf<\n AsyncIterableIterator<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n >\n >();\n });\n\n it(\"Works with no select\", async () => {\n const withFamilyResults = await withFamily.fetchPage();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }\n >\n >();\n });\n\n it(\"Works with selecting all RDPs\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"mom\", \"sister\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, never, {\n mom: \"integer\";\n sister: \"string\"[] | undefined;\n }>\n >();\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"mom\"]>()\n .toEqualTypeOf<number>();\n });\n\n it(\"Works with selecting some RDPs\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"mom\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, never, {\n mom: \"integer\";\n }>\n >();\n });\n\n it(\"Works with selecting all non-RDP's\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\n \"employeeId\",\n \"fullName\",\n \"class\",\n \"attachment\",\n \"geopoint\",\n \"timeseries\",\n \"mediaReference\",\n \"geotimeSeriesReference\",\n \"isActive\",\n \"yearsOfExperience\",\n \"rank\",\n \"performanceScore\",\n \"hourlyRate\",\n \"dateOfJoining\",\n \"lastUpdated\",\n ],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n PropertyKeys<EmployeeApiTest>,\n {}\n >\n >();\n expectTypeOf<typeof withFamilyResults[\"data\"][0][\"class\"]>()\n .toEqualTypeOf<\n string | undefined\n >();\n });\n\n it(\"Works with selecting some non-RDP's\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, \"class\", {}>\n >();\n });\n\n it(\"Works with selecting a mix\", async () => {\n const withFamilyResults = await withFamily.fetchPage({\n $select: [\"class\", \"mom\"],\n });\n\n expectTypeOf<typeof withFamilyResults[\"data\"][0]>()\n .toEqualTypeOf<\n Osdk.Instance<\n EmployeeApiTest,\n never,\n \"class\",\n { mom: \"integer\" }\n >\n >();\n });\n });\n\n it(\"allows extracting the type\", () => {\n const objectSet = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n });\n\n type ObjectSetType = typeof objectSet;\n\n expectTypeOf<ObjectSetType>().toEqualTypeOf<\n $ObjectSet<EmployeeApiTest, {\n mom: \"integer\";\n }>\n >();\n\n const objectSet2 = fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n }) satisfies ObjectSetType;\n });\n\n it(\"Defining the Type\", () => {\n type ObjectSetType = $ObjectSet<\n EmployeeApiTest,\n {\n mom: \"integer\";\n }\n >;\n\n fauxObjectSet.withProperties({\n \"mom\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n }) satisfies ObjectSetType;\n });\n\n it(\"has correct aggregation keys\", () => {\n fauxObjectSet.withProperties({\n \"integer\": (base) => base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"integerNumericAgg\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:sum\"),\n \"string\": (base) => base.pivotTo(\"lead\").aggregate(\"class:collectList\"),\n \"stringDoesNotHaveNumericAgg\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"class:sum\"),\n \"isActive\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"isActive:approximateDistinct\"),\n \"attachment\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"attachment:collectList\"),\n \"geopoint\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"geopoint:collectList\"),\n \"numericTimeseries\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"timeseries:sum\"),\n \"numericTimeseriesExactDistinct\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"timeseries:exactDistinct\"),\n \"mediaReference\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"mediaReference:avg\"),\n \"mediaReferenceExactDistinct\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"mediaReference:exactDistinct\"),\n \"geotimeSeriesReference\": (base) =>\n // @ts-expect-error\n base.pivotTo(\"lead\").aggregate(\"geotimeSeriesReference:sum\"),\n \"geotimeSeriesReferenceExactDistinct\": (base) =>\n base.pivotTo(\"lead\").aggregate(\n \"geotimeSeriesReference:exactDistinct\",\n ),\n \"lastUpdated\": (base) => {\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:approximateDistinct\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:exactDistinct\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:max\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:min\");\n base.pivotTo(\"lead\").aggregate(\"lastUpdated:collectList\");\n return base.pivotTo(\"lead\").aggregate(\"lastUpdated:collectSet\");\n },\n \"dateOfJoining\": (base) => {\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:approximateDistinct\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:exactDistinct\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:min\");\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:collectList\");\n return base.pivotTo(\"lead\").aggregate(\"dateOfJoining:collectSet\");\n },\n });\n });\n\n it(\"has correct aggregation return types\", async () => {\n const aggTestObjectSet = fauxObjectSet.withProperties({\n \"maxHasSameType\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:max\"),\n \"minHasSameType\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"dateOfJoining:min\"),\n \"approximateDistinctNumberNoUndefined\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximateDistinct\"),\n \"exactDistinctNumberNoUndefined\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:exactDistinct\"),\n \"countNumberNoUndefined\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"$count\"),\n \"sumNumber\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:sum\"),\n \"avgNumber\": (base) => base.pivotTo(\"lead\").aggregate(\"employeeId:avg\"),\n }).fetchPage();\n\n const result = (await aggTestObjectSet).data[0];\n expectTypeOf((await aggTestObjectSet).data[0]).toEqualTypeOf<\n Osdk.Instance<EmployeeApiTest, never, PropertyKeys<EmployeeApiTest>, {\n maxHasSameType: \"datetime\" | undefined;\n minHasSameType: \"datetime\" | undefined;\n avgNumber: \"double\" | undefined;\n approximateDistinctNumberNoUndefined: \"integer\";\n exactDistinctNumberNoUndefined: \"integer\";\n countNumberNoUndefined: \"integer\";\n sumNumber: \"double\" | undefined;\n }>\n >();\n\n expectTypeOf(result.maxHasSameType).toEqualTypeOf<string | undefined>();\n expectTypeOf(result.minHasSameType).toEqualTypeOf<string | undefined>();\n expectTypeOf(result.approximateDistinctNumberNoUndefined).toEqualTypeOf<\n number\n >();\n expectTypeOf(result.exactDistinctNumberNoUndefined).toEqualTypeOf<\n number\n >();\n expectTypeOf(result.countNumberNoUndefined).toEqualTypeOf<number>();\n expectTypeOf(result.sumNumber).toEqualTypeOf<number | undefined>();\n expectTypeOf(result.avgNumber).toEqualTypeOf<number | undefined>();\n });\n });\n describe(\"aggregate\", () => {\n it(\"has correct aggregation keys\", () => {\n void fauxObjectSet.aggregate({\n \"$select\": {\n \"lastUpdated:max\": \"asc\",\n \"lastUpdated:min\": \"desc\",\n \"lastUpdated:approximateDistinct\": \"asc\",\n \"lastUpdated:exactDistinct\": \"desc\",\n \"dateOfJoining:max\": \"desc\",\n \"dateOfJoining:min\": \"asc\",\n \"dateOfJoining:approximateDistinct\": \"asc\",\n \"dateOfJoining:exactDistinct\": \"desc\",\n },\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,YAAY,EAAEC,EAAE,EAAEC,IAAI,EAAEC,EAAE,QAA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;IACpE,CAAC,CAAC;EACJ,CAAC,CAAC;EACFxB,QAAQ,CAAC,WAAW,EAAE,MAAM;IAC1BE,EAAE,CAAC,8BAA8B,EAAE,MAAM;MACvC,KAAKM,aAAa,CAACc,SAAS,CAAC;QAC3B,SAAS,EAAE;UACT,iBAAiB,EAAE,KAAK;UACxB,iBAAiB,EAAE,MAAM;UACzB,iCAAiC,EAAE,KAAK;UACxC,2BAA2B,EAAE,MAAM;UACnC,mBAAmB,EAAE,MAAM;UAC3B,mBAAmB,EAAE,KAAK;UAC1B,mCAAmC,EAAE,KAAK;UAC1C,6BAA6B,EAAE;QACjC;MACF,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ObjectOrInterface.js","names":["DerivedObjectOrInterfaceDefinition","PropertyKeys"],"sources":["ObjectOrInterface.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 { IncludeValuesExtending } from \"../util/IncludeValuesExtending.js\";\nimport type { InterfaceDefinition } from \"./InterfaceDefinition.js\";\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n} from \"./ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"./SimplePropertyDef.js\";\nimport type { WirePropertyTypes } from \"./WirePropertyTypes.js\";\n\nexport type ObjectOrInterfaceDefinition =\n | ObjectTypeDefinition\n | InterfaceDefinition;\n\nexport namespace DerivedObjectOrInterfaceDefinition {\n export type WithDerivedProperties<\n K extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n > = {\n __DefinitionMetadata: {\n properties: {\n [T in keyof D]: SimplePropertyDef.ToPropertyDef<D[T]>;\n };\n props
|
|
1
|
+
{"version":3,"file":"ObjectOrInterface.js","names":["DerivedObjectOrInterfaceDefinition","PropertyKeys"],"sources":["ObjectOrInterface.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 { IncludeValuesExtending } from \"../util/IncludeValuesExtending.js\";\nimport type { InterfaceDefinition } from \"./InterfaceDefinition.js\";\nimport type {\n CompileTimeMetadata,\n ObjectTypeDefinition,\n} from \"./ObjectTypeDefinition.js\";\nimport type { SimplePropertyDef } from \"./SimplePropertyDef.js\";\nimport type { WirePropertyTypes } from \"./WirePropertyTypes.js\";\n\nexport type ObjectOrInterfaceDefinition =\n | ObjectTypeDefinition\n | InterfaceDefinition;\n\nexport namespace DerivedObjectOrInterfaceDefinition {\n export type WithDerivedProperties<\n K extends ObjectOrInterfaceDefinition,\n D extends Record<string, SimplePropertyDef>,\n > = {\n __DefinitionMetadata: {\n properties: {\n [T in keyof D]: SimplePropertyDef.ToPropertyDef<D[T]>;\n };\n props?: {\n [T in keyof D]: SimplePropertyDef.ToRuntimeProperty<D[T]>;\n };\n } | undefined;\n } & K;\n}\n\nexport type PropertyKeys<\n O extends ObjectOrInterfaceDefinition,\n> =\n & (keyof CompileTimeMetadata<O>[\"properties\"])\n & string;\n\nexport namespace PropertyKeys {\n export type Filtered<\n Q extends ObjectOrInterfaceDefinition,\n T extends WirePropertyTypes,\n > = keyof IncludeValuesExtending<\n CompileTimeMetadata<Q>[\"properties\"],\n { type: T }\n >;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WA6BiBA,kCAAkC;AAAA,WAsBlCC,YAAY","ignoreList":[]}
|
|
@@ -368,10 +368,10 @@ declare namespace DerivedObjectOrInterfaceDefinition {
|
|
|
368
368
|
properties: {
|
|
369
369
|
[T in keyof D]: SimplePropertyDef.ToPropertyDef<D[T]>;
|
|
370
370
|
};
|
|
371
|
-
props
|
|
371
|
+
props?: {
|
|
372
372
|
[T in keyof D]: SimplePropertyDef.ToRuntimeProperty<D[T]>;
|
|
373
373
|
};
|
|
374
|
-
};
|
|
374
|
+
} | undefined;
|
|
375
375
|
} & K;
|
|
376
376
|
}
|
|
377
377
|
type PropertyKeys<O extends ObjectOrInterfaceDefinition> = (keyof CompileTimeMetadata<O>["properties"]) & string;
|
|
@@ -562,18 +562,18 @@ declare namespace ObjectSetArgs {
|
|
|
562
562
|
$pageSize?: number;
|
|
563
563
|
}
|
|
564
564
|
}
|
|
565
|
-
interface SelectArg<Q extends ObjectOrInterfaceDefinition, L extends
|
|
565
|
+
interface SelectArg<Q extends ObjectOrInterfaceDefinition, L extends string = PropertyKeys<Q>, R extends boolean = false, S extends NullabilityAdherence = NullabilityAdherence.Default, RDP_KEYS extends string = never> {
|
|
566
566
|
$select?: readonly L[];
|
|
567
567
|
$includeRid?: R;
|
|
568
568
|
}
|
|
569
|
-
interface OrderByArg<Q extends ObjectOrInterfaceDefinition, L extends
|
|
569
|
+
interface OrderByArg<Q extends ObjectOrInterfaceDefinition, L extends string = PropertyKeys<Q>> extends ObjectSetArgs.OrderBy<L> {
|
|
570
570
|
}
|
|
571
571
|
type SelectArgToKeys<Q extends ObjectOrInterfaceDefinition, A extends SelectArg<Q, any, any>> = A extends SelectArg<Q, never> ? PropertyKeys<Q> : A["$select"] extends readonly string[] ? A["$select"][number] : PropertyKeys<Q>;
|
|
572
|
-
interface FetchPageArgs<Q extends ObjectOrInterfaceDefinition, K extends
|
|
572
|
+
interface FetchPageArgs<Q extends ObjectOrInterfaceDefinition, K extends string = PropertyKeys<Q>, R extends boolean = false, A extends Augments = never, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false, RDP_KEYS extends string = never> extends AsyncIterArgs<Q, K, R, A, S, T, RDP_KEYS> {
|
|
573
573
|
$nextPageToken?: string;
|
|
574
574
|
$pageSize?: number;
|
|
575
575
|
}
|
|
576
|
-
interface AsyncIterArgs<Q extends ObjectOrInterfaceDefinition, K extends
|
|
576
|
+
interface AsyncIterArgs<Q extends ObjectOrInterfaceDefinition, K extends string = PropertyKeys<Q>, R extends boolean = false, A extends Augments = never, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false, RDP_KEYS extends string = never> extends SelectArg<Q, K, R, S, RDP_KEYS>, OrderByArg<Q, PropertyKeys<Q> | RDP_KEYS> {
|
|
577
577
|
$__UNSTABLE_useOldInterfaceApis?: boolean;
|
|
578
578
|
$includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;
|
|
579
579
|
}
|
|
@@ -607,7 +607,7 @@ type DefaultToFalse<B extends boolean | undefined> = false extends B ? false : u
|
|
|
607
607
|
interface SingleLinkAccessor<T extends ObjectTypeDefinition> {
|
|
608
608
|
/** Load the linked object
|
|
609
609
|
*/
|
|
610
|
-
fetchOne: <const A extends SelectArg<T, PropertyKeys<T>, boolean>>(options?: A) => Promise<A extends FetchPageArgs<T, infer L, infer R, any, infer S> ? Osdk.Instance<T, ExtractOptions<R, S>, L
|
|
610
|
+
fetchOne: <const A extends SelectArg<T, PropertyKeys<T>, boolean>>(options?: A) => Promise<A extends FetchPageArgs<T, infer L, infer R, any, infer S> ? Osdk.Instance<T, ExtractOptions<R, S>, L & PropertyKeys<T>> : Osdk.Instance<T>>;
|
|
611
611
|
/** Load the linked object, with a result wrapper
|
|
612
612
|
*/
|
|
613
613
|
fetchOneWithErrors: <const A extends SelectArg<T, PropertyKeys<T>, boolean>>(options?: A) => Promise<Result<A extends FetchPageArgs<T, infer L, infer R, any, infer S> ? Osdk.Instance<T, ExtractOptions<R, S>, L> : Osdk.Instance<T>>>;
|
|
@@ -1024,7 +1024,6 @@ type ObjectUpdate<O extends ObjectOrInterfaceDefinition, P extends PropertyKeys<
|
|
|
1024
1024
|
|
|
1025
1025
|
type MergeObjectSet<Q extends ObjectOrInterfaceDefinition, D extends Record<string, SimplePropertyDef> = {}> = DerivedObjectOrInterfaceDefinition.WithDerivedProperties<Q, D>;
|
|
1026
1026
|
type ExtractRdp<D extends BaseObjectSet<any> | Record<string, SimplePropertyDef>> = [D] extends [never] ? {} : D extends BaseObjectSet<any> ? {} : D extends Record<string, SimplePropertyDef> ? D : {};
|
|
1027
|
-
type MaybeSimplifyPropertyKeys<Q extends ObjectOrInterfaceDefinition, L extends PropertyKeys<Q>> = PropertyKeys<Q> extends L ? PropertyKeys<Q> : L;
|
|
1028
1027
|
type SubSelectKeysHelper<Q extends ObjectOrInterfaceDefinition, L extends string> = [L] extends [never] ? PropertyKeys<Q> : PropertyKeys<Q> extends L ? PropertyKeys<Q> : L & PropertyKeys<Q>;
|
|
1029
1028
|
type SubSelectKeys<Q extends ObjectOrInterfaceDefinition, X extends SelectArg<Q, PropertyKeys<Q>, any, any> = never> = SubSelectKeysHelper<Q, Extract$Select<X>>;
|
|
1030
1029
|
type NOOP<T> = T extends (...args: any[]) => any ? T : T extends abstract new (...args: any[]) => any ? T : {
|
|
@@ -1042,7 +1041,7 @@ interface FetchPage<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<s
|
|
|
1042
1041
|
readonly fetchPage: FetchPageSignature<Q, RDPs>;
|
|
1043
1042
|
readonly fetchPageWithErrors: FetchPageWithErrorsSignature<Q, RDPs>;
|
|
1044
1043
|
}
|
|
1045
|
-
type ValidFetchPageArgs<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef>> = ObjectSetArgs.FetchPage<Q, PropertyKeys<Q>,
|
|
1044
|
+
type ValidFetchPageArgs<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef>> = ObjectSetArgs.FetchPage<Q, PropertyKeys<Q>, boolean, string & keyof RDPs>;
|
|
1046
1045
|
type ValidAsyncIterArgs<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef>> = ObjectSetArgs.AsyncIter<Q, PropertyKeys<Q>, false, string & keyof RDPs> | AsyncIterArgs<Q, never, any, any, any, true, string & keyof RDPs>;
|
|
1047
1046
|
interface FetchPageSignature<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
|
|
1048
1047
|
/**
|
|
@@ -1057,20 +1056,7 @@ interface FetchPageSignature<Q extends ObjectOrInterfaceDefinition, RDPs extends
|
|
|
1057
1056
|
|
|
1058
1057
|
* @returns a page of objects
|
|
1059
1058
|
*/
|
|
1060
|
-
<
|
|
1061
|
-
/**
|
|
1062
|
-
* Gets a page of objects of this type, with a result wrapper
|
|
1063
|
-
* @param args - Args to specify next page token and page size, if applicable
|
|
1064
|
-
* @example
|
|
1065
|
-
* const myObjs = await objectSet.fetchPage({
|
|
1066
|
-
$pageSize: 10,
|
|
1067
|
-
$nextPageToken: "nextPage"
|
|
1068
|
-
});
|
|
1069
|
-
const myObjsResult = myObjs.data;
|
|
1070
|
-
|
|
1071
|
-
* @returns a page of objects
|
|
1072
|
-
*/
|
|
1073
|
-
<L extends PropertyKeys<Q>, R extends boolean, const A extends Augments, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false>(args?: FetchPageArgs<Q, L, R, A, S, T>): Promise<PageResult<Osdk.Instance<Q, ExtractOptions<R, S, T>, MaybeSimplifyPropertyKeys<Q, L>>>>;
|
|
1059
|
+
<L extends PropertyKeys<Q> | (string & keyof RDPs), R extends boolean, const A extends Augments, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false>(args?: FetchPageArgs<Q, L, R, A, S, T>): Promise<PageResult<Osdk.Instance<Q, ExtractOptions<R, S, T>, NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>, SubSelectRDPs<RDPs, NonNullable<typeof args>>>>>;
|
|
1074
1060
|
}
|
|
1075
1061
|
interface FetchPageWithErrorsSignature<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
|
|
1076
1062
|
/**
|
|
@@ -1087,22 +1073,7 @@ interface FetchPageWithErrorsSignature<Q extends ObjectOrInterfaceDefinition, RD
|
|
|
1087
1073
|
}
|
|
1088
1074
|
* @returns a page of objects, wrapped in a result wrapper
|
|
1089
1075
|
*/
|
|
1090
|
-
<
|
|
1091
|
-
/**
|
|
1092
|
-
* Gets a page of objects of this type, with a result wrapper
|
|
1093
|
-
* @param args - Args to specify next page token and page size, if applicable
|
|
1094
|
-
* @example
|
|
1095
|
-
* const myObjs = await objectSet.fetchPage({
|
|
1096
|
-
$pageSize: 10,
|
|
1097
|
-
$nextPageToken: "nextPage"
|
|
1098
|
-
});
|
|
1099
|
-
|
|
1100
|
-
if(isOk(myObjs)){
|
|
1101
|
-
const myObjsResult = myObjs.value.data;
|
|
1102
|
-
}
|
|
1103
|
-
* @returns a page of objects, wrapped in a result wrapper
|
|
1104
|
-
*/
|
|
1105
|
-
<L extends PropertyKeys<Q>, R extends boolean, const A extends Augments, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false>(args?: FetchPageArgs<Q, L, R, A, S, T>): Promise<Result<PageResult<Osdk.Instance<Q, ExtractOptions<R, S, T>, MaybeSimplifyPropertyKeys<Q, L>>>>>;
|
|
1076
|
+
<L extends PropertyKeys<Q> | (string & keyof RDPs), R extends boolean, const A extends Augments, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false>(args?: FetchPageArgs<Q, L, R, A, S, T>): Promise<Result<PageResult<Osdk.Instance<Q, ExtractOptions<R, S, T>, NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>, SubSelectRDPs<RDPs, NonNullable<typeof args>>>>>>;
|
|
1106
1077
|
}
|
|
1107
1078
|
interface Where<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
|
|
1108
1079
|
/**
|
|
@@ -1135,7 +1106,7 @@ interface AsyncIterSignature<Q extends ObjectOrInterfaceDefinition, RDPs extends
|
|
|
1135
1106
|
* }
|
|
1136
1107
|
* @returns an async iterator to load all objects
|
|
1137
1108
|
*/
|
|
1138
|
-
<L extends PropertyKeys<Q
|
|
1109
|
+
<L extends PropertyKeys<Q> | (string & keyof RDPs), R extends boolean, const A extends Augments, S extends NullabilityAdherence = NullabilityAdherence.Default, T extends boolean = false>(args?: AsyncIterArgs<Q, L, R, A, S, T>): AsyncIterableIterator<Osdk.Instance<Q, ExtractOptions<R, S, T>, NoInfer<SubSelectKeys<Q, NonNullable<typeof args>>>, SubSelectRDPs<RDPs, NonNullable<typeof args>>>>;
|
|
1139
1110
|
}
|
|
1140
1111
|
interface AsyncIter<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef> = {}> {
|
|
1141
1112
|
asyncIter: AsyncIterSignature<Q, RDPs>;
|
|
@@ -1219,21 +1190,21 @@ interface FetchOneSignature<Q extends ObjectTypeDefinition, RDPs extends Record<
|
|
|
1219
1190
|
/**
|
|
1220
1191
|
* Fetches one object with the specified primary key, without a result wrapper
|
|
1221
1192
|
*/
|
|
1222
|
-
<
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1193
|
+
<const L extends PropertyKeys<Q> | (string & keyof RDPs), const R extends boolean, const S extends false | "throw" = NullabilityAdherence.Default>(primaryKey: PrimaryKeyType<Q>, options?: SelectArg<Q, L, R, S>): Promise<Osdk.Instance<Q, ExtractOptions<R, S>, NoInfer<SubSelectKeys<Q, {
|
|
1194
|
+
$select: Array<L>;
|
|
1195
|
+
}>>, SubSelectRDPs<RDPs, {
|
|
1196
|
+
$select: Array<L>;
|
|
1197
|
+
}>>>;
|
|
1227
1198
|
}
|
|
1228
1199
|
interface FetchOneWithErrorsSignature<Q extends ObjectTypeDefinition, RDPs extends Record<string, SimplePropertyDef>> {
|
|
1229
1200
|
/**
|
|
1230
1201
|
* Fetches one object with the specified primary key, with a result wrapper
|
|
1231
1202
|
*/
|
|
1232
|
-
<
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1203
|
+
<const L extends PropertyKeys<Q> | (string & keyof RDPs), const R extends boolean, const S extends false | "throw" = NullabilityAdherence.Default>(primaryKey: PrimaryKeyType<Q>, options?: SelectArg<Q, L, R, S>): Promise<Result<Osdk.Instance<Q, ExtractOptions<R, S>, NoInfer<SubSelectKeys<Q, {
|
|
1204
|
+
$select: Array<L>;
|
|
1205
|
+
}>>, SubSelectRDPs<RDPs, {
|
|
1206
|
+
$select: Array<L>;
|
|
1207
|
+
}>>>>;
|
|
1237
1208
|
}
|
|
1238
1209
|
interface FetchOne<Q extends ObjectOrInterfaceDefinition, RDPs extends Record<string, SimplePropertyDef>> {
|
|
1239
1210
|
fetchOne: Q extends ObjectTypeDefinition ? FetchOneSignature<Q, RDPs> : never;
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as AttachmentUpload, M as MediaReference, a as Attachment, O as ObjectTypeDefinition, b as ObjectIdentifiers, c as OsdkObjectPrimaryKeyType, d as ObjectSet, I as InterfaceDefinition, C as CompileTimeMetadata, e as OsdkMetadata, R as ReleaseStatus, P as PropertyValueWireToClient, f as PrimaryKeyTypes, g as OsdkBase } from './ObjectSet-
|
|
2
|
-
export { h as AggregateOpts, i as AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy, l as AggregationClause, j as AggregationResultsWithGroups, k as AggregationResultsWithoutGroups, m as AggregationsResults, u as AllGroupByValues, x as AsyncIterArgs, y as Augment, z as Augments, U as BaseObjectSet, a3 as BaseWirePropertyTypes, a6 as ConvertProps, s as DerivedProperty, D as DistanceUnitMapping, t as DurationMapping, F as FetchPageArgs, H as FetchPageResult, G as GeoFilterOptions, n as GeoFilter_Intersects, o as GeoFilter_Within, aa as GeotimeSeriesProperty, v as GroupByClause, w as GroupByRange, Y as InterfaceMetadata, af as LinkNames, ae as LinkedType, K as Media, L as MediaMetadata, N as NullabilityAdherence, a0 as ObjectMetadata, Z as ObjectOrInterfaceDefinition, X as ObjectSetSubscription, $ as ObjectSpecifier, a7 as Osdk, r as OsdkObjectLinksObject, q as OsdkObjectPropertyType, a8 as PageResult, p as PossibleWhereClauseFilters, a5 as PrimaryKeyType, a1 as PropertyDef, _ as PropertyKeys, T as Result, B as SelectArg, E as SelectArgToKeys, S as SingleLinkAccessor, J as SingleOsdkResult, ab as TimeSeriesPoint, ac as TimeSeriesProperty, ad as TimeSeriesQuery, a9 as TimeseriesDurationMapping, V as ValidAggregationKeys, a2 as VersionBound, W as WhereClause, a4 as WirePropertyTypes, Q as isOk } from './ObjectSet-
|
|
1
|
+
import { A as AttachmentUpload, M as MediaReference, a as Attachment, O as ObjectTypeDefinition, b as ObjectIdentifiers, c as OsdkObjectPrimaryKeyType, d as ObjectSet, I as InterfaceDefinition, C as CompileTimeMetadata, e as OsdkMetadata, R as ReleaseStatus, P as PropertyValueWireToClient, f as PrimaryKeyTypes, g as OsdkBase } from './ObjectSet-BLinzmtM.cjs';
|
|
2
|
+
export { h as AggregateOpts, i as AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy, l as AggregationClause, j as AggregationResultsWithGroups, k as AggregationResultsWithoutGroups, m as AggregationsResults, u as AllGroupByValues, x as AsyncIterArgs, y as Augment, z as Augments, U as BaseObjectSet, a3 as BaseWirePropertyTypes, a6 as ConvertProps, s as DerivedProperty, D as DistanceUnitMapping, t as DurationMapping, F as FetchPageArgs, H as FetchPageResult, G as GeoFilterOptions, n as GeoFilter_Intersects, o as GeoFilter_Within, aa as GeotimeSeriesProperty, v as GroupByClause, w as GroupByRange, Y as InterfaceMetadata, af as LinkNames, ae as LinkedType, K as Media, L as MediaMetadata, N as NullabilityAdherence, a0 as ObjectMetadata, Z as ObjectOrInterfaceDefinition, X as ObjectSetSubscription, $ as ObjectSpecifier, a7 as Osdk, r as OsdkObjectLinksObject, q as OsdkObjectPropertyType, a8 as PageResult, p as PossibleWhereClauseFilters, a5 as PrimaryKeyType, a1 as PropertyDef, _ as PropertyKeys, T as Result, B as SelectArg, E as SelectArgToKeys, S as SingleLinkAccessor, J as SingleOsdkResult, ab as TimeSeriesPoint, ac as TimeSeriesProperty, ad as TimeSeriesQuery, a9 as TimeseriesDurationMapping, V as ValidAggregationKeys, a2 as VersionBound, W as WhereClause, a4 as WirePropertyTypes, Q as isOk } from './ObjectSet-BLinzmtM.cjs';
|
|
3
3
|
import 'type-fest';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Z as ObjectOrInterfaceDefinition, _ as PropertyKeys, M as MediaReference, O as ObjectTypeDefinition, N as NullabilityAdherence, B as SelectArg, a7 as Osdk, ag as ExtractOptions, F as FetchPageArgs, H as FetchPageResult, g as OsdkBase } from '../ObjectSet-
|
|
2
|
-
export { ah as MinimalObjectSet } from '../ObjectSet-
|
|
1
|
+
import { Z as ObjectOrInterfaceDefinition, _ as PropertyKeys, M as MediaReference, O as ObjectTypeDefinition, N as NullabilityAdherence, B as SelectArg, a7 as Osdk, ag as ExtractOptions, F as FetchPageArgs, H as FetchPageResult, g as OsdkBase } from '../ObjectSet-BLinzmtM.cjs';
|
|
2
|
+
export { ah as MinimalObjectSet } from '../ObjectSet-BLinzmtM.cjs';
|
|
3
3
|
import 'type-fest';
|
|
4
4
|
import 'geojson';
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkDefinitions.js","names":[],"sources":["LinkDefinitions.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 { FetchPageArgs, SelectArg } from \"../object/FetchPageArgs.js\";\nimport type { Result } from \"../object/Result.js\";\nimport type { ObjectSet } from \"../objectSet/ObjectSet.js\";\nimport type { PropertyKeys } from \"../ontology/ObjectOrInterface.js\";\nimport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n ObjectTypeLinkKeysFrom2,\n} from \"../ontology/ObjectTypeDefinition.js\";\nimport type { ExtractOptions, Osdk } from \"../OsdkObjectFrom.js\";\n\n/** The $link container to get from one object type to its linked objects */\nexport type OsdkObjectLinksObject<\n O extends ObjectTypeDefinition,\n> = ObjectTypeLinkKeysFrom2<O> extends never ? never : {\n readonly [L in ObjectTypeLinkKeysFrom2<O>]: OsdkObjectLinksEntry<O, L>;\n};\n\nexport type OsdkObjectLinksEntry<\n Q extends ObjectTypeDefinition,\n L extends ObjectTypeLinkKeysFrom2<Q>,\n> = CompileTimeMetadata<Q>[\"links\"][L] extends\n ObjectMetadata.Link<infer T, infer M> ? (\n M extends false ? SingleLinkAccessor<T> : ObjectSet<T>\n )\n : never;\n\nexport type DefaultToFalse<B extends boolean | undefined> = false extends B\n ? false\n : undefined extends B ? false\n : true;\n\nexport interface SingleLinkAccessor<\n T extends ObjectTypeDefinition,\n> {\n /** Load the linked object\n */\n fetchOne: <\n const A extends SelectArg<\n T,\n PropertyKeys<T>,\n boolean\n >,\n >(\n options?: A,\n ) => Promise<\n A extends FetchPageArgs<T, infer L, infer R, any, infer S>\n ? Osdk.Instance<T, ExtractOptions<R, S>, L
|
|
1
|
+
{"version":3,"file":"LinkDefinitions.js","names":[],"sources":["LinkDefinitions.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 { FetchPageArgs, SelectArg } from \"../object/FetchPageArgs.js\";\nimport type { Result } from \"../object/Result.js\";\nimport type { ObjectSet } from \"../objectSet/ObjectSet.js\";\nimport type { PropertyKeys } from \"../ontology/ObjectOrInterface.js\";\nimport type {\n CompileTimeMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n ObjectTypeLinkKeysFrom2,\n} from \"../ontology/ObjectTypeDefinition.js\";\nimport type { ExtractOptions, Osdk } from \"../OsdkObjectFrom.js\";\n\n/** The $link container to get from one object type to its linked objects */\nexport type OsdkObjectLinksObject<\n O extends ObjectTypeDefinition,\n> = ObjectTypeLinkKeysFrom2<O> extends never ? never : {\n readonly [L in ObjectTypeLinkKeysFrom2<O>]: OsdkObjectLinksEntry<O, L>;\n};\n\nexport type OsdkObjectLinksEntry<\n Q extends ObjectTypeDefinition,\n L extends ObjectTypeLinkKeysFrom2<Q>,\n> = CompileTimeMetadata<Q>[\"links\"][L] extends\n ObjectMetadata.Link<infer T, infer M> ? (\n M extends false ? SingleLinkAccessor<T> : ObjectSet<T>\n )\n : never;\n\nexport type DefaultToFalse<B extends boolean | undefined> = false extends B\n ? false\n : undefined extends B ? false\n : true;\n\nexport interface SingleLinkAccessor<\n T extends ObjectTypeDefinition,\n> {\n /** Load the linked object\n */\n fetchOne: <\n const A extends SelectArg<\n T,\n PropertyKeys<T>,\n boolean\n >,\n >(\n options?: A,\n ) => Promise<\n A extends FetchPageArgs<T, infer L, infer R, any, infer S>\n ? Osdk.Instance<T, ExtractOptions<R, S>, L & PropertyKeys<T>>\n : Osdk.Instance<T>\n >;\n\n /** Load the linked object, with a result wrapper\n */\n fetchOneWithErrors: <\n const A extends SelectArg<\n T,\n PropertyKeys<T>,\n boolean\n >,\n >(\n options?: A,\n ) => Promise<\n Result<\n A extends FetchPageArgs<T, infer L, infer R, any, infer S>\n ? Osdk.Instance<T, ExtractOptions<R, S>, L>\n : Osdk.Instance<T>\n >\n >;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FetchPageArgs.js","names":["NullabilityAdherence","ObjectSetArgs"],"sources":["FetchPageArgs.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\n\nexport type NullabilityAdherence = false | \"throw\" | \"drop\";\nexport namespace NullabilityAdherence {\n export type Default = \"throw\";\n}\n\nexport namespace ObjectSetArgs {\n export interface Select<\n OBJECT_KEYS extends string = never,\n RDP_KEYS extends string = never,\n > {\n $select?: readonly (OBJECT_KEYS | RDP_KEYS)[];\n $includeRid?: boolean;\n }\n\n export interface OrderBy<\n L extends string = never,\n > {\n $orderBy?: {\n [K in L]?: \"asc\" | \"desc\";\n };\n }\n\n export interface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends Select<K, RDP_KEYS>, OrderBy<K> {\n $__UNSTABLE_useOldInterfaceApis?: boolean;\n $includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;\n }\n\n export interface FetchPage<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends AsyncIter<Q, K, T, RDP_KEYS> {\n $nextPageToken?: string;\n $pageSize?: number;\n }\n}\n\nexport interface SelectArg<\n Q extends ObjectOrInterfaceDefinition,\n L extends
|
|
1
|
+
{"version":3,"file":"FetchPageArgs.js","names":["NullabilityAdherence","ObjectSetArgs"],"sources":["FetchPageArgs.ts"],"sourcesContent":["/*\n * Copyright 2024 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 {\n ObjectOrInterfaceDefinition,\n PropertyKeys,\n} from \"../ontology/ObjectOrInterface.js\";\nimport type { CompileTimeMetadata } from \"../ontology/ObjectTypeDefinition.js\";\n\nexport type NullabilityAdherence = false | \"throw\" | \"drop\";\nexport namespace NullabilityAdherence {\n export type Default = \"throw\";\n}\n\nexport namespace ObjectSetArgs {\n export interface Select<\n OBJECT_KEYS extends string = never,\n RDP_KEYS extends string = never,\n > {\n $select?: readonly (OBJECT_KEYS | RDP_KEYS)[];\n $includeRid?: boolean;\n }\n\n export interface OrderBy<\n L extends string = never,\n > {\n $orderBy?: {\n [K in L]?: \"asc\" | \"desc\";\n };\n }\n\n export interface AsyncIter<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends Select<K, RDP_KEYS>, OrderBy<K> {\n $__UNSTABLE_useOldInterfaceApis?: boolean;\n $includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;\n }\n\n export interface FetchPage<\n Q extends ObjectOrInterfaceDefinition,\n K extends PropertyKeys<Q> = never,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n > extends AsyncIter<Q, K, T, RDP_KEYS> {\n $nextPageToken?: string;\n $pageSize?: number;\n }\n}\n\nexport interface SelectArg<\n Q extends ObjectOrInterfaceDefinition,\n L extends string = PropertyKeys<Q>,\n R extends boolean = false,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n RDP_KEYS extends string = never,\n> {\n $select?: readonly L[];\n $includeRid?: R;\n}\n\nexport interface OrderByArg<\n Q extends ObjectOrInterfaceDefinition,\n L extends string = PropertyKeys<Q>,\n> extends ObjectSetArgs.OrderBy<L> {\n}\n\nexport type SelectArgToKeys<\n Q extends ObjectOrInterfaceDefinition,\n A extends SelectArg<Q, any, any>,\n> = A extends SelectArg<Q, never> ? PropertyKeys<Q>\n : A[\"$select\"] extends readonly string[] ? A[\"$select\"][number]\n : PropertyKeys<Q>;\n\nexport interface FetchPageArgs<\n Q extends ObjectOrInterfaceDefinition,\n K extends string = PropertyKeys<Q>,\n R extends boolean = false,\n A extends Augments = never,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n> extends AsyncIterArgs<Q, K, R, A, S, T, RDP_KEYS> {\n $nextPageToken?: string;\n $pageSize?: number;\n}\n\nexport interface AsyncIterArgs<\n Q extends ObjectOrInterfaceDefinition,\n K extends string = PropertyKeys<Q>,\n R extends boolean = false,\n A extends Augments = never,\n S extends NullabilityAdherence = NullabilityAdherence.Default,\n T extends boolean = false,\n RDP_KEYS extends string = never,\n> extends\n SelectArg<Q, K, R, S, RDP_KEYS>,\n OrderByArg<Q, PropertyKeys<Q> | RDP_KEYS>\n{\n $__UNSTABLE_useOldInterfaceApis?: boolean;\n $includeAllBaseObjectProperties?: PropertyKeys<Q> extends K ? T : never;\n}\n\nexport type Augment<\n X extends ObjectOrInterfaceDefinition,\n T extends string,\n> = { [K in CompileTimeMetadata<X>[\"apiName\"]]: T[] };\n\nexport type Augments = Record<string, string[]>;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAdA,WAuBiBA,oBAAoB;AAAA,WAIpBC,aAAa","ignoreList":[]}
|