@osdk/generator 2.0.0-beta.8 → 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
@@ -748,7 +744,7 @@ async function generatePerActionDataFiles({
748
744
 
749
745
  ${getDescriptionIfPresent(action.description)}
750
746
  export interface Params {
751
- ${stringify(parameters, {
747
+ ${stringify(fullActionDef.parameters, {
752
748
  "*": (ogValue, _, ogKey) => {
753
749
  const key = `${getDescriptionIfPresent(ogValue.description)}
754
750
  readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
@@ -759,16 +755,6 @@ async function generatePerActionDataFiles({
759
755
  })}
760
756
  }
761
757
 
762
-
763
- // Represents the definition of the action
764
- export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
765
- ${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
766
- return `${key}: ${JSON.stringify(value)};`;
767
- }).join("\n")}
768
- parameters: ${action.definitionParamsIdentifier};
769
- osdkMetadata: typeof $osdkMetadata;
770
- }
771
-
772
758
  // Represents a fqn of the action
773
759
  export interface Signatures {
774
760
  ${getDescriptionIfPresent(action.description)}
@@ -779,15 +765,36 @@ async function generatePerActionDataFiles({
779
765
 
780
766
  }
781
767
 
768
+
782
769
  ${jsDocBlock.join("\n")}
783
770
  */
784
- export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
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
+ }
785
787
  `;
786
788
  }
787
789
  function createV2Object() {
788
- return ` export const ${action.shortApiName}: ${action.definitionIdentifier} =
790
+ return ` export const ${action.shortApiName}: ${action.shortApiName} =
789
791
  {
790
- ${stringify(fullActionDef)},
792
+ ${stringify(fullActionDef, {
793
+ "description": () => void 0,
794
+ "displayName": () => void 0,
795
+ "modifiedEntities": () => void 0,
796
+ "parameters": () => void 0
797
+ })},
791
798
  osdkMetadata: $osdkMetadata
792
799
  }
793
800
  `;
@@ -813,9 +820,8 @@ async function generatePerActionDataFiles({
813
820
  }
814
821
  const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
815
822
  await fs2.writeFile(path5__namespace.default.join(rootOutDir, currentFilePath), await formatTs(`
816
- import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
823
+ import type { MinimalActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
817
824
  import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
818
- import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
819
825
  import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
820
826
  ${imports}
821
827