@osdk/widget.api 3.1.0-beta.3 → 3.1.0-beta.5
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 +12 -0
- package/build/browser/config.js.map +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/manifest.js.map +1 -1
- package/build/cjs/index.d.cts +28 -3
- package/build/esm/config.js.map +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/manifest.js.map +1 -1
- package/build/types/config.d.ts +2 -1
- package/build/types/config.d.ts.map +1 -1
- package/build/types/index.d.ts +1 -1
- package/build/types/index.d.ts.map +1 -1
- package/build/types/manifest.d.ts +24 -0
- package/build/types/manifest.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @osdk/widget.api
|
|
2
2
|
|
|
3
|
+
## 3.1.0-beta.5
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- f173ee1: Improve widget client emitEvent types to more correctly extract event parameters
|
|
8
|
+
|
|
9
|
+
## 3.1.0-beta.4
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- 3744571: Discover widget set input specs
|
|
14
|
+
|
|
3
15
|
## 3.1.0-beta.3
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defineConfig","c"],"sources":["config.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 { ParameterValue } from \"./parameters.js\";\nimport type { AsyncValue } from \"./utils/asyncValue.js\";\n\ninterface PrimitiveParameterDefinition<T extends ParameterValue.PrimitiveType> {\n type: T;\n displayName: string;\n}\ninterface ArrayParameterDefinition<S extends ParameterValue.PrimitiveType> {\n type: ParameterValue.Array[\"type\"];\n displayName: string;\n subType: S;\n}\nexport type ParameterDefinition =\n | PrimitiveParameterDefinition<ParameterValue.PrimitiveType>\n | ArrayParameterDefinition<ParameterValue.PrimitiveType>;\n\nexport interface EventDefinition<P extends ParameterConfig> {\n displayName: string;\n parameterUpdateIds: Array<ParameterId<P>>;\n}\n\nexport type ParameterConfig = Record<string, ParameterDefinition>;\n\nexport interface WidgetConfig<P extends ParameterConfig> {\n id: string;\n name: string;\n description?: string;\n // TODO: Add specific config for each type of widget. For now, all the config is generic and can be used by any widget.\n type: \"workshop\";\n parameters: ParameterConfig;\n events: { [eventId: string]: EventDefinition<NoInfer<P>> };\n}\n\n/**\n * Extracts the parameter ID strings as types from the given ParameterConfig.\n */\nexport type ParameterId<C extends ParameterConfig> = Extract<keyof C, string>;\n\n/**\n * Extracts a map of parameter IDs to their async-wrapped value types from the given ParameterConfig.\n */\nexport type AsyncParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S>\n // If it's an array, pull out the subtype correctly\n ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: \"array\";\n subType: S;\n value: AsyncValue<P>;\n }\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: C[\"parameters\"][K][\"type\"];\n value: AsyncValue<P>;\n }\n : never;\n};\n\n/**\n * Extracts a map of parameter IDs to the raw parameter values from the given ParameterConfig.\n */\nexport type ParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S> ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never;\n};\n\nexport type EventId<C extends WidgetConfig<C[\"parameters\"]>> =\n keyof C[\"events\"];\n\n/**\n * Extracts a list of strongly-typed parameter IDs from the given WidgetConfig for a given event ID.\n * If a parameter ID is referenced by an event but does not exist, its type will be never\n */\nexport type EventParameterIdList<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = C[\"events\"][K][\"parameterUpdateIds\"] extends\n Array<ParameterId<C[\"parameters\"]>> ? C[\"events\"][K][\"parameterUpdateIds\"]\n : never;\n\n/**\n * Extracts a map of event IDs to their raw parameter value types from the given WidgetConfig.\n */\nexport type EventParameterValueMap<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = {\n
|
|
1
|
+
{"version":3,"file":"config.js","names":["defineConfig","c"],"sources":["config.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 { ParameterValue } from \"./parameters.js\";\nimport type { AsyncValue } from \"./utils/asyncValue.js\";\n\ninterface PrimitiveParameterDefinition<T extends ParameterValue.PrimitiveType> {\n type: T;\n displayName: string;\n}\ninterface ArrayParameterDefinition<S extends ParameterValue.PrimitiveType> {\n type: ParameterValue.Array[\"type\"];\n displayName: string;\n subType: S;\n}\nexport type ParameterDefinition =\n | PrimitiveParameterDefinition<ParameterValue.PrimitiveType>\n | ArrayParameterDefinition<ParameterValue.PrimitiveType>;\n\nexport interface EventDefinition<P extends ParameterConfig> {\n displayName: string;\n parameterUpdateIds: Array<ParameterId<P>>;\n}\n\nexport type ParameterConfig = Record<string, ParameterDefinition>;\n\nexport interface WidgetConfig<P extends ParameterConfig> {\n id: string;\n name: string;\n description?: string;\n // TODO: Add specific config for each type of widget. For now, all the config is generic and can be used by any widget.\n type: \"workshop\";\n parameters: ParameterConfig;\n events: { [eventId: string]: EventDefinition<NoInfer<P>> };\n}\n\n/**\n * Extracts the parameter ID strings as types from the given ParameterConfig.\n */\nexport type ParameterId<C extends ParameterConfig> = Extract<keyof C, string>;\n\n/**\n * Extracts a map of parameter IDs to their async-wrapped value types from the given ParameterConfig.\n */\nexport type AsyncParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S>\n // If it's an array, pull out the subtype correctly\n ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: \"array\";\n subType: S;\n value: AsyncValue<P>;\n }\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: C[\"parameters\"][K][\"type\"];\n value: AsyncValue<P>;\n }\n : never;\n};\n\n/**\n * Extracts a map of parameter IDs to the raw parameter values from the given ParameterConfig.\n */\nexport type ParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S> ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never;\n};\n\nexport type EventId<C extends WidgetConfig<C[\"parameters\"]>> =\n keyof C[\"events\"];\n\n/**\n * Extracts a list of strongly-typed parameter IDs from the given WidgetConfig for a given event ID.\n * If a parameter ID is referenced by an event but does not exist, its type will be never\n */\nexport type EventParameterIdList<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = C[\"events\"][K][\"parameterUpdateIds\"] extends\n Array<ParameterId<C[\"parameters\"]>> ? C[\"events\"][K][\"parameterUpdateIds\"]\n : never;\n\n/**\n * Extracts a map of event IDs to their raw parameter value types from the given WidgetConfig.\n */\nexport type EventParameterValueMap<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = NotEmptyObject<\n {\n [P in EventParameterIdList<C, K>[number]]: ParameterValueMap<C>[P];\n }\n>;\n\ntype NotEmptyObject<T extends Record<string, any>> = T extends\n Record<string, never> ? Record<string, never>\n : T;\n\nexport function defineConfig<const C extends WidgetConfig<any>>(c: C): C {\n return c as any;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;;AAGA;AACA;AACA;;AA2BA;AACA;AACA;;AAqBA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAcA,OAAO,SAASA,YAAYA,CAAoCC,CAAI,EAAK;EACvE,OAAOA,CAAC;AACV","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defineConfig","MANIFEST_FILE_LOCATION","HostMessage","isHostParametersUpdatedMessage","visitHostMessage","isWidgetEmitEventMessage","isWidgetReadyMessage","visitWidgetMessage"],"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 AsyncParameterValueMap,\n EventId,\n EventParameterValueMap,\n ParameterConfig,\n ParameterDefinition,\n ParameterValueMap,\n WidgetConfig,\n} from \"./config.js\";\nexport { defineConfig } from \"./config.js\";\nexport type {\n WidgetManifestConfigV1 as WidgetManifestConfig,\n WidgetSetManifestV1 as WidgetSetManifest,\n} from \"./manifest.js\";\nexport { MANIFEST_FILE_LOCATION } from \"./manifest.js\";\nexport {\n HostMessage,\n isHostParametersUpdatedMessage,\n visitHostMessage,\n} from \"./messages/hostMessages.js\";\nexport {\n isWidgetEmitEventMessage,\n isWidgetReadyMessage,\n visitWidgetMessage,\n} from \"./messages/widgetMessages.js\";\nexport type { WidgetMessage } from \"./messages/widgetMessages.js\";\nexport type { ParameterValue } from \"./parameters.js\";\nexport type {\n AsyncFailedValue,\n AsyncLoadedValue,\n AsyncLoadingValue,\n AsyncNotStartedLoadingValue,\n AsyncReloadingValue,\n AsyncValue,\n} from \"./utils/asyncValue.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,YAAY,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineConfig","MANIFEST_FILE_LOCATION","HostMessage","isHostParametersUpdatedMessage","visitHostMessage","isWidgetEmitEventMessage","isWidgetReadyMessage","visitWidgetMessage"],"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 AsyncParameterValueMap,\n EventId,\n EventParameterValueMap,\n ParameterConfig,\n ParameterDefinition,\n ParameterValueMap,\n WidgetConfig,\n} from \"./config.js\";\nexport { defineConfig } from \"./config.js\";\nexport type {\n OntologySdkInputSpecV1 as OntologySdkInputSpec,\n WidgetManifestConfigV1 as WidgetManifestConfig,\n WidgetSetDiscoveredInputSpecV1 as WidgetSetDiscoveredInputSpec,\n WidgetSetInputSpecV1 as WidgetSetInputSpec,\n WidgetSetManifestV1 as WidgetSetManifest,\n} from \"./manifest.js\";\nexport { MANIFEST_FILE_LOCATION } from \"./manifest.js\";\nexport {\n HostMessage,\n isHostParametersUpdatedMessage,\n visitHostMessage,\n} from \"./messages/hostMessages.js\";\nexport {\n isWidgetEmitEventMessage,\n isWidgetReadyMessage,\n visitWidgetMessage,\n} from \"./messages/widgetMessages.js\";\nexport type { WidgetMessage } from \"./messages/widgetMessages.js\";\nexport type { ParameterValue } from \"./parameters.js\";\nexport type {\n AsyncFailedValue,\n AsyncLoadedValue,\n AsyncLoadingValue,\n AsyncNotStartedLoadingValue,\n AsyncReloadingValue,\n AsyncValue,\n} from \"./utils/asyncValue.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,YAAY,QAAQ,aAAa;AAQ1C,SAASC,sBAAsB,QAAQ,eAAe;AACtD,SACEC,WAAW,EACXC,8BAA8B,EAC9BC,gBAAgB,QACX,4BAA4B;AACnC,SACEC,wBAAwB,EACxBC,oBAAoB,EACpBC,kBAAkB,QACb,8BAA8B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","names":["MANIFEST_FILE_LOCATION"],"sources":["manifest.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 {\n EventDefinition,\n ParameterConfig,\n ParameterDefinition,\n} from \"./config.js\";\n\nexport interface WidgetSetManifestV1 {\n manifestVersion: \"1.0.0\";\n widgetSet: WidgetSetManifestContentV1;\n}\n\nexport interface WidgetSetManifestContentV1 {\n /**\n * RID of the widget set that this config corresponds to\n */\n rid: string;\n\n /**\n * The version of the widget to publish as\n */\n version: string;\n\n /**\n * Set of widgets that are available to be rendered.\n * The key can be arbitrary, and is usually the name of your entrypoint, e.g. \"main\"\n */\n widgets: Record<string, WidgetManifestConfigV1>;\n}\n\nexport interface WidgetManifestConfigV1 {\n /**\n * The ID of this widget. Must be unique within the widget set\n */\n id: string;\n\n /**\n * The user friendly name of this widget\n */\n name: string;\n\n /**\n * A user friendly description of this widget\n */\n description?: string;\n\n /**\n * The target Foundry UI that this widget is intended to be used in\n */\n type: \"workshopWidgetV1\";\n\n /**\n * List of entrypoint JS files to be loaded, in order. These will be placed on the page in script tags\n */\n entrypointJs: Array<{\n /** Relative path of the JS file to load */\n path: string;\n\n /** The type to use in the script tag when loading this JS file */\n type: \"module\" | \"text/javascript\";\n }>;\n\n /**\n * Any CSS files to be loaded, in order.\n * @optional\n */\n entrypointCss?: Array<{\n /** Relative path of the CSS file to load */\n path: string;\n }>;\n\n /**\n * The map of parameter IDs to their definition\n */\n parameters: Record<string, ParameterDefinition>;\n\n /**\n * The map of events to their definition. Any parameter IDs referenced must be defined in the `parameters` field\n */\n events: Record<string, EventDefinition<ParameterConfig>>;\n}\n\nexport const MANIFEST_FILE_LOCATION = \".palantir/widgets.config.json\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"manifest.js","names":["MANIFEST_FILE_LOCATION"],"sources":["manifest.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 {\n EventDefinition,\n ParameterConfig,\n ParameterDefinition,\n} from \"./config.js\";\n\nexport interface WidgetSetManifestV1 {\n manifestVersion: \"1.0.0\";\n widgetSet: WidgetSetManifestContentV1;\n}\n\nexport interface WidgetSetManifestContentV1 {\n /**\n * RID of the widget set that this config corresponds to\n */\n rid: string;\n\n /**\n * The version of the widget to publish as\n */\n version: string;\n\n /**\n * Set of widgets that are available to be rendered.\n * The key can be arbitrary, and is usually the name of your entrypoint, e.g. \"main\"\n */\n widgets: Record<string, WidgetManifestConfigV1>;\n\n /**\n * The input specification for Foundry data required by the widget set.\n * @optional\n */\n inputSpec?: WidgetSetInputSpecV1;\n}\n\nexport interface WidgetManifestConfigV1 {\n /**\n * The ID of this widget. Must be unique within the widget set\n */\n id: string;\n\n /**\n * The user friendly name of this widget\n */\n name: string;\n\n /**\n * A user friendly description of this widget\n */\n description?: string;\n\n /**\n * The target Foundry UI that this widget is intended to be used in\n */\n type: \"workshopWidgetV1\";\n\n /**\n * List of entrypoint JS files to be loaded, in order. These will be placed on the page in script tags\n */\n entrypointJs: Array<{\n /** Relative path of the JS file to load */\n path: string;\n\n /** The type to use in the script tag when loading this JS file */\n type: \"module\" | \"text/javascript\";\n }>;\n\n /**\n * Any CSS files to be loaded, in order.\n * @optional\n */\n entrypointCss?: Array<{\n /** Relative path of the CSS file to load */\n path: string;\n }>;\n\n /**\n * The map of parameter IDs to their definition\n */\n parameters: Record<string, ParameterDefinition>;\n\n /**\n * The map of events to their definition. Any parameter IDs referenced must be defined in the `parameters` field\n */\n events: Record<string, EventDefinition<ParameterConfig>>;\n}\n\nexport interface WidgetSetInputSpecV1 {\n /**\n * The input specification for the widget set that was automatically discovered from the project's dependencies.\n * @optional\n */\n discovered?: WidgetSetDiscoveredInputSpecV1;\n}\n\nexport interface WidgetSetDiscoveredInputSpecV1 {\n /**\n * The discovered Ontology SDK packages in the project's dependencies.\n */\n sdks: Array<OntologySdkInputSpecV1>;\n}\n\nexport interface OntologySdkInputSpecV1 {\n /** The Ontology SDK package rid */\n rid: string;\n /** The Ontology SDK package version */\n version: string;\n}\n\nexport const MANIFEST_FILE_LOCATION = \".palantir/widgets.config.json\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+GA,OAAO,MAAMA,sBAAsB,GAAG,+BAA+B","ignoreList":[]}
|
package/build/cjs/index.d.cts
CHANGED
|
@@ -140,9 +140,10 @@ type EventParameterIdList<C extends WidgetConfig<C["parameters"]>, K extends Eve
|
|
|
140
140
|
/**
|
|
141
141
|
* Extracts a map of event IDs to their raw parameter value types from the given WidgetConfig.
|
|
142
142
|
*/
|
|
143
|
-
type EventParameterValueMap<C extends WidgetConfig<C["parameters"]>, K extends EventId<C>> = {
|
|
143
|
+
type EventParameterValueMap<C extends WidgetConfig<C["parameters"]>, K extends EventId<C>> = NotEmptyObject<{
|
|
144
144
|
[P in EventParameterIdList<C, K>[number]]: ParameterValueMap<C>[P];
|
|
145
|
-
}
|
|
145
|
+
}>;
|
|
146
|
+
type NotEmptyObject<T extends Record<string, any>> = T extends Record<string, never> ? Record<string, never> : T;
|
|
146
147
|
declare function defineConfig<const C extends WidgetConfig<any>>(c: C): C;
|
|
147
148
|
|
|
148
149
|
interface WidgetSetManifestV1 {
|
|
@@ -163,6 +164,11 @@ interface WidgetSetManifestContentV1 {
|
|
|
163
164
|
* The key can be arbitrary, and is usually the name of your entrypoint, e.g. "main"
|
|
164
165
|
*/
|
|
165
166
|
widgets: Record<string, WidgetManifestConfigV1>;
|
|
167
|
+
/**
|
|
168
|
+
* The input specification for Foundry data required by the widget set.
|
|
169
|
+
* @optional
|
|
170
|
+
*/
|
|
171
|
+
inputSpec?: WidgetSetInputSpecV1;
|
|
166
172
|
}
|
|
167
173
|
interface WidgetManifestConfigV1 {
|
|
168
174
|
/**
|
|
@@ -207,6 +213,25 @@ interface WidgetManifestConfigV1 {
|
|
|
207
213
|
*/
|
|
208
214
|
events: Record<string, EventDefinition<ParameterConfig>>;
|
|
209
215
|
}
|
|
216
|
+
interface WidgetSetInputSpecV1 {
|
|
217
|
+
/**
|
|
218
|
+
* The input specification for the widget set that was automatically discovered from the project's dependencies.
|
|
219
|
+
* @optional
|
|
220
|
+
*/
|
|
221
|
+
discovered?: WidgetSetDiscoveredInputSpecV1;
|
|
222
|
+
}
|
|
223
|
+
interface WidgetSetDiscoveredInputSpecV1 {
|
|
224
|
+
/**
|
|
225
|
+
* The discovered Ontology SDK packages in the project's dependencies.
|
|
226
|
+
*/
|
|
227
|
+
sdks: Array<OntologySdkInputSpecV1>;
|
|
228
|
+
}
|
|
229
|
+
interface OntologySdkInputSpecV1 {
|
|
230
|
+
/** The Ontology SDK package rid */
|
|
231
|
+
rid: string;
|
|
232
|
+
/** The Ontology SDK package version */
|
|
233
|
+
version: string;
|
|
234
|
+
}
|
|
210
235
|
declare const MANIFEST_FILE_LOCATION = ".palantir/widgets.config.json";
|
|
211
236
|
|
|
212
237
|
interface HostBaseMessage<T extends string, P = unknown> {
|
|
@@ -284,4 +309,4 @@ type WidgetMessageVisitor<C extends WidgetConfig<C["parameters"]>> = {
|
|
|
284
309
|
};
|
|
285
310
|
declare function visitWidgetMessage<C extends WidgetConfig<C["parameters"]>>(message: WidgetMessage<C>, visitor: WidgetMessageVisitor<C>): void;
|
|
286
311
|
|
|
287
|
-
export { type AsyncFailedValue, type AsyncLoadedValue, type AsyncLoadingValue, type AsyncNotStartedLoadingValue, type AsyncParameterValueMap, type AsyncReloadingValue, type AsyncValue, type EventId, type EventParameterValueMap, HostMessage, MANIFEST_FILE_LOCATION, type ParameterConfig, type ParameterDefinition, ParameterValue, type ParameterValueMap, type WidgetConfig, type WidgetManifestConfigV1 as WidgetManifestConfig, WidgetMessage, type WidgetSetManifestV1 as WidgetSetManifest, defineConfig, isHostParametersUpdatedMessage, isWidgetEmitEventMessage, isWidgetReadyMessage, visitHostMessage, visitWidgetMessage };
|
|
312
|
+
export { type AsyncFailedValue, type AsyncLoadedValue, type AsyncLoadingValue, type AsyncNotStartedLoadingValue, type AsyncParameterValueMap, type AsyncReloadingValue, type AsyncValue, type EventId, type EventParameterValueMap, HostMessage, MANIFEST_FILE_LOCATION, type OntologySdkInputSpecV1 as OntologySdkInputSpec, type ParameterConfig, type ParameterDefinition, ParameterValue, type ParameterValueMap, type WidgetConfig, type WidgetManifestConfigV1 as WidgetManifestConfig, WidgetMessage, type WidgetSetDiscoveredInputSpecV1 as WidgetSetDiscoveredInputSpec, type WidgetSetInputSpecV1 as WidgetSetInputSpec, type WidgetSetManifestV1 as WidgetSetManifest, defineConfig, isHostParametersUpdatedMessage, isWidgetEmitEventMessage, isWidgetReadyMessage, visitHostMessage, visitWidgetMessage };
|
package/build/esm/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","names":["defineConfig","c"],"sources":["config.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 { ParameterValue } from \"./parameters.js\";\nimport type { AsyncValue } from \"./utils/asyncValue.js\";\n\ninterface PrimitiveParameterDefinition<T extends ParameterValue.PrimitiveType> {\n type: T;\n displayName: string;\n}\ninterface ArrayParameterDefinition<S extends ParameterValue.PrimitiveType> {\n type: ParameterValue.Array[\"type\"];\n displayName: string;\n subType: S;\n}\nexport type ParameterDefinition =\n | PrimitiveParameterDefinition<ParameterValue.PrimitiveType>\n | ArrayParameterDefinition<ParameterValue.PrimitiveType>;\n\nexport interface EventDefinition<P extends ParameterConfig> {\n displayName: string;\n parameterUpdateIds: Array<ParameterId<P>>;\n}\n\nexport type ParameterConfig = Record<string, ParameterDefinition>;\n\nexport interface WidgetConfig<P extends ParameterConfig> {\n id: string;\n name: string;\n description?: string;\n // TODO: Add specific config for each type of widget. For now, all the config is generic and can be used by any widget.\n type: \"workshop\";\n parameters: ParameterConfig;\n events: { [eventId: string]: EventDefinition<NoInfer<P>> };\n}\n\n/**\n * Extracts the parameter ID strings as types from the given ParameterConfig.\n */\nexport type ParameterId<C extends ParameterConfig> = Extract<keyof C, string>;\n\n/**\n * Extracts a map of parameter IDs to their async-wrapped value types from the given ParameterConfig.\n */\nexport type AsyncParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S>\n // If it's an array, pull out the subtype correctly\n ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: \"array\";\n subType: S;\n value: AsyncValue<P>;\n }\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: C[\"parameters\"][K][\"type\"];\n value: AsyncValue<P>;\n }\n : never;\n};\n\n/**\n * Extracts a map of parameter IDs to the raw parameter values from the given ParameterConfig.\n */\nexport type ParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S> ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never;\n};\n\nexport type EventId<C extends WidgetConfig<C[\"parameters\"]>> =\n keyof C[\"events\"];\n\n/**\n * Extracts a list of strongly-typed parameter IDs from the given WidgetConfig for a given event ID.\n * If a parameter ID is referenced by an event but does not exist, its type will be never\n */\nexport type EventParameterIdList<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = C[\"events\"][K][\"parameterUpdateIds\"] extends\n Array<ParameterId<C[\"parameters\"]>> ? C[\"events\"][K][\"parameterUpdateIds\"]\n : never;\n\n/**\n * Extracts a map of event IDs to their raw parameter value types from the given WidgetConfig.\n */\nexport type EventParameterValueMap<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = {\n
|
|
1
|
+
{"version":3,"file":"config.js","names":["defineConfig","c"],"sources":["config.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 { ParameterValue } from \"./parameters.js\";\nimport type { AsyncValue } from \"./utils/asyncValue.js\";\n\ninterface PrimitiveParameterDefinition<T extends ParameterValue.PrimitiveType> {\n type: T;\n displayName: string;\n}\ninterface ArrayParameterDefinition<S extends ParameterValue.PrimitiveType> {\n type: ParameterValue.Array[\"type\"];\n displayName: string;\n subType: S;\n}\nexport type ParameterDefinition =\n | PrimitiveParameterDefinition<ParameterValue.PrimitiveType>\n | ArrayParameterDefinition<ParameterValue.PrimitiveType>;\n\nexport interface EventDefinition<P extends ParameterConfig> {\n displayName: string;\n parameterUpdateIds: Array<ParameterId<P>>;\n}\n\nexport type ParameterConfig = Record<string, ParameterDefinition>;\n\nexport interface WidgetConfig<P extends ParameterConfig> {\n id: string;\n name: string;\n description?: string;\n // TODO: Add specific config for each type of widget. For now, all the config is generic and can be used by any widget.\n type: \"workshop\";\n parameters: ParameterConfig;\n events: { [eventId: string]: EventDefinition<NoInfer<P>> };\n}\n\n/**\n * Extracts the parameter ID strings as types from the given ParameterConfig.\n */\nexport type ParameterId<C extends ParameterConfig> = Extract<keyof C, string>;\n\n/**\n * Extracts a map of parameter IDs to their async-wrapped value types from the given ParameterConfig.\n */\nexport type AsyncParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S>\n // If it's an array, pull out the subtype correctly\n ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: \"array\";\n subType: S;\n value: AsyncValue<P>;\n }\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? {\n type: C[\"parameters\"][K][\"type\"];\n value: AsyncValue<P>;\n }\n : never;\n};\n\n/**\n * Extracts a map of parameter IDs to the raw parameter values from the given ParameterConfig.\n */\nexport type ParameterValueMap<C extends WidgetConfig<C[\"parameters\"]>> = {\n [\n K in ParameterId<\n C[\"parameters\"]\n >\n ]: C[\"parameters\"][K] extends ArrayParameterDefinition<infer S> ? Extract<\n ParameterValue.Array,\n { type: C[\"parameters\"][K][\"type\"]; subType: S }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never\n : Extract<\n ParameterValue,\n { type: C[\"parameters\"][K][\"type\"] }\n >[\"value\"] extends AsyncValue<infer P> ? P\n : never;\n};\n\nexport type EventId<C extends WidgetConfig<C[\"parameters\"]>> =\n keyof C[\"events\"];\n\n/**\n * Extracts a list of strongly-typed parameter IDs from the given WidgetConfig for a given event ID.\n * If a parameter ID is referenced by an event but does not exist, its type will be never\n */\nexport type EventParameterIdList<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = C[\"events\"][K][\"parameterUpdateIds\"] extends\n Array<ParameterId<C[\"parameters\"]>> ? C[\"events\"][K][\"parameterUpdateIds\"]\n : never;\n\n/**\n * Extracts a map of event IDs to their raw parameter value types from the given WidgetConfig.\n */\nexport type EventParameterValueMap<\n C extends WidgetConfig<C[\"parameters\"]>,\n K extends EventId<C>,\n> = NotEmptyObject<\n {\n [P in EventParameterIdList<C, K>[number]]: ParameterValueMap<C>[P];\n }\n>;\n\ntype NotEmptyObject<T extends Record<string, any>> = T extends\n Record<string, never> ? Record<string, never>\n : T;\n\nexport function defineConfig<const C extends WidgetConfig<any>>(c: C): C {\n return c as any;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmCA;AACA;AACA;;AAGA;AACA;AACA;;AA2BA;AACA;AACA;;AAqBA;AACA;AACA;AACA;;AAQA;AACA;AACA;;AAcA,OAAO,SAASA,YAAYA,CAAoCC,CAAI,EAAK;EACvE,OAAOA,CAAC;AACV","ignoreList":[]}
|
package/build/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defineConfig","MANIFEST_FILE_LOCATION","HostMessage","isHostParametersUpdatedMessage","visitHostMessage","isWidgetEmitEventMessage","isWidgetReadyMessage","visitWidgetMessage"],"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 AsyncParameterValueMap,\n EventId,\n EventParameterValueMap,\n ParameterConfig,\n ParameterDefinition,\n ParameterValueMap,\n WidgetConfig,\n} from \"./config.js\";\nexport { defineConfig } from \"./config.js\";\nexport type {\n WidgetManifestConfigV1 as WidgetManifestConfig,\n WidgetSetManifestV1 as WidgetSetManifest,\n} from \"./manifest.js\";\nexport { MANIFEST_FILE_LOCATION } from \"./manifest.js\";\nexport {\n HostMessage,\n isHostParametersUpdatedMessage,\n visitHostMessage,\n} from \"./messages/hostMessages.js\";\nexport {\n isWidgetEmitEventMessage,\n isWidgetReadyMessage,\n visitWidgetMessage,\n} from \"./messages/widgetMessages.js\";\nexport type { WidgetMessage } from \"./messages/widgetMessages.js\";\nexport type { ParameterValue } from \"./parameters.js\";\nexport type {\n AsyncFailedValue,\n AsyncLoadedValue,\n AsyncLoadingValue,\n AsyncNotStartedLoadingValue,\n AsyncReloadingValue,\n AsyncValue,\n} from \"./utils/asyncValue.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,YAAY,QAAQ,aAAa;
|
|
1
|
+
{"version":3,"file":"index.js","names":["defineConfig","MANIFEST_FILE_LOCATION","HostMessage","isHostParametersUpdatedMessage","visitHostMessage","isWidgetEmitEventMessage","isWidgetReadyMessage","visitWidgetMessage"],"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 AsyncParameterValueMap,\n EventId,\n EventParameterValueMap,\n ParameterConfig,\n ParameterDefinition,\n ParameterValueMap,\n WidgetConfig,\n} from \"./config.js\";\nexport { defineConfig } from \"./config.js\";\nexport type {\n OntologySdkInputSpecV1 as OntologySdkInputSpec,\n WidgetManifestConfigV1 as WidgetManifestConfig,\n WidgetSetDiscoveredInputSpecV1 as WidgetSetDiscoveredInputSpec,\n WidgetSetInputSpecV1 as WidgetSetInputSpec,\n WidgetSetManifestV1 as WidgetSetManifest,\n} from \"./manifest.js\";\nexport { MANIFEST_FILE_LOCATION } from \"./manifest.js\";\nexport {\n HostMessage,\n isHostParametersUpdatedMessage,\n visitHostMessage,\n} from \"./messages/hostMessages.js\";\nexport {\n isWidgetEmitEventMessage,\n isWidgetReadyMessage,\n visitWidgetMessage,\n} from \"./messages/widgetMessages.js\";\nexport type { WidgetMessage } from \"./messages/widgetMessages.js\";\nexport type { ParameterValue } from \"./parameters.js\";\nexport type {\n AsyncFailedValue,\n AsyncLoadedValue,\n AsyncLoadingValue,\n AsyncNotStartedLoadingValue,\n AsyncReloadingValue,\n AsyncValue,\n} from \"./utils/asyncValue.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,YAAY,QAAQ,aAAa;AAQ1C,SAASC,sBAAsB,QAAQ,eAAe;AACtD,SACEC,WAAW,EACXC,8BAA8B,EAC9BC,gBAAgB,QACX,4BAA4B;AACnC,SACEC,wBAAwB,EACxBC,oBAAoB,EACpBC,kBAAkB,QACb,8BAA8B","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","names":["MANIFEST_FILE_LOCATION"],"sources":["manifest.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 {\n EventDefinition,\n ParameterConfig,\n ParameterDefinition,\n} from \"./config.js\";\n\nexport interface WidgetSetManifestV1 {\n manifestVersion: \"1.0.0\";\n widgetSet: WidgetSetManifestContentV1;\n}\n\nexport interface WidgetSetManifestContentV1 {\n /**\n * RID of the widget set that this config corresponds to\n */\n rid: string;\n\n /**\n * The version of the widget to publish as\n */\n version: string;\n\n /**\n * Set of widgets that are available to be rendered.\n * The key can be arbitrary, and is usually the name of your entrypoint, e.g. \"main\"\n */\n widgets: Record<string, WidgetManifestConfigV1>;\n}\n\nexport interface WidgetManifestConfigV1 {\n /**\n * The ID of this widget. Must be unique within the widget set\n */\n id: string;\n\n /**\n * The user friendly name of this widget\n */\n name: string;\n\n /**\n * A user friendly description of this widget\n */\n description?: string;\n\n /**\n * The target Foundry UI that this widget is intended to be used in\n */\n type: \"workshopWidgetV1\";\n\n /**\n * List of entrypoint JS files to be loaded, in order. These will be placed on the page in script tags\n */\n entrypointJs: Array<{\n /** Relative path of the JS file to load */\n path: string;\n\n /** The type to use in the script tag when loading this JS file */\n type: \"module\" | \"text/javascript\";\n }>;\n\n /**\n * Any CSS files to be loaded, in order.\n * @optional\n */\n entrypointCss?: Array<{\n /** Relative path of the CSS file to load */\n path: string;\n }>;\n\n /**\n * The map of parameter IDs to their definition\n */\n parameters: Record<string, ParameterDefinition>;\n\n /**\n * The map of events to their definition. Any parameter IDs referenced must be defined in the `parameters` field\n */\n events: Record<string, EventDefinition<ParameterConfig>>;\n}\n\nexport const MANIFEST_FILE_LOCATION = \".palantir/widgets.config.json\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"manifest.js","names":["MANIFEST_FILE_LOCATION"],"sources":["manifest.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 {\n EventDefinition,\n ParameterConfig,\n ParameterDefinition,\n} from \"./config.js\";\n\nexport interface WidgetSetManifestV1 {\n manifestVersion: \"1.0.0\";\n widgetSet: WidgetSetManifestContentV1;\n}\n\nexport interface WidgetSetManifestContentV1 {\n /**\n * RID of the widget set that this config corresponds to\n */\n rid: string;\n\n /**\n * The version of the widget to publish as\n */\n version: string;\n\n /**\n * Set of widgets that are available to be rendered.\n * The key can be arbitrary, and is usually the name of your entrypoint, e.g. \"main\"\n */\n widgets: Record<string, WidgetManifestConfigV1>;\n\n /**\n * The input specification for Foundry data required by the widget set.\n * @optional\n */\n inputSpec?: WidgetSetInputSpecV1;\n}\n\nexport interface WidgetManifestConfigV1 {\n /**\n * The ID of this widget. Must be unique within the widget set\n */\n id: string;\n\n /**\n * The user friendly name of this widget\n */\n name: string;\n\n /**\n * A user friendly description of this widget\n */\n description?: string;\n\n /**\n * The target Foundry UI that this widget is intended to be used in\n */\n type: \"workshopWidgetV1\";\n\n /**\n * List of entrypoint JS files to be loaded, in order. These will be placed on the page in script tags\n */\n entrypointJs: Array<{\n /** Relative path of the JS file to load */\n path: string;\n\n /** The type to use in the script tag when loading this JS file */\n type: \"module\" | \"text/javascript\";\n }>;\n\n /**\n * Any CSS files to be loaded, in order.\n * @optional\n */\n entrypointCss?: Array<{\n /** Relative path of the CSS file to load */\n path: string;\n }>;\n\n /**\n * The map of parameter IDs to their definition\n */\n parameters: Record<string, ParameterDefinition>;\n\n /**\n * The map of events to their definition. Any parameter IDs referenced must be defined in the `parameters` field\n */\n events: Record<string, EventDefinition<ParameterConfig>>;\n}\n\nexport interface WidgetSetInputSpecV1 {\n /**\n * The input specification for the widget set that was automatically discovered from the project's dependencies.\n * @optional\n */\n discovered?: WidgetSetDiscoveredInputSpecV1;\n}\n\nexport interface WidgetSetDiscoveredInputSpecV1 {\n /**\n * The discovered Ontology SDK packages in the project's dependencies.\n */\n sdks: Array<OntologySdkInputSpecV1>;\n}\n\nexport interface OntologySdkInputSpecV1 {\n /** The Ontology SDK package rid */\n rid: string;\n /** The Ontology SDK package version */\n version: string;\n}\n\nexport const MANIFEST_FILE_LOCATION = \".palantir/widgets.config.json\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA+GA,OAAO,MAAMA,sBAAsB,GAAG,+BAA+B","ignoreList":[]}
|
package/build/types/config.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type EventParameterIdList<
|
|
|
69
69
|
export type EventParameterValueMap<
|
|
70
70
|
C extends WidgetConfig<C["parameters"]>,
|
|
71
71
|
K extends EventId<C>
|
|
72
|
-
> = { [P in EventParameterIdList<C, K>[number]] : ParameterValueMap<C>[P] }
|
|
72
|
+
> = NotEmptyObject<{ [P in EventParameterIdList<C, K>[number]] : ParameterValueMap<C>[P] }>;
|
|
73
|
+
type NotEmptyObject<T extends Record<string, any>> = T extends Record<string, never> ? Record<string, never> : T;
|
|
73
74
|
export declare function defineConfig<const C extends WidgetConfig<any>>(c: C): C;
|
|
74
75
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cAAc,sBAAsB,iBAAkB;AACtD,cAAc,kBAAkB,uBAAwB;UAE9C,6BAA6B,UAAU,eAAe,eAAe;CAC7E,MAAM;CACN;AACD;UACS,yBAAyB,UAAU,eAAe,eAAe;CACzE,MAAM,eAAe,MAAM;CAC3B;CACA,SAAS;AACV;AACD,YAAY,sBACR,6BAA6B,eAAe,iBAC5C,yBAAyB,eAAe;AAE5C,iBAAiB,gBAAgB,UAAU,iBAAiB;CAC1D;CACA,oBAAoB,MAAM,YAAY;AACvC;AAED,YAAY,kBAAkB,eAAe;AAE7C,iBAAiB,aAAa,UAAU,iBAAiB;CACvD;CACA;CACA;CAEA,MAAM;CACN,YAAY;CACZ,QAAQ;qBAAqB,gBAAgB,QAAQ;CAAK;AAC3D;;;;AAKD,YAAY,YAAY,UAAU,mBAAmB,cAAc;;;;AAKnE,YAAY,uBAAuB,UAAU,aAAa,EAAE,qBAExD,KAAK,YACH,EAAE,kBAEH,EAAE,cAAc,WAAW,+BAA+B,KAEzD,QACA,eAAe,OACf;CAAE,MAAM,EAAE,cAAc,GAAG;CAAS,SAAS;AAAG,GAChD,iBAAiB,iBAAiB,KAAK;CACrC,MAAM;CACN,SAAS;CACT,OAAO,WAAW;AACnB,YAED,QACA,gBACA;CAAE,MAAM,EAAE,cAAc,GAAG;AAAS,GACpC,iBAAiB,iBAAiB,KAAK;CACrC,MAAM,EAAE,cAAc,GAAG;CACzB,OAAO,WAAW;AACnB;;;;AAOP,YAAY,kBAAkB,UAAU,aAAa,EAAE,qBAEnD,KAAK,YACH,EAAE,kBAEH,EAAE,cAAc,WAAW,+BAA+B,KAAK,QAC9D,eAAe,OACf;CAAE,MAAM,EAAE,cAAc,GAAG;CAAS,SAAS;AAAG,GAChD,iBAAiB,iBAAiB,KAAK,YAEvC,QACA,gBACA;CAAE,MAAM,EAAE,cAAc,GAAG;AAAS,GACpC,iBAAiB,iBAAiB,KAAK;AAI7C,YAAY,QAAQ,UAAU,aAAa,EAAE,wBACrC,EAAE;;;;;AAMV,YAAY;CACV,UAAU,aAAa,EAAE;CACzB,UAAU,QAAQ;IAChB,EAAE,UAAU,GAAG,8BACjB,MAAM,YAAY,EAAE,kBAAkB,EAAE,UAAU,GAAG;;;;AAMvD,YAAY;CACV,UAAU,aAAa,EAAE;CACzB,UAAU,QAAQ;
|
|
1
|
+
{"mappings":"AAgBA,cAAc,sBAAsB,iBAAkB;AACtD,cAAc,kBAAkB,uBAAwB;UAE9C,6BAA6B,UAAU,eAAe,eAAe;CAC7E,MAAM;CACN;AACD;UACS,yBAAyB,UAAU,eAAe,eAAe;CACzE,MAAM,eAAe,MAAM;CAC3B;CACA,SAAS;AACV;AACD,YAAY,sBACR,6BAA6B,eAAe,iBAC5C,yBAAyB,eAAe;AAE5C,iBAAiB,gBAAgB,UAAU,iBAAiB;CAC1D;CACA,oBAAoB,MAAM,YAAY;AACvC;AAED,YAAY,kBAAkB,eAAe;AAE7C,iBAAiB,aAAa,UAAU,iBAAiB;CACvD;CACA;CACA;CAEA,MAAM;CACN,YAAY;CACZ,QAAQ;qBAAqB,gBAAgB,QAAQ;CAAK;AAC3D;;;;AAKD,YAAY,YAAY,UAAU,mBAAmB,cAAc;;;;AAKnE,YAAY,uBAAuB,UAAU,aAAa,EAAE,qBAExD,KAAK,YACH,EAAE,kBAEH,EAAE,cAAc,WAAW,+BAA+B,KAEzD,QACA,eAAe,OACf;CAAE,MAAM,EAAE,cAAc,GAAG;CAAS,SAAS;AAAG,GAChD,iBAAiB,iBAAiB,KAAK;CACrC,MAAM;CACN,SAAS;CACT,OAAO,WAAW;AACnB,YAED,QACA,gBACA;CAAE,MAAM,EAAE,cAAc,GAAG;AAAS,GACpC,iBAAiB,iBAAiB,KAAK;CACrC,MAAM,EAAE,cAAc,GAAG;CACzB,OAAO,WAAW;AACnB;;;;AAOP,YAAY,kBAAkB,UAAU,aAAa,EAAE,qBAEnD,KAAK,YACH,EAAE,kBAEH,EAAE,cAAc,WAAW,+BAA+B,KAAK,QAC9D,eAAe,OACf;CAAE,MAAM,EAAE,cAAc,GAAG;CAAS,SAAS;AAAG,GAChD,iBAAiB,iBAAiB,KAAK,YAEvC,QACA,gBACA;CAAE,MAAM,EAAE,cAAc,GAAG;AAAS,GACpC,iBAAiB,iBAAiB,KAAK;AAI7C,YAAY,QAAQ,UAAU,aAAa,EAAE,wBACrC,EAAE;;;;;AAMV,YAAY;CACV,UAAU,aAAa,EAAE;CACzB,UAAU,QAAQ;IAChB,EAAE,UAAU,GAAG,8BACjB,MAAM,YAAY,EAAE,kBAAkB,EAAE,UAAU,GAAG;;;;AAMvD,YAAY;CACV,UAAU,aAAa,EAAE;CACzB,UAAU,QAAQ;IAChB,kBAEC,KAAK,qBAAqB,GAAG,cAAa,kBAAkB,GAAG;KAI/D,eAAe,UAAU,uBAAuB,UACnD,wBAAwB,wBACtB;AAEJ,OAAO,iBAAS,mBAAmB,UAAU,mBAAmBA,GAAG,IAAI","names":["c: C"],"sources":["../../src/config.ts"],"version":3,"file":"config.d.ts"}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type { AsyncParameterValueMap, EventId, EventParameterValueMap, ParameterConfig, ParameterDefinition, ParameterValueMap, WidgetConfig } from "./config.js";
|
|
2
2
|
export { defineConfig } from "./config.js";
|
|
3
|
-
export type { WidgetManifestConfigV1 as WidgetManifestConfig, WidgetSetManifestV1 as WidgetSetManifest } from "./manifest.js";
|
|
3
|
+
export type { OntologySdkInputSpecV1 as OntologySdkInputSpec, WidgetManifestConfigV1 as WidgetManifestConfig, WidgetSetDiscoveredInputSpecV1 as WidgetSetDiscoveredInputSpec, WidgetSetInputSpecV1 as WidgetSetInputSpec, WidgetSetManifestV1 as WidgetSetManifest } from "./manifest.js";
|
|
4
4
|
export { MANIFEST_FILE_LOCATION } from "./manifest.js";
|
|
5
5
|
export { HostMessage, isHostParametersUpdatedMessage, visitHostMessage } from "./messages/hostMessages.js";
|
|
6
6
|
export { isWidgetEmitEventMessage, isWidgetReadyMessage, visitWidgetMessage } from "./messages/widgetMessages.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,wBACA,SACA,wBACA,iBACA,qBACA,mBACA,oBACK;AACP,SAAS,oBAAoB;AAC7B,cACE,0BAA0B,sBAC1B,uBAAuB,yBAClB;AACP,SAAS,8BAA8B;AACvC,SACE,aACA,gCACA,wBACK;AACP,SACE,0BACA,sBACA,0BACK;AACP,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cACE,kBACA,kBACA,mBACA,6BACA,qBACA,kBACK","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
1
|
+
{"mappings":"AAgBA,cACE,wBACA,SACA,wBACA,iBACA,qBACA,mBACA,oBACK;AACP,SAAS,oBAAoB;AAC7B,cACE,0BAA0B,sBAC1B,0BAA0B,sBAC1B,kCAAkC,8BAClC,wBAAwB,oBACxB,uBAAuB,yBAClB;AACP,SAAS,8BAA8B;AACvC,SACE,aACA,gCACA,wBACK;AACP,SACE,0BACA,sBACA,0BACK;AACP,cAAc,qBAAqB;AACnC,cAAc,sBAAsB;AACpC,cACE,kBACA,kBACA,mBACA,6BACA,qBACA,kBACK","names":[],"sources":["../../src/index.ts"],"version":3,"file":"index.d.ts"}
|
|
@@ -17,6 +17,11 @@ export interface WidgetSetManifestContentV1 {
|
|
|
17
17
|
* The key can be arbitrary, and is usually the name of your entrypoint, e.g. "main"
|
|
18
18
|
*/
|
|
19
19
|
widgets: Record<string, WidgetManifestConfigV1>;
|
|
20
|
+
/**
|
|
21
|
+
* The input specification for Foundry data required by the widget set.
|
|
22
|
+
* @optional
|
|
23
|
+
*/
|
|
24
|
+
inputSpec?: WidgetSetInputSpecV1;
|
|
20
25
|
}
|
|
21
26
|
export interface WidgetManifestConfigV1 {
|
|
22
27
|
/**
|
|
@@ -61,4 +66,23 @@ export interface WidgetManifestConfigV1 {
|
|
|
61
66
|
*/
|
|
62
67
|
events: Record<string, EventDefinition<ParameterConfig>>;
|
|
63
68
|
}
|
|
69
|
+
export interface WidgetSetInputSpecV1 {
|
|
70
|
+
/**
|
|
71
|
+
* The input specification for the widget set that was automatically discovered from the project's dependencies.
|
|
72
|
+
* @optional
|
|
73
|
+
*/
|
|
74
|
+
discovered?: WidgetSetDiscoveredInputSpecV1;
|
|
75
|
+
}
|
|
76
|
+
export interface WidgetSetDiscoveredInputSpecV1 {
|
|
77
|
+
/**
|
|
78
|
+
* The discovered Ontology SDK packages in the project's dependencies.
|
|
79
|
+
*/
|
|
80
|
+
sdks: Array<OntologySdkInputSpecV1>;
|
|
81
|
+
}
|
|
82
|
+
export interface OntologySdkInputSpecV1 {
|
|
83
|
+
/** The Ontology SDK package rid */
|
|
84
|
+
rid: string;
|
|
85
|
+
/** The Ontology SDK package version */
|
|
86
|
+
version: string;
|
|
87
|
+
}
|
|
64
88
|
export declare const MANIFEST_FILE_LOCATION = ".palantir/widgets.config.json";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"AAgBA,cACE,iBACA,iBACA,2BACK,aAAc;AAErB,iBAAiB,oBAAoB;CACnC,iBAAiB;CACjB,WAAW;AACZ;AAED,iBAAiB,2BAA2B;;;;CAI1C;;;;CAKA;;;;;CAMA,SAAS,eAAe;
|
|
1
|
+
{"mappings":"AAgBA,cACE,iBACA,iBACA,2BACK,aAAc;AAErB,iBAAiB,oBAAoB;CACnC,iBAAiB;CACjB,WAAW;AACZ;AAED,iBAAiB,2BAA2B;;;;CAI1C;;;;CAKA;;;;;CAMA,SAAS,eAAe;;;;;CAMxB,YAAY;AACb;AAED,iBAAiB,uBAAuB;;;;CAItC;;;;CAKA;;;;CAKA;;;;CAKA,MAAM;;;;CAKN,cAAc,MAAM;;EAElB;;EAGA,MAAM,WAAW;CAClB;;;;;CAMD,gBAAgB,MAAM;;EAEpB;CACD;;;;CAKD,YAAY,eAAe;;;;CAK3B,QAAQ,eAAe,gBAAgB;AACxC;AAED,iBAAiB,qBAAqB;;;;;CAKpC,aAAa;AACd;AAED,iBAAiB,+BAA+B;;;;CAI9C,MAAM,MAAM;AACb;AAED,iBAAiB,uBAAuB;;CAEtC;;CAEA;AACD;AAED,OAAO,cAAM,yBAAyB","names":[],"sources":["../../src/manifest.ts"],"version":3,"file":"manifest.d.ts"}
|
package/package.json
CHANGED