@osdk/generator 1.12.0-beta.1 → 1.12.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/CHANGELOG.md +21 -5
  2. package/build/browser/index.js +138 -31
  3. package/build/browser/index.js.map +1 -1
  4. package/build/cjs/index.cjs +140 -31
  5. package/build/cjs/index.cjs.map +1 -1
  6. package/build/cjs/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.cts +2 -1
  7. package/build/cjs/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +1 -1
  8. package/build/cjs/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.cts +2 -0
  9. package/build/cjs/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +1 -0
  10. package/build/cjs/shared/propertyJsdoc.d.cts +6 -0
  11. package/build/cjs/shared/propertyJsdoc.d.ts.map +1 -0
  12. package/build/cjs/shared/wireObjectTypeV2ToSdkObjectConst.d.ts.map +1 -1
  13. package/build/cjs/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.cts +1 -1
  14. package/build/cjs/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -1
  15. package/build/cjs/shared/wireQueryTypeV2ToSdkQueryDefinition.d.cts +10 -2
  16. package/build/cjs/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +1 -1
  17. package/build/cjs/util/stringify.d.cts +3 -3
  18. package/build/cjs/util/stringify.d.ts.map +1 -1
  19. package/build/cjs/util/{verifyOutdir.d.cts → verifyOutDir.d.cts} +2 -2
  20. package/build/cjs/util/{verifyOutdir.d.ts.map → verifyOutDir.d.ts.map} +1 -1
  21. package/build/cjs/v1.1/backcompat/generateOntologyRuntimeDistDir.d.ts.map +1 -1
  22. package/build/cjs/v1.1/generatePerQueryDataFiles.d.cts +1 -1
  23. package/build/cjs/v1.1/generatePerQueryDataFiles.d.ts.map +1 -1
  24. package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  25. package/build/esm/index.js +138 -31
  26. package/build/esm/index.js.map +1 -1
  27. package/build/esm/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +2 -1
  28. package/build/esm/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +1 -1
  29. package/build/esm/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +2 -0
  30. package/build/esm/shared/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +1 -0
  31. package/build/esm/shared/propertyJsdoc.d.ts +6 -0
  32. package/build/esm/shared/propertyJsdoc.d.ts.map +1 -0
  33. package/build/esm/shared/wireObjectTypeV2ToSdkObjectConst.d.ts.map +1 -1
  34. package/build/esm/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +1 -1
  35. package/build/esm/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -1
  36. package/build/esm/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts +10 -2
  37. package/build/esm/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +1 -1
  38. package/build/esm/util/stringify.d.ts +3 -3
  39. package/build/esm/util/stringify.d.ts.map +1 -1
  40. package/build/esm/util/{verifyOutdir.d.ts → verifyOutDir.d.ts} +2 -2
  41. package/build/esm/util/{verifyOutdir.d.ts.map → verifyOutDir.d.ts.map} +1 -1
  42. package/build/esm/v1.1/backcompat/generateOntologyRuntimeDistDir.d.ts.map +1 -1
  43. package/build/esm/v1.1/generatePerQueryDataFiles.d.ts +1 -1
  44. package/build/esm/v1.1/generatePerQueryDataFiles.d.ts.map +1 -1
  45. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  46. package/package.json +13 -8
@@ -5,6 +5,8 @@ var path16 = require('path');
5
5
  var prettier = require('prettier');
6
6
  var organizeImports = require('prettier-plugin-organize-imports');
7
7
  var generatorConverters = require('@osdk/generator-converters');
8
+ var fastDeepEqual = require('fast-deep-equal');
9
+ var invariant = require('tiny-invariant');
8
10
 
9
11
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
10
12
 
@@ -29,6 +31,8 @@ function _interopNamespace(e) {
29
31
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
30
32
  var path16__namespace = /*#__PURE__*/_interopNamespace(path16);
31
33
  var organizeImports__default = /*#__PURE__*/_interopDefault(organizeImports);
34
+ var fastDeepEqual__default = /*#__PURE__*/_interopDefault(fastDeepEqual);
35
+ var invariant__default = /*#__PURE__*/_interopDefault(invariant);
32
36
 
33
37
  // src/generateClientSdkPackage.ts
34
38
 
@@ -243,6 +247,38 @@ function createModifiedEntities(addedObjects, modifiedObjects) {
243
247
  }
244
248
  return entities;
245
249
  }
250
+
251
+ // src/shared/propertyJsdoc.ts
252
+ function propertyJsdoc(property, {
253
+ isInherited,
254
+ apiName
255
+ }) {
256
+ let ret = `/**
257
+ `;
258
+ const renderDisplayName = property.displayName && property.displayName !== apiName;
259
+ if (isInherited || renderDisplayName || property.description) {
260
+ if (isInherited) {
261
+ ret += ` * (inherited from parent)
262
+ `;
263
+ }
264
+ if (renderDisplayName) {
265
+ ret += ` * display name: '${property.displayName}'${property.description ? "," : ""}
266
+ `;
267
+ }
268
+ if (property.description) {
269
+ ret += ` * description: ${property.description}
270
+ `;
271
+ }
272
+ } else {
273
+ ret += ` * (no ontology metadata)
274
+ `;
275
+ }
276
+ ret += ` */
277
+ `;
278
+ return ret;
279
+ }
280
+
281
+ // src/shared/wireObjectTypeV2ToSdkObjectConst.ts
246
282
  function getObjectDefIdentifier(name, v2) {
247
283
  return v2 ? name : `${name}Def`;
248
284
  }
@@ -281,7 +317,9 @@ function wireObjectTypeV2ToSdkObjectConst(object, importExt, v2 = false) {
281
317
  }`,
282
318
  properties: (_value) => `{
283
319
  ${stringify(definition.properties, {
284
- "*": (propertyDefinition) => `PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`
320
+ "*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
321
+ apiName
322
+ })}${apiName}`, `PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
285
323
  })}
286
324
  }`
287
325
  })}
@@ -471,8 +509,8 @@ function camelize(name) {
471
509
  return name.replace(/-./g, (segment) => segment[1].toUpperCase());
472
510
  }
473
511
 
474
- // src/util/verifyOutdir.ts
475
- async function verifyOutdir(outDir, fs2) {
512
+ // src/util/verifyOutDir.ts
513
+ async function verifyOutDir(outDir, fs2) {
476
514
  try {
477
515
  const contents = await fs2.readdir(outDir);
478
516
  if (contents.length !== 0) {
@@ -570,7 +608,7 @@ function reexportConsts(typesToExport) {
570
608
  import { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
571
609
 
572
610
  ${typesToExport.map((q) => `
573
- /** @deprecated submodule imports arent public api **/
611
+ /** @deprecated submodule imports aren't public api **/
574
612
  export const ${q} = OG_${q};
575
613
  `).join("\n\n")}
576
614
  `;
@@ -620,7 +658,7 @@ function reexportTypes(typesToExport, genericArgsLeft = "", genericArgsRight = c
620
658
  import type { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
621
659
 
622
660
  ${typesToExport.map((q) => `
623
- /** @deprecated submodule imports arent public api **/
661
+ /** @deprecated submodule imports aren't public api **/
624
662
  export type ${q}${genericArgsLeft} = OG_${q}${genericArgsRight};
625
663
  `).join("\n\n")}
626
664
  `;
@@ -930,10 +968,7 @@ async function generateOntologyRuntimeDistDir(outDir, fs2, importExt = "") {
930
968
  await generateBaseTypesDir(runtimeDistDir, fs2, importExt);
931
969
  await generateClientDir(runtimeDistDir, fs2, importExt);
932
970
  await generateFiltersDir(runtimeDistDir, fs2, importExt);
933
- await fs2.writeFile(
934
- path16__namespace.join(runtimeDistDir, "index.ts"),
935
- // TRASHFIXME
936
- await formatTs(`
971
+ await fs2.writeFile(path16__namespace.join(runtimeDistDir, "index.ts"), await formatTs(`
937
972
  export * from "./aggregations/index${importExt}";
938
973
  export * from "./baseTypes/index${importExt}";
939
974
  ${""}
@@ -943,8 +978,7 @@ async function generateOntologyRuntimeDistDir(outDir, fs2, importExt = "") {
943
978
 
944
979
  export * from "./ontologyProvider/index${importExt}";
945
980
  export * from "./paging/index${importExt}";
946
- `)
947
- );
981
+ `));
948
982
  }
949
983
 
950
984
  // src/v1.1/generateBackCompatDeprecatedExports.ts
@@ -1307,10 +1341,10 @@ function wireQueryDataTypeToQueryDataTypeDefinition(input) {
1307
1341
  case "union":
1308
1342
  const allowNulls = isNullableQueryDataType(input);
1309
1343
  if (allowNulls && input.unionTypes.length === 2) {
1310
- const nonnull = input.unionTypes.find((t) => t.type != null);
1311
- if (nonnull) {
1344
+ const nonNull = input.unionTypes.find((t) => t.type != null);
1345
+ if (nonNull) {
1312
1346
  return {
1313
- ...wireQueryDataTypeToQueryDataTypeDefinition(nonnull),
1347
+ ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),
1314
1348
  nullable: true
1315
1349
  };
1316
1350
  }
@@ -1335,12 +1369,14 @@ function wireQueryDataTypeToQueryDataTypeDefinition(input) {
1335
1369
  case "twoDimensionalAggregation":
1336
1370
  return {
1337
1371
  type: "twoDimensionalAggregation",
1338
- twoDimensionalAggregation: get2DQueryAggregationProps(input)
1372
+ twoDimensionalAggregation: get2DQueryAggregationProps(input),
1373
+ nullable: false
1339
1374
  };
1340
1375
  case "threeDimensionalAggregation":
1341
1376
  return {
1342
1377
  type: "threeDimensionalAggregation",
1343
- threeDimensionalAggregation: get3DQueryAggregationProps(input)
1378
+ threeDimensionalAggregation: get3DQueryAggregationProps(input),
1379
+ nullable: false
1344
1380
  };
1345
1381
  case "null":
1346
1382
  case "unsupported":
@@ -1399,6 +1435,15 @@ function wireQueryTypeV2ToSdkQueryDefinition(input) {
1399
1435
  output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)
1400
1436
  };
1401
1437
  }
1438
+ function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {
1439
+ return {
1440
+ type: "query",
1441
+ apiName: input.apiName,
1442
+ description: input.description,
1443
+ displayName: input.displayName,
1444
+ version: input.version
1445
+ };
1446
+ }
1402
1447
  function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
1403
1448
  return {
1404
1449
  description: parameter.description,
@@ -1407,19 +1452,36 @@ function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
1407
1452
  }
1408
1453
 
1409
1454
  // src/v1.1/generatePerQueryDataFiles.ts
1410
- async function generatePerQueryDataFiles(ontology, fs2, outDir, importExt = "") {
1455
+ async function generatePerQueryDataFiles(ontology, fs2, outDir, importExt = "", v2 = false) {
1411
1456
  await fs2.mkdir(outDir, {
1412
1457
  recursive: true
1413
1458
  });
1414
1459
  await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {
1415
1460
  const objectTypes = getObjectTypesFromQuery(query);
1416
- await fs2.writeFile(path16__namespace.default.join(outDir, `${query.apiName}.ts`), await formatTs(`
1417
- import { QueryDefinition } from "@osdk/api";
1418
-
1419
- export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} satisfies QueryDefinition<"${query.apiName}", ${objectTypes.length > 0 ? objectTypes.map((apiName) => `"${apiName}"`).join("|") : "never"}>;`));
1461
+ const importObjects = objectTypes.length > 0 ? `import {${[...objectTypes].join(",")}} from "../objects${importExt}";` : "";
1462
+ if (v2) {
1463
+ await fs2.writeFile(path16__namespace.default.join(outDir, `${query.apiName}.ts`), await formatTs(`
1464
+ import { QueryDefinition } from "@osdk/api";
1465
+ ${importObjects}
1466
+ export const ${query.apiName} = {
1467
+ ${stringify(deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query)))},
1468
+ parameters: {${Object.entries(query.parameters).map(([name, parameter]) => {
1469
+ return `${name} : {${stringify(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))},
1470
+ ${parameter.dataType.type === "object" || parameter.dataType.type === "objectSet" ? getOsdkTargetTypeIfPresent(parameter.dataType.objectTypeApiName, v2) : ``}}`;
1471
+ })}},
1472
+ output: {${stringify(deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output)))},
1473
+ ${query.output.type === "object" || query.output.type === "objectSet" ? getOsdkTargetTypeIfPresent(query.output.objectTypeApiName, v2) : ``}}
1474
+ } ${getQueryDefSatisfies(query.apiName, objectTypes)}`));
1475
+ } else {
1476
+ await fs2.writeFile(path16__namespace.default.join(outDir, `${query.apiName}.ts`), await formatTs(`
1477
+ import { QueryDefinition } from "@osdk/api";
1478
+
1479
+ export const ${query.apiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query))} ${getQueryDefSatisfies(query.apiName, objectTypes)}`));
1480
+ }
1420
1481
  }));
1421
1482
  await fs2.writeFile(path16__namespace.default.join(outDir, "index.ts"), await formatTs(`
1422
1483
  ${Object.values(ontology.queryTypes).map((query) => `export * from "./${query.apiName}${importExt}";`).join("\n")}
1484
+ ${Object.keys(ontology.queryTypes).length === 0 ? "export {};" : ""}
1423
1485
  `));
1424
1486
  }
1425
1487
  function getObjectTypesFromQuery(query) {
@@ -1472,6 +1534,14 @@ function getObjectTypesFromDataType(dataType, types) {
1472
1534
  throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);
1473
1535
  }
1474
1536
  }
1537
+ function getQueryDefSatisfies(apiName, objectTypes) {
1538
+ return `satisfies QueryDefinition<"${apiName}", ${objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never"}>;`;
1539
+ }
1540
+ function getOsdkTargetTypeIfPresent(objectTypeApiName, v2) {
1541
+ return `
1542
+ __OsdkTargetType: ${getObjectDefIdentifier(objectTypeApiName, v2)}
1543
+ `;
1544
+ }
1475
1545
  async function generateQueries(ontology, fs2, outDir, importExt = "") {
1476
1546
  const importedObjects = /* @__PURE__ */ new Set();
1477
1547
  const signatures = [];
@@ -1621,7 +1691,7 @@ async function generateClientSdkVersionOneDotOne(ontology, userAgent, fs2, outDi
1621
1691
  const objectsDir = path16__namespace.join(outDir, "ontology", "objects");
1622
1692
  const actionsDir = path16__namespace.join(outDir, "ontology", "actions");
1623
1693
  const queriesDir = path16__namespace.join(outDir, "ontology", "queries");
1624
- await verifyOutdir(outDir, fs2);
1694
+ await verifyOutDir(outDir, fs2);
1625
1695
  await fs2.mkdir(outDir, {
1626
1696
  recursive: true
1627
1697
  });
@@ -1641,9 +1711,37 @@ async function generateClientSdkVersionOneDotOne(ontology, userAgent, fs2, outDi
1641
1711
  await generateIndexFile(fs2, outDir, importExt);
1642
1712
  await generateBackCompatDeprecatedExports(fs2, outDir, importExt);
1643
1713
  }
1644
- function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, v2 = false) {
1714
+ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
1645
1715
  const definition = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef, v2));
1646
1716
  const objectDefIdentifier = getObjectDefIdentifier(interfaceDef.apiName, v2);
1717
+ const parents = definition.implements?.map((p) => {
1718
+ !(ontology.interfaceTypes[p] != null) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : invariant__default.default(false) : void 0;
1719
+ const it = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.interfaceTypes[p], v2));
1720
+ return it;
1721
+ }) ?? [];
1722
+ const mergedProperties = {
1723
+ ...definition.properties
1724
+ };
1725
+ for (const parent of parents) {
1726
+ for (const apiName of Object.keys(parent.properties)) {
1727
+ if (definition.properties[apiName] != null) {
1728
+ !fastDeepEqual__default.default(definition.properties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : invariant__default.default(false) : void 0;
1729
+ } else if (mergedProperties[apiName] != null) {
1730
+ !fastDeepEqual__default.default(mergedProperties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : invariant__default.default(false) : void 0;
1731
+ }
1732
+ mergedProperties[apiName] = parent.properties[apiName];
1733
+ }
1734
+ }
1735
+ const ogProperties = definition.properties;
1736
+ definition.properties = mergedProperties;
1737
+ function localPropertyJsdoc(apiName) {
1738
+ const property = definition.properties[apiName];
1739
+ const isInherited = ogProperties[apiName] == null;
1740
+ return propertyJsdoc(property, {
1741
+ isInherited,
1742
+ apiName
1743
+ });
1744
+ }
1647
1745
  function getV2Types() {
1648
1746
  return `
1649
1747
  export interface ${objectDefIdentifier} extends InterfaceDefinition<"${interfaceDef.apiName}", ${interfaceDef.apiName}>, VersionBound<$ExpectedClientVersion> {
@@ -1657,9 +1755,9 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, v2 = false
1657
1755
  "*": (definition2) => `ObjectTypeLinkDefinition<${getObjectDefIdentifier(definition2.targetType, v2)}, ${definition2.multiplicity}>`
1658
1756
  })}
1659
1757
  }`,
1660
- properties: (_value) => `{
1661
- ${stringify(definition.properties, {
1662
- "*": (propertyDefinition) => `PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`
1758
+ properties: (properties) => `{
1759
+ ${stringify(properties, {
1760
+ "*": (propertyDefinition, _, key) => [`${localPropertyJsdoc(key)}${key}`, `PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
1663
1761
  })}
1664
1762
  }`
1665
1763
  })}
@@ -1701,11 +1799,11 @@ async function generateOntologyMetadataFile(ontology, userAgent, fs2, outDir) {
1701
1799
 
1702
1800
  // src/v2.0/generateClientSdkVersionTwoPointZero.ts
1703
1801
  async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, outDir, packageType = "commonjs") {
1704
- await verifyOutdir(outDir, fs2);
1802
+ await verifyOutDir(outDir, fs2);
1705
1803
  const sanitizedOntology = sanitizeMetadata(ontology);
1706
1804
  const objectNames = Object.keys(sanitizedOntology.objectTypes).sort((a, b) => a.localeCompare(b));
1707
1805
  const actionNames = Object.keys(sanitizedOntology.actionTypes).sort((a, b) => a.localeCompare(b));
1708
- Object.keys(sanitizedOntology.queryTypes).sort((a, b) => a.localeCompare(b));
1806
+ const queryNames = Object.keys(sanitizedOntology.queryTypes).sort((a, b) => a.localeCompare(b));
1709
1807
  const interfaceNames = Object.keys(sanitizedOntology.interfaceTypes ?? {}).sort((a, b) => a.localeCompare(b));
1710
1808
  const importExt = packageType === "module" ? ".js" : "";
1711
1809
  await fs2.mkdir(outDir, {
@@ -1716,6 +1814,7 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1716
1814
  export * from "./ontology/actions/index${importExt}";
1717
1815
  export * from "./ontology/objects${importExt}";
1718
1816
  export * from "./ontology/interfaces${importExt}";
1817
+ export * from "./ontology/queries/index${importExt}";
1719
1818
  `));
1720
1819
  await generateOntologyMetadataFile(sanitizedOntology, userAgent, fs2, outDir);
1721
1820
  await fs2.writeFile(path16__namespace.default.join(outDir, "Ontology.ts"), await formatTs(`
@@ -1723,6 +1822,7 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1723
1822
  import * as Actions from "./ontology/actions/index${importExt}";
1724
1823
  import * as Objects from "./ontology/objects${importExt}";
1725
1824
  import * as Interfaces from "./ontology/interfaces${importExt}";
1825
+ import * as Queries from "./ontology/queries/index${importExt}";
1726
1826
  import { OntologyMetadata } from "./OntologyMetadata${importExt}";
1727
1827
 
1728
1828
  export interface Ontology extends OntologyDefinition<${stringUnionFrom2(objectNames)}> {
@@ -1738,7 +1838,9 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1738
1838
  }).join(",\n")}
1739
1839
  },
1740
1840
  queries: {
1741
- // TODO
1841
+ ${queryNames.map((queryName) => {
1842
+ return `${queryName}: typeof Queries.${queryName}`;
1843
+ }).join(",\n")}
1742
1844
  },
1743
1845
  interfaces: {
1744
1846
  ${interfaceNames.map((objectName) => {
@@ -1761,7 +1863,9 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1761
1863
  }).join(",\n")}
1762
1864
  },
1763
1865
  queries: {
1764
- // TODO
1866
+ ${queryNames.map((queryName) => {
1867
+ return `${queryName}: Queries.${queryName}`;
1868
+ }).join(",\n")}
1765
1869
  },
1766
1870
  interfaces: {
1767
1871
  ${interfaceNames.map((objectName) => {
@@ -1796,6 +1900,11 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
1796
1900
  ${Object.keys(ontology.objectTypes).sort((a, b) => a.localeCompare(b)).map((apiName) => `export * from "./objects/${apiName}${importExt}";`).join("\n")}
1797
1901
  ${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
1798
1902
  `));
1903
+ const queriesDir = path16__namespace.default.join(outDir, "ontology", "queries");
1904
+ await fs2.mkdir(queriesDir, {
1905
+ recursive: true
1906
+ });
1907
+ await generatePerQueryDataFiles(sanitizedOntology, fs2, queriesDir, importExt, true);
1799
1908
  }
1800
1909
  function stringUnionFrom2(values) {
1801
1910
  if (values.length === 0) {
@@ -1817,7 +1926,7 @@ async function generateOntologyInterfaces(fs2, outDir, interfaceNames, ontology,
1817
1926
  import { $osdkMetadata, $expectedClientVersion } from "../../OntologyMetadata${importExt}";
1818
1927
  import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
1819
1928
 
1820
- ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, true)}
1929
+ ${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
1821
1930
  `));
1822
1931
  }
1823
1932
  await fs2.writeFile(interfacesDir + ".ts", await formatTs(`