@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.
@@ -692,12 +692,8 @@ async function generatePerActionDataFiles({
692
692
  const uniqueApiNames = new Set(uniqueApiNamesArray);
693
693
  const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
694
694
  const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
695
- const {
696
- parameters,
697
- ...actionDefSansParameters
698
- } = fullActionDef;
699
695
  function createParamsDef() {
700
- const entries = Object.entries(parameters);
696
+ const entries = Object.entries(fullActionDef.parameters ?? {});
701
697
  entries.sort((a, b) => a[0].localeCompare(b[0]));
702
698
  if (entries.length === 0) {
703
699
  return `// Represents the definition of the parameters for the action
@@ -737,6 +733,10 @@ async function generatePerActionDataFiles({
737
733
  }
738
734
  function createV2Types() {
739
735
  `${action.shortApiName}$Params`;
736
+ let jsDocBlock = ["/**"];
737
+ if (action.description != null) {
738
+ jsDocBlock.push(`* ${action.description}`);
739
+ }
740
740
  return `
741
741
 
742
742
  export namespace ${action.shortApiName}{
@@ -744,26 +744,17 @@ async function generatePerActionDataFiles({
744
744
 
745
745
  ${getDescriptionIfPresent(action.description)}
746
746
  export interface Params {
747
- ${stringify(parameters, {
747
+ ${stringify(fullActionDef.parameters, {
748
748
  "*": (ogValue, _, ogKey) => {
749
749
  const key = `${getDescriptionIfPresent(ogValue.description)}
750
750
  readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
751
751
  const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
752
+ jsDocBlock.push(`* @param {${getActionParamType(ogValue.type)}} ${ogValue.nullable ? `[${ogKey}]` : `${ogKey}`} ${ogValue.description ?? ""} `);
752
753
  return [key, value];
753
754
  }
754
755
  })}
755
756
  }
756
757
 
757
-
758
- // Represents the definition of the action
759
- export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
760
- ${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
761
- return `${key}: ${JSON.stringify(value)};`;
762
- }).join("\n")}
763
- parameters: ${action.definitionParamsIdentifier};
764
- osdkMetadata: typeof $osdkMetadata;
765
- }
766
-
767
758
  // Represents a fqn of the action
768
759
  export interface Signatures {
769
760
  ${getDescriptionIfPresent(action.description)}
@@ -774,14 +765,36 @@ async function generatePerActionDataFiles({
774
765
 
775
766
  }
776
767
 
777
- /** @deprecated Use \`${action.definitionIdentifier}\` **/
778
- export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
768
+
769
+ ${jsDocBlock.join("\n")}
770
+ */
771
+ export interface ${action.shortApiName} extends MinimalActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
772
+ __DefinitionMetadata?: {
773
+ ${stringify(fullActionDef, {
774
+ "parameters": () => action.definitionParamsIdentifier
775
+ })}
776
+
777
+ signatures: ${action.shortApiName}.Signatures;
778
+ },
779
+ ${stringify(fullActionDef, {
780
+ "description": () => void 0,
781
+ "displayName": () => void 0,
782
+ "modifiedEntities": () => void 0,
783
+ "parameters": () => void 0
784
+ })}
785
+ osdkMetadata: typeof $osdkMetadata;
786
+ }
779
787
  `;
780
788
  }
781
789
  function createV2Object() {
782
- return ` export const ${action.shortApiName}: ${action.definitionIdentifier} =
790
+ return ` export const ${action.shortApiName}: ${action.shortApiName} =
783
791
  {
784
- ${stringify(fullActionDef)},
792
+ ${stringify(fullActionDef, {
793
+ "description": () => void 0,
794
+ "displayName": () => void 0,
795
+ "modifiedEntities": () => void 0,
796
+ "parameters": () => void 0
797
+ })},
785
798
  osdkMetadata: $osdkMetadata
786
799
  }
787
800
  `;
@@ -807,9 +820,8 @@ async function generatePerActionDataFiles({
807
820
  }
808
821
  const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
809
822
  await fs2.writeFile(path5__namespace.default.join(rootOutDir, currentFilePath), await formatTs(`
810
- import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
823
+ import type { MinimalActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
811
824
  import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
812
- import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
813
825
  import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
814
826
  ${imports}
815
827