@osdk/widget.client 3.3.0-rc.14 → 3.4.0-beta.2
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 +5 -20
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/tokenProvider.js +25 -0
- package/build/browser/tokenProvider.js.map +1 -0
- package/build/cjs/index.cjs +6 -0
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +8 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/tokenProvider.js +25 -0
- package/build/esm/tokenProvider.js.map +1 -0
- package/build/types/index.d.ts +1 -0
- package/build/types/index.d.ts.map +1 -1
- package/build/types/tokenProvider.d.ts +6 -0
- package/build/types/tokenProvider.d.ts.map +1 -0
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,30 +1,15 @@
|
|
|
1
1
|
# @osdk/widget.client
|
|
2
2
|
|
|
3
|
-
## 3.
|
|
3
|
+
## 3.4.0-beta.2
|
|
4
4
|
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
- @osdk/widget.api@3.3.0-rc.14
|
|
8
|
-
|
|
9
|
-
## 3.3.0-rc.13
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- @osdk/widget.api@3.3.0-rc.13
|
|
5
|
+
### Minor Changes
|
|
14
6
|
|
|
15
|
-
|
|
7
|
+
- 907bc6a: Create createFoundryWidgetTokenProvider helper
|
|
16
8
|
|
|
17
9
|
### Patch Changes
|
|
18
10
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- Property formatting
|
|
22
|
-
- Branching
|
|
23
|
-
- Constant RDPs
|
|
24
|
-
|
|
25
|
-
- Updated dependencies [baf1e30]
|
|
26
|
-
- Updated dependencies [af4f3bf]
|
|
27
|
-
- @osdk/widget.api@3.3.0-rc.12
|
|
11
|
+
- Updated dependencies [31909c1]
|
|
12
|
+
- @osdk/widget.api@3.4.0-beta.2
|
|
28
13
|
|
|
29
14
|
## 3.3.0-beta.11
|
|
30
15
|
|
package/build/browser/index.js
CHANGED
|
@@ -17,4 +17,5 @@
|
|
|
17
17
|
export { defineConfig, HostMessage, isHostParametersUpdatedMessage } from "@osdk/widget.api";
|
|
18
18
|
export { createFoundryWidgetClient } from "./client.js";
|
|
19
19
|
export { FoundryHostEventTarget } from "./host.js";
|
|
20
|
+
export { createFoundryWidgetTokenProvider } from "./tokenProvider.js";
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +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":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineConfig","HostMessage","isHostParametersUpdatedMessage","createFoundryWidgetClient","FoundryHostEventTarget","createFoundryWidgetTokenProvider"],"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\";\nexport { createFoundryWidgetTokenProvider } from \"./tokenProvider.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;AAClD,SAASC,gCAAgC,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
/**
|
|
18
|
+
* A token provider for use in OSDK clients within the Foundry Custom Widgets
|
|
19
|
+
* runtime environment. It resolves to a placeholder value which is replaced
|
|
20
|
+
* on the actual request.
|
|
21
|
+
*/
|
|
22
|
+
export function createFoundryWidgetTokenProvider() {
|
|
23
|
+
return () => Promise.resolve("widgets-auth");
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=tokenProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenProvider.js","names":["createFoundryWidgetTokenProvider","Promise","resolve"],"sources":["tokenProvider.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\n/**\n * A token provider for use in OSDK clients within the Foundry Custom Widgets\n * runtime environment. It resolves to a placeholder value which is replaced\n * on the actual request.\n */\nexport function createFoundryWidgetTokenProvider(): () => Promise<string> {\n return () => Promise.resolve(\"widgets-auth\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gCAAgCA,CAAA,EAA0B;EACxE,OAAO,MAAMC,OAAO,CAACC,OAAO,CAAC,cAAc,CAAC;AAC9C","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -76,6 +76,11 @@ function createFoundryWidgetClient() {
|
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
+
// src/tokenProvider.ts
|
|
80
|
+
function createFoundryWidgetTokenProvider() {
|
|
81
|
+
return () => Promise.resolve("widgets-auth");
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
Object.defineProperty(exports, "HostMessage", {
|
|
80
85
|
enumerable: true,
|
|
81
86
|
get: function () { return widget_api.HostMessage; }
|
|
@@ -90,5 +95,6 @@ Object.defineProperty(exports, "isHostParametersUpdatedMessage", {
|
|
|
90
95
|
});
|
|
91
96
|
exports.FoundryHostEventTarget = FoundryHostEventTarget;
|
|
92
97
|
exports.createFoundryWidgetClient = createFoundryWidgetClient;
|
|
98
|
+
exports.createFoundryWidgetTokenProvider = createFoundryWidgetTokenProvider;
|
|
93
99
|
//# sourceMappingURL=index.cjs.map
|
|
94
100
|
//# sourceMappingURL=index.cjs.map
|
package/build/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/host.ts","../../src/client.ts"],"names":["invariant","visitHostMessage","HostMessage"],"mappings":";;;;;;;;;;;;AAgBa,IAAA,sBAAA,GAAN,cAAqC,WAAY,CAAA;AAAA,EACt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AA,QACN,OAAS,EAAA;AAAA,UACP,YAAYC,sBAAY,CAAA;AAAA;AAC1B,OACD,CAAA;AAAA,KACH;AAAA,IACA,QAAQ,CAAW,OAAA,KAAA;AACjB,MAAkB,iBAAA,CAAA;AAAA,QAChB,IAAM,EAAA,eAAA;AAAA,QACN;AAAA,OACD,CAAA;AAAA,KACH;AAAA,IACA,SAAA,EAAW,CAAC,OAAA,EAAS,OAAY,KAAA;AAC/B,MAAkB,iBAAA,CAAA;AAAA,QAChB,IAAM,EAAA,mBAAA;AAAA,QACN,OAAS,EAAA;AAAA,UACP,OAAA;AAAA,UACA,GAAG;AAAA;AACL,OACD,CAAA;AAAA,KACH;AAAA,IACA,WAAa,EAAA,iBAAA;AAAA,IACb,WAAW,MAAM;AACf,MAAU,SAAA,CAAA,gBAAA,CAAiB,WAAW,qBAAqB,CAAA;AAAA,KAC7D;AAAA,IACA,aAAa,MAAM;AACjB,MAAU,SAAA,CAAA,mBAAA,CAAoB,WAAW,qBAAqB,CAAA;AAAA;AAChE,GACF;AACF","file":"index.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\nexport class FoundryHostEventTarget extends EventTarget {\n addEventListener(type, callback, options) {\n super.addEventListener(type, callback, options);\n }\n removeEventListener(type, callback, options) {\n super.removeEventListener(type, callback, options);\n }\n dispatchEventMessage(type, payload) {\n this.dispatchEvent(new CustomEvent(type, {\n detail: payload\n }));\n }\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 { HostMessage, visitHostMessage } from \"@osdk/widget.api\";\nimport invariant from \"tiny-invariant\";\nimport { FoundryHostEventTarget } from \"./host.js\";\nexport function createFoundryWidgetClient() {\n !(\"__PALANTIR_WIDGET_API__\" in window) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"[FoundryWidgetClient] Missing __PALANTIR_WIDGET_API__ in window\") : invariant(false) : void 0;\n const widgetApi = window.__PALANTIR_WIDGET_API__;\n const hostEventTarget = new FoundryHostEventTarget();\n const listenForHostMessages = event => {\n visitHostMessage(event.detail, {\n \"host.update-parameters\": payload => {\n hostEventTarget.dispatchEventMessage(\"host.update-parameters\", payload);\n },\n _unknown: () => {\n // Do nothing\n }\n });\n };\n const sendMessageToHost = message => {\n widgetApi.sendMessage(message);\n };\n return {\n hostEventTarget,\n ready: () => {\n sendMessageToHost({\n type: \"widget.ready\",\n payload: {\n apiVersion: HostMessage.Version\n }\n });\n },\n resize: payload => {\n sendMessageToHost({\n type: \"widget.resize\",\n payload\n });\n },\n emitEvent: (eventId, payload) => {\n sendMessageToHost({\n type: \"widget.emit-event\",\n payload: {\n eventId,\n ...payload\n }\n });\n },\n sendMessage: sendMessageToHost,\n subscribe: () => {\n widgetApi.addEventListener(\"message\", listenForHostMessages);\n },\n unsubscribe: () => {\n widgetApi.removeEventListener(\"message\", listenForHostMessages);\n }\n };\n}"]}
|
|
1
|
+
{"version":3,"sources":["../../src/host.ts","../../src/client.ts","../../src/tokenProvider.ts"],"names":["invariant","visitHostMessage","HostMessage"],"mappings":";;;;;;;;;;;;AAgBa,IAAA,sBAAA,GAAN,cAAqC,WAAY,CAAA;AAA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AA;AAAA,QACN,OAAS,EAAA;AAAA,UACP,YAAYC,sBAAY,CAAA;AAAA;AAC1B,OACD,CAAA;AAAA,KACH;AAAA,IACA,QAAQ,CAAW,OAAA,KAAA;AACjB,MAAkB,iBAAA,CAAA;AAAA,QAChB,IAAM,EAAA,eAAA;AAAA,QACN;AAAA,OACD,CAAA;AAAA,KACH;AAAA,IACA,SAAA,EAAW,CAAC,OAAA,EAAS,OAAY,KAAA;AAC/B,MAAkB,iBAAA,CAAA;AAAA,QAChB,IAAM,EAAA,mBAAA;AAAA,QACN,OAAS,EAAA;AAAA,UACP,OAAA;AAAA,UACA,GAAG;AAAA;AACL,OACD,CAAA;AAAA,KACH;AAAA,IACA,WAAa,EAAA,iBAAA;AAAA,IACb,WAAW,MAAM;AACf,MAAU,SAAA,CAAA,gBAAA,CAAiB,WAAW,qBAAqB,CAAA;AAAA,KAC7D;AAAA,IACA,aAAa,MAAM;AACjB,MAAU,SAAA,CAAA,mBAAA,CAAoB,WAAW,qBAAqB,CAAA;AAAA;AAChE,GACF;AACF;;;AChDO,SAAS,gCAAmC,GAAA;AACjD,EAAO,OAAA,MAAM,OAAQ,CAAA,OAAA,CAAQ,cAAc,CAAA;AAC7C","file":"index.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\nexport class FoundryHostEventTarget extends EventTarget {\n addEventListener(type, callback, options) {\n super.addEventListener(type, callback, options);\n }\n removeEventListener(type, callback, options) {\n super.removeEventListener(type, callback, options);\n }\n dispatchEventMessage(type, payload) {\n this.dispatchEvent(new CustomEvent(type, {\n detail: payload\n }));\n }\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 { HostMessage, visitHostMessage } from \"@osdk/widget.api\";\nimport invariant from \"tiny-invariant\";\nimport { FoundryHostEventTarget } from \"./host.js\";\nexport function createFoundryWidgetClient() {\n !(\"__PALANTIR_WIDGET_API__\" in window) ? process.env.NODE_ENV !== \"production\" ? invariant(false, \"[FoundryWidgetClient] Missing __PALANTIR_WIDGET_API__ in window\") : invariant(false) : void 0;\n const widgetApi = window.__PALANTIR_WIDGET_API__;\n const hostEventTarget = new FoundryHostEventTarget();\n const listenForHostMessages = event => {\n visitHostMessage(event.detail, {\n \"host.update-parameters\": payload => {\n hostEventTarget.dispatchEventMessage(\"host.update-parameters\", payload);\n },\n _unknown: () => {\n // Do nothing\n }\n });\n };\n const sendMessageToHost = message => {\n widgetApi.sendMessage(message);\n };\n return {\n hostEventTarget,\n ready: () => {\n sendMessageToHost({\n type: \"widget.ready\",\n payload: {\n apiVersion: HostMessage.Version\n }\n });\n },\n resize: payload => {\n sendMessageToHost({\n type: \"widget.resize\",\n payload\n });\n },\n emitEvent: (eventId, payload) => {\n sendMessageToHost({\n type: \"widget.emit-event\",\n payload: {\n eventId,\n ...payload\n }\n });\n },\n sendMessage: sendMessageToHost,\n subscribe: () => {\n widgetApi.addEventListener(\"message\", listenForHostMessages);\n },\n unsubscribe: () => {\n widgetApi.removeEventListener(\"message\", listenForHostMessages);\n }\n };\n}","/*\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\n/**\n * A token provider for use in OSDK clients within the Foundry Custom Widgets\n * runtime environment. It resolves to a placeholder value which is replaced\n * on the actual request.\n */\nexport function createFoundryWidgetTokenProvider() {\n return () => Promise.resolve(\"widgets-auth\");\n}"]}
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -59,4 +59,11 @@ type ExtractEmitEventPayload<M extends WidgetMessage.EmitEvent<any>, ID extends
|
|
|
59
59
|
}>;
|
|
60
60
|
declare function createFoundryWidgetClient<C extends WidgetConfig<C["parameters"]>>(): FoundryWidgetClient<C>;
|
|
61
61
|
|
|
62
|
-
|
|
62
|
+
/**
|
|
63
|
+
* A token provider for use in OSDK clients within the Foundry Custom Widgets
|
|
64
|
+
* runtime environment. It resolves to a placeholder value which is replaced
|
|
65
|
+
* on the actual request.
|
|
66
|
+
*/
|
|
67
|
+
declare function createFoundryWidgetTokenProvider(): () => Promise<string>;
|
|
68
|
+
|
|
69
|
+
export { FoundryHostEventTarget, type FoundryWidgetClient, createFoundryWidgetClient, createFoundryWidgetTokenProvider };
|
package/build/esm/index.js
CHANGED
|
@@ -17,4 +17,5 @@
|
|
|
17
17
|
export { defineConfig, HostMessage, isHostParametersUpdatedMessage } from "@osdk/widget.api";
|
|
18
18
|
export { createFoundryWidgetClient } from "./client.js";
|
|
19
19
|
export { FoundryHostEventTarget } from "./host.js";
|
|
20
|
+
export { createFoundryWidgetTokenProvider } from "./tokenProvider.js";
|
|
20
21
|
//# sourceMappingURL=index.js.map
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +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":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineConfig","HostMessage","isHostParametersUpdatedMessage","createFoundryWidgetClient","FoundryHostEventTarget","createFoundryWidgetTokenProvider"],"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\";\nexport { createFoundryWidgetTokenProvider } from \"./tokenProvider.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;AAClD,SAASC,gCAAgC,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
/**
|
|
18
|
+
* A token provider for use in OSDK clients within the Foundry Custom Widgets
|
|
19
|
+
* runtime environment. It resolves to a placeholder value which is replaced
|
|
20
|
+
* on the actual request.
|
|
21
|
+
*/
|
|
22
|
+
export function createFoundryWidgetTokenProvider() {
|
|
23
|
+
return () => Promise.resolve("widgets-auth");
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=tokenProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenProvider.js","names":["createFoundryWidgetTokenProvider","Promise","resolve"],"sources":["tokenProvider.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\n/**\n * A token provider for use in OSDK clients within the Foundry Custom Widgets\n * runtime environment. It resolves to a placeholder value which is replaced\n * on the actual request.\n */\nexport function createFoundryWidgetTokenProvider(): () => Promise<string> {\n return () => Promise.resolve(\"widgets-auth\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,gCAAgCA,CAAA,EAA0B;EACxE,OAAO,MAAMC,OAAO,CAACC,OAAO,CAAC,cAAc,CAAC;AAC9C","ignoreList":[]}
|
package/build/types/index.d.ts
CHANGED
|
@@ -3,3 +3,4 @@ export { defineConfig, HostMessage, isHostParametersUpdatedMessage } from "@osdk
|
|
|
3
3
|
export { createFoundryWidgetClient } from "./client.js";
|
|
4
4
|
export type { FoundryWidgetClient } from "./client.js";
|
|
5
5
|
export { FoundryHostEventTarget } from "./host.js";
|
|
6
|
+
export { createFoundryWidgetTokenProvider } from "./tokenProvider.js";
|
|
@@ -1 +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"}
|
|
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;AACvC,SAAS,wCAAwC","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A token provider for use in OSDK clients within the Foundry Custom Widgets
|
|
3
|
+
* runtime environment. It resolves to a placeholder value which is replaced
|
|
4
|
+
* on the actual request.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createFoundryWidgetTokenProvider(): () => Promise<string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":";;;;;AAqBA,OAAO,iBAAS,0CAA0C","names":[],"sources":["../../src/tokenProvider.ts"],"version":3,"file":"tokenProvider.d.ts"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@osdk/widget.client",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.4.0-beta.2",
|
|
4
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
5
|
"access": "public",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"tiny-invariant": "^1.3.3",
|
|
33
|
-
"@osdk/widget.api": "~3.
|
|
33
|
+
"@osdk/widget.api": "~3.4.0-beta.2"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"ts-expect": "^1.3.0",
|
|
37
37
|
"typescript": "~5.5.4",
|
|
38
|
-
"@osdk/monorepo.api-extractor": "~0.
|
|
39
|
-
"@osdk/monorepo.tsconfig": "~0.
|
|
38
|
+
"@osdk/monorepo.api-extractor": "~0.6.0-beta.1",
|
|
39
|
+
"@osdk/monorepo.tsconfig": "~0.6.0-beta.1"
|
|
40
40
|
},
|
|
41
41
|
"publishConfig": {
|
|
42
42
|
"access": "public"
|