@osdk/generator 2.0.0-beta.15 → 2.0.0-beta.16
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 +15 -0
- package/build/browser/shared/propertyJsdoc.d.ts +2 -2
- package/build/browser/shared/propertyJsdoc.d.ts.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +15 -25
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +1 -3
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +2 -6
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +2 -2
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/esm/shared/propertyJsdoc.d.ts +2 -2
- package/build/esm/shared/propertyJsdoc.d.ts.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +15 -25
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +1 -3
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +2 -6
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +2 -2
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/package.json +4 -4
|
@@ -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","getImportPathRelTo","keys","length","relFilePath","shortApiName","objectTypes","objectTypeObjects","Set","o","requireObjectType","importObjects","baseProps","raw","outputBase","output","referencedObjectTypes","apiNameObj","description","parameters","paramsIdentifier","getQueryParamType","dataType","*","parameter","formatter","apiName","q","queryParamJsDoc","nullable","fullApiName","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 * 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.fullApiName}\", \n ${referencedObjectTypes},\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,EAA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,IAAI,CAAC,GAAG;MACnE;IACJ,KAAK,QAAQ;MACTO,KAAK,GAAG,QAAQP,IAAI,eAAeK,gBAAgB,CAACnC,iBAAiB,CAACoC,KAAK,CAACG,MAAM,CAAC,CAC9EP,+BAA+B,CAAC,IAAI,CAAC,GAAG;MAC7C;IACJ,KAAK,WAAW;MACZK,KAAK,GAAG,QAAQP,IAAI,kBAAkBK,gBAAgB,CAACnC,iBAAiB,CAACoC,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,OAAOnB,iBAAiB,CAACwB,gBAAgB,EAAEC,KAAK,CAACK,GAAG,EAAEX,IAAI,CAAC,GAAG;MAC3G;IACJ,KAAK,OAAO;MACRO,KAAK,GAAGD,KAAK,CAACM,KAAK,CAACvD,GAAG,CAAEwD,CAAC,IAAKhC,iBAAiB,CAACwB,gBAAgB,EAAEQ,CAAC,EAAEb,IAAI,CAAC,CAAC,CAACnD,IAAI,CAAC,KAAK,CAAC;MACxF;EACR;EACA,IAAIyD,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","getImportPathRelTo","keys","length","relFilePath","shortApiName","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 * 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,E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B,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":[]}
|
|
@@ -51,9 +51,7 @@ describe("generatePerQueryDataFiles", () => {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
export interface getCount
|
|
55
|
-
extends QueryDefinition<'getCount', never, getCount.Signature>,
|
|
56
|
-
VersionBound<$ExpectedClientVersion> {
|
|
54
|
+
export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
57
55
|
__DefinitionMetadata?: {
|
|
58
56
|
apiName: 'getCount';
|
|
59
57
|
rid: 'rid.query.1';
|
|
@@ -106,9 +104,7 @@ describe("generatePerQueryDataFiles", () => {
|
|
|
106
104
|
}
|
|
107
105
|
}
|
|
108
106
|
|
|
109
|
-
export interface returnsTodo
|
|
110
|
-
extends QueryDefinition<'returnsTodo', 'Todo', returnsTodo.Signature>,
|
|
111
|
-
VersionBound<$ExpectedClientVersion> {
|
|
107
|
+
export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
112
108
|
__DefinitionMetadata?: {
|
|
113
109
|
apiName: 'returnsTodo';
|
|
114
110
|
rid: 'rid.query.2';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generatePerQueryDataFiles.test.js","names":["ts","describe","expect","it","enhanceOntology","createMockMinimalFiles","TodoWireOntology","generatePerQueryDataFilesV2","helper","fs","minimalFiles","ontology","undefined","Map","outDir","importExt","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","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(TodoWireOntology, undefined, new Map(), \".js\"),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export * from './queries/getCount.js';\n export * 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\n extends QueryDefinition<'getCount', never, getCount.Signature>,\n 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\n extends QueryDefinition<'returnsTodo', 'Todo', returnsTodo.Signature>,\n 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,CAACE,gBAAgB,EAAEM,SAAS,EAAE,IAAIC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;MACxEC,MAAM,EAJQ,MAIG;MACjBC,SAAS,EAAE;IACf,CAAC,EAAE,IAAI,CAAC;IACRb,MAAM,CAACM,MAAM,CAACQ,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;AAC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B,EAAEC,OAAO,IAAItC,EAAE,CAACuC,qBAAqB,CAACD,OAAO,CAAC;MACnEE,UAAU,EAAGC,IAAI,IAAK;QAClBnB,OAAO,CAACC,GAAG,CAACkB,IAAI,CAAC;QACjB,OAAOjC,MAAM,CAACQ,QAAQ,CAAC,CAAC,CAACyB,IAAI,CAAC,KAAK7B,SAAS;MAChD,CAAC;MACD8B,QAAQ,EAAGD,IAAI,IAAK;QAChBnB,OAAO,CAACC,GAAG,CAAC,YAAY,EAAEkB,IAAI,CAAC;QAC/B,OAAOjC,MAAM,CAACQ,QAAQ,CAAC,CAAC,CAACyB,IAAI,CAAC;MAClC,CAAC;MACDE,aAAa,EAAEA,CAACF,IAAI,EAAEG,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,KAAK;QAC1DzB,OAAO,CAACC,GAAG,CAAC,eAAe,EAAEkB,IAAI,CAAC;QAClC,OAAOzC,EAAE,CAACgD,GAAG,CAACL,aAAa,CAACF,IAAI,EAAEG,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,CAAC;MAC1E,CAAC;MACDE,eAAe,EAAEjD,EAAE,CAACgD,GAAG,CAACC,eAAe;MACvCC,cAAc,EAAElD,EAAE,CAACgD,GAAG,CAACE;IAC3B,CAAC;IACD,MAAMC,YAAY,GAAGnD,EAAE,CAACoD,qBAAqB,CAACxB,YAAY,CAAC;IAC3D,MAAMyB,CAAC,GAAGF,YAAY,CAACG,+BAA+B,CAAC,cAAc,EAAE,CAAC,CAAC;IACzEhC,OAAO,CAACC,GAAG,CAAC8B,CAAC,CAAC;IACdrD,EAAE,CAACuD,sBAAsB,CAAC,CAAC;EAC/B,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"generatePerQueryDataFiles.test.js","names":["ts","describe","expect","it","enhanceOntology","createMockMinimalFiles","TodoWireOntology","generatePerQueryDataFilesV2","helper","fs","minimalFiles","ontology","undefined","Map","outDir","importExt","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","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(TodoWireOntology, undefined, new Map(), \".js\"),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export * from './queries/getCount.js';\n export * 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,CAACE,gBAAgB,EAAEM,SAAS,EAAE,IAAIC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;MACxEC,MAAM,EAJQ,MAIG;MACjBC,SAAS,EAAE;IACf,CAAC,EAAE,IAAI,CAAC;IACRb,MAAM,CAACM,MAAM,CAACQ,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,KAAK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IAAI,CAAC,KAAK7B,SAAS;MAChD,CAAC;MACD8B,QAAQ,EAAGD,IAAI,IAAK;QAChBnB,OAAO,CAACC,GAAG,CAAC,YAAY,EAAEkB,IAAI,CAAC;QAC/B,OAAOjC,MAAM,CAACQ,QAAQ,CAAC,CAAC,CAACyB,IAAI,CAAC;MAClC,CAAC;MACDE,aAAa,EAAEA,CAACF,IAAI,EAAEG,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,KAAK;QAC1DzB,OAAO,CAACC,GAAG,CAAC,eAAe,EAAEkB,IAAI,CAAC;QAClC,OAAOzC,EAAE,CAACgD,GAAG,CAACL,aAAa,CAACF,IAAI,EAAEG,UAAU,EAAEC,OAAO,EAAEC,OAAO,EAAEC,KAAK,CAAC;MAC1E,CAAC;MACDE,eAAe,EAAEjD,EAAE,CAACgD,GAAG,CAACC,eAAe;MACvCC,cAAc,EAAElD,EAAE,CAACgD,GAAG,CAACE;IAC3B,CAAC;IACD,MAAMC,YAAY,GAAGnD,EAAE,CAACoD,qBAAqB,CAACxB,YAAY,CAAC;IAC3D,MAAMyB,CAAC,GAAGF,YAAY,CAACG,+BAA+B,CAAC,cAAc,EAAE,CAAC,CAAC;IACzEhC,OAAO,CAACC,GAAG,CAAC8B,CAAC,CAAC;IACdrD,EAAE,CAACuD,sBAAsB,CAAC,CAAC;EAC/B,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -51,7 +51,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
51
51
|
return `import type {
|
|
52
52
|
PropertyKeys as $PropertyKeys,
|
|
53
53
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
54
|
-
|
|
54
|
+
ObjectMetadata as $ObjectMetadata,
|
|
55
55
|
} from "@osdk/api";
|
|
56
56
|
import type {
|
|
57
57
|
ObjectSet as $ObjectSet,
|
|
@@ -169,7 +169,7 @@ export function createDefinition(object, ontology, identifier, {
|
|
|
169
169
|
${stringify(definition, {
|
|
170
170
|
links: () => `{
|
|
171
171
|
${stringify(definition.links, {
|
|
172
|
-
"*": definition => `$
|
|
172
|
+
"*": definition => `$ObjectMetadata.Link<${ontology.requireObjectType(definition.targetType).getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`
|
|
173
173
|
})}
|
|
174
174
|
}`,
|
|
175
175
|
properties: () => `{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","getObjectDefIdentifier","name","v2","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","currentFilePath","object","requireObjectType","objectType","apiName","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","JSON","multiplicity","nullable","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.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 { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nexport function getObjectDefIdentifier(name, v2) {\n return v2 ? name : `${name}Def`;\n}\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));\n const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n const identifiers = {\n objectDefIdentifier: `${object.shortApiName}`,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types() {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,\n } from \"@osdk/api\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"@osdk/api\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkObject\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\n return `${imports}${getV2Types()}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n\n > \n = $Osdk<\n ${objectDefIdentifier}, \n K | OPTIONS\n > \n \n ;\n `;\n}\nexport function createObjectSet(object, { objectDefIdentifier, objectSetIdentifier, propertyKeysIdentifier, osdkObjectIdentifier, }) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\nfunction maybeStripNamespace(type, q) {\n if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {\n return q.slice(type.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n}\nexport function createProps(type, identifier, strict) {\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable || !strict ? `| undefined` : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`} {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<\"${propertyDefinition.type}\", \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAO,SAASC,sBAAsBA,CAACC,IAAI,EAAEC,EAAE,EAAE;EAC7C,OAAOA,EAAE,GAAGD,IAAI,GAAG,GAAGA,IAAI,KAAK;AACnC;AACA;AACA,OAAO,SAASE,kCAAkCA,CAACC,UAAU,EAAE;EAAEC;AAAS,CAAC,EAAEC,eAAe,EAAE;EAC1F,MAAMC,MAAM,GAAGF,QAAQ,CAACG,iBAAiB,CAACJ,UAAU,CAACK,UAAU,CAACC,OAAO,EAAE,IAAI,CAAC;EAC9E,MAAMC,qBAAqB,GAAG,IAAIC,GAAG,CAACR,UAAU,CAACS,SAAS,CAACC,GAAG,CAACC,CAAC,IAAIV,QAAQ,CAACG,iBAAiB,CAACO,CAAC,CAACC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;EAC5H,MAAMC,UAAU,GAAGnB,gBAAgB,CAACJ,6CAA6C,CAACa,MAAM,CAACW,GAAG,EAAE,IAAI,CAAC,CAAC;EACpG,MAAMC,mBAAmB,GAAGZ,MAAM,CAACa,uBAAuB,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EAAE,EACjB,GAAG1C,UAAU,CAACmC,YAAY,GACpB,GAAGQ,UAAU,YAAY,GACzB,uBAAuBA,UAAU,GAAG;AAC9D,WAAW,CACM;IACL;EACJ,CAAC,CAAC;AACV;AACA,KAAK,EAAE;AACP;AACA,OAAO,SAAS9B,kBAAkBA,CAACU,IAAI,EAAE;EACrC,OAAO,8BAA8BiB,MAAM,CAACC,IAAI,CAAClB,IAAI,CAACF,sBAAsB,CAAC,IAAI,CAAC,CAACS,UAAU,CAAC,CAACjC,GAAG,CAAEC,CAAC,IAAKwB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC8C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC3K","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","getObjectDefIdentifier","name","v2","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","currentFilePath","object","requireObjectType","objectType","apiName","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","JSON","multiplicity","nullable","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.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 { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nexport function getObjectDefIdentifier(name, v2) {\n return v2 ? name : `${name}Def`;\n}\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));\n const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n const identifiers = {\n objectDefIdentifier: `${object.shortApiName}`,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types() {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"@osdk/api\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"@osdk/api\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkObject\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\n return `${imports}${getV2Types()}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n\n > \n = $Osdk<\n ${objectDefIdentifier}, \n K | OPTIONS\n > \n \n ;\n `;\n}\nexport function createObjectSet(object, { objectDefIdentifier, objectSetIdentifier, propertyKeysIdentifier, osdkObjectIdentifier, }) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\nfunction maybeStripNamespace(type, q) {\n if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {\n return q.slice(type.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n}\nexport function createProps(type, identifier, strict) {\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable || !strict ? `| undefined` : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`} {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectMetadata.Link<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<\"${propertyDefinition.type}\", \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,OAAO,SAASC,sBAAsBA,CAACC,IAAI,EAAEC,EAAE,EAAE;EAC7C,OAAOA,EAAE,GAAGD,IAAI,GAAG,GAAGA,IAAI,KAAK;AACnC;AACA;AACA,OAAO,SAASE,kCAAkCA,CAACC,UAAU,EAAE;EAAEC;AAAS,CAAC,EAAEC,eAAe,EAAE;EAC1F,MAAMC,MAAM,GAAGF,QAAQ,CAACG,iBAAiB,CAACJ,UAAU,CAACK,UAAU,CAACC,OAAO,EAAE,IAAI,CAAC;EAC9E,MAAMC,qBAAqB,GAAG,IAAIC,GAAG,CAACR,UAAU,CAACS,SAAS,CAACC,GAAG,CAACC,CAAC,I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U,CAACqC,KAAK,EAAE;IAClB,GAAG,EAAEN,CAAC/B,UAAU,EAAEiC,CAAC,EAAES,GAAG,KAAK;MACzB,MAAMC,UAAU,GAAGvD,QAAQ,CAACG,iBAAiB,CAACS,UAAU,CAACsC,UAAU,CAAC,CAC/DC,+BAA+B,CAAC,IAAI,CAAC;MAC1C,OAAO,CACH,YAAYG,GAAG,EAAE,EACjB,GAAG1C,UAAU,CAACmC,YAAY,GACpB,GAAGQ,UAAU,YAAY,GACzB,uBAAuBA,UAAU,GAAG;AAC9D,WAAW,CACM;IACL;EACJ,CAAC,CAAC;AACV;AACA,KAAK,EAAE;AACP;AACA,OAAO,SAAS9B,kBAAkBA,CAACU,IAAI,EAAE;EACrC,OAAO,8BAA8BiB,MAAM,CAACC,IAAI,CAAClB,IAAI,CAACF,sBAAsB,CAAC,IAAI,CAAC,CAACS,UAAU,CAAC,CAACjC,GAAG,CAAEC,CAAC,IAAKwB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC8C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC3K","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function propertyJsdoc(property:
|
|
1
|
+
import type { ObjectMetadata } from "@osdk/api";
|
|
2
|
+
export declare function propertyJsdoc(property: ObjectMetadata.Property, { isInherited, apiName }: {
|
|
3
3
|
isInherited?: boolean;
|
|
4
4
|
apiName: string;
|
|
5
5
|
}): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyJsdoc.d.ts","sourceRoot":"","sources":["../../../src/shared/propertyJsdoc.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"propertyJsdoc.d.ts","sourceRoot":"","sources":["../../../src/shared/propertyJsdoc.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEhD,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,cAAc,CAAC,QAAQ,EACjC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,UAyBrE"}
|
|
@@ -614,7 +614,7 @@ describe("generator", () => {
|
|
|
614
614
|
import type {
|
|
615
615
|
PropertyKeys as $PropertyKeys,
|
|
616
616
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
617
|
-
|
|
617
|
+
ObjectMetadata as $ObjectMetadata,
|
|
618
618
|
} from '@osdk/api';
|
|
619
619
|
import type {
|
|
620
620
|
ObjectSet as $ObjectSet,
|
|
@@ -667,7 +667,7 @@ describe("generator", () => {
|
|
|
667
667
|
interfaceMap: {};
|
|
668
668
|
inverseInterfaceMap: {};
|
|
669
669
|
links: {
|
|
670
|
-
Todos: $
|
|
670
|
+
Todos: $ObjectMetadata.Link<Todo, true>;
|
|
671
671
|
};
|
|
672
672
|
pluralDisplayName: 'Persons';
|
|
673
673
|
primaryKeyApiName: 'email';
|
|
@@ -698,7 +698,7 @@ describe("generator", () => {
|
|
|
698
698
|
import type {
|
|
699
699
|
PropertyKeys as $PropertyKeys,
|
|
700
700
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
701
|
-
|
|
701
|
+
ObjectMetadata as $ObjectMetadata,
|
|
702
702
|
} from '@osdk/api';
|
|
703
703
|
import type {
|
|
704
704
|
ObjectSet as $ObjectSet,
|
|
@@ -763,7 +763,7 @@ describe("generator", () => {
|
|
|
763
763
|
};
|
|
764
764
|
};
|
|
765
765
|
links: {
|
|
766
|
-
Assignee: $
|
|
766
|
+
Assignee: $ObjectMetadata.Link<Person, false>;
|
|
767
767
|
};
|
|
768
768
|
pluralDisplayName: 'AwesomeTodoDisplayNames';
|
|
769
769
|
primaryKeyApiName: 'id';
|
|
@@ -817,9 +817,7 @@ describe("generator", () => {
|
|
|
817
817
|
}
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
-
export interface getCount
|
|
821
|
-
extends QueryDefinition<'getCount', never, getCount.Signature>,
|
|
822
|
-
VersionBound<$ExpectedClientVersion> {
|
|
820
|
+
export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
823
821
|
__DefinitionMetadata?: {
|
|
824
822
|
apiName: 'getCount';
|
|
825
823
|
rid: 'rid.query.1';
|
|
@@ -872,9 +870,7 @@ describe("generator", () => {
|
|
|
872
870
|
}
|
|
873
871
|
}
|
|
874
872
|
|
|
875
|
-
export interface returnsTodo
|
|
876
|
-
extends QueryDefinition<'returnsTodo', 'Todo', returnsTodo.Signature>,
|
|
877
|
-
VersionBound<$ExpectedClientVersion> {
|
|
873
|
+
export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
878
874
|
__DefinitionMetadata?: {
|
|
879
875
|
apiName: 'returnsTodo';
|
|
880
876
|
rid: 'rid.query.2';
|
|
@@ -1179,7 +1175,7 @@ describe("generator", () => {
|
|
|
1179
1175
|
import type {
|
|
1180
1176
|
PropertyKeys as $PropertyKeys,
|
|
1181
1177
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1182
|
-
|
|
1178
|
+
ObjectMetadata as $ObjectMetadata,
|
|
1183
1179
|
} from '@osdk/api';
|
|
1184
1180
|
import type {
|
|
1185
1181
|
ObjectSet as $ObjectSet,
|
|
@@ -1232,7 +1228,7 @@ describe("generator", () => {
|
|
|
1232
1228
|
interfaceMap: {};
|
|
1233
1229
|
inverseInterfaceMap: {};
|
|
1234
1230
|
links: {
|
|
1235
|
-
Todos: $
|
|
1231
|
+
Todos: $ObjectMetadata.Link<Todo, true>;
|
|
1236
1232
|
};
|
|
1237
1233
|
pluralDisplayName: 'Persons';
|
|
1238
1234
|
primaryKeyApiName: 'email';
|
|
@@ -1263,7 +1259,7 @@ describe("generator", () => {
|
|
|
1263
1259
|
import type {
|
|
1264
1260
|
PropertyKeys as $PropertyKeys,
|
|
1265
1261
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1266
|
-
|
|
1262
|
+
ObjectMetadata as $ObjectMetadata,
|
|
1267
1263
|
} from '@osdk/api';
|
|
1268
1264
|
import type {
|
|
1269
1265
|
ObjectSet as $ObjectSet,
|
|
@@ -1328,7 +1324,7 @@ describe("generator", () => {
|
|
|
1328
1324
|
};
|
|
1329
1325
|
};
|
|
1330
1326
|
links: {
|
|
1331
|
-
Assignee: $
|
|
1327
|
+
Assignee: $ObjectMetadata.Link<Person, false>;
|
|
1332
1328
|
};
|
|
1333
1329
|
pluralDisplayName: 'AwesomeTodoDisplayNames';
|
|
1334
1330
|
primaryKeyApiName: 'id';
|
|
@@ -1382,9 +1378,7 @@ describe("generator", () => {
|
|
|
1382
1378
|
}
|
|
1383
1379
|
}
|
|
1384
1380
|
|
|
1385
|
-
export interface getCount
|
|
1386
|
-
extends QueryDefinition<'foo.bar.getCount', never, getCount.Signature>,
|
|
1387
|
-
VersionBound<$ExpectedClientVersion> {
|
|
1381
|
+
export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
1388
1382
|
__DefinitionMetadata?: {
|
|
1389
1383
|
apiName: 'foo.bar.getCount';
|
|
1390
1384
|
rid: 'rid.query.1';
|
|
@@ -1437,9 +1431,7 @@ describe("generator", () => {
|
|
|
1437
1431
|
}
|
|
1438
1432
|
}
|
|
1439
1433
|
|
|
1440
|
-
export interface returnsTodo
|
|
1441
|
-
extends QueryDefinition<'foo.bar.returnsTodo', 'foo.bar.Todo', returnsTodo.Signature>,
|
|
1442
|
-
VersionBound<$ExpectedClientVersion> {
|
|
1434
|
+
export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
1443
1435
|
__DefinitionMetadata?: {
|
|
1444
1436
|
apiName: 'foo.bar.returnsTodo';
|
|
1445
1437
|
rid: 'rid.query.2';
|
|
@@ -1546,9 +1538,7 @@ describe("generator", () => {
|
|
|
1546
1538
|
}
|
|
1547
1539
|
}
|
|
1548
1540
|
|
|
1549
|
-
export interface getTask
|
|
1550
|
-
extends QueryDefinition<'getTask', 'com.example.dep.Task', getTask.Signature>,
|
|
1551
|
-
VersionBound<$ExpectedClientVersion> {
|
|
1541
|
+
export interface getTask extends QueryDefinition<getTask.Signature>, VersionBound<$ExpectedClientVersion> {
|
|
1552
1542
|
__DefinitionMetadata?: {
|
|
1553
1543
|
apiName: 'getTask';
|
|
1554
1544
|
rid: 'ri.a.b.c';
|
|
@@ -1599,7 +1589,7 @@ describe("generator", () => {
|
|
|
1599
1589
|
import type {
|
|
1600
1590
|
PropertyKeys as $PropertyKeys,
|
|
1601
1591
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1602
|
-
|
|
1592
|
+
ObjectMetadata as $ObjectMetadata,
|
|
1603
1593
|
} from '@osdk/api';
|
|
1604
1594
|
import type {
|
|
1605
1595
|
ObjectSet as $ObjectSet,
|
|
@@ -1855,7 +1845,7 @@ describe("generator", () => {
|
|
|
1855
1845
|
import type {
|
|
1856
1846
|
PropertyKeys as $PropertyKeys,
|
|
1857
1847
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1858
|
-
|
|
1848
|
+
ObjectMetadata as $ObjectMetadata,
|
|
1859
1849
|
} from '@osdk/api';
|
|
1860
1850
|
import type {
|
|
1861
1851
|
ObjectSet as $ObjectSet,
|