@osdk/generator 1.9.1-main-20240412164446 → 1.10.0-main-20240418183121
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 +8 -3
- package/build/js/index.cjs +55 -1
- package/build/js/index.cjs.map +1 -1
- package/build/js/index.mjs +55 -1
- package/build/js/index.mjs.map +1 -1
- package/build/types/v1.1/generateBatchActions.d.ts +4 -0
- package/build/types/v1.1/generateBatchActions.d.ts.map +1 -0
- package/build/types/v1.1/generateBatchActions.test.d.ts +2 -0
- package/build/types/v1.1/generateBatchActions.test.d.ts.map +1 -0
- package/build/types/v1.1/generateClientSdkVersionOneDotOne.d.ts.map +1 -1
- package/build/types/v1.1/generateMetadataFile.d.ts.map +1 -1
- package/build/types/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
# @osdk/generator
|
|
2
2
|
|
|
3
|
-
## 1.
|
|
3
|
+
## 1.10.0-main-20240418183121
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 11434b95: Deprecated bulk actions with renamed batchActions functionality
|
|
8
|
+
- 948c6340: Add pivot to functionality and deprecate searchAround calls
|
|
4
9
|
|
|
5
10
|
### Patch Changes
|
|
6
11
|
|
|
7
12
|
- 9906a41e: Extract package generation
|
|
8
13
|
- 9906a41e: Compatible version checks now use versions that are both embedded in the code and updated automatically as part of the release process.
|
|
9
14
|
- f7287ae8: For 2.0, fixes codegen version matching in snapshot builds
|
|
10
|
-
- @osdk/api@1.6.1-main-
|
|
11
|
-
- @osdk/generator-converters@0.4.1-main-
|
|
15
|
+
- @osdk/api@1.6.1-main-20240418183121
|
|
16
|
+
- @osdk/generator-converters@0.4.1-main-20240418183121
|
|
12
17
|
|
|
13
18
|
## 1.1.1
|
|
14
19
|
|
package/build/js/index.cjs
CHANGED
|
@@ -84,7 +84,9 @@ ${Array.from(uniqueLinkTargets).map((linkTarget) => `import type { ${linkTarget}
|
|
|
84
84
|
${getDescriptionIfPresent(objectTypeWithLinks.objectType.description)}
|
|
85
85
|
export interface ${objectTypeWithLinks.objectType.apiName} extends OntologyObject {
|
|
86
86
|
/** @deprecated please migrate to $apiName instead */
|
|
87
|
-
readonly __apiName: "${objectTypeWithLinks.objectType.apiName}"
|
|
87
|
+
readonly __apiName: "${objectTypeWithLinks.objectType.apiName}" & {${objectTypeWithLinks.linkTypes.map((linkType) => {
|
|
88
|
+
return `/** @deprecated please migrate to pivotTo(${linkType.apiName}) instead */ searchAround${linkType.apiName.charAt(0).toUpperCase() + linkType.apiName.slice(1)}?: never`;
|
|
89
|
+
})}};
|
|
88
90
|
/** @deprecated please migrate to $primaryKey instead */
|
|
89
91
|
readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
90
92
|
readonly $apiName: "${objectTypeWithLinks.objectType.apiName}";
|
|
@@ -951,6 +953,54 @@ async function generateBackCompatDeprecatedExports(fs2, outDir, importExt = "")
|
|
|
951
953
|
await generateOntologyRuntimeDistDir(outDir, fs2, importExt);
|
|
952
954
|
await generateOAuthClientDistDir(outDir, fs2, importExt);
|
|
953
955
|
}
|
|
956
|
+
async function generateBatchActions(ontology, fs2, outDir, importExt = "") {
|
|
957
|
+
const importedObjects = /* @__PURE__ */ new Set();
|
|
958
|
+
let actionSignatures = [];
|
|
959
|
+
for (const action of Object.values(ontology.actionTypes)) {
|
|
960
|
+
const entries = Object.entries(action.parameters);
|
|
961
|
+
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
962
|
+
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
963
|
+
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
964
|
+
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
965
|
+
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
966
|
+
let jsDocBlock = ["/**"];
|
|
967
|
+
if (action.description) {
|
|
968
|
+
jsDocBlock.push(`* ${action.description}`);
|
|
969
|
+
}
|
|
970
|
+
let parameterBlock = "";
|
|
971
|
+
if (entries.length > 0) {
|
|
972
|
+
parameterBlock = `params: {
|
|
973
|
+
`;
|
|
974
|
+
for (const [parameterName, parameterData] of entries) {
|
|
975
|
+
parameterBlock += `"${parameterName}"`;
|
|
976
|
+
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
977
|
+
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
978
|
+
parameterBlock += `${typeScriptType};
|
|
979
|
+
`;
|
|
980
|
+
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
981
|
+
}
|
|
982
|
+
parameterBlock += "}[], ";
|
|
983
|
+
} else {
|
|
984
|
+
parameterBlock = `params: Record<string,never>[], `;
|
|
985
|
+
}
|
|
986
|
+
jsDocBlock.push(`*/`);
|
|
987
|
+
actionSignatures.push(`
|
|
988
|
+
${jsDocBlock.join("\n")}
|
|
989
|
+
${action.apiName}<O extends BatchActionExecutionOptions>(${parameterBlock}options?: O):
|
|
990
|
+
Promise<Result<BatchActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;
|
|
991
|
+
`);
|
|
992
|
+
}
|
|
993
|
+
await fs2.mkdir(outDir, {
|
|
994
|
+
recursive: true
|
|
995
|
+
});
|
|
996
|
+
await fs2.writeFile(path16__namespace.default.join(outDir, "BatchActions.ts"), await formatTs(`
|
|
997
|
+
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, BatchActionExecutionOptions, ActionError, Result, ActionResponseFromOptions, BatchActionResponseFromOptions } from "@osdk/legacy-client";
|
|
998
|
+
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
999
|
+
export interface BatchActions {
|
|
1000
|
+
${actionSignatures.join("\n")}
|
|
1001
|
+
}
|
|
1002
|
+
`));
|
|
1003
|
+
}
|
|
954
1004
|
async function generateBulkActions(ontology, fs2, outDir, importExt = "") {
|
|
955
1005
|
const importedObjects = /* @__PURE__ */ new Set();
|
|
956
1006
|
let actionSignatures = [];
|
|
@@ -1076,6 +1126,7 @@ async function generateMetadataFile(ontology, userAgent, fs2, outDir, importExt
|
|
|
1076
1126
|
import type { Objects } from "./ontology/objects/Objects${importExt}";
|
|
1077
1127
|
import type { Actions } from "./ontology/actions/Actions${importExt}";
|
|
1078
1128
|
import type { Queries } from "./ontology/queries/Queries${importExt}";
|
|
1129
|
+
import type { BatchActions } from "./ontology/actions/BatchActions${importExt}";
|
|
1079
1130
|
import type { BulkActions } from "./ontology/actions/BulkActions${importExt}";
|
|
1080
1131
|
${objectNames.map((name) => `import {${name}} from "./ontology/objects/${name}${importExt}";`).join("\n")}
|
|
1081
1132
|
${actionNames.map((name) => `import {${getImportClause(name, actionAltNames)}} from "./ontology/actions/${name}${importExt}";`).join("\n")}
|
|
@@ -1119,7 +1170,9 @@ async function generateMetadataFile(ontology, userAgent, fs2, outDir, importExt
|
|
|
1119
1170
|
export interface Ontology extends ClientOntology<typeof Ontology> {
|
|
1120
1171
|
objects: Objects;
|
|
1121
1172
|
actions: Actions;
|
|
1173
|
+
/** @deprecated use batchActions */
|
|
1122
1174
|
bulkActions: BulkActions;
|
|
1175
|
+
batchActions: BatchActions;
|
|
1123
1176
|
queries: Queries;
|
|
1124
1177
|
}`));
|
|
1125
1178
|
}
|
|
@@ -1581,6 +1634,7 @@ async function generateClientSdkVersionOneDotOne(ontology, userAgent, fs2, outDi
|
|
|
1581
1634
|
await generateObjectsInterfaceSupportFiles(sanitizedOntology, fs2, path16__namespace.join(objectsDir, "objects-api"), importExt);
|
|
1582
1635
|
await generatePerObjectInterfaceAndDataFiles(sanitizedOntology, fs2, objectsDir, importExt);
|
|
1583
1636
|
await generateActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1637
|
+
await generateBatchActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1584
1638
|
await generateBulkActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1585
1639
|
await generatePerActionDataFiles(sanitizedOntology, fs2, actionsDir, importExt, false);
|
|
1586
1640
|
await generateQueries(sanitizedOntology, fs2, queriesDir, importExt);
|