@osdk/maker 0.13.0-beta.7 → 0.13.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.
@@ -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.7" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
26
+ const commandLineOpts = await yargs(hideBin(args)).version("0.13.0-beta.9" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
27
  input: {
28
28
  alias: "i",
29
29
  describe: "Input file",
@@ -77,10 +77,7 @@ export default async function main(args = process.argv) {
77
77
  consola.info(`Loading ontology from ${commandLineOpts.input}`);
78
78
  const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies);
79
79
  consola.info(`Saving ontology to ${commandLineOpts.output}`);
80
- await fs.writeFile(commandLineOpts.output, JSON.stringify({
81
- ontology: ontologyIr.ontology,
82
- importedOntology: ontologyIr.importedOntology
83
- }, null, 2));
80
+ await fs.writeFile(commandLineOpts.output, JSON.stringify(ontologyIr, null, 2));
84
81
  // No point in generating block if there aren't any value types
85
82
  if (ontologyIr.valueTypes.valueTypes.length > 0 || ontologyIr.importedValueTypes.valueTypes.length > 0) {
86
83
  await fs.writeFile(commandLineOpts.valueTypesOutput, JSON.stringify(ontologyIr.valueTypes, null, 2));
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","defineOntology","apiNamespaceRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","parseAsync","length","slice","env","NODE_ENV","test","info","ontologyIr","loadOntology","writeFile","JSON","stringify","ontology","importedOntology","valueTypes","importedValueTypes","dependencyFile","q"],"sources":["main.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineOntology } from \"../api/defineOntology.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace = (commandLineOpts.apiNamespace.slice(-1) !== \".\")\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n {\n ontology: ontologyIr.ontology,\n importedOntology: ontologyIr.importedOntology,\n },\n null,\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0\n || ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(\n ontologyIr.valueTypes,\n null,\n 2,\n ),\n );\n }\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(input),\n outputDir,\n dependencyFile,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,OAA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ACgB,MAAM,EACtBgB,IAAI,CAACC,SAAS,CACZ;IACEC,QAAQ,EAAEL,UAAU,CAACK,QAAQ;IAC7BC,gBAAgB,EAAEN,UAAU,CAACM;EAC/B,CAAC,EACD,IAAI,EACJ,CACF,CACF,CAAC;EACD;EACA,IACEN,UAAU,CAACO,UAAU,CAACA,UAAU,CAACb,MAAM,GAAG,CAAC,IACxCM,UAAU,CAACQ,kBAAkB,CAACD,UAAU,CAACb,MAAM,GAAG,CAAC,EACtD;IACA,MAAMlC,EAAE,CAAC0C,SAAS,CAChB/B,eAAe,CAACoB,gBAAgB,EAChCY,IAAI,CAACC,SAAS,CACZJ,UAAU,CAACO,UAAU,EACrB,IAAI,EACJ,CACF,CACF,CAAC;EACH;AACF;AAEA,eAAeN,YAAYA,CACzBrB,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7BmB,cAAkC,EAClC;EACA,MAAMC,CAAC,GAAG,MAAM7C,cAAc,CAC5BuB,YAAY,EACZ,YAAY,MAAM,MAAM,CAACR,KAAK,CAAC,EAC/BU,SAAS,EACTmB,cACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"main.js","names":["consola","fs","path","invariant","yargs","hideBin","defineOntology","apiNamespaceRegex","main","args","process","argv","commandLineOpts","version","wrap","Math","min","terminalWidth","strict","help","options","input","alias","describe","type","default","coerce","resolve","output","apiNamespace","snapshotDir","outputDir","valueTypesOutput","dependencies","parseAsync","length","slice","env","NODE_ENV","test","info","ontologyIr","loadOntology","writeFile","JSON","stringify","valueTypes","importedValueTypes","dependencyFile","q"],"sources":["main.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"consola\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { defineOntology } from \"../api/defineOntology.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/;\n\nexport default async function main(\n args: string[] = process.argv,\n): Promise<void> {\n const commandLineOpts: {\n input: string;\n output: string;\n apiNamespace: string;\n snapshotDir: string;\n valueTypesOutput: string;\n outputDir?: string;\n dependencies?: string;\n } = await yargs(hideBin(args))\n .version(process.env.PACKAGE_VERSION ?? \"\")\n .wrap(Math.min(150, yargs().terminalWidth()))\n .strict()\n .help()\n .options({\n input: {\n alias: \"i\",\n describe: \"Input file\",\n type: \"string\",\n default: \".ontology/ontology.ts\",\n coerce: path.resolve,\n },\n output: {\n alias: \"o\",\n describe: \"Output file\",\n type: \"string\",\n default: \"ontology.json\",\n coerce: path.resolve,\n },\n apiNamespace: {\n describe: \"Api name prefix for namespaced ontology types\",\n type: \"string\",\n default: \"\",\n },\n snapshotDir: {\n alias: \"s\",\n describe: \"Snapshot directory\",\n type: \"string\",\n default: \"snapshots\",\n coerce: path.resolve,\n },\n outputDir: {\n alias: \"d\",\n describe: \"Directory for generated ontology entities\",\n type: \"string\",\n coerce: path.resolve,\n },\n valueTypesOutput: {\n describe: \"Value Type Output File\",\n type: \"string\",\n default: \"value-types.json\",\n coerce: path.resolve,\n },\n dependencies: {\n describe: \"File to write dependencies to\",\n type: \"string\",\n coerce: path.resolve,\n },\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace = (commandLineOpts.apiNamespace.slice(-1) !== \".\")\n ? commandLineOpts.apiNamespace + \".\"\n : commandLineOpts.apiNamespace;\n invariant(apiNamespace.length < 1024, \"API namespace is too long.\");\n invariant(\n apiNamespaceRegex.test(apiNamespace),\n \"API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$\",\n );\n }\n consola.info(`Loading ontology from ${commandLineOpts.input}`);\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n null,\n 2,\n ),\n );\n // No point in generating block if there aren't any value types\n if (\n ontologyIr.valueTypes.valueTypes.length > 0\n || ontologyIr.importedValueTypes.valueTypes.length > 0\n ) {\n await fs.writeFile(\n commandLineOpts.valueTypesOutput,\n JSON.stringify(\n ontologyIr.valueTypes,\n null,\n 2,\n ),\n );\n }\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(input),\n outputDir,\n dependencyFile,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,OAAO,QAAQ,SAAS;AACjC,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AACvC,SAASC,cAAc,QAAQ,0BAA0B;AAEzD,MAAMC,iBAAiB,GAAG,+BAA+B;AAEzD,eAAe,eAAeC,IAAIA,CAChCC,IAAc,GAAGC,OAAO,CAACC,IAAI,EACd;EACf,MAAMC,eAQL,GAAG,MAAMR,KAAK,CAACC,OAAO,CAACI,IAAI,CAAC,CAAC,CAC3BI,OAAO,CAAC,mBAA+B,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C;EACH;AACF;AAEA,eAAeJ,YAAYA,CACzBrB,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7BiB,cAAkC,EAClC;EACA,MAAMC,CAAC,GAAG,MAAM3C,cAAc,CAC5BuB,YAAY,EACZ,YAAY,MAAM,MAAM,CAACR,KAAK,CAAC,EAC/BU,SAAS,EACTiB,cACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
@@ -55,12 +55,14 @@ var CREATE_OR_MODIFY_OBJECT_PARAMETER = "objectToCreateOrModifyParameter";
55
55
  // src/api/defineObject.ts
56
56
  var ISO_8601_DURATION = /^P(?!$)(?:(?:((?:\d+Y)|(?:\d+(?:\.|,)\d+Y$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+D)|(?:\d+(?:\.|,)\d+D$))?(T((?:\d+H)|(?:\d+(?:\.|,)\d+H$))?((?:\d+M)|(?:\d+(?:\.|,)\d+M$))?((?:\d+S)|(?:\d+(?:\.|,)\d+S$))?)?)|(?:\d+(?:(?:\.|,)\d+)?W))$/;
57
57
  var ISO_8601_DATETIME = /^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}(\.\d+)?(Z|[+-]\d{2}:\d{2})?)?$/;
58
+ var API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9\\-]*)$/;
58
59
  function defineObject(objectDef) {
59
60
  const apiName = namespace + objectDef.apiName;
60
61
  const propertyApiNames = objectDef.properties ? Object.keys(objectDef.properties) : [];
61
62
  if (ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName] !== void 0) {
62
63
  throw new Error(`Object type with apiName ${objectDef.apiName} is already defined`);
63
64
  }
65
+ !API_NAME_PATTERN.test(objectDef.apiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`) : invariant5__default.default(false) : void 0;
64
66
  !propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`) : invariant5__default.default(false) : void 0;
65
67
  !propertyApiNames.includes(objectDef.primaryKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`) : invariant5__default.default(false) : void 0;
66
68
  !!objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly ? process.env.NODE_ENV !== "production" ? invariant5__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`) : invariant5__default.default(false) : void 0;
@@ -739,7 +741,7 @@ export const ${entityFileNameBase}: ${entityTypeName} = wrapWithProxy(${entityFi
739
741
  entityModuleNames.push(entityFileNameBase);
740
742
  });
741
743
  for (const entityModuleName of entityModuleNames) {
742
- topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.ts";`);
744
+ topLevelExportStatements.push(`export { ${entityModuleName} } from "./codegen/${typeDirName}/${entityModuleName}.js";`);
743
745
  }
744
746
  });
745
747
  if (topLevelExportStatements.length > 0) {
@@ -1647,7 +1649,7 @@ function convertCardinality(cardinality) {
1647
1649
  // src/cli/main.ts
1648
1650
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
1649
1651
  async function main(args = process.argv) {
1650
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.7").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1652
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.9").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
1651
1653
  input: {
1652
1654
  alias: "i",
1653
1655
  describe: "Input file",
@@ -1701,10 +1703,7 @@ async function main(args = process.argv) {
1701
1703
  consola.consola.info(`Loading ontology from ${commandLineOpts.input}`);
1702
1704
  const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies);
1703
1705
  consola.consola.info(`Saving ontology to ${commandLineOpts.output}`);
1704
- await fs2__namespace.writeFile(commandLineOpts.output, JSON.stringify({
1705
- ontology: ontologyIr.ontology,
1706
- importedOntology: ontologyIr.importedOntology
1707
- }, null, 2));
1706
+ await fs2__namespace.writeFile(commandLineOpts.output, JSON.stringify(ontologyIr, null, 2));
1708
1707
  if (ontologyIr.valueTypes.valueTypes.length > 0 || ontologyIr.importedValueTypes.valueTypes.length > 0) {
1709
1708
  await fs2__namespace.writeFile(commandLineOpts.valueTypesOutput, JSON.stringify(ontologyIr.valueTypes, null, 2));
1710
1709
  }