@osdk/generator 2.1.0-beta.3 → 2.1.0-beta.30
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 +293 -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 +1 -1
- 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 +1 -1
- 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 +3 -2
- 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 +8 -6
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +22 -20
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +7 -3
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +572 -557
- 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 +33 -10
- 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 +6 -3
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js +2 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +6 -5
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +9 -8
- 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 +23 -10
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/browser/validateWireOntologyAssumptions.js +3 -2
- package/build/browser/validateWireOntologyAssumptions.js.map +1 -1
- package/build/cjs/index.cjs +1384 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +31 -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 +1 -1
- 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 +1 -1
- 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 +3 -2
- 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 +8 -6
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +22 -20
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +7 -3
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +572 -557
- 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 +33 -10
- 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 +6 -3
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js +2 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +6 -5
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +9 -8
- 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 +23 -10
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/esm/validateWireOntologyAssumptions.js +3 -2
- package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
- package/build/types/GenerateContext/EnhanceCommon.d.ts +6 -0
- package/build/types/GenerateContext/EnhancedAction.d.ts +13 -0
- package/build/types/GenerateContext/EnhancedBase.d.ts +20 -0
- package/build/types/GenerateContext/EnhancedInterfaceType.d.ts +12 -0
- package/build/{esm → types}/GenerateContext/EnhancedObjectType.d.ts +5 -6
- package/build/types/GenerateContext/EnhancedOntologyDefinition.d.ts +28 -0
- package/build/types/GenerateContext/EnhancedQuery.d.ts +13 -0
- package/build/{browser → types}/GenerateContext/EnhancedSharedPropertyType.d.ts +2 -3
- package/build/types/GenerateContext/ForeignType.d.ts +8 -0
- package/build/types/GenerateContext/GenerateContext.d.ts +13 -0
- package/build/types/GenerateContext/enhanceOntology.d.ts +9 -0
- package/build/types/MinimalFs.d.ts +7 -0
- package/build/{browser → types}/WireOntologyDefinition.d.ts +1 -3
- package/build/types/generateClientSdkPackage.d.ts +31 -0
- package/build/types/generateClientSdkPackage.test.d.ts +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/{browser → types}/shared/apiNamespaces/startsWithApiNamespace.d.ts +0 -1
- package/build/types/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +1 -0
- package/build/{browser → types}/shared/getObjectImports.d.ts +2 -2
- package/build/{browser → types}/shared/getObjectTypeApiNamesFromQuery.d.ts +0 -1
- package/build/{browser → types}/shared/getObjectTypesFromQueryDataType.d.ts +0 -1
- package/build/{browser → types}/shared/propertyJsdoc.d.ts +2 -3
- package/build/types/shared/sanitizeMetadata.d.ts +1 -0
- package/build/types/shared/sanitizeMetadata.test.d.ts +1 -0
- package/build/{browser → types}/util/InMemoryFs.d.ts +2 -3
- package/build/{browser → types}/util/commaSeparatedIdentifiers.d.ts +0 -1
- package/build/{browser → types}/util/commaSeparatedTypeIdentifiers.d.ts +0 -1
- package/build/{browser → types}/util/deleteUndefineds.d.ts +0 -1
- package/build/{browser → types}/util/reservedKeywords.d.ts +0 -1
- package/build/{browser → types}/util/stringUnionFrom.d.ts +0 -1
- package/build/types/util/stringify.d.ts +20 -0
- package/build/types/util/test/TodoWireOntology.d.ts +2 -0
- package/build/{browser → types}/util/test/compileThis.d.ts +0 -1
- package/build/types/util/test/createMockMinimalFiles.d.ts +10 -0
- package/build/{browser → types}/util/test/formatTs.d.ts +0 -1
- package/build/types/util/verifyOutDir.d.ts +8 -0
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +1 -0
- package/build/types/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +1 -0
- package/build/{esm → types}/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -2
- package/build/types/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +1 -0
- package/build/{browser → types}/v2.0/generateMetadata.d.ts +0 -1
- package/build/{esm → types}/v2.0/generatePerActionDataFiles.d.ts +1 -2
- package/build/types/v2.0/generatePerActionDataFiles.test.d.ts +1 -0
- package/build/types/v2.0/generatePerInterfaceDataFiles.d.ts +1 -0
- package/build/{esm → types}/v2.0/generatePerObjectDataFiles.d.ts +0 -1
- package/build/{browser → types}/v2.0/generatePerQueryDataFiles.d.ts +2 -5
- package/build/types/v2.0/generatePerQueryDataFiles.test.d.ts +1 -0
- package/build/{esm → types}/v2.0/generateRootIndexTsFile.d.ts +0 -1
- package/build/{browser → types}/v2.0/getDescriptionIfPresent.d.ts +0 -1
- package/build/{browser → types}/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +4 -6
- package/build/{browser → types}/validateWireOntologyAssumptions.d.ts +0 -1
- package/package.json +29 -13
- 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.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 -13
- 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.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.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.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 -13
- 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.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","getFiles","toMatchInlineSnapshot","writeFile","rootFileNames","Object","keys","console","log","files","forEach","fileName","version","servicesHost","getScriptFileNames","getScriptVersion","toString","getScriptSnapshot","undefined","ScriptSnapshot","fromString","getCurrentDirectory","getCompilationSettings","getDefaultLibFileName","options","getDefaultLibFilePath","fileExists","path","readFile","readDirectory","extensions","exclude","include","depth","sys","directoryExists","getDirectories","langServices","createLanguageService","q","getDocCommentTemplateAtPosition","createDocumentRegistry","actionTypes","interfaceTypes","objectTypes","apiName","description","displayName","rid","queryTypes","doThing","parameters","foo","dataType","type","paramStruct","fields","name","fieldType","output","sharedPropertyTypes"],"sources":["generatePerQueryDataFiles.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as ts from \"typescript\";\nimport { describe, expect, it } from \"vitest\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { createMockMinimalFiles } from \"../util/test/createMockMinimalFiles.js\";\nimport { TodoWireOntology } from \"../util/test/TodoWireOntology.js\";\nimport { generatePerQueryDataFilesV2 } from \"./generatePerQueryDataFiles.js\";\ndescribe(\"generatePerQueryDataFiles\", () => {\n it(\"is stable v2\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: TodoWireOntology,\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()).toMatchInlineSnapshot(`\n {\n \"/foo/ontology/queries.ts\": \"export { getCount } from './queries/getCount.js';\n export { returnsTodo } from './queries/returnsTodo.js';\n \",\n \"/foo/ontology/queries/getCount.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace getCount {\n export interface Signature {\n (query: getCount.Parameters): Promise<getCount.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly completed: QueryParam.PrimitiveType<'boolean'>;\n }\n\n export type ReturnType = QueryResult.PrimitiveType<'integer'>;\n }\n\n export interface getCount extends QueryDefinition<getCount.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'getCount';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n completed: {\n nullable: false;\n type: 'boolean';\n };\n };\n output: {\n nullable: false;\n type: 'integer';\n };\n signature: getCount.Signature;\n };\n apiName: 'getCount';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const getCount: getCount = {\n apiName: 'getCount',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n \"/foo/ontology/queries/returnsTodo.ts\": \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n import type { Todo } from '../objects/Todo.js';\n\n export namespace returnsTodo {\n export interface Signature {\n (query: returnsTodo.Parameters): Promise<returnsTodo.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * description: Random desc so we test jsdoc\n */\n readonly someTodo: QueryParam.ObjectType<Todo>;\n }\n\n export type ReturnType = QueryResult.ObjectType<Todo>;\n }\n\n export interface returnsTodo extends QueryDefinition<returnsTodo.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'returnsTodo';\n rid: 'rid.query.2';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * description: Random desc so we test jsdoc\n */\n someTodo: {\n description: 'Random desc so we test jsdoc';\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n };\n output: {\n nullable: false;\n object: 'Todo';\n type: 'object';\n __OsdkTargetType?: Todo;\n };\n signature: returnsTodo.Signature;\n };\n apiName: 'returnsTodo';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const returnsTodo: returnsTodo = {\n apiName: 'returnsTodo',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \",\n }\n `);\n await helper.minimalFiles.writeFile(\"/bar/test.ts\", `\n import {returnsTodo} from \"/foo/ontology/queries/returnsTodo.ts\";\n\n returnsTodo({someTodo:/*marker*/})\n `);\n const rootFileNames = Object.keys(helper.getFiles());\n console.log(rootFileNames);\n const files = {};\n // initialize the list of files\n rootFileNames.forEach(fileName => {\n files[fileName] = { version: 0 };\n });\n const servicesHost = {\n getScriptFileNames: () => Object.keys(helper.getFiles()),\n getScriptVersion: fileName => files[fileName] && files[fileName].version.toString(),\n getScriptSnapshot: fileName => {\n if (!helper.getFiles()[fileName]) {\n return undefined;\n }\n return ts.ScriptSnapshot.fromString(helper.getFiles()[fileName]);\n },\n getCurrentDirectory: () => \"/bar\",\n getCompilationSettings: () => ({}),\n getDefaultLibFileName: options => ts.getDefaultLibFilePath(options),\n fileExists: (path) => {\n console.log(path);\n return helper.getFiles()[path] !== undefined;\n },\n readFile: (path) => {\n console.log(\"readFile: \", path);\n return helper.getFiles()[path];\n },\n readDirectory: (path, extensions, exclude, include, depth) => {\n console.log(\"readDirectory\", path);\n return ts.sys.readDirectory(path, extensions, exclude, include, depth);\n },\n directoryExists: ts.sys.directoryExists,\n getDirectories: ts.sys.getDirectories,\n };\n const langServices = ts.createLanguageService(servicesHost);\n const q = langServices.getDocCommentTemplateAtPosition(\"/bar/test.ts\", 1);\n console.log(q);\n ts.createDocumentRegistry();\n });\n it(\"generates structs for queries\", async () => {\n const helper = createMockMinimalFiles();\n const BASE_PATH = \"/foo\";\n await generatePerQueryDataFilesV2({\n fs: helper.minimalFiles,\n ontology: enhanceOntology({\n sanitized: {\n actionTypes: {},\n interfaceTypes: {},\n objectTypes: {},\n ontology: {\n apiName: \"foo\",\n description: \"foo\",\n displayName: \"foo\",\n rid: \"ri.foo\",\n },\n queryTypes: {\n doThing: {\n rid: \"rid.query.1\",\n version: \"0\",\n apiName: \"doThing\",\n parameters: {\n foo: {\n dataType: { type: \"string\" },\n },\n paramStruct: {\n dataType: {\n type: \"struct\",\n fields: [\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n output: {\n type: \"struct\",\n fields: [\n {\n name: \"aString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"anInteger\",\n fieldType: { type: \"integer\" },\n },\n {\n name: \"aLong\",\n fieldType: { type: \"long\" },\n },\n {\n name: \"aDate\",\n fieldType: { type: \"date\" },\n },\n {\n name: \"nestedStruct\",\n fieldType: {\n type: \"struct\",\n fields: [\n {\n name: \"nestedString\",\n fieldType: { type: \"string\" },\n },\n {\n name: \"nestedInteger\",\n fieldType: { type: \"integer\" },\n },\n ],\n },\n },\n ],\n },\n },\n },\n sharedPropertyTypes: {},\n },\n importExt: \".js\",\n externalObjects: new Map(),\n externalInterfaces: new Map(),\n externalSpts: new Map(),\n }),\n outDir: BASE_PATH,\n importExt: \".js\",\n }, true);\n expect(helper.getFiles()[\"/foo/ontology/queries/doThing.ts\"])\n .toMatchInlineSnapshot(`\n \"import type { QueryDefinition, VersionBound } from '@osdk/api';\n import type { QueryParam, QueryResult } from '@osdk/api';\n import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';\n import { $osdkMetadata } from '../../OntologyMetadata.js';\n\n export namespace doThing {\n export interface Signature {\n (query: doThing.Parameters): Promise<doThing.ReturnType>;\n }\n\n export interface Parameters {\n /**\n * (no ontology metadata)\n */\n readonly foo: QueryParam.PrimitiveType<'string'>;\n\n /**\n * (no ontology metadata)\n */\n readonly paramStruct: {\n readonly aDate: QueryParam.PrimitiveType<'datetime'>;\n\n readonly nestedStruct: {\n readonly nestedInteger: QueryParam.PrimitiveType<'integer'>;\n\n readonly nestedString: QueryParam.PrimitiveType<'string'>;\n };\n };\n }\n\n export interface ReturnType {\n aDate: QueryResult.PrimitiveType<'datetime'>;\n\n aLong: QueryResult.PrimitiveType<'long'>;\n\n anInteger: QueryResult.PrimitiveType<'integer'>;\n\n aString: QueryResult.PrimitiveType<'string'>;\n\n nestedStruct: {\n nestedInteger: QueryResult.PrimitiveType<'integer'>;\n\n nestedString: QueryResult.PrimitiveType<'string'>;\n };\n }\n }\n\n export interface doThing extends QueryDefinition<doThing.Signature>, VersionBound<$ExpectedClientVersion> {\n __DefinitionMetadata?: {\n apiName: 'doThing';\n rid: 'rid.query.1';\n type: 'query';\n version: '0';\n parameters: {\n /**\n * (no ontology metadata)\n */\n foo: {\n nullable: false;\n type: 'string';\n };\n /**\n * (no ontology metadata)\n */\n paramStruct: {\n nullable: false;\n struct: {\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n };\n output: {\n nullable: false;\n struct: {\n aString: {\n type: 'string';\n nullable: false;\n };\n anInteger: {\n type: 'integer';\n nullable: false;\n };\n aLong: {\n type: 'long';\n nullable: false;\n };\n aDate: {\n type: 'date';\n nullable: false;\n };\n nestedStruct: {\n type: 'struct';\n struct: {\n nestedString: {\n type: 'string';\n nullable: false;\n };\n nestedInteger: {\n type: 'integer';\n nullable: false;\n };\n };\n nullable: false;\n };\n };\n type: 'struct';\n };\n signature: doThing.Signature;\n };\n apiName: 'doThing';\n type: 'query';\n version: '0';\n osdkMetadata: typeof $osdkMetadata;\n }\n\n export const doThing: doThing = {\n apiName: 'doThing',\n type: 'query',\n version: '0',\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AAC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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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S,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,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 { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
|
|
17
18
|
import { EnhancedObjectType } from "../GenerateContext/EnhancedObjectType.js";
|
|
18
19
|
import { ForeignType } from "../GenerateContext/ForeignType.js";
|
|
@@ -20,9 +21,11 @@ import { getObjectImports } from "../shared/getObjectImports.js";
|
|
|
20
21
|
import { propertyJsdoc } from "../shared/propertyJsdoc.js";
|
|
21
22
|
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
22
23
|
import { stringify } from "../util/stringify.js";
|
|
24
|
+
|
|
23
25
|
/** @internal */
|
|
24
26
|
export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
25
|
-
ontology
|
|
27
|
+
ontology,
|
|
28
|
+
forInternalUse
|
|
26
29
|
}, currentFilePath) {
|
|
27
30
|
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
28
31
|
if (object instanceof ForeignType) {
|
|
@@ -48,19 +51,19 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
48
51
|
propertyKeysIdentifier
|
|
49
52
|
};
|
|
50
53
|
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
51
|
-
return `${imports}${function (object) {
|
|
54
|
+
return `${imports}${function (object, forInternalUse = false) {
|
|
52
55
|
return `import type {
|
|
53
56
|
PropertyKeys as $PropertyKeys,
|
|
54
57
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
55
58
|
ObjectMetadata as $ObjectMetadata,
|
|
56
|
-
} from "@osdk/api";
|
|
59
|
+
} from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
|
|
57
60
|
import type {
|
|
58
61
|
ObjectSet as $ObjectSet,
|
|
59
62
|
Osdk as $Osdk,
|
|
60
63
|
OsdkObject as $OsdkObject,
|
|
61
64
|
PropertyValueWireToClient as $PropType,
|
|
62
65
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
63
|
-
} from "@osdk/api";
|
|
66
|
+
} from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
|
|
64
67
|
|
|
65
68
|
|
|
66
69
|
export namespace ${object.shortApiName} {
|
|
@@ -82,7 +85,7 @@ export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
82
85
|
|
|
83
86
|
${createDefinition(object, ontology, object.shortApiName, identifiers)}
|
|
84
87
|
`;
|
|
85
|
-
}(object)}
|
|
88
|
+
}(object, forInternalUse)}
|
|
86
89
|
|
|
87
90
|
export const ${object.shortApiName}: ${objectDefIdentifier}
|
|
88
91
|
= {
|
|
@@ -100,7 +103,7 @@ export function createOsdkObject(object, identifier, {
|
|
|
100
103
|
object.getCleanedUpDefinition(true);
|
|
101
104
|
return `
|
|
102
105
|
export type ${identifier}<
|
|
103
|
-
OPTIONS extends never | "$
|
|
106
|
+
OPTIONS extends never | "$rid" = never,
|
|
104
107
|
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
105
108
|
>
|
|
106
109
|
= $Osdk.Instance<
|
|
@@ -112,7 +115,7 @@ export function createOsdkObject(object, identifier, {
|
|
|
112
115
|
|
|
113
116
|
/** @deprecated use ${identifier} */
|
|
114
117
|
export type OsdkObject<
|
|
115
|
-
OPTIONS extends never | "$
|
|
118
|
+
OPTIONS extends never | "$rid" = never,
|
|
116
119
|
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
117
120
|
> = ${identifier}<OPTIONS, K>;
|
|
118
121
|
;
|
|
@@ -143,6 +146,9 @@ function maybeStripNamespace(type, q) {
|
|
|
143
146
|
}
|
|
144
147
|
}
|
|
145
148
|
export function createProps(type, identifier, strict) {
|
|
149
|
+
if (identifier === "StrictProps") {
|
|
150
|
+
return `export type StrictProps = Props`;
|
|
151
|
+
}
|
|
146
152
|
const definition = type.getCleanedUpDefinition(true);
|
|
147
153
|
return `export interface ${identifier} {
|
|
148
154
|
${stringify(definition.properties, {
|
|
@@ -150,7 +156,7 @@ ${stringify(definition.properties, {
|
|
|
150
156
|
return [`readonly "${maybeStripNamespace(type, apiName)}"${
|
|
151
157
|
// after we convert everything over we can do this:
|
|
152
158
|
// !strict || propertyDefinition.nullable ? "?" : ""
|
|
153
|
-
""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]
|
|
159
|
+
""}`, (typeof propertyDefinition.type === "object" ? `${remapStructType(propertyDefinition.type)}` : `$PropType[${JSON.stringify(propertyDefinition.type)}]`) + `${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict && !(definition.type === "object" && definition.primaryKeyApiName === apiName) ? `| undefined` : ""}`];
|
|
154
160
|
}
|
|
155
161
|
})}
|
|
156
162
|
}`;
|
|
@@ -183,7 +189,7 @@ export function createDefinition(object, ontology, identifier, {
|
|
|
183
189
|
${stringify(definition.properties, {
|
|
184
190
|
"*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
|
|
185
191
|
apiName
|
|
186
|
-
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef
|
|
192
|
+
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<${JSON.stringify(propertyDefinition.type)}, "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
|
|
187
193
|
})}
|
|
188
194
|
}`
|
|
189
195
|
})}
|
|
@@ -207,6 +213,13 @@ ${stringify(definition.links, {
|
|
|
207
213
|
`}`;
|
|
208
214
|
}
|
|
209
215
|
export function createPropertyKeys(type) {
|
|
210
|
-
|
|
216
|
+
const properties = Object.keys(type.getCleanedUpDefinition(true).properties);
|
|
217
|
+
return `export type PropertyKeys = ${properties.length === 0 ? "never" : properties.map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
|
|
218
|
+
}
|
|
219
|
+
function remapStructType(structType) {
|
|
220
|
+
let output = `{`;
|
|
221
|
+
Object.entries(structType).map(([key, value]) => output += `${key}:$PropType[${JSON.stringify(value)}]|undefined;`);
|
|
222
|
+
output += "}";
|
|
223
|
+
return output;
|
|
211
224
|
}
|
|
212
225
|
//# sourceMappingURL=wireObjectTypeV2ToSdkObjectConstV2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","ForeignType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","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","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 }, 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) {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectMetadata as $ObjectMetadata,\n } from \"@osdk/api\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"@osdk/api\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"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)}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n > \n = $Osdk.Instance<\n ${objectDefIdentifier}, \n OPTIONS,\n K\n >;\n \n\n /** @deprecated use ${identifier} */\n export type OsdkObject<\n OPTIONS extends never | \"$notStrict\" | \"$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 const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable || !strict ? `| undefined` : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`} {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectMetadata.Link<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<\"${propertyDefinition.type}\", \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,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;AAAS,CAAC,EAAEC,eAAe,EAAE;EAC1F,MAAMC,MAAM,GAAGF,QAAQ,CAACG,iBAAiB,CAACJ,UAAU,CAACK,UAAU,CAACC,OAAO,EAAE,IAAI,CAAC;EAC9E,IAAIH,MAAM,YAAYT,WAAW,EAAE;IAC/B,MAAM,IAAIa,KAAK,CAAC,qDAAqD,CAAC;EAC1E;EACA,MAAMC,qBAAqB,GAAG,IAAIC,GAAG,CAACT,UAAU,CAACU,SAAS,CAACC,GAAG,CAACC,CAAC,IAAIX,QAAQ,CAACG,iBAAiB,CAACQ,CAAC,CAACC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;EAC5H,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U;AACrC,EAAEpC,SAAS,CAACgB,UAAU,CAACqC,KAAK,EAAE;IAClB,GAAG,EAAEN,CAAC/B,UAAU,EAAEiC,CAAC,EAAES,GAAG,KAAK;MACzB,MAAMC,UAAU,GAAGxD,QAAQ,CAACG,iBAAiB,CAACU,UAAU,CAACsC,UAAU,CAAC,CAC/DC,+BAA+B,CAAC,IAAI,CAAC;MAC1C,OAAO,CACH,YAAYG,GAAG,EAAE,EACjB,GAAG1C,UAAU,CAACmC,YAAY,GACpB,GAAGQ,UAAU,YAAY,GACzB,uBAAuBA,UAAU,GAAG;AAC9D,WAAW,CACM;IACL;EACJ,CAAC,CAAC;AACV;AACA,KAAK,EAAE;AACP;AACA,OAAO,SAAS9B,kBAAkBA,CAACU,IAAI,EAAE;EACrC,OAAO,8BAA8BiB,MAAM,CAACC,IAAI,CAAClB,IAAI,CAACF,sBAAsB,CAAC,IAAI,CAAC,CAACS,UAAU,CAAC,CAACjC,GAAG,CAAEC,CAAC,IAAKwB,mBAAmB,CAACC,IAAI,EAAEzB,CAAC,CAAC,CAAC,CAACD,GAAG,CAACC,CAAC,IAAI,IAAIA,CAAC,GAAG,CAAC,CAAC8C,IAAI,CAAC,GAAG,CAAC,GAAG;AAC3K","ignoreList":[]}
|
|
1
|
+
{"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","_","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 { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport type { ObjectTypeFullMetadata } from \"@osdk/internal.foundry.core\";\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 ),\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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
* 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);
|
|
@@ -25,9 +26,9 @@ export function validateWireOntologyAssumptions(ontology) {
|
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
function invariantMapKeyMatchesApiName(key, value) {
|
|
28
|
-
!(key === value.apiName) ? invariant(false, "Key in the map should be the same as the apiName.") : void 0;
|
|
29
|
+
!(key === value.apiName) ? process.env.NODE_ENV !== "production" ? invariant(false, "Key in the map should be the same as the apiName.") : invariant(false) : void 0;
|
|
29
30
|
}
|
|
30
31
|
function invariantNotStartWithDollarSign(value) {
|
|
31
|
-
!!value.startsWith("$") ? invariant(false, "apiName should not start with $") : void 0;
|
|
32
|
+
!!value.startsWith("$") ? process.env.NODE_ENV !== "production" ? invariant(false, "apiName should not start with $") : invariant(false) : void 0;
|
|
32
33
|
}
|
|
33
34
|
//# sourceMappingURL=validateWireOntologyAssumptions.js.map
|
|
@@ -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","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":[]}
|