@osdk/generator 2.2.0-beta.8 → 2.2.0-rc.24

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 (50) hide show
  1. package/CHANGELOG.md +267 -0
  2. package/build/browser/GenerateContext/GenerateContext.js.map +1 -1
  3. package/build/browser/util/test/TodoWireOntology.js +4 -2
  4. package/build/browser/util/test/TodoWireOntology.js.map +1 -1
  5. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +19 -0
  6. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  7. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
  8. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  9. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +470 -32
  10. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  11. package/build/browser/v2.0/generatePerActionDataFiles.js +2 -2
  12. package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
  13. package/build/browser/v2.0/generatePerQueryDataFiles.js +7 -9
  14. package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
  15. package/build/browser/v2.0/generatePerQueryDataFiles.test.js +16 -8
  16. package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  17. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +3 -4
  18. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  19. package/build/cjs/index.cjs +83 -1148
  20. package/build/cjs/index.cjs.map +1 -1
  21. package/build/cjs/index.d.cts +1 -1
  22. package/build/esm/GenerateContext/GenerateContext.js.map +1 -1
  23. package/build/esm/util/test/TodoWireOntology.js +4 -2
  24. package/build/esm/util/test/TodoWireOntology.js.map +1 -1
  25. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +19 -0
  26. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  27. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
  28. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
  29. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +470 -32
  30. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  31. package/build/esm/v2.0/generatePerActionDataFiles.js +2 -2
  32. package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
  33. package/build/esm/v2.0/generatePerQueryDataFiles.js +7 -9
  34. package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
  35. package/build/esm/v2.0/generatePerQueryDataFiles.test.js +16 -8
  36. package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
  37. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +3 -4
  38. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  39. package/build/types/GenerateContext/GenerateContext.d.ts +1 -0
  40. package/build/types/GenerateContext/GenerateContext.d.ts.map +1 -1
  41. package/build/types/index.d.ts +2 -2
  42. package/build/types/index.d.ts.map +1 -1
  43. package/build/types/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
  44. package/build/types/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
  45. package/build/types/v2.0/generatePerQueryDataFiles.d.ts +1 -1
  46. package/build/types/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
  47. package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  48. package/package.json +5 -5
  49. package/build/cjs/prompt-IKRSF7JL.cjs +0 -954
  50. package/build/cjs/prompt-IKRSF7JL.cjs.map +0 -1
@@ -243,6 +243,7 @@ const referencingOntology = {
243
243
  "apiName": "setTaskBody",
244
244
  "parameters": {
245
245
  "task": {
246
+ "displayName": "taskBody",
246
247
  "dataType": {
247
248
  "type": "object",
248
249
  "objectApiName": "com.example.dep.Task",
@@ -251,6 +252,7 @@ const referencingOntology = {
251
252
  "required": true
252
253
  },
253
254
  "body": {
255
+ "displayName": "body",
254
256
  "dataType": {
255
257
  "type": "string"
256
258
  },
@@ -472,13 +474,13 @@ describe("generator", () => {
472
474
  /**
473
475
  * An action which takes in an array of objects
474
476
  */
475
- applyAction<P extends deleteTodos.Params, OP extends ApplyActionOptions>(
476
- args: P,
477
+ applyAction<OP extends ApplyActionOptions>(
478
+ args: deleteTodos.Params,
477
479
  options?: OP,
478
480
  ): Promise<ActionReturnTypeForOptions<OP>>;
479
481
 
480
- batchApplyAction<P extends ReadonlyArray<deleteTodos.Params>, OP extends ApplyBatchActionOptions>(
481
- args: P,
482
+ batchApplyAction<OP extends ApplyBatchActionOptions>(
483
+ args: ReadonlyArray<deleteTodos.Params>,
482
484
  options?: OP,
483
485
  ): Promise<ActionReturnTypeForOptions<OP>>;
484
486
  }
@@ -548,13 +550,13 @@ describe("generator", () => {
548
550
  /**
549
551
  * An action which takes different types of parameters
550
552
  */
551
- applyAction<P extends markTodoCompleted.Params, OP extends ApplyActionOptions>(
552
- args: P,
553
+ applyAction<OP extends ApplyActionOptions>(
554
+ args: markTodoCompleted.Params,
553
555
  options?: OP,
554
556
  ): Promise<ActionReturnTypeForOptions<OP>>;
555
557
 
556
- batchApplyAction<P extends ReadonlyArray<markTodoCompleted.Params>, OP extends ApplyBatchActionOptions>(
557
- args: P,
558
+ batchApplyAction<OP extends ApplyBatchActionOptions>(
559
+ args: ReadonlyArray<markTodoCompleted.Params>,
558
560
  options?: OP,
559
561
  ): Promise<ActionReturnTypeForOptions<OP>>;
560
562
  }
@@ -610,6 +612,10 @@ describe("generator", () => {
610
612
  export type PropertyKeys = 'SomeProperty';
611
613
 
612
614
  export interface Props {
615
+ /**
616
+ * display name: 'Sum Property',
617
+ * description: Some property
618
+ */
613
619
  readonly SomeProperty: $PropType['string'] | undefined;
614
620
  }
615
621
  export type StrictProps = Props;
@@ -689,6 +695,9 @@ describe("generator", () => {
689
695
  }
690
696
 
691
697
  export interface Props {
698
+ /**
699
+ * (no ontology metadata)
700
+ */
692
701
  readonly email: $PropType['string'];
693
702
  }
694
703
  export type StrictProps = Props;
@@ -777,8 +786,18 @@ describe("generator", () => {
777
786
  }
778
787
 
779
788
  export interface Props {
789
+ /**
790
+ * display name: 'Body',
791
+ * description: The text of the todo
792
+ */
780
793
  readonly body: $PropType['string'] | undefined;
794
+ /**
795
+ * (no ontology metadata)
796
+ */
781
797
  readonly complete: $PropType['boolean'] | undefined;
798
+ /**
799
+ * (no ontology metadata)
800
+ */
782
801
  readonly id: $PropType['integer'];
783
802
  }
784
803
  export type StrictProps = Props;
@@ -886,7 +905,8 @@ describe("generator", () => {
886
905
  apiName: 'getCount';
887
906
  rid: 'rid.query.1';
888
907
  type: 'query';
889
- version: '0';
908
+ version: '1.1.0';
909
+ isFixedVersion: false;
890
910
  parameters: {
891
911
  /**
892
912
  * (no ontology metadata)
@@ -904,14 +924,15 @@ describe("generator", () => {
904
924
  };
905
925
  apiName: 'getCount';
906
926
  type: 'query';
907
- version: '0';
927
+ version: '1.1.0';
908
928
  osdkMetadata: typeof $osdkMetadata;
909
929
  }
910
930
 
911
931
  export const getCount: getCount = {
912
932
  apiName: 'getCount',
913
933
  type: 'query',
914
- version: '0',
934
+ version: '1.1.0',
935
+ isFixedVersion: false,
915
936
  osdkMetadata: $osdkMetadata,
916
937
  };
917
938
  ",
@@ -940,7 +961,8 @@ describe("generator", () => {
940
961
  apiName: 'returnsTodo';
941
962
  rid: 'rid.query.2';
942
963
  type: 'query';
943
- version: '0';
964
+ version: '3.2.0';
965
+ isFixedVersion: false;
944
966
  parameters: {
945
967
  /**
946
968
  * description: Random desc so we test jsdoc
@@ -963,14 +985,15 @@ describe("generator", () => {
963
985
  };
964
986
  apiName: 'returnsTodo';
965
987
  type: 'query';
966
- version: '0';
988
+ version: '3.2.0';
967
989
  osdkMetadata: typeof $osdkMetadata;
968
990
  }
969
991
 
970
992
  export const returnsTodo: returnsTodo = {
971
993
  apiName: 'returnsTodo',
972
994
  type: 'query',
973
- version: '0',
995
+ version: '3.2.0',
996
+ isFixedVersion: false,
974
997
  osdkMetadata: $osdkMetadata,
975
998
  };
976
999
  ",
@@ -1055,13 +1078,13 @@ describe("generator", () => {
1055
1078
  /**
1056
1079
  * An action which takes in an array of objects
1057
1080
  */
1058
- applyAction<P extends deleteTodos.Params, OP extends ApplyActionOptions>(
1059
- args: P,
1081
+ applyAction<OP extends ApplyActionOptions>(
1082
+ args: deleteTodos.Params,
1060
1083
  options?: OP,
1061
1084
  ): Promise<ActionReturnTypeForOptions<OP>>;
1062
1085
 
1063
- batchApplyAction<P extends ReadonlyArray<deleteTodos.Params>, OP extends ApplyBatchActionOptions>(
1064
- args: P,
1086
+ batchApplyAction<OP extends ApplyBatchActionOptions>(
1087
+ args: ReadonlyArray<deleteTodos.Params>,
1065
1088
  options?: OP,
1066
1089
  ): Promise<ActionReturnTypeForOptions<OP>>;
1067
1090
  }
@@ -1131,13 +1154,13 @@ describe("generator", () => {
1131
1154
  /**
1132
1155
  * An action which takes different types of parameters
1133
1156
  */
1134
- applyAction<P extends markTodoCompleted.Params, OP extends ApplyActionOptions>(
1135
- args: P,
1157
+ applyAction<OP extends ApplyActionOptions>(
1158
+ args: markTodoCompleted.Params,
1136
1159
  options?: OP,
1137
1160
  ): Promise<ActionReturnTypeForOptions<OP>>;
1138
1161
 
1139
- batchApplyAction<P extends ReadonlyArray<markTodoCompleted.Params>, OP extends ApplyBatchActionOptions>(
1140
- args: P,
1162
+ batchApplyAction<OP extends ApplyBatchActionOptions>(
1163
+ args: ReadonlyArray<markTodoCompleted.Params>,
1141
1164
  options?: OP,
1142
1165
  ): Promise<ActionReturnTypeForOptions<OP>>;
1143
1166
  }
@@ -1193,6 +1216,10 @@ describe("generator", () => {
1193
1216
  export type PropertyKeys = 'SomeProperty';
1194
1217
 
1195
1218
  export interface Props {
1219
+ /**
1220
+ * display name: 'Sum Property',
1221
+ * description: Some property
1222
+ */
1196
1223
  readonly SomeProperty: $PropType['string'] | undefined;
1197
1224
  }
1198
1225
  export type StrictProps = Props;
@@ -1272,6 +1299,9 @@ describe("generator", () => {
1272
1299
  }
1273
1300
 
1274
1301
  export interface Props {
1302
+ /**
1303
+ * (no ontology metadata)
1304
+ */
1275
1305
  readonly email: $PropType['string'];
1276
1306
  }
1277
1307
  export type StrictProps = Props;
@@ -1360,8 +1390,18 @@ describe("generator", () => {
1360
1390
  }
1361
1391
 
1362
1392
  export interface Props {
1393
+ /**
1394
+ * display name: 'Body',
1395
+ * description: The text of the todo
1396
+ */
1363
1397
  readonly body: $PropType['string'] | undefined;
1398
+ /**
1399
+ * (no ontology metadata)
1400
+ */
1364
1401
  readonly complete: $PropType['boolean'] | undefined;
1402
+ /**
1403
+ * (no ontology metadata)
1404
+ */
1365
1405
  readonly id: $PropType['integer'];
1366
1406
  }
1367
1407
  export type StrictProps = Props;
@@ -1469,7 +1509,8 @@ describe("generator", () => {
1469
1509
  apiName: 'foo.bar.getCount';
1470
1510
  rid: 'rid.query.1';
1471
1511
  type: 'query';
1472
- version: '0';
1512
+ version: '1.1.0';
1513
+ isFixedVersion: false;
1473
1514
  parameters: {
1474
1515
  /**
1475
1516
  * (no ontology metadata)
@@ -1487,14 +1528,15 @@ describe("generator", () => {
1487
1528
  };
1488
1529
  apiName: 'foo.bar.getCount';
1489
1530
  type: 'query';
1490
- version: '0';
1531
+ version: '1.1.0';
1491
1532
  osdkMetadata: typeof $osdkMetadata;
1492
1533
  }
1493
1534
 
1494
1535
  export const getCount: getCount = {
1495
1536
  apiName: 'foo.bar.getCount',
1496
1537
  type: 'query',
1497
- version: '0',
1538
+ version: '1.1.0',
1539
+ isFixedVersion: false,
1498
1540
  osdkMetadata: $osdkMetadata,
1499
1541
  };
1500
1542
  ",
@@ -1523,7 +1565,8 @@ describe("generator", () => {
1523
1565
  apiName: 'foo.bar.returnsTodo';
1524
1566
  rid: 'rid.query.2';
1525
1567
  type: 'query';
1526
- version: '0';
1568
+ version: '3.2.0';
1569
+ isFixedVersion: false;
1527
1570
  parameters: {
1528
1571
  /**
1529
1572
  * description: Random desc so we test jsdoc
@@ -1546,14 +1589,15 @@ describe("generator", () => {
1546
1589
  };
1547
1590
  apiName: 'foo.bar.returnsTodo';
1548
1591
  type: 'query';
1549
- version: '0';
1592
+ version: '3.2.0';
1550
1593
  osdkMetadata: typeof $osdkMetadata;
1551
1594
  }
1552
1595
 
1553
1596
  export const returnsTodo: returnsTodo = {
1554
1597
  apiName: 'foo.bar.returnsTodo',
1555
1598
  type: 'query',
1556
- version: '0',
1599
+ version: '3.2.0',
1600
+ isFixedVersion: false,
1557
1601
  osdkMetadata: $osdkMetadata,
1558
1602
  };
1559
1603
  ",
@@ -1635,6 +1679,7 @@ describe("generator", () => {
1635
1679
  rid: 'ri.a.b.c';
1636
1680
  type: 'query';
1637
1681
  version: '0';
1682
+ isFixedVersion: false;
1638
1683
  parameters: {
1639
1684
  /**
1640
1685
  * (no ontology metadata)
@@ -1664,6 +1709,7 @@ describe("generator", () => {
1664
1709
  apiName: 'getTask',
1665
1710
  type: 'query',
1666
1711
  version: '0',
1712
+ isFixedVersion: false,
1667
1713
  osdkMetadata: $osdkMetadata,
1668
1714
  };
1669
1715
  "
@@ -1696,7 +1742,13 @@ describe("generator", () => {
1696
1742
  export type Links = {};
1697
1743
 
1698
1744
  export interface Props {
1745
+ /**
1746
+ * (no ontology metadata)
1747
+ */
1699
1748
  readonly body: $PropType['string'] | undefined;
1749
+ /**
1750
+ * (no ontology metadata)
1751
+ */
1700
1752
  readonly id: $PropType['integer'];
1701
1753
  }
1702
1754
  export type StrictProps = Props;
@@ -1802,13 +1854,13 @@ describe("generator", () => {
1802
1854
 
1803
1855
  // Represents a fqn of the action
1804
1856
  export interface Signatures {
1805
- applyAction<P extends setTaskBody.Params, OP extends ApplyActionOptions>(
1806
- args: P,
1857
+ applyAction<OP extends ApplyActionOptions>(
1858
+ args: setTaskBody.Params,
1807
1859
  options?: OP,
1808
1860
  ): Promise<ActionReturnTypeForOptions<OP>>;
1809
1861
 
1810
- batchApplyAction<P extends ReadonlyArray<setTaskBody.Params>, OP extends ApplyBatchActionOptions>(
1811
- args: P,
1862
+ batchApplyAction<OP extends ApplyBatchActionOptions>(
1863
+ args: ReadonlyArray<setTaskBody.Params>,
1812
1864
  options?: OP,
1813
1865
  ): Promise<ActionReturnTypeForOptions<OP>>;
1814
1866
  }
@@ -1848,6 +1900,380 @@ describe("generator", () => {
1848
1900
  `);
1849
1901
  });
1850
1902
  });
1903
+ describe("queries with versions", () => {
1904
+ it("can generate properly when queries have versions and optionally have fixed versions", async () => {
1905
+ await generateClientSdkVersionTwoPointZero({
1906
+ ontology: TodoWireOntology.ontology,
1907
+ actionTypes: {},
1908
+ interfaceTypes: {},
1909
+ objectTypes: TodoWireOntology.objectTypes,
1910
+ queryTypes: {
1911
+ "getCount:1.1.0": {
1912
+ ...TodoWireOntology.queryTypes.getCount
1913
+ },
1914
+ "returnsTodo:3.2.0": {
1915
+ ...TodoWireOntology.queryTypes.returnsTodo,
1916
+ version: "0"
1917
+ }
1918
+ },
1919
+ sharedPropertyTypes: {}
1920
+ }, "typescript-sdk/0.0.0 osdk-cli/0.0.0", helper.minimalFiles, BASE_PATH, "module", new Map(), new Map(), new Map(), false, ["getCount"]);
1921
+ expect(tweakedFilesForSnapshotConsistency(helper.getFiles())).toMatchInlineSnapshot(`
1922
+ {
1923
+ "/foo/OntologyMetadata.ts": "export type $ExpectedClientVersion = 'PLACEHOLDER';
1924
+ export const $osdkMetadata = { extraUserAgent: 'typescript-sdk/0.0.0 osdk-cli/0.0.0' };
1925
+
1926
+ export const $ontologyRid = 'ridHere';
1927
+ ",
1928
+ "/foo/index.ts": "export {} from './ontology/actions.js';
1929
+ export * as $Actions from './ontology/actions.js';
1930
+ export {} from './ontology/interfaces.js';
1931
+ export * as $Interfaces from './ontology/interfaces.js';
1932
+ export { Person, Todo } from './ontology/objects.js';
1933
+ export * as $Objects from './ontology/objects.js';
1934
+ export { getCount, returnsTodo } from './ontology/queries.js';
1935
+ export * as $Queries from './ontology/queries.js';
1936
+ export { $osdkMetadata } from './OntologyMetadata.js';
1937
+ export { $ontologyRid } from './OntologyMetadata.js';
1938
+ ",
1939
+ "/foo/ontology/actions.ts": "export {};
1940
+ ",
1941
+ "/foo/ontology/interfaces.ts": "export {};
1942
+ ",
1943
+ "/foo/ontology/objects.ts": "export { Person } from './objects/Person.js';
1944
+ export { Todo } from './objects/Todo.js';
1945
+ ",
1946
+ "/foo/ontology/objects/Person.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
1947
+ import { $osdkMetadata } from '../../OntologyMetadata.js';
1948
+ import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
1949
+ import type { Todo } from './Todo.js';
1950
+ import type {
1951
+ PropertyKeys as $PropertyKeys,
1952
+ ObjectTypeDefinition as $ObjectTypeDefinition,
1953
+ ObjectMetadata as $ObjectMetadata,
1954
+ } from '@osdk/client';
1955
+ import type {
1956
+ ObjectSet as $ObjectSet,
1957
+ Osdk as $Osdk,
1958
+ OsdkObject as $OsdkObject,
1959
+ PropertyValueWireToClient as $PropType,
1960
+ SingleLinkAccessor as $SingleLinkAccessor,
1961
+ } from '@osdk/client';
1962
+
1963
+ export namespace Person {
1964
+ export type PropertyKeys = 'email';
1965
+
1966
+ export interface Links {
1967
+ readonly Todos: Todo.ObjectSet;
1968
+ }
1969
+
1970
+ export interface Props {
1971
+ /**
1972
+ * (no ontology metadata)
1973
+ */
1974
+ readonly email: $PropType['string'];
1975
+ }
1976
+ export type StrictProps = Props;
1977
+
1978
+ export interface ObjectSet extends $ObjectSet<Person, Person.ObjectSet> {}
1979
+
1980
+ export type OsdkInstance<
1981
+ OPTIONS extends never | '$rid' = never,
1982
+ K extends keyof Person.Props = keyof Person.Props,
1983
+ > = $Osdk.Instance<Person, OPTIONS, K>;
1984
+
1985
+ /** @deprecated use OsdkInstance */
1986
+ export type OsdkObject<
1987
+ OPTIONS extends never | '$rid' = never,
1988
+ K extends keyof Person.Props = keyof Person.Props,
1989
+ > = OsdkInstance<OPTIONS, K>;
1990
+ }
1991
+
1992
+ export interface Person extends $ObjectTypeDefinition {
1993
+ osdkMetadata: typeof $osdkMetadata;
1994
+ type: 'object';
1995
+ apiName: 'Person';
1996
+ __DefinitionMetadata?: {
1997
+ objectSet: Person.ObjectSet;
1998
+ props: Person.Props;
1999
+ linksType: Person.Links;
2000
+ strictProps: Person.StrictProps;
2001
+ apiName: 'Person';
2002
+ description: 'A person';
2003
+ displayName: 'Person';
2004
+ icon: {
2005
+ type: 'blueprint';
2006
+ name: 'document';
2007
+ color: 'blue';
2008
+ };
2009
+ implements: [];
2010
+ interfaceMap: {};
2011
+ inverseInterfaceMap: {};
2012
+ links: {
2013
+ Todos: $ObjectMetadata.Link<Todo, true>;
2014
+ };
2015
+ pluralDisplayName: 'Persons';
2016
+ primaryKeyApiName: 'email';
2017
+ primaryKeyType: 'string';
2018
+ properties: {
2019
+ /**
2020
+ * (no ontology metadata)
2021
+ */
2022
+ email: $PropertyDef<'string', 'non-nullable', 'single'>;
2023
+ };
2024
+ rid: 'ridForPerson';
2025
+ status: 'ACTIVE';
2026
+ titleProperty: 'email';
2027
+ type: 'object';
2028
+ };
2029
+ }
2030
+
2031
+ export const Person: Person = {
2032
+ type: 'object',
2033
+ apiName: 'Person',
2034
+ osdkMetadata: $osdkMetadata,
2035
+ };
2036
+ ",
2037
+ "/foo/ontology/objects/Todo.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
2038
+ import { $osdkMetadata } from '../../OntologyMetadata.js';
2039
+ import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
2040
+ import type { Person } from './Person.js';
2041
+ import type {
2042
+ PropertyKeys as $PropertyKeys,
2043
+ ObjectTypeDefinition as $ObjectTypeDefinition,
2044
+ ObjectMetadata as $ObjectMetadata,
2045
+ } from '@osdk/client';
2046
+ import type {
2047
+ ObjectSet as $ObjectSet,
2048
+ Osdk as $Osdk,
2049
+ OsdkObject as $OsdkObject,
2050
+ PropertyValueWireToClient as $PropType,
2051
+ SingleLinkAccessor as $SingleLinkAccessor,
2052
+ } from '@osdk/client';
2053
+
2054
+ export namespace Todo {
2055
+ export type PropertyKeys = 'id' | 'body' | 'complete';
2056
+
2057
+ export interface Links {
2058
+ readonly Assignee: $SingleLinkAccessor<Person>;
2059
+ }
2060
+
2061
+ export interface Props {
2062
+ /**
2063
+ * display name: 'Body',
2064
+ * description: The text of the todo
2065
+ */
2066
+ readonly body: $PropType['string'] | undefined;
2067
+ /**
2068
+ * (no ontology metadata)
2069
+ */
2070
+ readonly complete: $PropType['boolean'] | undefined;
2071
+ /**
2072
+ * (no ontology metadata)
2073
+ */
2074
+ readonly id: $PropType['integer'];
2075
+ }
2076
+ export type StrictProps = Props;
2077
+
2078
+ export interface ObjectSet extends $ObjectSet<Todo, Todo.ObjectSet> {}
2079
+
2080
+ export type OsdkInstance<
2081
+ OPTIONS extends never | '$rid' = never,
2082
+ K extends keyof Todo.Props = keyof Todo.Props,
2083
+ > = $Osdk.Instance<Todo, OPTIONS, K>;
2084
+
2085
+ /** @deprecated use OsdkInstance */
2086
+ export type OsdkObject<
2087
+ OPTIONS extends never | '$rid' = never,
2088
+ K extends keyof Todo.Props = keyof Todo.Props,
2089
+ > = OsdkInstance<OPTIONS, K>;
2090
+ }
2091
+
2092
+ export interface Todo extends $ObjectTypeDefinition {
2093
+ osdkMetadata: typeof $osdkMetadata;
2094
+ type: 'object';
2095
+ apiName: 'Todo';
2096
+ __DefinitionMetadata?: {
2097
+ objectSet: Todo.ObjectSet;
2098
+ props: Todo.Props;
2099
+ linksType: Todo.Links;
2100
+ strictProps: Todo.StrictProps;
2101
+ apiName: 'Todo';
2102
+ description: 'Its a todo item.';
2103
+ displayName: 'AwesomeTodoDisplayname';
2104
+ icon: {
2105
+ type: 'blueprint';
2106
+ name: 'document';
2107
+ color: 'blue';
2108
+ };
2109
+ implements: ['SomeInterface'];
2110
+ interfaceMap: {
2111
+ SomeInterface: {
2112
+ SomeProperty: 'body';
2113
+ };
2114
+ };
2115
+ inverseInterfaceMap: {
2116
+ SomeInterface: {
2117
+ body: 'SomeProperty';
2118
+ };
2119
+ };
2120
+ links: {
2121
+ Assignee: $ObjectMetadata.Link<Person, false>;
2122
+ };
2123
+ pluralDisplayName: 'AwesomeTodoDisplayNames';
2124
+ primaryKeyApiName: 'id';
2125
+ primaryKeyType: 'integer';
2126
+ properties: {
2127
+ /**
2128
+ * display name: 'Body',
2129
+ * description: The text of the todo
2130
+ */
2131
+ body: $PropertyDef<'string', 'nullable', 'single'>;
2132
+ /**
2133
+ * (no ontology metadata)
2134
+ */
2135
+ complete: $PropertyDef<'boolean', 'nullable', 'single'>;
2136
+ /**
2137
+ * (no ontology metadata)
2138
+ */
2139
+ id: $PropertyDef<'integer', 'non-nullable', 'single'>;
2140
+ };
2141
+ rid: 'ridForTodo';
2142
+ status: 'ACTIVE';
2143
+ titleProperty: 'body';
2144
+ type: 'object';
2145
+ };
2146
+ }
2147
+
2148
+ export const Todo: Todo = {
2149
+ type: 'object',
2150
+ apiName: 'Todo',
2151
+ osdkMetadata: $osdkMetadata,
2152
+ };
2153
+ ",
2154
+ "/foo/ontology/queries.ts": "export { getCount } from './queries/getCount.js';
2155
+ export { returnsTodo } from './queries/returnsTodo.js';
2156
+ ",
2157
+ "/foo/ontology/queries/getCount.ts": "import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
2158
+ import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
2159
+ import { $osdkMetadata } from '../../OntologyMetadata.js';
2160
+
2161
+ export namespace getCount {
2162
+ export interface Signature {
2163
+ (query: getCount.Parameters): Promise<getCount.ReturnType>;
2164
+ }
2165
+
2166
+ export interface Parameters {
2167
+ /**
2168
+ * (no ontology metadata)
2169
+ */
2170
+ readonly completed: QueryParam.PrimitiveType<'boolean'>;
2171
+ }
2172
+
2173
+ export type ReturnType = QueryResult.PrimitiveType<'integer'>;
2174
+ }
2175
+
2176
+ export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
2177
+ __DefinitionMetadata?: {
2178
+ apiName: 'getCount';
2179
+ rid: 'rid.query.1';
2180
+ type: 'query';
2181
+ version: '1.1.0';
2182
+ isFixedVersion: true;
2183
+ parameters: {
2184
+ /**
2185
+ * (no ontology metadata)
2186
+ */
2187
+ completed: {
2188
+ nullable: false;
2189
+ type: 'boolean';
2190
+ };
2191
+ };
2192
+ output: {
2193
+ nullable: false;
2194
+ type: 'integer';
2195
+ };
2196
+ signature: getCount.Signature;
2197
+ };
2198
+ apiName: 'getCount';
2199
+ type: 'query';
2200
+ version: '1.1.0';
2201
+ osdkMetadata: typeof $osdkMetadata;
2202
+ }
2203
+
2204
+ export const getCount: getCount = {
2205
+ apiName: 'getCount',
2206
+ type: 'query',
2207
+ version: '1.1.0',
2208
+ isFixedVersion: true,
2209
+ osdkMetadata: $osdkMetadata,
2210
+ };
2211
+ ",
2212
+ "/foo/ontology/queries/returnsTodo.ts": "import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
2213
+ import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
2214
+ import { $osdkMetadata } from '../../OntologyMetadata.js';
2215
+ import type { Todo } from '../objects/Todo.js';
2216
+
2217
+ export namespace returnsTodo {
2218
+ export interface Signature {
2219
+ (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;
2220
+ }
2221
+
2222
+ export interface Parameters {
2223
+ /**
2224
+ * description: Random desc so we test jsdoc
2225
+ */
2226
+ readonly someTodo: QueryParam.ObjectType<Todo>;
2227
+ }
2228
+
2229
+ export type ReturnType = QueryResult.ObjectType<Todo>;
2230
+ }
2231
+
2232
+ export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
2233
+ __DefinitionMetadata?: {
2234
+ apiName: 'returnsTodo';
2235
+ rid: 'rid.query.2';
2236
+ type: 'query';
2237
+ version: '0';
2238
+ isFixedVersion: false;
2239
+ parameters: {
2240
+ /**
2241
+ * description: Random desc so we test jsdoc
2242
+ */
2243
+ someTodo: {
2244
+ description: 'Random desc so we test jsdoc';
2245
+ nullable: false;
2246
+ object: 'Todo';
2247
+ type: 'object';
2248
+ __OsdkTargetType?: Todo;
2249
+ };
2250
+ };
2251
+ output: {
2252
+ nullable: false;
2253
+ object: 'Todo';
2254
+ type: 'object';
2255
+ __OsdkTargetType?: Todo;
2256
+ };
2257
+ signature: returnsTodo.Signature;
2258
+ };
2259
+ apiName: 'returnsTodo';
2260
+ type: 'query';
2261
+ version: '0';
2262
+ osdkMetadata: typeof $osdkMetadata;
2263
+ }
2264
+
2265
+ export const returnsTodo: returnsTodo = {
2266
+ apiName: 'returnsTodo',
2267
+ type: 'query',
2268
+ version: '0',
2269
+ isFixedVersion: false,
2270
+ osdkMetadata: $osdkMetadata,
2271
+ };
2272
+ ",
2273
+ }
2274
+ `);
2275
+ });
2276
+ });
1851
2277
  it("can generate an sdk package that is entirely a library", async () => {
1852
2278
  const mockConsola = vi.spyOn(consola, "info");
1853
2279
  await expect(generateClientSdkVersionTwoPointZero(referencedOntology, "", helper.minimalFiles, BASE_PATH, "module")).resolves.toMatchInlineSnapshot(`undefined`);
@@ -1890,7 +2316,13 @@ describe("generator", () => {
1890
2316
  export type PropertyKeys = 'spt' | 'spt2';
1891
2317
 
1892
2318
  export interface Props {
2319
+ /**
2320
+ * display name: 'Some Property'
2321
+ */
1893
2322
  readonly spt: $PropType['string'] | undefined;
2323
+ /**
2324
+ * display name: 'Some Property 2'
2325
+ */
1894
2326
  readonly spt2: $PropType['string'] | undefined;
1895
2327
  }
1896
2328
  export type StrictProps = Props;
@@ -1968,7 +2400,13 @@ describe("generator", () => {
1968
2400
  export type Links = {};
1969
2401
 
1970
2402
  export interface Props {
2403
+ /**
2404
+ * (no ontology metadata)
2405
+ */
1971
2406
  readonly body: $PropType['string'] | undefined;
2407
+ /**
2408
+ * (no ontology metadata)
2409
+ */
1972
2410
  readonly taskId: $PropType['string'];
1973
2411
  }
1974
2412
  export type StrictProps = Props;