@osdk/generator 2.2.0-beta.2 → 2.2.0-beta.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +191 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.js +5 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -1
- package/build/browser/util/test/TodoWireOntology.js +6 -2
- package/build/browser/util/test/TodoWireOntology.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +102 -3
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +100 -30
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.js +2 -2
- package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +8 -2
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +3 -3
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +3 -4
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/cjs/index.cjs +51 -41
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/shared/getObjectTypesFromQueryDataType.js +5 -0
- package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -1
- package/build/esm/util/test/TodoWireOntology.js +6 -2
- package/build/esm/util/test/TodoWireOntology.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +102 -3
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +100 -30
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.js +2 -2
- package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +8 -2
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +3 -3
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +3 -4
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/types/index.d.ts +2 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/types/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/package.json +5 -5
- package/build/cjs/chunk-XOCES5YA.cjs +0 -978
- package/build/cjs/chunk-XOCES5YA.cjs.map +0 -1
- package/build/cjs/prompt-YMFYYBNJ.cjs +0 -860
- package/build/cjs/prompt-YMFYYBNJ.cjs.map +0 -1
|
@@ -84,8 +84,8 @@ function changeNames(ontology, newNames) {
|
|
|
84
84
|
// Handle interface renames
|
|
85
85
|
changeEachEntry(draft.interfaceTypes, newNames.interfaces, (ifaceType, oldIfaceName, newIfaceName) => {
|
|
86
86
|
changeValue(ifaceType, "apiName", oldIfaceName, newIfaceName);
|
|
87
|
-
ifaceType.extendsInterfaces = ifaceType.
|
|
88
|
-
changeEachEntry(ifaceType.
|
|
87
|
+
ifaceType.extendsInterfaces = ifaceType.allExtendsInterfaces.map(v => v === oldIfaceName ? newIfaceName : v);
|
|
88
|
+
changeEachEntry(ifaceType.allProperties, newNames.spts, (property, oldSptName, newSptName) => {
|
|
89
89
|
changeValue(property, "apiName", oldSptName, newSptName);
|
|
90
90
|
}, true);
|
|
91
91
|
}, true);
|
|
@@ -195,7 +195,8 @@ const referencedOntology = {
|
|
|
195
195
|
type: "string"
|
|
196
196
|
},
|
|
197
197
|
displayName: "Some Property",
|
|
198
|
-
rid: "idk"
|
|
198
|
+
rid: "idk",
|
|
199
|
+
required: true
|
|
199
200
|
}
|
|
200
201
|
},
|
|
201
202
|
implementedByObjectTypes: [],
|
|
@@ -209,7 +210,17 @@ const referencedOntology = {
|
|
|
209
210
|
type: "string"
|
|
210
211
|
},
|
|
211
212
|
displayName: "Some Property",
|
|
212
|
-
rid: "idk"
|
|
213
|
+
rid: "idk",
|
|
214
|
+
required: true
|
|
215
|
+
},
|
|
216
|
+
"com.example.dep.spt2": {
|
|
217
|
+
apiName: "com.example.dep.spt2",
|
|
218
|
+
dataType: {
|
|
219
|
+
type: "string"
|
|
220
|
+
},
|
|
221
|
+
displayName: "Some Property 2",
|
|
222
|
+
rid: "idk",
|
|
223
|
+
required: true
|
|
213
224
|
}
|
|
214
225
|
}
|
|
215
226
|
}
|
|
@@ -232,6 +243,7 @@ const referencingOntology = {
|
|
|
232
243
|
"apiName": "setTaskBody",
|
|
233
244
|
"parameters": {
|
|
234
245
|
"task": {
|
|
246
|
+
"displayName": "taskBody",
|
|
235
247
|
"dataType": {
|
|
236
248
|
"type": "object",
|
|
237
249
|
"objectApiName": "com.example.dep.Task",
|
|
@@ -240,6 +252,7 @@ const referencingOntology = {
|
|
|
240
252
|
"required": true
|
|
241
253
|
},
|
|
242
254
|
"body": {
|
|
255
|
+
"displayName": "body",
|
|
243
256
|
"dataType": {
|
|
244
257
|
"type": "string"
|
|
245
258
|
},
|
|
@@ -461,13 +474,13 @@ describe("generator", () => {
|
|
|
461
474
|
/**
|
|
462
475
|
* An action which takes in an array of objects
|
|
463
476
|
*/
|
|
464
|
-
applyAction<
|
|
465
|
-
args:
|
|
477
|
+
applyAction<OP extends ApplyActionOptions>(
|
|
478
|
+
args: deleteTodos.Params,
|
|
466
479
|
options?: OP,
|
|
467
480
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
468
481
|
|
|
469
|
-
batchApplyAction<
|
|
470
|
-
args:
|
|
482
|
+
batchApplyAction<OP extends ApplyBatchActionOptions>(
|
|
483
|
+
args: ReadonlyArray<deleteTodos.Params>,
|
|
471
484
|
options?: OP,
|
|
472
485
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
473
486
|
}
|
|
@@ -537,13 +550,13 @@ describe("generator", () => {
|
|
|
537
550
|
/**
|
|
538
551
|
* An action which takes different types of parameters
|
|
539
552
|
*/
|
|
540
|
-
applyAction<
|
|
541
|
-
args:
|
|
553
|
+
applyAction<OP extends ApplyActionOptions>(
|
|
554
|
+
args: markTodoCompleted.Params,
|
|
542
555
|
options?: OP,
|
|
543
556
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
544
557
|
|
|
545
|
-
batchApplyAction<
|
|
546
|
-
args:
|
|
558
|
+
batchApplyAction<OP extends ApplyBatchActionOptions>(
|
|
559
|
+
args: ReadonlyArray<markTodoCompleted.Params>,
|
|
547
560
|
options?: OP,
|
|
548
561
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
549
562
|
}
|
|
@@ -599,6 +612,10 @@ describe("generator", () => {
|
|
|
599
612
|
export type PropertyKeys = 'SomeProperty';
|
|
600
613
|
|
|
601
614
|
export interface Props {
|
|
615
|
+
/**
|
|
616
|
+
* display name: 'Sum Property',
|
|
617
|
+
* description: Some property
|
|
618
|
+
*/
|
|
602
619
|
readonly SomeProperty: $PropType['string'] | undefined;
|
|
603
620
|
}
|
|
604
621
|
export type StrictProps = Props;
|
|
@@ -678,6 +695,9 @@ describe("generator", () => {
|
|
|
678
695
|
}
|
|
679
696
|
|
|
680
697
|
export interface Props {
|
|
698
|
+
/**
|
|
699
|
+
* (no ontology metadata)
|
|
700
|
+
*/
|
|
681
701
|
readonly email: $PropType['string'];
|
|
682
702
|
}
|
|
683
703
|
export type StrictProps = Props;
|
|
@@ -766,8 +786,18 @@ describe("generator", () => {
|
|
|
766
786
|
}
|
|
767
787
|
|
|
768
788
|
export interface Props {
|
|
789
|
+
/**
|
|
790
|
+
* display name: 'Body',
|
|
791
|
+
* description: The text of the todo
|
|
792
|
+
*/
|
|
769
793
|
readonly body: $PropType['string'] | undefined;
|
|
794
|
+
/**
|
|
795
|
+
* (no ontology metadata)
|
|
796
|
+
*/
|
|
770
797
|
readonly complete: $PropType['boolean'] | undefined;
|
|
798
|
+
/**
|
|
799
|
+
* (no ontology metadata)
|
|
800
|
+
*/
|
|
771
801
|
readonly id: $PropType['integer'];
|
|
772
802
|
}
|
|
773
803
|
export type StrictProps = Props;
|
|
@@ -851,7 +881,7 @@ describe("generator", () => {
|
|
|
851
881
|
"/foo/ontology/queries.ts": "export { getCount } from './queries/getCount.js';
|
|
852
882
|
export { returnsTodo } from './queries/returnsTodo.js';
|
|
853
883
|
",
|
|
854
|
-
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
884
|
+
"/foo/ontology/queries/getCount.ts": "import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
855
885
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
856
886
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
857
887
|
|
|
@@ -904,7 +934,7 @@ describe("generator", () => {
|
|
|
904
934
|
osdkMetadata: $osdkMetadata,
|
|
905
935
|
};
|
|
906
936
|
",
|
|
907
|
-
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
937
|
+
"/foo/ontology/queries/returnsTodo.ts": "import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
908
938
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
909
939
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
910
940
|
import type { Todo } from '../objects/Todo.js';
|
|
@@ -1044,13 +1074,13 @@ describe("generator", () => {
|
|
|
1044
1074
|
/**
|
|
1045
1075
|
* An action which takes in an array of objects
|
|
1046
1076
|
*/
|
|
1047
|
-
applyAction<
|
|
1048
|
-
args:
|
|
1077
|
+
applyAction<OP extends ApplyActionOptions>(
|
|
1078
|
+
args: deleteTodos.Params,
|
|
1049
1079
|
options?: OP,
|
|
1050
1080
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
1051
1081
|
|
|
1052
|
-
batchApplyAction<
|
|
1053
|
-
args:
|
|
1082
|
+
batchApplyAction<OP extends ApplyBatchActionOptions>(
|
|
1083
|
+
args: ReadonlyArray<deleteTodos.Params>,
|
|
1054
1084
|
options?: OP,
|
|
1055
1085
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
1056
1086
|
}
|
|
@@ -1120,13 +1150,13 @@ describe("generator", () => {
|
|
|
1120
1150
|
/**
|
|
1121
1151
|
* An action which takes different types of parameters
|
|
1122
1152
|
*/
|
|
1123
|
-
applyAction<
|
|
1124
|
-
args:
|
|
1153
|
+
applyAction<OP extends ApplyActionOptions>(
|
|
1154
|
+
args: markTodoCompleted.Params,
|
|
1125
1155
|
options?: OP,
|
|
1126
1156
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
1127
1157
|
|
|
1128
|
-
batchApplyAction<
|
|
1129
|
-
args:
|
|
1158
|
+
batchApplyAction<OP extends ApplyBatchActionOptions>(
|
|
1159
|
+
args: ReadonlyArray<markTodoCompleted.Params>,
|
|
1130
1160
|
options?: OP,
|
|
1131
1161
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
1132
1162
|
}
|
|
@@ -1182,6 +1212,10 @@ describe("generator", () => {
|
|
|
1182
1212
|
export type PropertyKeys = 'SomeProperty';
|
|
1183
1213
|
|
|
1184
1214
|
export interface Props {
|
|
1215
|
+
/**
|
|
1216
|
+
* display name: 'Sum Property',
|
|
1217
|
+
* description: Some property
|
|
1218
|
+
*/
|
|
1185
1219
|
readonly SomeProperty: $PropType['string'] | undefined;
|
|
1186
1220
|
}
|
|
1187
1221
|
export type StrictProps = Props;
|
|
@@ -1261,6 +1295,9 @@ describe("generator", () => {
|
|
|
1261
1295
|
}
|
|
1262
1296
|
|
|
1263
1297
|
export interface Props {
|
|
1298
|
+
/**
|
|
1299
|
+
* (no ontology metadata)
|
|
1300
|
+
*/
|
|
1264
1301
|
readonly email: $PropType['string'];
|
|
1265
1302
|
}
|
|
1266
1303
|
export type StrictProps = Props;
|
|
@@ -1349,8 +1386,18 @@ describe("generator", () => {
|
|
|
1349
1386
|
}
|
|
1350
1387
|
|
|
1351
1388
|
export interface Props {
|
|
1389
|
+
/**
|
|
1390
|
+
* display name: 'Body',
|
|
1391
|
+
* description: The text of the todo
|
|
1392
|
+
*/
|
|
1352
1393
|
readonly body: $PropType['string'] | undefined;
|
|
1394
|
+
/**
|
|
1395
|
+
* (no ontology metadata)
|
|
1396
|
+
*/
|
|
1353
1397
|
readonly complete: $PropType['boolean'] | undefined;
|
|
1398
|
+
/**
|
|
1399
|
+
* (no ontology metadata)
|
|
1400
|
+
*/
|
|
1354
1401
|
readonly id: $PropType['integer'];
|
|
1355
1402
|
}
|
|
1356
1403
|
export type StrictProps = Props;
|
|
@@ -1434,7 +1481,7 @@ describe("generator", () => {
|
|
|
1434
1481
|
"/foo/ontology/queries.ts": "export { getCount } from './queries/getCount.js';
|
|
1435
1482
|
export { returnsTodo } from './queries/returnsTodo.js';
|
|
1436
1483
|
",
|
|
1437
|
-
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1484
|
+
"/foo/ontology/queries/getCount.ts": "import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1438
1485
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1439
1486
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1440
1487
|
|
|
@@ -1487,7 +1534,7 @@ describe("generator", () => {
|
|
|
1487
1534
|
osdkMetadata: $osdkMetadata,
|
|
1488
1535
|
};
|
|
1489
1536
|
",
|
|
1490
|
-
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1537
|
+
"/foo/ontology/queries/returnsTodo.ts": "import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1491
1538
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1492
1539
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1493
1540
|
import type { Todo } from '../objects/Todo.js';
|
|
@@ -1598,7 +1645,7 @@ describe("generator", () => {
|
|
|
1598
1645
|
it("generates the correct code", async () => {
|
|
1599
1646
|
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1600
1647
|
expect(helper.getFiles()["/foo/ontology/queries/getTask.ts"]).toMatchInlineSnapshot(`
|
|
1601
|
-
"import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1648
|
+
"import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1602
1649
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1603
1650
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1604
1651
|
import type { Task as $Imported$com$example$dep$Task } from '@com.example.dep/osdk';
|
|
@@ -1685,7 +1732,13 @@ describe("generator", () => {
|
|
|
1685
1732
|
export type Links = {};
|
|
1686
1733
|
|
|
1687
1734
|
export interface Props {
|
|
1735
|
+
/**
|
|
1736
|
+
* (no ontology metadata)
|
|
1737
|
+
*/
|
|
1688
1738
|
readonly body: $PropType['string'] | undefined;
|
|
1739
|
+
/**
|
|
1740
|
+
* (no ontology metadata)
|
|
1741
|
+
*/
|
|
1689
1742
|
readonly id: $PropType['integer'];
|
|
1690
1743
|
}
|
|
1691
1744
|
export type StrictProps = Props;
|
|
@@ -1791,13 +1844,13 @@ describe("generator", () => {
|
|
|
1791
1844
|
|
|
1792
1845
|
// Represents a fqn of the action
|
|
1793
1846
|
export interface Signatures {
|
|
1794
|
-
applyAction<
|
|
1795
|
-
args:
|
|
1847
|
+
applyAction<OP extends ApplyActionOptions>(
|
|
1848
|
+
args: setTaskBody.Params,
|
|
1796
1849
|
options?: OP,
|
|
1797
1850
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
1798
1851
|
|
|
1799
|
-
batchApplyAction<
|
|
1800
|
-
args:
|
|
1852
|
+
batchApplyAction<OP extends ApplyBatchActionOptions>(
|
|
1853
|
+
args: ReadonlyArray<setTaskBody.Params>,
|
|
1801
1854
|
options?: OP,
|
|
1802
1855
|
): Promise<ActionReturnTypeForOptions<OP>>;
|
|
1803
1856
|
}
|
|
@@ -1876,10 +1929,17 @@ describe("generator", () => {
|
|
|
1876
1929
|
export type OsdkObjectLinks$SomeInterface = {};
|
|
1877
1930
|
|
|
1878
1931
|
export namespace SomeInterface {
|
|
1879
|
-
export type PropertyKeys = 'spt';
|
|
1932
|
+
export type PropertyKeys = 'spt' | 'spt2';
|
|
1880
1933
|
|
|
1881
1934
|
export interface Props {
|
|
1935
|
+
/**
|
|
1936
|
+
* display name: 'Some Property'
|
|
1937
|
+
*/
|
|
1882
1938
|
readonly spt: $PropType['string'] | undefined;
|
|
1939
|
+
/**
|
|
1940
|
+
* display name: 'Some Property 2'
|
|
1941
|
+
*/
|
|
1942
|
+
readonly spt2: $PropType['string'] | undefined;
|
|
1883
1943
|
}
|
|
1884
1944
|
export type StrictProps = Props;
|
|
1885
1945
|
|
|
@@ -1916,6 +1976,10 @@ describe("generator", () => {
|
|
|
1916
1976
|
* display name: 'Some Property'
|
|
1917
1977
|
*/
|
|
1918
1978
|
spt: $PropertyDef<'string', 'nullable', 'single'>;
|
|
1979
|
+
/**
|
|
1980
|
+
* display name: 'Some Property 2'
|
|
1981
|
+
*/
|
|
1982
|
+
spt2: $PropertyDef<'string', 'nullable', 'single'>;
|
|
1919
1983
|
};
|
|
1920
1984
|
rid: 'idk2';
|
|
1921
1985
|
type: 'interface';
|
|
@@ -1952,7 +2016,13 @@ describe("generator", () => {
|
|
|
1952
2016
|
export type Links = {};
|
|
1953
2017
|
|
|
1954
2018
|
export interface Props {
|
|
2019
|
+
/**
|
|
2020
|
+
* (no ontology metadata)
|
|
2021
|
+
*/
|
|
1955
2022
|
readonly body: $PropType['string'] | undefined;
|
|
2023
|
+
/**
|
|
2024
|
+
* (no ontology metadata)
|
|
2025
|
+
*/
|
|
1956
2026
|
readonly taskId: $PropType['string'];
|
|
1957
2027
|
}
|
|
1958
2028
|
export type StrictProps = Props;
|