@osdk/widget.client 2.1.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/CHANGELOG.md +516 -0
- package/build/browser/client.js +128 -0
- package/build/browser/client.js.map +1 -0
- package/build/browser/host.js +30 -0
- package/build/browser/host.js.map +1 -0
- package/build/browser/host.test.js +113 -0
- package/build/browser/host.test.js.map +1 -0
- package/build/browser/index.js +20 -0
- package/build/browser/index.js.map +1 -0
- package/build/cjs/index.cjs +145 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +55 -0
- package/build/esm/client.js +128 -0
- package/build/esm/client.js.map +1 -0
- package/build/esm/host.js +30 -0
- package/build/esm/host.js.map +1 -0
- package/build/esm/host.test.js +113 -0
- package/build/esm/host.test.js.map +1 -0
- package/build/esm/index.js +20 -0
- package/build/esm/index.js.map +1 -0
- package/build/types/client.d.ts +30 -0
- package/build/types/client.d.ts.map +1 -0
- package/build/types/host.d.ts +22 -0
- package/build/types/host.d.ts.map +1 -0
- package/build/types/host.test.d.ts +1 -0
- package/build/types/host.test.d.ts.map +1 -0
- package/build/types/index.d.ts +5 -0
- package/build/types/index.d.ts.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { defineConfig } from "@osdk/widget.api";
|
|
18
|
+
import { describe, expectTypeOf, it } from "vitest";
|
|
19
|
+
import { FoundryHostEventTarget } from "./host.js";
|
|
20
|
+
describe("FoundryHostEventTarget", () => {
|
|
21
|
+
it("should narrow the event payload based on host message type for addEventListener", () => {
|
|
22
|
+
defineConfig({
|
|
23
|
+
id: "widgetId",
|
|
24
|
+
name: "Widget Name",
|
|
25
|
+
description: "Widget Description",
|
|
26
|
+
type: "workshop",
|
|
27
|
+
parameters: {
|
|
28
|
+
test: {
|
|
29
|
+
displayName: "Testing",
|
|
30
|
+
type: "array",
|
|
31
|
+
subType: "boolean"
|
|
32
|
+
},
|
|
33
|
+
test2: {
|
|
34
|
+
displayName: "Testing 2",
|
|
35
|
+
type: "array",
|
|
36
|
+
subType: "string"
|
|
37
|
+
},
|
|
38
|
+
test3: {
|
|
39
|
+
displayName: "Testing 3",
|
|
40
|
+
type: "number"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
events: {
|
|
44
|
+
myEvent: {
|
|
45
|
+
displayName: "My Event",
|
|
46
|
+
parameterUpdateIds: ["test"]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
const hostTarget = new FoundryHostEventTarget();
|
|
51
|
+
hostTarget.addEventListener("host.update-parameters", event => {
|
|
52
|
+
expectTypeOf(event.detail).toMatchTypeOf();
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
it("should narrow the event payload based on host message type for removeEventListener", () => {
|
|
56
|
+
defineConfig({
|
|
57
|
+
id: "widgetId",
|
|
58
|
+
name: "Widget Name",
|
|
59
|
+
description: "Widget Description",
|
|
60
|
+
type: "workshop",
|
|
61
|
+
parameters: {
|
|
62
|
+
test: {
|
|
63
|
+
displayName: "Testing",
|
|
64
|
+
type: "array",
|
|
65
|
+
subType: "boolean"
|
|
66
|
+
},
|
|
67
|
+
test2: {
|
|
68
|
+
displayName: "Testing 2",
|
|
69
|
+
type: "array",
|
|
70
|
+
subType: "string"
|
|
71
|
+
},
|
|
72
|
+
test3: {
|
|
73
|
+
displayName: "Testing 3",
|
|
74
|
+
type: "number"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
events: {
|
|
78
|
+
myEvent: {
|
|
79
|
+
displayName: "My Event",
|
|
80
|
+
parameterUpdateIds: ["test"]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const hostTarget = new FoundryHostEventTarget();
|
|
85
|
+
hostTarget.removeEventListener("host.update-parameters", event => {
|
|
86
|
+
expectTypeOf(event.detail).toMatchTypeOf();
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
it("should narrow the event payload when dispatching an event", () => {
|
|
90
|
+
defineConfig({
|
|
91
|
+
id: "widgetId",
|
|
92
|
+
name: "Widget Name",
|
|
93
|
+
description: "Widget Description",
|
|
94
|
+
type: "workshop",
|
|
95
|
+
parameters: {
|
|
96
|
+
test: {
|
|
97
|
+
displayName: "Testing",
|
|
98
|
+
type: "array",
|
|
99
|
+
subType: "boolean"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
events: {
|
|
103
|
+
myEvent: {
|
|
104
|
+
displayName: "My Event",
|
|
105
|
+
parameterUpdateIds: ["test"]
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
new FoundryHostEventTarget();
|
|
110
|
+
expectTypeOf().toMatchTypeOf();
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=host.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"host.test.js","names":["defineConfig","describe","expectTypeOf","it","FoundryHostEventTarget","id","name","description","type","parameters","test","displayName","subType","test2","test3","events","myEvent","parameterUpdateIds","hostTarget","addEventListener","event","detail","toMatchTypeOf","removeEventListener"],"sources":["host.test.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 { HostMessage } from \"@osdk/widget.api\";\nimport { defineConfig } from \"@osdk/widget.api\";\nimport { describe, expectTypeOf, it } from \"vitest\";\nimport type { HostMessageEventListener } from \"./host.js\";\nimport { FoundryHostEventTarget } from \"./host.js\";\n\ndescribe(\"FoundryHostEventTarget\", () => {\n it(\"should narrow the event payload based on host message type for addEventListener\", () => {\n const test = defineConfig({\n id: \"widgetId\",\n name: \"Widget Name\",\n description: \"Widget Description\",\n type: \"workshop\",\n parameters: {\n test: {\n displayName: \"Testing\",\n type: \"array\",\n subType: \"boolean\",\n },\n test2: {\n displayName: \"Testing 2\",\n type: \"array\",\n subType: \"string\",\n },\n test3: {\n displayName: \"Testing 3\",\n type: \"number\",\n },\n },\n events: {\n myEvent: {\n displayName: \"My Event\",\n parameterUpdateIds: [\"test\"],\n },\n },\n });\n\n const hostTarget = new FoundryHostEventTarget<typeof test>();\n hostTarget.addEventListener(\"host.update-parameters\", (event) => {\n expectTypeOf(event.detail).toMatchTypeOf<\n HostMessage.Payload.UpdateParameters<typeof test>\n >();\n });\n });\n\n it(\"should narrow the event payload based on host message type for removeEventListener\", () => {\n const test = defineConfig({\n id: \"widgetId\",\n name: \"Widget Name\",\n description: \"Widget Description\",\n type: \"workshop\",\n parameters: {\n test: {\n displayName: \"Testing\",\n type: \"array\",\n subType: \"boolean\",\n },\n test2: {\n displayName: \"Testing 2\",\n type: \"array\",\n subType: \"string\",\n },\n test3: {\n displayName: \"Testing 3\",\n type: \"number\",\n },\n },\n events: {\n myEvent: {\n displayName: \"My Event\",\n parameterUpdateIds: [\"test\"],\n },\n },\n });\n\n const hostTarget = new FoundryHostEventTarget<typeof test>();\n const listener: HostMessageEventListener<\n HostMessage.Payload.UpdateParameters<typeof test>\n > = (event) => {\n expectTypeOf(event.detail).toMatchTypeOf<\n HostMessage.Payload.UpdateParameters<typeof test>\n >();\n };\n\n hostTarget.removeEventListener(\"host.update-parameters\", listener);\n });\n\n it(\"should narrow the event payload when dispatching an event\", () => {\n const test = defineConfig({\n id: \"widgetId\",\n name: \"Widget Name\",\n description: \"Widget Description\",\n type: \"workshop\",\n parameters: {\n test: {\n displayName: \"Testing\",\n type: \"array\",\n subType: \"boolean\",\n },\n },\n events: {\n myEvent: {\n displayName: \"My Event\",\n parameterUpdateIds: [\"test\"],\n },\n },\n });\n\n const hostTarget = new FoundryHostEventTarget<typeof test>();\n type dispatchUpdateMessage = Parameters<\n typeof hostTarget.dispatchEventMessage<\"host.update-parameters\">\n >[1];\n expectTypeOf<dispatchUpdateMessage>().toMatchTypeOf<\n HostMessage.Payload.UpdateParameters<typeof test>\n >();\n });\n});\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export { defineConfig, HostMessage, isHostParametersUpdatedMessage } from "@osdk/widget.api";
|
|
18
|
+
export { createFoundryWidgetClient } from "./client.js";
|
|
19
|
+
export { FoundryHostEventTarget } from "./host.js";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineConfig","HostMessage","isHostParametersUpdatedMessage","createFoundryWidgetClient","FoundryHostEventTarget"],"sources":["index.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\nexport type {\n AsyncFailedValue,\n AsyncLoadedValue,\n AsyncLoadingValue,\n AsyncNotStartedLoadingValue,\n AsyncParameterValueMap,\n AsyncReloadingValue,\n AsyncValue,\n EventId,\n EventParameterValueMap,\n ParameterConfig,\n ParameterValue,\n ParameterValueMap,\n WidgetConfig,\n WidgetMessage,\n} from \"@osdk/widget.api\";\nexport {\n defineConfig,\n HostMessage,\n isHostParametersUpdatedMessage,\n} from \"@osdk/widget.api\";\nexport { createFoundryWidgetClient } from \"./client.js\";\nexport type { FoundryWidgetClient } from \"./client.js\";\nexport { FoundryHostEventTarget } from \"./host.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,SACEA,YAAY,EACZC,WAAW,EACXC,8BAA8B,QACzB,kBAAkB;AACzB,SAASC,yBAAyB,QAAQ,aAAa;AAEvD,SAASC,sBAAsB,QAAQ,WAAW","ignoreList":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type WidgetConfig, type WidgetMessage } from "@osdk/widget.api";
|
|
2
|
+
import { FoundryHostEventTarget } from "./host.js";
|
|
3
|
+
export interface FoundryWidgetClient<C extends WidgetConfig<C["parameters"]>> {
|
|
4
|
+
/**
|
|
5
|
+
* Notifies the host that this client is ready to receive the first parameter values
|
|
6
|
+
*/
|
|
7
|
+
ready: () => void;
|
|
8
|
+
/**
|
|
9
|
+
* Emits an event with the given ID and payload
|
|
10
|
+
*/
|
|
11
|
+
emitEvent: <M extends WidgetMessage.EmitEvent<C>>(eventId: M["payload"]["eventId"], payload: Omit<M["payload"], "eventId">) => void;
|
|
12
|
+
/**
|
|
13
|
+
* Sends a message to the parent frame.
|
|
14
|
+
* It is recommended to use the convenience methods for individual messages (e.g. ready or emitEvent) instead
|
|
15
|
+
*/
|
|
16
|
+
sendMessage: <M extends WidgetMessage<C>>(message: M) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Subscribes to events from the host, invoking the listener when a message is received
|
|
19
|
+
*/
|
|
20
|
+
subscribe: () => void;
|
|
21
|
+
/**
|
|
22
|
+
* Unsubscribes a previously subscribed listener from host events, if one exists
|
|
23
|
+
*/
|
|
24
|
+
unsubscribe: () => void;
|
|
25
|
+
/**
|
|
26
|
+
* Event targets on which you can subscribe to specific host messages
|
|
27
|
+
*/
|
|
28
|
+
hostEventTarget: FoundryHostEventTarget<C>;
|
|
29
|
+
}
|
|
30
|
+
export declare function createFoundryWidgetClient<C extends WidgetConfig<C["parameters"]>>(): FoundryWidgetClient<C>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAGO,mBACA,qBACA,kBAAmB;AAG1B,SAAS,8BAA8B,WAAY;AAEnD,iBAAiB,oBAAoB,UAAU,aAAa,EAAE,gBAAgB;;;;CAI5E;;;;CAKA,YAAY,UAAU,cAAc,UAAU,IAC5CA,SAAS,EAAE,WAAW,YACtBC,SAAS,KAAK,EAAE,YAAY;;;;;CAO9B,cAAc,UAAU,cAAc,IAAIC,SAAS;;;;CAKnD;;;;CAKA;;;;CAKA,iBAAiB,uBAAuB;AACzC;AAED,OAAO,iBAAS,0BACd,UAAU,aAAa,EAAE,mBACtB,oBAAoB","names":["eventId: M[\"payload\"][\"eventId\"]","payload: Omit<M[\"payload\"], \"eventId\">","message: M"],"sources":["../../src/client.ts"],"version":3,"file":"client.d.ts"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HostMessage, WidgetConfig } from "@osdk/widget.api";
|
|
2
|
+
export interface HostMessageEventListener<P extends HostMessage.Payload> {
|
|
3
|
+
(event: CustomEvent<P>): void;
|
|
4
|
+
}
|
|
5
|
+
export interface HostMessageEventListenerObject<P extends HostMessage.Payload> {
|
|
6
|
+
handleEvent(object: CustomEvent<P>): void;
|
|
7
|
+
}
|
|
8
|
+
export declare class FoundryHostEventTarget<C extends WidgetConfig<C["parameters"]>> extends EventTarget {
|
|
9
|
+
addEventListener<T extends HostMessage<C>["type"]>(type: T, callback: HostMessageEventListener<(HostMessage<C> & {
|
|
10
|
+
type: T
|
|
11
|
+
})["payload"]> | HostMessageEventListenerObject<(HostMessage<C> & {
|
|
12
|
+
type: T
|
|
13
|
+
})["payload"]> | null, options?: AddEventListenerOptions | boolean): void;
|
|
14
|
+
removeEventListener<T extends HostMessage<C>["type"]>(type: T, callback: HostMessageEventListener<(HostMessage<C> & {
|
|
15
|
+
type: T
|
|
16
|
+
})["payload"]> | HostMessageEventListenerObject<(HostMessage<C> & {
|
|
17
|
+
type: T
|
|
18
|
+
})["payload"]> | null, options?: EventListenerOptions | boolean): void;
|
|
19
|
+
dispatchEventMessage<T extends HostMessage<C>["type"]>(type: T, payload: (HostMessage<C> & {
|
|
20
|
+
type: T
|
|
21
|
+
})["payload"]): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,aAAa,oBAAoB,kBAAmB;AAElE,iBAAiB,yBAAyB,UAAU,YAAY,SAAS;EACtEA,OAAO,YAAY;AACrB;AAED,iBAAiB,+BAA+B,UAAU,YAAY,SAAS;CAC7E,YAAYC,QAAQ,YAAY;AACjC;AAED,OAAO,cAAM,uBACX,UAAU,aAAa,EAAE,wBACjB,YAAY;CACpB,iBAAiB,UAAU,YAAY,GAAG,SACxCC,MAAM,GACNC,UACI,0BACC,YAAY,KAAK;EAAE,MAAM;CAAG,GAAE,cAE/B,gCACC,YAAY,KAAK;EAAE,MAAM;CAAG,GAAE,oBAGnCC,UAAU;CAKZ,oBAAoB,UAAU,YAAY,GAAG,SAC3CF,MAAM,GACNC,UACI,0BACC,YAAY,KAAK;EAAE,MAAM;CAAG,GAAE,cAE/B,gCACC,YAAY,KAAK;EAAE,MAAM;CAAG,GAAE,oBAGnCE,UAAU;CAKZ,AAAO,qBAAqB,UAAU,YAAY,GAAG,SACnDH,MAAM,GACNI,UAAU,YAAY,KAAK;EAAE,MAAM;CAAG,GAAE;AAQ3C","names":["event: CustomEvent<P>","object: CustomEvent<P>","type: T","callback:\n | HostMessageEventListener<\n (HostMessage<C> & { type: T })[\"payload\"]\n >\n | HostMessageEventListenerObject<\n (HostMessage<C> & { type: T })[\"payload\"]\n >\n | null","options?: AddEventListenerOptions | boolean","options?: EventListenerOptions | boolean","payload: (HostMessage<C> & { type: T })[\"payload\"]"],"sources":["../../src/host.ts"],"version":3,"file":"host.d.ts"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"","names":[],"sources":["../../src/host.test.ts"],"version":3,"file":"host.test.d.ts"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { AsyncFailedValue, AsyncLoadedValue, AsyncLoadingValue, AsyncNotStartedLoadingValue, AsyncParameterValueMap, AsyncReloadingValue, AsyncValue, EventId, EventParameterValueMap, ParameterConfig, ParameterValue, ParameterValueMap, WidgetConfig, WidgetMessage } from "@osdk/widget.api";
|
|
2
|
+
export { defineConfig, HostMessage, isHostParametersUpdatedMessage } from "@osdk/widget.api";
|
|
3
|
+
export { createFoundryWidgetClient } from "./client.js";
|
|
4
|
+
export type { FoundryWidgetClient } from "./client.js";
|
|
5
|
+
export { FoundryHostEventTarget } from "./host.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cACE,kBACA,kBACA,mBACA,6BACA,wBACA,qBACA,YACA,SACA,wBACA,iBACA,gBACA,mBACA,cACA,qBACK;AACP,SACE,cACA,aACA,sCACK;AACP,SAAS,iCAAiC;AAC1C,cAAc,2BAA2B;AACzC,SAAS,8BAA8B","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
package/package.json
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@osdk/widget.client",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Client that sets up listeners for the custom widgets embedded into Foundry, adhering to the contract laid out in @osdk/widget.api",
|
|
5
|
+
"access": "public",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/palantir/osdk-ts.git"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"browser": "./build/browser/index.js",
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./build/types/index.d.ts",
|
|
16
|
+
"default": "./build/esm/index.js"
|
|
17
|
+
},
|
|
18
|
+
"require": "./build/cjs/index.cjs",
|
|
19
|
+
"default": "./build/browser/index.js"
|
|
20
|
+
},
|
|
21
|
+
"./*": {
|
|
22
|
+
"browser": "./build/browser/public/*.js",
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./build/types/public/*.d.ts",
|
|
25
|
+
"default": "./build/esm/public/*.js"
|
|
26
|
+
},
|
|
27
|
+
"require": "./build/cjs/public/*.cjs",
|
|
28
|
+
"default": "./build/browser/public/*.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"tiny-invariant": "^1.3.1",
|
|
33
|
+
"@osdk/widget.api": "~2.1.0"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"ts-expect": "^1.3.0",
|
|
37
|
+
"typescript": "~5.5.4",
|
|
38
|
+
"@osdk/monorepo.api-extractor": "~0.1.0",
|
|
39
|
+
"@osdk/monorepo.tsconfig": "~0.1.0"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [],
|
|
45
|
+
"files": [
|
|
46
|
+
"build/cjs",
|
|
47
|
+
"build/esm",
|
|
48
|
+
"build/browser",
|
|
49
|
+
"build/types",
|
|
50
|
+
"CHANGELOG.md",
|
|
51
|
+
"package.json",
|
|
52
|
+
"templates",
|
|
53
|
+
"*.d.ts"
|
|
54
|
+
],
|
|
55
|
+
"main": "./build/cjs/index.cjs",
|
|
56
|
+
"module": "./build/esm/index.js",
|
|
57
|
+
"types": "./build/cjs/index.d.cts",
|
|
58
|
+
"type": "module",
|
|
59
|
+
"scripts": {
|
|
60
|
+
"check-attw": "attw --pack .",
|
|
61
|
+
"check-spelling": "cspell --quiet .",
|
|
62
|
+
"clean": "rm -rf lib dist types build tsconfig.tsbuildinfo",
|
|
63
|
+
"fix-lint": "eslint . --fix && dprint fmt --config $(find-up dprint.json)",
|
|
64
|
+
"lint": "eslint . && dprint check --config $(find-up dprint.json)",
|
|
65
|
+
"transpileBrowser": "monorepo.tool.transpile -f esm -m normal -t browser",
|
|
66
|
+
"transpileCjs": "monorepo.tool.transpile -f cjs -m bundle -t node",
|
|
67
|
+
"transpileEsm": "monorepo.tool.transpile -f esm -m normal -t node",
|
|
68
|
+
"transpileTypes": "monorepo.tool.transpile -f esm -m types -t node",
|
|
69
|
+
"typecheck": "tsc --noEmit --emitDeclarationOnly false"
|
|
70
|
+
}
|
|
71
|
+
}
|