@osdk/generator 2.1.0-beta.9 → 2.1.0
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 +350 -0
- package/build/browser/GenerateContext/EnhanceCommon.js +0 -15
- package/build/browser/GenerateContext/EnhanceCommon.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedAction.js +1 -1
- package/build/browser/GenerateContext/EnhancedAction.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedBase.js +2 -7
- package/build/browser/GenerateContext/EnhancedBase.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedInterfaceType.js +1 -1
- package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedObjectType.js +2 -2
- package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.js +1 -8
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedQuery.js +2 -2
- package/build/browser/GenerateContext/EnhancedQuery.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.js +1 -1
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.js.map +1 -1
- package/build/browser/GenerateContext/ForeignType.js +1 -1
- package/build/browser/GenerateContext/ForeignType.js.map +1 -1
- package/build/browser/GenerateContext/GenerateContext.js +0 -15
- package/build/browser/GenerateContext/GenerateContext.js.map +1 -1
- package/build/browser/GenerateContext/enhanceOntology.js +1 -0
- package/build/browser/GenerateContext/enhanceOntology.js.map +1 -1
- package/build/browser/MinimalFs.js +0 -15
- package/build/browser/MinimalFs.js.map +1 -1
- package/build/browser/WireOntologyDefinition.js +0 -15
- package/build/browser/WireOntologyDefinition.js.map +1 -1
- package/build/browser/generateClientSdkPackage.js +5 -3
- package/build/browser/generateClientSdkPackage.js.map +1 -1
- package/build/browser/generateClientSdkPackage.test.js +1 -0
- package/build/browser/generateClientSdkPackage.test.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js +1 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -1
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js +1 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -1
- package/build/browser/shared/getObjectImports.js +1 -0
- package/build/browser/shared/getObjectImports.js.map +1 -1
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.js +1 -0
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.js.map +1 -1
- package/build/browser/shared/getObjectTypesFromQueryDataType.js +1 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -1
- package/build/browser/shared/propertyJsdoc.js +1 -0
- package/build/browser/shared/propertyJsdoc.js.map +1 -1
- package/build/browser/shared/sanitizeMetadata.js +9 -0
- package/build/browser/shared/sanitizeMetadata.js.map +1 -1
- package/build/browser/shared/sanitizeMetadata.test.js +1 -0
- package/build/browser/shared/sanitizeMetadata.test.js.map +1 -1
- package/build/browser/util/InMemoryFs.js +1 -0
- package/build/browser/util/InMemoryFs.js.map +1 -1
- package/build/browser/util/commaSeparatedIdentifiers.js +1 -0
- package/build/browser/util/commaSeparatedIdentifiers.js.map +1 -1
- package/build/browser/util/commaSeparatedTypeIdentifiers.js +1 -0
- package/build/browser/util/commaSeparatedTypeIdentifiers.js.map +1 -1
- package/build/browser/util/deleteUndefineds.js +1 -0
- package/build/browser/util/deleteUndefineds.js.map +1 -1
- package/build/browser/util/reservedKeywords.js +1 -0
- package/build/browser/util/reservedKeywords.js.map +1 -1
- package/build/browser/util/stringUnionFrom.js +1 -0
- package/build/browser/util/stringUnionFrom.js.map +1 -1
- package/build/browser/util/stringify.js +16 -0
- package/build/browser/util/stringify.js.map +1 -1
- package/build/browser/util/test/TodoWireOntology.js +24 -5
- package/build/browser/util/test/TodoWireOntology.js.map +1 -1
- package/build/browser/util/test/compileThis.js +1 -0
- package/build/browser/util/test/compileThis.js.map +1 -1
- package/build/browser/util/test/createMockMinimalFiles.js +1 -0
- package/build/browser/util/test/createMockMinimalFiles.js.map +1 -1
- package/build/browser/util/test/formatTs.js +1 -0
- package/build/browser/util/test/formatTs.js.map +1 -1
- package/build/browser/util/verifyOutDir.js +1 -0
- package/build/browser/util/verifyOutDir.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +4 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +10 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +4 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +672 -628
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/generateMetadata.js +4 -1
- package/build/browser/v2.0/generateMetadata.js.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.js +30 -8
- package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.test.js +1 -0
- package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -1
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js +2 -0
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js +1 -0
- package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +10 -4
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +2 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/browser/v2.0/generateRootIndexTsFile.js +3 -1
- package/build/browser/v2.0/generateRootIndexTsFile.js.map +1 -1
- package/build/browser/v2.0/getDescriptionIfPresent.js +1 -0
- package/build/browser/v2.0/getDescriptionIfPresent.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +13 -4
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/browser/validateWireOntologyAssumptions.js +1 -0
- package/build/browser/validateWireOntologyAssumptions.js.map +1 -1
- package/build/cjs/chunk-XOCES5YA.cjs +978 -0
- package/build/cjs/chunk-XOCES5YA.cjs.map +1 -0
- package/build/cjs/index.cjs +1392 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +31 -0
- package/build/cjs/prompt-YMFYYBNJ.cjs +860 -0
- package/build/cjs/prompt-YMFYYBNJ.cjs.map +1 -0
- package/build/esm/GenerateContext/EnhanceCommon.js +0 -15
- package/build/esm/GenerateContext/EnhanceCommon.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedAction.js +1 -1
- package/build/esm/GenerateContext/EnhancedAction.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedBase.js +2 -7
- package/build/esm/GenerateContext/EnhancedBase.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.js +1 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedObjectType.js +2 -2
- package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +1 -8
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedQuery.js +2 -2
- package/build/esm/GenerateContext/EnhancedQuery.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.js +1 -1
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.js.map +1 -1
- package/build/esm/GenerateContext/ForeignType.js +1 -1
- package/build/esm/GenerateContext/ForeignType.js.map +1 -1
- package/build/esm/GenerateContext/GenerateContext.js +0 -15
- package/build/esm/GenerateContext/GenerateContext.js.map +1 -1
- package/build/esm/GenerateContext/enhanceOntology.js +1 -0
- package/build/esm/GenerateContext/enhanceOntology.js.map +1 -1
- package/build/esm/MinimalFs.js +0 -15
- package/build/esm/MinimalFs.js.map +1 -1
- package/build/esm/WireOntologyDefinition.js +0 -15
- package/build/esm/WireOntologyDefinition.js.map +1 -1
- package/build/esm/generateClientSdkPackage.js +5 -3
- package/build/esm/generateClientSdkPackage.js.map +1 -1
- package/build/esm/generateClientSdkPackage.test.js +1 -0
- package/build/esm/generateClientSdkPackage.test.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js +1 -0
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -1
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js +1 -0
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -1
- package/build/esm/shared/getObjectImports.js +1 -0
- package/build/esm/shared/getObjectImports.js.map +1 -1
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.js +1 -0
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.js.map +1 -1
- package/build/esm/shared/getObjectTypesFromQueryDataType.js +1 -0
- package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -1
- package/build/esm/shared/propertyJsdoc.js +1 -0
- package/build/esm/shared/propertyJsdoc.js.map +1 -1
- package/build/esm/shared/sanitizeMetadata.js +9 -0
- package/build/esm/shared/sanitizeMetadata.js.map +1 -1
- package/build/esm/shared/sanitizeMetadata.test.js +1 -0
- package/build/esm/shared/sanitizeMetadata.test.js.map +1 -1
- package/build/esm/util/InMemoryFs.js +1 -0
- package/build/esm/util/InMemoryFs.js.map +1 -1
- package/build/esm/util/commaSeparatedIdentifiers.js +1 -0
- package/build/esm/util/commaSeparatedIdentifiers.js.map +1 -1
- package/build/esm/util/commaSeparatedTypeIdentifiers.js +1 -0
- package/build/esm/util/commaSeparatedTypeIdentifiers.js.map +1 -1
- package/build/esm/util/deleteUndefineds.js +1 -0
- package/build/esm/util/deleteUndefineds.js.map +1 -1
- package/build/esm/util/reservedKeywords.js +1 -0
- package/build/esm/util/reservedKeywords.js.map +1 -1
- package/build/esm/util/stringUnionFrom.js +1 -0
- package/build/esm/util/stringUnionFrom.js.map +1 -1
- package/build/esm/util/stringify.js +16 -0
- package/build/esm/util/stringify.js.map +1 -1
- package/build/esm/util/test/TodoWireOntology.js +24 -5
- package/build/esm/util/test/TodoWireOntology.js.map +1 -1
- package/build/esm/util/test/compileThis.js +1 -0
- package/build/esm/util/test/compileThis.js.map +1 -1
- package/build/esm/util/test/createMockMinimalFiles.js +1 -0
- package/build/esm/util/test/createMockMinimalFiles.js.map +1 -1
- package/build/esm/util/test/formatTs.js +1 -0
- package/build/esm/util/test/formatTs.js.map +1 -1
- package/build/esm/util/verifyOutDir.js +1 -0
- package/build/esm/util/verifyOutDir.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +4 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +10 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +4 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +672 -628
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/generateMetadata.js +4 -1
- package/build/esm/v2.0/generateMetadata.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.js +30 -8
- package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.test.js +1 -0
- package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -1
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js +2 -0
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js +1 -0
- package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +10 -4
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +2 -0
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/esm/v2.0/generateRootIndexTsFile.js +3 -1
- package/build/esm/v2.0/generateRootIndexTsFile.js.map +1 -1
- package/build/esm/v2.0/getDescriptionIfPresent.js +1 -0
- package/build/esm/v2.0/getDescriptionIfPresent.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +13 -4
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/esm/validateWireOntologyAssumptions.js +1 -0
- package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
- package/build/types/GenerateContext/EnhanceCommon.d.ts +6 -0
- package/build/types/GenerateContext/EnhanceCommon.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedAction.d.ts +13 -0
- package/build/types/GenerateContext/EnhancedAction.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedBase.d.ts +20 -0
- package/build/types/GenerateContext/EnhancedBase.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedInterfaceType.d.ts +12 -0
- package/build/types/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedObjectType.d.ts +11 -0
- package/build/types/GenerateContext/EnhancedObjectType.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts +28 -0
- package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedQuery.d.ts +13 -0
- package/build/types/GenerateContext/EnhancedQuery.d.ts.map +1 -0
- package/build/types/GenerateContext/EnhancedSharedPropertyType.d.ts +7 -0
- package/build/types/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -0
- package/build/types/GenerateContext/ForeignType.d.ts +8 -0
- package/build/types/GenerateContext/ForeignType.d.ts.map +1 -0
- package/build/types/GenerateContext/GenerateContext.d.ts +13 -0
- package/build/types/GenerateContext/GenerateContext.d.ts.map +1 -0
- package/build/types/GenerateContext/enhanceOntology.d.ts +9 -0
- package/build/types/GenerateContext/enhanceOntology.d.ts.map +1 -0
- package/build/types/MinimalFs.d.ts +9 -0
- package/build/types/MinimalFs.d.ts.map +1 -0
- package/build/types/WireOntologyDefinition.d.ts +2 -0
- package/build/types/WireOntologyDefinition.d.ts.map +1 -0
- package/build/types/generateClientSdkPackage.d.ts +33 -0
- package/build/types/generateClientSdkPackage.d.ts.map +1 -0
- package/build/types/generateClientSdkPackage.test.d.ts +1 -0
- package/build/types/generateClientSdkPackage.test.d.ts.map +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/{browser → types}/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -1
- package/build/types/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +1 -0
- package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +1 -0
- package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +1 -0
- package/build/{browser → types}/shared/getObjectImports.d.ts +2 -2
- package/build/types/shared/getObjectImports.d.ts.map +1 -0
- package/build/{browser → types}/shared/getObjectTypeApiNamesFromQuery.d.ts +1 -2
- package/build/types/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -0
- package/build/types/shared/getObjectTypesFromQueryDataType.d.ts +2 -0
- package/build/types/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -0
- package/build/{browser → types}/shared/propertyJsdoc.d.ts +2 -3
- package/build/types/shared/propertyJsdoc.d.ts.map +1 -0
- package/build/types/shared/sanitizeMetadata.d.ts +1 -0
- package/build/types/shared/sanitizeMetadata.d.ts.map +1 -0
- package/build/types/shared/sanitizeMetadata.test.d.ts +1 -0
- package/build/types/shared/sanitizeMetadata.test.d.ts.map +1 -0
- package/build/{browser → types}/util/InMemoryFs.d.ts +2 -3
- package/build/types/util/InMemoryFs.d.ts.map +1 -0
- package/build/{browser → types}/util/commaSeparatedIdentifiers.d.ts +0 -1
- package/build/types/util/commaSeparatedIdentifiers.d.ts.map +1 -0
- package/build/{browser → types}/util/commaSeparatedTypeIdentifiers.d.ts +0 -1
- package/build/types/util/commaSeparatedTypeIdentifiers.d.ts.map +1 -0
- package/build/{browser → types}/util/deleteUndefineds.d.ts +0 -1
- package/build/types/util/deleteUndefineds.d.ts.map +1 -0
- package/build/{browser → types}/util/reservedKeywords.d.ts +0 -1
- package/build/types/util/reservedKeywords.d.ts.map +1 -0
- package/build/{browser → types}/util/stringUnionFrom.d.ts +0 -1
- package/build/types/util/stringUnionFrom.d.ts.map +1 -0
- package/build/types/util/stringify.d.ts +20 -0
- package/build/types/util/stringify.d.ts.map +1 -0
- package/build/types/util/test/TodoWireOntology.d.ts +2 -0
- package/build/types/util/test/TodoWireOntology.d.ts.map +1 -0
- package/build/{browser → types}/util/test/compileThis.d.ts +0 -1
- package/build/types/util/test/compileThis.d.ts.map +1 -0
- package/build/types/util/test/createMockMinimalFiles.d.ts +12 -0
- package/build/types/util/test/createMockMinimalFiles.d.ts.map +1 -0
- package/build/{browser → types}/util/test/formatTs.d.ts +0 -1
- package/build/types/util/test/formatTs.d.ts.map +1 -0
- package/build/types/util/verifyOutDir.d.ts +8 -0
- package/build/types/util/verifyOutDir.d.ts.map +1 -0
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +1 -0
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +1 -0
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +1 -0
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +1 -0
- package/build/{esm → types}/v2.0/generateClientSdkVersionTwoPointZero.d.ts +0 -1
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -0
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +1 -0
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +1 -0
- package/build/{browser → types}/v2.0/generateMetadata.d.ts +0 -1
- package/build/types/v2.0/generateMetadata.d.ts.map +1 -0
- package/build/types/v2.0/generatePerActionDataFiles.d.ts +2 -0
- package/build/types/v2.0/generatePerActionDataFiles.d.ts.map +1 -0
- package/build/types/v2.0/generatePerActionDataFiles.test.d.ts +1 -0
- package/build/types/v2.0/generatePerActionDataFiles.test.d.ts.map +1 -0
- package/build/types/v2.0/generatePerInterfaceDataFiles.d.ts +1 -0
- package/build/types/v2.0/generatePerInterfaceDataFiles.d.ts.map +1 -0
- package/build/{esm → types}/v2.0/generatePerObjectDataFiles.d.ts +0 -1
- package/build/types/v2.0/generatePerObjectDataFiles.d.ts.map +1 -0
- package/build/{browser → types}/v2.0/generatePerQueryDataFiles.d.ts +2 -3
- package/build/types/v2.0/generatePerQueryDataFiles.d.ts.map +1 -0
- package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts +1 -0
- package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts.map +1 -0
- package/build/{esm → types}/v2.0/generateRootIndexTsFile.d.ts +0 -1
- package/build/types/v2.0/generateRootIndexTsFile.d.ts.map +1 -0
- package/build/{browser → types}/v2.0/getDescriptionIfPresent.d.ts +0 -1
- package/build/types/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
- package/build/{browser → types}/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +4 -6
- package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -0
- package/build/{browser → types}/validateWireOntologyAssumptions.d.ts +0 -1
- package/build/types/validateWireOntologyAssumptions.d.ts.map +1 -0
- package/package.json +26 -12
- package/build/browser/GenerateContext/EnhanceCommon.d.ts +0 -7
- package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedAction.d.ts +0 -14
- package/build/browser/GenerateContext/EnhancedAction.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedBase.d.ts +0 -21
- package/build/browser/GenerateContext/EnhancedBase.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts +0 -13
- package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedObjectType.d.ts +0 -12
- package/build/browser/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +0 -27
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedQuery.d.ts +0 -14
- package/build/browser/GenerateContext/EnhancedQuery.d.ts.map +0 -1
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts +0 -8
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
- package/build/browser/GenerateContext/ForeignType.d.ts +0 -9
- package/build/browser/GenerateContext/ForeignType.d.ts.map +0 -1
- package/build/browser/GenerateContext/GenerateContext.d.ts +0 -14
- package/build/browser/GenerateContext/GenerateContext.d.ts.map +0 -1
- package/build/browser/GenerateContext/enhanceOntology.d.ts +0 -10
- package/build/browser/GenerateContext/enhanceOntology.d.ts.map +0 -1
- package/build/browser/MinimalFs.d.ts +0 -10
- package/build/browser/MinimalFs.d.ts.map +0 -1
- package/build/browser/WireOntologyDefinition.d.ts +0 -4
- package/build/browser/WireOntologyDefinition.d.ts.map +0 -1
- package/build/browser/generateClientSdkPackage.d.ts +0 -47
- package/build/browser/generateClientSdkPackage.d.ts.map +0 -1
- package/build/browser/generateClientSdkPackage.test.d.ts +0 -2
- package/build/browser/generateClientSdkPackage.test.d.ts.map +0 -1
- package/build/browser/index.d.ts +0 -5
- package/build/browser/index.d.ts.map +0 -1
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -2
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
- package/build/browser/shared/getObjectImports.d.ts.map +0 -1
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
- package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts +0 -3
- package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
- package/build/browser/shared/propertyJsdoc.d.ts.map +0 -1
- package/build/browser/shared/sanitizeMetadata.d.ts +0 -2
- package/build/browser/shared/sanitizeMetadata.d.ts.map +0 -1
- package/build/browser/shared/sanitizeMetadata.test.d.ts +0 -2
- package/build/browser/shared/sanitizeMetadata.test.d.ts.map +0 -1
- package/build/browser/util/InMemoryFs.d.ts.map +0 -1
- package/build/browser/util/commaSeparatedIdentifiers.d.ts.map +0 -1
- package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
- package/build/browser/util/deleteUndefineds.d.ts.map +0 -1
- package/build/browser/util/reservedKeywords.d.ts.map +0 -1
- package/build/browser/util/stringUnionFrom.d.ts.map +0 -1
- package/build/browser/util/stringify.d.ts +0 -20
- package/build/browser/util/stringify.d.ts.map +0 -1
- package/build/browser/util/test/TodoWireOntology.d.ts +0 -217
- package/build/browser/util/test/TodoWireOntology.d.ts.map +0 -1
- package/build/browser/util/test/compileThis.d.ts.map +0 -1
- package/build/browser/util/test/createMockMinimalFiles.d.ts +0 -13
- package/build/browser/util/test/createMockMinimalFiles.d.ts.map +0 -1
- package/build/browser/util/test/formatTs.d.ts.map +0 -1
- package/build/browser/util/verifyOutDir.d.ts +0 -9
- package/build/browser/util/verifyOutDir.d.ts.map +0 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +0 -2
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -2
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +0 -4
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -2
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
- package/build/browser/v2.0/generateMetadata.d.ts.map +0 -1
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts +0 -3
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
- package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts +0 -2
- package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
- package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts +0 -2
- package/build/browser/v2.0/generatePerInterfaceDataFiles.d.ts.map +0 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.d.ts +0 -3
- package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +0 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts +0 -2
- package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
- package/build/browser/v2.0/generateRootIndexTsFile.d.ts +0 -3
- package/build/browser/v2.0/generateRootIndexTsFile.d.ts.map +0 -1
- package/build/browser/v2.0/getDescriptionIfPresent.d.ts.map +0 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
- package/build/browser/validateWireOntologyAssumptions.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhanceCommon.d.ts +0 -7
- package/build/esm/GenerateContext/EnhanceCommon.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedAction.d.ts +0 -14
- package/build/esm/GenerateContext/EnhancedAction.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedBase.d.ts +0 -21
- package/build/esm/GenerateContext/EnhancedBase.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +0 -13
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts +0 -12
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +0 -27
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedQuery.d.ts +0 -14
- package/build/esm/GenerateContext/EnhancedQuery.d.ts.map +0 -1
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts +0 -8
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
- package/build/esm/GenerateContext/ForeignType.d.ts +0 -9
- package/build/esm/GenerateContext/ForeignType.d.ts.map +0 -1
- package/build/esm/GenerateContext/GenerateContext.d.ts +0 -14
- package/build/esm/GenerateContext/GenerateContext.d.ts.map +0 -1
- package/build/esm/GenerateContext/enhanceOntology.d.ts +0 -10
- package/build/esm/GenerateContext/enhanceOntology.d.ts.map +0 -1
- package/build/esm/MinimalFs.d.ts +0 -10
- package/build/esm/MinimalFs.d.ts.map +0 -1
- package/build/esm/WireOntologyDefinition.d.ts +0 -4
- package/build/esm/WireOntologyDefinition.d.ts.map +0 -1
- package/build/esm/generateClientSdkPackage.d.ts +0 -47
- package/build/esm/generateClientSdkPackage.d.ts.map +0 -1
- package/build/esm/generateClientSdkPackage.test.d.ts +0 -2
- package/build/esm/generateClientSdkPackage.test.d.ts.map +0 -1
- package/build/esm/index.d.ts +0 -5
- package/build/esm/index.d.ts.map +0 -1
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -2
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +0 -2
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
- package/build/esm/shared/getObjectImports.d.ts +0 -4
- package/build/esm/shared/getObjectImports.d.ts.map +0 -1
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts +0 -4
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
- package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts +0 -3
- package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
- package/build/esm/shared/propertyJsdoc.d.ts +0 -6
- package/build/esm/shared/propertyJsdoc.d.ts.map +0 -1
- package/build/esm/shared/sanitizeMetadata.d.ts +0 -2
- package/build/esm/shared/sanitizeMetadata.d.ts.map +0 -1
- package/build/esm/shared/sanitizeMetadata.test.d.ts +0 -2
- package/build/esm/shared/sanitizeMetadata.test.d.ts.map +0 -1
- package/build/esm/util/InMemoryFs.d.ts +0 -7
- package/build/esm/util/InMemoryFs.d.ts.map +0 -1
- package/build/esm/util/commaSeparatedIdentifiers.d.ts +0 -2
- package/build/esm/util/commaSeparatedIdentifiers.d.ts.map +0 -1
- package/build/esm/util/commaSeparatedTypeIdentifiers.d.ts +0 -2
- package/build/esm/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
- package/build/esm/util/deleteUndefineds.d.ts +0 -2
- package/build/esm/util/deleteUndefineds.d.ts.map +0 -1
- package/build/esm/util/reservedKeywords.d.ts +0 -2
- package/build/esm/util/reservedKeywords.d.ts.map +0 -1
- package/build/esm/util/stringUnionFrom.d.ts +0 -2
- package/build/esm/util/stringUnionFrom.d.ts.map +0 -1
- package/build/esm/util/stringify.d.ts +0 -20
- package/build/esm/util/stringify.d.ts.map +0 -1
- package/build/esm/util/test/TodoWireOntology.d.ts +0 -217
- package/build/esm/util/test/TodoWireOntology.d.ts.map +0 -1
- package/build/esm/util/test/compileThis.d.ts +0 -3
- package/build/esm/util/test/compileThis.d.ts.map +0 -1
- package/build/esm/util/test/createMockMinimalFiles.d.ts +0 -13
- package/build/esm/util/test/createMockMinimalFiles.d.ts.map +0 -1
- package/build/esm/util/test/formatTs.d.ts +0 -2
- package/build/esm/util/test/formatTs.d.ts.map +0 -1
- package/build/esm/util/verifyOutDir.d.ts +0 -9
- package/build/esm/util/verifyOutDir.d.ts.map +0 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +0 -2
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +0 -2
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +0 -2
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
- package/build/esm/v2.0/generateMetadata.d.ts +0 -3
- package/build/esm/v2.0/generateMetadata.d.ts.map +0 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts +0 -3
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
- package/build/esm/v2.0/generatePerActionDataFiles.test.d.ts +0 -2
- package/build/esm/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
- package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts +0 -2
- package/build/esm/v2.0/generatePerInterfaceDataFiles.d.ts.map +0 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +0 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +0 -9
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.d.ts +0 -2
- package/build/esm/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
- package/build/esm/v2.0/generateRootIndexTsFile.d.ts.map +0 -1
- package/build/esm/v2.0/getDescriptionIfPresent.d.ts +0 -2
- package/build/esm/v2.0/getDescriptionIfPresent.d.ts.map +0 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +0 -12
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
- package/build/esm/validateWireOntologyAssumptions.d.ts +0 -3
- package/build/esm/validateWireOntologyAssumptions.d.ts.map +0 -1
|
@@ -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","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry","actionTypes","interfaceTypes","objectTypes","apiName","description","displayName","rid","queryTypes","doThing","parameters","foo","dataType","type","paramStruct","fields","name","fieldType","output","sharedPropertyTypes"],"sources":["generatePerQueryDataFiles.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as ts from \"typescript\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { createMockMinimalFiles } from \"../util/test/createMockMinimalFiles.js\";\nimport { TodoWireOntology } from \"../util/test/TodoWireOntology.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: TodoWireOntology,\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n forInternalUse: true,\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export { getCount } from './queries/getCount.js';\n export { returnsTodo } from './queries/returnsTodo.js';\n \",\n \"/foo/ontology/queries/getCount.ts\": \"import type { QueryDefinition, 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: '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, 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: '0';\n parameters: {\n /**\n * description: Random desc so we test jsdoc\n */\n someTodo: {\n description: 'Random desc so we test jsdoc';\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n };\n output: {\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n signature: returnsTodo.Signature;\n };\n apiName: 'returnsTodo';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n await helper.minimalFiles.writeFile(\"/bar/test.ts\", `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `);\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n const files = {};\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n const servicesHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n return ts.ScriptSnapshot.fromString(helper.getFiles()[fileName]);\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path) => {\n console.log(\"readFile: \", path);\n return helper.getFiles()[path];\n },\n readDirectory: (path, extensions, exclude, include, depth) => {\n console.log(\"readDirectory\", path);\n return ts.sys.readDirectory(path, extensions, exclude, include, depth);\n },\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n const langServices = ts.createLanguageService(servicesHost);\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology: {\n apiName: \"foo\",\n description: \"foo\",\n displayName: \"foo\",\n rid: \"ri.foo\",\n },\n queryTypes: {\n doThing: {\n rid: \"rid.query.1\",\n version: \"0\",\n apiName: \"doThing\",\n parameters: {\n foo: {\n dataType: { type: \"string\" },\n },\n paramStruct: {\n dataType: {\n type: \"struct\",\n fields: [\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n output: {\n type: \"struct\",\n fields: [\n {\n name: \"aString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"anInteger\",\n fieldType: { type: \"integer\" },\n },\n {\n name: \"aLong\",\n fieldType: { type: \"long\" },\n },\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n sharedPropertyTypes: {},\n },\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n forInternalUse: true,\n }, true);\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { 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 parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n paramStruct: {\n nullable: false;\n struct: {\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n };\n output: {\n nullable: false;\n struct: {\n aString: {\n type: 'string';\n nullable: false;\n };\n anInteger: {\n type: 'integer';\n nullable: false;\n };\n aLong: {\n type: 'long';\n nullable: false;\n };\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n signature: doThing.Signature;\n };\n apiName: 'doThing';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const doThing: doThing = {\n apiName: 'doThing',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AAC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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,OAAO,CAAC;EACJ,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","sanitized","importExt","externalObjects","Map","externalInterfaces","externalSpts","outDir","forInternalUse","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry","actionTypes","interfaceTypes","objectTypes","apiName","description","displayName","rid","queryTypes","doThing","parameters","foo","dataType","type","paramStruct","fields","name","fieldType","output","sharedPropertyTypes"],"sources":["generatePerQueryDataFiles.test.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 },\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 { 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: '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, 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: '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\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 },\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 },\n true,\n );\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { 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 parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n paramStruct: {\n nullable: false;\n struct: {\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n };\n output: {\n nullable: false;\n struct: {\n aString: {\n type: 'string';\n nullable: false;\n };\n anInteger: {\n type: 'integer';\n nullable: false;\n };\n aLong: {\n type: 'long';\n nullable: false;\n };\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n signature: doThing.Signature;\n };\n apiName: 'doThing';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const doThing: doThing = {\n apiName: 'doThing',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;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;IAClB,CAAC,EACD,IACF,CAAC;IAEDjB,MAAM,CAACM,MAAM,CAACY,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;AAC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AAC,EACD;kBACEG,IAAI,EAAE,OAAO;kBACbC,SAAS,EAAE;oBAAEJ,IAAI,EAAE;kBAAO;gBAC5B,CAAC,EACD;kBACEG,IAAI,EAAE,cAAc;kBACpBC,SAAS,EAAE;oBACTJ,IAAI,EAAE,QAAQ;oBACdE,MAAM,EAAE,CACN;sBACEC,IAAI,EAAE,cAAc;sBACpBC,SAAS,EAAE;wBAAEJ,IAAI,EAAE;sBAAS;oBAC9B,CAAC,EACD;sBACEG,IAAI,EAAE,eAAe;sBACrBC,SAAS,EAAE;wBAAEJ,IAAI,EAAE;sBAAU;oBAC/B,CAAC;kBAEL;gBACF,CAAC;cAEL;YACF;UACF,CAAC;UACDM,mBAAmB,EAAE,CAAC;QACxB,CAAC;QACDlE,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,EAnGQ,MAmGG;MACjBL,SAAS,EAAE,KAAK;MAChBM,cAAc,EAAE;IAClB,CAAC,EACD,IACF,CAAC;IACDjB,MAAM,CAACM,MAAM,CAACY,QAAQ,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAC1DC,qBAAqB,CAAC;AAC7B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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":[]}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import path from "node:path";
|
|
17
18
|
import { ForeignType } from "../GenerateContext/ForeignType.js";
|
|
18
19
|
import { formatTs } from "../util/test/formatTs.js";
|
|
@@ -23,7 +24,7 @@ export async function generateRootIndexTsFile({
|
|
|
23
24
|
ontologyApiNamespace,
|
|
24
25
|
ontology
|
|
25
26
|
}) {
|
|
26
|
-
fs.writeFile(path.join(outDir, "index.ts"), await formatTs(`export {${helper(ontology.actionTypes)}} from "./ontology/actions${importExt}";
|
|
27
|
+
await fs.writeFile(path.join(outDir, "index.ts"), await formatTs(`export {${helper(ontology.actionTypes)}} from "./ontology/actions${importExt}";
|
|
27
28
|
export * as $Actions from "./ontology/actions${importExt}";
|
|
28
29
|
export {${helper(ontology.interfaceTypes)}} from "./ontology/interfaces${importExt}";
|
|
29
30
|
export * as $Interfaces from "./ontology/interfaces${importExt}";
|
|
@@ -31,6 +32,7 @@ export async function generateRootIndexTsFile({
|
|
|
31
32
|
export * as $Objects from "./ontology/objects${importExt}";
|
|
32
33
|
export {${helper(ontology.queryTypes)}} from "./ontology/queries${importExt}";
|
|
33
34
|
export * as $Queries from "./ontology/queries${importExt}";
|
|
35
|
+
export { $osdkMetadata } from "./OntologyMetadata${importExt}";
|
|
34
36
|
${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
|
|
35
37
|
`));
|
|
36
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateRootIndexTsFile.js","names":["path","ForeignType","formatTs","generateRootIndexTsFile","fs","outDir","importExt","ontologyApiNamespace","ontology","writeFile","join","helper","actionTypes","interfaceTypes","objectTypes","queryTypes","x","Object","values","filter","map","a","shortApiName"],"sources":["generateRootIndexTsFile.
|
|
1
|
+
{"version":3,"file":"generateRootIndexTsFile.js","names":["path","ForeignType","formatTs","generateRootIndexTsFile","fs","outDir","importExt","ontologyApiNamespace","ontology","writeFile","join","helper","actionTypes","interfaceTypes","objectTypes","queryTypes","x","Object","values","filter","map","a","shortApiName"],"sources":["generateRootIndexTsFile.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 path from \"node:path\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { GenerateContext } from \"../GenerateContext/GenerateContext.js\";\nimport { formatTs } from \"../util/test/formatTs.js\";\n\nexport async function generateRootIndexTsFile(\n { fs, outDir, importExt, ontologyApiNamespace, ontology }: GenerateContext,\n): Promise<void> {\n await fs.writeFile(\n path.join(outDir, \"index.ts\"),\n await formatTs(\n `export {${\n helper(ontology.actionTypes)\n }} from \"./ontology/actions${importExt}\";\n export * as $Actions from \"./ontology/actions${importExt}\";\n export {${\n helper(ontology.interfaceTypes)\n }} from \"./ontology/interfaces${importExt}\";\n export * as $Interfaces from \"./ontology/interfaces${importExt}\";\n export {${\n helper(ontology.objectTypes)\n }} from \"./ontology/objects${importExt}\";\n export * as $Objects from \"./ontology/objects${importExt}\";\n export {${\n helper(ontology.queryTypes)\n }} from \"./ontology/queries${importExt}\";\n export * as $Queries from \"./ontology/queries${importExt}\";\n export { $osdkMetadata } from \"./OntologyMetadata${importExt}\";\n ${\n ontologyApiNamespace == null\n ? `export { $ontologyRid } from \"./OntologyMetadata${importExt}\";`\n : ``\n }\n `,\n ),\n );\n}\n\nfunction helper(x: Record<string, { shortApiName: string }>) {\n return Object.values(x).filter(x => !(x instanceof ForeignType)).map(a =>\n a.shortApiName\n ).join(\n \", \",\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,IAAI,MAAM,WAAW;AAC5B,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,QAAQ,QAAQ,0BAA0B;AAEnD,OAAO,eAAeC,uBAAuBA,CAC3C;EAAEC,EAAE;EAAEC,MAAM;EAAEC,SAAS;EAAEC,oBAAoB;EAAEC;AAA0B,CAAC,EAC3D;EACf,MAAMJ,EAAE,CAACK,SAAS,CAChBT,IAAI,CAACU,IAAI,CAACL,MAAM,EAAE,UAAU,CAAC,EAC7B,MAAMH,QAAQ,CACZ,WACES,MAAM,CAACH,QAAQ,CAACI,WAAW,CAAC,6BACDN,SAAS;AAC5C,uDAAuDA,SAAS;AAChE,kBACQK,MAAM,CAACH,QAAQ,CAACK,cAAc,CAAC,gCACDP,SAAS;AAC/C,6DAA6DA,SAAS;AACtE,kBACQK,MAAM,CAACH,QAAQ,CAACM,WAAW,CAAC,6BACDR,SAAS;AAC5C,uDAAuDA,SAAS;AAChE,kBACQK,MAAM,CAACH,QAAQ,CAACO,UAAU,CAAC,6BACAT,SAAS;AAC5C,uDAAuDA,SAAS;AAChE,2DAA2DA,SAAS;AACpE,UACQC,oBAAoB,IAAI,IAAI,GACxB,mDAAmDD,SAAS,IAAI,GAChE,EAAE;AACd,KAEI,CACF,CAAC;AACH;AAEA,SAASK,MAAMA,CAACK,CAA2C,EAAE;EAC3D,OAAOC,MAAM,CAACC,MAAM,CAACF,CAAC,CAAC,CAACG,MAAM,CAACH,CAAC,IAAI,EAAEA,CAAC,YAAYf,WAAW,CAAC,CAAC,CAACmB,GAAG,CAACC,CAAC,IACpEA,CAAC,CAACC,YACJ,CAAC,CAACZ,IAAI,CACJ,IACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDescriptionIfPresent.js","names":["getDescriptionIfPresent","description","includeNewline"],"sources":["getDescriptionIfPresent.
|
|
1
|
+
{"version":3,"file":"getDescriptionIfPresent.js","names":["getDescriptionIfPresent","description","includeNewline"],"sources":["getDescriptionIfPresent.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\nexport function getDescriptionIfPresent(\n description?: string,\n includeNewline?: boolean,\n): string {\n if (description) {\n return `/**\n * ${description}\n */${includeNewline ? \"\\n\" : \"\"}`;\n }\n return \"\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,uBAAuBA,CACrCC,WAAoB,EACpBC,cAAwB,EAChB;EACR,IAAID,WAAW,EAAE;IACf,OAAO;AACX,KAAKA,WAAW;AAChB,KAAKC,cAAc,GAAG,IAAI,GAAG,EAAE,EAAE;EAC/B;EACA,OAAO,EAAE;AACX","ignoreList":[]}
|
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
|
|
18
|
+
import consola from "consola";
|
|
17
19
|
import { EnhancedObjectType } from "../GenerateContext/EnhancedObjectType.js";
|
|
18
20
|
import { ForeignType } from "../GenerateContext/ForeignType.js";
|
|
19
21
|
import { getObjectImports } from "../shared/getObjectImports.js";
|
|
20
22
|
import { propertyJsdoc } from "../shared/propertyJsdoc.js";
|
|
21
23
|
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
22
24
|
import { stringify } from "../util/stringify.js";
|
|
25
|
+
|
|
23
26
|
/** @internal */
|
|
24
27
|
export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
25
28
|
ontology,
|
|
@@ -30,7 +33,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
30
33
|
throw new Error("Should not be generating types for an external type");
|
|
31
34
|
}
|
|
32
35
|
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
33
|
-
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
|
|
36
|
+
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true, consola));
|
|
34
37
|
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
35
38
|
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
36
39
|
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
@@ -40,7 +43,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
40
43
|
const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
|
|
41
44
|
const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
|
|
42
45
|
const identifiers = {
|
|
43
|
-
objectDefIdentifier:
|
|
46
|
+
objectDefIdentifier: object.shortApiName,
|
|
44
47
|
osdkObjectLinksIdentifier,
|
|
45
48
|
osdkObjectPropsIdentifier,
|
|
46
49
|
osdkObjectStrictPropsIdentifier,
|
|
@@ -154,7 +157,7 @@ ${stringify(definition.properties, {
|
|
|
154
157
|
return [`readonly "${maybeStripNamespace(type, apiName)}"${
|
|
155
158
|
// after we convert everything over we can do this:
|
|
156
159
|
// !strict || propertyDefinition.nullable ? "?" : ""
|
|
157
|
-
""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]
|
|
160
|
+
""}`, (typeof propertyDefinition.type === "object" ? remapStructType(propertyDefinition.type) : `$PropType[${JSON.stringify(propertyDefinition.type)}]`) + `${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict && !(definition.type === "object" && definition.primaryKeyApiName === apiName) ? `| undefined` : ""}`];
|
|
158
161
|
}
|
|
159
162
|
})}
|
|
160
163
|
}`;
|
|
@@ -187,7 +190,7 @@ export function createDefinition(object, ontology, identifier, {
|
|
|
187
190
|
${stringify(definition.properties, {
|
|
188
191
|
"*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
|
|
189
192
|
apiName
|
|
190
|
-
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef
|
|
193
|
+
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
|
|
191
194
|
})}
|
|
192
195
|
}`
|
|
193
196
|
})}
|
|
@@ -214,4 +217,10 @@ export function createPropertyKeys(type) {
|
|
|
214
217
|
const properties = Object.keys(type.getCleanedUpDefinition(true).properties);
|
|
215
218
|
return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
|
|
216
219
|
}
|
|
220
|
+
function remapStructType(structType) {
|
|
221
|
+
let output = `{`;
|
|
222
|
+
Object.entries(structType).map(([key, value]) => output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`);
|
|
223
|
+
output += "}";
|
|
224
|
+
return output;
|
|
225
|
+
}
|
|
217
226
|
//# sourceMappingURL=wireObjectTypeV2ToSdkObjectConstV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","forInternalUse","currentFilePath","object","requireObjectType","objectType","apiName","Error","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","primaryKeyApiName","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 { ForeignType } from \"../GenerateContext/ForeignType.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\";\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology, forInternalUse }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n if (object instanceof ForeignType) {\n throw new Error(\"Should not be generating types for an external type\");\n }\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(object, forInternalUse = false) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\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 \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\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, \"OsdkInstance\", 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(object, forInternalUse)}\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 | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > = ${identifier}<OPTIONS, K>;\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 if (identifier === \"StrictProps\") {\n return `export type StrictProps = Props`;\n }\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\n || (!strict\n && !(definition.type === \"object\"\n && definition.primaryKeyApiName === apiName))\n ? `| undefined`\n : \"\"}`,\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 const properties = Object.keys(type.getCleanedUpDefinition(true).properties);\n return `export type PropertyKeys = ${properties.length === 0\n ? \"never\"\n : 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,WAAW,QAAQ,mCAAmC;AAC/D,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD;AACA,OAAO,SAASC,kCAAkCA,CAACC,UAAU,EAAE;EAAEC,QAAQ;EAAEC;AAAe,CAAC,EAAEC,eAAe,EAAE;EAC1G,MAAMC,MAAM,GAAGH,QAAQ,CAACI,iBAAiB,CAACL,UAAU,CAACM,UAAU,CAACC,OAAO,EAAE,IAAI,CAAC;EAC9E,IAAIH,MAA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wB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC+C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC7F","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","consola","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","forInternalUse","currentFilePath","object","requireObjectType","objectType","apiName","Error","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","_","remapStructType","JSON","multiplicity","nullable","primaryKeyApiName","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join","structType","output","entries","value"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.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 { ObjectTypeFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport type { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { GenerateContext } from \"../GenerateContext/GenerateContext.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\";\n\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(\n wireObject: ObjectTypeFullMetadata,\n { ontology, forInternalUse }: Pick<\n GenerateContext,\n \"ontology\" | \"forInternalUse\"\n >,\n currentFilePath: string,\n) {\n const object = ontology.requireObjectType(\n wireObject.objectType.apiName,\n true,\n );\n if (object instanceof ForeignType) {\n throw new Error(\"Should not be generating types for an external type\");\n }\n const uniqueLinkTargetTypes = new Set(\n wireObject.linkTypes.map(a =>\n ontology.requireObjectType(a.objectTypeApiName, false)\n ),\n );\n\n const definition = deleteUndefineds(\n wireObjectTypeFullMetadataToSdkObjectMetadata(\n object.raw,\n true,\n consola,\n ),\n );\n\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n\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\n const identifiers: Identifiers = {\n objectDefIdentifier: object.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n function getV2Types(\n object: EnhancedObjectType,\n forInternalUse: boolean = false,\n ) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\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 \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\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, \"OsdkInstance\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n\n const imports = getObjectImports(\n uniqueLinkTargetTypes,\n definition.apiName,\n currentFilePath,\n true,\n );\n\n return `${imports}${getV2Types(object, forInternalUse)}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\n\nexport interface Identifiers extends\n Record<\n | \"osdkObjectIdentifier\"\n | \"propertyKeysIdentifier\"\n | \"osdkObjectPropsIdentifier\"\n | \"objectDefIdentifier\"\n | \"osdkObjectLinksIdentifier\"\n | \"osdkObjectStrictPropsIdentifier\"\n | \"objectSetIdentifier\",\n string\n >\n{}\n\nexport function createOsdkObject(\n object: EnhancedObjectType | EnhancedInterfaceType,\n identifier: string,\n {\n osdkObjectPropsIdentifier,\n objectDefIdentifier,\n osdkObjectStrictPropsIdentifier,\n osdkObjectLinksIdentifier,\n }: Identifiers,\n) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > = ${identifier}<OPTIONS, K>;\n ;\n `;\n}\n\nexport function createObjectSet(\n object: EnhancedObjectType | EnhancedInterfaceType,\n {\n objectDefIdentifier,\n objectSetIdentifier,\n propertyKeysIdentifier,\n osdkObjectIdentifier,\n }: Identifiers,\n) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\n\nfunction maybeStripNamespace(\n type: EnhancedInterfaceType | EnhancedObjectType,\n q: string,\n) {\n if (\n type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)\n ) {\n return q.slice(type.apiNamespace.length + 1);\n } else {\n return q;\n }\n}\n\nexport function createProps(\n type: EnhancedInterfaceType | EnhancedObjectType,\n identifier: string,\n strict: boolean,\n): string {\n if (identifier === \"StrictProps\") {\n return `export type StrictProps = Props`;\n }\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${\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 (typeof propertyDefinition.type === \"object\"\n ? remapStructType(propertyDefinition.type)\n : `$PropType[${JSON.stringify(propertyDefinition.type)}]`)\n + `${propertyDefinition.multiplicity ? \"[]\" : \"\"}${\n propertyDefinition.nullable\n || (!strict\n && !(definition.type === \"object\"\n && definition.primaryKeyApiName === apiName))\n ? `| undefined`\n : \"\"\n }`,\n ] as [string, string];\n },\n })\n }\n }`;\n}\n\nexport function createDefinition(\n object: EnhancedObjectType | EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n identifier: string,\n {\n objectDefIdentifier,\n objectSetIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n osdkObjectLinksIdentifier,\n }: Identifiers,\n) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${\n object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`\n } {\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 ${\n stringify(definition, {\n links: (_value) =>\n `{\n ${\n stringify(definition.links, {\n \"*\": (definition) =>\n `$ObjectMetadata.Link<${\n ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)\n }, ${definition.multiplicity}>`,\n })\n }\n }`,\n properties: (_value) => (`{\n ${\n stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) =>\n [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${\n maybeStripNamespace(object, apiName)\n }\"`,\n `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, \"${\n propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"\n }\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ] as [string, string],\n })\n }\n }`),\n })\n }\n } \n}\n `;\n}\n\nexport function createLinks(\n ontology: EnhancedOntologyDefinition,\n object: EnhancedObjectType | EnhancedInterfaceType,\n identifier: string,\n) {\n const definition = object.getCleanedUpDefinition(true);\n\n return `\n ${\n Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${\n stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(\n definition.targetType,\n )\n .getImportedDefinitionIdentifier(true);\n\n return [\n `readonly ${key}`,\n `${\n definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`\n }\n `,\n ];\n },\n })\n }\n }\n `\n }`;\n}\n\nexport function createPropertyKeys(\n type: EnhancedObjectType | EnhancedInterfaceType,\n) {\n const properties = Object.keys(type.getCleanedUpDefinition(true).properties);\n return `export type PropertyKeys = ${\n properties.length === 0\n ? \"never\"\n : properties.map(\n (a) => maybeStripNamespace(type, a),\n ).map(a => `\"${a}\"`).join(\"|\")\n };`;\n}\n\nfunction remapStructType(structType: Record<string, any>): string {\n let output = `{`;\n Object.entries(structType).map(([key, value]) =>\n output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`\n );\n output += \"}\";\n return output;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,OAAOC,OAAO,MAAM,SAAS;AAE7B,SAASC,kBAAkB,QAAQ,0CAA0C;AAE7E,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;;AAEhD;AACA,OAAO,SAASC,kCAAkCA,CAChDC,UAAkC,EAClC;EAAEC,QAAQ;EAAEC;AAGZ,CAAC,EACDC,eAAuB,EACvB;EACA,MAAMC,MAAM,GAAGH,QAAQ,CAACI,iBAAiB,CACvCL,UAAU,CAACM,UAAU,CAACC,OAAO,EAC7B,IACF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AsB,CAAC,IAAI,CAAC,CAACS,UAAU,CAAC;EAC5E,OAAO,8BACLA,UAAU,CAACF,MAAM,KAAK,CAAC,GACnB,OAAO,GACPE,UAAU,CAACjC,GAAG,CACbC,CAAC,IAAKwB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CACpC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAACgD,IAAI,CAAC,GAAG,CAAC,GAC/B;AACL;AAEA,SAASZ,eAAeA,CAACa,UAA+B,EAAU;EAChE,IAAIC,MAAM,GAAG,GAAG;EAChBN,MAAM,CAACO,OAAO,CAACF,UAAU,CAAC,CAAClD,GAAG,CAAC,CAAC,CAAC+C,GAAG,EAAEM,KAAK,CAAC,KAC1CF,MAAM,IAAI,GAAGJ,GAAG,cAAcT,IAAI,CAACpD,SAAS,CAACmE,KAAK,CAAC,cACrD,CAAC;EACDF,MAAM,IAAI,GAAG;EACb,OAAOA,MAAM;AACf","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import invariant from "tiny-invariant";
|
|
17
18
|
export function validateWireOntologyAssumptions(ontology) {
|
|
18
19
|
invariantNotStartWithDollarSign(ontology.ontology.apiName);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","process","env","NODE_ENV","startsWith"],"sources":["validateWireOntologyAssumptions.
|
|
1
|
+
{"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","process","env","NODE_ENV","startsWith"],"sources":["validateWireOntologyAssumptions.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 invariant from \"tiny-invariant\";\nimport type { WireOntologyDefinition } from \"./WireOntologyDefinition.js\";\n\nexport function validateWireOntologyAssumptions(\n ontology: WireOntologyDefinition,\n): void {\n invariantNotStartWithDollarSign(ontology.ontology.apiName);\n\n for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {\n invariantMapKeyMatchesApiName(objectKey, objectType.objectType);\n invariantNotStartWithDollarSign(objectType.objectType.apiName);\n\n for (\n const [propertyKey, propertyType] of Object.entries(\n objectType.objectType.properties,\n )\n ) {\n invariantNotStartWithDollarSign(propertyKey);\n }\n }\n}\n\nfunction invariantMapKeyMatchesApiName(\n key: string,\n value: { apiName: string },\n) {\n invariant(\n key === value.apiName,\n \"Key in the map should be the same as the apiName.\",\n );\n}\nfunction invariantNotStartWithDollarSign(value: string) {\n invariant(\n !value.startsWith(\"$\"),\n \"apiName should not start with $\",\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AAGtC,OAAO,SAASC,+BAA+BA,CAC7CC,QAAgC,EAC1B;EACNC,+BAA+B,CAACD,QAAQ,CAACA,QAAQ,CAACE,OAAO,CAAC;EAE1D,KAAK,MAAM,CAACC,SAAS,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IAC1EC,6BAA6B,CAACL,SAAS,EAAEC,UAAU,CAACA,UAAU,CAAC;IAC/DH,+BAA+B,CAACG,UAAU,CAACA,UAAU,CAACF,OAAO,CAAC;IAE9D,KACE,MAAM,CAACO,WAAW,EAAEC,YAAY,CAAC,IAAIL,MAAM,CAACC,OAAO,CACjDF,UAAU,CAACA,UAAU,CAACO,UACxB,CAAC,EACD;MACAV,+BAA+B,CAACQ,WAAW,CAAC;IAC9C;EACF;AACF;AAEA,SAASD,6BAA6BA,CACpCI,GAAW,EACXC,KAA0B,EAC1B;EACA,EACED,GAAG,KAAKC,KAAK,CAACX,OAAO,IAAAY,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADvBlB,SAAS,QAEP,mDAAmD,IAFrDA,SAAS;AAIX;AACA,SAASG,+BAA+BA,CAACY,KAAa,EAAE;EACtD,CACE,CAACA,KAAK,CAACI,UAAU,CAAC,GAAG,CAAC,GAAAH,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBADxBlB,SAAS,QAEP,iCAAiC,IAFnCA,SAAS;AAIX","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,kCAAkC,iCAAkC;AAElF,iBAAiB,cAAc;CAC7B;;CAEA,kBAAkB;AACnB","names":[],"sources":["../../../src/GenerateContext/EnhanceCommon.ts"],"version":3,"file":"EnhanceCommon.d.ts"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ActionTypeV2, LogicRule } from "@osdk/foundry.ontologies";
|
|
2
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
3
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
4
|
+
export declare class EnhancedAction extends EnhancedBase<ActionTypeV2> {
|
|
5
|
+
raw: ActionTypeV2;
|
|
6
|
+
constructor(common: EnhanceCommon, raw: ActionTypeV2);
|
|
7
|
+
get description(): string | undefined;
|
|
8
|
+
get parameters(): ActionTypeV2["parameters"];
|
|
9
|
+
get operations(): LogicRule[];
|
|
10
|
+
get paramsIdentifier(): string;
|
|
11
|
+
get definitionIdentifier(): string;
|
|
12
|
+
get definitionParamsIdentifier(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,cAAc,iBAAiB,0BAA2B;AACxE,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,oBAAoB,mBAAoB;AAEjD,OAAO,cAAM,uBAAuB,aAAa,cAAc;CAC1B,KAAY;CAA/C,YAAYA,QAAQ,eAAsBC,KAAK;CAI/C,IAAI;CAIJ,IAAI,cAAc,aAAa;CAI/B,IAAI,cAAc;CAIlB,IAAI;CAIJ,IAAI;CAIJ,IAAI;AAGL","names":["common: EnhanceCommon","raw: ActionTypeV2"],"sources":["../../../src/GenerateContext/EnhancedAction.ts"],"version":3,"file":"EnhancedAction.d.ts"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
2
|
+
export declare abstract class AbstractImportable {
|
|
3
|
+
protected _common: EnhanceCommon;
|
|
4
|
+
shortApiName: string;
|
|
5
|
+
fullApiName: string;
|
|
6
|
+
apiNamespace: string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Either a path relative to the ourDir (e.g. "./ontology/objects/foo.js") or a normal
|
|
9
|
+
* module import (e.g. "@something/foo")/
|
|
10
|
+
*/
|
|
11
|
+
importPath: string;
|
|
12
|
+
uniqueImportName: string;
|
|
13
|
+
constructor(common: EnhanceCommon, fullApiName: string, basePath: string, isLocal?: boolean);
|
|
14
|
+
getImportPathRelTo: (filePath: string) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare abstract class EnhancedBase<T> extends AbstractImportable {
|
|
17
|
+
raw: T;
|
|
18
|
+
constructor(common: EnhanceCommon, raw: T, fullApiName: string, basePath: string);
|
|
19
|
+
}
|
|
20
|
+
export declare function extractNamespace(fqApiName: string): [string | undefined, string];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAiBA,cAAc,qBAAqB,oBAAqB;AAExD,OAAO,uBAAe,mBAAmB;CACvC,UAAU,SAAS;CAEnB;CACA;CACA;;;;;CAMA;CACA;CAEA,YACEA,QAAQ,eACRC,qBACAC,kBACAC;CAiBF,qBAAsBC;AAcvB;AAED,OAAO,uBAAe,aAAa,WAAW,mBAAmB;CAC/D,KAAK;CAEL,YACEJ,QAAQ,eACRK,KAAK,GACLJ,qBACAC;AAKH;AAED,OAAO,iBAAS,iBACdI","names":["common: EnhanceCommon","fullApiName: string","basePath: string","isLocal: boolean","filePath: string","raw: T","fqApiName: string"],"sources":["../../../src/GenerateContext/EnhancedBase.ts"],"version":3,"file":"EnhancedBase.d.ts"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { InterfaceMetadata } from "@osdk/api";
|
|
2
|
+
import type { InterfaceType } from "@osdk/foundry.ontologies";
|
|
3
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
4
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
5
|
+
export declare class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {
|
|
6
|
+
raw: InterfaceType;
|
|
7
|
+
constructor(common: EnhanceCommon, raw: InterfaceType);
|
|
8
|
+
getDefinitionIdentifier(v2: boolean): string;
|
|
9
|
+
getImportedDefinitionIdentifier(v2: boolean): string;
|
|
10
|
+
get properties(): InterfaceType["properties"];
|
|
11
|
+
getCleanedUpDefinition(v2: boolean): InterfaceMetadata;
|
|
12
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,yBAAyB,WAAY;AACnD,cAAc,qBAAqB,0BAA2B;AAG9D,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,oBAAoB,mBAAoB;AAEjD,OAAO,cAAM,8BAA8B,aAAa,eAAe;CAClC,KAAY;CAA/C,YAAYA,QAAQ,eAAsBC,KAAK;CAI/C,wBAAwBC;CAIxB,gCAAgCA;CAIhC,IAAI,cAAc,cAAc;CAIhC,uBAAuBA,cAAc;AAQtC","names":["common: EnhanceCommon","raw: InterfaceType","v2: boolean"],"sources":["../../../src/GenerateContext/EnhancedInterfaceType.ts"],"version":3,"file":"EnhancedInterfaceType.d.ts"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ObjectMetadata } from "@osdk/api";
|
|
2
|
+
import type { ObjectTypeFullMetadata } from "@osdk/foundry.ontologies";
|
|
3
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
4
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
5
|
+
export declare class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {
|
|
6
|
+
raw: ObjectTypeFullMetadata;
|
|
7
|
+
constructor(common: EnhanceCommon, raw: ObjectTypeFullMetadata);
|
|
8
|
+
getDefinitionIdentifier(v2: boolean): string;
|
|
9
|
+
getImportedDefinitionIdentifier(v2: boolean): string;
|
|
10
|
+
getCleanedUpDefinition(v2: boolean): ObjectMetadata;
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,sBAAsB,WAAY;AAChD,cAAc,8BAA8B,0BAA2B;AAGvE,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,oBAAoB,mBAAoB;AAEjD,OAAO,cAAM,2BAA2B,aAAa,wBAAwB;CACxC,KAAY;CAA/C,YAAYA,QAAQ,eAAsBC,KAAK;CAI/C,wBAAwBC;CAIxB,gCAAgCA;CAIhC,uBAAuBA,cAAc;AAQtC","names":["common: EnhanceCommon","raw: ObjectTypeFullMetadata","v2: boolean"],"sources":["../../../src/GenerateContext/EnhancedObjectType.ts"],"version":3,"file":"EnhancedObjectType.d.ts"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { OntologyV2 } from "@osdk/foundry.ontologies";
|
|
2
|
+
import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
|
|
3
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
4
|
+
import { EnhancedAction } from "./EnhancedAction.js";
|
|
5
|
+
import { EnhancedInterfaceType } from "./EnhancedInterfaceType.js";
|
|
6
|
+
import { EnhancedObjectType } from "./EnhancedObjectType.js";
|
|
7
|
+
import { EnhancedQuery } from "./EnhancedQuery.js";
|
|
8
|
+
import { EnhancedSharedPropertyType } from "./EnhancedSharedPropertyType.js";
|
|
9
|
+
import { ForeignType } from "./ForeignType.js";
|
|
10
|
+
type RequiredType<K extends "objectTypes" | "actionTypes" | "interfaceTypes" | "queryTypes" | "sharedPropertyTypes"> = <L extends boolean = false>(fullApiName: string, localOnly?: L) => L extends true ? EnhancedOntologyDefinition[K][string] : ForeignType;
|
|
11
|
+
export declare class EnhancedOntologyDefinition {
|
|
12
|
+
#private;
|
|
13
|
+
ontology: OntologyV2;
|
|
14
|
+
objectTypes: Record<string, EnhancedObjectType | ForeignType>;
|
|
15
|
+
actionTypes: Record<string, EnhancedAction>;
|
|
16
|
+
queryTypes: Record<string, EnhancedQuery>;
|
|
17
|
+
interfaceTypes: Record<string, EnhancedInterfaceType | ForeignType>;
|
|
18
|
+
sharedPropertyTypes: Record<string, EnhancedSharedPropertyType | ForeignType>;
|
|
19
|
+
raw: WireOntologyDefinition;
|
|
20
|
+
common: EnhanceCommon;
|
|
21
|
+
constructor(raw: WireOntologyDefinition, importExt: string, externalObjects?: Map<string, string>, externalInterfaces?: Map<string, string>, externalSpts?: Map<string, string>);
|
|
22
|
+
requireObjectType: RequiredType<"objectTypes">;
|
|
23
|
+
requireInterfaceType: RequiredType<"interfaceTypes">;
|
|
24
|
+
requireActionType: RequiredType<"actionTypes">;
|
|
25
|
+
requireQueryType: RequiredType<"queryTypes">;
|
|
26
|
+
requireSharedPropertyType: RequiredType<"sharedPropertyTypes">;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,kBAAkB,0BAA2B;AAC3D,cAAc,8BAA8B,8BAA+B;AAC3E,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,sBAAsB,qBAAsB;AAErD,SAAS,6BAA6B,4BAA6B;AACnE,SAAS,0BAA0B,yBAA0B;AAC7D,SAAS,qBAAqB,oBAAqB;AACnD,SAAS,kCAAkC,iCAAkC;AAC7E,SAAS,mBAAmB,kBAAmB;KAE1C,aACH,UACI,gBACA,gBACA,mBACA,eACA,0BAEJ,oBAAoB,OAEpBA,qBACAC,YAAY,MACT,UAAU,OAAO,2BAA2B,aAAa;AAE9D,OAAO,cAAM,2BAA2B;;CACtC,UAAU;CACV,aAAa,eAAe,qBAAqB;CACjD,aAAa,eAAe;CAC5B,YAAY,eAAe;CAC3B,gBAAgB,eAEd,wBAAwB;CAE1B,qBAAqB,eAEnB,6BAA6B;CAI/B,KAAK;CACL,QAAQ;CAER,YACEC,KAAK,wBACLC,mBACAC,kBAAkB,qBAClBC,qBAAqB,qBACrBC,eAAe;CAiEjB,AAAO,mBAAmB,aAAa;CAEvC,AAAO,sBAAsB,aAAa;CAE1C,AAAO,mBAAmB,aAAa;CAEvC,AAAO,kBAAkB,aAAa;CAEtC,AAAO,2BAA2B,aAAa;AAIhD","names":["fullApiName: string","localOnly?: L","raw: WireOntologyDefinition","importExt: string","externalObjects?: Map<string, string>","externalInterfaces?: Map<string, string>","externalSpts?: Map<string, string>"],"sources":["../../../src/GenerateContext/EnhancedOntologyDefinition.ts"],"version":3,"file":"EnhancedOntologyDefinition.d.ts"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryDataType, QueryTypeV2 } from "@osdk/foundry.ontologies";
|
|
2
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
3
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
4
|
+
export declare class EnhancedQuery extends EnhancedBase<QueryTypeV2> {
|
|
5
|
+
raw: QueryTypeV2;
|
|
6
|
+
constructor(common: EnhanceCommon, raw: QueryTypeV2);
|
|
7
|
+
get description(): string | undefined;
|
|
8
|
+
get parameters(): QueryTypeV2["parameters"];
|
|
9
|
+
get output(): QueryDataType;
|
|
10
|
+
get paramsIdentifier(): string;
|
|
11
|
+
get definitionIdentifier(): string;
|
|
12
|
+
get definitionParamsIdentifier(): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,eAAe,mBAAmB,0BAA2B;AAC3E,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,oBAAoB,mBAAoB;AAEjD,OAAO,cAAM,sBAAsB,aAAa,aAAa;CACxB,KAAY;CAA/C,YAAYA,QAAQ,eAAsBC,KAAK;CAI/C,IAAI;CAIJ,IAAI,cAAc,YAAY;CAI9B,IAAI,UAAU;CAId,IAAI;CAIJ,IAAI;CAIJ,IAAI;AAGL","names":["common: EnhanceCommon","raw: QueryTypeV2"],"sources":["../../../src/GenerateContext/EnhancedQuery.ts"],"version":3,"file":"EnhancedQuery.d.ts"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SharedPropertyType } from "@osdk/foundry.ontologies";
|
|
2
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
3
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
4
|
+
export declare class EnhancedSharedPropertyType extends EnhancedBase<SharedPropertyType> {
|
|
5
|
+
raw: SharedPropertyType;
|
|
6
|
+
constructor(common: EnhanceCommon, raw: SharedPropertyType);
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,0BAA0B,0BAA2B;AACnE,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,oBAAoB,mBAAoB;AAEjD,OAAO,cAAM,mCACH,aAAa,oBACvB;CACqC,KAAY;CAA/C,YAAYA,QAAQ,eAAsBC,KAAK;AAGhD","names":["common: EnhanceCommon","raw: SharedPropertyType"],"sources":["../../../src/GenerateContext/EnhancedSharedPropertyType.ts"],"version":3,"file":"EnhancedSharedPropertyType.d.ts"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EnhanceCommon } from "./EnhanceCommon.js";
|
|
2
|
+
import { AbstractImportable } from "./EnhancedBase.js";
|
|
3
|
+
export declare class ForeignType extends AbstractImportable {
|
|
4
|
+
_common: EnhanceCommon;
|
|
5
|
+
constructor(_common: EnhanceCommon, apiNamespace: string | undefined, shortApiName: string, destinationPackage: string);
|
|
6
|
+
getImportedDefinitionIdentifier(v2: boolean): string;
|
|
7
|
+
getDefinitionIdentifier(v2: boolean): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,qBAAqB,oBAAqB;AACxD,SAAS,0BAA0B,mBAAoB;AAEvD,OAAO,cAAM,oBAAoB,mBAAmB;CAEhD,SAAgB;CADlB,YACSA,SAAS,eAChBC,kCACAC,sBACAC;CAUF,gCAAgCC;CAMhC,wBAAwBA;AAGzB","names":["_common: EnhanceCommon","apiNamespace: string | undefined","shortApiName: string","destinationPackage: string","v2: boolean"],"sources":["../../../src/GenerateContext/ForeignType.ts"],"version":3,"file":"ForeignType.d.ts"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MinimalFs } from "../MinimalFs.js";
|
|
2
|
+
import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
|
|
3
|
+
import type { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
|
|
4
|
+
export interface GenerateContext {
|
|
5
|
+
sanitizedOntology: WireOntologyDefinition;
|
|
6
|
+
ontology: EnhancedOntologyDefinition;
|
|
7
|
+
importExt?: string;
|
|
8
|
+
fs: MinimalFs;
|
|
9
|
+
outDir: string;
|
|
10
|
+
ontologyApiNamespace?: string | undefined;
|
|
11
|
+
apiNamespacePackageMap?: Map<string, string>;
|
|
12
|
+
forInternalUse?: boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,iBAAiB,iBAAkB;AACjD,cAAc,8BAA8B,8BAA+B;AAC3E,cAAc,kCAAkC,iCAAkC;AAElF,iBAAiB,gBAAgB;CAC/B,mBAAmB;CACnB,UAAU;CAEV;CACA,IAAI;CAEJ;CAEA;CACA,yBAAyB;CACzB;AACD","names":[],"sources":["../../../src/GenerateContext/GenerateContext.ts"],"version":3,"file":"GenerateContext.d.ts"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WireOntologyDefinition } from "../WireOntologyDefinition.js";
|
|
2
|
+
import { EnhancedOntologyDefinition } from "./EnhancedOntologyDefinition.js";
|
|
3
|
+
export declare function enhanceOntology({ sanitized, importExt, externalObjects, externalInterfaces, externalSpts }: {
|
|
4
|
+
sanitized: WireOntologyDefinition
|
|
5
|
+
externalObjects?: Map<string, string>
|
|
6
|
+
externalInterfaces?: Map<string, string>
|
|
7
|
+
externalSpts?: Map<string, string>
|
|
8
|
+
importExt: string
|
|
9
|
+
}): EnhancedOntologyDefinition;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"mappings":"AAgBA,cAAc,8BAA8B,8BAA+B;AAC3E,SAAS,kCAAkC,iCAAkC;AAE7E,OAAO,iBAAS,gBACd,EACE,WACA,WACA,iBACA,oBACA,cAOD,EANE;CACD,WAAW;CACX,kBAAkB;CAClB,qBAAqB;CACrB,eAAe;CACf;AACD,IACA","names":[],"sources":["../../../src/GenerateContext/enhanceOntology.ts"],"version":3,"file":"enhanceOntology.d.ts"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface MinimalFs {
|
|
2
|
+
mkdir: (path: string, options?: {
|
|
3
|
+
recursive: boolean
|
|
4
|
+
}) => Promise<void>;
|
|
5
|
+
writeFile: WriteFileFn;
|
|
6
|
+
readdir: ReaddirFn;
|
|
7
|
+
}
|
|
8
|
+
export type WriteFileFn = (path: string, contents: string) => Promise<void>;
|
|
9
|
+
export type ReaddirFn = (path: string) => Promise<string[]>;
|