@osdk/generator 2.6.0-beta.5 → 2.6.0-beta.7
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 +19 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.js +18 -20
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +58 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/cjs/index.cjs +18 -20
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +18 -20
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +58 -0
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @osdk/generator
|
|
2
2
|
|
|
3
|
+
## 2.6.0-beta.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @osdk/api@2.6.0-beta.7
|
|
8
|
+
- @osdk/generator-converters@2.6.0-beta.7
|
|
9
|
+
|
|
10
|
+
## 2.6.0-beta.6
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- b959085: Fix nested array query param type handling
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [b959085]
|
|
19
|
+
- @osdk/generator-converters@2.6.0-beta.6
|
|
20
|
+
- @osdk/api@2.6.0-beta.6
|
|
21
|
+
|
|
3
22
|
## 2.6.0-beta.5
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -157,10 +157,13 @@ export function queryParamJsDoc(param, {
|
|
|
157
157
|
return ret;
|
|
158
158
|
}
|
|
159
159
|
export function getQueryParamType(enhancedOntology, input, type, isMapKey = false) {
|
|
160
|
-
let
|
|
160
|
+
let paramType = `unknown /* ${input.type} */`;
|
|
161
161
|
switch (input.type) {
|
|
162
|
+
case "array":
|
|
163
|
+
paramType = `${type === "Param" ? "Readonly" : ""}Array<${getQueryParamType(enhancedOntology, input.array, type)}>`;
|
|
164
|
+
break;
|
|
162
165
|
case "date":
|
|
163
|
-
|
|
166
|
+
paramType = `Query${type}.PrimitiveType<${JSON.stringify("datetime")}>`;
|
|
164
167
|
break;
|
|
165
168
|
case "attachment":
|
|
166
169
|
case "boolean":
|
|
@@ -170,10 +173,10 @@ export function getQueryParamType(enhancedOntology, input, type, isMapKey = fals
|
|
|
170
173
|
case "long":
|
|
171
174
|
case "string":
|
|
172
175
|
case "timestamp":
|
|
173
|
-
|
|
176
|
+
paramType = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;
|
|
174
177
|
break;
|
|
175
178
|
case "struct":
|
|
176
|
-
|
|
179
|
+
paramType = `{
|
|
177
180
|
${stringify(input.struct, {
|
|
178
181
|
"*": (p, formatter, apiName) => {
|
|
179
182
|
return [`
|
|
@@ -183,42 +186,37 @@ export function getQueryParamType(enhancedOntology, input, type, isMapKey = fals
|
|
|
183
186
|
}`;
|
|
184
187
|
break;
|
|
185
188
|
case "twoDimensionalAggregation":
|
|
186
|
-
|
|
189
|
+
paramType = `Query${type}.TwoDimensionalAggregationType<${input.twoDimensionalAggregation.keyType === "range" ? `Query${type}.RangeKey<"${input.twoDimensionalAggregation.keySubtype}">` : `"${input.twoDimensionalAggregation.keyType}"`}, "${input.twoDimensionalAggregation.valueType}">`;
|
|
187
190
|
break;
|
|
188
191
|
case "threeDimensionalAggregation":
|
|
189
|
-
|
|
192
|
+
paramType = `Query${type}.ThreeDimensionalAggregationType<${input.threeDimensionalAggregation.keyType === "range" ? `Query${type}.RangeKey<"${input.threeDimensionalAggregation.keySubtype}">` : `"${input.threeDimensionalAggregation.keyType}"`},${input.threeDimensionalAggregation.valueType.keyType === "range" ? `Query${type}.RangeKey<"${input.threeDimensionalAggregation.valueType.keySubtype}">` : `"${input.threeDimensionalAggregation.valueType.keyType}"`},
|
|
190
193
|
"${input.threeDimensionalAggregation.valueType.valueType}">`;
|
|
191
194
|
break;
|
|
192
195
|
case "object":
|
|
193
196
|
if (isMapKey) {
|
|
194
|
-
|
|
197
|
+
paramType = `ObjectSpecifier<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
195
198
|
break;
|
|
196
199
|
}
|
|
197
|
-
|
|
200
|
+
paramType = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
198
201
|
break;
|
|
199
202
|
case "interface":
|
|
200
|
-
|
|
203
|
+
paramType = `Query${type}.InterfaceType<${enhancedOntology.requireInterfaceType(input.interface).getImportedDefinitionIdentifier(true)}>`;
|
|
201
204
|
break;
|
|
202
205
|
case "objectSet":
|
|
203
|
-
|
|
206
|
+
paramType = `Query${type}.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
204
207
|
break;
|
|
205
208
|
case "interfaceObjectSet":
|
|
206
|
-
|
|
209
|
+
paramType = `Query${type}.ObjectSetType<${enhancedOntology.requireInterfaceType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
207
210
|
break;
|
|
208
211
|
case "set":
|
|
209
|
-
|
|
212
|
+
paramType = `${type === "Param" ? "Readonly" : ""}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;
|
|
210
213
|
break;
|
|
211
214
|
case "union":
|
|
212
|
-
|
|
215
|
+
paramType = input.union.map(u => getQueryParamType(enhancedOntology, u, type)).join(" | ");
|
|
213
216
|
break;
|
|
214
217
|
case "map":
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
if (input.multiplicity && type === "Param") {
|
|
218
|
-
return `ReadonlyArray<${inner}>`;
|
|
219
|
-
} else if (input.multiplicity) {
|
|
220
|
-
return `Array<${inner}>`;
|
|
218
|
+
paramType = `Partial<Record<${getQueryParamType(enhancedOntology, input.keyType, type, true)}, ${getQueryParamType(enhancedOntology, input.valueType, type)}>>`;
|
|
221
219
|
}
|
|
222
|
-
return
|
|
220
|
+
return paramType;
|
|
223
221
|
}
|
|
224
222
|
//# sourceMappingURL=generatePerQueryDataFiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePerQueryDataFiles.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryParameterV2ToQueryParameterDefinition","paramToDef","wireQueryTypeV2ToSdkQueryDefinitionNoParams","path","getInterfaceTypeApiNamesFromQuery","getObjectImports","getObjectTypeApiNamesFromQuery","deleteUndefineds","stringify","formatTs","getDescriptionIfPresent","generatePerQueryDataFilesV2","fs","outDir","rootOutDir","ontology","fixedVersionQueryTypes","importExt","forInternalUse","relOutDir","join","mkdir","recursive","Promise","all","Object","values","queryTypes","map","query","generateV2QueryFile","writeFile","shortApiName","getImportPathRelTo","keys","length","relFilePath","objectTypes","interfaceTypes","interfaceAndObjectTypes","Set","o","requireObjectType","requireInterfaceType","importObjects","baseProps","raw","outputBase","output","isUsingFixedVersion","includes","fullApiName","description","parameters","paramsIdentifier","*","parameter","formatter","apiName","q","queryParamJsDoc","nullable","getQueryParamType","type","dataType","parameterDefsForType","getLineFor__OsdkTargetType","undefined","displayName","rid","definitionIdentifier","valueFormatter","qdt","objectTypeApiName","getImportedDefinitionIdentifier","param","ret","enhancedOntology","input","isMapKey","inner","JSON","struct","p","twoDimensionalAggregation","keyType","keySubtype","valueType","threeDimensionalAggregation","object","interface","objectSet","set","union","u","multiplicity"],"sources":["generatePerQueryDataFiles.ts"],"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 */\n\nimport type { QueryParameterDefinition } from \"@osdk/api\";\nimport type { QueryDataType } from \"@osdk/foundry.ontologies\";\nimport {\n wireQueryDataTypeToQueryDataTypeDefinition,\n wireQueryParameterV2ToQueryParameterDefinition as paramToDef,\n wireQueryTypeV2ToSdkQueryDefinitionNoParams,\n} from \"@osdk/generator-converters\";\nimport path from \"node:path\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport type { EnhancedQuery } from \"../GenerateContext/EnhancedQuery.js\";\nimport type { GenerateContext } from \"../GenerateContext/GenerateContext.js\";\nimport type { MinimalFs } from \"../MinimalFs.js\";\nimport { getInterfaceTypeApiNamesFromQuery } from \"../shared/getInterfaceTypeApiNamesFromQuery.js\";\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\";\n\nexport async function generatePerQueryDataFilesV2(\n {\n fs,\n outDir: rootOutDir,\n ontology,\n fixedVersionQueryTypes,\n importExt = \"\",\n forInternalUse = false,\n }: Pick<\n GenerateContext,\n | \"fs\"\n | \"outDir\"\n | \"importExt\"\n | \"ontology\"\n | \"forInternalUse\"\n | \"fixedVersionQueryTypes\"\n >,\n v2: boolean,\n): Promise<void> {\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(\n Object.values(ontology.queryTypes).map(async query => {\n await generateV2QueryFile(\n fs,\n outDir,\n relOutDir,\n query,\n importExt,\n ontology,\n forInternalUse,\n fixedVersionQueryTypes,\n );\n }),\n );\n\n const indexFilePath = `${outDir}.ts`;\n await fs.writeFile(\n indexFilePath,\n await formatTs(`\n ${\n Object.values(ontology.queryTypes).map(query =>\n `export {${query.shortApiName}} from \"${\n query.getImportPathRelTo(relOutDir)\n }\";`\n )\n .join(\"\\n\")\n }\n ${Object.keys(ontology.queryTypes).length === 0 ? \"export {};\" : \"\"}\n `),\n );\n}\n\nasync function generateV2QueryFile(\n fs: MinimalFs,\n outDir: string,\n relOutDir: string,\n query: EnhancedQuery,\n importExt: string,\n ontology: EnhancedOntologyDefinition,\n forInternalUse: boolean,\n fixedVersionQueryTypes: string[],\n) {\n const relFilePath = path.join(relOutDir, `${query.shortApiName}.ts`);\n const objectTypes = getObjectTypeApiNamesFromQuery(query);\n const interfaceTypes = getInterfaceTypeApiNamesFromQuery(query);\n const interfaceAndObjectTypes = new Set(\n [\n ...objectTypes.map(o => ontology.requireObjectType(o)),\n ...interfaceTypes.map(o => ontology.requireInterfaceType(o)),\n ],\n );\n\n const importObjects = getObjectImports(\n interfaceAndObjectTypes,\n \"\",\n relFilePath,\n true,\n );\n\n const baseProps = deleteUndefineds(\n wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw),\n );\n\n const outputBase = deleteUndefineds(\n wireQueryDataTypeToQueryDataTypeDefinition(query.output),\n );\n\n const isUsingFixedVersion = fixedVersionQueryTypes.includes(\n query.fullApiName,\n );\n\n await fs.writeFile(\n path.join(outDir, `${query.shortApiName}.ts`),\n await formatTs(`\n import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound} from \"${\n forInternalUse ? \"@osdk/api\" : \"@osdk/client\"\n }\";\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 (${\n Object.keys(query.parameters).length > 0\n ? `query: ${query.paramsIdentifier}`\n : \"\"\n }): Promise<${query.shortApiName}.ReturnType>\n }\n\n ${\n Object.keys(query.parameters).length > 0\n ? `\n export interface Parameters {\n ${\n stringify(query.parameters, {\n \"*\": (parameter, formatter, apiName) => {\n const q = paramToDef(parameter);\n return [\n `\n ${\n queryParamJsDoc(paramToDef(parameter), { apiName })\n }readonly \"${apiName}\"${q.nullable ? \"?\" : \"\"}`,\n getQueryParamType(ontology, q, \"Param\"),\n ];\n },\n })\n }\n }`\n : \"\"\n }\n\n ${\n query.output.type === \"struct\"\n ? `\n export interface ReturnType \n ${\n getQueryParamType(\n ontology,\n paramToDef({ dataType: query.output }),\n \"Result\",\n )\n }\n `\n : `\n export type ReturnType = ${\n getQueryParamType(\n ontology,\n paramToDef({ dataType: query.output }),\n \"Result\",\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 isFixedVersion: ${isUsingFixedVersion};\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 ${\n stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })\n }, \n osdkMetadata: typeof $osdkMetadata;\n }\n\n\n export const ${query.shortApiName}: ${query.definitionIdentifier} = {\n ${\n stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })\n },\n isFixedVersion: ${isUsingFixedVersion},\n osdkMetadata: $osdkMetadata\n };\n `),\n );\n}\n\nfunction parameterDefsForType(\n ontology: EnhancedOntologyDefinition,\n query: EnhancedQuery,\n) {\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}\n\nfunction getLineFor__OsdkTargetType(\n ontology: EnhancedOntologyDefinition,\n qdt: QueryDataType,\n) {\n if (qdt.type === \"object\" || qdt.type === \"objectSet\") {\n return `__OsdkTargetType?: ${\n ontology.requireObjectType(\n qdt.objectTypeApiName!,\n ).getImportedDefinitionIdentifier(true)\n }`;\n }\n return \"\";\n}\n\nexport function queryParamJsDoc(\n param: QueryParameterDefinition<any>,\n { apiName }: { apiName: string },\n): string {\n let ret = `/**\\n`;\n\n if (param.description) {\n if (param.description) {\n ret += ` * description: ${param.description}\\n`;\n }\n } else {\n ret += ` * (no ontology metadata)\\n`;\n }\n\n ret += ` */\\n`;\n return ret;\n}\n\nexport function getQueryParamType(\n enhancedOntology: EnhancedOntologyDefinition,\n input: QueryParameterDefinition,\n type: \"Param\" | \"Result\",\n isMapKey = false,\n): string {\n let inner = `unknown /* ${input.type} */`;\n\n switch (input.type) {\n case \"date\":\n inner = `Query${type}.PrimitiveType<${JSON.stringify(\"datetime\")}>`;\n break;\n\n case \"attachment\":\n case \"boolean\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"timestamp\":\n inner = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;\n break;\n case \"struct\":\n inner = `{\n ${\n stringify(input.struct, {\n \"*\": (p, formatter, apiName) => {\n return [\n `\n ${type === \"Param\" ? \"readonly \" : \"\"}\"${apiName}\"${\n p.nullable ? \"?\" : \"\"\n }`,\n getQueryParamType(enhancedOntology, p, type),\n ];\n },\n })\n }\n }`;\n break;\n case \"twoDimensionalAggregation\":\n inner = `Query${type}.TwoDimensionalAggregationType<${\n input.twoDimensionalAggregation.keyType === \"range\"\n ? `Query${type}.RangeKey<\"${input.twoDimensionalAggregation.keySubtype}\">`\n : `\"${input.twoDimensionalAggregation.keyType}\"`\n }, \"${input.twoDimensionalAggregation.valueType}\">`;\n break;\n\n case \"threeDimensionalAggregation\":\n inner = `Query${type}.ThreeDimensionalAggregationType<${\n input.threeDimensionalAggregation.keyType === \"range\"\n ? `Query${type}.RangeKey<\"${input.threeDimensionalAggregation.keySubtype}\">`\n : `\"${input.threeDimensionalAggregation.keyType}\"`\n },${\n input.threeDimensionalAggregation.valueType.keyType === \"range\"\n ? `Query${type}.RangeKey<\"${input.threeDimensionalAggregation.valueType.keySubtype}\">`\n : `\"${input.threeDimensionalAggregation.valueType.keyType}\"`\n }, \n \"${input.threeDimensionalAggregation.valueType.valueType}\">`;\n break;\n case \"object\":\n if (isMapKey) {\n inner = `ObjectSpecifier<${\n enhancedOntology.requireObjectType(input.object)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n }\n inner = `Query${type}.ObjectType<${\n enhancedOntology.requireObjectType(input.object)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n case \"interface\":\n inner = `Query${type}.InterfaceType<${\n enhancedOntology.requireInterfaceType(input.interface)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n\n case \"objectSet\":\n inner = `Query${type}.ObjectSetType<${\n enhancedOntology.requireObjectType(input.objectSet)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n\n case \"interfaceObjectSet\":\n inner = `Query${type}.ObjectSetType<${\n enhancedOntology.requireInterfaceType(input.objectSet)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n\n case \"set\":\n inner = `${type === \"Param\" ? \"Readonly\" : \"\"}Set<${\n getQueryParamType(enhancedOntology, input.set, type)\n }>`;\n break;\n\n case \"union\":\n inner = input.union.map((u) =>\n getQueryParamType(enhancedOntology, u, type)\n ).join(\" | \");\n break;\n\n case \"map\":\n inner = `Partial<Record<${\n getQueryParamType(enhancedOntology, input.keyType, type, true)\n }, ${getQueryParamType(enhancedOntology, input.valueType, type)}>>`;\n }\n\n if (input.multiplicity && type === \"Param\") {\n return `ReadonlyArray<${inner}>`;\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;;AAIA,SACEA,0CAA0C,EAC1CC,8CAA8C,IAAIC,UAAU,EAC5DC,2CAA2C,QACtC,4BAA4B;AACnC,OAAOC,IAAI,MAAM,WAAW;AAK5B,SAASC,iCAAiC,QAAQ,gDAAgD;AAClG,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;AAEtE,OAAO,eAAeC,2BAA2BA,CAC/C;EACEC,EAAE;EACFC,MAAM,EAAEC,UAAU;EAClBC,QAAQ;EACRC,sBAAsB;EACtBC,SAAS,GAAG,EAAE;EACdC,cAAc,GAAG;AASnB,CAAC,EAEc;EACf,MAAMC,SAAS,GAAGhB,IAAI,CAACiB,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE,SAAS,CAAC;EACvD,MAAMP,MAAM,GAAGV,IAAI,CAACiB,IAAI,CAACN,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC;EAC3D,MAAMF,EAAE,CAACS,KAAK,CAACR,MAAM,EAAE;IAAES,SAAS,EAAE;EAAK,CAAC,CAAC;EAC3C,MAAMC,OAAO,CAACC,GAAG,CACfC,MAAM,CAACC,MAAM,CAACX,QAAQ,CAACY,UAAU,CAAC,CAACC,GAAG,CAAC,MAAMC,KAAK,IAAI;IACpD,MAAMC,mBAAmB,CACvBlB,EAAE,EACFC,MAAM,EACNM,SAAS,EACTU,KAAK,EACLZ,SAAS,EACTF,QAAQ,EACRG,cAAc,EACdF,sBACF,CAAC;EACH,CAAC,CACH,CAAC;EAGD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KAAK,OAAO,GAAG,UAAU,GAAG,EAAE,OAC3CD,iBAAiB,CAACe,gBAAgB,EAAEC,KAAK,CAACc,GAAG,EAAE7B,IAAI,CAAC,GACnD;MACH;IAEF,KAAK,OAAO;MACViB,KAAK,GAAGF,KAAK,CAACe,KAAK,CAACjE,GAAG,CAAEkE,CAAC,IACxBhC,iBAAiB,CAACe,gBAAgB,EAAEiB,CAAC,EAAE/B,IAAI,CAC7C,CAAC,CAAC3C,IAAI,CAAC,KAAK,CAAC;MACb;IAEF,KAAK,KAAK;MACR4D,KAAK,GAAG,kBACNlB,iBAAiB,CAACe,gBAAgB,EAAEC,KAAK,CAACO,OAAO,EAAEtB,IAAI,EAAE,IAAI,CAAC,KAC3DD,iBAAiB,CAACe,gBAAgB,EAAEC,KAAK,CAACS,SAAS,EAAExB,IAAI,CAAC,IAAI;EACvE;EAEA,IAAIe,KAAK,CAACiB,YAAY,IAAIhC,IAAI,KAAK,OAAO,EAAE;IAC1C,OAAO,iBAAiBiB,KAAK,GAAG;EAClC,CAAC,MAAM,IAAIF,KAAK,CAACiB,YAAY,EAAE;IAC7B,OAAO,SAASf,KAAK,GAAG;EAC1B;EACA,OAAOA,KAAK;AACd","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generatePerQueryDataFiles.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryParameterV2ToQueryParameterDefinition","paramToDef","wireQueryTypeV2ToSdkQueryDefinitionNoParams","path","getInterfaceTypeApiNamesFromQuery","getObjectImports","getObjectTypeApiNamesFromQuery","deleteUndefineds","stringify","formatTs","getDescriptionIfPresent","generatePerQueryDataFilesV2","fs","outDir","rootOutDir","ontology","fixedVersionQueryTypes","importExt","forInternalUse","relOutDir","join","mkdir","recursive","Promise","all","Object","values","queryTypes","map","query","generateV2QueryFile","writeFile","shortApiName","getImportPathRelTo","keys","length","relFilePath","objectTypes","interfaceTypes","interfaceAndObjectTypes","Set","o","requireObjectType","requireInterfaceType","importObjects","baseProps","raw","outputBase","output","isUsingFixedVersion","includes","fullApiName","description","parameters","paramsIdentifier","*","parameter","formatter","apiName","q","queryParamJsDoc","nullable","getQueryParamType","type","dataType","parameterDefsForType","getLineFor__OsdkTargetType","undefined","displayName","rid","definitionIdentifier","valueFormatter","qdt","objectTypeApiName","getImportedDefinitionIdentifier","param","ret","enhancedOntology","input","isMapKey","paramType","array","JSON","struct","p","twoDimensionalAggregation","keyType","keySubtype","valueType","threeDimensionalAggregation","object","interface","objectSet","set","union","u"],"sources":["generatePerQueryDataFiles.ts"],"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 */\n\nimport type { QueryParameterDefinition } from \"@osdk/api\";\nimport type { QueryDataType } from \"@osdk/foundry.ontologies\";\nimport {\n wireQueryDataTypeToQueryDataTypeDefinition,\n wireQueryParameterV2ToQueryParameterDefinition as paramToDef,\n wireQueryTypeV2ToSdkQueryDefinitionNoParams,\n} from \"@osdk/generator-converters\";\nimport path from \"node:path\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport type { EnhancedQuery } from \"../GenerateContext/EnhancedQuery.js\";\nimport type { GenerateContext } from \"../GenerateContext/GenerateContext.js\";\nimport type { MinimalFs } from \"../MinimalFs.js\";\nimport { getInterfaceTypeApiNamesFromQuery } from \"../shared/getInterfaceTypeApiNamesFromQuery.js\";\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\";\n\nexport async function generatePerQueryDataFilesV2(\n {\n fs,\n outDir: rootOutDir,\n ontology,\n fixedVersionQueryTypes,\n importExt = \"\",\n forInternalUse = false,\n }: Pick<\n GenerateContext,\n | \"fs\"\n | \"outDir\"\n | \"importExt\"\n | \"ontology\"\n | \"forInternalUse\"\n | \"fixedVersionQueryTypes\"\n >,\n v2: boolean,\n): Promise<void> {\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(\n Object.values(ontology.queryTypes).map(async query => {\n await generateV2QueryFile(\n fs,\n outDir,\n relOutDir,\n query,\n importExt,\n ontology,\n forInternalUse,\n fixedVersionQueryTypes,\n );\n }),\n );\n\n const indexFilePath = `${outDir}.ts`;\n await fs.writeFile(\n indexFilePath,\n await formatTs(`\n ${\n Object.values(ontology.queryTypes).map(query =>\n `export {${query.shortApiName}} from \"${\n query.getImportPathRelTo(relOutDir)\n }\";`\n )\n .join(\"\\n\")\n }\n ${Object.keys(ontology.queryTypes).length === 0 ? \"export {};\" : \"\"}\n `),\n );\n}\n\nasync function generateV2QueryFile(\n fs: MinimalFs,\n outDir: string,\n relOutDir: string,\n query: EnhancedQuery,\n importExt: string,\n ontology: EnhancedOntologyDefinition,\n forInternalUse: boolean,\n fixedVersionQueryTypes: string[],\n) {\n const relFilePath = path.join(relOutDir, `${query.shortApiName}.ts`);\n const objectTypes = getObjectTypeApiNamesFromQuery(query);\n const interfaceTypes = getInterfaceTypeApiNamesFromQuery(query);\n const interfaceAndObjectTypes = new Set(\n [\n ...objectTypes.map(o => ontology.requireObjectType(o)),\n ...interfaceTypes.map(o => ontology.requireInterfaceType(o)),\n ],\n );\n\n const importObjects = getObjectImports(\n interfaceAndObjectTypes,\n \"\",\n relFilePath,\n true,\n );\n\n const baseProps = deleteUndefineds(\n wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw),\n );\n\n const outputBase = deleteUndefineds(\n wireQueryDataTypeToQueryDataTypeDefinition(query.output),\n );\n\n const isUsingFixedVersion = fixedVersionQueryTypes.includes(\n query.fullApiName,\n );\n\n await fs.writeFile(\n path.join(outDir, `${query.shortApiName}.ts`),\n await formatTs(`\n import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound} from \"${\n forInternalUse ? \"@osdk/api\" : \"@osdk/client\"\n }\";\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 (${\n Object.keys(query.parameters).length > 0\n ? `query: ${query.paramsIdentifier}`\n : \"\"\n }): Promise<${query.shortApiName}.ReturnType>\n }\n\n ${\n Object.keys(query.parameters).length > 0\n ? `\n export interface Parameters {\n ${\n stringify(query.parameters, {\n \"*\": (parameter, formatter, apiName) => {\n const q = paramToDef(parameter);\n return [\n `\n ${\n queryParamJsDoc(paramToDef(parameter), { apiName })\n }readonly \"${apiName}\"${q.nullable ? \"?\" : \"\"}`,\n getQueryParamType(ontology, q, \"Param\"),\n ];\n },\n })\n }\n }`\n : \"\"\n }\n\n ${\n query.output.type === \"struct\"\n ? `\n export interface ReturnType \n ${\n getQueryParamType(\n ontology,\n paramToDef({ dataType: query.output }),\n \"Result\",\n )\n }\n `\n : `\n export type ReturnType = ${\n getQueryParamType(\n ontology,\n paramToDef({ dataType: query.output }),\n \"Result\",\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 isFixedVersion: ${isUsingFixedVersion};\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 ${\n stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })\n }, \n osdkMetadata: typeof $osdkMetadata;\n }\n\n\n export const ${query.shortApiName}: ${query.definitionIdentifier} = {\n ${\n stringify(baseProps, {\n \"description\": () => undefined,\n \"displayName\": () => undefined,\n \"rid\": () => undefined,\n })\n },\n isFixedVersion: ${isUsingFixedVersion},\n osdkMetadata: $osdkMetadata\n };\n `),\n );\n}\n\nfunction parameterDefsForType(\n ontology: EnhancedOntologyDefinition,\n query: EnhancedQuery,\n) {\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}\n\nfunction getLineFor__OsdkTargetType(\n ontology: EnhancedOntologyDefinition,\n qdt: QueryDataType,\n) {\n if (qdt.type === \"object\" || qdt.type === \"objectSet\") {\n return `__OsdkTargetType?: ${\n ontology.requireObjectType(\n qdt.objectTypeApiName!,\n ).getImportedDefinitionIdentifier(true)\n }`;\n }\n return \"\";\n}\n\nexport function queryParamJsDoc(\n param: QueryParameterDefinition<any>,\n { apiName }: { apiName: string },\n): string {\n let ret = `/**\\n`;\n\n if (param.description) {\n if (param.description) {\n ret += ` * description: ${param.description}\\n`;\n }\n } else {\n ret += ` * (no ontology metadata)\\n`;\n }\n\n ret += ` */\\n`;\n return ret;\n}\n\nexport function getQueryParamType(\n enhancedOntology: EnhancedOntologyDefinition,\n input: QueryParameterDefinition,\n type: \"Param\" | \"Result\",\n isMapKey = false,\n): string {\n let paramType = `unknown /* ${input.type} */`;\n\n switch (input.type) {\n case \"array\":\n paramType = `${type === \"Param\" ? \"Readonly\" : \"\"}Array<${\n getQueryParamType(enhancedOntology, input.array, type)\n }>`;\n break;\n case \"date\":\n paramType = `Query${type}.PrimitiveType<${JSON.stringify(\"datetime\")}>`;\n break;\n\n case \"attachment\":\n case \"boolean\":\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"string\":\n case \"timestamp\":\n paramType = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;\n break;\n case \"struct\":\n paramType = `{\n ${\n stringify(input.struct, {\n \"*\": (p, formatter, apiName) => {\n return [\n `\n ${type === \"Param\" ? \"readonly \" : \"\"}\"${apiName}\"${\n p.nullable ? \"?\" : \"\"\n }`,\n getQueryParamType(enhancedOntology, p, type),\n ];\n },\n })\n }\n }`;\n break;\n case \"twoDimensionalAggregation\":\n paramType = `Query${type}.TwoDimensionalAggregationType<${\n input.twoDimensionalAggregation.keyType === \"range\"\n ? `Query${type}.RangeKey<\"${input.twoDimensionalAggregation.keySubtype}\">`\n : `\"${input.twoDimensionalAggregation.keyType}\"`\n }, \"${input.twoDimensionalAggregation.valueType}\">`;\n break;\n\n case \"threeDimensionalAggregation\":\n paramType = `Query${type}.ThreeDimensionalAggregationType<${\n input.threeDimensionalAggregation.keyType === \"range\"\n ? `Query${type}.RangeKey<\"${input.threeDimensionalAggregation.keySubtype}\">`\n : `\"${input.threeDimensionalAggregation.keyType}\"`\n },${\n input.threeDimensionalAggregation.valueType.keyType === \"range\"\n ? `Query${type}.RangeKey<\"${input.threeDimensionalAggregation.valueType.keySubtype}\">`\n : `\"${input.threeDimensionalAggregation.valueType.keyType}\"`\n }, \n \"${input.threeDimensionalAggregation.valueType.valueType}\">`;\n break;\n case \"object\":\n if (isMapKey) {\n paramType = `ObjectSpecifier<${\n enhancedOntology.requireObjectType(input.object)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n }\n paramType = `Query${type}.ObjectType<${\n enhancedOntology.requireObjectType(input.object)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n case \"interface\":\n paramType = `Query${type}.InterfaceType<${\n enhancedOntology.requireInterfaceType(input.interface)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n\n case \"objectSet\":\n paramType = `Query${type}.ObjectSetType<${\n enhancedOntology.requireObjectType(input.objectSet)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n\n case \"interfaceObjectSet\":\n paramType = `Query${type}.ObjectSetType<${\n enhancedOntology.requireInterfaceType(input.objectSet)\n .getImportedDefinitionIdentifier(true)\n }>`;\n break;\n\n case \"set\":\n paramType = `${type === \"Param\" ? \"Readonly\" : \"\"}Set<${\n getQueryParamType(enhancedOntology, input.set, type)\n }>`;\n break;\n\n case \"union\":\n paramType = input.union.map((u) =>\n getQueryParamType(enhancedOntology, u, type)\n ).join(\" | \");\n break;\n\n case \"map\":\n paramType = `Partial<Record<${\n getQueryParamType(enhancedOntology, input.keyType, type, true)\n }, ${getQueryParamType(enhancedOntology, input.valueType, type)}>>`;\n }\n\n return paramType;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SACEA,0CAA0C,EAC1CC,8CAA8C,IAAIC,UAAU,EAC5DC,2CAA2C,QACtC,4BAA4B;AACnC,OAAOC,IAAI,MAAM,WAAW;AAK5B,SAASC,iCAAiC,QAAQ,gDAAgD;AAClG,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;AAEtE,OAAO,eAAeC,2BAA2BA,CAC/C;EACEC,EAAE;EACFC,MAAM,EAAEC,UAAU;EAClBC,QAAQ;EACRC,sBAAsB;EACtBC,SAAS,GAAG,EAAE;EACdC,cAAc,GAAG;AASnB,CAAC,EAEc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AAI,CAAC,IAAI;EACvE;EAEA,OAAOiB,SAAS;AAClB","ignoreList":[]}
|
|
@@ -233,6 +233,25 @@ describe("generatePerQueryDataFiles", () => {
|
|
|
233
233
|
type: "string"
|
|
234
234
|
}
|
|
235
235
|
},
|
|
236
|
+
listField: {
|
|
237
|
+
dataType: {
|
|
238
|
+
type: "array",
|
|
239
|
+
"subType": {
|
|
240
|
+
"type": "float"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
nestedListField: {
|
|
245
|
+
dataType: {
|
|
246
|
+
type: "array",
|
|
247
|
+
"subType": {
|
|
248
|
+
"type": "array",
|
|
249
|
+
"subType": {
|
|
250
|
+
"type": "float"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
},
|
|
236
255
|
paramStruct: {
|
|
237
256
|
dataType: {
|
|
238
257
|
type: "struct",
|
|
@@ -332,6 +351,16 @@ describe("generatePerQueryDataFiles", () => {
|
|
|
332
351
|
*/
|
|
333
352
|
readonly foo: QueryParam.PrimitiveType<'string'>;
|
|
334
353
|
|
|
354
|
+
/**
|
|
355
|
+
* (no ontology metadata)
|
|
356
|
+
*/
|
|
357
|
+
readonly listField: ReadonlyArray<QueryParam.PrimitiveType<'float'>>;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* (no ontology metadata)
|
|
361
|
+
*/
|
|
362
|
+
readonly nestedListField: ReadonlyArray<ReadonlyArray<QueryParam.PrimitiveType<'float'>>>;
|
|
363
|
+
|
|
335
364
|
/**
|
|
336
365
|
* (no ontology metadata)
|
|
337
366
|
*/
|
|
@@ -378,6 +407,35 @@ describe("generatePerQueryDataFiles", () => {
|
|
|
378
407
|
nullable: false;
|
|
379
408
|
type: 'string';
|
|
380
409
|
};
|
|
410
|
+
/**
|
|
411
|
+
* (no ontology metadata)
|
|
412
|
+
*/
|
|
413
|
+
listField: {
|
|
414
|
+
array: {
|
|
415
|
+
type: 'float';
|
|
416
|
+
nullable: false;
|
|
417
|
+
};
|
|
418
|
+
multiplicity: true;
|
|
419
|
+
nullable: false;
|
|
420
|
+
type: 'array';
|
|
421
|
+
};
|
|
422
|
+
/**
|
|
423
|
+
* (no ontology metadata)
|
|
424
|
+
*/
|
|
425
|
+
nestedListField: {
|
|
426
|
+
array: {
|
|
427
|
+
array: {
|
|
428
|
+
type: 'float';
|
|
429
|
+
nullable: false;
|
|
430
|
+
};
|
|
431
|
+
type: 'array';
|
|
432
|
+
nullable: false;
|
|
433
|
+
multiplicity: true;
|
|
434
|
+
};
|
|
435
|
+
multiplicity: true;
|
|
436
|
+
nullable: false;
|
|
437
|
+
type: 'array';
|
|
438
|
+
};
|
|
381
439
|
/**
|
|
382
440
|
* (no ontology metadata)
|
|
383
441
|
*/
|
|
@@ -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","forInternalUse","fixedVersionQueryTypes","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","valueTypes"],"sources":["generatePerQueryDataFiles.test.ts"],"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 */\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\";\n\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n\n await generatePerQueryDataFilesV2(\n {\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 forInternalUse: true,\n fixedVersionQueryTypes: [],\n },\n true,\n );\n\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 { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } 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: '1.1.0';\n isFixedVersion: false;\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: '1.1.0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '1.1.0',\n isFixedVersion: false,\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } 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: '3.2.0';\n isFixedVersion: false;\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: '3.2.0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '3.2.0',\n isFixedVersion: false,\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n\n await helper.minimalFiles.writeFile(\n \"/bar/test.ts\",\n `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `,\n );\n\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n\n const files: ts.MapLike<{ version: number }> = {};\n\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n\n const servicesHost: ts.LanguageServiceHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName =>\n files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n\n return ts.ScriptSnapshot.fromString(\n helper.getFiles()[fileName],\n );\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path: string) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path: string) => {\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\n const langServices = ts.createLanguageService(servicesHost);\n\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n\n await generatePerQueryDataFilesV2(\n {\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 valueTypes: {},\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 forInternalUse: true,\n fixedVersionQueryTypes: [],\n },\n true,\n );\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } 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 isFixedVersion: false;\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 isFixedVersion: false,\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;;AAEA,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;AAE5EN,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EAC1CE,EAAE,CAAC,cAAc,EAAE,YAAY;IAC7B,MAAMK,MAAM,GAAGH,sBAAsB,CAAC,CAAC;IAGvC,MAAME,2BAA2B,CAC/B;MACEE,EAAE,EAAED,MAAM,CAACE,YAAY;MACvBC,QAAQ,EAAEP,eAAe,CAAC;QACxBQ,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;MACxB,CAAC,CAAC;MACFG,MAAM,EAZQ,MAYG;MACjBL,SAAS,EAAE,KAAK;MAChBM,cAAc,EAAE,IAAI;MACpBC,sBAAsB,EAAE;IAC1B,CAAC,EACD,IACF,CAAC;IAEDlB,MAAM,CAACM,MAAM,CAACa,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,CAAC;AACpD;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,KAAK,CAAC;IAEF,MAAMd,MAAM,CAACE,YAAY,CAACa,SAAS,CACjC,cAAc,EACd;AACN;AACA;AACA;AACA,KACI,CAAC;IAED,MAAMC,aAAa,GAAGC,MAAM,CAACC,IAAI,CAAClB,MAAM,CAACa,QAAQ,CAAC,CAAC,CAAC;IACpDM,OAAO,CAACC,GAAG,CAACJ,aAAa,CAAC;IAE1B,MAAMK,KAAsC,GAAG,CAAC,CAAC;;IAEjD;IACAL,aAAa,CAACM,OAAO,CAACC,QAAQ,IAAI;MAChCF,KAAK,CAACE,QAAQ,CAAC,GAAG;QAAEC,OAAO,EAAE;MAAE,CAAC;IAClC,CAAC,CAAC;IAEF,MAAMC,YAAoC,GAAG;MAC3CC,kBAAkB,EAAEA,CAAA,KAAMT,MAAM,CAACC,IAAI,CAAClB,MAAM,CAACa,QAAQ,CAAC,CAAC,CAAC;MACxDc,gBAAgB,EAAEJ,QAAQ,IACxBF,KAAK,CAACE,QAAQ,CAAC,IAAIF,KAAK,CAACE,QAAQ,CAAC,CAACC,OAAO,CAACI,QAAQ,CAAC,CAAC;MACvDC,iBAAiB,EAAEN,QAAQ,IAAI;QAC7B,IAAI,CAACvB,MAAM,CAACa,QAAQ,CAAC,CAAC,CAACU,QAAQ,CAAC,EAAE;UAChC,OAAOO,SAAS;Q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ACA;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;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
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","forInternalUse","fixedVersionQueryTypes","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","listField","nestedListField","paramStruct","fields","name","fieldType","output","sharedPropertyTypes","valueTypes"],"sources":["generatePerQueryDataFiles.test.ts"],"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 */\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\";\n\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n\n await generatePerQueryDataFilesV2(\n {\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 forInternalUse: true,\n fixedVersionQueryTypes: [],\n },\n true,\n );\n\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 { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } 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: '1.1.0';\n isFixedVersion: false;\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: '1.1.0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '1.1.0',\n isFixedVersion: false,\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } 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: '3.2.0';\n isFixedVersion: false;\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: '3.2.0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '3.2.0',\n isFixedVersion: false,\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n\n await helper.minimalFiles.writeFile(\n \"/bar/test.ts\",\n `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `,\n );\n\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n\n const files: ts.MapLike<{ version: number }> = {};\n\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n\n const servicesHost: ts.LanguageServiceHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName =>\n files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n\n return ts.ScriptSnapshot.fromString(\n helper.getFiles()[fileName],\n );\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path: string) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path: string) => {\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\n const langServices = ts.createLanguageService(servicesHost);\n\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n\n await generatePerQueryDataFilesV2(\n {\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 listField: {\n dataType: { type: \"array\", \"subType\": { \"type\": \"float\" } },\n },\n nestedListField: {\n dataType: {\n type: \"array\",\n \"subType\": {\n \"type\": \"array\",\n \"subType\": { \"type\": \"float\" },\n },\n },\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 valueTypes: {},\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 forInternalUse: true,\n fixedVersionQueryTypes: [],\n },\n true,\n );\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { ObjectSpecifier, QueryDefinition, QueryParam, QueryResult, VersionBound } 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 listField: ReadonlyArray<QueryParam.PrimitiveType<'float'>>;\n\n /**\n * (no ontology metadata)\n */\n readonly nestedListField: ReadonlyArray<ReadonlyArray<QueryParam.PrimitiveType<'float'>>>;\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 isFixedVersion: false;\n parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n listField: {\n array: {\n type: 'float';\n nullable: false;\n };\n multiplicity: true;\n nullable: false;\n type: 'array';\n };\n /**\n * (no ontology metadata)\n */\n nestedListField: {\n array: {\n array: {\n type: 'float';\n nullable: false;\n };\n type: 'array';\n nullable: false;\n multiplicity: true;\n };\n multiplicity: true;\n nullable: false;\n type: 'array';\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 isFixedVersion: false,\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;;AAEA,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;AAE5EN,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EAC1CE,EAAE,CAAC,cAAc,EAAE,YAAY;IAC7B,MAAMK,MAAM,GAAGH,sBAAsB,CAAC,CAAC;IAGvC,MAAME,2BAA2B,CAC/B;MACEE,EAAE,EAAED,MAAM,CAACE,YAAY;MACvBC,QAAQ,EAAEP,eAAe,CAAC;QACxBQ,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;MACxB,CAAC,CAAC;MACFG,MAAM,EAZQ,MAYG;MACjBL,SAAS,EAAE,KAAK;MAChBM,cAAc,EAAE,IAAI;MACpBC,sBAAsB,EAAE;IAC1B,CAAC,EACD,IACF,CAAC;IAEDlB,MAAM,CAACM,MAAM,CAACa,QAAQ,CAAC,CAAC,CAAC,CAACC,qBAAqB,CAAC;AACpD;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,KAAK,CAAC;IAEF,MAAMd,MAAM,CAACE,YAAY,CAACa,SAAS,C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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;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/build/cjs/index.cjs
CHANGED
|
@@ -1319,10 +1319,13 @@ function queryParamJsDoc(param, {
|
|
|
1319
1319
|
return ret;
|
|
1320
1320
|
}
|
|
1321
1321
|
function getQueryParamType(enhancedOntology, input, type, isMapKey = false) {
|
|
1322
|
-
let
|
|
1322
|
+
let paramType = `unknown /* ${input.type} */`;
|
|
1323
1323
|
switch (input.type) {
|
|
1324
|
+
case "array":
|
|
1325
|
+
paramType = `${type === "Param" ? "Readonly" : ""}Array<${getQueryParamType(enhancedOntology, input.array, type)}>`;
|
|
1326
|
+
break;
|
|
1324
1327
|
case "date":
|
|
1325
|
-
|
|
1328
|
+
paramType = `Query${type}.PrimitiveType<${JSON.stringify("datetime")}>`;
|
|
1326
1329
|
break;
|
|
1327
1330
|
case "attachment":
|
|
1328
1331
|
case "boolean":
|
|
@@ -1332,10 +1335,10 @@ function getQueryParamType(enhancedOntology, input, type, isMapKey = false) {
|
|
|
1332
1335
|
case "long":
|
|
1333
1336
|
case "string":
|
|
1334
1337
|
case "timestamp":
|
|
1335
|
-
|
|
1338
|
+
paramType = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;
|
|
1336
1339
|
break;
|
|
1337
1340
|
case "struct":
|
|
1338
|
-
|
|
1341
|
+
paramType = `{
|
|
1339
1342
|
${stringify(input.struct, {
|
|
1340
1343
|
"*": (p, formatter, apiName) => {
|
|
1341
1344
|
return [`
|
|
@@ -1345,43 +1348,38 @@ function getQueryParamType(enhancedOntology, input, type, isMapKey = false) {
|
|
|
1345
1348
|
}`;
|
|
1346
1349
|
break;
|
|
1347
1350
|
case "twoDimensionalAggregation":
|
|
1348
|
-
|
|
1351
|
+
paramType = `Query${type}.TwoDimensionalAggregationType<${input.twoDimensionalAggregation.keyType === "range" ? `Query${type}.RangeKey<"${input.twoDimensionalAggregation.keySubtype}">` : `"${input.twoDimensionalAggregation.keyType}"`}, "${input.twoDimensionalAggregation.valueType}">`;
|
|
1349
1352
|
break;
|
|
1350
1353
|
case "threeDimensionalAggregation":
|
|
1351
|
-
|
|
1354
|
+
paramType = `Query${type}.ThreeDimensionalAggregationType<${input.threeDimensionalAggregation.keyType === "range" ? `Query${type}.RangeKey<"${input.threeDimensionalAggregation.keySubtype}">` : `"${input.threeDimensionalAggregation.keyType}"`},${input.threeDimensionalAggregation.valueType.keyType === "range" ? `Query${type}.RangeKey<"${input.threeDimensionalAggregation.valueType.keySubtype}">` : `"${input.threeDimensionalAggregation.valueType.keyType}"`},
|
|
1352
1355
|
"${input.threeDimensionalAggregation.valueType.valueType}">`;
|
|
1353
1356
|
break;
|
|
1354
1357
|
case "object":
|
|
1355
1358
|
if (isMapKey) {
|
|
1356
|
-
|
|
1359
|
+
paramType = `ObjectSpecifier<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
1357
1360
|
break;
|
|
1358
1361
|
}
|
|
1359
|
-
|
|
1362
|
+
paramType = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
1360
1363
|
break;
|
|
1361
1364
|
case "interface":
|
|
1362
|
-
|
|
1365
|
+
paramType = `Query${type}.InterfaceType<${enhancedOntology.requireInterfaceType(input.interface).getImportedDefinitionIdentifier(true)}>`;
|
|
1363
1366
|
break;
|
|
1364
1367
|
case "objectSet":
|
|
1365
|
-
|
|
1368
|
+
paramType = `Query${type}.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
1366
1369
|
break;
|
|
1367
1370
|
case "interfaceObjectSet":
|
|
1368
|
-
|
|
1371
|
+
paramType = `Query${type}.ObjectSetType<${enhancedOntology.requireInterfaceType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
1369
1372
|
break;
|
|
1370
1373
|
case "set":
|
|
1371
|
-
|
|
1374
|
+
paramType = `${type === "Param" ? "Readonly" : ""}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;
|
|
1372
1375
|
break;
|
|
1373
1376
|
case "union":
|
|
1374
|
-
|
|
1377
|
+
paramType = input.union.map((u) => getQueryParamType(enhancedOntology, u, type)).join(" | ");
|
|
1375
1378
|
break;
|
|
1376
1379
|
case "map":
|
|
1377
|
-
|
|
1378
|
-
}
|
|
1379
|
-
if (input.multiplicity && type === "Param") {
|
|
1380
|
-
return `ReadonlyArray<${inner}>`;
|
|
1381
|
-
} else if (input.multiplicity) {
|
|
1382
|
-
return `Array<${inner}>`;
|
|
1380
|
+
paramType = `Partial<Record<${getQueryParamType(enhancedOntology, input.keyType, type, true)}, ${getQueryParamType(enhancedOntology, input.valueType, type)}>>`;
|
|
1383
1381
|
}
|
|
1384
|
-
return
|
|
1382
|
+
return paramType;
|
|
1385
1383
|
}
|
|
1386
1384
|
async function generateRootIndexTsFile({
|
|
1387
1385
|
fs: fs2,
|