@osdk/react-sdk-docs 0.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.
@@ -0,0 +1,129 @@
1
+ /*
2
+ * Copyright 2026 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 { snippets } from "./generatedNoCheck/docsNoComputedVariables.js";
18
+ export const REACT_OSDK_SNIPPETS = {
19
+ ...snippets,
20
+ computedVariables: {
21
+ actionParameterSampleValuesV2: handleActionParameterSampleValuesV2,
22
+ propertyValueV2: handlePropertyValueV2,
23
+ primaryKeyPropertyV2: handlePrimaryKeyPropertyV2,
24
+ linkedPrimaryKeyPropertyV2: handleLinkedPrimaryKeyPropertyV2
25
+ }
26
+ };
27
+ function handleActionParameterSampleValuesV2({
28
+ rawActionTypeParameterValues
29
+ }) {
30
+ if (rawActionTypeParameterValues == null) {
31
+ throw new Error("Cannot render a null rawActionTypeParameterValues");
32
+ }
33
+ return rawActionTypeParameterValues.map((param, index, array) => ({
34
+ key: param.key,
35
+ value: renderType(param.value),
36
+ last: index === array.length - 1
37
+ }));
38
+ }
39
+ function handlePropertyValueV2({
40
+ rawPropertyValue
41
+ }) {
42
+ return renderPropertyValue(rawPropertyValue);
43
+ }
44
+ function handlePrimaryKeyPropertyV2({
45
+ rawPrimaryKeyProperty
46
+ }) {
47
+ if (rawPrimaryKeyProperty == null) {
48
+ throw new Error("Cannot render with null rawPrimaryKeyProperty");
49
+ }
50
+ return {
51
+ apiName: rawPrimaryKeyProperty.apiName,
52
+ value: renderPropertyValue(rawPrimaryKeyProperty.value)
53
+ };
54
+ }
55
+ function handleLinkedPrimaryKeyPropertyV2({
56
+ rawLinkedPrimaryKeyProperty
57
+ }) {
58
+ if (rawLinkedPrimaryKeyProperty == null) {
59
+ throw new Error("Cannot render with null rawLinkedPrimaryKeyProperty");
60
+ }
61
+ return {
62
+ apiName: rawLinkedPrimaryKeyProperty.apiName,
63
+ value: renderPropertyValue(rawLinkedPrimaryKeyProperty.value),
64
+ type: rawLinkedPrimaryKeyProperty.type
65
+ };
66
+ }
67
+ function renderPropertyValue(propertyValue) {
68
+ if (propertyValue == null) {
69
+ throw new Error("Cannot render a null property value");
70
+ }
71
+ return renderType(propertyValue);
72
+ }
73
+ function renderType(type) {
74
+ if (type == null) {
75
+ throw new Error("Cannot render a null type value");
76
+ }
77
+ switch (type.type) {
78
+ case "array":
79
+ case "set":
80
+ case "list":
81
+ return `[${renderType(type.subtype)}]`;
82
+ case "boolean":
83
+ return type.value ? "true" : "false";
84
+ case "byte":
85
+ case "integer":
86
+ case "long":
87
+ case "short":
88
+ return type.value.toString();
89
+ case "decimal":
90
+ case "double":
91
+ case "float":
92
+ return type.value.toString();
93
+ case "date":
94
+ {
95
+ const offsetDate = new Date();
96
+ offsetDate.setDate(offsetDate.getDate() + (type.daysOffset ?? 0));
97
+ return `"${offsetDate.toISOString().slice(0, 10)}"`;
98
+ }
99
+ case "timestamp":
100
+ {
101
+ const offsetDate = new Date();
102
+ offsetDate.setDate(offsetDate.getDate() + (type.daysOffset ?? 0));
103
+ return `"${offsetDate.toISOString()}"`;
104
+ }
105
+ case "object":
106
+ return `"primaryKeyValue" // or myObjectInstance`;
107
+ case "objectSet":
108
+ return `client(${type.objectTypeApiName}).where({ /* filter conditions */ })`;
109
+ case "anonymousCustomType":
110
+ case "customType":
111
+ case "interface":
112
+ case "marking":
113
+ return "{}";
114
+ case "attachment":
115
+ return type.hasAttachments ? "attachment" : "{}";
116
+ case "mediaReference":
117
+ return "mediaUpload";
118
+ case "objectType":
119
+ return `"${type.objectTypeApiName}"`;
120
+ case "map":
121
+ return `{key: ${renderType(type.valueType)}}`;
122
+ case "string":
123
+ return `"${type.value ?? "value"}"`;
124
+ case "unknown":
125
+ default:
126
+ return `"value"`;
127
+ }
128
+ }
129
+ //# sourceMappingURL=docs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"docs.js","names":["snippets","REACT_OSDK_SNIPPETS","computedVariables","actionParameterSampleValuesV2","handleActionParameterSampleValuesV2","propertyValueV2","handlePropertyValueV2","primaryKeyPropertyV2","handlePrimaryKeyPropertyV2","linkedPrimaryKeyPropertyV2","handleLinkedPrimaryKeyPropertyV2","rawActionTypeParameterValues","Error","map","param","index","array","key","value","renderType","last","length","rawPropertyValue","renderPropertyValue","rawPrimaryKeyProperty","apiName","rawLinkedPrimaryKeyProperty","type","propertyValue","subtype","toString","offsetDate","Date","setDate","getDate","daysOffset","toISOString","slice","objectTypeApiName","hasAttachments","valueType"],"sources":["docs.ts"],"sourcesContent":["/*\n * Copyright 2026 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 { SdkSnippets } from \"@osdk/docs-spec-core\";\nimport type {\n ActionParameterSampleValuesIR,\n ActionParameterSampleValueTypeIR,\n FunctionSampleValueTypeIR,\n OSDK_SNIPPETS_SPEC,\n PropertySampleIR,\n PropertySampleValueTypeIR,\n} from \"@osdk/docs-spec-sdk\";\nimport { snippets } from \"./generatedNoCheck/docsNoComputedVariables.js\";\n\nexport const REACT_OSDK_SNIPPETS: SdkSnippets<typeof OSDK_SNIPPETS_SPEC> = {\n ...snippets,\n computedVariables: {\n actionParameterSampleValuesV2: handleActionParameterSampleValuesV2,\n propertyValueV2: handlePropertyValueV2,\n primaryKeyPropertyV2: handlePrimaryKeyPropertyV2,\n linkedPrimaryKeyPropertyV2: handleLinkedPrimaryKeyPropertyV2,\n },\n};\n\nfunction handleActionParameterSampleValuesV2({\n rawActionTypeParameterValues,\n}: {\n rawActionTypeParameterValues?: ActionParameterSampleValuesIR;\n}): Array<{ key: string; value: string; last: boolean }> {\n if (rawActionTypeParameterValues == null) {\n throw new Error(\"Cannot render a null rawActionTypeParameterValues\");\n }\n\n return rawActionTypeParameterValues.map((param, index, array) => ({\n key: param.key,\n value: renderType(param.value),\n last: index === array.length - 1,\n }));\n}\n\nfunction handlePropertyValueV2({\n rawPropertyValue,\n}: {\n rawPropertyValue?: PropertySampleValueTypeIR;\n}): string {\n return renderPropertyValue(rawPropertyValue);\n}\n\nfunction handlePrimaryKeyPropertyV2({\n rawPrimaryKeyProperty,\n}: {\n rawPrimaryKeyProperty?: PropertySampleIR;\n}): { apiName: string; value: string } {\n if (rawPrimaryKeyProperty == null) {\n throw new Error(\"Cannot render with null rawPrimaryKeyProperty\");\n }\n\n return {\n apiName: rawPrimaryKeyProperty.apiName,\n value: renderPropertyValue(rawPrimaryKeyProperty.value),\n };\n}\n\nfunction handleLinkedPrimaryKeyPropertyV2({\n rawLinkedPrimaryKeyProperty,\n}: {\n rawLinkedPrimaryKeyProperty?: {\n apiName: string;\n value: PropertySampleValueTypeIR;\n type: string;\n };\n}): { apiName: string; value: string; type: string } {\n if (rawLinkedPrimaryKeyProperty == null) {\n throw new Error(\"Cannot render with null rawLinkedPrimaryKeyProperty\");\n }\n\n return {\n apiName: rawLinkedPrimaryKeyProperty.apiName,\n value: renderPropertyValue(rawLinkedPrimaryKeyProperty.value),\n type: rawLinkedPrimaryKeyProperty.type,\n };\n}\n\nfunction renderPropertyValue(\n propertyValue: PropertySampleValueTypeIR | undefined,\n): string {\n if (propertyValue == null) {\n throw new Error(\"Cannot render a null property value\");\n }\n\n return renderType(propertyValue);\n}\n\nfunction renderType(\n type:\n | ActionParameterSampleValueTypeIR\n | FunctionSampleValueTypeIR\n | PropertySampleValueTypeIR,\n): string {\n if (type == null) {\n throw new Error(\"Cannot render a null type value\");\n }\n\n switch (type.type) {\n case \"array\":\n case \"set\":\n case \"list\":\n return `[${renderType(type.subtype)}]`;\n case \"boolean\":\n return type.value ? \"true\" : \"false\";\n case \"byte\":\n case \"integer\":\n case \"long\":\n case \"short\":\n return type.value.toString();\n case \"decimal\":\n case \"double\":\n case \"float\":\n return type.value.toString();\n case \"date\": {\n const offsetDate = new Date();\n offsetDate.setDate(offsetDate.getDate() + (type.daysOffset ?? 0));\n return `\"${offsetDate.toISOString().slice(0, 10)}\"`;\n }\n case \"timestamp\": {\n const offsetDate = new Date();\n offsetDate.setDate(offsetDate.getDate() + (type.daysOffset ?? 0));\n return `\"${offsetDate.toISOString()}\"`;\n }\n case \"object\":\n return `\"primaryKeyValue\" // or myObjectInstance`;\n case \"objectSet\":\n return `client(${type.objectTypeApiName}).where({ /* filter conditions */ })`;\n case \"anonymousCustomType\":\n case \"customType\":\n case \"interface\":\n case \"marking\":\n return \"{}\";\n case \"attachment\":\n return type.hasAttachments ? \"attachment\" : \"{}\";\n case \"mediaReference\":\n return \"mediaUpload\";\n case \"objectType\":\n return `\"${type.objectTypeApiName}\"`;\n case \"map\":\n return `{key: ${renderType(type.valueType)}}`;\n case \"string\":\n return `\"${type.value ?? \"value\"}\"`;\n case \"unknown\":\n default:\n return `\"value\"`;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,SAASA,QAAQ,QAAQ,+CAA+C;AAExE,OAAO,MAAMC,mBAA2D,GAAG;EACzE,GAAGD,QAAQ;EACXE,iBAAiB,EAAE;IACjBC,6BAA6B,EAAEC,mCAAmC;IAClEC,eAAe,EAAEC,qBAAqB;IACtCC,oBAAoB,EAAEC,0BAA0B;IAChDC,0BAA0B,EAAEC;EAC9B;AACF,CAAC;AAED,SAASN,mCAAmCA,CAAC;EAC3CO;AAGF,CAAC,EAAwD;EACvD,IAAIA,4BAA4B,IAAI,IAAI,EAAE;IACxC,MAAM,IAAIC,KAAK,CAAC,mDAAmD,CAAC;EACtE;EAEA,OAAOD,4BAA4B,CAACE,GAAG,CAAC,CAACC,KAAK,EAAEC,KAAK,EAAEC,KAAK,MAAM;IAChEC,GAAG,EAAEH,KAAK,CAACG,GAAG;IACdC,KAAK,EAAEC,UAAU,CAACL,KAAK,CAACI,KAAK,CAAC;IAC9BE,IAAI,EAAEL,KAAK,KAAKC,KAAK,CAACK,MAAM,GAAG;EACjC,CAAC,CAAC,CAAC;AACL;AAEA,SAASf,qBAAqBA,CAAC;EAC7BgB;AAGF,CAAC,EAAU;EACT,OAAOC,mBAAmB,CAACD,gBAAgB,CAAC;AAC9C;AAEA,SAASd,0BAA0BA,CAAC;EAClCgB;AAGF,CAAC,EAAsC;EACrC,IAAIA,qBAAqB,IAAI,IAAI,EAAE;IACjC,MAAM,IAAIZ,KAAK,CAAC,+CAA+C,CAAC;EAClE;EAEA,OAAO;IACLa,OAAO,EAAED,qBAAqB,CAACC,OAAO;IACtCP,KAAK,EAAEK,mBAAmB,CAACC,qBAAqB,CAACN,KAAK;EACxD,CAAC;AACH;AAEA,SAASR,gCAAgCA,CAAC;EACxCgB;AAOF,CAAC,EAAoD;EACnD,IAAIA,2BAA2B,IAAI,IAAI,EAAE;IACvC,MAAM,IAAId,KAAK,CAAC,qDAAqD,CAAC;EACxE;EAEA,OAAO;IACLa,OAAO,EAAEC,2BAA2B,CAACD,OAAO;IAC5CP,KAAK,EAAEK,mBAAmB,CAACG,2BAA2B,CAACR,KAAK,CAAC;IAC7DS,IAAI,EAAED,2BAA2B,CAACC;EACpC,CAAC;AACH;AAEA,SAASJ,mBAAmBA,CAC1BK,aAAoD,EAC5C;EACR,IAAIA,aAAa,IAAI,IAAI,EAAE;IACzB,MAAM,IAAIhB,KAAK,CAAC,qCAAqC,CAAC;EACxD;EAEA,OAAOO,UAAU,CAACS,aAAa,CAAC;AAClC;AAEA,SAAST,UAAUA,CACjBQ,IAG6B,EACrB;EACR,IAAIA,IAAI,IAAI,IAAI,EAAE;IAChB,MAAM,IAAIf,KAAK,CAAC,iCAAiC,CAAC;EACpD;EAEA,QAAQe,IAAI,CAACA,IAAI;IACf,KAAK,OAAO;IACZ,KAAK,KAAK;IACV,KAAK,MAAM;MACT,OAAO,IAAIR,UAAU,CAACQ,IAAI,CAACE,OAAO,CAAC,GAAG;IACxC,KAAK,SAAS;MACZ,OAAOF,IAAI,CAACT,KAAK,GAAG,MAAM,GAAG,OAAO;IACtC,KAAK,MAAM;IACX,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,OAAO;MACV,OAAOS,IAAI,CAACT,KAAK,CAACY,QAAQ,CAAC,CAAC;IAC9B,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,OAAO;MACV,OAAOH,IAAI,CAACT,KAAK,CAACY,QAAQ,CAAC,CAAC;IAC9B,KAAK,MAAM;MAAE;QACX,MAAMC,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;QAC7BD,UAAU,CAACE,OAAO,CAACF,UAAU,CAACG,OAAO,CAAC,CAAC,IAAIP,IAAI,CAACQ,UAAU,IAAI,CAAC,CAAC,CAAC;QACjE,OAAO,IAAIJ,UAAU,CAACK,WAAW,CAAC,CAAC,CAACC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG;MACrD;IACA,KAAK,WAAW;MAAE;QAChB,MAAMN,UAAU,GAAG,IAAIC,IAAI,CAAC,CAAC;QAC7BD,UAAU,CAACE,OAAO,CAACF,UAAU,CAACG,OAAO,CAAC,CAAC,IAAIP,IAAI,CAACQ,UAAU,IAAI,CAAC,CAAC,CAAC;QACjE,OAAO,IAAIJ,UAAU,CAACK,WAAW,CAAC,CAAC,GAAG;MACxC;IACA,KAAK,QAAQ;MACX,OAAO,0CAA0C;IACnD,KAAK,WAAW;MACd,OAAO,UAAUT,IAAI,CAACW,iBAAiB,sCAAsC;IAC/E,KAAK,qBAAqB;IAC1B,KAAK,YAAY;IACjB,KAAK,WAAW;IAChB,KAAK,SAAS;MACZ,OAAO,IAAI;IACb,KAAK,YAAY;MACf,OAAOX,IAAI,CAACY,cAAc,GAAG,YAAY,GAAG,IAAI;IAClD,KAAK,gBAAgB;MACnB,OAAO,aAAa;IACtB,KAAK,YAAY;MACf,OAAO,IAAIZ,IAAI,CAACW,iBAAiB,GAAG;IACtC,KAAK,KAAK;MACR,OAAO,SAASnB,UAAU,CAACQ,IAAI,CAACa,SAAS,CAAC,GAAG;IAC/C,KAAK,QAAQ;MACX,OAAO,IAAIb,IAAI,CAACT,KAAK,IAAI,OAAO,GAAG;IACrC,KAAK,SAAS;IACd;MACE,OAAO,SAAS;EACpB;AACF","ignoreList":[]}
@@ -0,0 +1,294 @@
1
+ // THIS FILE IS GENERATED. DO NOT MODIFY.
2
+ // You probably want to modify ../documentation.yml instead.
3
+
4
+ export const snippets = {
5
+ "kind": "sdk",
6
+ "versions": {
7
+ "1.0.0": {
8
+ "snippets": {
9
+ "reactProviderSetup": [{
10
+ "template": "import { OsdkProvider2 } from \"@osdk/react/experimental\";\nimport { createClient } from \"@osdk/client\";\n\nconst client = createClient(\n \"https://your-stack.palantirfoundry.com\",\n \"{{{packageName}}}\",\n async () => \"your-token\"\n);\n\nfunction App() {\n return (\n <OsdkProvider2 client={client}>\n <YourApp />\n </OsdkProvider2>\n );\n}"
11
+ }],
12
+ "reactUseOsdkObjectsBasic": [{
13
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}List() {\n const { data, isLoading, error, fetchMore } = useOsdkObjects({{objectType}});\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error.message}</div>}\n {isLoading && !data && <div className=\"skeleton\">Loading...</div>}\n <ul>\n {data?.map(obj => (\n <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>\n ))}\n </ul>\n {isLoading && data && <span className=\"refresh-indicator\">Refreshing...</span>}\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
14
+ }],
15
+ "reactUseOsdkObjectsFilter": [{
16
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction Filtered{{objectType}}List() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{titleProperty}}: { $isNotNull: true }\n }\n });\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error.message}</div>}\n {isLoading && !data && <div className=\"skeleton\">Loading...</div>}\n <ul>\n {data?.map(obj => (\n <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>\n ))}\n </ul>\n </div>\n );\n}"
17
+ }],
18
+ "reactUseOsdkObjectByPrimaryKey": [{
19
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObject } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Detail({ primaryKey }: { primaryKey: string }) {\n const { object, isLoading, error } = useOsdkObject({{objectType}}, primaryKey);\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error.message}</div>}\n {isLoading && !object && <div className=\"skeleton\">Loading...</div>}\n {object && (\n <div>\n <h2>{object.{{titleProperty}}}</h2>\n </div>\n )}\n </div>\n );\n}"
20
+ }],
21
+ "reactUseLinksBasic": [{
22
+ "template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\nimport { useLinks } from \"@osdk/react/experimental\";\n\nfunction Linked{{linkedObjectType}}({ source }: { source: {{sourceObjectType}}.OsdkInstance }) {\n const { links, isLoading, error } = useLinks(source, \"{{linkApiName}}\");\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error.message}</div>}\n {isLoading && !links && <div className=\"skeleton\">Loading...</div>}\n <ul>\n {links?.map(linked => (\n <li key={linked.$primaryKey}>{linked.$primaryKey}</li>\n ))}\n </ul>\n </div>\n );\n}"
23
+ }],
24
+ "reactUseOsdkActionBasic": [{
25
+ "template": "import { {{actionApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkAction } from \"@osdk/react/experimental\";\n\nfunction {{actionApiName}}Button() {\n const { applyAction, isPending, error } = useOsdkAction({{actionApiName}});\n\n const handleClick = async () => {\n await applyAction({\n {{#actionParameterSampleValuesV2}}\n {{key}}: {{value}}{{^last}},{{/last}}\n {{/actionParameterSampleValuesV2}}\n });\n };\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {String(error.unknown ?? error.actionValidation)}</div>}\n <button onClick={handleClick} disabled={isPending}>\n {isPending ? \"Applying...\" : \"Apply {{actionApiName}}\"}\n </button>\n </div>\n );\n}",
26
+ "computedVariables": ["actionParameterSampleValuesV2"]
27
+ }],
28
+ "reactUseOsdkAggregationBasic": [{
29
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Count() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: { $select: { $count: \"unordered\" } }\n });\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error.message}</div>}\n {isLoading && data == null && <div className=\"skeleton\">Loading...</div>}\n {data != null && <span>Total: {data}</span>}\n </div>\n );\n}"
30
+ }],
31
+ "reactUseOsdkObjectsEnabled": [{
32
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction Conditional{{objectType}}List({ shouldFetch }: { shouldFetch: boolean }) {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n enabled: shouldFetch\n });\n\n return (\n <div>\n {!shouldFetch && <div>Select criteria to load data</div>}\n {error && <div className=\"error-banner\">Error: {error.message}</div>}\n {isLoading && !data && <div className=\"skeleton\">Loading...</div>}\n <ul>\n {data?.map(obj => (\n <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>\n ))}\n </ul>\n </div>\n );\n}"
33
+ }],
34
+ "loadSingleObjectGuide": [{
35
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObject } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Detail({ primaryKey }: { primaryKey: string }) {\n const { object, isLoading, error } = useOsdkObject({{objectType}}, primaryKey);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !object && <div>Loading...</div>}\n {object && <div>{object.{{titleProperty}}}</div>}\n </div>\n );\n}"
36
+ }],
37
+ "loadObjectPageGuide": [{
38
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}List() {\n const { data, isLoading, error, fetchMore } = useOsdkObjects({{objectType}}, {\n pageSize: 30\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
39
+ }],
40
+ "orderObjectsGuide": [{
41
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction Sorted{{objectType}}List() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n orderBy: { {{titleProperty}}: \"asc\" }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
42
+ }],
43
+ "searchObjectsGuide": [{
44
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction Filtered{{objectType}}List() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{titleProperty}}: { $isNotNull: true }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
45
+ }],
46
+ "loadSingleObjectReference": [{
47
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObject } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Detail({ primaryKey }: { primaryKey: string }) {\n const { object, isLoading, error } = useOsdkObject({{objectType}}, primaryKey);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !object && <div>Loading...</div>}\n {object && <div>{object.{{titleProperty}}}</div>}\n </div>\n );\n}"
48
+ }],
49
+ "loadObjectsReference": [{
50
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}List() {\n const { data, isLoading, error, fetchMore } = useOsdkObjects({{objectType}}, {\n pageSize: 30\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
51
+ }],
52
+ "loadAllObjectsReference": [{
53
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\n// Note: For large datasets, consider using pagination with fetchMore\nfunction All{{objectType}}List() {\n const { data, isLoading, error, fetchMore } = useOsdkObjects({{objectType}});\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
54
+ }],
55
+ "loadLinkedObjectReference": [{
56
+ "template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\nimport { useLinks } from \"@osdk/react/experimental\";\n\nfunction {{linkedObjectType}}Detail({ source }: { source: {{sourceObjectType}}.OsdkInstance }) {\n const { links, isLoading, error } = useLinks(source, \"{{linkApiName}}\");\n const linkedObject = links?.[0];\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !links && <div>Loading...</div>}\n {linkedObject && <div>{linkedObject.$primaryKey}</div>}\n </div>\n );\n}"
57
+ }],
58
+ "loadLinkedObjectsReference": [{
59
+ "template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\nimport { useLinks } from \"@osdk/react/experimental\";\n\nfunction Linked{{linkedObjectType}}List({ source }: { source: {{sourceObjectType}}.OsdkInstance }) {\n const { links, isLoading, error, fetchMore } = useLinks(source, \"{{linkApiName}}\");\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !links && <div>Loading...</div>}\n <ul>\n {links?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
60
+ }],
61
+ "aggregationTemplate": [{
62
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Aggregation() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n where: { {{property}}: { $isNull: false } },\n aggregate: {\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: \"exact\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n );\n}"
63
+ }],
64
+ "countAggregationTemplate": [{
65
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Count() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: { $select: { $count: \"unordered\" } }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <span>Total: {data}</span>}\n </div>\n );\n}"
66
+ }],
67
+ "approximateDistinctAggregationTemplate": [{
68
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}DistinctCount() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: { $select: { \"{{property}}:approximateDistinct\": \"unordered\" } }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <span>Distinct count: {data}</span>}\n </div>\n );\n}"
69
+ }],
70
+ "exactDistinctAggregationTemplate": [{
71
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}ExactDistinctCount() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: { $select: { \"{{property}}:exactDistinct\": \"unordered\" } }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <span>Exact distinct count: {data}</span>}\n </div>\n );\n}"
72
+ }],
73
+ "numericAggregationTemplate": [{
74
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}{{operation}}() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: { $select: { \"{{property}}:{{operation}}\": \"unordered\" } }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <span>{{operation}}: {data}</span>}\n </div>\n );\n}"
75
+ }],
76
+ "fixedWidthGroupByTemplate": [{
77
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}GroupedByFixedWidth() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: {\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: { $fixedWidth: 10 } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n );\n}"
78
+ }],
79
+ "durationGroupByTemplate": [{
80
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}GroupedByDuration() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: {\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: { $duration: [{{#durationText}}{{arg}}{{/durationText}}, \"{{#durationText}}{{unit}}{{/durationText}}\"] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n );\n}"
81
+ }],
82
+ "exactGroupByTemplate": [{
83
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}GroupedByExact() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: {\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: \"exact\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n );\n}"
84
+ }],
85
+ "rangeGroupByTemplate": [{
86
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkAggregation } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}GroupedByRange() {\n const { data, isLoading, error } = useOsdkAggregation({{objectType}}, {\n aggregate: {\n $select: { $count: \"unordered\" },\n $groupBy: { {{property}}: { $ranges: [[{{{propertyValueV2}}}, {{{propertyValueV2}}}]] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && data == null && <div>Loading...</div>}\n {data != null && <pre>{JSON.stringify(data, null, 2)}</pre>}\n </div>\n );\n}",
87
+ "computedVariables": ["propertyValueV2"]
88
+ }],
89
+ "applyAction": [{
90
+ "template": "import { {{actionApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkAction } from \"@osdk/react/experimental\";\n\nfunction {{actionApiName}}Button() {\n const { applyAction, isPending, error } = useOsdkAction({{actionApiName}});\n\n const handleClick = async () => {\n await applyAction({\n {{#actionParameterSampleValuesV2}}\n {{key}}: {{value}}{{^last}},{{/last}}\n {{/actionParameterSampleValuesV2}}\n });\n };\n\n return (\n <div>\n {error && <div>Error: {String(error.unknown ?? error.actionValidation)}</div>}\n <button onClick={handleClick} disabled={isPending}>\n {isPending ? \"Applying...\" : \"Apply\"}\n </button>\n </div>\n );\n}",
91
+ "computedVariables": ["actionParameterSampleValuesV2"]
92
+ }],
93
+ "applyActionResponse": [{
94
+ "template": "import { {{actionApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkAction } from \"@osdk/react/experimental\";\n\nfunction {{actionApiName}}WithResult() {\n const { applyAction, isPending, error, data } = useOsdkAction({{actionApiName}});\n\n const handleClick = async () => {\n await applyAction({\n {{#actionParameterSampleValuesV2}}\n {{key}}: {{value}}{{^last}},{{/last}}\n {{/actionParameterSampleValuesV2}}\n });\n };\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {String(error.unknown ?? error.actionValidation)}</div>}\n {data && <div>Action completed successfully</div>}\n <button onClick={handleClick} disabled={isPending}>\n {isPending ? \"Applying...\" : \"Apply {{actionApiName}}\"}\n </button>\n </div>\n );\n}",
95
+ "computedVariables": ["actionParameterSampleValuesV2"]
96
+ }],
97
+ "validateAction": [{
98
+ "template": "import { {{actionApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkAction, useDebouncedCallback } from \"@osdk/react/experimental\";\nimport { useState } from \"react\";\n\nfunction {{actionApiName}}WithValidation() {\n const { validateAction, applyAction, isPending, validationResult } = useOsdkAction({{actionApiName}});\n const [params, setParams] = useState<Record<string, string>>({});\n\n const debouncedValidate = useDebouncedCallback(\n (nextParams: Record<string, string>) => { validateAction(nextParams); },\n 300\n );\n\n const handleParamChange = (key: string, value: string) => {\n const nextParams = { ...params, [key]: value };\n setParams(nextParams);\n debouncedValidate(nextParams);\n };\n\n return (\n <div>\n <input\n placeholder=\"Parameter value\"\n onChange={(e) => handleParamChange(\"paramName\", e.target.value)}\n />\n {validationResult?.result === \"INVALID\" && (\n <div>Validation errors present</div>\n )}\n <button\n onClick={() => applyAction(params)}\n disabled={isPending || validationResult?.result === \"INVALID\"}\n >\n {isPending ? \"Applying...\" : \"Apply\"}\n </button>\n </div>\n );\n}"
99
+ }],
100
+ "batchApplyAction": [{
101
+ "template": "// Batch actions in React should be handled with multiple hook calls\n// or by using the client directly for batch operations\nimport { {{actionApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkAction } from \"@osdk/react/experimental\";\n\nfunction Batch{{actionApiName}}() {\n const { applyAction, isPending } = useOsdkAction({{actionApiName}});\n\n const handleBatchApply = async (items: Array<Parameters<typeof applyAction>[0]>) => {\n await Promise.all(items.map(item => applyAction(item)));\n };\n\n return (\n <button onClick={() => handleBatchApply([])} disabled={isPending}>\n Apply Batch\n </button>\n );\n}"
102
+ }],
103
+ "clientSetup": [{
104
+ "template": "import { OsdkProvider2 } from \"@osdk/react/experimental\";\nimport { createClient } from \"@osdk/client\";\n\nconst client = createClient(\n \"https://your-stack.palantirfoundry.com\",\n \"{{{packageName}}}\",\n async () => \"your-token\"\n);\n\nfunction App() {\n return (\n <OsdkProvider2 client={client}>\n <YourApp />\n </OsdkProvider2>\n );\n}"
105
+ }],
106
+ "callFunction": [{
107
+ "template": "import { {{funcApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkFunction } from \"@osdk/react/experimental\";\n\nfunction {{funcApiName}}Caller() {\n const { data, isLoading, error, refetch } = useOsdkFunction({{funcApiName}}, {\n params: { /* function parameters */ }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n {data && <pre>{JSON.stringify(data, null, 2)}</pre>}\n <button onClick={refetch}>Refresh</button>\n </div>\n );\n}"
108
+ }],
109
+ "executeFunction": [{
110
+ "template": "import { {{funcApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkFunction } from \"@osdk/react/experimental\";\n\nfunction {{funcApiName}}Executor() {\n const { data, isLoading, error, refetch } = useOsdkFunction({{funcApiName}}, {\n params: { /* function parameters */ }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n {data && <pre>{JSON.stringify(data, null, 2)}</pre>}\n <button onClick={refetch}>Refresh</button>\n </div>\n );\n}"
111
+ }],
112
+ "stringStartsWithTemplate": [{
113
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}StartsWith() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $startsWith: \"foo\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
114
+ }],
115
+ "containsAnyTermTemplate": [{
116
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}ContainsAnyTerm() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $containsAnyTerm: \"foo bar\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
117
+ }],
118
+ "containsAllTermsTemplate": [{
119
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}ContainsAllTerms() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $containsAllTerms: \"foo bar\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
120
+ }],
121
+ "containsAllTermsInOrderTemplate": [{
122
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}ContainsAllTermsInOrder() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $containsAllTermsInOrder: \"foo bar\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
123
+ }],
124
+ "containsTemplate": [{
125
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Contains() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $contains: \"value\" }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
126
+ }],
127
+ "equalityTemplate": [{
128
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Equality() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $eq: {{{propertyValueV2}}} }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}",
129
+ "computedVariables": ["propertyValueV2"]
130
+ }],
131
+ "inFilterTemplate": [{
132
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}InFilter() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $in: [{{{propertyValueV2}}}] }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}",
133
+ "computedVariables": ["propertyValueV2"]
134
+ }],
135
+ "rangeTemplate": [{
136
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Range() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { ${{operation}}: {{{propertyValueV2}}} }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}",
137
+ "computedVariables": ["propertyValueV2"]
138
+ }],
139
+ "nullTemplate": [{
140
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}NullFilter() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $isNull: true }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
141
+ }],
142
+ "andTemplate": [{
143
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}AndFilter() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n $and: [\n { $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true } } },\n { {{property}}: { $eq: {{{propertyValueV2}}} } }\n ]\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}",
144
+ "computedVariables": ["primaryKeyPropertyV2", "propertyValueV2"]
145
+ }],
146
+ "orTemplate": [{
147
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}OrFilter() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n $or: [\n { $not: { {{primaryKeyPropertyV2.apiName}}: { $isNull: true } } },\n { {{property}}: { $eq: {{{propertyValueV2}}} } }\n ]\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}",
148
+ "computedVariables": ["primaryKeyPropertyV2", "propertyValueV2"]
149
+ }],
150
+ "notTemplate": [{
151
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}NotFilter() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n $not: { {{property}}: { $eq: {{{propertyValueV2}}} } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}",
152
+ "computedVariables": ["propertyValueV2"]
153
+ }],
154
+ "withinDistanceTemplate": [{
155
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}WithinDistance() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $within: { $distance: [100, \"{{distanceUnit}}\"], $of: [-74.0060, 40.7128] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
156
+ }],
157
+ "withinBoundingBoxTemplate": [{
158
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}WithinBoundingBox() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $within: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
159
+ }],
160
+ "withinPolygonTemplate": [{
161
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}WithinPolygon() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $within: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
162
+ }],
163
+ "intersectsPolygonTemplate": [{
164
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}IntersectsPolygon() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $intersects: { type: \"Polygon\", coordinates: [[[10.0, 40.0], [20.0, 50.0], [20.0, 30.0], [10.0, 40.0]]] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
165
+ }],
166
+ "intersectsBboxTemplate": [{
167
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}IntersectsBbox() {\n const { data, isLoading, error } = useOsdkObjects({{objectType}}, {\n where: {\n {{property}}: { $intersects: { $bbox: [-74.0060, 25.123, 80.4231, 40.7128] } }\n }\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
168
+ }],
169
+ "objectSetOperationsGuide": [{
170
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}SetOperations() {\n const client = useOsdkClient();\n const combinedSet = useMemo(() => {\n const setA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\" } });\n const setB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\" } });\n const setC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\" } });\n return setA.intersect(setB).subtract(setC);\n }, [client]);\n\n const { data, isLoading, error } = useObjectSet(combinedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
171
+ }],
172
+ "objectSetOperationsUnion": [{
173
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}Union() {\n const client = useOsdkClient();\n const unionSet = useMemo(() => {\n const setA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\" } });\n const setB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\" } });\n const setC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\" } });\n return setA.union(setB).union(setC);\n }, [client]);\n\n const { data, isLoading, error } = useObjectSet(unionSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
174
+ }],
175
+ "objectSetOperationsSubtract": [{
176
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}Subtract() {\n const client = useOsdkClient();\n const subtractedSet = useMemo(() => {\n const setA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\" } });\n const setB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\" } });\n const setC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\" } });\n return setA.subtract(setB).subtract(setC);\n }, [client]);\n\n const { data, isLoading, error } = useObjectSet(subtractedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
177
+ }],
178
+ "objectSetOperationsIntersect": [{
179
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}Intersect() {\n const client = useOsdkClient();\n const intersectedSet = useMemo(() => {\n const setA = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"a\" } });\n const setB = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"b\" } });\n const setC = client({{objectType}}).where({ {{titleProperty}}: { $containsAnyTerm: \"c\" } });\n return setA.intersect(setB).intersect(setC);\n }, [client]);\n\n const { data, isLoading, error } = useObjectSet(intersectedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.{{titleProperty}}}</li>)}\n </ul>\n </div>\n );\n}"
180
+ }],
181
+ "derivedPropertyBaseExample": [{
182
+ "template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{sourceObjectType}}DerivedProperty() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{sourceObjectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"$count\")\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
183
+ }],
184
+ "derivedPropertyCountAggregation": [{
185
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedCount() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"$count\")\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
186
+ }],
187
+ "derivedPropertyNumericAggregation": [{
188
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedNumeric() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:{{operation}}\")\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
189
+ }],
190
+ "derivedPropertySelectPropertyAggregation": [{
191
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedSelectProperty() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").selectProperty(\"{{property}}\")\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
192
+ }],
193
+ "derivedPropertyApproximateDistinctAggregation": [{
194
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedApproxDistinct() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:approximateDistinct\")\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
195
+ }],
196
+ "derivedPropertyExactDistinctAggregation": [{
197
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedExactDistinct() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:exactDistinct\")\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
198
+ }],
199
+ "derivedPropertyApproximatePercentileAggregation": [{
200
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedPercentile() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:approximatePercentile\", { percentile: 95 })\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
201
+ }],
202
+ "derivedPropertyCollectToListAggregation": [{
203
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedCollectList() {\n const client = useOsdkClient();\n const maxObjectsInList = 75;\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:collectList\", { limit: maxObjectsInList })\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
204
+ }],
205
+ "derivedPropertyCollectToSetAggregation": [{
206
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedCollectSet() {\n const client = useOsdkClient();\n const maxObjectsInSet = 75;\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"{{property}}:collectSet\", { limit: maxObjectsInSet })\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
207
+ }],
208
+ "loadObjectMetadataSnippet": [{
209
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkMetadata } from \"@osdk/react/experimental\";\n\nfunction {{objectType}}Metadata() {\n const { loading, metadata, error } = useOsdkMetadata({{objectType}});\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error}</div>}\n {loading && !metadata && <div className=\"skeleton\">Loading...</div>}\n {metadata && (\n <div>\n <div>Description: {metadata.description}</div>\n <div>Visibility: {metadata.visibility}</div>\n </div>\n )}\n </div>\n );\n}"
210
+ }],
211
+ "loadInterfaceMetadataSnippet": [{
212
+ "template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkMetadata } from \"@osdk/react/experimental\";\n\nfunction {{interfaceApiName}}Metadata() {\n const { loading, metadata, error } = useOsdkMetadata({{interfaceApiName}});\n\n return (\n <div>\n {error && <div className=\"error-banner\">Error: {error}</div>}\n {loading && !metadata && <div className=\"skeleton\">Loading...</div>}\n {metadata && (\n <div>\n <div>RID: {metadata.rid}</div>\n <div>Implemented by: {metadata.implementedBy?.join(\", \")}</div>\n </div>\n )}\n </div>\n );\n}"
213
+ }],
214
+ "loadInterfacesReference": [{
215
+ "template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{interfaceApiName}}List() {\n const { data, isLoading, error, fetchMore } = useOsdkObjects({{interfaceApiName}}, {\n pageSize: 30\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
216
+ }],
217
+ "loadAllInterfacesReference": [{
218
+ "template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction All{{interfaceApiName}}List() {\n const { data, isLoading, error, fetchMore } = useOsdkObjects({{interfaceApiName}});\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n {fetchMore && <button onClick={fetchMore}>Load more</button>}\n </div>\n );\n}"
219
+ }],
220
+ "loadOrderedInterfacesReference": [{
221
+ "template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction Ordered{{interfaceApiName}}List() {\n const { data, isLoading, error } = useOsdkObjects({{interfaceApiName}}, {\n orderBy: { {{property}}: \"asc\" },\n pageSize: 30\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
222
+ }],
223
+ "searchInterfacesReference": [{
224
+ "template": "import { {{interfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction Search{{interfaceApiName}}() {\n const { data, isLoading, error } = useOsdkObjects({{interfaceApiName}}, {\n where: {\n {{property}}: { $startsWith: \"foo\" }\n },\n pageSize: 30\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
225
+ }],
226
+ "castInterfaceToObjectReference": [{
227
+ "template": "import { {{objectTypeApiName}}, {{interfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction CastInterface() {\n const { data, isLoading, error } = useOsdkObjects({{interfaceApiName}}, {\n pageSize: 10\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => {\n const casted = obj.$as({{objectTypeApiName}});\n return <li key={casted.$primaryKey}>{casted.$primaryKey}</li>;\n })}\n </ul>\n </div>\n );\n}"
228
+ }],
229
+ "subscribeToObjectSetInstructions": [{
230
+ "template": "import { {{objectOrInterfaceApiName}} } from \"{{{packageName}}}\";\nimport { useOsdkObjects } from \"@osdk/react/experimental\";\n\nfunction {{objectOrInterfaceApiName}}LiveList() {\n const { data, isLoading, error } = useOsdkObjects({{objectOrInterfaceApiName}}, {\n streamUpdates: true\n });\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
231
+ }],
232
+ "loadTimeSeriesPointsSnippet": [{
233
+ "template": "// Timeseries does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getAllTimeSeriesPoints(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getAllPoints();\n}"
234
+ }],
235
+ "loadTimeSeriesFirstPointSnippet": [{
236
+ "template": "// Timeseries does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getFirstTimeSeriesPoint(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getFirstPoint();\n}"
237
+ }],
238
+ "loadTimeSeriesLastPointSnippet": [{
239
+ "template": "// Timeseries does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getLastTimeSeriesPoint(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getLastPoint();\n}"
240
+ }],
241
+ "loadAbsoluteTimeSeriesPointsSnippet": [{
242
+ "template": "// Timeseries does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getAbsoluteTimeSeriesPoints(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getAllPoints({\n $startTime: \"2022-08-13T12:34:56Z\",\n $endTime: \"2022-08-14T12:34:56Z\",\n });\n}"
243
+ }],
244
+ "loadRelativeTimeSeriesPointsSnippet": [{
245
+ "template": "// Timeseries does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getRelativeTimeSeriesPoints(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getAllPoints({\n $before: 1,\n $unit: \"{{timeUnit}}\",\n });\n}"
246
+ }],
247
+ "loadGeotimeSeriesPointsSnippet": [{
248
+ "template": "// Geo-time series does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getAllGeotimeSeriesPoints(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getAllValues();\n}"
249
+ }],
250
+ "loadGeotimeSeriesLastPointSnippet": [{
251
+ "template": "// Geo-time series does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getLatestGeotimeSeriesPoint(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getLatestValue();\n}"
252
+ }],
253
+ "loadAbsoluteGeotimeSeriesPointsSnippet": [{
254
+ "template": "// Geo-time series does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getAbsoluteGeotimeSeriesPoints(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getAllValues({\n $startTime: \"2022-08-13T12:34:56Z\",\n $endTime: \"2022-08-14T12:34:56Z\",\n });\n}"
255
+ }],
256
+ "loadRelativeGeotimeSeriesPointsSnippet": [{
257
+ "template": "// Geo-time series does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function getRelativeGeotimeSeriesPoints(obj: Osdk.Instance<typeof {{objectType}}>) {\n return obj.{{property}}?.getAllValues({\n $before: 1,\n $unit: \"{{timeUnit}}\",\n });\n}"
258
+ }],
259
+ "uploadAttachment": [{
260
+ "template": "import { useOsdkClient } from \"@osdk/react/experimental\";\nimport { createAttachmentUpload } from \"@osdk/client\";\nimport { {{actionApiName}} } from \"{{{packageName}}}\";\n\nfunction AttachmentUploader() {\n const client = useOsdkClient();\n\n const handleUpload = async (file: File) => {\n const attachment = createAttachmentUpload(file, file.name);\n await client({{actionApiName}}).applyAction({\n {{primaryKeyPropertyV2.apiName}}: {{{propertyValueV2}}},\n {{property}}: attachment\n });\n };\n\n return (\n <input type=\"file\" onChange={e => {\n const file = e.target.files?.[0];\n if (file) {\n handleUpload(file);\n }\n }} />\n );\n}",
261
+ "computedVariables": ["propertyValueV2", "primaryKeyPropertyV2"]
262
+ }],
263
+ "readMedia": [{
264
+ "template": "// Media does not have a dedicated React hook yet.\n// Use the client API directly with a loaded OSDK object.\nimport type { Osdk } from \"@osdk/client\";\nimport type { {{objectType}} } from \"{{{packageName}}}\";\n\nasync function readMediaContent(obj: Osdk.Instance<typeof {{objectType}}>) {\n const contents = await obj.{{property}}?.fetchContents();\n if (contents?.ok) {\n return contents.blob();\n }\n}"
265
+ }],
266
+ "uploadMedia": [{
267
+ "template": "import { useOsdkClient } from \"@osdk/react/experimental\";\nimport { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference } from \"@osdk/api/unstable\";\nimport type { MediaReference } from \"@osdk/api\";\nimport { {{actionApiName}}, {{objectType}} } from \"{{{packageName}}}\";\n\nfunction MediaUploader() {\n const client = useOsdkClient();\n\n const handleUpload = async (file: File) => {\n const mediaReference: MediaReference = await client(\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n ).createMediaReference({\n data: file,\n fileName: file.name,\n objectType: {{objectType}},\n propertyType: \"{{property}}\",\n });\n await client({{actionApiName}}).applyAction({\n // Pass the required action parameters including the primary key\n {{mediaParameter}}: mediaReference\n });\n };\n\n return (\n <input type=\"file\" onChange={e => {\n const file = e.target.files?.[0];\n if (file) {\n handleUpload(file);\n }\n }} />\n );\n}"
268
+ }],
269
+ "uploadMediaOntologyEdits": [{
270
+ "template": "import { useOsdkClient } from \"@osdk/react/experimental\";\nimport { {{objectType}} } from \"{{{packageName}}}\";\nimport { createEditBatch, uploadMedia } from \"@osdk/functions\";\n\nfunction MediaOntologyEditsUploader() {\n const client = useOsdkClient();\n\n const handleUpload = async (file: File) => {\n const batch = createEditBatch(client);\n const mediaReference = await uploadMedia(client, { data: file, fileName: file.name });\n // @ts-expect-error - batch.create types don't support media references yet\n batch.create({{objectType}}, { {{property}}: mediaReference });\n return batch.getEdits();\n };\n\n return (\n <input type=\"file\" onChange={e => {\n const file = e.target.files?.[0];\n if (file) {\n handleUpload(file);\n }\n }} />\n );\n}"
271
+ }],
272
+ "uploadMediaEphemeral": [{
273
+ "template": "// Ephemeral media upload is not yet supported in the React SDK"
274
+ }],
275
+ "derivedPropertyNumericExpression": [{
276
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedNumericExpression() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n {{^isUnary}}\n \"newPropertyName\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .aggregate(\"{{property}}\").{{operation}}(\n baseObjectSet.pivotTo(\"{{linkApiName}}\").aggregate(\"$count\"))\n {{/isUnary}}\n {{#isUnary}}\n \"{{operation}}_{{property}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\").{{operation}}()\n {{/isUnary}}\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
277
+ }],
278
+ "derivedPropertyDatetimeExpression": [{
279
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}DerivedDatetimeExpression() {\n const client = useOsdkClient();\n const derivedSet = useMemo(() =>\n client({{objectType}}).withProperties({\n {{^isExtractPart}}\n \"derivedPropertyDatetime_{{operation}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\")\n .{{operation}}(baseObjectSet.pivotTo(\"{{linkApiName}}\").selectProperty(\"{{property}}\"))\n {{/isExtractPart}}\n {{#isExtractPart}}\n \"YEARS_part_of_{{property}}_of_{{linkApiName}}\": (baseObjectSet) =>\n baseObjectSet.pivotTo(\"{{linkApiName}}\")\n .selectProperty(\"{{property}}\").extractPart(\"YEARS\")\n {{/isExtractPart}}\n }), [client]);\n\n const { data, isLoading, error } = useObjectSet(derivedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
280
+ }],
281
+ "nearestNeighborsTextQuery": [{
282
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}NearestNeighborsText() {\n const client = useOsdkClient();\n const resultSet = useMemo(() =>\n client({{objectType}}).nearestNeighbors(\"coffee\", 5, \"{{property}}\"),\n [client]);\n\n const { data, isLoading, error } = useObjectSet(resultSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
283
+ }],
284
+ "nearestNeighborsVectorQuery": [{
285
+ "template": "import { {{objectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction {{objectType}}NearestNeighborsVector() {\n const client = useOsdkClient();\n // Note that this vector maps to an arbitrary string\n // It must match the dimension of the \"{{property}}\" property: {{vectorDimensionSize}}\n const vectorQuery = useMemo(() =>\n Array.from({ length: {{vectorDimensionSize}} }, () => 0.3),\n []);\n const resultSet = useMemo(() =>\n client({{objectType}}).nearestNeighbors(vectorQuery, 5, \"{{property}}\"),\n [client, vectorQuery]);\n\n const { data, isLoading, error } = useObjectSet(resultSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
286
+ }],
287
+ "searchAround": [{
288
+ "template": "import { {{sourceObjectType}} } from \"{{{packageName}}}\";\nimport { useOsdkClient, useObjectSet } from \"@osdk/react/experimental\";\nimport { useMemo } from \"react\";\n\nfunction SearchAround{{linkedObjectType}}() {\n const client = useOsdkClient();\n const linkedSet = useMemo(() =>\n client({{sourceObjectType}})\n .where({ {{rawLinkedPrimaryKeyProperty.apiName}}: { $in: [\"a\", \"b\", \"c\"] } })\n .pivotTo(\"{{linkApiName}}\"),\n [client]);\n\n const { data, isLoading, error } = useObjectSet(linkedSet);\n\n return (\n <div>\n {error && <div>Error: {error.message}</div>}\n {isLoading && !data && <div>Loading...</div>}\n <ul>\n {data?.map(obj => <li key={obj.$primaryKey}>{obj.$primaryKey}</li>)}\n </ul>\n </div>\n );\n}"
289
+ }]
290
+ }
291
+ }
292
+ }
293
+ };
294
+ //# sourceMappingURL=docsNoComputedVariables.js.map