@osdk/maker 0.13.0-beta.12 → 0.13.0-beta.13

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.
@@ -23,7 +23,7 @@ import { hideBin } from "yargs/helpers";
23
23
  import { defineOntology } from "../api/defineOntology.js";
24
24
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
25
25
  export default async function main(args = process.argv) {
26
- const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.12" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
26
+ const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.13" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
27
  input: {
28
28
  alias: "i",
29
29
  describe: "Input file",
@@ -1690,7 +1690,7 @@ function addNamespaceIfNone(apiName) {
1690
1690
  // src/cli/main.ts
1691
1691
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
1692
1692
  async function main(args = process.argv) {
1693
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.12").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1693
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.13").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1694
1694
  input: {
1695
1695
  alias: "i",
1696
1696
  describe: "Input file",
@@ -1805,36 +1805,36 @@ function isActionParameterTypePrimitive(type) {
1805
1805
  // src/api/defineAction.ts
1806
1806
  var MODIFY_OBJECT_PARAMETER = "objectToModifyParameter";
1807
1807
  var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
1808
- function defineCreateInterfaceObjectAction(interfaceType, objectType, validation) {
1809
- const allProperties = Object.entries(getFlattenedInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1810
- if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(interfaceType)).length) {
1811
- consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the create action because they are structs`);
1808
+ function defineCreateInterfaceObjectAction(def) {
1809
+ const allProperties = Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type) && !(def.excludedProperties ?? []).includes(prop.sharedPropertyType.nonNameSpacedApiName));
1810
+ if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).length) {
1811
+ consola.consola.info(`Some properties on ${def.interfaceType.apiName} were skipped in the create action because they are structs`);
1812
1812
  }
1813
1813
  return defineAction({
1814
- apiName: `create-${kebab(interfaceType.apiName.split(".").pop() ?? interfaceType.apiName)}${objectType === void 0 ? "" : `-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`}`,
1815
- displayName: `Create ${interfaceType.displayMetadata.displayName}`,
1814
+ apiName: `create-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}${def.objectType === void 0 ? "" : `-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`}`,
1815
+ displayName: `Create ${def.interfaceType.displayMetadata.displayName}`,
1816
1816
  parameters: [{
1817
1817
  id: "objectTypeParameter",
1818
1818
  displayName: "Object type to create",
1819
1819
  type: {
1820
1820
  type: "objectTypeReference",
1821
1821
  objectTypeReference: {
1822
- interfaceTypeRids: [interfaceType.apiName]
1822
+ interfaceTypeRids: [def.interfaceType.apiName]
1823
1823
  }
1824
1824
  },
1825
1825
  validation: {
1826
1826
  required: true,
1827
- allowedValues: objectType === void 0 ? {
1827
+ allowedValues: def.objectType === void 0 ? {
1828
1828
  type: "objectTypeReference",
1829
- interfaceTypes: [interfaceType.apiName]
1829
+ interfaceTypes: [def.interfaceType.apiName]
1830
1830
  } : {
1831
1831
  type: "oneOf",
1832
1832
  oneOf: [{
1833
- label: objectType.displayName,
1833
+ label: def.objectType.displayName,
1834
1834
  value: {
1835
1835
  type: "objectType",
1836
1836
  objectType: {
1837
- objectTypeId: objectType.apiName
1837
+ objectTypeId: def.objectType.apiName
1838
1838
  }
1839
1839
  }
1840
1840
  }]
@@ -1852,9 +1852,9 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1852
1852
  allowedValues: extractAllowedValuesFromPropertyType(prop.sharedPropertyType.type)
1853
1853
  }
1854
1854
  }))],
1855
- status: interfaceType.status.type !== "deprecated" ? interfaceType.status.type : interfaceType.status,
1855
+ status: def.interfaceType.status.type !== "deprecated" ? def.interfaceType.status.type : def.interfaceType.status,
1856
1856
  entities: {
1857
- affectedInterfaceTypes: [interfaceType.apiName],
1857
+ affectedInterfaceTypes: [def.interfaceType.apiName],
1858
1858
  affectedObjectTypes: [],
1859
1859
  affectedLinkTypes: [],
1860
1860
  typeGroups: []
@@ -1862,7 +1862,7 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1862
1862
  rules: [{
1863
1863
  type: "addInterfaceRule",
1864
1864
  addInterfaceRule: {
1865
- interfaceApiName: interfaceType.apiName,
1865
+ interfaceApiName: def.interfaceType.apiName,
1866
1866
  objectTypeParameter: "objectTypeParameter",
1867
1867
  sharedPropertyValues: Object.fromEntries(allProperties.map(([id, _prop]) => [id, {
1868
1868
  type: "parameterId",
@@ -1870,8 +1870,8 @@ function defineCreateInterfaceObjectAction(interfaceType, objectType, validation
1870
1870
  }]))
1871
1871
  }
1872
1872
  }],
1873
- ...validation ? {
1874
- validation: convertValidationRule(validation)
1873
+ ...def.validation ? {
1874
+ validation: convertValidationRule(def.validation)
1875
1875
  } : {}
1876
1876
  });
1877
1877
  }
@@ -1932,35 +1932,35 @@ function defineCreateObjectAction(def) {
1932
1932
  }
1933
1933
  });
1934
1934
  }
1935
- function defineModifyInterfaceObjectAction(interfaceType, objectType, validation) {
1936
- const allProperties = Object.entries(getFlattenedInterfaceProperties(interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type));
1937
- if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(interfaceType)).length) {
1938
- consola.consola.info(`Some properties on ${interfaceType.apiName} were skipped in the modify action because they are structs`);
1935
+ function defineModifyInterfaceObjectAction(def) {
1936
+ const allProperties = Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).filter(([_, prop]) => !isStruct(prop.sharedPropertyType.type) && !(def.excludedProperties ?? []).includes(prop.sharedPropertyType.nonNameSpacedApiName));
1937
+ if (allProperties.length !== Object.entries(getFlattenedInterfaceProperties(def.interfaceType)).length) {
1938
+ consola.consola.info(`Some properties on ${def.interfaceType.apiName} were skipped in the modify action because they are structs`);
1939
1939
  }
1940
1940
  return defineAction({
1941
- apiName: `modify-${kebab(interfaceType.apiName.split(".").pop() ?? interfaceType.apiName)}${objectType === void 0 ? "" : `-${kebab(objectType.apiName.split(".").pop() ?? objectType.apiName)}`}`,
1942
- displayName: `Modify ${interfaceType.displayMetadata.displayName}`,
1941
+ apiName: `modify-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}${def.objectType === void 0 ? "" : `-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`}`,
1942
+ displayName: `Modify ${def.interfaceType.displayMetadata.displayName}`,
1943
1943
  parameters: [{
1944
1944
  id: "interfaceObjectToModifyParameter",
1945
1945
  displayName: "Object type to modify",
1946
1946
  type: {
1947
1947
  type: "interfaceReference",
1948
1948
  interfaceReference: {
1949
- interfaceTypeRid: interfaceType.apiName
1949
+ interfaceTypeRid: def.interfaceType.apiName
1950
1950
  }
1951
1951
  },
1952
1952
  validation: {
1953
1953
  required: true,
1954
- allowedValues: objectType === void 0 ? {
1954
+ allowedValues: def.objectType === void 0 ? {
1955
1955
  type: "interfaceObjectQuery"
1956
1956
  } : {
1957
1957
  type: "oneOf",
1958
1958
  oneOf: [{
1959
- label: objectType.displayName,
1959
+ label: def.objectType.displayName,
1960
1960
  value: {
1961
1961
  type: "objectType",
1962
1962
  objectType: {
1963
- objectTypeId: objectType.apiName
1963
+ objectTypeId: def.objectType.apiName
1964
1964
  }
1965
1965
  }
1966
1966
  }]
@@ -1978,9 +1978,9 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
1978
1978
  allowedValues: extractAllowedValuesFromPropertyType(prop.sharedPropertyType.type)
1979
1979
  }
1980
1980
  }))],
1981
- status: interfaceType.status.type !== "deprecated" ? interfaceType.status.type : interfaceType.status,
1981
+ status: def.interfaceType.status.type !== "deprecated" ? def.interfaceType.status.type : def.interfaceType.status,
1982
1982
  entities: {
1983
- affectedInterfaceTypes: [interfaceType.apiName],
1983
+ affectedInterfaceTypes: [def.interfaceType.apiName],
1984
1984
  affectedObjectTypes: [],
1985
1985
  affectedLinkTypes: [],
1986
1986
  typeGroups: []
@@ -1995,8 +1995,8 @@ function defineModifyInterfaceObjectAction(interfaceType, objectType, validation
1995
1995
  }]))
1996
1996
  }
1997
1997
  }],
1998
- ...validation ? {
1999
- validation: convertValidationRule(validation)
1998
+ ...def.validation ? {
1999
+ validation: convertValidationRule(def.validation)
2000
2000
  } : {}
2001
2001
  });
2002
2002
  }