@osdk/maker 0.84.0 → 0.84.1-main-65dcc111f0439ce4ce5dfd623bc3c12058fc547b

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,13 @@
1
1
  # @osdk/maker
2
2
 
3
+ ## 0.84.1-main-65dcc111f0439ce4ce5dfd623bc3c12058fc547b
4
+
5
+ ### Patch Changes
6
+
7
+ - 6b9b2c0: Preserve `isRequiredParameterOnConcreteAction` in Maker and Marketplace shapes. When the flag is true, check that mapped Action parameters are required.
8
+ - @osdk/api@2.85.1-main-65dcc111f0439ce4ce5dfd623bc3c12058fc547b
9
+ - @osdk/generator-converters.ontologyir@2.85.1-main-65dcc111f0439ce4ce5dfd623bc3c12058fc547b
10
+
3
11
  ## 0.84.0
4
12
 
5
13
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceActionTypeConstraintDefinition.js","names":[],"sources":["InterfaceActionTypeConstraintDefinition.ts"],"sourcesContent":["/*\n * Copyright 2025 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 type { OntologyIrBaseParameterConstraintType } from \"@osdk/client.unstable\";\n\nimport type { InterfaceType } from \"./interface/InterfaceType.js\";\n\nexport interface ParameterConstraintDefinition {\n apiName: string;\n displayName: string;\n type: OntologyIrBaseParameterConstraintType;\n requireImplementation: boolean;\n}\n\nexport interface InterfaceActionTypeConstraintDefinition {\n interfaceType: InterfaceType;\n apiName: string;\n displayName: string;\n description: string;\n requireImplementation: boolean;\n parameters: Array<ParameterConstraintDefinition>;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"InterfaceActionTypeConstraintDefinition.js","names":[],"sources":["InterfaceActionTypeConstraintDefinition.ts"],"sourcesContent":["/*\n * Copyright 2025 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 type { OntologyIrBaseParameterConstraintType } from \"@osdk/client.unstable\";\n\nimport type { InterfaceType } from \"./interface/InterfaceType.js\";\n\nexport interface ParameterConstraintDefinition {\n apiName: string;\n displayName: string;\n type: OntologyIrBaseParameterConstraintType;\n requireImplementation: boolean;\n isRequiredParameterOnConcreteAction?: boolean;\n}\n\nexport interface InterfaceActionTypeConstraintDefinition {\n interfaceType: InterfaceType;\n apiName: string;\n displayName: string;\n description: string;\n requireImplementation: boolean;\n parameters: Array<ParameterConstraintDefinition>;\n}\n"],"mappings":"","ignoreList":[]}
@@ -35,7 +35,8 @@ export function defineInterfaceActionTypeConstraint(input) {
35
35
  apiName: param.apiName
36
36
  },
37
37
  type: param.type,
38
- requireImplementation: param.requireImplementation
38
+ requireImplementation: param.requireImplementation,
39
+ isRequiredParameterOnConcreteAction: param.isRequiredParameterOnConcreteAction
39
40
  };
40
41
  }
41
42
  def.interfaceType.actionTypeConstraints.push({
@@ -1 +1 @@
1
- {"version":3,"file":"defineInterfaceActionTypeConstraint.js","names":["invariant","cloneDefinition","OntologyEntityTypeEnum","importedTypes","namespace","combineApiNamespaceIfMissing","defineInterfaceActionTypeConstraint","input","def","INTERFACE_TYPE","interfaceType","apiName","process","env","NODE_ENV","apiNameWithNamespace","actionTypeConstraints","find","a","metadata","parameters","seenParamApiNames","Set","param","has","add","displayMetadata","displayName","type","requireImplementation","push","description"],"sources":["defineInterfaceActionTypeConstraint.ts"],"sourcesContent":["/*\n * Copyright 2025 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 type {\n InterfaceParameterConstraintApiName,\n OntologyIrInterfaceParameterConstraint,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\n\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport { importedTypes, namespace } from \"./defineOntology.js\";\nimport type { InterfaceActionTypeConstraintDefinition } from \"./InterfaceActionTypeConstraintDefinition.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\n\nexport function defineInterfaceActionTypeConstraint(\n input: InterfaceActionTypeConstraintDefinition,\n): void {\n const def = cloneDefinition(input);\n\n invariant(\n importedTypes[OntologyEntityTypeEnum.INTERFACE_TYPE][\n def.interfaceType.apiName\n ] == null,\n `Cannot define an action type constraint on imported interface ${def.interfaceType.apiName}. The interface must be locally defined.`,\n );\n\n const apiNameWithNamespace = combineApiNamespaceIfMissing(\n namespace,\n def.apiName,\n );\n\n invariant(\n def.interfaceType.actionTypeConstraints.find(\n (a) => a.metadata.apiName === apiNameWithNamespace,\n ) == null,\n `Action type constraint with apiName ${apiNameWithNamespace} already exists on interface ${def.interfaceType.apiName}`,\n );\n\n const parameters: Record<\n InterfaceParameterConstraintApiName,\n OntologyIrInterfaceParameterConstraint\n > = {};\n const seenParamApiNames = new Set<string>();\n for (const param of def.parameters) {\n invariant(\n !seenParamApiNames.has(param.apiName),\n `Duplicate parameter constraint apiName \"${param.apiName}\" in action type constraint ${apiNameWithNamespace}`,\n );\n seenParamApiNames.add(param.apiName);\n parameters[param.apiName] = {\n displayMetadata: {\n displayName: param.displayName,\n apiName: param.apiName,\n },\n type: param.type,\n requireImplementation: param.requireImplementation,\n };\n }\n\n def.interfaceType.actionTypeConstraints.push({\n metadata: {\n apiName: apiNameWithNamespace,\n displayName: def.displayName,\n description: def.description,\n },\n parameters,\n requireImplementation: def.requireImplementation,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,aAAa,EAAEC,SAAS,QAAQ,qBAAqB;AAE9D,SAASC,4BAA4B,QAAQ,6CAA6C;AAE1F,OAAO,SAASC,mCAAmCA,CACjDC,KAA8C,EACxC;EACN,MAAMC,GAAG,GAAGP,eAAe,CAACM,KAAK,CAAC;EAElC,EACEJ,aAAa,CAACD,sBAAsB,CAACO,cAAc,CAAC,CAClDD,GAAG,CAACE,aAAa,CAACC,OAAO,CAC1B,IAAI,IAAI,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAHXd,SAAS,QAIP,iEAAiEQ,GAAG,CAACE,aAAa,CAACC,OAAO,0CAA0C,IAJtIX,SAAS;EAOT,MAAMe,oBAAoB,GAAGV,4BAA4B,CACvDD,SAAS,EACTI,GAAG,CAACG,OACN,CAAC;EAED,EACEH,GAAG,CAACE,aAAa,CAACM,qBAAqB,CAACC,IAAI,CACzCC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,OAAO,KAAKI,oBAChC,CAAC,IAAI,IAAI,IAAAH,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAHXd,SAAS,QAIP,uCAAuCe,oBAAoB,gCAAgCP,GAAG,CAACE,aAAa,CAACC,OAAO,EAAE,IAJxHX,SAAS;EAOT,MAAMoB,UAGL,GAAG,CAAC,CAAC;EACN,MAAMC,iBAAiB,GAAG,IAAIC,GAAG,CAAS,CAAC;EAC3C,KAAK,MAAMC,KAAK,IAAIf,GAAG,CAACY,UAAU,EAAE;IAClC,CACE,CAACC,iBAAiB,CAACG,GAAG,CAACD,KAAK,CAACZ,OAAO,CAAC,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADvCd,SAAS,QAEP,2CAA2CuB,KAAK,CAACZ,OAAO,+BAA+BI,oBAAoB,EAAE,IAF/Gf,SAAS;IAITqB,iBAAiB,CAACI,GAAG,CAACF,KAAK,CAACZ,OAAO,CAAC;IACpCS,UAAU,CAACG,KAAK,CAACZ,OAAO,CAAC,GAAG;MAC1Be,eAAe,EAAE;QACfC,WAAW,EAAEJ,KAAK,CAACI,WAAW;QAC9BhB,OAAO,EAAEY,KAAK,CAACZ;MACjB,CAAC;MACDiB,IAAI,EAAEL,KAAK,CAACK,IAAI;MAChBC,qBAAqB,EAAEN,KAAK,CAACM;IAC/B,CAAC;EACH;EAEArB,GAAG,CAACE,aAAa,CAACM,qBAAqB,CAACc,IAAI,CAAC;IAC3CX,QAAQ,EAAE;MACRR,OAAO,EAAEI,oBAAoB;MAC7BY,WAAW,EAAEnB,GAAG,CAACmB,WAAW;MAC5BI,WAAW,EAAEvB,GAAG,CAACuB;IACnB,CAAC;IACDX,UAAU;IACVS,qBAAqB,EAAErB,GAAG,CAACqB;EAC7B,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"defineInterfaceActionTypeConstraint.js","names":["invariant","cloneDefinition","OntologyEntityTypeEnum","importedTypes","namespace","combineApiNamespaceIfMissing","defineInterfaceActionTypeConstraint","input","def","INTERFACE_TYPE","interfaceType","apiName","process","env","NODE_ENV","apiNameWithNamespace","actionTypeConstraints","find","a","metadata","parameters","seenParamApiNames","Set","param","has","add","displayMetadata","displayName","type","requireImplementation","isRequiredParameterOnConcreteAction","push","description"],"sources":["defineInterfaceActionTypeConstraint.ts"],"sourcesContent":["/*\n * Copyright 2025 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 type {\n InterfaceParameterConstraintApiName,\n OntologyIrInterfaceParameterConstraint,\n} from \"@osdk/client.unstable\";\nimport invariant from \"tiny-invariant\";\n\nimport { cloneDefinition } from \"./cloneDefinition.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport { importedTypes, namespace } from \"./defineOntology.js\";\nimport type { InterfaceActionTypeConstraintDefinition } from \"./InterfaceActionTypeConstraintDefinition.js\";\nimport { combineApiNamespaceIfMissing } from \"./namespace/combineApiNamespaceIfMissing.js\";\n\nexport function defineInterfaceActionTypeConstraint(\n input: InterfaceActionTypeConstraintDefinition,\n): void {\n const def = cloneDefinition(input);\n\n invariant(\n importedTypes[OntologyEntityTypeEnum.INTERFACE_TYPE][\n def.interfaceType.apiName\n ] == null,\n `Cannot define an action type constraint on imported interface ${def.interfaceType.apiName}. The interface must be locally defined.`,\n );\n\n const apiNameWithNamespace = combineApiNamespaceIfMissing(\n namespace,\n def.apiName,\n );\n\n invariant(\n def.interfaceType.actionTypeConstraints.find(\n (a) => a.metadata.apiName === apiNameWithNamespace,\n ) == null,\n `Action type constraint with apiName ${apiNameWithNamespace} already exists on interface ${def.interfaceType.apiName}`,\n );\n\n const parameters: Record<\n InterfaceParameterConstraintApiName,\n OntologyIrInterfaceParameterConstraint\n > = {};\n const seenParamApiNames = new Set<string>();\n for (const param of def.parameters) {\n invariant(\n !seenParamApiNames.has(param.apiName),\n `Duplicate parameter constraint apiName \"${param.apiName}\" in action type constraint ${apiNameWithNamespace}`,\n );\n seenParamApiNames.add(param.apiName);\n parameters[param.apiName] = {\n displayMetadata: {\n displayName: param.displayName,\n apiName: param.apiName,\n },\n type: param.type,\n requireImplementation: param.requireImplementation,\n isRequiredParameterOnConcreteAction:\n param.isRequiredParameterOnConcreteAction,\n };\n }\n\n def.interfaceType.actionTypeConstraints.push({\n metadata: {\n apiName: apiNameWithNamespace,\n displayName: def.displayName,\n description: def.description,\n },\n parameters,\n requireImplementation: def.requireImplementation,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,OAAOA,SAAS,MAAM,gBAAgB;AAEtC,SAASC,eAAe,QAAQ,sBAAsB;AACtD,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SAASC,aAAa,EAAEC,SAAS,QAAQ,qBAAqB;AAE9D,SAASC,4BAA4B,QAAQ,6CAA6C;AAE1F,OAAO,SAASC,mCAAmCA,CACjDC,KAA8C,EACxC;EACN,MAAMC,GAAG,GAAGP,eAAe,CAACM,KAAK,CAAC;EAElC,EACEJ,aAAa,CAACD,sBAAsB,CAACO,cAAc,CAAC,CAClDD,GAAG,CAACE,aAAa,CAACC,OAAO,CAC1B,IAAI,IAAI,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAHXd,SAAS,QAIP,iEAAiEQ,GAAG,CAACE,aAAa,CAACC,OAAO,0CAA0C,IAJtIX,SAAS;EAOT,MAAMe,oBAAoB,GAAGV,4BAA4B,CACvDD,SAAS,EACTI,GAAG,CAACG,OACN,CAAC;EAED,EACEH,GAAG,CAACE,aAAa,CAACM,qBAAqB,CAACC,IAAI,CACzCC,CAAC,IAAKA,CAAC,CAACC,QAAQ,CAACR,OAAO,KAAKI,oBAChC,CAAC,IAAI,IAAI,IAAAH,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAHXd,SAAS,QAIP,uCAAuCe,oBAAoB,gCAAgCP,GAAG,CAACE,aAAa,CAACC,OAAO,EAAE,IAJxHX,SAAS;EAOT,MAAMoB,UAGL,GAAG,CAAC,CAAC;EACN,MAAMC,iBAAiB,GAAG,IAAIC,GAAG,CAAS,CAAC;EAC3C,KAAK,MAAMC,KAAK,IAAIf,GAAG,CAACY,UAAU,EAAE;IAClC,CACE,CAACC,iBAAiB,CAACG,GAAG,CAACD,KAAK,CAACZ,OAAO,CAAC,GAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADvCd,SAAS,QAEP,2CAA2CuB,KAAK,CAACZ,OAAO,+BAA+BI,oBAAoB,EAAE,IAF/Gf,SAAS;IAITqB,iBAAiB,CAACI,GAAG,CAACF,KAAK,CAACZ,OAAO,CAAC;IACpCS,UAAU,CAACG,KAAK,CAACZ,OAAO,CAAC,GAAG;MAC1Be,eAAe,EAAE;QACfC,WAAW,EAAEJ,KAAK,CAACI,WAAW;QAC9BhB,OAAO,EAAEY,KAAK,CAACZ;MACjB,CAAC;MACDiB,IAAI,EAAEL,KAAK,CAACK,IAAI;MAChBC,qBAAqB,EAAEN,KAAK,CAACM,qBAAqB;MAClDC,mCAAmC,EACjCP,KAAK,CAACO;IACV,CAAC;EACH;EAEAtB,GAAG,CAACE,aAAa,CAACM,qBAAqB,CAACe,IAAI,CAAC;IAC3CZ,QAAQ,EAAE;MACRR,OAAO,EAAEI,oBAAoB;MAC7BY,WAAW,EAAEnB,GAAG,CAACmB,WAAW;MAC5BK,WAAW,EAAExB,GAAG,CAACwB;IACnB,CAAC;IACDZ,UAAU;IACVS,qBAAqB,EAAErB,GAAG,CAACqB;EAC7B,CAAC,CAAC;AACJ","ignoreList":[]}
@@ -27,7 +27,7 @@ import { reconcileOntologySchemaLockfile } from "../lockfile/reconcileOntologySc
27
27
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/u;
28
28
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
29
29
  export default async function main(args = process.argv) {
30
- const commandLineOpts = await yargs(hideBin(args)).version("0.84.0" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
30
+ const commandLineOpts = await yargs(hideBin(args)).version("0.84.1-main-65dcc111f0439ce4ce5dfd623bc3c12058fc547b" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
31
31
  input: {
32
32
  alias: "i",
33
33
  describe: "Input file",
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","names":["fs","path","pathToFileURL","consola","LogLevels","invariant","yargs","hideBin","defineOntology","DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME","reconcileOntologySchemaLockfile","apiNamespaceRegex","uuidRegex","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","generateCodeSnippets","codeSnippetPackageName","codeSnippetDir","randomnessKey","lockfile","writeLocks","yes","verbose","count","middleware","level","logLevelFor","implies","fail","msg","err","usage","showHelp","Error","parseAsync","length","slice","env","NODE_ENV","test","info","undefined","lockfilePath","join","dirname","ontologyIr","loadOntology","ontology","assumeYes","writeFile","JSON","stringify","key","value","valueTypes","importedValueTypes","verbosity","debug","trace","dependencyFile","snippetPackageName","beforeWrite","q","href"],"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 * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { LogLevel } from \"consola\";\nimport { consola, LogLevels } from \"consola\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport type { OntologyDefinition } from \"../api/common/OntologyDefinition.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME } from \"../lockfile/OntologySchemaLockfile.js\";\nimport { reconcileOntologySchemaLockfile } from \"../lockfile/reconcileOntologySchemaLockfile.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/u;\nconst uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;\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 generateCodeSnippets: boolean;\n codeSnippetPackageName: string;\n codeSnippetDir: string;\n randomnessKey?: string;\n lockfile?: string;\n writeLocks?: boolean;\n yes?: boolean;\n verbose: number;\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 generateCodeSnippets: {\n describe: \"Enable code snippet files creation\",\n type: \"boolean\",\n default: false,\n },\n codeSnippetPackageName: {\n describe:\n \"The package name that will be displayed in the code snippets\",\n default: \"\",\n type: \"string\",\n },\n codeSnippetDir: {\n describe: \"Directory for generated code snippet files\",\n type: \"string\",\n default: \"./\",\n coerce: path.resolve,\n },\n randomnessKey: {\n describe: \"Value used to assure uniqueness of entities\",\n type: \"string\",\n },\n lockfile: {\n describe: `Ontology schema lockfile path (default: ${DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME} beside --input)`,\n type: \"string\",\n // No `default`: it depends on --input, which `coerce` cannot see. Resolved after parsing.\n coerce: path.resolve,\n },\n writeLocks: {\n describe:\n \"Update the ontology schema lockfile instead of failing when it is out of date\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n yes: {\n alias: \"y\",\n describe:\n \"Accept detected ontology schema migration finalizations/deletions without prompting\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n verbose: {\n alias: \"v\",\n describe:\n \"Enable verbose logging: -v for debug, including stack traces on failure, -vv for trace\",\n type: \"boolean\",\n count: true,\n },\n })\n .middleware(({ verbose }) => {\n consola.level = logLevelFor(verbose);\n }, true)\n // --yes only answers the prompt that --write-locks can raise, so on its own it does nothing.\n .implies(\"yes\", \"writeLocks\")\n // Without this, the usage error that `implies` raises calls `process.exit` from inside the\n // library, which takes the whole host process with it.\n .fail((msg, err, usage) => {\n if (err) {\n throw err;\n }\n\n // Registering a failure handler suppresses yargs' showHelpOnFail behavior, so reinstate it.\n usage.showHelp(\"error\");\n throw new Error(msg);\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace =\n 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 if (\n !commandLineOpts.generateCodeSnippets &&\n (commandLineOpts.codeSnippetPackageName !== \"\" ||\n commandLineOpts.codeSnippetDir !== path.resolve(\"./\"))\n ) {\n consola.info(\n \"Package name and/or directory supplied for code snippets, but code snippet generation is false.\",\n );\n }\n\n if (commandLineOpts.randomnessKey !== undefined) {\n invariant(\n uuidRegex.test(commandLineOpts.randomnessKey),\n \"Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee\",\n );\n }\n\n // The lockfile is a checked-in source artifact describing the ontology definition, not a build artifact\n // like `output`, so it belongs beside the definition rather than wherever maker was invoked.\n const lockfilePath =\n commandLineOpts.lockfile ??\n path.join(\n path.dirname(commandLineOpts.input),\n DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME,\n );\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n commandLineOpts.generateCodeSnippets,\n commandLineOpts.codeSnippetPackageName,\n commandLineOpts.codeSnippetDir,\n commandLineOpts.randomnessKey,\n // An ontology that fails lockfile checks would fail at installation-time, so the ontology-ir\n // should never reach disk at all.\n async (ontology) =>\n await reconcileOntologySchemaLockfile({\n ontology,\n lockfilePath,\n writeLocks: commandLineOpts.writeLocks ?? false,\n assumeYes: commandLineOpts.yes ?? false,\n }),\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n (key, value) => (key === \"linkedInterfaces\" ? undefined : value),\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(ontologyIr.valueTypes, null, 2),\n );\n }\n}\n\nfunction logLevelFor(verbosity: number): LogLevel {\n if (verbosity === 0) return LogLevels.info;\n if (verbosity === 1) return LogLevels.debug;\n return LogLevels.trace;\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n generateCodeSnippets: boolean,\n snippetPackageName: string,\n codeSnippetDir: string,\n randomnessKey: string | undefined,\n beforeWrite: (ontology: OntologyDefinition) => Promise<void>,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(pathToFileURL(input).href),\n outputDir,\n dependencyFile,\n generateCodeSnippets,\n snippetPackageName,\n codeSnippetDir,\n randomnessKey,\n beforeWrite,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,aAAa,QAAQ,UAAU;AAGxC,SAASC,OAAO,EAAEC,SAAS,QAAQ,SAAS;AAC5C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,OAAO,QAAQ,eAAe;AAGvC,SAASC,cAAc,QAAQ,0BAA0B;AACzD,SAASC,qCAAqC,QAAQ,uCAAuC;AAC7F,SAASC,+BAA+B,QAAQ,gDAAgD;AAEhG,MAAMC,iBAAiB,GAAG,gCAAgC;AAC1D,MAAMC,SAAS,GACb,iEAAiE;AAEnE,eA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EAAE,IAAI,EAAE,CAAC,CAC/C,CAAC;EACH;AACF;AAEA,SAAS5B,WAAWA,CAAC8B,SAAiB,EAAY;EAChD,IAAIA,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC4D,IAAI;EAC1C,IAAIgB,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC6E,KAAK;EAC3C,OAAO7E,SAAS,CAAC8E,KAAK;AACxB;AAEA,eAAeZ,YAAYA,CACzB5C,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7B+C,cAAkC,EAClC5C,oBAA6B,EAC7B6C,kBAA0B,EAC1B3C,cAAsB,EACtBC,aAAiC,EACjC2C,WAA4D,EAC5D;EACA,MAAMC,CAAC,GAAG,MAAM9E,cAAc,CAC5B0B,YAAY,EACZ,YAAY,MAAM,MAAM,CAAChC,aAAa,CAACwB,KAAK,CAAC,CAAC6D,IAAI,CAAC,EACnDnD,SAAS,EACT+C,cAAc,EACd5C,oBAAoB,EACpB6C,kBAAkB,EAClB3C,cAAc,EACdC,aAAa,EACb2C,WACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"main.js","names":["fs","path","pathToFileURL","consola","LogLevels","invariant","yargs","hideBin","defineOntology","DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME","reconcileOntologySchemaLockfile","apiNamespaceRegex","uuidRegex","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","generateCodeSnippets","codeSnippetPackageName","codeSnippetDir","randomnessKey","lockfile","writeLocks","yes","verbose","count","middleware","level","logLevelFor","implies","fail","msg","err","usage","showHelp","Error","parseAsync","length","slice","env","NODE_ENV","test","info","undefined","lockfilePath","join","dirname","ontologyIr","loadOntology","ontology","assumeYes","writeFile","JSON","stringify","key","value","valueTypes","importedValueTypes","verbosity","debug","trace","dependencyFile","snippetPackageName","beforeWrite","q","href"],"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 * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nimport type { LogLevel } from \"consola\";\nimport { consola, LogLevels } from \"consola\";\nimport invariant from \"tiny-invariant\";\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\n\nimport type { OntologyDefinition } from \"../api/common/OntologyDefinition.js\";\nimport { defineOntology } from \"../api/defineOntology.js\";\nimport { DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME } from \"../lockfile/OntologySchemaLockfile.js\";\nimport { reconcileOntologySchemaLockfile } from \"../lockfile/reconcileOntologySchemaLockfile.js\";\n\nconst apiNamespaceRegex = /^[a-z0-9-]+(\\.[a-z0-9-]+)*\\.$/u;\nconst uuidRegex =\n /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;\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 generateCodeSnippets: boolean;\n codeSnippetPackageName: string;\n codeSnippetDir: string;\n randomnessKey?: string;\n lockfile?: string;\n writeLocks?: boolean;\n yes?: boolean;\n verbose: number;\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 generateCodeSnippets: {\n describe: \"Enable code snippet files creation\",\n type: \"boolean\",\n default: false,\n },\n codeSnippetPackageName: {\n describe:\n \"The package name that will be displayed in the code snippets\",\n default: \"\",\n type: \"string\",\n },\n codeSnippetDir: {\n describe: \"Directory for generated code snippet files\",\n type: \"string\",\n default: \"./\",\n coerce: path.resolve,\n },\n randomnessKey: {\n describe: \"Value used to assure uniqueness of entities\",\n type: \"string\",\n },\n lockfile: {\n describe: `Ontology schema lockfile path (default: ${DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME} beside --input)`,\n type: \"string\",\n // No `default`: it depends on --input, which `coerce` cannot see. Resolved after parsing.\n coerce: path.resolve,\n },\n writeLocks: {\n describe:\n \"Update the ontology schema lockfile instead of failing when it is out of date\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n yes: {\n alias: \"y\",\n describe:\n \"Accept detected ontology schema migration finalizations/deletions without prompting\",\n type: \"boolean\",\n // NB: no default since \"implied\" below\n },\n verbose: {\n alias: \"v\",\n describe:\n \"Enable verbose logging: -v for debug, including stack traces on failure, -vv for trace\",\n type: \"boolean\",\n count: true,\n },\n })\n .middleware(({ verbose }) => {\n consola.level = logLevelFor(verbose);\n }, true)\n // --yes only answers the prompt that --write-locks can raise, so on its own it does nothing.\n .implies(\"yes\", \"writeLocks\")\n // Without this, the usage error that `implies` raises calls `process.exit` from inside the\n // library, which takes the whole host process with it.\n .fail((msg, err, usage) => {\n if (err) {\n throw err;\n }\n\n // Registering a failure handler suppresses yargs' showHelpOnFail behavior, so reinstate it.\n usage.showHelp(\"error\");\n throw new Error(msg);\n })\n .parseAsync();\n let apiNamespace = \"\";\n if (commandLineOpts.apiNamespace.length !== 0) {\n apiNamespace =\n 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 if (\n !commandLineOpts.generateCodeSnippets &&\n (commandLineOpts.codeSnippetPackageName !== \"\" ||\n commandLineOpts.codeSnippetDir !== path.resolve(\"./\"))\n ) {\n consola.info(\n \"Package name and/or directory supplied for code snippets, but code snippet generation is false.\",\n );\n }\n\n if (commandLineOpts.randomnessKey !== undefined) {\n invariant(\n uuidRegex.test(commandLineOpts.randomnessKey),\n \"Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee\",\n );\n }\n\n // The lockfile is a checked-in source artifact describing the ontology definition, not a build artifact\n // like `output`, so it belongs beside the definition rather than wherever maker was invoked.\n const lockfilePath =\n commandLineOpts.lockfile ??\n path.join(\n path.dirname(commandLineOpts.input),\n DEFAULT_ONTOLOGY_SCHEMA_LOCKFILE_NAME,\n );\n\n const ontologyIr = await loadOntology(\n commandLineOpts.input,\n apiNamespace,\n commandLineOpts.outputDir,\n commandLineOpts.dependencies,\n commandLineOpts.generateCodeSnippets,\n commandLineOpts.codeSnippetPackageName,\n commandLineOpts.codeSnippetDir,\n commandLineOpts.randomnessKey,\n // An ontology that fails lockfile checks would fail at installation-time, so the ontology-ir\n // should never reach disk at all.\n async (ontology) =>\n await reconcileOntologySchemaLockfile({\n ontology,\n lockfilePath,\n writeLocks: commandLineOpts.writeLocks ?? false,\n assumeYes: commandLineOpts.yes ?? false,\n }),\n );\n\n consola.info(`Saving ontology to ${commandLineOpts.output}`);\n await fs.writeFile(\n commandLineOpts.output,\n JSON.stringify(\n ontologyIr,\n (key, value) => (key === \"linkedInterfaces\" ? undefined : value),\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(ontologyIr.valueTypes, null, 2),\n );\n }\n}\n\nfunction logLevelFor(verbosity: number): LogLevel {\n if (verbosity === 0) return LogLevels.info;\n if (verbosity === 1) return LogLevels.debug;\n return LogLevels.trace;\n}\n\nasync function loadOntology(\n input: string,\n apiNamespace: string,\n outputDir: string | undefined,\n dependencyFile: string | undefined,\n generateCodeSnippets: boolean,\n snippetPackageName: string,\n codeSnippetDir: string,\n randomnessKey: string | undefined,\n beforeWrite: (ontology: OntologyDefinition) => Promise<void>,\n) {\n const q = await defineOntology(\n apiNamespace,\n async () => await import(pathToFileURL(input).href),\n outputDir,\n dependencyFile,\n generateCodeSnippets,\n snippetPackageName,\n codeSnippetDir,\n randomnessKey,\n beforeWrite,\n );\n return q;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,SAASC,aAAa,QAAQ,UAAU;AAGxC,SAASC,OAAO,EAAEC,SAAS,QAAQ,SAAS;AA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Y,KAAM,EAChE,CACF,CACF,CAAC;EACD;EACA,IACER,UAAU,CAACS,UAAU,CAACA,UAAU,CAACnB,MAAM,GAAG,CAAC,IAC3CU,UAAU,CAACU,kBAAkB,CAACD,UAAU,CAACnB,MAAM,GAAG,CAAC,EACnD;IACA,MAAM3D,EAAE,CAACyE,SAAS,CAChBxD,eAAe,CAACoB,gBAAgB,EAChCqC,IAAI,CAACC,SAAS,CAACN,UAAU,CAACS,UAAU,EAAE,IAAI,EAAE,CAAC,CAC/C,CAAC;EACH;AACF;AAEA,SAAS5B,WAAWA,CAAC8B,SAAiB,EAAY;EAChD,IAAIA,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC4D,IAAI;EAC1C,IAAIgB,SAAS,KAAK,CAAC,EAAE,OAAO5E,SAAS,CAAC6E,KAAK;EAC3C,OAAO7E,SAAS,CAAC8E,KAAK;AACxB;AAEA,eAAeZ,YAAYA,CACzB5C,KAAa,EACbQ,YAAoB,EACpBE,SAA6B,EAC7B+C,cAAkC,EAClC5C,oBAA6B,EAC7B6C,kBAA0B,EAC1B3C,cAAsB,EACtBC,aAAiC,EACjC2C,WAA4D,EAC5D;EACA,MAAMC,CAAC,GAAG,MAAM9E,cAAc,CAC5B0B,YAAY,EACZ,YAAY,MAAM,MAAM,CAAChC,aAAa,CAACwB,KAAK,CAAC,CAAC6D,IAAI,CAAC,EACnDnD,SAAS,EACT+C,cAAc,EACd5C,oBAAoB,EACpB6C,kBAAkB,EAClB3C,cAAc,EACdC,aAAa,EACb2C,WACF,CAAC;EACD,OAAOC,CAAC;AACV","ignoreList":[]}
@@ -5052,7 +5052,8 @@ function defineInterfaceActionTypeConstraint(input) {
5052
5052
  apiName: param.apiName
5053
5053
  },
5054
5054
  type: param.type,
5055
- requireImplementation: param.requireImplementation
5055
+ requireImplementation: param.requireImplementation,
5056
+ isRequiredParameterOnConcreteAction: param.isRequiredParameterOnConcreteAction
5056
5057
  };
5057
5058
  }
5058
5059
  def.interfaceType.actionTypeConstraints.push({
@@ -6562,7 +6563,7 @@ async function readIfExists(path5) {
6562
6563
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/u;
6563
6564
  var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u;
6564
6565
  async function main(args = process.argv) {
6565
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.84.0").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
6566
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.84.1-main-65dcc111f0439ce4ce5dfd623bc3c12058fc547b").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
6566
6567
  input: {
6567
6568
  alias: "i",
6568
6569
  describe: "Input file",