@osdk/react 0.9.0-beta.2 → 0.9.0-beta.4
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 +28 -0
- package/build/browser/new/makeExternalStore.js +2 -2
- package/build/browser/new/makeExternalStore.js.map +1 -1
- package/build/browser/new/platform-apis/admin/useCurrentFoundryUser.js +44 -0
- package/build/browser/new/platform-apis/admin/useCurrentFoundryUser.js.map +1 -0
- package/build/browser/new/platform-apis/admin/useFoundryUser.js +50 -0
- package/build/browser/new/platform-apis/admin/useFoundryUser.js.map +1 -0
- package/build/browser/new/platform-apis/admin/useFoundryUsersList.js +54 -0
- package/build/browser/new/platform-apis/admin/useFoundryUsersList.js.map +1 -0
- package/build/browser/new/useObjectSet.js +17 -2
- package/build/browser/new/useObjectSet.js.map +1 -1
- package/build/browser/new/useOsdkAction.js.map +1 -1
- package/build/browser/new/useOsdkObject.js.map +1 -1
- package/build/browser/new/useOsdkObjects.js.map +1 -1
- package/build/browser/public/experimental.js +3 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/utils/usePlatformQuery.js +74 -0
- package/build/browser/utils/usePlatformQuery.js.map +1 -0
- package/build/cjs/{chunk-OVBG5VXE.cjs → chunk-V32JHU3O.cjs} +8 -3
- package/build/cjs/chunk-V32JHU3O.cjs.map +1 -0
- package/build/cjs/index.cjs +4 -4
- package/build/cjs/public/experimental.cjs +692 -53
- package/build/cjs/public/experimental.cjs.map +1 -1
- package/build/cjs/public/experimental.d.cts +122 -7
- package/build/esm/new/makeExternalStore.js +2 -2
- package/build/esm/new/makeExternalStore.js.map +1 -1
- package/build/esm/new/platform-apis/admin/useCurrentFoundryUser.js +44 -0
- package/build/esm/new/platform-apis/admin/useCurrentFoundryUser.js.map +1 -0
- package/build/esm/new/platform-apis/admin/useFoundryUser.js +50 -0
- package/build/esm/new/platform-apis/admin/useFoundryUser.js.map +1 -0
- package/build/esm/new/platform-apis/admin/useFoundryUsersList.js +54 -0
- package/build/esm/new/platform-apis/admin/useFoundryUsersList.js.map +1 -0
- package/build/esm/new/useObjectSet.js +17 -2
- package/build/esm/new/useObjectSet.js.map +1 -1
- package/build/esm/new/useOsdkAction.js.map +1 -1
- package/build/esm/new/useOsdkObject.js.map +1 -1
- package/build/esm/new/useOsdkObjects.js.map +1 -1
- package/build/esm/public/experimental.js +3 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/utils/usePlatformQuery.js +74 -0
- package/build/esm/utils/usePlatformQuery.js.map +1 -0
- package/build/types/new/makeExternalStore.d.ts +1 -1
- package/build/types/new/makeExternalStore.d.ts.map +1 -1
- package/build/types/new/platform-apis/admin/useCurrentFoundryUser.d.ts +28 -0
- package/build/types/new/platform-apis/admin/useCurrentFoundryUser.d.ts.map +1 -0
- package/build/types/new/platform-apis/admin/useFoundryUser.d.ts +36 -0
- package/build/types/new/platform-apis/admin/useFoundryUser.d.ts.map +1 -0
- package/build/types/new/platform-apis/admin/useFoundryUsersList.d.ts +52 -0
- package/build/types/new/platform-apis/admin/useFoundryUsersList.d.ts.map +1 -0
- package/build/types/new/useOsdkAction.d.ts +3 -3
- package/build/types/new/useOsdkAction.d.ts.map +1 -1
- package/build/types/new/useOsdkObjects.d.ts +7 -4
- package/build/types/new/useOsdkObjects.d.ts.map +1 -1
- package/build/types/public/experimental.d.ts +3 -0
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/utils/usePlatformQuery.d.ts +25 -0
- package/build/types/utils/usePlatformQuery.d.ts.map +1 -0
- package/package.json +5 -4
- package/build/cjs/chunk-OVBG5VXE.cjs.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Core } from "@osdk/foundry";
|
|
2
|
+
import { Admin } from "@osdk/foundry";
|
|
3
|
+
export interface UseFoundryUserOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Enable or disable the query.
|
|
6
|
+
*
|
|
7
|
+
* When `false`, the query will not automatically execute.
|
|
8
|
+
*
|
|
9
|
+
* This is useful for:
|
|
10
|
+
* - Lazy/on-demand queries that should wait for user interaction
|
|
11
|
+
* - Dependent queries that need data from another query first
|
|
12
|
+
* - Conditional queries based on component state
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
* });
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The default status of the users returned in the list.
|
|
20
|
+
*
|
|
21
|
+
* @default "ACTIVE"
|
|
22
|
+
*/
|
|
23
|
+
status?: Core.UserStatus;
|
|
24
|
+
}
|
|
25
|
+
export interface UseFoundryUserResult {
|
|
26
|
+
user: Admin.User | undefined;
|
|
27
|
+
isLoading: boolean;
|
|
28
|
+
error: Error | undefined;
|
|
29
|
+
refetch: () => void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Get the User with the specified id.
|
|
33
|
+
* @param userId A Foundry User ID.
|
|
34
|
+
* @param options Options to control the query.
|
|
35
|
+
*/
|
|
36
|
+
export declare function useFoundryUser(userId: string, { enabled, status }?: UseFoundryUserOptions): UseFoundryUserResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,YAAY,eAAgB;AAC1C,SAAS,aAAa,eAAgB;AAMtC,iBAAiB,sBAAsB;;;;;;;;;;;;;;CAcrC;;;;;;CAOA,SAAS,KAAK;AACf;AAED,iBAAiB,qBAAqB;CACpC,MAAM,MAAM;CACZ;CAEA,OAAO;CAEP;AACD;;;;;;AAOD,OAAO,iBAAS,eACdA,gBACA,EAAE,SAAgB,QAA0C,GAArB,wBACtC","names":["userId: string"],"sources":["../../../../../src/new/platform-apis/admin/useFoundryUser.ts"],"version":3,"file":"useFoundryUser.d.ts"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Core } from "@osdk/foundry";
|
|
2
|
+
import { Admin } from "@osdk/foundry";
|
|
3
|
+
export interface UseFoundryUsersListOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Enable or disable the query.
|
|
6
|
+
*
|
|
7
|
+
* When `false`, the query will not automatically execute.
|
|
8
|
+
*
|
|
9
|
+
* This is useful for:
|
|
10
|
+
* - Lazy/on-demand queries that should wait for user interaction
|
|
11
|
+
* - Dependent queries that need data from another query first
|
|
12
|
+
* - Conditional queries based on component state
|
|
13
|
+
*
|
|
14
|
+
* @default true
|
|
15
|
+
* });
|
|
16
|
+
*/
|
|
17
|
+
enabled?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The default status of the users returned in the list.
|
|
20
|
+
*
|
|
21
|
+
* @default "ACTIVE"
|
|
22
|
+
*/
|
|
23
|
+
include?: Core.UserStatus;
|
|
24
|
+
/**
|
|
25
|
+
* The preferred page size for the list.
|
|
26
|
+
*
|
|
27
|
+
* @default 1000
|
|
28
|
+
*/
|
|
29
|
+
pageSize?: number;
|
|
30
|
+
/**
|
|
31
|
+
* The page token indicates where to start paging. This should be omitted from the first page's request.
|
|
32
|
+
* To fetch the next page, clients should take the value from the nextPageToken field of the previous
|
|
33
|
+
* response and use it to populate the pageToken field of the next request.
|
|
34
|
+
*/
|
|
35
|
+
pageToken?: string;
|
|
36
|
+
}
|
|
37
|
+
export interface UseFoundryUsersListResult {
|
|
38
|
+
users: Admin.ListUsersResponse["data"] | undefined;
|
|
39
|
+
/**
|
|
40
|
+
* The page token to be used for the next page of users. If this is undefined, there are no more
|
|
41
|
+
* pages of users to load.
|
|
42
|
+
*/
|
|
43
|
+
nextPageToken: string | undefined;
|
|
44
|
+
isLoading: boolean;
|
|
45
|
+
error: Error | undefined;
|
|
46
|
+
refetch: () => void;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Lists all Users. This is a paged endpoint. Each page may be smaller or larger than the requested page size.
|
|
50
|
+
* @param options Options to control the query.
|
|
51
|
+
*/
|
|
52
|
+
export declare function useFoundryUsersList({ enabled, include, pageSize, pageToken }?: UseFoundryUsersListOptions): UseFoundryUsersListResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,YAAY,eAAgB;AAC1C,SAAS,aAAa,eAAgB;AAMtC,iBAAiB,2BAA2B;;;;;;;;;;;;;;CAc1C;;;;;;CAOA,UAAU,KAAK;;;;;;CAOf;;;;;;CAOA;AACD;AAED,iBAAiB,0BAA0B;CACzC,OAAO,MAAM,kBAAkB;;;;;CAK/B;CACA;CAEA,OAAO;CAEP;AACD;;;;;AAMD,OAAO,iBAAS,oBACd,EAAE,SAAgB,SAAoB,UAAiB,WAC3B,GAA1B,6BACD","names":[],"sources":["../../../../../src/new/platform-apis/admin/useFoundryUsersList.ts"],"version":3,"file":"useFoundryUsersList.d.ts"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { ActionDefinition, ActionValidationResponse } from "@osdk/client";
|
|
1
|
+
import type { ActionDefinition, ActionEditResponse, ActionValidationResponse } from "@osdk/client";
|
|
2
2
|
import { ActionValidationError } from "@osdk/client";
|
|
3
3
|
import type { ActionSignatureFromDef, ObservableClient } from "@osdk/client/unstable-do-not-use";
|
|
4
4
|
type ApplyActionParams<Q extends ActionDefinition<any>> = Parameters<ActionSignatureFromDef<Q>["applyAction"]>[0] & { [K in keyof ObservableClient.ApplyActionOptions as `$${K}`] : ObservableClient.ApplyActionOptions[K] };
|
|
5
5
|
export interface UseOsdkActionResult<Q extends ActionDefinition<any>> {
|
|
6
|
-
applyAction: (args: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>) => Promise<
|
|
6
|
+
applyAction: (args: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>) => Promise<ActionEditResponse | undefined>;
|
|
7
7
|
error: undefined | Partial<{
|
|
8
8
|
actionValidation: ActionValidationError
|
|
9
9
|
unknown: unknown
|
|
10
10
|
}>;
|
|
11
|
-
data:
|
|
11
|
+
data: ActionEditResponse | undefined;
|
|
12
12
|
isPending: boolean;
|
|
13
13
|
isValidating: boolean;
|
|
14
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,
|
|
1
|
+
{"mappings":"AAgBA,cACE,kBACA,oBACA,gCACK,cAAe;AACtB,SAAS,6BAA6B,cAAe;AACrD,cACE,wBACA,wBACK,kCAAmC;KAIrC,kBAAkB,UAAU,yBAC7B,WAAW,uBAAuB,GAAG,gBAAgB,QAEpD,WAAW,iBAAiB,0BAA0B,OACrD,iBAAiB,mBAAmB;AAG1C,iBAAiB,oBAAoB,UAAU,uBAAuB;CACpE,cACEA,MAAM,kBAAkB,KAAK,MAAM,kBAAkB,QAClD,QAAQ;CAEb,mBAEI,QAAQ;EACR,kBAAkB;EAClB;CACD;CACH,MAAM;CAEN;CACA;;;;;;;;CASA,iBACEC,MAAM,WAAW,uBAAuB,GAAG,gBAAgB,OACxD,QAAQ;CAEb,mBAAmB;AACpB;AAED,OAAO,iBAAS,cAAc,UAAU,uBACtCC,WAAW,IACV,oBAAoB","names":["args: ApplyActionParams<Q> | Array<ApplyActionParams<Q>>","args: Parameters<ActionSignatureFromDef<Q>[\"applyAction\"]>[0]","actionDef: Q"],"sources":["../../../src/new/useOsdkAction.ts"],"version":3,"file":"useOsdkAction.d.ts"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DerivedProperty, InterfaceDefinition, LinkedType, LinkNames, ObjectTypeDefinition, Osdk, PropertyKeys, WhereClause } from "@osdk/api";
|
|
1
|
+
import type { DerivedProperty, InterfaceDefinition, LinkedType, LinkNames, ObjectTypeDefinition, Osdk, PropertyKeys, SimplePropertyDef, WhereClause } from "@osdk/api";
|
|
2
2
|
import type { InferRdpTypes } from "./types.js";
|
|
3
3
|
export interface UseOsdkObjectsOptions<
|
|
4
4
|
T extends ObjectTypeDefinition | InterfaceDefinition,
|
|
@@ -106,9 +106,12 @@ export interface UseOsdkObjectsOptions<
|
|
|
106
106
|
*/
|
|
107
107
|
enabled?: boolean;
|
|
108
108
|
}
|
|
109
|
-
export interface UseOsdkListResult<
|
|
109
|
+
export interface UseOsdkListResult<
|
|
110
|
+
T extends ObjectTypeDefinition | InterfaceDefinition,
|
|
111
|
+
RDPs extends Record<string, SimplePropertyDef> = {}
|
|
112
|
+
> {
|
|
110
113
|
fetchMore: (() => Promise<void>) | undefined;
|
|
111
|
-
data: Osdk.Instance<T>[] | undefined;
|
|
114
|
+
data: Osdk.Instance<T, "$allBaseProperties", PropertyKeys<T>, RDPs>[] | undefined;
|
|
112
115
|
isLoading: boolean;
|
|
113
116
|
error: Error | undefined;
|
|
114
117
|
/**
|
|
@@ -129,4 +132,4 @@ export declare function useOsdkObjects<
|
|
|
129
132
|
export declare function useOsdkObjects<
|
|
130
133
|
Q extends ObjectTypeDefinition | InterfaceDefinition,
|
|
131
134
|
WP extends DerivedProperty.Clause<Q> | undefined
|
|
132
|
-
>(type: Q, options?: UseOsdkObjectsOptions<Q, WP>): UseOsdkListResult<Q
|
|
135
|
+
>(type: Q, options?: UseOsdkObjectsOptions<Q, WP>): UseOsdkListResult<Q, InferRdpTypes<Q, WP>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,iBACA,qBACA,YACA,WACA,sBACA,MACA,cACA,mBACK,WAAY;AAKnB,cAAc,qBAAqB,YAAa;AAEhD,iBAAiB;CACf,UAAU,uBAAuB;CACjC,kBAAkB,gBAAgB,OAAO;EACzC;;;;CAIA,QAAQ,YAAY,GAAG,cAAc,GAAG;;;;CAKxC;;CAGA,aACG,KAAK,aAAa,OAAM,QAAQ;;;;;CAOnC,iBAAiB;;;;;;CAOjB,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG,cAAc,GAAG;CACxC;;;;;CAMD,UAAU,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;CA0BpB;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BA;CAEA;;;;;;;;;;;;;;;;;;;;;CAsBA;AACD;AAED,iBAAiB,
|
|
1
|
+
{"mappings":"AAgBA,cACE,iBACA,qBACA,YACA,WACA,sBACA,MACA,cACA,mBACA,mBACK,WAAY;AAKnB,cAAc,qBAAqB,YAAa;AAEhD,iBAAiB;CACf,UAAU,uBAAuB;CACjC,kBAAkB,gBAAgB,OAAO;EACzC;;;;CAIA,QAAQ,YAAY,GAAG,cAAc,GAAG;;;;CAKxC;;CAGA,aACG,KAAK,aAAa,OAAM,QAAQ;;;;;CAOnC,iBAAiB;;;;;;CAOjB,gBAAgB,MAAM;EACpB,OAAO,YAAY,GAAG,cAAc,GAAG;CACxC;;;;;CAMD,UAAU,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;CA0BpB;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BA;CAEA;;;;;;;;;;;;;;;;;;;;;CAsBA;AACD;AAED,iBAAiB;CACf,UAAU,uBAAuB;CACjC,aAAa,eAAe,qBAAqB,CAAE;EACnD;CACA,kBAAkB;CAClB,MACI,KAAK,SAAS,GAAG,sBAAsB,aAAa,IAAI;CAE5D;CAEA,OAAO;;;;;;;;CASP;AACD;AAQD,OAAO,iBAAS;CACd,UAAU;CACV,UAAU,UAAU;EAEpBA,MAAM,GACNC,SAAS,sBAAsB,KAAK;CAAE,SAAS;AAAG,IACjD,kBAAkB,WAAW,GAAG;AAEnC,OAAO,iBAAS;CACd,UAAU,uBAAuB;CACjC,WAAW,gBAAgB,OAAO;EAElCD,MAAM,GACNE,UAAU,sBAAsB,GAAG,MAClC,kBAAkB,GAAG,cAAc,GAAG","names":["type: Q","options: UseOsdkObjectsOptions<Q> & { pivotTo: L }","options?: UseOsdkObjectsOptions<Q, WP>"],"sources":["../../../src/new/useOsdkObjects.ts"],"version":3,"file":"useOsdkObjects.d.ts"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { OsdkProvider2 } from "../new/OsdkProvider2.js";
|
|
2
|
+
export { useCurrentFoundryUser } from "../new/platform-apis/admin/useCurrentFoundryUser.js";
|
|
3
|
+
export { useFoundryUser } from "../new/platform-apis/admin/useFoundryUser.js";
|
|
4
|
+
export { useFoundryUsersList } from "../new/platform-apis/admin/useFoundryUsersList.js";
|
|
2
5
|
export { useLinks } from "../new/useLinks.js";
|
|
3
6
|
export { useObjectSet } from "../new/useObjectSet.js";
|
|
4
7
|
export { useOsdkAction } from "../new/useOsdkAction.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,cAAc,gCAAgC;AAC9C,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,cAAc,yBAAyB;AACvC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,cAAc,6BAA6B;AAC3C,SAAS,4BAA4B","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,SAAS,qBAAqB;AAC9B,SAAS,6BAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AACpC,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,cAAc,gCAAgC;AAC9C,SAAS,0BAA0B;AACnC,SAAS,qBAAqB;AAC9B,cAAc,yBAAyB;AACvC,SAAS,sBAAsB;AAC/B,SAAS,qBAAqB;AAC9B,SAAS,uBAAuB;AAChC,cAAc,6BAA6B;AAC3C,SAAS,4BAA4B","names":[],"sources":["../../../src/public/experimental.ts"],"version":3,"file":"experimental.d.ts"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface UseQueryOptions<T> {
|
|
2
|
+
/**
|
|
3
|
+
* Enable or disable the query.
|
|
4
|
+
*
|
|
5
|
+
* When `false`, the query will not automatically execute.
|
|
6
|
+
*
|
|
7
|
+
* This is useful for:
|
|
8
|
+
* - Lazy/on-demand queries that should wait for user interaction
|
|
9
|
+
* - Dependent queries that need data from another query first
|
|
10
|
+
* - Conditional queries based on component state
|
|
11
|
+
*
|
|
12
|
+
* @default true
|
|
13
|
+
* });
|
|
14
|
+
*/
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
queryName: string;
|
|
17
|
+
query: () => Promise<T>;
|
|
18
|
+
}
|
|
19
|
+
export interface QueryResult<T> {
|
|
20
|
+
data: T | undefined;
|
|
21
|
+
isLoading: boolean;
|
|
22
|
+
error: Error | undefined;
|
|
23
|
+
refetch: () => void;
|
|
24
|
+
}
|
|
25
|
+
export declare function usePlatformQuery<T>({ query, queryName, enabled }: UseQueryOptions<T>): QueryResult<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAoBA,iBAAiB,gBAAgB,GAAG;;;;;;;;;;;;;;CAclC;CACA;CACA,aAAa,QAAQ;AACtB;AAED,iBAAiB,YAAY,GAAG;CAC9B,MAAM;CACN;CACA,OAAO;CACP;AACD;AAOD,OAAO,iBAAS,iBAAiB,GAC/B,EAAE,OAAO,WAAW,SAAoC,EAAlB,gBAAgB,KACrD,YAAY","names":[],"sources":["../../../src/utils/usePlatformQuery.ts"],"version":3,"file":"usePlatformQuery.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/react",
|
|
3
|
-
"version": "0.9.0-beta.
|
|
3
|
+
"version": "0.9.0-beta.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"react-dom": "^17 || ^18 || ^19"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
+
"@osdk/foundry": "latest",
|
|
46
47
|
"@testing-library/react": "^16.3.0",
|
|
47
48
|
"@types/react": "^18.3.24",
|
|
48
49
|
"find-up": "^8.0.0",
|
|
@@ -55,10 +56,10 @@
|
|
|
55
56
|
"react": "^18.3.1",
|
|
56
57
|
"tiny-invariant": "^1.3.3",
|
|
57
58
|
"typescript": "~5.5.4",
|
|
58
|
-
"@osdk/
|
|
59
|
-
"@osdk/
|
|
59
|
+
"@osdk/client": "2.7.0-beta.6",
|
|
60
|
+
"@osdk/api": "2.7.0-beta.6",
|
|
60
61
|
"@osdk/monorepo.api-extractor": "~0.6.0-beta.1",
|
|
61
|
-
"@osdk/client.test.ontology": "2.7.0-beta.
|
|
62
|
+
"@osdk/client.test.ontology": "2.7.0-beta.6",
|
|
62
63
|
"@osdk/monorepo.tsconfig": "~0.6.0-beta.1"
|
|
63
64
|
},
|
|
64
65
|
"publishConfig": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/OsdkContext.ts","../../src/useOsdkClient.ts","../../src/useOsdkMetadata.ts"],"names":["React","error"],"mappings":";;;;;;;;;AAiBA,SAAS,gBAAgB,KAAO,EAAA;AAC9B,EAAM,MAAA,IAAI,MAAM,sEAAsE,CAAA;AACxF;AACA,IAAM,UAAA,GAAa,MAAO,CAAA,MAAA,CAAO,YAAc,EAAA;AAAA,EAC7C,aAAe,EAAA;AACjB,CAAC,CAAA;AACY,IAAA,WAAA,2CAAiC,aAAc,CAAA;AAAA,EAC1D,MAAQ,EAAA;AACV,CAAC;;;ACPM,SAAS,aAAgB,GAAA;AAC9B,EAAOA,OAAAA,uBAAAA,CAAM,UAAW,CAAA,WAAW,CAAE,CAAA,MAAA;AACvC;ACFO,SAAS,gBAAgB,IAAM,EAAA;AACpC,EAAA,MAAM,SAAS,aAAc,EAAA;AAC7B,EAAA,MAAM,CAAC,QAAU,EAAA,WAAW,CAAIA,GAAAA,uBAAAA,CAAM,SAAS,MAAS,CAAA;AACxD,EAAA,MAAM,CAAC,KAAA,EAAO,QAAQ,CAAA,GAAIA,wBAAM,QAAS,EAAA;AACzC,EAAI,IAAA,CAAC,QAAY,IAAA,CAAC,KAAO,EAAA;AACvB,IAAA,MAAA,CAAO,aAAc,CAAA,IAAI,CAAE,CAAA,IAAA,CAAK,CAAmB,eAAA,KAAA;AACjD,MAAA,WAAA,CAAY,eAAe,CAAA;AAAA,KAC5B,CAAA,CAAE,KAAM,CAAA,CAAAC,MAAS,KAAA;AAChB,MAAA,MAAM,eAAeA,MAAiB,YAAA,KAAA,GAAQA,MAAM,CAAA,OAAA,GAAU,OAAOA,MAAK,CAAA;AAC1E,MAAA,QAAA,CAAS,YAAY,CAAA;AAAA,KACtB,CAAA;AACD,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,KACX;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,OAAS,EAAA,KAAA;AAAA,IACT,QAAA;AAAA,IACA;AAAA,GACF;AACF","file":"chunk-OVBG5VXE.cjs","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 React from \"react\";\nfunction fakeClientFn(..._args) {\n throw new Error(\"This is not a real client. Did you forget to <OsdkContext.Provider>?\");\n}\nconst fakeClient = Object.assign(fakeClientFn, {\n fetchMetadata: fakeClientFn\n});\nexport const OsdkContext = /*#__PURE__*/React.createContext({\n client: fakeClient\n});","/*\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 React from \"react\";\nimport { OsdkContext } from \"./OsdkContext.js\";\nexport function useOsdkClient() {\n return React.useContext(OsdkContext).client;\n}","/*\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 React from \"react\";\nimport { useOsdkClient } from \"./useOsdkClient.js\";\nexport function useOsdkMetadata(type) {\n const client = useOsdkClient();\n const [metadata, setMetadata] = React.useState(undefined);\n const [error, setError] = React.useState();\n if (!metadata && !error) {\n client.fetchMetadata(type).then(fetchedMetadata => {\n setMetadata(fetchedMetadata);\n }).catch(error => {\n const errorMessage = error instanceof Error ? error.message : String(error);\n setError(errorMessage);\n });\n return {\n loading: true\n };\n }\n return {\n loading: false,\n metadata,\n error\n };\n}"]}
|