@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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 2.0.0-beta.9
4
+
5
+ ### Minor Changes
6
+
7
+ - b946e00: Emitted action definition is minimal size now
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [b946e00]
12
+ - @osdk/api@2.0.0-beta.9
13
+ - @osdk/generator-converters@2.0.0-beta.9
14
+ - @osdk/internal.foundry.core@0.2.0-beta.6
15
+
3
16
  ## 2.0.0-beta.8
4
17
 
5
18
  ### Minor Changes
@@ -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
@@ -722,7 +718,7 @@ async function generatePerActionDataFiles({
722
718
 
723
719
  ${getDescriptionIfPresent(action.description)}
724
720
  export interface Params {
725
- ${stringify(parameters, {
721
+ ${stringify(fullActionDef.parameters, {
726
722
  "*": (ogValue, _, ogKey) => {
727
723
  const key = `${getDescriptionIfPresent(ogValue.description)}
728
724
  readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
@@ -733,16 +729,6 @@ async function generatePerActionDataFiles({
733
729
  })}
734
730
  }
735
731
 
736
-
737
- // Represents the definition of the action
738
- export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
739
- ${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
740
- return `${key}: ${JSON.stringify(value)};`;
741
- }).join("\n")}
742
- parameters: ${action.definitionParamsIdentifier};
743
- osdkMetadata: typeof $osdkMetadata;
744
- }
745
-
746
732
  // Represents a fqn of the action
747
733
  export interface Signatures {
748
734
  ${getDescriptionIfPresent(action.description)}
@@ -753,15 +739,36 @@ async function generatePerActionDataFiles({
753
739
 
754
740
  }
755
741
 
742
+
756
743
  ${jsDocBlock.join("\n")}
757
744
  */
758
- export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
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
+ }
759
761
  `;
760
762
  }
761
763
  function createV2Object() {
762
- return ` export const ${action.shortApiName}: ${action.definitionIdentifier} =
764
+ return ` export const ${action.shortApiName}: ${action.shortApiName} =
763
765
  {
764
- ${stringify(fullActionDef)},
766
+ ${stringify(fullActionDef, {
767
+ "description": () => void 0,
768
+ "displayName": () => void 0,
769
+ "modifiedEntities": () => void 0,
770
+ "parameters": () => void 0
771
+ })},
765
772
  osdkMetadata: $osdkMetadata
766
773
  }
767
774
  `;
@@ -787,9 +794,8 @@ async function generatePerActionDataFiles({
787
794
  }
788
795
  const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
789
796
  await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
790
- import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
797
+ import type { MinimalActionDefinition, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
791
798
  import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
792
- import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
793
799
  import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
794
800
  ${imports}
795
801