@osdk/client 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/build/types/Client.d.ts +2 -2
- package/build/types/ObjectSetCreator.d.ts +2 -2
- package/build/types/index.d.ts +1 -1
- package/build/types/internal/conversions/modernToLegacyWhereClause.d.ts +2 -2
- package/build/types/object/fetchPageOrThrow.d.ts +3 -3
- package/build/types/objectSet/ObjectSet.d.ts +8 -8
- package/build/types/objectSet/ObjectSetListenerWebsocket.d.ts +2 -2
- package/build/types/objectSet/createObjectSet.d.ts +2 -2
- package/build/types/query/WhereClause.d.ts +5 -5
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
package/build/types/Client.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceKeysFrom, ObjectTypeKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import type { Actions } from "./actions/Actions.js";
|
|
3
3
|
import type { ObjectSet, ObjectSetOptions } from "./objectSet/ObjectSet.js";
|
|
4
4
|
import type { ObjectSetCreator } from "./ObjectSetCreator.js";
|
|
5
5
|
export type ConcreteObjectType<O extends OntologyDefinition<any>, K extends ObjectTypeKeysFrom<O>> = O["objects"][K];
|
|
6
6
|
export interface Client<O extends OntologyDefinition<any>> {
|
|
7
|
-
objectSet: <const K extends
|
|
7
|
+
objectSet: <const K extends ObjectOrInterfaceKeysFrom<O>>(type: K, opts?: ObjectSetOptions<O, K>) => ObjectSet<O, K>;
|
|
8
8
|
objects: ObjectSetCreator<O>;
|
|
9
9
|
actions: Actions<O>;
|
|
10
10
|
__UNSTABLE_preexistingObjectSet<const K extends ObjectTypeKeysFrom<O>>(type: K, rid: string): ObjectSet<O, K>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import type { Client } from "./Client.js";
|
|
3
3
|
import type { ObjectSet } from "./objectSet/ObjectSet.js";
|
|
4
4
|
/**
|
|
5
5
|
* A type that creates an object set for each object in the ontology.
|
|
6
6
|
*/
|
|
7
7
|
export type ObjectSetCreator<D extends OntologyDefinition<any>> = {
|
|
8
|
-
[T in
|
|
8
|
+
[T in ObjectOrInterfaceKeysFrom<D>]: ObjectSet<D, T>;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Create a proxy for the object set creator.
|
package/build/types/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { ObjectSetListener } from "./objectSet/ObjectSetListener.js";
|
|
|
5
5
|
export type { PageResult } from "./PageResult.js";
|
|
6
6
|
export * as Objects from "./object/index.js";
|
|
7
7
|
export type { OsdkObject } from "./OsdkObject.js";
|
|
8
|
-
export type { OsdkObjectFrom } from "./OsdkObjectFrom.js";
|
|
8
|
+
export type { OsdkInterfaceFrom, OsdkObjectFrom } from "./OsdkObjectFrom.js";
|
|
9
9
|
export { createClientContext } from "@osdk/shared.net";
|
|
10
10
|
export { isOk } from "@osdk/shared.net";
|
|
11
11
|
export type { ResultOrError } from "@osdk/shared.net";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceDefinition } from "@osdk/api";
|
|
2
2
|
import type { WhereClause } from "../../query/index.js";
|
|
3
3
|
import type { Wire } from "../net/index.js";
|
|
4
|
-
export declare function modernToLegacyWhereClause<T extends
|
|
4
|
+
export declare function modernToLegacyWhereClause<T extends ObjectOrInterfaceDefinition<any, any>>(whereClause: WhereClause<T>): Wire.SearchJsonQueryV2;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceKeysFrom, ObjectOrInterfacePropertyKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import type { ClientContext } from "@osdk/shared.net";
|
|
3
3
|
import type { Wire } from "../internal/net/index.js";
|
|
4
4
|
import type { OsdkObjectFrom } from "../OsdkObjectFrom.js";
|
|
5
5
|
import type { PageResult } from "../PageResult.js";
|
|
6
6
|
import type { NOOP } from "../util/NOOP.js";
|
|
7
|
-
export interface FetchPageOrThrowArgs<O extends OntologyDefinition<any>, K extends
|
|
7
|
+
export interface FetchPageOrThrowArgs<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>, L extends ObjectOrInterfacePropertyKeysFrom<O, K>> {
|
|
8
8
|
select?: readonly L[];
|
|
9
9
|
nextPageToken?: string;
|
|
10
10
|
}
|
|
11
|
-
export declare function fetchPageOrThrow<O extends OntologyDefinition<any>, T extends
|
|
11
|
+
export declare function fetchPageOrThrow<O extends OntologyDefinition<any>, T extends ObjectOrInterfaceKeysFrom<O>, const A extends FetchPageOrThrowArgs<O, T, ObjectOrInterfacePropertyKeysFrom<O, T>>>(client: ClientContext<O>, objectType: T & string, args: A, objectSet?: Wire.ObjectSet): Promise<PageResult<NOOP<OsdkObjectFrom<T, O, A["select"] extends readonly string[] ? A["select"][number] : ObjectOrInterfacePropertyKeysFrom<O, T>>>>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { InterfaceKeysFrom,
|
|
1
|
+
import type { InterfaceKeysFrom, ObjectOrInterfaceDefinitionFrom, ObjectOrInterfaceKeysFrom, ObjectOrInterfacePropertyKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import type { FetchPageOrThrowArgs } from "../object/fetchPageOrThrow.js";
|
|
3
3
|
import type { OsdkInterfaceFrom, OsdkObjectFrom } from "../OsdkObjectFrom.js";
|
|
4
4
|
import type { PageResult } from "../PageResult.js";
|
|
@@ -6,15 +6,15 @@ import type { AggregateOpts } from "../query/aggregations/AggregateOpts.js";
|
|
|
6
6
|
import type { AggregationsResults, WhereClause } from "../query/index.js";
|
|
7
7
|
import type { LinkTypesFrom } from "./LinkTypesFrom.js";
|
|
8
8
|
import type { ObjectSetListener } from "./ObjectSetListener.js";
|
|
9
|
-
export type ObjectSet<O extends OntologyDefinition<string>, K extends
|
|
10
|
-
export interface BaseObjectSet<O extends OntologyDefinition<any>, K extends
|
|
11
|
-
fetchPageOrThrow: <L extends
|
|
9
|
+
export type ObjectSet<O extends OntologyDefinition<string>, K extends ObjectOrInterfaceKeysFrom<O>> = BaseObjectSet<O, K>;
|
|
10
|
+
export interface BaseObjectSet<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>> {
|
|
11
|
+
fetchPageOrThrow: <L extends ObjectOrInterfacePropertyKeysFrom<O, K>>(args?: FetchPageOrThrowArgs<O, K, L>) => Promise<PageResult<K extends InterfaceKeysFrom<O> ? OsdkInterfaceFrom<K, O, L> : OsdkObjectFrom<K, O, L>>>;
|
|
12
12
|
aggregateOrThrow: <const AO extends AggregateOpts<O, K, any>>(req: AO) => Promise<AggregationsResults<O, K, AO>>;
|
|
13
|
-
where: (clause: WhereClause<
|
|
13
|
+
where: (clause: WhereClause<ObjectOrInterfaceDefinitionFrom<O, K>>) => ObjectSet<O, K>;
|
|
14
14
|
pivotTo: <T extends LinkTypesFrom<O, K>>(type: T & string, opts?: ObjectSetOptions<O, O["objects"][K]["links"][T]["targetType"]>) => ObjectSet<O, O["objects"][K]["links"][T]["targetType"]>;
|
|
15
15
|
subscribe: (listener: ObjectSetListener<O, K>) => () => void;
|
|
16
16
|
}
|
|
17
|
-
export interface ObjectSetOptions<O extends OntologyDefinition<any>, K extends
|
|
18
|
-
$where?: WhereClause<
|
|
17
|
+
export interface ObjectSetOptions<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>> {
|
|
18
|
+
$where?: WhereClause<ObjectOrInterfaceDefinitionFrom<O, K>>;
|
|
19
19
|
}
|
|
20
|
-
export type ObjectSetFactory<O extends OntologyDefinition<any>> = <K extends
|
|
20
|
+
export type ObjectSetFactory<O extends OntologyDefinition<any>> = <K extends ObjectOrInterfaceKeysFrom<O>>(type: K & string, opts?: ObjectSetOptions<O, K>) => ObjectSet<O, K>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import { type ClientContext } from "@osdk/shared.net";
|
|
3
3
|
import type { Wire } from "../internal/net/index.js";
|
|
4
4
|
import type { ObjectSetListener } from "./ObjectSetListener.js";
|
|
@@ -6,7 +6,7 @@ export declare class ObjectSetListenerWebsocket<O extends OntologyDefinition<any
|
|
|
6
6
|
#private;
|
|
7
7
|
static getInstance<O extends OntologyDefinition<any, any, any>>(client: ClientContext<O>): ObjectSetListenerWebsocket<O>;
|
|
8
8
|
private constructor();
|
|
9
|
-
subscribe<K extends
|
|
9
|
+
subscribe<K extends ObjectOrInterfaceKeysFrom<O>>(objectSet: Wire.ObjectSet, listener: ObjectSetListener<O, K>): () => void;
|
|
10
10
|
}
|
|
11
11
|
export type ObjectPropertyMapping = {
|
|
12
12
|
apiName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceKeysFrom, OntologyDefinition } from "@osdk/api";
|
|
2
2
|
import type { ClientContext } from "@osdk/shared.net";
|
|
3
3
|
import type { Wire } from "../internal/net/index.js";
|
|
4
4
|
import type { ObjectSet, ObjectSetOptions } from "./ObjectSet.js";
|
|
5
|
-
export declare function createObjectSet<O extends OntologyDefinition<any>, K extends
|
|
5
|
+
export declare function createObjectSet<O extends OntologyDefinition<any>, K extends ObjectOrInterfaceKeysFrom<O>>(objectType: K & string, clientCtx: ClientContext<O>, opts: ObjectSetOptions<O, K> | undefined, objectSet?: Wire.ObjectSet): ObjectSet<O, K>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectOrInterfaceDefinition, ObjectTypePropertyDefinition } from "@osdk/api";
|
|
2
2
|
export type PossibleWhereClauseFilters = "gt" | "eq" | "ne" | "isNull" | "gte" | "lt" | "lte";
|
|
3
3
|
type MakeFilter<K extends PossibleWhereClauseFilters, V> = K extends string ? Omit<{
|
|
4
4
|
[k in PossibleWhereClauseFilters]?: undefined;
|
|
@@ -9,16 +9,16 @@ type BaseFilter<T> = T | MakeFilter<"eq" | "ne", T> | MakeFilter<"isNull", boole
|
|
|
9
9
|
type StringFilter = BaseFilter<string>;
|
|
10
10
|
type NumberFilter = BaseFilter<number> | MakeFilter<"gt" | "gte" | "lt" | "lte", number>;
|
|
11
11
|
type FilterFor<PD extends ObjectTypePropertyDefinition> = PD["type"] extends "string" ? StringFilter : NumberFilter;
|
|
12
|
-
export interface AndWhereClause<T extends
|
|
12
|
+
export interface AndWhereClause<T extends ObjectOrInterfaceDefinition<any, any>> {
|
|
13
13
|
$and: WhereClause<T>[];
|
|
14
14
|
}
|
|
15
|
-
export interface OrWhereClause<T extends
|
|
15
|
+
export interface OrWhereClause<T extends ObjectOrInterfaceDefinition<any, any>> {
|
|
16
16
|
$or: WhereClause<T>[];
|
|
17
17
|
}
|
|
18
|
-
export interface NotWhereClause<T extends
|
|
18
|
+
export interface NotWhereClause<T extends ObjectOrInterfaceDefinition<any, any>> {
|
|
19
19
|
$not: WhereClause<T>;
|
|
20
20
|
}
|
|
21
|
-
export type WhereClause<T extends
|
|
21
|
+
export type WhereClause<T extends ObjectOrInterfaceDefinition<any, any>> = OrWhereClause<T> | AndWhereClause<T> | NotWhereClause<T> | {
|
|
22
22
|
[P in keyof T["properties"]]?: FilterFor<T["properties"][P]>;
|
|
23
23
|
};
|
|
24
24
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/client",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"isomorphic-ws": "^5.0.0",
|
|
23
23
|
"tiny-invariant": "^1.3.1",
|
|
24
24
|
"ws": "^8.14.2",
|
|
25
|
-
"@osdk/api": "1.0.
|
|
26
|
-
"@osdk/gateway": "1.0.
|
|
27
|
-
"@osdk/shared.net": "1.0.
|
|
25
|
+
"@osdk/api": "1.0.2",
|
|
26
|
+
"@osdk/gateway": "1.0.2",
|
|
27
|
+
"@osdk/shared.net": "1.0.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/ws": "^8.5.10",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"package.json",
|
|
43
43
|
"*.d.ts"
|
|
44
44
|
],
|
|
45
|
-
"main": "./build/js/index.
|
|
45
|
+
"main": "./build/js/index.cjs",
|
|
46
46
|
"module": "./build/js/index.mjs",
|
|
47
47
|
"types": "./build/types/index.d.ts",
|
|
48
48
|
"type": "module",
|