@osdk/client 0.11.0 → 0.13.0
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/build/js/{chunk-LK4VDWCG.cjs → chunk-CKYBATFN.cjs} +253 -108
- package/build/js/chunk-CKYBATFN.cjs.map +1 -0
- package/build/js/{chunk-GOBQUVQZ.mjs → chunk-SNGUDELK.mjs} +250 -109
- package/build/js/chunk-SNGUDELK.mjs.map +1 -0
- package/build/js/index.cjs +82 -33
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +78 -30
- package/build/js/index.mjs.map +1 -1
- package/build/js/public/objects.cjs +3 -3
- package/build/js/public/objects.mjs +1 -1
- package/build/types/Client.d.ts +4 -4
- package/build/types/Definitions.d.ts +4 -5
- package/build/types/ObjectSetCreator.d.ts +2 -2
- package/build/types/OsdkObjectFrom.d.ts +17 -4
- package/build/types/actions/Actions.d.ts +5 -8
- package/build/types/createClient.d.ts +1 -1
- package/build/types/createMinimalClient.d.ts +1 -1
- package/build/types/definitions/LinkDefinitions.d.ts +2 -2
- package/build/types/generatedNoCheck/Ontology.d.ts +10 -7
- package/build/types/generatedNoCheck/ontology/actions/actionTakesAttachment.d.ts +2 -2
- package/build/types/generatedNoCheck/ontology/actions/actionTakesObjectSet.d.ts +2 -2
- package/build/types/generatedNoCheck/ontology/actions/createOffice.d.ts +12 -12
- package/build/types/generatedNoCheck/ontology/actions/createOfficeAndEmployee.d.ts +17 -17
- package/build/types/generatedNoCheck/ontology/actions/moveOffice.d.ts +12 -12
- package/build/types/generatedNoCheck/ontology/actions/promoteEmployee.d.ts +6 -6
- package/build/types/generatedNoCheck/ontology/actions/promoteEmployeeObject.d.ts +6 -6
- package/build/types/generatedNoCheck/ontology/interfaces/FooInterface.d.ts +8 -0
- package/build/types/generatedNoCheck/ontology/interfaces.d.ts +1 -1
- package/build/types/generatedNoCheck/ontology/objects/Employee.d.ts +11 -4
- package/build/types/generatedNoCheck/ontology/objects/ObjectWithTimestampPrimaryKey.d.ts +4 -1
- package/build/types/generatedNoCheck/ontology/objects/Office.d.ts +7 -4
- package/build/types/generatedNoCheck/ontology/objects/equipment.d.ts +4 -1
- package/build/types/generatedNoCheck/ontology/objects/objectTypeWithAllPropertyTypes.d.ts +24 -21
- package/build/types/index.d.ts +1 -1
- package/build/types/mapping/DataValueMapping.d.ts +39 -0
- package/build/types/mapping/PropertyValueMapping.d.ts +47 -0
- package/build/types/object/Cache.d.ts +9 -2
- package/build/types/object/Cache.test.d.ts +10 -0
- package/build/types/object/aggregate.d.ts +4 -2
- package/build/types/object/convertWireToOsdkObjects.d.ts +17 -2
- package/build/types/object/fetchPage.d.ts +12 -3
- package/build/types/objectSet/ObjectSet.d.ts +13 -11
- package/build/types/objectSet/createObjectSet.d.ts +4 -2
- package/build/types/ontology/OntologyProvider.d.ts +12 -4
- package/build/types/ontology/{providers/StandardOntologyProvider.d.ts → StandardOntologyProvider.d.ts} +2 -1
- package/build/types/ontology/StandardOntologyProvider.test.d.ts +1 -0
- package/build/types/ontology/loadInterfaceDefinition.d.ts +3 -0
- package/build/types/query/WhereClause.d.ts +4 -3
- package/build/types/query/aggregations/AggregationsClause.d.ts +2 -2
- package/build/types/query/aggregations/AggregationsResults.d.ts +1 -1
- package/changelog/0.13.0/pr-101.v2.yml +5 -0
- package/changelog/0.13.0/pr-102.v2.yml +5 -0
- package/changelog/0.13.0/pr-104.v2.yml +5 -0
- package/changelog/0.13.0/pr-106.v2.yml +5 -0
- package/changelog/0.13.0/pr-107.v2.yml +5 -0
- package/changelog/0.13.0/pr-110.v2.yml +5 -0
- package/changelog/0.13.0/pr-111.v2.yml +5 -0
- package/changelog/0.13.0/pr-112.v2.yml +5 -0
- package/changelog/0.13.0/pr-116.v2.yml +5 -0
- package/changelog/0.13.0/pr-117.v2.yml +5 -0
- package/changelog/0.13.0/pr-120.v2.yml +5 -0
- package/changelog/0.13.0/pr-125.v2.yml +5 -0
- package/package.json +10 -7
- package/build/js/chunk-GOBQUVQZ.mjs.map +0 -1
- package/build/js/chunk-LK4VDWCG.cjs.map +0 -1
- /package/build/types/{ontology/providers/StandardOntologyProvider.test.d.ts → OsdkObjectFrom.test.d.ts} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { Attachment } from "../object/Attachment.js";
|
|
2
|
+
/**
|
|
3
|
+
* Map from the PropertyDefinition type to the typescript type that we return
|
|
4
|
+
*/
|
|
5
|
+
export interface PropertyValueWireToClient {
|
|
6
|
+
attachment: Attachment;
|
|
7
|
+
boolean: boolean;
|
|
8
|
+
byte: number;
|
|
9
|
+
datetime: string;
|
|
10
|
+
decimal: string;
|
|
11
|
+
double: number;
|
|
12
|
+
float: number;
|
|
13
|
+
geopoint: GeoJSON.Point;
|
|
14
|
+
geoshape: GeoJSON.GeoJSON;
|
|
15
|
+
integer: number;
|
|
16
|
+
long: string;
|
|
17
|
+
marking: string;
|
|
18
|
+
short: number;
|
|
19
|
+
string: string;
|
|
20
|
+
timestamp: string;
|
|
21
|
+
numericTimeseries: unknown;
|
|
22
|
+
stringTimeseries: unknown;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Map from the PropertyDefinition type to the typescript type that we accept
|
|
26
|
+
*/
|
|
27
|
+
export interface PropertyValueClientToWire {
|
|
28
|
+
attachment: Attachment | {
|
|
29
|
+
rid: string;
|
|
30
|
+
};
|
|
31
|
+
boolean: boolean;
|
|
32
|
+
byte: number;
|
|
33
|
+
datetime: string;
|
|
34
|
+
decimal: string | number;
|
|
35
|
+
double: number;
|
|
36
|
+
float: number;
|
|
37
|
+
geopoint: GeoJSON.Point;
|
|
38
|
+
geoshape: GeoJSON.GeoJSON;
|
|
39
|
+
integer: number;
|
|
40
|
+
long: string | number;
|
|
41
|
+
marking: string;
|
|
42
|
+
short: number;
|
|
43
|
+
string: string;
|
|
44
|
+
timestamp: string;
|
|
45
|
+
numericTimeseries: unknown;
|
|
46
|
+
stringTimeseries: unknown;
|
|
47
|
+
}
|
|
@@ -5,13 +5,20 @@ import type { MinimalClient } from "../MinimalClientContext.js";
|
|
|
5
5
|
interface Cache<K, V> {
|
|
6
6
|
get: (client: MinimalClient, key: K) => V;
|
|
7
7
|
set: <X extends V>(client: MinimalClient, key: K, value: X) => X;
|
|
8
|
+
remove: (client: MinimalClient, key: K) => boolean;
|
|
8
9
|
}
|
|
9
10
|
/**
|
|
10
11
|
* A simple async cache that can be used to store values for a given client.
|
|
11
12
|
*/
|
|
12
|
-
interface AsyncCache<K, V> {
|
|
13
|
+
export interface AsyncCache<K, V> {
|
|
13
14
|
getOrUndefined: (client: MinimalClient, key: K) => V | undefined;
|
|
14
15
|
get: (client: MinimalClient, key: K) => Promise<V>;
|
|
16
|
+
/**
|
|
17
|
+
* @param client the client to key from
|
|
18
|
+
* @param key the subkey to use
|
|
19
|
+
* @param value the value or a promise to the value
|
|
20
|
+
* @returns a new promise to the resolved value
|
|
21
|
+
*/
|
|
15
22
|
set: (client: MinimalClient, key: K, value: V | Promise<V>) => Promise<V>;
|
|
16
23
|
}
|
|
17
24
|
type Factory<K, V> = (client: MinimalClient, key: K) => V;
|
|
@@ -29,5 +36,5 @@ export declare function createCache<K, V extends {}>(fn: Factory<K, V>): Cache<K
|
|
|
29
36
|
* @param fn A factory function that will be used to create the value if it does not exist in the cache.
|
|
30
37
|
* @returns
|
|
31
38
|
*/
|
|
32
|
-
export declare function createAsyncCache<K, V extends {}>(fn: (client: MinimalClient, key: K) => Promise<V
|
|
39
|
+
export declare function createAsyncCache<K, V extends {}>(fn: (client: MinimalClient, key: K) => Promise<V>, createCacheLocal?: typeof createCache): AsyncCache<K, V>;
|
|
33
40
|
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module "vitest" {
|
|
2
|
+
interface Assertion<T = any> extends CustomMatchers<T> {
|
|
3
|
+
}
|
|
4
|
+
interface AsymmetricMatchersContaining<T = any> extends CustomMatchers<T> {
|
|
5
|
+
}
|
|
6
|
+
interface ExpectStatic<T = any> extends CustomMatchers<T> {
|
|
7
|
+
isPromiseLike: () => any;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export {};
|
|
@@ -2,10 +2,12 @@ import type { ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
|
2
2
|
import type { ObjectSet } from "@osdk/gateway/types";
|
|
3
3
|
import type { MinimalClient } from "../MinimalClientContext.js";
|
|
4
4
|
import type { AggregateOpts } from "../query/aggregations/AggregateOpts.js";
|
|
5
|
-
import type { AggregationsResults } from "../query/index.js";
|
|
5
|
+
import type { AggregationsResults, GroupByClause } from "../query/index.js";
|
|
6
6
|
export type AggregateOptsThatErrors<Q extends ObjectOrInterfaceDefinition, AO extends AggregateOpts<Q>> = AO & {
|
|
7
7
|
select: Pick<AO["select"], keyof AggregateOpts<Q>["select"] & keyof AO["select"]> & Record<Exclude<keyof AO["select"], keyof AggregateOpts<Q>["select"]>, never>;
|
|
8
|
-
}
|
|
8
|
+
} & (unknown extends AO["groupBy"] ? {} : Exclude<AO["groupBy"], undefined> extends never ? {} : {
|
|
9
|
+
groupBy: Pick<AO["groupBy"], keyof GroupByClause<Q> & keyof AO["groupBy"]> & Record<Exclude<keyof AO["groupBy"], keyof GroupByClause<Q>>, never>;
|
|
10
|
+
});
|
|
9
11
|
/** @deprecated use `aggregate` */
|
|
10
12
|
export declare function aggregateOrThrow<Q extends ObjectOrInterfaceDefinition, AO extends AggregateOpts<Q>>(clientCtx: MinimalClient, objectType: Q, objectSet: ObjectSet | undefined, req: AggregateOptsThatErrors<Q, AO>): Promise<AggregationsResults<Q, AO>>;
|
|
11
13
|
export declare function aggregate<Q extends ObjectOrInterfaceDefinition, AO extends AggregateOpts<Q>>(clientCtx: MinimalClient, objectType: Q, objectSet: ObjectSet | undefined, req: AggregateOptsThatErrors<Q, AO>): Promise<AggregationsResults<Q, AO>>;
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
+
import type { ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
1
2
|
import type { OntologyObjectV2 } from "@osdk/gateway/types";
|
|
2
3
|
import type { MinimalClient } from "../MinimalClientContext.js";
|
|
4
|
+
import type { Osdk } from "../OsdkObjectFrom.js";
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* If interfaceApiName is not undefined, converts the instances of the
|
|
7
|
+
* interface into their respective
|
|
8
|
+
* underlying concrete types and then returns the $as() representation
|
|
9
|
+
* for the consumers.
|
|
10
|
+
*
|
|
11
|
+
* Otherwise just does the conversion
|
|
12
|
+
*
|
|
13
|
+
* May mutate in place for performance reasons. If you need a clean copy,
|
|
14
|
+
* keep it first.
|
|
15
|
+
*
|
|
16
|
+
* However, you must use the returned value, which will be whatever is correct.
|
|
17
|
+
*
|
|
18
|
+
* @internal
|
|
19
|
+
* @param interfaceApiName - if undefined
|
|
5
20
|
*/
|
|
6
|
-
export declare function
|
|
21
|
+
export declare function convertWireToOsdkObjects(client: MinimalClient, objects: OntologyObjectV2[], interfaceApiName: string | undefined): Promise<Osdk<ObjectOrInterfaceDefinition>[]>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ObjectOrInterfaceDefinition, ObjectOrInterfacePropertyKeysFrom2 } from "@osdk/api";
|
|
2
|
-
import type { ObjectSet } from "@osdk/gateway/types";
|
|
1
|
+
import type { InterfaceDefinition, ObjectOrInterfaceDefinition, ObjectOrInterfacePropertyKeysFrom2, ObjectTypeDefinition } from "@osdk/api";
|
|
2
|
+
import type { ObjectSet, SearchJsonQueryV2 } from "@osdk/gateway/types";
|
|
3
3
|
import type { DefaultToFalse } from "../definitions/LinkDefinitions.js";
|
|
4
4
|
import type { MinimalClient } from "../MinimalClientContext.js";
|
|
5
5
|
import type { Osdk } from "../OsdkObjectFrom.js";
|
|
@@ -18,5 +18,14 @@ export interface FetchPageArgs<Q extends ObjectOrInterfaceDefinition, K extends
|
|
|
18
18
|
nextPageToken?: string;
|
|
19
19
|
pageSize?: number;
|
|
20
20
|
}
|
|
21
|
-
export
|
|
21
|
+
export interface FetchInterfacePageArgs<Q extends InterfaceDefinition<any, any>, K extends ObjectOrInterfacePropertyKeysFrom2<Q> = ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean = false> extends SelectArg<Q, K, R>, OrderByArg<Q, ObjectOrInterfacePropertyKeysFrom2<Q>> {
|
|
22
|
+
nextPageToken?: string;
|
|
23
|
+
pageSize?: number;
|
|
24
|
+
}
|
|
25
|
+
export type FetchPageResult<Q extends ObjectOrInterfaceDefinition, L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean> = Promise<PageResult<ObjectOrInterfacePropertyKeysFrom2<Q> extends L ? (DefaultToFalse<R> extends false ? Osdk<Q> : Osdk<Q, "$all", true, Q extends InterfaceDefinition<any> ? "$all" : L>) : (DefaultToFalse<R> extends false ? Osdk<Q, L, false, Q extends InterfaceDefinition<any> ? never : L> : Osdk<Q, L, true, Q extends InterfaceDefinition<any> ? never : L>)>>;
|
|
26
|
+
/** @internal */
|
|
27
|
+
export declare function objectSetToSearchJsonV2(objectSet: ObjectSet, expectedApiName: string, existingWhere?: SearchJsonQueryV2 | undefined): SearchJsonQueryV2 | undefined;
|
|
28
|
+
/** @internal */
|
|
29
|
+
export declare function fetchPageInternal<Q extends ObjectOrInterfaceDefinition, L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean>(client: MinimalClient, objectType: Q, objectSet: ObjectSet, args?: FetchPageArgs<Q, L, R>): FetchPageResult<Q, L, R>;
|
|
22
30
|
export declare function fetchPage<Q extends ObjectOrInterfaceDefinition, L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean>(client: MinimalClient, objectType: Q, args: FetchPageArgs<Q, L, R>, objectSet?: ObjectSet): FetchPageResult<Q, L, R>;
|
|
31
|
+
export declare function fetchObjectPage<Q extends ObjectTypeDefinition<any>, L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean>(client: MinimalClient, objectType: Q, args: FetchPageArgs<Q, L, R>, objectSet: ObjectSet): FetchPageResult<Q, L, R>;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import type { ObjectOrInterfaceDefinition, ObjectOrInterfaceDefinitionFrom, ObjectOrInterfaceKeysFrom, ObjectOrInterfacePropertyKeysFrom2, ObjectTypeDefinition, OntologyDefinition
|
|
2
|
-
import type {
|
|
1
|
+
import type { InterfaceDefinition, ObjectOrInterfaceDefinition, ObjectOrInterfaceDefinitionFrom, ObjectOrInterfaceKeysFrom, ObjectOrInterfacePropertyKeysFrom2, ObjectTypeDefinition, OntologyDefinition } from "@osdk/api";
|
|
2
|
+
import type { PropertyValueClientToWire } from "../mapping/PropertyValueMapping.js";
|
|
3
3
|
import type { AggregateOptsThatErrors } from "../object/aggregate.js";
|
|
4
4
|
import type { FetchPageArgs, FetchPageResult, SelectArg } from "../object/fetchPage.js";
|
|
5
|
-
import type { Osdk
|
|
5
|
+
import type { Osdk } from "../OsdkObjectFrom.js";
|
|
6
6
|
import type { AggregateOpts } from "../query/aggregations/AggregateOpts.js";
|
|
7
7
|
import type { AggregationsResults, WhereClause } from "../query/index.js";
|
|
8
8
|
import type { LinkedType, LinkNames } from "./LinkUtils.js";
|
|
9
9
|
import type { ObjectSetListener } from "./ObjectSetListener.js";
|
|
10
|
-
export interface
|
|
11
|
-
definition: WireObjectSet;
|
|
12
|
-
/** @deprecated */
|
|
13
|
-
fetchPageOrThrow: <L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean>(args?: FetchPageArgs<Q, L, R>) => FetchPageResult<Q, L, R>;
|
|
10
|
+
export interface MinimalObjectSet<Q extends ObjectOrInterfaceDefinition> {
|
|
14
11
|
fetchPage: <L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean>(args?: FetchPageArgs<Q, L, R>) => FetchPageResult<Q, L, R>;
|
|
12
|
+
where: (clause: WhereClause<Q>) => MinimalObjectSet<Q>;
|
|
15
13
|
asyncIter: () => AsyncIterableIterator<Osdk<Q, "$all">>;
|
|
14
|
+
}
|
|
15
|
+
export interface InterfaceObjectSet<Q extends InterfaceDefinition<any, any>> extends MinimalObjectSet<Q> {
|
|
16
|
+
}
|
|
17
|
+
export interface ObjectSet<Q extends ObjectOrInterfaceDefinition> extends MinimalObjectSet<Q> {
|
|
18
|
+
/** @deprecated */
|
|
19
|
+
fetchPageOrThrow: <L extends ObjectOrInterfacePropertyKeysFrom2<Q>, R extends boolean>(args?: FetchPageArgs<Q, L, R>) => FetchPageResult<Q, L, R>;
|
|
16
20
|
/** @deprecated use `aggregate` */
|
|
17
21
|
aggregateOrThrow: <AO extends AggregateOpts<Q>>(req: AggregateOptsThatErrors<Q, AO>) => Promise<AggregationsResults<Q, AO>>;
|
|
18
22
|
aggregate: <AO extends AggregateOpts<Q>>(req: AggregateOptsThatErrors<Q, AO>) => Promise<AggregationsResults<Q, AO>>;
|
|
@@ -20,10 +24,8 @@ export interface ObjectSet<Q extends ObjectOrInterfaceDefinition> {
|
|
|
20
24
|
union: (...objectSets: ReadonlyArray<ObjectSet<Q>>) => ObjectSet<Q>;
|
|
21
25
|
intersect: (...objectSets: ReadonlyArray<ObjectSet<Q>>) => ObjectSet<Q>;
|
|
22
26
|
subtract: (...objectSets: ReadonlyArray<ObjectSet<Q>>) => ObjectSet<Q>;
|
|
23
|
-
pivotTo: <L extends LinkNames<Q>>(type: L) =>
|
|
27
|
+
pivotTo: <L extends LinkNames<Q>>(type: L) => ObjectSet<LinkedType<Q, L>>;
|
|
28
|
+
get: Q extends ObjectTypeDefinition<any> ? <L extends ObjectOrInterfacePropertyKeysFrom2<Q>>(primaryKey: PropertyValueClientToWire[Q["primaryKeyType"]], options?: SelectArg<Q, L>) => Promise<Osdk<Q, L>> : never;
|
|
24
29
|
subscribe: (listener: ObjectSetListener<Q>) => () => void;
|
|
25
30
|
}
|
|
26
|
-
export interface BaseObjectSet<Q extends ObjectOrInterfaceDefinition> extends ObjectSet<Q> {
|
|
27
|
-
get: Q extends ObjectTypeDefinition<any> ? <L extends ObjectOrInterfacePropertyKeysFrom2<Q>>(primaryKey: WirePropertyTypes[Q["primaryKeyType"]], options?: SelectArg<Q, L>) => Promise<OsdkObjectOrInterfaceFrom<Q, L>> : never;
|
|
28
|
-
}
|
|
29
31
|
export type ObjectSetFactory<O extends OntologyDefinition<any>> = <K extends ObjectOrInterfaceKeysFrom<O>>(type: K) => ObjectSet<ObjectOrInterfaceDefinitionFrom<O, K>>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
2
2
|
import type { ObjectSet as WireObjectSet } from "@osdk/gateway/types";
|
|
3
3
|
import type { MinimalClient } from "../MinimalClientContext.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { MinimalObjectSet, ObjectSet } from "./ObjectSet.js";
|
|
5
|
+
export declare function isObjectSet(o: any): o is ObjectSet<any>;
|
|
6
|
+
/** @internal */
|
|
7
|
+
export declare function getWireObjectSet(objectSet: ObjectSet<any> | MinimalObjectSet<any>): WireObjectSet;
|
|
5
8
|
export declare function createObjectSet<Q extends ObjectOrInterfaceDefinition>(objectType: Q, clientCtx: MinimalClient, objectSet?: WireObjectSet): ObjectSet<Q>;
|
|
6
|
-
export declare function createBaseObjectSet<Q extends ObjectOrInterfaceDefinition>(objectType: Q, clientCtx: MinimalClient, objectSet?: WireObjectSet): BaseObjectSet<Q>;
|
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import type { ActionDefinition, ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
1
|
+
import type { ActionDefinition, InterfaceDefinition, ObjectOrInterfaceDefinition, ObjectTypeDefinition } from "@osdk/api";
|
|
2
2
|
import type { MinimalClient } from "../MinimalClientContext.js";
|
|
3
3
|
export interface OntologyProvider {
|
|
4
4
|
/**
|
|
5
|
-
* Returns the current known definition for the object
|
|
5
|
+
* Returns the current known definition for the object.
|
|
6
6
|
*
|
|
7
|
-
* May result in
|
|
7
|
+
* May result in multiple network calls. May cache results. May invalidate results
|
|
8
8
|
* @param apiName
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
getObjectDefinition: (apiName: string) => Promise<ObjectTypeDefinition<any>>;
|
|
12
|
+
/**
|
|
13
|
+
* Returns the current known definition for the interface.
|
|
14
|
+
*
|
|
15
|
+
* May result in multiple network calls. May cache results. May invalidate results
|
|
16
|
+
* @param apiName
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
getInterfaceDefinition: (apiName: string) => Promise<InterfaceDefinition<any, any>>;
|
|
12
20
|
/**
|
|
13
21
|
* If the OntologyProvider supports seeding, this method will seed the provider with the given definition.
|
|
14
22
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { OntologyProviderFactory } from "
|
|
1
|
+
import type { OntologyProviderFactory } from "./OntologyProvider.js";
|
|
2
2
|
export interface OntologyCachingOptions {
|
|
3
3
|
alwaysRevalidate?: boolean;
|
|
4
4
|
}
|
|
5
|
+
export declare const USE_FULL_ONTOLOGY = false;
|
|
5
6
|
export declare const createStandardOntologyProviderFactory: (opts: OntologyCachingOptions) => OntologyProviderFactory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { BBox, Point, Polygon } from "geojson";
|
|
2
2
|
import type { ObjectOrInterfaceDefinition, ObjectTypePropertyDefinition } from "@osdk/api";
|
|
3
|
-
export type PossibleWhereClauseFilters = "$gt" | "$eq" | "$ne" | "$isNull" | "$contains" | "$gte" | "$lt" | "$lte" | "$within" | "$intersects";
|
|
3
|
+
export type PossibleWhereClauseFilters = "$gt" | "$eq" | "$ne" | "$isNull" | "$contains" | "$gte" | "$lt" | "$lte" | "$within" | "$intersects" | "$startsWith";
|
|
4
4
|
type MakeFilter<K extends PossibleWhereClauseFilters, V> = K extends string ? {
|
|
5
5
|
[k in K]: V;
|
|
6
6
|
} : never;
|
|
7
7
|
type BaseFilter<T> = T | MakeFilter<"$eq" | "$ne" | "$contains", T> | MakeFilter<"$isNull", boolean>;
|
|
8
|
-
type StringFilter = BaseFilter<string>;
|
|
8
|
+
type StringFilter = BaseFilter<string> | MakeFilter<"$startsWith", string>;
|
|
9
9
|
type NumberFilter = BaseFilter<number> | MakeFilter<"$gt" | "$gte" | "$lt" | "$lte", number>;
|
|
10
10
|
type DatetimeFilter = BaseFilter<string> | MakeFilter<"$gt" | "$gte" | "$lt" | "$lte", string>;
|
|
11
|
+
type BooleanFilter = boolean | MakeFilter<"$eq" | "$ne", boolean> | MakeFilter<"$isNull", boolean>;
|
|
11
12
|
export declare const DistanceUnitMapping: {
|
|
12
13
|
centimeter: "CENTIMETERS";
|
|
13
14
|
centimeters: "CENTIMETERS";
|
|
@@ -48,7 +49,7 @@ export type GeoFilter_Intersects = {
|
|
|
48
49
|
} | Polygon;
|
|
49
50
|
};
|
|
50
51
|
export type GeoFilter = GeoFilter_Within | GeoFilter_Intersects;
|
|
51
|
-
type FilterFor<PD extends ObjectTypePropertyDefinition> = PD["type"] extends "string" ? StringFilter : PD["type"] extends "geopoint" | "geoshape" ? GeoFilter : PD["type"] extends "datetime" | "timestamp" ? DatetimeFilter : NumberFilter;
|
|
52
|
+
type FilterFor<PD extends ObjectTypePropertyDefinition> = PD["type"] extends "string" ? StringFilter : PD["type"] extends "geopoint" | "geoshape" ? GeoFilter : PD["type"] extends "datetime" | "timestamp" ? DatetimeFilter : PD["type"] extends "boolean" ? BooleanFilter : NumberFilter;
|
|
52
53
|
export interface AndWhereClause<T extends ObjectOrInterfaceDefinition<any, any>> {
|
|
53
54
|
$and: WhereClause<T>[];
|
|
54
55
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
2
2
|
import type { AggregatableKeys } from "./AggregatableKeys.js";
|
|
3
|
-
type StringAggregateOption = "approximateDistinct"
|
|
4
|
-
type NumericAggregateOption = "
|
|
3
|
+
type StringAggregateOption = "approximateDistinct";
|
|
4
|
+
type NumericAggregateOption = "min" | "max" | "sum" | "avg" | "approximateDistinct";
|
|
5
5
|
type totalCountOption = {
|
|
6
6
|
$count?: true;
|
|
7
7
|
};
|
|
@@ -3,4 +3,4 @@ import type { AggregatableKeys } from "./AggregatableKeys.js";
|
|
|
3
3
|
import type { AggregateOpts } from "./AggregateOpts.js";
|
|
4
4
|
import type { AggregationResultsWithGroups } from "./AggregationResultsWithGroups.js";
|
|
5
5
|
import type { AggregationCountResult, AggregationResultsWithoutGroups } from "./AggregationResultsWithoutGroups.js";
|
|
6
|
-
export type AggregationsResults<Q extends ObjectOrInterfaceDefinition, AO extends AggregateOpts<Q>> = Exclude<keyof AO["select"], AggregatableKeys<Q> | "$count"> extends never ? unknown extends AO["groupBy"] ? AggregationResultsWithoutGroups<Q, AO["select"]> & AggregationCountResult<Q, AO["select"]> : Exclude<AO["groupBy"], undefined> extends never ? AggregationResultsWithoutGroups<Q, AO["select"]> & AggregationCountResult<Q, AO["select"]> : AggregationResultsWithGroups<Q, AO["select"], AO["groupBy"]> : `Sorry, the following are not valid selectors for an aggregation: ${Exclude<keyof AO["select"] & string, AggregatableKeys<Q> | "$count">}`;
|
|
6
|
+
export type AggregationsResults<Q extends ObjectOrInterfaceDefinition, AO extends AggregateOpts<Q>> = Exclude<keyof AO["select"], AggregatableKeys<Q> | "$count"> extends never ? unknown extends AO["groupBy"] ? AggregationResultsWithoutGroups<Q, AO["select"]> & AggregationCountResult<Q, AO["select"]> : Exclude<AO["groupBy"], undefined> extends never ? AggregationResultsWithoutGroups<Q, AO["select"]> & AggregationCountResult<Q, AO["select"]> : Exclude<keyof AO["groupBy"], AggregatableKeys<Q>> extends never ? AggregationResultsWithGroups<Q, AO["select"], AO["groupBy"]> : `Sorry, the following are not valid groups for an aggregation: ${Exclude<keyof AO["groupBy"] & string, AggregatableKeys<Q>>}` : `Sorry, the following are not valid selectors for an aggregation: ${Exclude<keyof AO["select"] & string, AggregatableKeys<Q> | "$count">}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,17 +27,20 @@
|
|
|
27
27
|
"isomorphic-ws": "^5.0.0",
|
|
28
28
|
"tiny-invariant": "^1.3.1",
|
|
29
29
|
"ws": "^8.14.2",
|
|
30
|
-
"@osdk/api": "1.
|
|
31
|
-
"@osdk/gateway": "
|
|
32
|
-
"@osdk/generator-converters": "0.
|
|
33
|
-
"@osdk/shared.net": "1.
|
|
30
|
+
"@osdk/api": "1.4.0",
|
|
31
|
+
"@osdk/gateway": "2.0.0",
|
|
32
|
+
"@osdk/generator-converters": "0.2.0",
|
|
33
|
+
"@osdk/shared.net": "1.7.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/geojson": "^7946.0.14",
|
|
37
37
|
"@types/ws": "^8.5.10",
|
|
38
|
+
"jest-extended": "^4.0.2",
|
|
39
|
+
"p-defer": "^4.0.0",
|
|
40
|
+
"p-state": "^2.0.0",
|
|
38
41
|
"ts-expect": "^1.3.0",
|
|
39
|
-
"typescript": "^5.
|
|
40
|
-
"@osdk/generator": "1.
|
|
42
|
+
"typescript": "^5.4.2",
|
|
43
|
+
"@osdk/generator": "1.7.0",
|
|
41
44
|
"@osdk/shared.test": "1.2.0"
|
|
42
45
|
},
|
|
43
46
|
"publishConfig": {
|