@osdk/generator 2.0.0-beta.7 → 2.0.0-beta.9
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 +25 -0
- package/build/browser/index.js +34 -22
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +34 -22
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/esm/index.js +34 -22
- package/build/esm/index.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePerActionDataFiles.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generatePerActionDataFiles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAU7E,wBAAsB,0BAA0B,CAC9C,EACE,iBAAiB,EAAE,QAAQ,EAC3B,EAAE,EACF,MAAM,EAAE,UAAU,EAClB,SAAc,EACd,QAAQ,EAAE,gBAAgB,GAC3B,EAAE,IAAI,CACL,eAAe,EACb,mBAAmB,GACnB,IAAI,GACJ,QAAQ,GACR,WAAW,GACX,UAAU,CACb,
|
|
1
|
+
{"version":3,"file":"generatePerActionDataFiles.d.ts","sourceRoot":"","sources":["../../../src/v2.0/generatePerActionDataFiles.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AAU7E,wBAAsB,0BAA0B,CAC9C,EACE,iBAAiB,EAAE,QAAQ,EAC3B,EAAE,EACF,MAAM,EAAE,UAAU,EAClB,SAAc,EACd,QAAQ,EAAE,gBAAgB,GAC3B,EAAE,IAAI,CACL,eAAe,EACb,mBAAmB,GACnB,IAAI,GACJ,QAAQ,GACR,WAAW,GACX,UAAU,CACb,iBAsPF"}
|
package/build/esm/index.js
CHANGED
|
@@ -666,12 +666,8 @@ async function generatePerActionDataFiles({
|
|
|
666
666
|
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
667
667
|
const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
|
|
668
668
|
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
|
|
669
|
-
const {
|
|
670
|
-
parameters,
|
|
671
|
-
...actionDefSansParameters
|
|
672
|
-
} = fullActionDef;
|
|
673
669
|
function createParamsDef() {
|
|
674
|
-
const entries = Object.entries(parameters);
|
|
670
|
+
const entries = Object.entries(fullActionDef.parameters ?? {});
|
|
675
671
|
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
676
672
|
if (entries.length === 0) {
|
|
677
673
|
return `// Represents the definition of the parameters for the action
|
|
@@ -711,6 +707,10 @@ async function generatePerActionDataFiles({
|
|
|
711
707
|
}
|
|
712
708
|
function createV2Types() {
|
|
713
709
|
`${action.shortApiName}$Params`;
|
|
710
|
+
let jsDocBlock = ["/**"];
|
|
711
|
+
if (action.description != null) {
|
|
712
|
+
jsDocBlock.push(`* ${action.description}`);
|
|
713
|
+
}
|
|
714
714
|
return `
|
|
715
715
|
|
|
716
716
|
export namespace ${action.shortApiName}{
|
|
@@ -718,26 +718,17 @@ async function generatePerActionDataFiles({
|
|
|
718
718
|
|
|
719
719
|
${getDescriptionIfPresent(action.description)}
|
|
720
720
|
export interface Params {
|
|
721
|
-
${stringify(parameters, {
|
|
721
|
+
${stringify(fullActionDef.parameters, {
|
|
722
722
|
"*": (ogValue, _, ogKey) => {
|
|
723
723
|
const key = `${getDescriptionIfPresent(ogValue.description)}
|
|
724
724
|
readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
|
|
725
725
|
const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
|
|
726
|
+
jsDocBlock.push(`* @param {${getActionParamType(ogValue.type)}} ${ogValue.nullable ? `[${ogKey}]` : `${ogKey}`} ${ogValue.description ?? ""} `);
|
|
726
727
|
return [key, value];
|
|
727
728
|
}
|
|
728
729
|
})}
|
|
729
730
|
}
|
|
730
731
|
|
|
731
|
-
|
|
732
|
-
// Represents the definition of the action
|
|
733
|
-
export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
|
|
734
|
-
${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
|
|
735
|
-
return `${key}: ${JSON.stringify(value)};`;
|
|
736
|
-
}).join("\n")}
|
|
737
|
-
parameters: ${action.definitionParamsIdentifier};
|
|
738
|
-
osdkMetadata: typeof $osdkMetadata;
|
|
739
|
-
}
|
|
740
|
-
|
|
741
732
|
// Represents a fqn of the action
|
|
742
733
|
export interface Signatures {
|
|
743
734
|
${getDescriptionIfPresent(action.description)}
|
|
@@ -748,14 +739,36 @@ async function generatePerActionDataFiles({
|
|
|
748
739
|
|
|
749
740
|
}
|
|
750
741
|
|
|
751
|
-
|
|
752
|
-
|
|
742
|
+
|
|
743
|
+
${jsDocBlock.join("\n")}
|
|
744
|
+
*/
|
|
745
|
+
export interface ${action.shortApiName} extends MinimalActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
|
|
746
|
+
__DefinitionMetadata?: {
|
|
747
|
+
${stringify(fullActionDef, {
|
|
748
|
+
"parameters": () => action.definitionParamsIdentifier
|
|
749
|
+
})}
|
|
750
|
+
|
|
751
|
+
signatures: ${action.shortApiName}.Signatures;
|
|
752
|
+
},
|
|
753
|
+
${stringify(fullActionDef, {
|
|
754
|
+
"description": () => void 0,
|
|
755
|
+
"displayName": () => void 0,
|
|
756
|
+
"modifiedEntities": () => void 0,
|
|
757
|
+
"parameters": () => void 0
|
|
758
|
+
})}
|
|
759
|
+
osdkMetadata: typeof $osdkMetadata;
|
|
760
|
+
}
|
|
753
761
|
`;
|
|
754
762
|
}
|
|
755
763
|
function createV2Object() {
|
|
756
|
-
return ` export const ${action.shortApiName}: ${action.
|
|
764
|
+
return ` export const ${action.shortApiName}: ${action.shortApiName} =
|
|
757
765
|
{
|
|
758
|
-
${stringify(fullActionDef
|
|
766
|
+
${stringify(fullActionDef, {
|
|
767
|
+
"description": () => void 0,
|
|
768
|
+
"displayName": () => void 0,
|
|
769
|
+
"modifiedEntities": () => void 0,
|
|
770
|
+
"parameters": () => void 0
|
|
771
|
+
})},
|
|
759
772
|
osdkMetadata: $osdkMetadata
|
|
760
773
|
}
|
|
761
774
|
`;
|
|
@@ -781,9 +794,8 @@ async function generatePerActionDataFiles({
|
|
|
781
794
|
}
|
|
782
795
|
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
|
|
783
796
|
await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
784
|
-
import type {
|
|
797
|
+
import type { MinimalActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
|
|
785
798
|
import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
|
|
786
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
787
799
|
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
788
800
|
${imports}
|
|
789
801
|
|