@osdk/generator 2.0.4 → 2.0.6

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.
@@ -58,9 +58,7 @@ async function generateV2QueryFile(fs, outDir, relOutDir, query, importExt, onto
58
58
  export namespace ${query.shortApiName} {
59
59
  export interface Signature {
60
60
  ${getDescriptionIfPresent(query.description)}
61
- (${Object.keys(query.parameters).length > 0 ? `query: ${query.paramsIdentifier}` : ""}): Promise<${getQueryParamType(ontology, paramToDef({
62
- dataType: query.output
63
- }), "Result")}>
61
+ (${Object.keys(query.parameters).length > 0 ? `query: ${query.paramsIdentifier}` : ""}): Promise<${query.shortApiName}.ReturnType>
64
62
  }
65
63
 
66
64
  ${Object.keys(query.parameters).length > 0 ? `
@@ -74,14 +72,21 @@ async function generateV2QueryFile(fs, outDir, relOutDir, query, importExt, onto
74
72
  })}readonly "${apiName}"${q.nullable ? "?" : ""}`, `${getQueryParamType(ontology, q, "Param")}`];
75
73
  }
76
74
  })}
77
- }
78
-
79
- ` : ""}
80
-
81
-
82
-
83
- }
75
+ }` : ""}
84
76
 
77
+ ${query.output.type === "struct" ? `
78
+ export interface ReturnType
79
+ ${getQueryParamType(ontology, paramToDef({
80
+ dataType: query.output
81
+ }), "Result")}
82
+ ` : `
83
+ export type ReturnType = ${getQueryParamType(ontology, paramToDef({
84
+ dataType: query.output
85
+ }), "Result")}
86
+ `}
87
+ }
88
+
89
+
85
90
  export interface ${query.shortApiName} extends QueryDefinition<
86
91
  ${query.shortApiName}.Signature
87
92
  >, VersionBound<$ExpectedClientVersion>{
@@ -163,12 +168,21 @@ export function getQueryParamType(enhancedOntology, input, type) {
163
168
  case "integer":
164
169
  case "long":
165
170
  case "string":
166
- case "struct":
167
171
  case "threeDimensionalAggregation":
168
172
  case "timestamp":
169
173
  case "twoDimensionalAggregation":
170
174
  inner = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;
171
175
  break;
176
+ case "struct":
177
+ inner = `{
178
+ ${stringify(input.struct, {
179
+ "*": (p, formatter, apiName) => {
180
+ return [`
181
+ ${type === "Param" ? "readonly " : ""}"${apiName}"${p.nullable ? "?" : ""}`, `${getQueryParamType(enhancedOntology, p, type)}`];
182
+ }
183
+ })}
184
+ }`;
185
+ break;
172
186
  case "object":
173
187
  inner = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
174
188
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"generatePerQueryDataFiles.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryParameterV2ToQueryParameterDefinition","paramToDef","wireQueryTypeV2ToSdkQueryDefinitionNoParams","path","getObjectImports","getObjectTypeApiNamesFromQuery","deleteUndefineds","stringify","formatTs","getDescriptionIfPresent","generatePerQueryDataFilesV2","fs","outDir","rootOutDir","ontology","importExt","relOutDir","join","mkdir","recursive","Promise","all","Object","values","queryTypes","map","query","generateV2QueryFile","writeFile","shortApiName","getImportPathRelTo","keys","length","relFilePath","objectTypes","objectTypeObjects","Set","o","requireObjectType","importObjects","baseProps","raw","outputBase","output","apiNameObj","description","parameters","paramsIdentifier","getQueryParamType","dataType","*","parameter","formatter","apiName","q","queryParamJsDoc","nullable","parameterDefsForType","getLineFor__OsdkTargetType","undefined","displayName","rid","definitionIdentifier","parametersForConst","valueFormatter","qdt","type","objectTypeApiName","getImportedDefinitionIdentifier","param","ret","enhancedOntology","input","inner","JSON","object","objectSet","set","union","u","multiplicity"],"sources":["generatePerQueryDataFiles.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition as paramToDef, wireQueryTypeV2ToSdkQueryDefinitionNoParams, } from \"@osdk/generator-converters\";\nimport path from \"node:path\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { getObjectTypeApiNamesFromQuery } from \"../shared/getObjectTypeApiNamesFromQuery.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { formatTs } from \"../util/test/formatTs.js\";\nimport { getDescriptionIfPresent } from \"./getDescriptionIfPresent.js\";\nexport async function generatePerQueryDataFilesV2({ fs, outDir: rootOutDir, ontology, importExt = \"\", }, v2) {\n const relOutDir = path.join(\".\", \"ontology\", \"queries\");\n const outDir = path.join(rootOutDir, \"ontology\", \"queries\");\n await fs.mkdir(outDir, { recursive: true });\n await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {\n await generateV2QueryFile(fs, outDir, relOutDir, query, importExt, ontology);\n }));\n const indexFilePath = `${outDir}.ts`;\n await fs.writeFile(indexFilePath, await formatTs(`\n ${Object.values(ontology.queryTypes).map(query => `export {${query.shortApiName}} from \"${query.getImportPathRelTo(relOutDir)}\";`)\n .join(\"\\n\")}\n ${Object.keys(ontology.queryTypes).length === 0 ? \"export {};\" : \"\"}\n `));\n}\nasync function generateV2QueryFile(fs, outDir, relOutDir, query, importExt, ontology) {\n const relFilePath = path.join(relOutDir, `${query.shortApiName}.ts`);\n const objectTypes = getObjectTypeApiNamesFromQuery(query);\n const objectTypeObjects = new Set(objectTypes.map(o => ontology.requireObjectType(o)));\n const importObjects = getObjectImports(objectTypeObjects, \"\", relFilePath, true);\n const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw));\n const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));\n const referencedObjectTypes = objectTypes.length > 0\n ? objectTypes.map(apiNameObj => `\"${apiNameObj}\"`).join(\"|\")\n : \"never\";\n await fs.writeFile(path.join(outDir, `${query.shortApiName}.ts`), await formatTs(`\n import type { QueryDefinition , VersionBound} from \"@osdk/api\";\n import type { QueryParam, QueryResult } from \"@osdk/api\";\n import type { $ExpectedClientVersion } from \"../../OntologyMetadata${importExt}\";\n import { $osdkMetadata} from \"../../OntologyMetadata${importExt}\";\n ${importObjects}\n\n export namespace ${query.shortApiName} {\n export interface Signature {\n ${getDescriptionIfPresent(query.description)}\n (${Object.keys(query.parameters).length > 0\n ? `query: ${query.paramsIdentifier}`\n : \"\"}): Promise<${getQueryParamType(ontology, paramToDef({ dataType: query.output }), \"Result\")}>\n }\n\n ${Object.keys(query.parameters).length > 0\n ? `\n export interface Parameters {\n ${stringify(query.parameters, {\n \"*\": (parameter, formatter, apiName) => {\n const q = paramToDef(parameter);\n return [\n `\n ${queryParamJsDoc(paramToDef(parameter), { apiName })}readonly \"${apiName}\"${q.nullable ? \"?\" : \"\"}`,\n `${getQueryParamType(ontology, q, \"Param\")}`,\n ];\n },\n })}\n }\n \n `\n : \"\"}\n\n \n\n }\n\n export interface ${query.shortApiName} extends QueryDefinition<\n ${query.shortApiName}.Signature\n >, VersionBound<$ExpectedClientVersion>{\n __DefinitionMetadata?: {\n ${stringify(baseProps)}\n parameters: {\n ${parameterDefsForType(ontology, query)}\n };\n output: {\n ${stringify(outputBase)},\n ${getLineFor__OsdkTargetType(ontology, query.output)}\n };\n signature: ${query.shortApiName}.Signature;\n }, \n ${stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })}, \n osdkMetadata: typeof $osdkMetadata;\n }\n\n\n export const ${query.shortApiName}: ${query.definitionIdentifier} = {\n ${stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })},\n osdkMetadata: $osdkMetadata\n };\n `));\n}\nfunction parametersForConst(query) {\n return stringify(query.parameters, {\n \"*\": (parameter, formatter) => formatter(deleteUndefineds(paramToDef(parameter))),\n });\n}\nfunction parameterDefsForType(ontology, query) {\n return stringify(query.parameters, {\n \"*\": (parameter, valueFormatter, apiName) => [\n `${queryParamJsDoc(paramToDef(parameter), { apiName })} ${apiName}`,\n ` {\n ${stringify(deleteUndefineds(paramToDef(parameter)))},\n ${getLineFor__OsdkTargetType(ontology, parameter.dataType)}\n }`,\n ],\n });\n}\nfunction getLineFor__OsdkTargetType(ontology, qdt) {\n if (qdt.type === \"object\" || qdt.type === \"objectSet\") {\n return `__OsdkTargetType?: ${ontology.requireObjectType(qdt.objectTypeApiName).getImportedDefinitionIdentifier(true)}`;\n }\n return \"\";\n}\nexport function queryParamJsDoc(param, { apiName }) {\n let ret = `/**\\n`;\n if (param.description) {\n if (param.description) {\n ret += ` * description: ${param.description}\\n`;\n }\n }\n else {\n ret += ` * (no ontology metadata)\\n`;\n }\n ret += ` */\\n`;\n return ret;\n}\nexport function getQueryParamType(enhancedOntology, input, type) {\n let inner = `unknown /* ${input.type} */`;\n switch (input.type) {\n case \"date\":\n inner = `Query${type}.PrimitiveType<${JSON.stringify(\"datetime\")}>`;\n break;\n case \"attachment\":\n case \"boolean\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"struct\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n inner = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;\n break;\n case \"object\":\n inner = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object)\n .getImportedDefinitionIdentifier(true)}>`;\n break;\n case \"objectSet\":\n inner = `Query${type}.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet)\n .getImportedDefinitionIdentifier(true)}>`;\n break;\n case \"set\":\n inner = `${type === \"Param\" ? \"Readonly\" : \"\"}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;\n break;\n case \"union\":\n inner = input.union.map((u) => getQueryParamType(enhancedOntology, u, type)).join(\" | \");\n break;\n }\n if (input.multiplicity && type === \"Param\") {\n return `ReadonlyArray<${inner}>`;\n }\n else if (input.multiplicity) {\n return `Array<${inner}>`;\n }\n return inner;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,0CAA0C,EAAEC,8CAA8C,IAAIC,UAAU,EAAEC,2CAA2C,QAAS,4BAA4B;AACnM,OAAOC,IAAI,MAAM,WAAW;AAC5B,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,8BAA8B,QAAQ,6CAA6C;AAC5F,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,QAAQ,QAAQ,0BAA0B;AACnD,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,OAAO,eAAeC,2BAA2BA,CAAC;EAAEC,EAAE;EAAEC,MAAM,EAAEC,UAAU;EAAEC,QAAQ;EAAEC,SAAS,GAAG;AAAI,CAAC,EAAM;EACzG,MAAMC,SAAS,GAAGb,IAAI,CAACc,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,CAAC;EACvD,MAAML,MAAM,GAAGT,IAAI,CAACc,IAAI,CAACJ,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC;EAC3D,MAAMF,EAAE,CAACO,KAAK,CAACN,MAAM,EAAE;IAAEO,SAAS,EAAE;EAAK,CAAC,CAAC;EAC3C,MAAMC,OAAO,CAACC,GAAG,CAACC,MAAM,CAACC,MAAM,CAACT,QAAQ,CAACU,UAAU,CAAC,CAACC,GAAG,CAAC,MAAOC,KAAK,IAAK;IACtE,MAAMC,mBAAmB,CAAChB,EAAE,EAAEC,MAAM,EAAEI,SAAS,EAAEU,KAAK,EAAEX,SAAS,EAAED,QAAQ,CAAC;EAChF,CAAC,CAAC,CAAC;EAEH,MAAMH,EAAE,CAACiB,SAAS,CADI,GAAGhB,MAAM,KAAK,EACF,M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KAAK,QAAQ;IACb,KAAK,6BAA6B;IAClC,KAAK,WAAW;IAChB,KAAK,2BAA2B;MAC5BkE,KAAK,GAAG,QAAQP,IAAI,kBAAkBQ,IAAI,CAACnE,SAAS,CAACiE,KAAK,CAACN,IAAI,CAAC,GAAG;MACnE;IACJ,KAAK,QAAQ;MACTO,KAAK,GAAG,QAAQP,IAAI,eAAeK,gBAAgB,CAACjC,iBAAiB,CAACkC,KAAK,CAACG,MAAM,CAAC,CAC9EP,+BAA+B,CAAC,IAAI,CAAC,GAAG;MAC7C;IACJ,KAAK,WAAW;MACZK,KAAK,GAAG,QAAQP,IAAI,kBAAkBK,gBAAgB,CAACjC,iBAAiB,CAACkC,KAAK,CAACI,SAAS,CAAC,CACpFR,+BAA+B,CAAC,IAAI,CAAC,GAAG;MAC7C;IACJ,KAAK,KAAK;MACNK,KAAK,GAAG,GAAGP,IAAI,KAAK,OAAO,GAAG,UAAU,GAAG,EAAE,OAAOlB,iBAAiB,CAACuB,gBAAgB,EAAEC,KAAK,CAACK,GAAG,EAAEX,IAAI,CAAC,GAAG;MAC3G;IACJ,KAAK,OAAO;MACRO,KAAK,GAAGD,KAAK,CAACM,KAAK,CAACrD,GAAG,CAAEsD,CAAC,IAAK/B,iBAAiB,CAACuB,gBAAgB,EAAEQ,CAAC,EAAEb,IAAI,CAAC,CAAC,CAACjD,IAAI,CAAC,KAAK,CAAC;MACxF;EACR;EACA,IAAIuD,KAAK,CAACQ,YAAY,IAAId,IAAI,KAAK,OAAO,EAAE;IACxC,OAAO,iBAAiBO,KAAK,GAAG;EACpC,CAAC,MACI,IAAID,KAAK,CAACQ,YAAY,EAAE;IACzB,OAAO,SAASP,KAAK,GAAG;EAC5B;EACA,OAAOA,KAAK;AAChB","ignoreList":[]}
1
+ {"version":3,"file":"generatePerQueryDataFiles.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryParameterV2ToQueryParameterDefinition","paramToDef","wireQueryTypeV2ToSdkQueryDefinitionNoParams","path","getObjectImports","getObjectTypeApiNamesFromQuery","deleteUndefineds","stringify","formatTs","getDescriptionIfPresent","generatePerQueryDataFilesV2","fs","outDir","rootOutDir","ontology","importExt","relOutDir","join","mkdir","recursive","Promise","all","Object","values","queryTypes","map","query","generateV2QueryFile","writeFile","shortApiName","getImportPathRelTo","keys","length","relFilePath","objectTypes","objectTypeObjects","Set","o","requireObjectType","importObjects","baseProps","raw","outputBase","output","apiNameObj","description","parameters","paramsIdentifier","*","parameter","formatter","apiName","q","queryParamJsDoc","nullable","getQueryParamType","type","dataType","parameterDefsForType","getLineFor__OsdkTargetType","undefined","displayName","rid","definitionIdentifier","parametersForConst","valueFormatter","qdt","objectTypeApiName","getImportedDefinitionIdentifier","param","ret","enhancedOntology","input","inner","JSON","struct","p","object","objectSet","set","union","u","multiplicity"],"sources":["generatePerQueryDataFiles.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition as paramToDef, wireQueryTypeV2ToSdkQueryDefinitionNoParams, } from \"@osdk/generator-converters\";\nimport path from \"node:path\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { getObjectTypeApiNamesFromQuery } from \"../shared/getObjectTypeApiNamesFromQuery.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { formatTs } from \"../util/test/formatTs.js\";\nimport { getDescriptionIfPresent } from \"./getDescriptionIfPresent.js\";\nexport async function generatePerQueryDataFilesV2({ fs, outDir: rootOutDir, ontology, importExt = \"\", }, v2) {\n const relOutDir = path.join(\".\", \"ontology\", \"queries\");\n const outDir = path.join(rootOutDir, \"ontology\", \"queries\");\n await fs.mkdir(outDir, { recursive: true });\n await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {\n await generateV2QueryFile(fs, outDir, relOutDir, query, importExt, ontology);\n }));\n const indexFilePath = `${outDir}.ts`;\n await fs.writeFile(indexFilePath, await formatTs(`\n ${Object.values(ontology.queryTypes).map(query => `export {${query.shortApiName}} from \"${query.getImportPathRelTo(relOutDir)}\";`)\n .join(\"\\n\")}\n ${Object.keys(ontology.queryTypes).length === 0 ? \"export {};\" : \"\"}\n `));\n}\nasync function generateV2QueryFile(fs, outDir, relOutDir, query, importExt, ontology) {\n const relFilePath = path.join(relOutDir, `${query.shortApiName}.ts`);\n const objectTypes = getObjectTypeApiNamesFromQuery(query);\n const objectTypeObjects = new Set(objectTypes.map(o => ontology.requireObjectType(o)));\n const importObjects = getObjectImports(objectTypeObjects, \"\", relFilePath, true);\n const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw));\n const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));\n const referencedObjectTypes = objectTypes.length > 0\n ? objectTypes.map(apiNameObj => `\"${apiNameObj}\"`).join(\"|\")\n : \"never\";\n await fs.writeFile(path.join(outDir, `${query.shortApiName}.ts`), await formatTs(`\n import type { QueryDefinition , VersionBound} from \"@osdk/api\";\n import type { QueryParam, QueryResult } from \"@osdk/api\";\n import type { $ExpectedClientVersion } from \"../../OntologyMetadata${importExt}\";\n import { $osdkMetadata} from \"../../OntologyMetadata${importExt}\";\n ${importObjects}\n\n export namespace ${query.shortApiName} {\n export interface Signature {\n ${getDescriptionIfPresent(query.description)}\n (${Object.keys(query.parameters).length > 0\n ? `query: ${query.paramsIdentifier}`\n : \"\"}): Promise<${query.shortApiName}.ReturnType>\n }\n\n ${Object.keys(query.parameters).length > 0\n ? `\n export interface Parameters {\n ${stringify(query.parameters, {\n \"*\": (parameter, formatter, apiName) => {\n const q = paramToDef(parameter);\n return [\n `\n ${queryParamJsDoc(paramToDef(parameter), { apiName })}readonly \"${apiName}\"${q.nullable ? \"?\" : \"\"}`,\n `${getQueryParamType(ontology, q, \"Param\")}`,\n ];\n },\n })}\n }`\n : \"\"}\n\n ${query.output.type === \"struct\"\n ? `\n export interface ReturnType \n ${getQueryParamType(ontology, paramToDef({ dataType: query.output }), \"Result\")}\n `\n : `\n export type ReturnType = ${getQueryParamType(ontology, paramToDef({ dataType: query.output }), \"Result\")}\n `}\n }\n \n \n export interface ${query.shortApiName} extends QueryDefinition<\n ${query.shortApiName}.Signature\n >, VersionBound<$ExpectedClientVersion>{\n __DefinitionMetadata?: {\n ${stringify(baseProps)}\n parameters: {\n ${parameterDefsForType(ontology, query)}\n };\n output: {\n ${stringify(outputBase)},\n ${getLineFor__OsdkTargetType(ontology, query.output)}\n };\n signature: ${query.shortApiName}.Signature;\n }, \n ${stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })}, \n osdkMetadata: typeof $osdkMetadata;\n }\n\n\n export const ${query.shortApiName}: ${query.definitionIdentifier} = {\n ${stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })},\n osdkMetadata: $osdkMetadata\n };\n `));\n}\nfunction parametersForConst(query) {\n return stringify(query.parameters, {\n \"*\": (parameter, formatter) => formatter(deleteUndefineds(paramToDef(parameter))),\n });\n}\nfunction parameterDefsForType(ontology, query) {\n return stringify(query.parameters, {\n \"*\": (parameter, valueFormatter, apiName) => [\n `${queryParamJsDoc(paramToDef(parameter), { apiName })} ${apiName}`,\n ` {\n ${stringify(deleteUndefineds(paramToDef(parameter)))},\n ${getLineFor__OsdkTargetType(ontology, parameter.dataType)}\n }`,\n ],\n });\n}\nfunction getLineFor__OsdkTargetType(ontology, qdt) {\n if (qdt.type === \"object\" || qdt.type === \"objectSet\") {\n return `__OsdkTargetType?: ${ontology.requireObjectType(qdt.objectTypeApiName).getImportedDefinitionIdentifier(true)}`;\n }\n return \"\";\n}\nexport function queryParamJsDoc(param, { apiName }) {\n let ret = `/**\\n`;\n if (param.description) {\n if (param.description) {\n ret += ` * description: ${param.description}\\n`;\n }\n }\n else {\n ret += ` * (no ontology metadata)\\n`;\n }\n ret += ` */\\n`;\n return ret;\n}\nexport function getQueryParamType(enhancedOntology, input, type) {\n let inner = `unknown /* ${input.type} */`;\n switch (input.type) {\n case \"date\":\n inner = `Query${type}.PrimitiveType<${JSON.stringify(\"datetime\")}>`;\n break;\n case \"attachment\":\n case \"boolean\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"threeDimensionalAggregation\":\n case \"timestamp\":\n case \"twoDimensionalAggregation\":\n inner = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;\n break;\n case \"struct\":\n inner = `{\n ${stringify(input.struct, {\n \"*\": (p, formatter, apiName) => {\n return [\n `\n ${type === \"Param\" ? \"readonly \" : \"\"}\"${apiName}\"${p.nullable ? \"?\" : \"\"}`,\n `${getQueryParamType(enhancedOntology, p, type)}`,\n ];\n },\n })}\n }`;\n break;\n case \"object\":\n inner = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object)\n .getImportedDefinitionIdentifier(true)}>`;\n break;\n case \"objectSet\":\n inner = `Query${type}.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet)\n .getImportedDefinitionIdentifier(true)}>`;\n break;\n case \"set\":\n inner = `${type === \"Param\" ? \"Readonly\" : \"\"}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;\n break;\n case \"union\":\n inner = input.union.map((u) => getQueryParamType(enhancedOntology, u, type)).join(\" | \");\n break;\n }\n if (input.multiplicity && type === \"Param\") {\n return `ReadonlyArray<${inner}>`;\n }\n else if (input.multiplicity) {\n return `Array<${inner}>`;\n }\n return inner;\n}\n"],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ACJ,KAAK,OAAO;MACRiB,KAAK,GAAGD,KAAK,CAACQ,KAAK,CAACvD,GAAG,CAAEwD,CAAC,IAAK1B,iBAAiB,CAACgB,gBAAgB,EAAEU,CAAC,EAAEzB,IAAI,CAAC,CAAC,CAACvC,IAAI,CAAC,KAAK,CAAC;MACxF;EACR;EACA,IAAIuD,KAAK,CAACU,YAAY,IAAI1B,IAAI,KAAK,OAAO,EAAE;IACxC,OAAO,iBAAiBiB,KAAK,GAAG;EACpC,CAAC,MACI,IAAID,KAAK,CAACU,YAAY,EAAE;IACzB,OAAO,SAAST,KAAK,GAAG;EAC5B;EACA,OAAOA,KAAK;AAChB","ignoreList":[]}
@@ -46,7 +46,7 @@ describe("generatePerQueryDataFiles", () => {
46
46
 
47
47
  export namespace getCount {
48
48
  export interface Signature {
49
- (query: getCount.Parameters): Promise<QueryResult.PrimitiveType<'integer'>>;
49
+ (query: getCount.Parameters): Promise<getCount.ReturnType>;
50
50
  }
51
51
 
52
52
  export interface Parameters {
@@ -55,6 +55,8 @@ describe("generatePerQueryDataFiles", () => {
55
55
  */
56
56
  readonly completed: QueryParam.PrimitiveType<'boolean'>;
57
57
  }
58
+
59
+ export type ReturnType = QueryResult.PrimitiveType<'integer'>;
58
60
  }
59
61
 
60
62
  export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
@@ -99,7 +101,7 @@ describe("generatePerQueryDataFiles", () => {
99
101
 
100
102
  export namespace returnsTodo {
101
103
  export interface Signature {
102
- (query: returnsTodo.Parameters): Promise<QueryResult.ObjectType<Todo>>;
104
+ (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;
103
105
  }
104
106
 
105
107
  export interface Parameters {
@@ -108,6 +110,8 @@ describe("generatePerQueryDataFiles", () => {
108
110
  */
109
111
  readonly someTodo: QueryParam.ObjectType<Todo>;
110
112
  }
113
+
114
+ export type ReturnType = QueryResult.ObjectType<Todo>;
111
115
  }
112
116
 
113
117
  export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
@@ -197,5 +201,254 @@ describe("generatePerQueryDataFiles", () => {
197
201
  console.log(q);
198
202
  ts.createDocumentRegistry();
199
203
  });
204
+ it("generates structs for queries", async () => {
205
+ const helper = createMockMinimalFiles();
206
+ await generatePerQueryDataFilesV2({
207
+ fs: helper.minimalFiles,
208
+ ontology: enhanceOntology({
209
+ sanitized: {
210
+ actionTypes: {},
211
+ interfaceTypes: {},
212
+ objectTypes: {},
213
+ ontology: {
214
+ apiName: "foo",
215
+ description: "foo",
216
+ displayName: "foo",
217
+ rid: "ri.foo"
218
+ },
219
+ queryTypes: {
220
+ doThing: {
221
+ rid: "rid.query.1",
222
+ version: "0",
223
+ apiName: "doThing",
224
+ parameters: {
225
+ foo: {
226
+ dataType: {
227
+ type: "string"
228
+ }
229
+ },
230
+ paramStruct: {
231
+ dataType: {
232
+ type: "struct",
233
+ fields: [{
234
+ name: "aDate",
235
+ fieldType: {
236
+ type: "date"
237
+ }
238
+ }, {
239
+ name: "nestedStruct",
240
+ fieldType: {
241
+ type: "struct",
242
+ fields: [{
243
+ name: "nestedString",
244
+ fieldType: {
245
+ type: "string"
246
+ }
247
+ }, {
248
+ name: "nestedInteger",
249
+ fieldType: {
250
+ type: "integer"
251
+ }
252
+ }]
253
+ }
254
+ }]
255
+ }
256
+ }
257
+ },
258
+ output: {
259
+ type: "struct",
260
+ fields: [{
261
+ name: "aString",
262
+ fieldType: {
263
+ type: "string"
264
+ }
265
+ }, {
266
+ name: "anInteger",
267
+ fieldType: {
268
+ type: "integer"
269
+ }
270
+ }, {
271
+ name: "aLong",
272
+ fieldType: {
273
+ type: "long"
274
+ }
275
+ }, {
276
+ name: "aDate",
277
+ fieldType: {
278
+ type: "date"
279
+ }
280
+ }, {
281
+ name: "nestedStruct",
282
+ fieldType: {
283
+ type: "struct",
284
+ fields: [{
285
+ name: "nestedString",
286
+ fieldType: {
287
+ type: "string"
288
+ }
289
+ }, {
290
+ name: "nestedInteger",
291
+ fieldType: {
292
+ type: "integer"
293
+ }
294
+ }]
295
+ }
296
+ }]
297
+ }
298
+ }
299
+ },
300
+ sharedPropertyTypes: {}
301
+ },
302
+ importExt: ".js",
303
+ externalObjects: new Map(),
304
+ externalInterfaces: new Map(),
305
+ externalSpts: new Map()
306
+ }),
307
+ outDir: "/foo",
308
+ importExt: ".js"
309
+ }, true);
310
+ expect(helper.getFiles()["/foo/ontology/queries/doThing.ts"]).toMatchInlineSnapshot(`
311
+ "import type { QueryDefinition, VersionBound } from '@osdk/api';
312
+ import type { QueryParam, QueryResult } from '@osdk/api';
313
+ import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
314
+ import { $osdkMetadata } from '../../OntologyMetadata.js';
315
+
316
+ export namespace doThing {
317
+ export interface Signature {
318
+ (query: doThing.Parameters): Promise<doThing.ReturnType>;
319
+ }
320
+
321
+ export interface Parameters {
322
+ /**
323
+ * (no ontology metadata)
324
+ */
325
+ readonly foo: QueryParam.PrimitiveType<'string'>;
326
+
327
+ /**
328
+ * (no ontology metadata)
329
+ */
330
+ readonly paramStruct: {
331
+ readonly aDate: QueryParam.PrimitiveType<'datetime'>;
332
+
333
+ readonly nestedStruct: {
334
+ readonly nestedInteger: QueryParam.PrimitiveType<'integer'>;
335
+
336
+ readonly nestedString: QueryParam.PrimitiveType<'string'>;
337
+ };
338
+ };
339
+ }
340
+
341
+ export interface ReturnType {
342
+ aDate: QueryResult.PrimitiveType<'datetime'>;
343
+
344
+ aLong: QueryResult.PrimitiveType<'long'>;
345
+
346
+ anInteger: QueryResult.PrimitiveType<'integer'>;
347
+
348
+ aString: QueryResult.PrimitiveType<'string'>;
349
+
350
+ nestedStruct: {
351
+ nestedInteger: QueryResult.PrimitiveType<'integer'>;
352
+
353
+ nestedString: QueryResult.PrimitiveType<'string'>;
354
+ };
355
+ }
356
+ }
357
+
358
+ export interface doThing extends QueryDefinition<doThing.Signature>, VersionBound<$ExpectedClientVersion> {
359
+ __DefinitionMetadata?: {
360
+ apiName: 'doThing';
361
+ rid: 'rid.query.1';
362
+ type: 'query';
363
+ version: '0';
364
+ parameters: {
365
+ /**
366
+ * (no ontology metadata)
367
+ */
368
+ foo: {
369
+ nullable: false;
370
+ type: 'string';
371
+ };
372
+ /**
373
+ * (no ontology metadata)
374
+ */
375
+ paramStruct: {
376
+ nullable: false;
377
+ struct: {
378
+ aDate: {
379
+ type: 'date';
380
+ nullable: false;
381
+ };
382
+ nestedStruct: {
383
+ type: 'struct';
384
+ struct: {
385
+ nestedString: {
386
+ type: 'string';
387
+ nullable: false;
388
+ };
389
+ nestedInteger: {
390
+ type: 'integer';
391
+ nullable: false;
392
+ };
393
+ };
394
+ nullable: false;
395
+ };
396
+ };
397
+ type: 'struct';
398
+ };
399
+ };
400
+ output: {
401
+ nullable: false;
402
+ struct: {
403
+ aString: {
404
+ type: 'string';
405
+ nullable: false;
406
+ };
407
+ anInteger: {
408
+ type: 'integer';
409
+ nullable: false;
410
+ };
411
+ aLong: {
412
+ type: 'long';
413
+ nullable: false;
414
+ };
415
+ aDate: {
416
+ type: 'date';
417
+ nullable: false;
418
+ };
419
+ nestedStruct: {
420
+ type: 'struct';
421
+ struct: {
422
+ nestedString: {
423
+ type: 'string';
424
+ nullable: false;
425
+ };
426
+ nestedInteger: {
427
+ type: 'integer';
428
+ nullable: false;
429
+ };
430
+ };
431
+ nullable: false;
432
+ };
433
+ };
434
+ type: 'struct';
435
+ };
436
+ signature: doThing.Signature;
437
+ };
438
+ apiName: 'doThing';
439
+ type: 'query';
440
+ version: '0';
441
+ osdkMetadata: typeof $osdkMetadata;
442
+ }
443
+
444
+ export const doThing: doThing = {
445
+ apiName: 'doThing',
446
+ type: 'query',
447
+ version: '0',
448
+ osdkMetadata: $osdkMetadata,
449
+ };
450
+ "
451
+ `);
452
+ });
200
453
  });
201
454
  //# sourceMappingURL=generatePerQueryDataFiles.test.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generatePerQueryDataFiles.test.js","names":["ts","describe","expect","it","enhanceOntology","createMockMinimalFiles","TodoWireOntology","generatePerQueryDataFilesV2","helper","fs","minimalFiles","ontology","sanitized","importExt","externalObjects","Map","externalInterfaces","externalSpts","outDir","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry"],"sources":["generatePerQueryDataFiles.test.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport * as ts from \"typescript\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { createMockMinimalFiles } from \"../util/test/createMockMinimalFiles.js\";\nimport { TodoWireOntology } from \"../util/test/TodoWireOntology.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: TodoWireOntology,\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export { getCount } from './queries/getCount.js';\n export { returnsTodo } from './queries/returnsTodo.js';\n \",\n \"/foo/ontology/queries/getCount.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace getCount {\n export interface Signature {\n (query: getCount.Parameters): Promise<QueryResult.PrimitiveType<'integer'>>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly completed: QueryParam.PrimitiveType<'boolean'>;\n }\n }\n\n export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'getCount';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n completed: {\n nullable: false;\n type: 'boolean';\n };\n };\n output: {\n nullable: false;\n type: 'integer';\n };\n signature: getCount.Signature;\n };\n apiName: 'getCount';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n import type { Todo } from '../objects/Todo.js';\n\n export namespace returnsTodo {\n export interface Signature {\n (query: returnsTodo.Parameters): Promise<QueryResult.ObjectType<Todo>>;\n }\n\n export interface Parameters {\n /**\n * description: Random desc so we test jsdoc\n */\n readonly someTodo: QueryParam.ObjectType<Todo>;\n }\n }\n\n export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'returnsTodo';\n rid: 'rid.query.2';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * description: Random desc so we test jsdoc\n */\n someTodo: {\n description: 'Random desc so we test jsdoc';\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n };\n output: {\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n signature: returnsTodo.Signature;\n };\n apiName: 'returnsTodo';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n await helper.minimalFiles.writeFile(\"/bar/test.ts\", `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `);\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n const files = {};\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n const servicesHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n return ts.ScriptSnapshot.fromString(helper.getFiles()[fileName]);\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path) => {\n console.log(\"readFile: \", path);\n return helper.getFiles()[path];\n },\n readDirectory: (path, extensions, exclude, include, depth) => {\n console.log(\"readDirectory\", path);\n return ts.sys.readDirectory(path, extensions, exclude, include, depth);\n },\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n const langServices = ts.createLanguageService(servicesHost);\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,EAAE,MAAM,YAAY;AAChC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5EN,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EACxCE,EAAE,CAAC,cAAc,EAAE,YAAY;IAC3B,MAAMK,MAAM,GAAGH,sBAAsB,CAAC,CAAC;IAEvC,MAAME,2BAA2B,CAAC;MAC9BE,EAAE,EAAED,MAAM,CAACE,YAAY;MACvBC,QAAQ,EAAEP,eAAe,CAAC;QACtBQ,SAAS,EAAEN,gBAAgB;QAC3BO,SAAS,EAAE,KAAK;QAChBC,eAAe,EAAE,IAAIC,GAAG,CAAC,CAAC;QAC1BC,kBAAkB,EAAE,IAAID,GAAG,CAAC,CAAC;QAC7BE,YAAY,EAAE,IAAIF,GAAG,CAAC;MAC1B,CAAC,CAAC;MACFG,MAAM,EAVQ,MAUG;MACjBL,SAAS,EAAE;IACf,CAAC,EAAE,IAAI,CAAC;IACRX,MAAM,CAACM,MAAM,CAACW,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,CAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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file":"generatePerQueryDataFiles.test.js","names":["ts","describe","expect","it","enhanceOntology","createMockMinimalFiles","TodoWireOntology","generatePerQueryDataFilesV2","helper","fs","minimalFiles","ontology","sanitized","importExt","externalObjects","Map","externalInterfaces","externalSpts","outDir","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry","actionTypes","interfaceTypes","objectTypes","apiName","description","displayName","rid","queryTypes","doThing","parameters","foo","dataType","type","paramStruct","fields","name","fieldType","output","sharedPropertyTypes"],"sources":["generatePerQueryDataFiles.test.js"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport * as ts from \"typescript\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { createMockMinimalFiles } from \"../util/test/createMockMinimalFiles.js\";\nimport { TodoWireOntology } from \"../util/test/TodoWireOntology.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: TodoWireOntology,\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export { getCount } from './queries/getCount.js';\n export { returnsTodo } from './queries/returnsTodo.js';\n \",\n \"/foo/ontology/queries/getCount.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace getCount {\n export interface Signature {\n (query: getCount.Parameters): Promise<getCount.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly completed: QueryParam.PrimitiveType<'boolean'>;\n }\n\n export type ReturnType = QueryResult.PrimitiveType<'integer'>;\n }\n\n export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'getCount';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n completed: {\n nullable: false;\n type: 'boolean';\n };\n };\n output: {\n nullable: false;\n type: 'integer';\n };\n signature: getCount.Signature;\n };\n apiName: 'getCount';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n import type { Todo } from '../objects/Todo.js';\n\n export namespace returnsTodo {\n export interface Signature {\n (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * description: Random desc so we test jsdoc\n */\n readonly someTodo: QueryParam.ObjectType<Todo>;\n }\n\n export type ReturnType = QueryResult.ObjectType<Todo>;\n }\n\n export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'returnsTodo';\n rid: 'rid.query.2';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * description: Random desc so we test jsdoc\n */\n someTodo: {\n description: 'Random desc so we test jsdoc';\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n };\n output: {\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n signature: returnsTodo.Signature;\n };\n apiName: 'returnsTodo';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n await helper.minimalFiles.writeFile(\"/bar/test.ts\", `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `);\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n const files = {};\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n const servicesHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n return ts.ScriptSnapshot.fromString(helper.getFiles()[fileName]);\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path) => {\n console.log(\"readFile: \", path);\n return helper.getFiles()[path];\n },\n readDirectory: (path, extensions, exclude, include, depth) => {\n console.log(\"readDirectory\", path);\n return ts.sys.readDirectory(path, extensions, exclude, include, depth);\n },\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n const langServices = ts.createLanguageService(servicesHost);\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology: {\n apiName: \"foo\",\n description: \"foo\",\n displayName: \"foo\",\n rid: \"ri.foo\",\n },\n queryTypes: {\n doThing: {\n rid: \"rid.query.1\",\n version: \"0\",\n apiName: \"doThing\",\n parameters: {\n foo: {\n dataType: { type: \"string\" },\n },\n paramStruct: {\n dataType: {\n type: \"struct\",\n fields: [\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n output: {\n type: \"struct\",\n fields: [\n {\n name: \"aString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"anInteger\",\n fieldType: { type: \"integer\" },\n },\n {\n name: \"aLong\",\n fieldType: { type: \"long\" },\n },\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n sharedPropertyTypes: {},\n },\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace doThing {\n export interface Signature {\n (query: doThing.Parameters): Promise<doThing.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly foo: QueryParam.PrimitiveType<'string'>;\n\n /**\n * (no ontology metadata)\n */\n readonly paramStruct: {\n readonly aDate: QueryParam.PrimitiveType<'datetime'>;\n\n readonly nestedStruct: {\n readonly nestedInteger: QueryParam.PrimitiveType<'integer'>;\n\n readonly nestedString: QueryParam.PrimitiveType<'string'>;\n };\n };\n }\n\n export interface ReturnType {\n aDate: QueryResult.PrimitiveType<'datetime'>;\n\n aLong: QueryResult.PrimitiveType<'long'>;\n\n anInteger: QueryResult.PrimitiveType<'integer'>;\n\n aString: QueryResult.PrimitiveType<'string'>;\n\n nestedStruct: {\n nestedInteger: QueryResult.PrimitiveType<'integer'>;\n\n nestedString: QueryResult.PrimitiveType<'string'>;\n };\n }\n }\n\n export interface doThing extends QueryDefinition<doThing.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'doThing';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n paramStruct: {\n nullable: false;\n struct: {\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n };\n output: {\n nullable: false;\n struct: {\n aString: {\n type: 'string';\n nullable: false;\n };\n anInteger: {\n type: 'integer';\n nullable: false;\n };\n aLong: {\n type: 'long';\n nullable: false;\n };\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n signature: doThing.Signature;\n };\n apiName: 'doThing';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const doThing: doThing = {\n apiName: 'doThing',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,EAAE,MAAM,YAAY;AAChC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,sBAAsB,QAAQ,wCAAwC;AAC/E,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,2BAA2B,QAAQ,gCAAgC;AAC5EN,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EACxCE,EAAE,CAAC,cAAc,EAAE,YAAY;IAC3B,MAAMK,MAAM,GAAGH,sBAAsB,CAAC,CAAC;IAEvC,MAAME,2BAA2B,CAAC;MAC9BE,EAAE,EAAED,MAAM,CAACE,YAAY;MACvBC,QAAQ,EAAEP,eAAe,CAAC;QACtBQ,SAAS,EAAEN,gBAAgB;QAC3BO,SAAS,EAAE,KAAK;QAChBC,eAAe,EAAE,IAAIC,GAAG,CAAC,CAAC;QAC1BC,kBAAkB,EAAE,IAAID,GAAG,CAAC,CAAC;QAC7BE,YAAY,EAAE,IAAIF,GAAG,CAAC;MAC1B,CAAC,CAAC;MACFG,MAAM,EAVQ,MAUG;MACjBL,SAAS,EAAE;IACf,CAAC,EAAE,IAAI,CAAC;IACRX,MAAM,CAACM,MAAM,CAACW,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,CAAC;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;IACE,MAAMZ,MAAM,CAACE,YAAY,CAACW,SAAS,CAAC,cAAc,EAAE;AAC5D;AACA;AACA;AACA,KAAK,CAAC;IACE,MAAMC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAAChB,MAAM,CAACW,QAAQ,CAAC,CAAC,CAAC;IACpDM,OAAO,CAACC,GAAG,CAACJ,aAAa,CAAC;IAC1B,MAAMK,KAAK,GAAG,CAAC,CAAC;IAChB;IACAL,aAAa,CAACM,OAAO,CAACC,QAAQ,IAAI;MAC9BF,KAAK,CAACE,QAAQ,CAAC,GAAG;QAAEC,OAAO,EAAE;MAAE,CAAC;IACpC,CAAC,CAAC;IACF,MAAMC,YAAY,GAAG;MACjBC,kBAAkB,EAAEA,CAAA,KAAMT,MAAM,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IF,GAAG,CAAC;MAC1B,CAAC,CAAC;MACFG,MAAM,EAjGQ,MAiGG;MACjBL,SAAS,EAAE;IACf,CAAC,EAAE,IAAI,CAAC;IACRX,MAAM,CAACM,MAAM,CAACW,QAAQ,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CACxDC,qBAAqB,CAAC;AACnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACJ,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -830,7 +830,7 @@ describe("generator", () => {
830
830
 
831
831
  export namespace getCount {
832
832
  export interface Signature {
833
- (query: getCount.Parameters): Promise<QueryResult.PrimitiveType<'integer'>>;
833
+ (query: getCount.Parameters): Promise<getCount.ReturnType>;
834
834
  }
835
835
 
836
836
  export interface Parameters {
@@ -839,6 +839,8 @@ describe("generator", () => {
839
839
  */
840
840
  readonly completed: QueryParam.PrimitiveType<'boolean'>;
841
841
  }
842
+
843
+ export type ReturnType = QueryResult.PrimitiveType<'integer'>;
842
844
  }
843
845
 
844
846
  export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
@@ -883,7 +885,7 @@ describe("generator", () => {
883
885
 
884
886
  export namespace returnsTodo {
885
887
  export interface Signature {
886
- (query: returnsTodo.Parameters): Promise<QueryResult.ObjectType<Todo>>;
888
+ (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;
887
889
  }
888
890
 
889
891
  export interface Parameters {
@@ -892,6 +894,8 @@ describe("generator", () => {
892
894
  */
893
895
  readonly someTodo: QueryParam.ObjectType<Todo>;
894
896
  }
897
+
898
+ export type ReturnType = QueryResult.ObjectType<Todo>;
895
899
  }
896
900
 
897
901
  export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
@@ -1416,7 +1420,7 @@ describe("generator", () => {
1416
1420
 
1417
1421
  export namespace getCount {
1418
1422
  export interface Signature {
1419
- (query: getCount.Parameters): Promise<QueryResult.PrimitiveType<'integer'>>;
1423
+ (query: getCount.Parameters): Promise<getCount.ReturnType>;
1420
1424
  }
1421
1425
 
1422
1426
  export interface Parameters {
@@ -1425,6 +1429,8 @@ describe("generator", () => {
1425
1429
  */
1426
1430
  readonly completed: QueryParam.PrimitiveType<'boolean'>;
1427
1431
  }
1432
+
1433
+ export type ReturnType = QueryResult.PrimitiveType<'integer'>;
1428
1434
  }
1429
1435
 
1430
1436
  export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
@@ -1469,7 +1475,7 @@ describe("generator", () => {
1469
1475
 
1470
1476
  export namespace returnsTodo {
1471
1477
  export interface Signature {
1472
- (query: returnsTodo.Parameters): Promise<QueryResult.ObjectType<Todo>>;
1478
+ (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;
1473
1479
  }
1474
1480
 
1475
1481
  export interface Parameters {
@@ -1478,6 +1484,8 @@ describe("generator", () => {
1478
1484
  */
1479
1485
  readonly someTodo: QueryParam.ObjectType<Todo>;
1480
1486
  }
1487
+
1488
+ export type ReturnType = QueryResult.ObjectType<Todo>;
1481
1489
  }
1482
1490
 
1483
1491
  export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
@@ -1578,7 +1586,7 @@ describe("generator", () => {
1578
1586
 
1579
1587
  export namespace getTask {
1580
1588
  export interface Signature {
1581
- (query: getTask.Parameters): Promise<QueryResult.ObjectType<$Imported$com$example$dep$Task>>;
1589
+ (query: getTask.Parameters): Promise<getTask.ReturnType>;
1582
1590
  }
1583
1591
 
1584
1592
  export interface Parameters {
@@ -1587,6 +1595,8 @@ describe("generator", () => {
1587
1595
  */
1588
1596
  readonly a: QueryParam.ObjectType<$Imported$com$example$dep$Task>;
1589
1597
  }
1598
+
1599
+ export type ReturnType = QueryResult.ObjectType<$Imported$com$example$dep$Task>;
1590
1600
  }
1591
1601
 
1592
1602
  export interface getTask extends QueryDefinition<getTask.Signature>, VersionBound<$ExpectedClientVersion> {