@osdk/generator 1.14.0-beta.4 → 2.0.0-beta.11
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 +86 -0
- package/build/browser/index.js +352 -1850
- package/build/browser/index.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedAction.d.ts +5 -5
- package/build/esm/GenerateContext/EnhancedAction.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedBase.d.ts +2 -2
- package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +4 -4
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts +3 -3
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts +7 -7
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedQuery.d.ts +5 -5
- package/build/esm/GenerateContext/EnhancedQuery.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts +3 -3
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -1
- package/build/esm/WireOntologyDefinition.d.ts +2 -2
- package/build/esm/WireOntologyDefinition.d.ts.map +1 -1
- package/build/esm/generateClientSdkPackage.d.ts +6 -26
- package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
- package/build/esm/index.d.ts +0 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +352 -1850
- package/build/esm/index.js.map +1 -1
- package/build/esm/shared/getEditedEntities.d.ts +1 -1
- package/build/esm/shared/getEditedEntities.d.ts.map +1 -1
- package/build/esm/shared/getObjectImports.d.ts.map +1 -1
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts +1 -1
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -1
- package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts +1 -1
- package/build/esm/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -1
- package/build/esm/shared/wireActionTypeV2ToSdkActionDefinition.d.ts +1 -1
- package/build/esm/shared/wireActionTypeV2ToSdkActionDefinition.d.ts.map +1 -1
- package/build/esm/util/test/TodoWireOntology.d.ts +14 -0
- package/build/esm/util/test/TodoWireOntology.d.ts.map +1 -1
- package/build/esm/util/test/formatTs.d.ts.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/getDescriptionIfPresent.d.ts +2 -0
- package/build/esm/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/package.json +9 -13
- package/build/cjs/GenerateContext/EnhanceCommon.d.cts +0 -9
- package/build/cjs/GenerateContext/EnhanceCommon.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedAction.d.cts +0 -14
- package/build/cjs/GenerateContext/EnhancedAction.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedBase.d.cts +0 -23
- package/build/cjs/GenerateContext/EnhancedBase.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedInterfaceType.d.cts +0 -13
- package/build/cjs/GenerateContext/EnhancedInterfaceType.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedObjectType.d.cts +0 -12
- package/build/cjs/GenerateContext/EnhancedObjectType.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedOntologyDefinition.d.cts +0 -27
- package/build/cjs/GenerateContext/EnhancedOntologyDefinition.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedQuery.d.cts +0 -14
- package/build/cjs/GenerateContext/EnhancedQuery.d.ts.map +0 -1
- package/build/cjs/GenerateContext/EnhancedSharedPropertyType.d.cts +0 -8
- package/build/cjs/GenerateContext/EnhancedSharedPropertyType.d.ts.map +0 -1
- package/build/cjs/GenerateContext/ForeignType.d.cts +0 -10
- package/build/cjs/GenerateContext/ForeignType.d.ts.map +0 -1
- package/build/cjs/GenerateContext/GenerateContext.d.cts +0 -13
- package/build/cjs/GenerateContext/GenerateContext.d.ts.map +0 -1
- package/build/cjs/GenerateContext/enhanceOntology.d.cts +0 -4
- package/build/cjs/GenerateContext/enhanceOntology.d.ts.map +0 -1
- package/build/cjs/MinimalFs.d.cts +0 -10
- package/build/cjs/MinimalFs.d.ts.map +0 -1
- package/build/cjs/WireOntologyDefinition.d.cts +0 -4
- package/build/cjs/WireOntologyDefinition.d.ts.map +0 -1
- package/build/cjs/generateClientSdkPackage.d.cts +0 -72
- package/build/cjs/generateClientSdkPackage.d.ts.map +0 -1
- package/build/cjs/generateClientSdkPackage.test.d.cts +0 -2
- package/build/cjs/generateClientSdkPackage.test.d.ts.map +0 -1
- package/build/cjs/index.cjs +0 -2928
- package/build/cjs/index.cjs.map +0 -1
- package/build/cjs/index.d.cts +0 -6
- package/build/cjs/index.d.ts.map +0 -1
- package/build/cjs/shared/apiNamespaces/startsWithApiNamespace.d.cts +0 -2
- package/build/cjs/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +0 -1
- package/build/cjs/shared/apiNamespaces/startsWithApiNamespace.test.d.cts +0 -2
- package/build/cjs/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +0 -1
- package/build/cjs/shared/getEditedEntities.d.cts +0 -7
- package/build/cjs/shared/getEditedEntities.d.ts.map +0 -1
- package/build/cjs/shared/getObjectImports.d.cts +0 -4
- package/build/cjs/shared/getObjectImports.d.ts.map +0 -1
- package/build/cjs/shared/getObjectTypeApiNamesFromQuery.d.cts +0 -4
- package/build/cjs/shared/getObjectTypeApiNamesFromQuery.d.ts.map +0 -1
- package/build/cjs/shared/getObjectTypesFromQueryDataType.d.cts +0 -3
- package/build/cjs/shared/getObjectTypesFromQueryDataType.d.ts.map +0 -1
- package/build/cjs/shared/isNullableQueryDataType.d.cts +0 -3
- package/build/cjs/shared/isNullableQueryDataType.d.ts.map +0 -1
- package/build/cjs/shared/propertyJsdoc.d.cts +0 -6
- package/build/cjs/shared/propertyJsdoc.d.ts.map +0 -1
- package/build/cjs/shared/sanitizeMetadata.d.cts +0 -2
- package/build/cjs/shared/sanitizeMetadata.d.ts.map +0 -1
- package/build/cjs/shared/sanitizeMetadata.test.d.cts +0 -2
- package/build/cjs/shared/sanitizeMetadata.test.d.ts.map +0 -1
- package/build/cjs/shared/wireActionTypeV2ToSdkActionDefinition.d.cts +0 -4
- package/build/cjs/shared/wireActionTypeV2ToSdkActionDefinition.d.ts.map +0 -1
- package/build/cjs/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.cts +0 -4
- package/build/cjs/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +0 -1
- package/build/cjs/shared/wireQueryTypeV2ToSdkQueryDefinition.d.cts +0 -12
- package/build/cjs/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +0 -1
- package/build/cjs/util/InMemoryFs.d.cts +0 -7
- package/build/cjs/util/InMemoryFs.d.ts.map +0 -1
- package/build/cjs/util/commaSeparatedIdentifiers.d.cts +0 -2
- package/build/cjs/util/commaSeparatedIdentifiers.d.ts.map +0 -1
- package/build/cjs/util/commaSeparatedTypeIdentifiers.d.cts +0 -2
- package/build/cjs/util/commaSeparatedTypeIdentifiers.d.ts.map +0 -1
- package/build/cjs/util/deleteUndefineds.d.cts +0 -2
- package/build/cjs/util/deleteUndefineds.d.ts.map +0 -1
- package/build/cjs/util/reservedKeywords.d.cts +0 -2
- package/build/cjs/util/reservedKeywords.d.ts.map +0 -1
- package/build/cjs/util/stringUnionFrom.d.cts +0 -2
- package/build/cjs/util/stringUnionFrom.d.ts.map +0 -1
- package/build/cjs/util/stringify.d.cts +0 -20
- package/build/cjs/util/stringify.d.ts.map +0 -1
- package/build/cjs/util/test/TodoWireOntology.d.cts +0 -203
- package/build/cjs/util/test/TodoWireOntology.d.ts.map +0 -1
- package/build/cjs/util/test/compileThis.d.cts +0 -3
- package/build/cjs/util/test/compileThis.d.ts.map +0 -1
- package/build/cjs/util/test/createMockMinimalFiles.d.cts +0 -13
- package/build/cjs/util/test/createMockMinimalFiles.d.ts.map +0 -1
- package/build/cjs/util/test/formatTs.d.cts +0 -2
- package/build/cjs/util/test/formatTs.d.ts.map +0 -1
- package/build/cjs/util/verifyOutDir.d.cts +0 -9
- package/build/cjs/util/verifyOutDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/generateOAuthDistDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/generateOAuthDistDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/generateOntologyRuntimeDistDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/generateOntologyRuntimeDistDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-oauth-dist/generatePublicClientDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-oauth-dist/generatePublicClientDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-oauth-dist/generateUserTokenDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-oauth-dist/generateUserTokenDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateAggregationsAggregations.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateAggregationsAggregations.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateGroupBy.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateGroupBy.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateMetrics.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateMetrics.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateAttachmentsDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateAttachmentsDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateGeoshapesDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateGeoshapesDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateObjectSetDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateObjectSetDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateSharedObjectCode.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateSharedObjectCode.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateTimeSeriesDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateTimeSeriesDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateClientDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateClientDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateCommonDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateCommonDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateFiltersDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateFiltersDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generatePagingDir.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generatePagingDir.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateErrors.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateErrors.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateOntologyMetadata.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateOntologyMetadata.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateResult.d.cts +0 -3
- package/build/cjs/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateResult.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/util/reexportConsts.d.cts +0 -2
- package/build/cjs/v1.1/backcompat/util/reexportConsts.d.ts.map +0 -1
- package/build/cjs/v1.1/backcompat/util/reexportTypes.d.cts +0 -2
- package/build/cjs/v1.1/backcompat/util/reexportTypes.d.ts.map +0 -1
- package/build/cjs/v1.1/generateActions.d.cts +0 -6
- package/build/cjs/v1.1/generateActions.d.ts.map +0 -1
- package/build/cjs/v1.1/generateActions.test.d.cts +0 -2
- package/build/cjs/v1.1/generateActions.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateBackCompatDeprecatedExports.d.cts +0 -3
- package/build/cjs/v1.1/generateBackCompatDeprecatedExports.d.ts.map +0 -1
- package/build/cjs/v1.1/generateBatchActions.d.cts +0 -4
- package/build/cjs/v1.1/generateBatchActions.d.ts.map +0 -1
- package/build/cjs/v1.1/generateBatchActions.test.d.cts +0 -2
- package/build/cjs/v1.1/generateBatchActions.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateBulkActions.d.cts +0 -4
- package/build/cjs/v1.1/generateBulkActions.d.ts.map +0 -1
- package/build/cjs/v1.1/generateBulkActions.test.d.cts +0 -2
- package/build/cjs/v1.1/generateBulkActions.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateClientSdkVersionOneDotOne.d.cts +0 -4
- package/build/cjs/v1.1/generateClientSdkVersionOneDotOne.d.ts.map +0 -1
- package/build/cjs/v1.1/generateClientSdkVersionOneDotOne.test.d.cts +0 -2
- package/build/cjs/v1.1/generateClientSdkVersionOneDotOne.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateFoundryClientFile.d.cts +0 -3
- package/build/cjs/v1.1/generateFoundryClientFile.d.ts.map +0 -1
- package/build/cjs/v1.1/generateFoundryClientFile.test.d.cts +0 -2
- package/build/cjs/v1.1/generateFoundryClientFile.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateIndexFile.d.cts +0 -3
- package/build/cjs/v1.1/generateIndexFile.d.ts.map +0 -1
- package/build/cjs/v1.1/generateMetadataFile.d.cts +0 -4
- package/build/cjs/v1.1/generateMetadataFile.d.ts.map +0 -1
- package/build/cjs/v1.1/generateMetadataFile.test.d.cts +0 -2
- package/build/cjs/v1.1/generateMetadataFile.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateObjectsInterfaceFile.d.cts +0 -4
- package/build/cjs/v1.1/generateObjectsInterfaceFile.d.ts.map +0 -1
- package/build/cjs/v1.1/generateObjectsInterfaceFile.test.d.cts +0 -2
- package/build/cjs/v1.1/generateObjectsInterfaceFile.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateObjectsInterfaceSupportFiles.d.cts +0 -4
- package/build/cjs/v1.1/generateObjectsInterfaceSupportFiles.d.ts.map +0 -1
- package/build/cjs/v1.1/generateObjectsInterfaceSupportFiles.test.d.cts +0 -2
- package/build/cjs/v1.1/generateObjectsInterfaceSupportFiles.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateOntologyIndexFile.d.cts +0 -3
- package/build/cjs/v1.1/generateOntologyIndexFile.d.ts.map +0 -1
- package/build/cjs/v1.1/generatePerActionDataFilesV1.d.cts +0 -3
- package/build/cjs/v1.1/generatePerActionDataFilesV1.d.ts.map +0 -1
- package/build/cjs/v1.1/generatePerActionDataFilesV1.test.d.cts +0 -2
- package/build/cjs/v1.1/generatePerActionDataFilesV1.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generatePerObjectInterfaceAndDataFiles.d.cts +0 -4
- package/build/cjs/v1.1/generatePerObjectInterfaceAndDataFiles.d.ts.map +0 -1
- package/build/cjs/v1.1/generatePerObjectInterfaceAndDataFiles.test.d.cts +0 -2
- package/build/cjs/v1.1/generatePerObjectInterfaceAndDataFiles.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generatePerQueryDataFiles.d.cts +0 -4
- package/build/cjs/v1.1/generatePerQueryDataFiles.d.ts.map +0 -1
- package/build/cjs/v1.1/generatePerQueryDataFiles.test.d.cts +0 -2
- package/build/cjs/v1.1/generatePerQueryDataFiles.test.d.ts.map +0 -1
- package/build/cjs/v1.1/generateQueries.d.cts +0 -4
- package/build/cjs/v1.1/generateQueries.d.ts.map +0 -1
- package/build/cjs/v1.1/generateQueries.test.d.cts +0 -2
- package/build/cjs/v1.1/generateQueries.test.d.ts.map +0 -1
- package/build/cjs/v1.1/wireObjectTypeV2ToSdkObjectConstV1.d.cts +0 -2
- package/build/cjs/v1.1/wireObjectTypeV2ToSdkObjectConstV1.d.ts.map +0 -1
- package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.cts +0 -4
- package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +0 -1
- package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.d.cts +0 -2
- package/build/cjs/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.d.ts.map +0 -1
- package/build/cjs/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.cts +0 -2
- package/build/cjs/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +0 -1
- package/build/cjs/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.cts +0 -2
- package/build/cjs/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +0 -1
- package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.d.cts +0 -4
- package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +0 -1
- package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.test.d.cts +0 -2
- package/build/cjs/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +0 -1
- package/build/cjs/v2.0/generateMetadata.d.cts +0 -3
- package/build/cjs/v2.0/generateMetadata.d.ts.map +0 -1
- package/build/cjs/v2.0/generatePerActionDataFiles.d.cts +0 -3
- package/build/cjs/v2.0/generatePerActionDataFiles.d.ts.map +0 -1
- package/build/cjs/v2.0/generatePerActionDataFiles.test.d.cts +0 -2
- package/build/cjs/v2.0/generatePerActionDataFiles.test.d.ts.map +0 -1
- package/build/cjs/v2.0/generatePerQueryDataFiles.d.cts +0 -9
- package/build/cjs/v2.0/generatePerQueryDataFiles.d.ts.map +0 -1
- package/build/cjs/v2.0/generatePerQueryDataFiles.test.d.cts +0 -2
- package/build/cjs/v2.0/generatePerQueryDataFiles.test.d.ts.map +0 -1
- package/build/cjs/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.cts +0 -13
- package/build/cjs/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +0 -1
- package/build/cjs/validateWireOntologyAssumptions.d.cts +0 -3
- package/build/cjs/validateWireOntologyAssumptions.d.ts.map +0 -1
- package/build/esm/shared/isNullableQueryDataType.d.ts +0 -3
- package/build/esm/shared/isNullableQueryDataType.d.ts.map +0 -1
- package/build/esm/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +0 -4
- package/build/esm/shared/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +0 -1
- package/build/esm/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts +0 -12
- package/build/esm/shared/wireQueryTypeV2ToSdkQueryDefinition.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/generateOAuthDistDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/generateOAuthDistDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/generateOntologyRuntimeDistDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/generateOntologyRuntimeDistDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-oauth-dist/generatePublicClientDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-oauth-dist/generatePublicClientDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-oauth-dist/generateUserTokenDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-oauth-dist/generateUserTokenDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateAggregationsAggregations.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateAggregationsAggregations.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateGroupBy.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateGroupBy.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateMetrics.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/aggregations/generateMetrics.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateAttachmentsDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateAttachmentsDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateGeoshapesDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateGeoshapesDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateObjectSetDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateObjectSetDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateSharedObjectCode.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateSharedObjectCode.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateTimeSeriesDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/baseTypes/generateTimeSeriesDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateClientDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateClientDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateCommonDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateCommonDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateFiltersDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateFiltersDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generatePagingDir.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generatePagingDir.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateErrors.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateErrors.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateOntologyMetadata.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateOntologyMetadata.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateResult.d.ts +0 -3
- package/build/esm/v1.1/backcompat/internal-foundry-ontology-runtime-dist/ontologyProvider/generateResult.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/util/reexportConsts.d.ts +0 -2
- package/build/esm/v1.1/backcompat/util/reexportConsts.d.ts.map +0 -1
- package/build/esm/v1.1/backcompat/util/reexportTypes.d.ts +0 -2
- package/build/esm/v1.1/backcompat/util/reexportTypes.d.ts.map +0 -1
- package/build/esm/v1.1/generateActions.d.ts +0 -6
- package/build/esm/v1.1/generateActions.d.ts.map +0 -1
- package/build/esm/v1.1/generateActions.test.d.ts +0 -2
- package/build/esm/v1.1/generateActions.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateBackCompatDeprecatedExports.d.ts +0 -3
- package/build/esm/v1.1/generateBackCompatDeprecatedExports.d.ts.map +0 -1
- package/build/esm/v1.1/generateBatchActions.d.ts +0 -4
- package/build/esm/v1.1/generateBatchActions.d.ts.map +0 -1
- package/build/esm/v1.1/generateBatchActions.test.d.ts +0 -2
- package/build/esm/v1.1/generateBatchActions.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateBulkActions.d.ts +0 -4
- package/build/esm/v1.1/generateBulkActions.d.ts.map +0 -1
- package/build/esm/v1.1/generateBulkActions.test.d.ts +0 -2
- package/build/esm/v1.1/generateBulkActions.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateClientSdkVersionOneDotOne.d.ts +0 -4
- package/build/esm/v1.1/generateClientSdkVersionOneDotOne.d.ts.map +0 -1
- package/build/esm/v1.1/generateClientSdkVersionOneDotOne.test.d.ts +0 -2
- package/build/esm/v1.1/generateClientSdkVersionOneDotOne.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateFoundryClientFile.d.ts +0 -3
- package/build/esm/v1.1/generateFoundryClientFile.d.ts.map +0 -1
- package/build/esm/v1.1/generateFoundryClientFile.test.d.ts +0 -2
- package/build/esm/v1.1/generateFoundryClientFile.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateIndexFile.d.ts +0 -3
- package/build/esm/v1.1/generateIndexFile.d.ts.map +0 -1
- package/build/esm/v1.1/generateMetadataFile.d.ts +0 -4
- package/build/esm/v1.1/generateMetadataFile.d.ts.map +0 -1
- package/build/esm/v1.1/generateMetadataFile.test.d.ts +0 -2
- package/build/esm/v1.1/generateMetadataFile.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateObjectsInterfaceFile.d.ts +0 -4
- package/build/esm/v1.1/generateObjectsInterfaceFile.d.ts.map +0 -1
- package/build/esm/v1.1/generateObjectsInterfaceFile.test.d.ts +0 -2
- package/build/esm/v1.1/generateObjectsInterfaceFile.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateObjectsInterfaceSupportFiles.d.ts +0 -4
- package/build/esm/v1.1/generateObjectsInterfaceSupportFiles.d.ts.map +0 -1
- package/build/esm/v1.1/generateObjectsInterfaceSupportFiles.test.d.ts +0 -2
- package/build/esm/v1.1/generateObjectsInterfaceSupportFiles.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateOntologyIndexFile.d.ts +0 -3
- package/build/esm/v1.1/generateOntologyIndexFile.d.ts.map +0 -1
- package/build/esm/v1.1/generatePerActionDataFilesV1.d.ts +0 -3
- package/build/esm/v1.1/generatePerActionDataFilesV1.d.ts.map +0 -1
- package/build/esm/v1.1/generatePerActionDataFilesV1.test.d.ts +0 -2
- package/build/esm/v1.1/generatePerActionDataFilesV1.test.d.ts.map +0 -1
- package/build/esm/v1.1/generatePerObjectInterfaceAndDataFiles.d.ts +0 -4
- package/build/esm/v1.1/generatePerObjectInterfaceAndDataFiles.d.ts.map +0 -1
- package/build/esm/v1.1/generatePerObjectInterfaceAndDataFiles.test.d.ts +0 -2
- package/build/esm/v1.1/generatePerObjectInterfaceAndDataFiles.test.d.ts.map +0 -1
- package/build/esm/v1.1/generatePerQueryDataFiles.d.ts +0 -4
- package/build/esm/v1.1/generatePerQueryDataFiles.d.ts.map +0 -1
- package/build/esm/v1.1/generatePerQueryDataFiles.test.d.ts +0 -2
- package/build/esm/v1.1/generatePerQueryDataFiles.test.d.ts.map +0 -1
- package/build/esm/v1.1/generateQueries.d.ts +0 -4
- package/build/esm/v1.1/generateQueries.d.ts.map +0 -1
- package/build/esm/v1.1/generateQueries.test.d.ts +0 -2
- package/build/esm/v1.1/generateQueries.test.d.ts.map +0 -1
- package/build/esm/v1.1/wireObjectTypeV2ToSdkObjectConstV1.d.ts +0 -2
- package/build/esm/v1.1/wireObjectTypeV2ToSdkObjectConstV1.d.ts.map +0 -1
- package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts +0 -4
- package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.d.ts.map +0 -1
- package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.d.ts +0 -2
- package/build/esm/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.test.d.ts.map +0 -1
package/build/browser/index.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
-
import * as
|
|
3
|
-
import
|
|
4
|
-
import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from '@osdk/generator-converters';
|
|
2
|
+
import * as path5 from 'path';
|
|
3
|
+
import path5__default from 'path';
|
|
4
|
+
import { wireQueryTypeV2ToSdkQueryDefinitionNoParams, wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition, __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireObjectTypeFullMetadataToSdkObjectTypeDefinition } from '@osdk/generator-converters';
|
|
5
5
|
import { format } from 'prettier';
|
|
6
|
-
import organizeImports from 'prettier-plugin-organize-imports';
|
|
7
6
|
import fastDeepEqual from 'fast-deep-equal';
|
|
8
7
|
import invariant from 'tiny-invariant';
|
|
9
8
|
|
|
@@ -29,7 +28,7 @@ var AbstractImportable = class {
|
|
|
29
28
|
}
|
|
30
29
|
getImportPathRelTo = (filePath) => {
|
|
31
30
|
if (this.importPath.startsWith(".")) {
|
|
32
|
-
const result =
|
|
31
|
+
const result = path5.relative(path5.dirname(filePath), this.importPath);
|
|
33
32
|
if (result.startsWith(".")) {
|
|
34
33
|
return result;
|
|
35
34
|
} else {
|
|
@@ -41,9 +40,9 @@ var AbstractImportable = class {
|
|
|
41
40
|
};
|
|
42
41
|
};
|
|
43
42
|
var EnhancedBase = class extends AbstractImportable {
|
|
44
|
-
constructor(common,
|
|
43
|
+
constructor(common, raw, fullApiName, basePath) {
|
|
45
44
|
super(common, fullApiName, basePath);
|
|
46
|
-
this.
|
|
45
|
+
this.raw = raw;
|
|
47
46
|
if (!this.isLocal && !this.sourcePackage) {
|
|
48
47
|
throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
|
|
49
48
|
}
|
|
@@ -57,18 +56,18 @@ function extractNamespace(fqApiName) {
|
|
|
57
56
|
|
|
58
57
|
// src/GenerateContext/EnhancedAction.ts
|
|
59
58
|
var EnhancedAction = class extends EnhancedBase {
|
|
60
|
-
constructor(common,
|
|
61
|
-
super(common,
|
|
62
|
-
this.
|
|
59
|
+
constructor(common, raw) {
|
|
60
|
+
super(common, raw, raw.apiName, "./ontology/actions");
|
|
61
|
+
this.raw = raw;
|
|
63
62
|
}
|
|
64
63
|
get description() {
|
|
65
|
-
return this.
|
|
64
|
+
return this.raw.description;
|
|
66
65
|
}
|
|
67
66
|
get parameters() {
|
|
68
|
-
return this.
|
|
67
|
+
return this.raw.parameters;
|
|
69
68
|
}
|
|
70
69
|
get operations() {
|
|
71
|
-
return this.
|
|
70
|
+
return this.raw.operations;
|
|
72
71
|
}
|
|
73
72
|
get paramsIdentifier() {
|
|
74
73
|
return `${this.shortApiName}.Params`;
|
|
@@ -88,9 +87,9 @@ function deleteUndefineds(obj) {
|
|
|
88
87
|
|
|
89
88
|
// src/GenerateContext/EnhancedInterfaceType.ts
|
|
90
89
|
var EnhancedInterfaceType = class extends EnhancedBase {
|
|
91
|
-
constructor(common,
|
|
92
|
-
super(common,
|
|
93
|
-
this.
|
|
90
|
+
constructor(common, raw) {
|
|
91
|
+
super(common, raw, raw.apiName, "./ontology/interfaces");
|
|
92
|
+
this.raw = raw;
|
|
94
93
|
}
|
|
95
94
|
getDefinitionIdentifier(v2) {
|
|
96
95
|
return v2 ? this.shortApiName : `${this.shortApiName}Def`;
|
|
@@ -99,16 +98,16 @@ var EnhancedInterfaceType = class extends EnhancedBase {
|
|
|
99
98
|
return this.getDefinitionIdentifier(v2);
|
|
100
99
|
}
|
|
101
100
|
get properties() {
|
|
102
|
-
return this.
|
|
101
|
+
return this.raw.properties;
|
|
103
102
|
}
|
|
104
103
|
getCleanedUpDefinition(v2) {
|
|
105
|
-
return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.
|
|
104
|
+
return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));
|
|
106
105
|
}
|
|
107
106
|
};
|
|
108
107
|
var EnhancedObjectType = class extends EnhancedBase {
|
|
109
|
-
constructor(common,
|
|
110
|
-
super(common,
|
|
111
|
-
this.
|
|
108
|
+
constructor(common, raw) {
|
|
109
|
+
super(common, raw, raw.objectType.apiName, "./ontology/objects");
|
|
110
|
+
this.raw = raw;
|
|
112
111
|
}
|
|
113
112
|
getDefinitionIdentifier(v2) {
|
|
114
113
|
return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
|
|
@@ -117,24 +116,24 @@ var EnhancedObjectType = class extends EnhancedBase {
|
|
|
117
116
|
return this.getDefinitionIdentifier(v2);
|
|
118
117
|
}
|
|
119
118
|
getCleanedUpDefinition(v2) {
|
|
120
|
-
return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.
|
|
119
|
+
return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.raw, v2));
|
|
121
120
|
}
|
|
122
121
|
};
|
|
123
122
|
|
|
124
123
|
// src/GenerateContext/EnhancedQuery.ts
|
|
125
124
|
var EnhancedQuery = class extends EnhancedBase {
|
|
126
|
-
constructor(common,
|
|
127
|
-
super(common,
|
|
128
|
-
this.
|
|
125
|
+
constructor(common, raw) {
|
|
126
|
+
super(common, raw, raw.apiName, "./ontology/queries");
|
|
127
|
+
this.raw = raw;
|
|
129
128
|
}
|
|
130
129
|
get description() {
|
|
131
|
-
return this.
|
|
130
|
+
return this.raw.description;
|
|
132
131
|
}
|
|
133
132
|
get parameters() {
|
|
134
|
-
return this.
|
|
133
|
+
return this.raw.parameters;
|
|
135
134
|
}
|
|
136
135
|
get output() {
|
|
137
|
-
return this.
|
|
136
|
+
return this.raw.output;
|
|
138
137
|
}
|
|
139
138
|
get paramsIdentifier() {
|
|
140
139
|
return `${this.shortApiName}.Parameters`;
|
|
@@ -149,9 +148,9 @@ var EnhancedQuery = class extends EnhancedBase {
|
|
|
149
148
|
|
|
150
149
|
// src/GenerateContext/EnhancedSharedPropertyType.ts
|
|
151
150
|
var EnhancedSharedPropertyType = class extends EnhancedBase {
|
|
152
|
-
constructor(common,
|
|
153
|
-
super(common,
|
|
154
|
-
this.
|
|
151
|
+
constructor(common, raw) {
|
|
152
|
+
super(common, raw, raw.apiName, "./ontology/interfaces");
|
|
153
|
+
this.raw = raw;
|
|
155
154
|
}
|
|
156
155
|
};
|
|
157
156
|
|
|
@@ -176,20 +175,21 @@ var ForeignType = class extends AbstractImportable {
|
|
|
176
175
|
|
|
177
176
|
// src/GenerateContext/EnhancedOntologyDefinition.ts
|
|
178
177
|
var EnhancedOntologyDefinition = class {
|
|
179
|
-
|
|
178
|
+
#foreignTypes = {};
|
|
179
|
+
constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
|
|
180
180
|
this.common = {
|
|
181
181
|
apiNamespacePackageMap,
|
|
182
182
|
enhancedOntology: this,
|
|
183
183
|
importExt,
|
|
184
184
|
ontologyApiNamespace
|
|
185
185
|
};
|
|
186
|
-
this.
|
|
187
|
-
this.ontology =
|
|
188
|
-
this.objectTypes = remap(
|
|
189
|
-
this.actionTypes = remap(
|
|
190
|
-
this.queryTypes = remap(
|
|
191
|
-
this.interfaceTypes = remap(
|
|
192
|
-
this.sharedPropertyTypes = remap(
|
|
186
|
+
this.raw = raw;
|
|
187
|
+
this.ontology = raw.ontology;
|
|
188
|
+
this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
|
|
189
|
+
this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
|
|
190
|
+
this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
|
|
191
|
+
this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
|
|
192
|
+
this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
|
|
193
193
|
}
|
|
194
194
|
#createRequireType = (type) => {
|
|
195
195
|
return (fullApiName, localOnly) => {
|
|
@@ -202,7 +202,9 @@ var EnhancedOntologyDefinition = class {
|
|
|
202
202
|
if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
|
|
203
203
|
throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
|
|
204
204
|
}
|
|
205
|
-
|
|
205
|
+
const ret2 = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);
|
|
206
|
+
this.#foreignTypes[fullApiName] = ret2;
|
|
207
|
+
return ret2;
|
|
206
208
|
}
|
|
207
209
|
return ret;
|
|
208
210
|
};
|
|
@@ -239,6 +241,21 @@ function sanitizeMetadata(ontology) {
|
|
|
239
241
|
function camelize(name) {
|
|
240
242
|
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
241
243
|
}
|
|
244
|
+
function formatTs(contents) {
|
|
245
|
+
try {
|
|
246
|
+
return format(contents, {
|
|
247
|
+
parser: "typescript",
|
|
248
|
+
singleQuote: true,
|
|
249
|
+
trailingComma: "all",
|
|
250
|
+
tabWidth: 2,
|
|
251
|
+
printWidth: 120
|
|
252
|
+
});
|
|
253
|
+
} catch (e) {
|
|
254
|
+
console.error("Failed to format file", e);
|
|
255
|
+
console.log(contents);
|
|
256
|
+
return contents;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
242
259
|
|
|
243
260
|
// src/util/verifyOutDir.ts
|
|
244
261
|
async function verifyOutDir(outDir, fs2) {
|
|
@@ -253,6 +270,31 @@ async function verifyOutDir(outDir, fs2) {
|
|
|
253
270
|
}
|
|
254
271
|
}
|
|
255
272
|
}
|
|
273
|
+
var ExpectedOsdkVersion = "2.0.0";
|
|
274
|
+
async function generateOntologyMetadataFile({
|
|
275
|
+
fs: fs2,
|
|
276
|
+
outDir,
|
|
277
|
+
ontology,
|
|
278
|
+
ontologyApiNamespace
|
|
279
|
+
}, userAgent) {
|
|
280
|
+
fs2.writeFile(path5__default.join(outDir, "OntologyMetadata.ts"), await formatTs(`
|
|
281
|
+
export type $ExpectedClientVersion = "${ExpectedOsdkVersion}";
|
|
282
|
+
export const $osdkMetadata = { extraUserAgent: "${userAgent}" };
|
|
283
|
+
${ontologyApiNamespace == null ? `
|
|
284
|
+
export const $ontologyRid = "${ontology.ontology.rid}";
|
|
285
|
+
` : ""}
|
|
286
|
+
`));
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
// src/shared/getObjectImports.ts
|
|
290
|
+
function getObjectImports(objects, curApiName, currentFilePath, v2) {
|
|
291
|
+
return Array.from(objects).filter((obj) => obj.fullApiName !== curApiName).map((obj) => {
|
|
292
|
+
const defId = obj.getDefinitionIdentifier(v2);
|
|
293
|
+
const importedId = obj.getImportedDefinitionIdentifier(v2);
|
|
294
|
+
const nameOrAlias = defId === importedId ? defId : `${defId} as ${importedId}`;
|
|
295
|
+
return `import type { ${nameOrAlias} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
|
|
296
|
+
}).join("\n");
|
|
297
|
+
}
|
|
256
298
|
|
|
257
299
|
// src/shared/getEditedEntities.ts
|
|
258
300
|
function getModifiedEntityTypes(action) {
|
|
@@ -273,777 +315,6 @@ function getModifiedEntityTypes(action) {
|
|
|
273
315
|
modifiedObjects
|
|
274
316
|
};
|
|
275
317
|
}
|
|
276
|
-
function formatTs(contents) {
|
|
277
|
-
try {
|
|
278
|
-
return format(contents, {
|
|
279
|
-
parser: "typescript",
|
|
280
|
-
singleQuote: true,
|
|
281
|
-
trailingComma: "all",
|
|
282
|
-
plugins: [organizeImports],
|
|
283
|
-
tabWidth: 2,
|
|
284
|
-
printWidth: 120
|
|
285
|
-
});
|
|
286
|
-
} catch (e) {
|
|
287
|
-
console.error("Failed to format file", e);
|
|
288
|
-
console.log(contents);
|
|
289
|
-
return contents;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
// src/v1.1/generateActions.ts
|
|
294
|
-
async function generateActions(ontology, fs2, outDir, importExt = "") {
|
|
295
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
296
|
-
let actionSignatures = [];
|
|
297
|
-
for (const action of Object.values(ontology.actionTypes)) {
|
|
298
|
-
const entries = Object.entries(action.parameters);
|
|
299
|
-
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
300
|
-
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
301
|
-
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
302
|
-
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
303
|
-
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
304
|
-
let jsDocBlock = ["/**"];
|
|
305
|
-
if (action.description) {
|
|
306
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
307
|
-
}
|
|
308
|
-
let parameterBlock = "";
|
|
309
|
-
if (entries.length > 0) {
|
|
310
|
-
parameterBlock = `params: {
|
|
311
|
-
`;
|
|
312
|
-
for (const [parameterName, parameterData] of entries) {
|
|
313
|
-
parameterBlock += `"${parameterName}"`;
|
|
314
|
-
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
315
|
-
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
316
|
-
parameterBlock += `${typeScriptType};
|
|
317
|
-
`;
|
|
318
|
-
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
319
|
-
}
|
|
320
|
-
parameterBlock += "}, ";
|
|
321
|
-
}
|
|
322
|
-
jsDocBlock.push(`*/`);
|
|
323
|
-
actionSignatures.push(`
|
|
324
|
-
${jsDocBlock.join("\n")}
|
|
325
|
-
${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O):
|
|
326
|
-
Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;`);
|
|
327
|
-
}
|
|
328
|
-
await fs2.mkdir(outDir, {
|
|
329
|
-
recursive: true
|
|
330
|
-
});
|
|
331
|
-
await fs2.writeFile(path16__default.join(outDir, "Actions.ts"), await formatTs(`
|
|
332
|
-
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from "@osdk/legacy-client";
|
|
333
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
334
|
-
export interface Actions {
|
|
335
|
-
${actionSignatures.join("\n")}
|
|
336
|
-
}
|
|
337
|
-
`));
|
|
338
|
-
}
|
|
339
|
-
function getTypeScriptTypeFromDataType(actionParameter, importedObjects) {
|
|
340
|
-
switch (actionParameter.type) {
|
|
341
|
-
case "objectSet": {
|
|
342
|
-
const objectType = actionParameter.objectTypeApiName;
|
|
343
|
-
importedObjects.add(objectType);
|
|
344
|
-
return `ObjectSet<${objectType}>`;
|
|
345
|
-
}
|
|
346
|
-
case "object": {
|
|
347
|
-
const objectType = actionParameter.objectTypeApiName;
|
|
348
|
-
importedObjects.add(objectType);
|
|
349
|
-
return `${objectType} | ${objectType}["__primaryKey"]`;
|
|
350
|
-
}
|
|
351
|
-
case "array":
|
|
352
|
-
return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;
|
|
353
|
-
case "string":
|
|
354
|
-
return `string`;
|
|
355
|
-
case "boolean":
|
|
356
|
-
return `boolean`;
|
|
357
|
-
case "attachment":
|
|
358
|
-
return `Attachment`;
|
|
359
|
-
case "date":
|
|
360
|
-
return `LocalDate`;
|
|
361
|
-
case "double":
|
|
362
|
-
case "integer":
|
|
363
|
-
case "long":
|
|
364
|
-
return `number`;
|
|
365
|
-
case "timestamp":
|
|
366
|
-
return `Timestamp`;
|
|
367
|
-
case "marking":
|
|
368
|
-
return "string";
|
|
369
|
-
default:
|
|
370
|
-
throw new Error(`Unsupported action parameter type: ${actionParameter}`);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
// src/v1.1/backcompat/util/reexportConsts.ts
|
|
375
|
-
function reexportConsts(typesToExport) {
|
|
376
|
-
return `
|
|
377
|
-
import { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
|
|
378
|
-
|
|
379
|
-
${typesToExport.map((q) => `
|
|
380
|
-
/** @deprecated submodule imports aren't public api **/
|
|
381
|
-
export const ${q} = OG_${q};
|
|
382
|
-
`).join("\n\n")}
|
|
383
|
-
`;
|
|
384
|
-
}
|
|
385
|
-
|
|
386
|
-
// src/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.ts
|
|
387
|
-
async function generateConfidentialClientDir(fs2, oauthDistDir, importExt = "") {
|
|
388
|
-
const confidentialClientDistDir = path16__default.join(oauthDistDir, "ConfidentialClient");
|
|
389
|
-
await fs2.mkdir(confidentialClientDistDir, {
|
|
390
|
-
recursive: true
|
|
391
|
-
});
|
|
392
|
-
await fs2.writeFile(path16__default.join(confidentialClientDistDir, "index.ts"), await formatTs(`
|
|
393
|
-
export * from "./ConfidentialClientAuth${importExt}";
|
|
394
|
-
`));
|
|
395
|
-
await fs2.writeFile(path16__default.join(confidentialClientDistDir, "ConfidentialClientAuth.ts"), await formatTs(`
|
|
396
|
-
${reexportConsts(["ConfidentialClientAuth"])}
|
|
397
|
-
`));
|
|
398
|
-
}
|
|
399
|
-
async function generatePublicClientDir(fs2, oauthDistDir, importExt = "") {
|
|
400
|
-
const publicClientDistDir = path16__default.join(oauthDistDir, "PublicClient");
|
|
401
|
-
await fs2.mkdir(publicClientDistDir, {
|
|
402
|
-
recursive: true
|
|
403
|
-
});
|
|
404
|
-
await fs2.writeFile(path16__default.join(publicClientDistDir, "index.ts"), await formatTs(`
|
|
405
|
-
export * from "./PublicClientAuth${importExt}";
|
|
406
|
-
`));
|
|
407
|
-
await fs2.writeFile(path16__default.join(publicClientDistDir, "PublicClientAuth.ts"), await formatTs(`
|
|
408
|
-
${reexportConsts(["PublicClientAuth"])}
|
|
409
|
-
`));
|
|
410
|
-
}
|
|
411
|
-
async function generateUserTokenDir(fs2, oauthDistDir, importExt = "") {
|
|
412
|
-
const userTokenDistDir = path16__default.join(oauthDistDir, "UserToken");
|
|
413
|
-
await fs2.mkdir(userTokenDistDir, {
|
|
414
|
-
recursive: true
|
|
415
|
-
});
|
|
416
|
-
await fs2.writeFile(path16__default.join(userTokenDistDir, "index.ts"), await formatTs(`
|
|
417
|
-
export * from "./UserTokenAuth${importExt}";
|
|
418
|
-
`));
|
|
419
|
-
await fs2.writeFile(path16__default.join(userTokenDistDir, "UserTokenAuth.ts"), await formatTs(`
|
|
420
|
-
${reexportConsts(["UserTokenAuth"])}
|
|
421
|
-
`));
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
// src/v1.1/backcompat/util/reexportTypes.ts
|
|
425
|
-
function reexportTypes(typesToExport, genericArgsLeft = "", genericArgsRight = cleanup(genericArgsLeft)) {
|
|
426
|
-
return `
|
|
427
|
-
import type { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
|
|
428
|
-
|
|
429
|
-
${typesToExport.map((q) => `
|
|
430
|
-
/** @deprecated submodule imports aren't public api **/
|
|
431
|
-
export type ${q}${genericArgsLeft} = OG_${q}${genericArgsRight};
|
|
432
|
-
`).join("\n\n")}
|
|
433
|
-
`;
|
|
434
|
-
}
|
|
435
|
-
var captureInBracketsRegex = /<(.*?)>/;
|
|
436
|
-
var captureGenericParamNameRegex = /^\s?(.+?)( extends .*?)?( = .*?)?\s?$/;
|
|
437
|
-
function cleanup(s) {
|
|
438
|
-
if (s.length === 0) return "";
|
|
439
|
-
const genericParameterNames = captureInBracketsRegex.exec(s)?.[1]?.split(",")?.map((a) => {
|
|
440
|
-
return captureGenericParamNameRegex.exec(a)?.[1] ?? a;
|
|
441
|
-
});
|
|
442
|
-
return `<${genericParameterNames?.join(",")}>`;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
// src/v1.1/backcompat/generateOAuthDistDir.ts
|
|
446
|
-
async function generateOAuthClientDistDir(outDir, fs2, importExt = "") {
|
|
447
|
-
const oauthDistDir = path16.join(outDir, "internal", "@foundry", "oauth-client", "dist");
|
|
448
|
-
await fs2.mkdir(oauthDistDir, {
|
|
449
|
-
recursive: true
|
|
450
|
-
});
|
|
451
|
-
await fs2.writeFile(path16.join(oauthDistDir, "index.ts"), await formatTs(`
|
|
452
|
-
export * from "./Auth${importExt}";
|
|
453
|
-
export * from "./ConfidentialClient/index${importExt}";
|
|
454
|
-
export * from "./OAuthClient${importExt}";
|
|
455
|
-
export * from "./PublicClient/index${importExt}";
|
|
456
|
-
export * from "./Token${importExt}";
|
|
457
|
-
export * from "./UserToken/index${importExt}";
|
|
458
|
-
`));
|
|
459
|
-
await fs2.writeFile(path16.join(oauthDistDir, "Auth.ts"), await formatTs(reexportTypes(["Auth"])));
|
|
460
|
-
await fs2.writeFile(path16.join(oauthDistDir, "Token.ts"), await formatTs(reexportTypes(["Token", "TokenValue"])));
|
|
461
|
-
await fs2.writeFile(path16.join(oauthDistDir, "OAuthClient.ts"), await formatTs(reexportTypes(["AuthSubscription", "UnsubscribeFunction", "SignInResponse", "RefreshResponse", "SignOutResponse"])));
|
|
462
|
-
await fs2.writeFile(path16.join(oauthDistDir, "OAuthToken.ts"), await formatTs(reexportConsts(["OAuthToken"])));
|
|
463
|
-
await fs2.writeFile(path16.join(oauthDistDir, "Auth.ts"), await formatTs(reexportTypes(["Auth"])));
|
|
464
|
-
await generateConfidentialClientDir(fs2, oauthDistDir, importExt);
|
|
465
|
-
await generatePublicClientDir(fs2, oauthDistDir, importExt);
|
|
466
|
-
await generateUserTokenDir(fs2, oauthDistDir, importExt);
|
|
467
|
-
}
|
|
468
|
-
async function generateAggregationsAggregations(fs2, aggregationsDir) {
|
|
469
|
-
await fs2.writeFile(path16.join(aggregationsDir, "Aggregations.ts"), await formatTs(`
|
|
470
|
-
import { LocalDate, Timestamp } from "@osdk/legacy-client";
|
|
471
|
-
` + reexportTypes(["Double", "Rangeable", "MetricValue", "Date", "BucketKey", "BucketValue", "TimeUnit", "BucketGroup", "Metrics", "AggregatableProperties", "AggregationClause"]) + reexportTypes(["Range"], "<T extends Rangeable>", "<T>") + reexportTypes(["BaseGroupBy"], "<_T extends BucketValue = BucketValue>") + reexportTypes(["Duration"], "<_T extends Timestamp | LocalDate = Timestamp | LocalDate>") + reexportTypes(["AggregatableProperty", "MultipleAggregationsOperations"], "<_T extends MetricValue = MetricValue>") + reexportTypes(["AggregationGroup"], "<TMetrics extends Metrics | MetricValue, TBucketGroup extends BucketGroup>") + reexportTypes(["Bucketing"], "<_T extends string , _X extends BucketValue>") + reexportTypes(["AggregationResult"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue>") + reexportTypes(["BaseBucketing"], "<TBucketKey extends BucketKey, TBucketValue extends BucketValue, Kind extends string>") + reexportTypes(["ExactValueBucketing", "InternalBucketing"], `<TBucketKey extends BucketKey, TBucketValue extends BucketValue>`) + reexportTypes(["RangeBucketing", "FixedWidthBucketing"], `<TBucketKey extends BucketKey, TBucketValue extends Range<Rangeable>>`) + reexportTypes(["DurationBucketing"], `<TBucketKey extends BucketKey, TBucketValue extends Date>`) + reexportTypes(["InternalBucketingVisitor"], "<TBucketKey extends BucketKey, T extends BucketValue, R>") + reexportTypes(["AggregationBuilderResult"], "<T, TMultipleAggregationProperties>") + reexportTypes(["AggregatablePropertiesForResult", "AggregatablePropertyNamesForResult"], "<TAggregatableProperties, TResult extends MetricValue>") + reexportConsts(["assertBucketingInternal", "visitInternalBucketing"]) + reexportTypes(["AggregatableObjectSetStep"], "<TAggregatableProperties, TMultipleAggregationProperties, TBucketableProperties, TBucketGroup extends BucketGroup = {}>") + reexportTypes(["GroupedTerminalAggregationOperations"], "<TAggregatableProperties, TMultipleAggregationProperties, TBucketGroup extends BucketGroup = {}>")));
|
|
472
|
-
}
|
|
473
|
-
async function generateGroupBy(fs2, aggregationsDir, importExt = "") {
|
|
474
|
-
await fs2.mkdir(path16.join(aggregationsDir, "groupBy"), {
|
|
475
|
-
recursive: true
|
|
476
|
-
});
|
|
477
|
-
const groupBys = ["BooleanGroupBy", "LocalDateGroupBy", "NumericGroupBy", "StringGroupBy", "TimestampGroupBy"];
|
|
478
|
-
const reexportFiles = [...groupBys, "GroupKeyType"];
|
|
479
|
-
for (const key of reexportFiles) {
|
|
480
|
-
await fs2.writeFile(path16.join(aggregationsDir, "groupBy", `${key}.ts`), await formatTs(`export {${key}} from "./index${importExt}";`));
|
|
481
|
-
}
|
|
482
|
-
await fs2.writeFile(path16.join(aggregationsDir, "groupBy", "index.ts"), await formatTs(`import { Bucketing, BucketKey, Duration, Range, Rangeable } from "../Aggregations${importExt}";` + reexportConsts(groupBys) + reexportTypes(groupBys, "<T extends BucketKey>") + `export {GroupKeyType} from "@osdk/legacy-client";
|
|
483
|
-
`));
|
|
484
|
-
}
|
|
485
|
-
async function generateMetrics(fs2, aggregationsDir, importExt = "") {
|
|
486
|
-
const metricsDir = path16.join(aggregationsDir, "metrics");
|
|
487
|
-
await fs2.mkdir(metricsDir, {
|
|
488
|
-
recursive: true
|
|
489
|
-
});
|
|
490
|
-
await fs2.writeFile(path16.join(metricsDir, "metrics.ts"), await formatTs(`export {MetricValueType} from "@osdk/legacy-client";`));
|
|
491
|
-
await fs2.writeFile(path16.join(metricsDir, "ApproximateDistinctCountAggregatableProperty.ts"), await formatTs(reexportConsts(["ApproximateDistinctCountAggregatableProperty"]) + reexportTypes(["ApproximateDistinctCountAggregatableProperty"])));
|
|
492
|
-
await fs2.writeFile(path16.join(metricsDir, "MultipleAggregatableProperty.ts"), await formatTs(`
|
|
493
|
-
import { Double, MetricValue, MultipleAggregationsOperations } from "../Aggregations${importExt}";
|
|
494
|
-
import { MetricValueType } from "./metrics/index${importExt}";
|
|
495
|
-
` + reexportConsts(["MultipleAggregatableProperty"]) + reexportTypes(["MultipleAggregatableProperty"], "<TResult extends MetricValue = Double>")));
|
|
496
|
-
for (const typeName of ["DefaultAggregatableProperty", "LocalDatePropertyMetric", "NumericPropertyMetric", "TimestampPropertyMetric"]) {
|
|
497
|
-
await fs2.writeFile(path16.join(metricsDir, `${typeName}.ts`), await formatTs(`
|
|
498
|
-
import { MultipleAggregatableProperty } from "./MultipleAggregatableProperty${importExt}";
|
|
499
|
-
` + reexportConsts([typeName])));
|
|
500
|
-
}
|
|
501
|
-
await fs2.writeFile(path16.join(metricsDir, "index.ts"), await formatTs(`
|
|
502
|
-
export * from "./ApproximateDistinctCountAggregatableProperty${importExt}";
|
|
503
|
-
export * from "./DefaultAggregatableProperty${importExt}";
|
|
504
|
-
export * from "./LocalDatePropertyMetric${importExt}";
|
|
505
|
-
export * from "./metrics${importExt}";
|
|
506
|
-
export * from "./MultipleAggregatableProperty${importExt}";
|
|
507
|
-
export * from "./NumericPropertyMetric${importExt}";
|
|
508
|
-
export * from "./TimestampPropertyMetric${importExt}";
|
|
509
|
-
`));
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.ts
|
|
513
|
-
async function generateAggregationsDir(fs2, runtimeDistDir, importExt = "") {
|
|
514
|
-
const aggregationsDir = path16.join(runtimeDistDir, "aggregations");
|
|
515
|
-
await fs2.mkdir(aggregationsDir, {
|
|
516
|
-
recursive: true
|
|
517
|
-
});
|
|
518
|
-
await generateGroupBy(fs2, aggregationsDir, importExt);
|
|
519
|
-
await generateAggregationsAggregations(fs2, aggregationsDir);
|
|
520
|
-
await generateMetrics(fs2, aggregationsDir, importExt);
|
|
521
|
-
await fs2.writeFile(path16.join(aggregationsDir, "index.ts"), await formatTs(`
|
|
522
|
-
${""}
|
|
523
|
-
${""}
|
|
524
|
-
|
|
525
|
-
export * from "./Aggregations${importExt}";
|
|
526
|
-
export * from "./ComputeStep${importExt}";
|
|
527
|
-
export * from "./CountOperation${importExt}";
|
|
528
|
-
export * from "./groupBy/index${importExt}";
|
|
529
|
-
export * from "./internalAggregationRequest${importExt}";
|
|
530
|
-
export * from "./metrics/index${importExt}";
|
|
531
|
-
`));
|
|
532
|
-
await fs2.writeFile(path16.join(aggregationsDir, "ComputeStep.ts"), await formatTs(`
|
|
533
|
-
import { ObjectSetDefinition } from "../baseTypes/index${importExt}";
|
|
534
|
-
import { FoundryClientOptions } from "../client/${importExt}";
|
|
535
|
-
import { AggregateObjectsError, OntologyMetadata, Result } from "../ontologyProvider/index${importExt}";
|
|
536
|
-
import { AggregationClause, AggregationResult, BucketGroup, BucketValue, InternalBucketing, Metrics, MetricValue } from "./Aggregations${importExt}";
|
|
537
|
-
` + reexportConsts(["ComputeStep"]) + reexportTypes(["ComputeStep"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue> ") + reexportTypes(["AggregationComputeStep"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue>") + `
|
|
538
|
-
|
|
539
|
-
`));
|
|
540
|
-
await fs2.writeFile(path16.join(aggregationsDir, "CountOperation.ts"), await formatTs(`` + reexportConsts(["CountOperation", "isCountOperation"]) + reexportTypes(["CountOperation"])));
|
|
541
|
-
await fs2.writeFile(path16.join(aggregationsDir, "internalAggregationRequest.ts"), await formatTs(reexportTypes(["InternalAggregationRequest"])));
|
|
542
|
-
}
|
|
543
|
-
async function generateAttachmentsDir(attachmentsDir, fs2, importExt = "") {
|
|
544
|
-
await fs2.mkdir(attachmentsDir, {
|
|
545
|
-
recursive: true
|
|
546
|
-
});
|
|
547
|
-
await fs2.writeFile(path16__default.join(attachmentsDir, "index.ts"), await formatTs(`export * from "./Attachment${importExt}";
|
|
548
|
-
export * from "./Attachments${importExt}";
|
|
549
|
-
`));
|
|
550
|
-
await fs2.writeFile(path16__default.join(attachmentsDir, "Attachment.ts"), await formatTs(reexportTypes(["Attachment", "AttachmentMetadata"])));
|
|
551
|
-
await fs2.writeFile(path16__default.join(attachmentsDir, "Attachments.ts"), await formatTs(reexportTypes(["Attachments"])));
|
|
552
|
-
}
|
|
553
|
-
async function generateGeoshapesDir(runtimeDistDir, fs2, importExt = "") {
|
|
554
|
-
await fs2.mkdir(runtimeDistDir, {
|
|
555
|
-
recursive: true
|
|
556
|
-
});
|
|
557
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "index.ts"), await formatTs(`export * from "./Distance${importExt}";
|
|
558
|
-
export * from "./GeoJson${importExt}";
|
|
559
|
-
export * from "./GeometryCollection${importExt}";
|
|
560
|
-
export * from "./GeoPoint${importExt}";
|
|
561
|
-
export * from "./GeoShape${importExt}";
|
|
562
|
-
export * from "./LineString${importExt}";
|
|
563
|
-
export * from "./MultiGeoPoint${importExt}";
|
|
564
|
-
export * from "./MultiLineString${importExt}";
|
|
565
|
-
export * from "./MultiPolygon${importExt}";
|
|
566
|
-
export * from "./Polygon${importExt}";`));
|
|
567
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "Distance.ts"), await formatTs(`` + reexportConsts(["Distance", "DistanceUnit"]) + reexportTypes(["Distance", "DistanceUnit"])));
|
|
568
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "GeoJson.ts"), await formatTs(reexportTypes(["GeoJsonPoint", "GeoJsonPolygon", "GeoJsonLineString", "GeoJsonMultiPoint", "GeoJsonMultiPolygon", "GeoJsonMultiLineString", "GeoJsonGeometryCollection", "GeoJsonGeometry", "GeoJson"])));
|
|
569
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "GeometryCollection.ts"), await formatTs(reexportConsts(["GeometryCollection"])));
|
|
570
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "GeoPoint.ts"), await formatTs(`` + reexportConsts(["isGeoPoint", "GeoPoint", "mapCoordinatesToGeoPoint"]) + reexportTypes(["GeoHash", "Coordinates", "GeoPoint"])));
|
|
571
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "GeoShape.ts"), await formatTs(reexportConsts(["GeoShape"]) + reexportTypes(["GeoShape"])));
|
|
572
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "LineString.ts"), await formatTs(reexportConsts(["LineString"]) + reexportTypes(["LineString"])));
|
|
573
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "MultiGeoPoint.ts"), await formatTs(reexportConsts(["MultiGeoPoint"]) + reexportTypes(["MultiGeoPoint"])));
|
|
574
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "MultiLineString.ts"), await formatTs(reexportConsts(["MultiLineString"]) + reexportTypes(["MultiLineString"])));
|
|
575
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "MultiPolygon.ts"), await formatTs(reexportConsts(["MultiPolygon"]) + reexportTypes(["MultiPolygon"])));
|
|
576
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "Polygon.ts"), await formatTs(reexportConsts(["Polygon"]) + reexportTypes(["LinearRing", "Polygon"])));
|
|
577
|
-
}
|
|
578
|
-
async function generateObjectSetDir(objectSetDir, fs2, importExt = "") {
|
|
579
|
-
await fs2.mkdir(objectSetDir, {
|
|
580
|
-
recursive: true
|
|
581
|
-
});
|
|
582
|
-
await fs2.writeFile(path16__default.join(objectSetDir, "index.ts"), await formatTs(`
|
|
583
|
-
export * from "./ObjectSetDefinition${importExt}";
|
|
584
|
-
export * from "./OntologyObjectSet${importExt}";
|
|
585
|
-
`));
|
|
586
|
-
await fs2.writeFile(path16__default.join(objectSetDir, "ObjectSetDefinition.ts"), await formatTs(reexportTypes(["BaseObjectSetDefinition", "ReferenceObjectSetDefinition", "StaticObjectSetDefinition", "IntersectObjectSetDefinition", "SubtractObjectSetDefinition", "SearchAroundObjectSetDefinition", "FilterObjectSetDefinition", "ObjectSetDefinition"])));
|
|
587
|
-
await fs2.writeFile(path16__default.join(objectSetDir, "OntologyObjectSet.ts"), await formatTs(reexportTypes(["OntologyObjectSet"])));
|
|
588
|
-
}
|
|
589
|
-
async function generateSharedObjectCodeDir(sharedObjectCodeDir, fs2, importExt = "") {
|
|
590
|
-
await fs2.mkdir(sharedObjectCodeDir, {
|
|
591
|
-
recursive: true
|
|
592
|
-
});
|
|
593
|
-
await fs2.writeFile(path16__default.join(sharedObjectCodeDir, "index.ts"), await formatTs(`
|
|
594
|
-
export * from "./FilteredPropertiesTerminalOperations${importExt}";
|
|
595
|
-
`));
|
|
596
|
-
await fs2.writeFile(path16__default.join(sharedObjectCodeDir, "FilteredPropertiesTerminalOperations.ts"), await formatTs(`import { OntologyObject } from "../OntologyObject${importExt}` + reexportTypes(["FilteredPropertiesTerminalOperations", "FilteredPropertiesTerminalOperationsWithGet"], "<T extends OntologyObject, V extends Array<keyof T>>")));
|
|
597
|
-
}
|
|
598
|
-
async function generateTimeSeriesDir(timeseriesDir, fs2, importExt = "") {
|
|
599
|
-
await fs2.mkdir(timeseriesDir, {
|
|
600
|
-
recursive: true
|
|
601
|
-
});
|
|
602
|
-
await fs2.writeFile(path16.join(timeseriesDir, "index.ts"), await formatTs(`
|
|
603
|
-
export * from "./TimeSeries${importExt}";
|
|
604
|
-
export * from "./TimeSeriesDuration${importExt}";
|
|
605
|
-
export * from "./TimeSeriesPoint${importExt}";
|
|
606
|
-
${""}
|
|
607
|
-
export * from "./TimeSeriesQuery${importExt}";
|
|
608
|
-
export * from "./TimeSeriesTerminalOperations${importExt}";
|
|
609
|
-
`));
|
|
610
|
-
await fs2.writeFile(path16.join(timeseriesDir, "TimeSeries.ts"), await formatTs(reexportTypes(["TimeSeries"], `<T extends number | string>`)));
|
|
611
|
-
await fs2.writeFile(path16.join(timeseriesDir, "TimeSeriesDuration.ts"), await formatTs(reexportTypes([`WhenUnit`, `DurationUnit`, `TimeSeriesDuration`])));
|
|
612
|
-
await fs2.writeFile(path16.join(timeseriesDir, "TimeSeriesPoint.ts"), await formatTs(reexportTypes(["TimeSeriesPoint"], `<T extends number | string>`)));
|
|
613
|
-
await fs2.writeFile(path16.join(timeseriesDir, "TimeSeriesQuery.ts"), await formatTs(reexportTypes(["TimeSeriesQuery"], `<T extends number | string>`)));
|
|
614
|
-
await fs2.writeFile(path16.join(timeseriesDir, "TimeSeriesTerminalOperations.ts"), await formatTs(reexportTypes(["TimeSeriesTerminalOperations", "TimeSeriesIterator"], `<T extends number | string>`)));
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.ts
|
|
618
|
-
async function generateBaseTypesDir(runtimeDistDir, fs2, importExt = "") {
|
|
619
|
-
const baseTypesDir = path16.join(runtimeDistDir, "baseTypes");
|
|
620
|
-
await fs2.mkdir(baseTypesDir, {
|
|
621
|
-
recursive: true
|
|
622
|
-
});
|
|
623
|
-
await fs2.writeFile(path16.join(baseTypesDir, "index.ts"), await formatTs(`export * from "./ActionType${importExt}";
|
|
624
|
-
export * from "./attachments/index${importExt}";
|
|
625
|
-
export * from "./geoshapes/index${importExt}";
|
|
626
|
-
export * from "./links${importExt}";
|
|
627
|
-
export * from "./localDate${importExt}";
|
|
628
|
-
export * from "./objectset/index${importExt}";
|
|
629
|
-
export * from "./ObjectType${importExt}";
|
|
630
|
-
export * from "./OntologyObject${importExt}";
|
|
631
|
-
export * from "./Queries${importExt}";
|
|
632
|
-
export * from "./timeseries/index${importExt}";
|
|
633
|
-
export * from "./timestamp${importExt}";`));
|
|
634
|
-
const geoshapesDir = path16.join(baseTypesDir, "geoshapes");
|
|
635
|
-
await generateGeoshapesDir(geoshapesDir, fs2, importExt);
|
|
636
|
-
const timeseriesDir = path16.join(baseTypesDir, "timeseries");
|
|
637
|
-
await generateTimeSeriesDir(timeseriesDir, fs2, importExt);
|
|
638
|
-
const attachmentsDir = path16.join(baseTypesDir, "attachments");
|
|
639
|
-
await generateAttachmentsDir(attachmentsDir, fs2, importExt);
|
|
640
|
-
const objectSetDir = path16.join(baseTypesDir, "objectset");
|
|
641
|
-
await generateObjectSetDir(objectSetDir, fs2, importExt);
|
|
642
|
-
const sharedObjectCodeDir = path16.join(baseTypesDir, "sharedObjectCode");
|
|
643
|
-
await generateSharedObjectCodeDir(sharedObjectCodeDir, fs2, importExt);
|
|
644
|
-
await fs2.writeFile(path16.join(baseTypesDir, "ActionType.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject${importExt}";
|
|
645
|
-
` + reexportConsts(["ActionExecutionMode", "ReturnEditsMode", "ActionValidationResult"]) + reexportTypes(["ActionExecutionOptions", "ValidationResponse", "BulkEdits"]) + reexportTypes(["CreatedObjectEdits", "ModifiedObjectEdits"], "<T extends OntologyObject>") + reexportTypes(["Edits"], "<TAddedObjects extends OntologyObject | void, TModifiedObjects extends OntologyObject | void>") + reexportTypes(["ActionResponse"], "<TEdits extends Edits<any, any> | undefined = undefined>", "<TEdits>") + reexportTypes(["ActionResponseFromOptions"], "<TOptions extends ActionExecutionOptions | undefined = undefined, TEdits extends Edits<any, any> | undefined = undefined>", "<TOptions, TEdits>")));
|
|
646
|
-
await fs2.writeFile(path16.join(baseTypesDir, "OntologyObject.ts"), await formatTs(reexportTypes(["OntologyObject"]) + reexportConsts(["isOntologyObject"])));
|
|
647
|
-
await fs2.writeFile(path16.join(baseTypesDir, "links.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject${importExt}` + reexportTypes(["SingleLink", "MultiLink"], "<T extends OntologyObject = OntologyObject>")));
|
|
648
|
-
await fs2.writeFile(path16.join(baseTypesDir, "localDate.ts"), await formatTs(reexportConsts(["LocalDate"]) + reexportTypes(["LocalDate"])));
|
|
649
|
-
await fs2.writeFile(path16.join(baseTypesDir, "timestamp.ts"), await formatTs(reexportConsts(["Timestamp"]) + reexportTypes(["Timestamp"])));
|
|
650
|
-
await fs2.writeFile(path16.join(baseTypesDir, "Queries.ts"), await formatTs(`import { BucketValue, Range, Rangeable } from "../aggregations/index${importExt}";
|
|
651
|
-
` + reexportTypes(["QueryResponse"], "<T>") + reexportTypes(["BaseBucket"], "<K, V>") + reexportTypes(["NestedBucket"], "<TGroupKey, TSegmentKey, TValue extends BucketValue>") + reexportTypes(["TwoDimensionalAggregation"], "<TGroupKey extends QueryBucketKey, TValue extends BucketValue = number>") + reexportTypes(["ThreeDimensionalAggregation"], "<TGroupKey extends QueryBucketKey, TSegmentKey extends QueryBucketKey, TValue extends BucketValue = number>") + reexportTypes(["QueryBucketKey"])));
|
|
652
|
-
await fs2.writeFile(path16.join(baseTypesDir, "ObjectType.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject${importExt}";` + reexportTypes(["BaseType", "StringType", "IntegerType", "DateType", "BooleanType", "ByteType", "DecimalType", "FloatType", "TimestampType", "ShortType", "LongType", "DoubleType", "GeoPointType", "GeoShapeType", "AttachmentType", "ObjectType", "StructField", "QueryBucketRangeableType", "QueryBucketKeyType", "QueryBucketValueType", "AllValueTypes", "OntologyType", "ObjectTypeProperties", "StructType"]) + reexportTypes(["TimeSeriesType", "ArrayType", "SetType"], "<T extends BaseType>") + reexportTypes(["Property"], "<TType extends OntologyType = OntologyType>") + reexportTypes(["BaseObjectType"], "<TOntologyObject extends OntologyObject = OntologyObject>") + reexportTypes(["ObjectSetType"], "<T extends ObjectType>") + reexportTypes(["RangeType"], "<T extends QueryBucketRangeableType>") + reexportTypes(["TwoDimensionalAggregationType"], "<TGroupKey extends QueryBucketKeyType, TValue extends QueryBucketValueType>") + reexportTypes(["ThreeDimensionalAggregationType"], "<TGroupKey extends QueryBucketKeyType, TSegmentKey extends QueryBucketKeyType, TValue extends QueryBucketValueType>")));
|
|
653
|
-
}
|
|
654
|
-
async function generateClientDir(runtimeDistDir, fs2, importExt = "") {
|
|
655
|
-
const pagingDir = path16__default.join(runtimeDistDir, "client");
|
|
656
|
-
await fs2.mkdir(pagingDir, {
|
|
657
|
-
recursive: true
|
|
658
|
-
});
|
|
659
|
-
await fs2.writeFile(path16__default.join(pagingDir, "index.ts"), await formatTs(`export * from "./clientOptions${importExt}";`));
|
|
660
|
-
await fs2.writeFile(path16__default.join(pagingDir, "clientOptions.ts"), await formatTs(`import {Auth} from "@osdk/legacy-client";` + reexportTypes(["FoundryClientOptions"], "<TAuth extends Auth = Auth>")));
|
|
661
|
-
}
|
|
662
|
-
async function generateFiltersDir(runtimeDistDir, fs2, importExt = "") {
|
|
663
|
-
const pagingDir = path16__default.join(runtimeDistDir, "filters");
|
|
664
|
-
await fs2.mkdir(pagingDir, {
|
|
665
|
-
recursive: true
|
|
666
|
-
});
|
|
667
|
-
await fs2.writeFile(path16__default.join(pagingDir, "index.ts"), await formatTs(`export * from "./ArrayFilter${importExt}";
|
|
668
|
-
export * from "./AttachmentFilter${importExt}";
|
|
669
|
-
export * from "./BooleanFilter${importExt}";
|
|
670
|
-
export * from "./DateTimeFilters${importExt}";
|
|
671
|
-
export * from "./Filters${importExt}";
|
|
672
|
-
export * from "./GeoPointFilter${importExt}";
|
|
673
|
-
export * from "./GeoShapeFilter${importExt}";
|
|
674
|
-
export * from "./NumericFilter${importExt}";
|
|
675
|
-
export * from "./Op${importExt}";
|
|
676
|
-
export * from "./OrderByOption${importExt}";
|
|
677
|
-
export * from "./StringFilter${importExt}";`));
|
|
678
|
-
await fs2.writeFile(path16__default.join(pagingDir, "ArrayFilter.ts"), await formatTs(`import { Attachment, GeoPoint, GeoShape, LocalDate, Timestamp } from "../baseTypes/index${importExt}";` + reexportConsts(["ArrayFilter"]) + reexportTypes(["ArrayFilter"], "<T extends string | number | Timestamp | LocalDate | boolean | GeoShape | GeoPoint | Attachment>")));
|
|
679
|
-
await fs2.writeFile(path16__default.join(pagingDir, "AttachmentFilter.ts"), await formatTs(reexportConsts(["AttachmentFilter"]) + reexportTypes(["AttachmentFilter"])));
|
|
680
|
-
await fs2.writeFile(path16__default.join(pagingDir, "BooleanFilter.ts"), await formatTs(reexportConsts(["BooleanFilter"]) + reexportTypes(["BooleanFilter"])));
|
|
681
|
-
await fs2.writeFile(path16__default.join(pagingDir, "GeoPointFilter.ts"), await formatTs(reexportConsts(["GeoPointFilter"]) + reexportTypes(["GeoPointFilter", "BoundingBox"])));
|
|
682
|
-
await fs2.writeFile(path16__default.join(pagingDir, "DateTimeFilters.ts"), await formatTs(reexportConsts(["TimestampFilter", "LocalDateFilter"]) + reexportTypes(["TimestampFilter", "LocalDateFilter"])));
|
|
683
|
-
await fs2.writeFile(path16__default.join(pagingDir, "GeoShapeFilter.ts"), await formatTs(reexportConsts(["GeoShapeFilter"]) + reexportTypes(["GeoShapeFilter"])));
|
|
684
|
-
await fs2.writeFile(path16__default.join(pagingDir, "NumericFilter.ts"), await formatTs(reexportConsts(["NumericFilter"]) + reexportTypes(["NumericFilter"])));
|
|
685
|
-
await fs2.writeFile(path16__default.join(pagingDir, "Op.ts"), await formatTs(reexportConsts(["Op"])));
|
|
686
|
-
await fs2.writeFile(path16__default.join(pagingDir, "OrderByOption.ts"), await formatTs(reexportConsts(["OrderByOption"]) + reexportTypes(["OrderByOption"])));
|
|
687
|
-
await fs2.writeFile(path16__default.join(pagingDir, "StringFilter.ts"), await formatTs(reexportConsts(["StringFilter"]) + reexportTypes(["StringFilter"])));
|
|
688
|
-
await fs2.writeFile(path16__default.join(pagingDir, "Filters.ts"), await formatTs(`import { OntologyObject } from "@osdk/legacy-client";` + reexportTypes(["ObjectTypeFilterFunction", "ObjectTypeOrderByFunction"], "<T extends OntologyObject>") + reexportTypes(["BoundingBoxFilter", "DistanceOf", "SearchClause", "LtWhereClause", "GtWhereClause", "LteWhereClause", "GteWhereClause", "EqWhereClause", "IsNullWhereClause", "ContainsWhereClause", "StartsWithWhereClause", "ContainsAllTermsInOrderWhereClause", "ContainsAnyTermWhereClause", "ContainsAllTermsWhereClause", "WithinDistanceOfWhereClause", "WithinBoundingBoxWhereClause", "IntersectsBoundingBoxWhereClause", "DoesNotIntersectBoundingBoxWhereClause", "WithinPolygonWhereClause", "IntersectsPolygonWhereClause", "DoesNotIntersectPolygonWhereClause", "AndWhereClause", "OrWhereClause", "NotWhereClause", "WhereClause", "OrderByClause"]) + reexportTypes(["FilterType"], "<T extends string | number>")));
|
|
689
|
-
}
|
|
690
|
-
async function generateErrors(fs2, ontologyProviderDir) {
|
|
691
|
-
await fs2.writeFile(path16.join(ontologyProviderDir, "Errors.ts"), await formatTs(reexportTypes(["PermissionDenied", "Unauthorized", "InvalidAggregationRangeValue", "MalformedPropertyFilters", "PropertiesNotFilterable", "ParametersNotFound", "ApplyActionFailed", "PropertyTypesSearchNotSupported", "InvalidParameterValue", "QueryTimeExceededLimit", "CompositePrimaryKeyNotSupported", "PropertyBaseTypeNotSupported", "PropertiesNotSearchable", "AttachmentNotFound", "ObjectTypeNotFound", "InvalidGroupId", "OntologySyncing", "ActionNotFound", "ParameterObjectSetRidNotFound", "LinkTypeNotFound", "InvalidRangeQuery", "ActionParameterObjectNotFound", "InvalidPropertyValue", "PropertiesNotSortable", "FunctionExecutionTimedOut", "InvalidFields", "ActionTypeNotFound", "ObjectTypeNotSynced", "OntologyEditsExceededLimit", "AggregationGroupCountExceededLimit", "InvalidContentType", "PropertiesNotFound", "FunctionInvalidInput", "InvalidSortOrder", "QueryDepthExceededLimit", "InvalidPropertyFiltersCombination", "ObjectsExceededLimit", "DuplicateOrderBy", "FunctionEncounteredUserFacingError", "InvalidUserId", "QueryNotFound", "InvalidAggregationRange", "ParameterObjectNotFound", "QueryMemoryExceededLimit", "InvalidContentLength", "OntologyNotFound", "ActionParameterObjectTypeNotFound", "UnknownParameter", "InvalidSortType", "PropertyFiltersNotSupported", "ActionValidationFailed", "MultipleGroupByOnFieldNotSupported", "LinkedObjectNotFound", "ActionEditedPropertiesNotFound", "InvalidPropertyFilterValue", "QueryEncounteredUserFacingError", "AttachmentSizeExceededLimit", "ObjectNotFound", "PropertyApiNameNotFound", "ParameterTypeNotSupported", "InvalidAggregationRangePropertyType", "MissingParameter"])));
|
|
692
|
-
}
|
|
693
|
-
async function generateOntologyMetadata(fs2, ontologyProviderDir) {
|
|
694
|
-
await fs2.writeFile(path16.join(ontologyProviderDir, "OntologyMetadata.ts"), await formatTs(reexportTypes(["OntologyMetadata"])));
|
|
695
|
-
}
|
|
696
|
-
async function generateResult(fs2, ontologyProviderDir) {
|
|
697
|
-
await fs2.writeFile(path16.join(ontologyProviderDir, "Result.ts"), await formatTs(`import {FoundryApiError} from "@osdk/legacy-client";
|
|
698
|
-
` + reexportTypes(["Ok", "Err"], "<T>") + reexportTypes(["Result"], "<V, E = FoundryApiError>", "<V,E>") + reexportConsts(["isOk", "isErr", "visitError"]) + reexportTypes(["ErrorVisitor"], "<E extends FoundryApiError, R>", "<E,R>") + reexportTypes(["ExtractKeysWithType"], "<T, K extends keyof T>", "<T,K>")));
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.ts
|
|
702
|
-
async function generateOntologyProviderDir(fs2, runtimeDistDir, importExt = "") {
|
|
703
|
-
const ontologyProviderDir = path16.join(runtimeDistDir, "ontologyProvider");
|
|
704
|
-
await fs2.mkdir(ontologyProviderDir, {
|
|
705
|
-
recursive: true
|
|
706
|
-
});
|
|
707
|
-
await generateErrors(fs2, ontologyProviderDir);
|
|
708
|
-
await generateOntologyMetadata(fs2, ontologyProviderDir);
|
|
709
|
-
await generateResult(fs2, ontologyProviderDir);
|
|
710
|
-
await fs2.writeFile(path16.join(ontologyProviderDir, "index.ts"), await formatTs(`
|
|
711
|
-
${""}
|
|
712
|
-
export * from "./Errors${importExt}";
|
|
713
|
-
export * from "./OntologyMetadata${importExt}";
|
|
714
|
-
${""}
|
|
715
|
-
${""}
|
|
716
|
-
// export * from "./Result${importExt}";
|
|
717
|
-
`));
|
|
718
|
-
}
|
|
719
|
-
async function generatePagingDir(runtimeDistDir, fs2, importExt = "") {
|
|
720
|
-
const pagingDir = path16.join(runtimeDistDir, "paging");
|
|
721
|
-
await fs2.mkdir(pagingDir, {
|
|
722
|
-
recursive: true
|
|
723
|
-
});
|
|
724
|
-
await fs2.writeFile(path16.join(pagingDir, "index.ts"), await formatTs(`export * from "./Page${importExt}";`));
|
|
725
|
-
await fs2.writeFile(path16.join(pagingDir, "Page.ts"), await formatTs(reexportTypes(["Page"], "<T>")));
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
// src/v1.1/backcompat/generateOntologyRuntimeDistDir.ts
|
|
729
|
-
async function generateOntologyRuntimeDistDir(outDir, fs2, importExt = "") {
|
|
730
|
-
const runtimeDistDir = path16.join(outDir, "internal", "@foundry", "ontology-runtime", "dist");
|
|
731
|
-
await fs2.mkdir(runtimeDistDir, {
|
|
732
|
-
recursive: true
|
|
733
|
-
});
|
|
734
|
-
await generateOntologyProviderDir(fs2, runtimeDistDir, importExt);
|
|
735
|
-
await generateAggregationsDir(fs2, runtimeDistDir, importExt);
|
|
736
|
-
await generatePagingDir(runtimeDistDir, fs2, importExt);
|
|
737
|
-
await generateBaseTypesDir(runtimeDistDir, fs2, importExt);
|
|
738
|
-
await generateClientDir(runtimeDistDir, fs2, importExt);
|
|
739
|
-
await generateFiltersDir(runtimeDistDir, fs2, importExt);
|
|
740
|
-
await fs2.writeFile(path16.join(runtimeDistDir, "index.ts"), await formatTs(`
|
|
741
|
-
export * from "./aggregations/index${importExt}";
|
|
742
|
-
export * from "./baseTypes/index${importExt}";
|
|
743
|
-
${""}
|
|
744
|
-
// export * from "./filters/index${importExt}";
|
|
745
|
-
${""}
|
|
746
|
-
${""}
|
|
747
|
-
|
|
748
|
-
export * from "./ontologyProvider/index${importExt}";
|
|
749
|
-
export * from "./paging/index${importExt}";
|
|
750
|
-
`));
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
// src/v1.1/generateBackCompatDeprecatedExports.ts
|
|
754
|
-
async function generateBackCompatDeprecatedExports(fs2, outDir, importExt = "") {
|
|
755
|
-
await generateOntologyRuntimeDistDir(outDir, fs2, importExt);
|
|
756
|
-
await generateOAuthClientDistDir(outDir, fs2, importExt);
|
|
757
|
-
}
|
|
758
|
-
async function generateBatchActions(ontology, fs2, outDir, importExt = "") {
|
|
759
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
760
|
-
let actionSignatures = [];
|
|
761
|
-
for (const action of Object.values(ontology.actionTypes)) {
|
|
762
|
-
const entries = Object.entries(action.parameters);
|
|
763
|
-
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
764
|
-
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
765
|
-
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
766
|
-
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
767
|
-
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
768
|
-
let jsDocBlock = ["/**"];
|
|
769
|
-
if (action.description) {
|
|
770
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
771
|
-
}
|
|
772
|
-
let parameterBlock = "";
|
|
773
|
-
if (entries.length > 0) {
|
|
774
|
-
parameterBlock = `params: {
|
|
775
|
-
`;
|
|
776
|
-
for (const [parameterName, parameterData] of entries) {
|
|
777
|
-
parameterBlock += `"${parameterName}"`;
|
|
778
|
-
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
779
|
-
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
780
|
-
parameterBlock += `${typeScriptType};
|
|
781
|
-
`;
|
|
782
|
-
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
783
|
-
}
|
|
784
|
-
parameterBlock += "}[], ";
|
|
785
|
-
} else {
|
|
786
|
-
parameterBlock = `params: Record<string,never>[], `;
|
|
787
|
-
}
|
|
788
|
-
jsDocBlock.push(`*/`);
|
|
789
|
-
actionSignatures.push(`
|
|
790
|
-
${jsDocBlock.join("\n")}
|
|
791
|
-
${action.apiName}<O extends BatchActionExecutionOptions>(${parameterBlock}options?: O):
|
|
792
|
-
Promise<Result<BatchActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;
|
|
793
|
-
`);
|
|
794
|
-
}
|
|
795
|
-
await fs2.mkdir(outDir, {
|
|
796
|
-
recursive: true
|
|
797
|
-
});
|
|
798
|
-
await fs2.writeFile(path16__default.join(outDir, "BatchActions.ts"), await formatTs(`
|
|
799
|
-
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, BatchActionExecutionOptions, ActionError, Result, ActionResponseFromOptions, BatchActionResponseFromOptions } from "@osdk/legacy-client";
|
|
800
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
801
|
-
export interface BatchActions {
|
|
802
|
-
${actionSignatures.join("\n")}
|
|
803
|
-
}
|
|
804
|
-
`));
|
|
805
|
-
}
|
|
806
|
-
async function generateBulkActions(ontology, fs2, outDir, importExt = "") {
|
|
807
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
808
|
-
let actionSignatures = [];
|
|
809
|
-
for (const action of Object.values(ontology.actionTypes)) {
|
|
810
|
-
const entries = Object.entries(action.parameters);
|
|
811
|
-
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
812
|
-
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
813
|
-
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
814
|
-
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
815
|
-
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
816
|
-
let jsDocBlock = ["/**"];
|
|
817
|
-
if (action.description) {
|
|
818
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
819
|
-
}
|
|
820
|
-
let parameterBlock = "";
|
|
821
|
-
if (entries.length > 0) {
|
|
822
|
-
parameterBlock = `params: {
|
|
823
|
-
`;
|
|
824
|
-
for (const [parameterName, parameterData] of entries) {
|
|
825
|
-
parameterBlock += `"${parameterName}"`;
|
|
826
|
-
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
827
|
-
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
828
|
-
parameterBlock += `${typeScriptType};
|
|
829
|
-
`;
|
|
830
|
-
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
831
|
-
}
|
|
832
|
-
parameterBlock += "}[], ";
|
|
833
|
-
} else {
|
|
834
|
-
parameterBlock = `params: Record<string,never>[], `;
|
|
835
|
-
}
|
|
836
|
-
jsDocBlock.push(`*/`);
|
|
837
|
-
actionSignatures.push(`
|
|
838
|
-
${jsDocBlock.join("\n")}
|
|
839
|
-
${action.apiName}<O extends BulkActionExecutionOptions>(${parameterBlock}options?: O):
|
|
840
|
-
Promise<Result<BulkActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;
|
|
841
|
-
`);
|
|
842
|
-
}
|
|
843
|
-
await fs2.mkdir(outDir, {
|
|
844
|
-
recursive: true
|
|
845
|
-
});
|
|
846
|
-
await fs2.writeFile(path16__default.join(outDir, "BulkActions.ts"), await formatTs(`
|
|
847
|
-
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, BulkActionExecutionOptions, ActionError, Result, ActionResponseFromOptions, BulkActionResponseFromOptions } from "@osdk/legacy-client";
|
|
848
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
849
|
-
export interface BulkActions {
|
|
850
|
-
${actionSignatures.join("\n")}
|
|
851
|
-
}
|
|
852
|
-
`));
|
|
853
|
-
}
|
|
854
|
-
async function generateFoundryClientFile(fs2, outDir, importExt = "") {
|
|
855
|
-
await fs2.writeFile(path16__default.join(outDir, "FoundryClient.ts"), await formatTs(`
|
|
856
|
-
import { BaseFoundryClient } from "@osdk/legacy-client";
|
|
857
|
-
import type { Auth, FoundryClientOptions } from "@osdk/legacy-client";
|
|
858
|
-
import { Ontology } from "./Ontology${importExt}";
|
|
859
|
-
|
|
860
|
-
export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {
|
|
861
|
-
constructor(options: FoundryClientOptions<TAuth>) {
|
|
862
|
-
super(options, Ontology);
|
|
863
|
-
}
|
|
864
|
-
|
|
865
|
-
get ontology(): Ontology {
|
|
866
|
-
return super.ontology;
|
|
867
|
-
}
|
|
868
|
-
}`));
|
|
869
|
-
}
|
|
870
|
-
async function generateIndexFile(fs2, outDir, importExt) {
|
|
871
|
-
await fs2.mkdir(outDir, {
|
|
872
|
-
recursive: true
|
|
873
|
-
});
|
|
874
|
-
await fs2.writeFile(path16.join(outDir, "index.ts"), await formatTs(`
|
|
875
|
-
export * from "@osdk/legacy-client";
|
|
876
|
-
export type { Ontology } from "./Ontology${importExt}";
|
|
877
|
-
export { FoundryClient } from "./FoundryClient${importExt}";
|
|
878
|
-
`));
|
|
879
|
-
}
|
|
880
|
-
|
|
881
|
-
// src/util/commaSeparatedIdentifiers.ts
|
|
882
|
-
function commaSeparatedIdentifiers(identifiers, alternateNames) {
|
|
883
|
-
return identifiers.map((i) => {
|
|
884
|
-
const alt = alternateNames?.get(i);
|
|
885
|
-
if (alt) {
|
|
886
|
-
return `${i}: ${alt}`;
|
|
887
|
-
}
|
|
888
|
-
return i;
|
|
889
|
-
}).join(",");
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
// src/util/commaSeparatedTypeIdentifiers.ts
|
|
893
|
-
function commaSeparatedTypeIdentifiers(identifiers, altNames) {
|
|
894
|
-
return identifiers.map((i) => `${i}: typeof ${altNames?.get(i) ?? i}`).join(",");
|
|
895
|
-
}
|
|
896
|
-
|
|
897
|
-
// src/v1.1/generateMetadataFile.ts
|
|
898
|
-
async function generateMetadataFile(ontology, userAgent, fs2, outDir, importExt = "") {
|
|
899
|
-
const objectNames = Object.keys(ontology.objectTypes);
|
|
900
|
-
const actionNames = Object.keys(ontology.actionTypes);
|
|
901
|
-
const queryNames = Object.keys(ontology.queryTypes);
|
|
902
|
-
const actionAltNames = /* @__PURE__ */ new Map();
|
|
903
|
-
const queryAltNames = /* @__PURE__ */ new Map();
|
|
904
|
-
const seenIdentifiers = new Set(objectNames);
|
|
905
|
-
for (const actionName of actionNames) {
|
|
906
|
-
if (seenIdentifiers.has(actionName)) {
|
|
907
|
-
actionAltNames.set(actionName, `${actionName}Action`);
|
|
908
|
-
} else {
|
|
909
|
-
seenIdentifiers.add(actionName);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
for (const queryName of queryNames) {
|
|
913
|
-
if (seenIdentifiers.has(queryName)) {
|
|
914
|
-
queryAltNames.set(queryName, `${queryName}Query`);
|
|
915
|
-
}
|
|
916
|
-
}
|
|
917
|
-
const getImportClause = (name, altNames) => {
|
|
918
|
-
const alt = altNames.get(name);
|
|
919
|
-
if (alt) {
|
|
920
|
-
return `${name} as ${alt}`;
|
|
921
|
-
} else {
|
|
922
|
-
return name;
|
|
923
|
-
}
|
|
924
|
-
};
|
|
925
|
-
await fs2.writeFile(path16__default.join(outDir, "Ontology.ts"), await formatTs(`
|
|
926
|
-
import type { OntologyDefinition } from "@osdk/api";
|
|
927
|
-
import type { Ontology as ClientOntology } from "@osdk/legacy-client";
|
|
928
|
-
import type { Objects } from "./ontology/objects/Objects${importExt}";
|
|
929
|
-
import type { Actions } from "./ontology/actions/Actions${importExt}";
|
|
930
|
-
import type { Queries } from "./ontology/queries/Queries${importExt}";
|
|
931
|
-
import type { BatchActions } from "./ontology/actions/BatchActions${importExt}";
|
|
932
|
-
import type { BulkActions } from "./ontology/actions/BulkActions${importExt}";
|
|
933
|
-
${objectNames.map((name) => `import {${name}} from "./ontology/objects/${name}${importExt}";`).join("\n")}
|
|
934
|
-
${actionNames.map((name) => `import {${getImportClause(name, actionAltNames)}} from "./ontology/actions/${name}${importExt}";`).join("\n")}
|
|
935
|
-
${queryNames.map((name) => `import {${getImportClause(name, queryAltNames)}} from "./ontology/queries/${name}${importExt}";`).join("\n")}
|
|
936
|
-
|
|
937
|
-
export const Ontology : {
|
|
938
|
-
metadata: {
|
|
939
|
-
ontologyRid: "${ontology.ontology.rid}",
|
|
940
|
-
ontologyApiName: "${ontology.ontology.apiName}",
|
|
941
|
-
userAgent: "${userAgent}",
|
|
942
|
-
},
|
|
943
|
-
objects: {
|
|
944
|
-
${commaSeparatedTypeIdentifiers(objectNames)}
|
|
945
|
-
},
|
|
946
|
-
actions: {
|
|
947
|
-
${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}
|
|
948
|
-
},
|
|
949
|
-
queries: {
|
|
950
|
-
${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}
|
|
951
|
-
},
|
|
952
|
-
} = {
|
|
953
|
-
metadata: {
|
|
954
|
-
ontologyRid: "${ontology.ontology.rid}" as const,
|
|
955
|
-
ontologyApiName: "${ontology.ontology.apiName}" as const,
|
|
956
|
-
userAgent: "${userAgent}" as const,
|
|
957
|
-
},
|
|
958
|
-
objects: {
|
|
959
|
-
${commaSeparatedIdentifiers(objectNames)}
|
|
960
|
-
},
|
|
961
|
-
actions: {
|
|
962
|
-
${commaSeparatedIdentifiers(actionNames, actionAltNames)}
|
|
963
|
-
},
|
|
964
|
-
queries: {
|
|
965
|
-
${commaSeparatedIdentifiers(queryNames, queryAltNames)}
|
|
966
|
-
}
|
|
967
|
-
} satisfies OntologyDefinition<
|
|
968
|
-
${stringUnionFrom(objectNames)},
|
|
969
|
-
${stringUnionFrom(Object.values(ontology.actionTypes).map((actionType) => actionType.apiName))},
|
|
970
|
-
${stringUnionFrom(Object.values(ontology.queryTypes).map((queryType) => queryType.apiName))}>;
|
|
971
|
-
|
|
972
|
-
export interface Ontology extends ClientOntology<typeof Ontology> {
|
|
973
|
-
objects: Objects;
|
|
974
|
-
actions: Actions;
|
|
975
|
-
/** @deprecated use batchActions */
|
|
976
|
-
bulkActions: BulkActions;
|
|
977
|
-
batchActions: BatchActions;
|
|
978
|
-
queries: Queries;
|
|
979
|
-
}`));
|
|
980
|
-
}
|
|
981
|
-
function stringUnionFrom(values) {
|
|
982
|
-
if (values.length === 0) {
|
|
983
|
-
return "never";
|
|
984
|
-
}
|
|
985
|
-
return values.map((n) => `"${n}"`).join("|");
|
|
986
|
-
}
|
|
987
|
-
async function generateObjectsInterfaceFile(ontology, fs2, outDir, importExt = "") {
|
|
988
|
-
await fs2.mkdir(outDir, {
|
|
989
|
-
recursive: true
|
|
990
|
-
});
|
|
991
|
-
await fs2.writeFile(path16__default.join(outDir, "Objects.ts"), await formatTs(`
|
|
992
|
-
import { BaseObjectSet } from "@osdk/legacy-client";
|
|
993
|
-
${Array.from(Object.keys(ontology.objectTypes)).map((importedObject) => `import type { ${importedObject} } from "./${importedObject}${importExt}";`).join("\n")}
|
|
994
|
-
|
|
995
|
-
export interface Objects {
|
|
996
|
-
${Object.keys(ontology.objectTypes).map((apiName) => `${apiName} : BaseObjectSet<${apiName}>;`).join("\n")}
|
|
997
|
-
}
|
|
998
|
-
;`));
|
|
999
|
-
}
|
|
1000
|
-
async function generateObjectsInterfaceSupportFiles(ontology, fs2, outDir, importExt = "") {
|
|
1001
|
-
await fs2.mkdir(outDir, {
|
|
1002
|
-
recursive: true
|
|
1003
|
-
});
|
|
1004
|
-
for (const {
|
|
1005
|
-
objectType: {
|
|
1006
|
-
apiName
|
|
1007
|
-
}
|
|
1008
|
-
} of Object.values(ontology.objectTypes)) {
|
|
1009
|
-
const fileName = join(outDir, `${apiName}.ts`);
|
|
1010
|
-
const localApiName = `OG_${apiName}`;
|
|
1011
|
-
const contents = [];
|
|
1012
|
-
contents.push(`import { ObjectSetAggregateArg, ObjectSetFilterArg, ObjectSetGroupByArg, ObjectSetMultipleAggregateArg, ObjectSetOrderByArg } from "@osdk/legacy-client";`);
|
|
1013
|
-
contents.push(`import { ${apiName} as ${localApiName} } from "../${apiName}${importExt}";`);
|
|
1014
|
-
contents.push("");
|
|
1015
|
-
contents.push(`/** @deprecated Use ${apiName} from ontology/objects instead */`, `export type ${apiName} = ${localApiName};`);
|
|
1016
|
-
contents.push(`/** @deprecated Use ObjectSetFilterArg<${apiName}> instead */`, `export type ${apiName}Filter = ObjectSetFilterArg<${localApiName}>;`);
|
|
1017
|
-
contents.push(`/** @deprecated Use ObjectSetOrderByArg<${apiName}> instead */`, `export type ${apiName}OrderBy = ObjectSetOrderByArg<${localApiName}>;`);
|
|
1018
|
-
contents.push(`/** @deprecated Use ObjectSetGroupByArg<${apiName}> instead */`, `export type ${apiName}GroupByProperties = ObjectSetGroupByArg<${localApiName}>;`);
|
|
1019
|
-
contents.push(`
|
|
1020
|
-
/**
|
|
1021
|
-
* Aggregation properties for ${apiName}
|
|
1022
|
-
* @deprecated Use ObjectSetAggregateArg<${apiName}> instead
|
|
1023
|
-
*/`, `export type ${apiName}AggregationProperties = ObjectSetAggregateArg<${localApiName}>;`);
|
|
1024
|
-
contents.push(`
|
|
1025
|
-
/**
|
|
1026
|
-
* Multiple aggregation properties for ${apiName}.
|
|
1027
|
-
* @deprecated Use ObjectSetMultipleAggregateArg<${apiName}> instead
|
|
1028
|
-
*/`, `export type ${apiName}MultipleAggregationProperties = ObjectSetMultipleAggregateArg<${localApiName}>;`);
|
|
1029
|
-
await fs2.writeFile(fileName, contents.join("\n"));
|
|
1030
|
-
}
|
|
1031
|
-
}
|
|
1032
|
-
async function generateOntologyIndexFile(fs2, outDir) {
|
|
1033
|
-
await fs2.mkdir(outDir, {
|
|
1034
|
-
recursive: true
|
|
1035
|
-
});
|
|
1036
|
-
await fs2.writeFile(path16.join(outDir, "index.ts"), await formatTs(`
|
|
1037
|
-
export type { ObjectSet } from "@osdk/legacy-client";
|
|
1038
|
-
`));
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
// src/shared/getObjectImports.ts
|
|
1042
|
-
function getObjectImports(objects, curApiName, currentFilePath, v2) {
|
|
1043
|
-
return Array.from(objects).filter((obj) => obj.fullApiName !== curApiName).map((obj) => {
|
|
1044
|
-
return `import type { ${obj.getDefinitionIdentifier(v2)} as ${obj.getImportedDefinitionIdentifier(v2)} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
|
|
1045
|
-
}).join("\n");
|
|
1046
|
-
}
|
|
1047
318
|
|
|
1048
319
|
// src/shared/wireActionTypeV2ToSdkActionDefinition.ts
|
|
1049
320
|
function wireActionTypeV2ToSdkActionDefinition(input) {
|
|
@@ -1057,774 +328,101 @@ function wireActionTypeV2ToSdkActionDefinition(input) {
|
|
|
1057
328
|
modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)
|
|
1058
329
|
};
|
|
1059
330
|
}
|
|
1060
|
-
function wireActionParameterV2ToSdkParameterDefinition(value) {
|
|
1061
|
-
return {
|
|
1062
|
-
multiplicity: value.dataType.type === "array",
|
|
1063
|
-
type: actionPropertyToSdkPropertyDefinition(value.dataType.type === "array" ? value.dataType.subType : value.dataType),
|
|
1064
|
-
nullable: !value.required,
|
|
1065
|
-
description: value.description
|
|
1066
|
-
};
|
|
1067
|
-
}
|
|
1068
|
-
function actionPropertyToSdkPropertyDefinition(parameterType) {
|
|
1069
|
-
switch (parameterType.type) {
|
|
1070
|
-
case "string":
|
|
1071
|
-
case "boolean":
|
|
1072
|
-
case "attachment":
|
|
1073
|
-
case "double":
|
|
1074
|
-
case "integer":
|
|
1075
|
-
case "long":
|
|
1076
|
-
case "timestamp":
|
|
1077
|
-
case "marking":
|
|
1078
|
-
return parameterType.type;
|
|
1079
|
-
case "date":
|
|
1080
|
-
return "datetime";
|
|
1081
|
-
case "objectSet":
|
|
1082
|
-
return {
|
|
1083
|
-
type: "objectSet",
|
|
1084
|
-
objectSet: parameterType.objectTypeApiName
|
|
1085
|
-
};
|
|
1086
|
-
case "object":
|
|
1087
|
-
return {
|
|
1088
|
-
type: "object",
|
|
1089
|
-
object: parameterType.objectTypeApiName
|
|
1090
|
-
};
|
|
1091
|
-
case "array":
|
|
1092
|
-
return actionPropertyToSdkPropertyDefinition(parameterType.subType);
|
|
1093
|
-
}
|
|
1094
|
-
}
|
|
1095
|
-
function createModifiedEntities(addedObjects, modifiedObjects) {
|
|
1096
|
-
let entities = {};
|
|
1097
|
-
for (const key of addedObjects) {
|
|
1098
|
-
entities[key] = {
|
|
1099
|
-
created: true,
|
|
1100
|
-
modified: false
|
|
1101
|
-
};
|
|
1102
|
-
}
|
|
1103
|
-
for (const key of modifiedObjects) {
|
|
1104
|
-
if (entities[key]) {
|
|
1105
|
-
entities[key].modified = true;
|
|
1106
|
-
} else {
|
|
1107
|
-
entities[key] = {
|
|
1108
|
-
created: false,
|
|
1109
|
-
modified: true
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
}
|
|
1113
|
-
return entities;
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
// src/util/stringUnionFrom.ts
|
|
1117
|
-
function stringUnionFrom2(values) {
|
|
1118
|
-
if (values.length === 0) {
|
|
1119
|
-
return "never";
|
|
1120
|
-
} else {
|
|
1121
|
-
return values.map((v) => `"${v}"`).join("|");
|
|
1122
|
-
}
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
// src/v1.1/generatePerActionDataFilesV1.ts
|
|
1126
|
-
async function generatePerActionDataFilesV1({
|
|
1127
|
-
sanitizedOntology: ontology,
|
|
1128
|
-
fs: fs2,
|
|
1129
|
-
outDir: rootOutDir,
|
|
1130
|
-
importExt = "",
|
|
1131
|
-
ontology: enhancedOntology
|
|
1132
|
-
}) {
|
|
1133
|
-
const outDir = path16__default.join(rootOutDir, "ontology", "actions");
|
|
1134
|
-
await fs2.mkdir(outDir, {
|
|
1135
|
-
recursive: true
|
|
1136
|
-
});
|
|
1137
|
-
await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
|
|
1138
|
-
const currentFilePath = `${path16__default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
|
|
1139
|
-
const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.og);
|
|
1140
|
-
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
1141
|
-
const uniqueApiNamesString = stringUnionFrom2([...uniqueApiNames]);
|
|
1142
|
-
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.og));
|
|
1143
|
-
function createV1Object() {
|
|
1144
|
-
return ` export const ${action.shortApiName} = ${JSON.stringify(fullActionDef, null, 2)} satisfies ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}>;`;
|
|
1145
|
-
}
|
|
1146
|
-
const referencedObjectDefs = /* @__PURE__ */ new Set();
|
|
1147
|
-
for (const p of Object.values(action.parameters)) {
|
|
1148
|
-
if (p.dataType.type === "object" || p.dataType.type === "objectSet") {
|
|
1149
|
-
if (p.dataType.objectApiName) {
|
|
1150
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectApiName));
|
|
1151
|
-
}
|
|
1152
|
-
if (p.dataType.objectTypeApiName) {
|
|
1153
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectTypeApiName));
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
if (p.dataType.type === "array" && (p.dataType.subType.type === "object" || p.dataType.subType.type === "objectSet")) {
|
|
1157
|
-
if (p.dataType.subType.objectApiName) {
|
|
1158
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectApiName));
|
|
1159
|
-
}
|
|
1160
|
-
if (p.dataType.subType.objectTypeApiName) {
|
|
1161
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectTypeApiName));
|
|
1162
|
-
}
|
|
1163
|
-
}
|
|
1164
|
-
}
|
|
1165
|
-
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, false);
|
|
1166
|
-
await fs2.writeFile(path16__default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
1167
|
-
import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
|
|
1168
|
-
import type { ApplyActionOptions, ApplyBatchActionOptions, ActionReturnTypeForOptions, ActionParam } from '@osdk/client.api';
|
|
1169
|
-
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
1170
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
1171
|
-
${imports}
|
|
1172
|
-
|
|
1173
|
-
${createV1Object()}
|
|
1174
|
-
`));
|
|
1175
|
-
}));
|
|
1176
|
-
const indexFileRelPath = path16__default.join("ontology", "actions", `index.ts`);
|
|
1177
|
-
await fs2.writeFile(path16__default.join(rootOutDir, indexFileRelPath), await formatTs(`
|
|
1178
|
-
${Object.values(enhancedOntology.actionTypes).map((action) => {
|
|
1179
|
-
const exportConstLine = `export {${action.shortApiName} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
1180
|
-
`export type { ${action.paramsIdentifier} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
1181
|
-
return exportConstLine;
|
|
1182
|
-
}).join("\n")}
|
|
1183
|
-
${Object.keys(ontology.actionTypes).length === 0 ? "export {};" : ""}
|
|
1184
|
-
`));
|
|
1185
|
-
}
|
|
1186
|
-
function extractReferencedObjectsFromAction(actionType) {
|
|
1187
|
-
const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({
|
|
1188
|
-
dataType
|
|
1189
|
-
}) => {
|
|
1190
|
-
const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);
|
|
1191
|
-
return objectTypeReference ? [objectTypeReference] : [];
|
|
1192
|
-
});
|
|
1193
|
-
const referenceObjectsInEdits = actionType.operations.flatMap((value) => {
|
|
1194
|
-
switch (value.type) {
|
|
1195
|
-
case "createObject":
|
|
1196
|
-
return [value.objectTypeApiName];
|
|
1197
|
-
case "modifyObject":
|
|
1198
|
-
return [value.objectTypeApiName];
|
|
1199
|
-
case "deleteObject":
|
|
1200
|
-
case "createLink":
|
|
1201
|
-
case "deleteLink":
|
|
1202
|
-
return [];
|
|
1203
|
-
}
|
|
1204
|
-
});
|
|
1205
|
-
return [...referenceObjectsInEdits, ...referencedObjectsInParameters];
|
|
1206
|
-
}
|
|
1207
|
-
function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
1208
|
-
switch (actionParameter.type) {
|
|
1209
|
-
case "objectSet":
|
|
1210
|
-
case "object":
|
|
1211
|
-
return actionParameter.objectTypeApiName;
|
|
1212
|
-
case "array":
|
|
1213
|
-
return extractReferencedObjectsFromActionParameter(actionParameter.subType);
|
|
1214
|
-
case "string":
|
|
1215
|
-
case "boolean":
|
|
1216
|
-
case "attachment":
|
|
1217
|
-
case "date":
|
|
1218
|
-
case "double":
|
|
1219
|
-
case "integer":
|
|
1220
|
-
case "long":
|
|
1221
|
-
case "timestamp":
|
|
1222
|
-
return void 0;
|
|
1223
|
-
}
|
|
1224
|
-
}
|
|
1225
|
-
|
|
1226
|
-
// src/util/stringify.ts
|
|
1227
|
-
var defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatter) => {
|
|
1228
|
-
return [defaultKeyFormatter(key), defaultValueFormatter(value)];
|
|
1229
|
-
};
|
|
1230
|
-
function stringify(obj, customizer = {}, separator = ",\n") {
|
|
1231
|
-
const defaultKeyFormatter = (key) => `${JSON.stringify(key)}`;
|
|
1232
|
-
const entries = [];
|
|
1233
|
-
const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
|
|
1234
|
-
for (const key of sortedKeys) {
|
|
1235
|
-
const value = obj[key];
|
|
1236
|
-
const res = (customizer[key] ?? customizer["*"] ?? defaultCustomizer)(value, (value2) => JSON.stringify(value2, null, 2), key, defaultKeyFormatter);
|
|
1237
|
-
if (res) {
|
|
1238
|
-
if (typeof res === "string") {
|
|
1239
|
-
entries.push(`${defaultKeyFormatter(key)}: ${res}`);
|
|
1240
|
-
} else {
|
|
1241
|
-
entries.push(`${res[0]}: ${res[1]}`);
|
|
1242
|
-
}
|
|
1243
|
-
}
|
|
1244
|
-
}
|
|
1245
|
-
return entries.join(separator);
|
|
1246
|
-
}
|
|
1247
|
-
|
|
1248
|
-
// src/v1.1/wireObjectTypeV2ToSdkObjectConstV1.ts
|
|
1249
|
-
function wireObjectTypeV2ToSdkObjectConstV1(wireObject, {
|
|
1250
|
-
ontology
|
|
1251
|
-
}, currentFilePath) {
|
|
1252
|
-
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
1253
|
-
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
1254
|
-
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.og, false));
|
|
1255
|
-
const objectDefIdentifier = object.getDefinitionIdentifier(false);
|
|
1256
|
-
function getV1Types() {
|
|
1257
|
-
return `
|
|
1258
|
-
export interface ${objectDefIdentifier} extends ObjectTypeDefinition<"${object.fullApiName}", ${object.uniqueImportName}> {
|
|
1259
|
-
${stringify(definition, {
|
|
1260
|
-
osdkMetadata: () => void 0,
|
|
1261
|
-
// not used in v1
|
|
1262
|
-
links: (_value) => `{
|
|
1263
|
-
${stringify(definition.links, {
|
|
1264
|
-
"*": (definition2) => `ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(false)}, ${definition2.multiplicity}>`
|
|
1265
|
-
})}
|
|
1266
|
-
}`
|
|
1267
|
-
})}
|
|
1268
|
-
}
|
|
1269
|
-
`;
|
|
1270
|
-
}
|
|
1271
|
-
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, false);
|
|
1272
|
-
return `${imports}${getV1Types()}
|
|
1273
|
-
|
|
1274
|
-
export const ${object.shortApiName}: ${objectDefIdentifier} = {
|
|
1275
|
-
${stringify(definition, {
|
|
1276
|
-
osdkMetadata: (value) => void 0
|
|
1277
|
-
})}
|
|
1278
|
-
|
|
1279
|
-
};`;
|
|
1280
|
-
}
|
|
1281
|
-
|
|
1282
|
-
// src/util/reservedKeywords.ts
|
|
1283
|
-
var reservedKeywords = /* @__PURE__ */ new Set(["break", "case", "catch", "class", "const", "continue", "debugger", "default", "delete", "do", "else", "enum", "export", "extends", "false", "finally", "for", "function", "if", "import", "in", "instanceof", "new", "null", "return", "super", "switch", "this", "throw", "true", "try", "typeof", "var", "void", "while", "with", "implements", "interface", "let", "package", "private", "protected", "public", "static", "yield"]);
|
|
1284
|
-
function isReservedKeyword(name) {
|
|
1285
|
-
return reservedKeywords.has(name);
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
// src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts
|
|
1289
|
-
function wireObjectTypeV2ToObjectInterfaceStringV1(objectTypeWithLinks, importExt = "") {
|
|
1290
|
-
const uniqueLinkTargets = new Set(objectTypeWithLinks.linkTypes.map((a) => a.objectTypeApiName).filter((a) => a !== objectTypeWithLinks.objectType.apiName));
|
|
1291
|
-
return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink, StringLong } from "@osdk/legacy-client";
|
|
1292
|
-
${Array.from(uniqueLinkTargets).map((linkTarget) => `import type { ${linkTarget} } from "./${linkTarget}${importExt}";`).join("\n")}
|
|
1293
|
-
|
|
1294
|
-
${getDescriptionIfPresent(objectTypeWithLinks.objectType.description)}
|
|
1295
|
-
export interface ${objectTypeWithLinks.objectType.apiName} extends OntologyObject {
|
|
1296
|
-
/** @deprecated please migrate to $apiName instead */
|
|
1297
|
-
readonly __apiName: "${objectTypeWithLinks.objectType.apiName}" & {${objectTypeWithLinks.linkTypes.map((linkType) => {
|
|
1298
|
-
return `/** @deprecated please migrate to pivotTo(${linkType.apiName}) instead */ searchAround${linkType.apiName.charAt(0).toUpperCase() + linkType.apiName.slice(1)}?: never`;
|
|
1299
|
-
})}};
|
|
1300
|
-
/** @deprecated please migrate to $primaryKey instead */
|
|
1301
|
-
readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
1302
|
-
readonly $apiName: "${objectTypeWithLinks.objectType.apiName}";
|
|
1303
|
-
readonly $primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
1304
|
-
${Object.entries(objectTypeWithLinks.objectType.properties).sort((a, b) => a[0].localeCompare(b[0])).flatMap(([propertyName, propertyDefinition]) => {
|
|
1305
|
-
const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);
|
|
1306
|
-
const entries = [`${getDescriptionIfPresent(propertyDefinition.description, true)}readonly ${propertyName}: ${propertyType} | undefined`];
|
|
1307
|
-
if (isReservedKeyword(propertyName)) {
|
|
1308
|
-
entries.push(`/** @deprecated please migrate to '${propertyName}' instead */
|
|
1309
|
-
readonly ${propertyName}_: ${propertyType} | undefined`);
|
|
1310
|
-
}
|
|
1311
|
-
return entries;
|
|
1312
|
-
}).join(";\n")}
|
|
1313
|
-
${objectTypeWithLinks.linkTypes.flatMap((linkType) => {
|
|
1314
|
-
const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === "MANY" ? "MultiLink" : "SingleLink"}<${linkType.objectTypeApiName}>`];
|
|
1315
|
-
return entries;
|
|
1316
|
-
}).join(";\n")}
|
|
1317
|
-
}
|
|
1318
|
-
`;
|
|
1319
|
-
}
|
|
1320
|
-
function wirePropertyTypeV2ToTypeScriptType(property) {
|
|
1321
|
-
switch (property.type) {
|
|
1322
|
-
case "string":
|
|
1323
|
-
return "string";
|
|
1324
|
-
case "boolean":
|
|
1325
|
-
return "boolean";
|
|
1326
|
-
case "array":
|
|
1327
|
-
return wirePropertyTypeV2ToTypeScriptType(property.subType) + "[]";
|
|
1328
|
-
case "integer":
|
|
1329
|
-
return "number";
|
|
1330
|
-
case "attachment":
|
|
1331
|
-
return "Attachment";
|
|
1332
|
-
case "byte":
|
|
1333
|
-
return "number";
|
|
1334
|
-
case "date":
|
|
1335
|
-
return "LocalDate";
|
|
1336
|
-
case "decimal":
|
|
1337
|
-
return "string";
|
|
1338
|
-
case "double":
|
|
1339
|
-
return "number";
|
|
1340
|
-
case "float":
|
|
1341
|
-
return "number";
|
|
1342
|
-
case "geopoint":
|
|
1343
|
-
return "GeoPoint";
|
|
1344
|
-
case "geoshape":
|
|
1345
|
-
return "GeoShape";
|
|
1346
|
-
case "long":
|
|
1347
|
-
return "StringLong";
|
|
1348
|
-
case "short":
|
|
1349
|
-
return "number";
|
|
1350
|
-
case "timestamp":
|
|
1351
|
-
return "Timestamp";
|
|
1352
|
-
case "timeseries":
|
|
1353
|
-
return property.itemType.type === "string" ? `TimeSeries<string>` : `TimeSeries<number>`;
|
|
1354
|
-
case "marking":
|
|
1355
|
-
return "string";
|
|
1356
|
-
default:
|
|
1357
|
-
throw new Error(`Unknown property type ${property}`);
|
|
1358
|
-
}
|
|
1359
|
-
}
|
|
1360
|
-
function getDescriptionIfPresent(description, includeNewline) {
|
|
1361
|
-
if (description) {
|
|
1362
|
-
return `/**
|
|
1363
|
-
* ${description}
|
|
1364
|
-
*/${includeNewline ? "\n" : ""}`;
|
|
1365
|
-
}
|
|
1366
|
-
return "";
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
// src/v1.1/generatePerObjectInterfaceAndDataFiles.ts
|
|
1370
|
-
async function generatePerObjectInterfaceAndDataFiles(ontology, fs2, outDir, importExt = "") {
|
|
1371
|
-
await fs2.mkdir(outDir, {
|
|
1372
|
-
recursive: true
|
|
1373
|
-
});
|
|
1374
|
-
await Promise.all(Object.values(ontology.og.objectTypes).map(async (object) => {
|
|
1375
|
-
const relPath = path16__default.join(".", "ontology", `objects`, `${object.objectType.apiName}.ts`);
|
|
1376
|
-
await fs2.writeFile(path16__default.join(outDir, `${object.objectType.apiName}.ts`), await formatTs(`
|
|
1377
|
-
import type { ObjectTypeDefinition, ObjectTypeLinkDefinition, PropertyDef } from "@osdk/api";
|
|
1378
|
-
${wireObjectTypeV2ToObjectInterfaceStringV1(object, importExt)}
|
|
1379
|
-
|
|
1380
|
-
${wireObjectTypeV2ToSdkObjectConstV1(object, {
|
|
1381
|
-
ontology
|
|
1382
|
-
}, relPath)}
|
|
1383
|
-
`));
|
|
1384
|
-
}));
|
|
1385
|
-
await fs2.writeFile(path16__default.join(outDir, "index.ts"), await formatTs(`
|
|
1386
|
-
${Object.keys(ontology.og.objectTypes).map((apiName) => `export * from "./${apiName}${importExt}";`).join("\n")}
|
|
1387
|
-
export type { ObjectSet } from "@osdk/legacy-client";
|
|
1388
|
-
|
|
1389
|
-
`));
|
|
1390
|
-
}
|
|
1391
|
-
|
|
1392
|
-
// src/shared/getObjectTypesFromQueryDataType.ts
|
|
1393
|
-
function getObjectTypesFromQueryDataType(dataType, types) {
|
|
1394
|
-
switch (dataType.type) {
|
|
1395
|
-
case "array":
|
|
1396
|
-
case "set":
|
|
1397
|
-
getObjectTypesFromQueryDataType(dataType.subType, types);
|
|
1398
|
-
return;
|
|
1399
|
-
case "object":
|
|
1400
|
-
types.add(dataType.objectTypeApiName);
|
|
1401
|
-
return;
|
|
1402
|
-
case "objectSet":
|
|
1403
|
-
types.add(dataType.objectTypeApiName);
|
|
1404
|
-
return;
|
|
1405
|
-
case "struct":
|
|
1406
|
-
for (const prop of Object.values(dataType.fields)) {
|
|
1407
|
-
getObjectTypesFromQueryDataType(prop.fieldType, types);
|
|
1408
|
-
}
|
|
1409
|
-
return;
|
|
1410
|
-
case "union":
|
|
1411
|
-
for (const type of dataType.unionTypes) {
|
|
1412
|
-
getObjectTypesFromQueryDataType(type, types);
|
|
1413
|
-
}
|
|
1414
|
-
return;
|
|
1415
|
-
case "attachment":
|
|
1416
|
-
case "boolean":
|
|
1417
|
-
case "date":
|
|
1418
|
-
case "double":
|
|
1419
|
-
case "float":
|
|
1420
|
-
case "integer":
|
|
1421
|
-
case "long":
|
|
1422
|
-
case "null":
|
|
1423
|
-
case "string":
|
|
1424
|
-
case "threeDimensionalAggregation":
|
|
1425
|
-
case "timestamp":
|
|
1426
|
-
case "twoDimensionalAggregation":
|
|
1427
|
-
case "unsupported":
|
|
1428
|
-
return;
|
|
1429
|
-
default:
|
|
1430
|
-
throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
|
|
1434
|
-
// src/shared/getObjectTypeApiNamesFromQuery.ts
|
|
1435
|
-
function getObjectTypeApiNamesFromQuery(query) {
|
|
1436
|
-
const types = /* @__PURE__ */ new Set();
|
|
1437
|
-
for (const {
|
|
1438
|
-
dataType
|
|
1439
|
-
} of Object.values(query.parameters)) {
|
|
1440
|
-
getObjectTypesFromQueryDataType(dataType, types);
|
|
1441
|
-
}
|
|
1442
|
-
getObjectTypesFromQueryDataType(query.output, types);
|
|
1443
|
-
return Array.from(types);
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
// src/shared/isNullableQueryDataType.ts
|
|
1447
|
-
function isNullableQueryDataType(input) {
|
|
1448
|
-
if (input.type === "null") {
|
|
1449
|
-
return true;
|
|
1450
|
-
}
|
|
1451
|
-
if (input.type === "union") {
|
|
1452
|
-
return input.unionTypes.some((t) => isNullableQueryDataType(t));
|
|
1453
|
-
}
|
|
1454
|
-
return false;
|
|
1455
|
-
}
|
|
1456
|
-
|
|
1457
|
-
// src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts
|
|
1458
|
-
function wireQueryDataTypeToQueryDataTypeDefinition(input) {
|
|
1459
|
-
switch (input.type) {
|
|
1460
|
-
case "double":
|
|
1461
|
-
case "float":
|
|
1462
|
-
case "integer":
|
|
1463
|
-
case "long":
|
|
1464
|
-
case "attachment":
|
|
1465
|
-
case "boolean":
|
|
1466
|
-
case "date":
|
|
1467
|
-
case "string":
|
|
1468
|
-
case "timestamp":
|
|
1469
|
-
return {
|
|
1470
|
-
type: input.type,
|
|
1471
|
-
nullable: false
|
|
1472
|
-
};
|
|
1473
|
-
case "object":
|
|
1474
|
-
return {
|
|
1475
|
-
type: "object",
|
|
1476
|
-
object: input.objectTypeApiName,
|
|
1477
|
-
nullable: false
|
|
1478
|
-
};
|
|
1479
|
-
case "objectSet":
|
|
1480
|
-
return {
|
|
1481
|
-
type: "objectSet",
|
|
1482
|
-
objectSet: input.objectTypeApiName,
|
|
1483
|
-
nullable: false
|
|
1484
|
-
};
|
|
1485
|
-
case "array":
|
|
1486
|
-
return {
|
|
1487
|
-
...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
1488
|
-
multiplicity: true
|
|
1489
|
-
};
|
|
1490
|
-
case "set":
|
|
1491
|
-
return {
|
|
1492
|
-
type: "set",
|
|
1493
|
-
set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
1494
|
-
nullable: false
|
|
1495
|
-
};
|
|
1496
|
-
case "union":
|
|
1497
|
-
const allowNulls = isNullableQueryDataType(input);
|
|
1498
|
-
if (allowNulls && input.unionTypes.length === 2) {
|
|
1499
|
-
const nonNull = input.unionTypes.find((t) => t.type != null);
|
|
1500
|
-
if (nonNull) {
|
|
1501
|
-
return {
|
|
1502
|
-
...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),
|
|
1503
|
-
nullable: true
|
|
1504
|
-
};
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1507
|
-
return {
|
|
1508
|
-
type: "union",
|
|
1509
|
-
union: input.unionTypes.reduce((acc, t) => {
|
|
1510
|
-
if (t.type === "null") {
|
|
1511
|
-
return acc;
|
|
1512
|
-
}
|
|
1513
|
-
acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));
|
|
1514
|
-
return acc;
|
|
1515
|
-
}, []),
|
|
1516
|
-
nullable: allowNulls
|
|
1517
|
-
};
|
|
1518
|
-
case "struct":
|
|
1519
|
-
return {
|
|
1520
|
-
type: "struct",
|
|
1521
|
-
struct: Object.fromEntries(input.fields.map((f) => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),
|
|
1522
|
-
nullable: false
|
|
1523
|
-
};
|
|
1524
|
-
case "twoDimensionalAggregation":
|
|
1525
|
-
return {
|
|
1526
|
-
type: "twoDimensionalAggregation",
|
|
1527
|
-
twoDimensionalAggregation: get2DQueryAggregationProps(input),
|
|
1528
|
-
nullable: false
|
|
1529
|
-
};
|
|
1530
|
-
case "threeDimensionalAggregation":
|
|
1531
|
-
return {
|
|
1532
|
-
type: "threeDimensionalAggregation",
|
|
1533
|
-
threeDimensionalAggregation: get3DQueryAggregationProps(input),
|
|
1534
|
-
nullable: false
|
|
1535
|
-
};
|
|
1536
|
-
case "null":
|
|
1537
|
-
case "unsupported":
|
|
1538
|
-
throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);
|
|
1539
|
-
default:
|
|
1540
|
-
throw new Error(`Unsupported QueryDataType.type ${input.type}`);
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
function get2DQueryAggregationProps(input) {
|
|
1544
|
-
if (input.keyType.type === "range") {
|
|
1545
|
-
return {
|
|
1546
|
-
keyType: input.keyType.type,
|
|
1547
|
-
keySubtype: input.keyType.subType.type,
|
|
1548
|
-
valueType: input.valueType.type
|
|
1549
|
-
};
|
|
1550
|
-
} else {
|
|
1551
|
-
if (guardInvalidKeyTypes(input.keyType)) {
|
|
1552
|
-
return {
|
|
1553
|
-
keyType: input.keyType.type,
|
|
1554
|
-
valueType: input.valueType.type
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);
|
|
1558
|
-
}
|
|
1559
|
-
}
|
|
1560
|
-
function get3DQueryAggregationProps(input) {
|
|
1561
|
-
if (input.keyType.type === "range") {
|
|
1562
|
-
return {
|
|
1563
|
-
keyType: input.keyType.type,
|
|
1564
|
-
keySubtype: input.keyType.subType.type,
|
|
1565
|
-
valueType: get2DQueryAggregationProps(input.valueType)
|
|
1566
|
-
};
|
|
1567
|
-
} else {
|
|
1568
|
-
if (guardInvalidKeyTypes(input.keyType)) {
|
|
1569
|
-
return {
|
|
1570
|
-
keyType: input.keyType.type,
|
|
1571
|
-
valueType: get2DQueryAggregationProps(input.valueType)
|
|
1572
|
-
};
|
|
1573
|
-
}
|
|
1574
|
-
throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
|
|
1575
|
-
}
|
|
1576
|
-
}
|
|
1577
|
-
function guardInvalidKeyTypes(key) {
|
|
1578
|
-
return key.type === "string" || key.type === "boolean";
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
|
-
// src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts
|
|
1582
|
-
function wireQueryTypeV2ToSdkQueryDefinition(input) {
|
|
1583
|
-
return {
|
|
1584
|
-
type: "query",
|
|
1585
|
-
apiName: input.apiName,
|
|
1586
|
-
description: input.description,
|
|
1587
|
-
displayName: input.displayName,
|
|
1588
|
-
version: input.version,
|
|
1589
|
-
parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),
|
|
1590
|
-
output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)
|
|
1591
|
-
};
|
|
1592
|
-
}
|
|
1593
|
-
function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {
|
|
1594
|
-
return {
|
|
1595
|
-
type: "query",
|
|
1596
|
-
apiName: input.apiName,
|
|
1597
|
-
description: input.description,
|
|
1598
|
-
displayName: input.displayName,
|
|
1599
|
-
version: input.version
|
|
1600
|
-
};
|
|
1601
|
-
}
|
|
1602
|
-
function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
|
|
1603
|
-
return {
|
|
1604
|
-
description: parameter.description,
|
|
1605
|
-
...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)
|
|
1606
|
-
};
|
|
1607
|
-
}
|
|
1608
|
-
|
|
1609
|
-
// src/v1.1/generatePerQueryDataFiles.ts
|
|
1610
|
-
async function generatePerQueryDataFiles({
|
|
1611
|
-
fs: fs2,
|
|
1612
|
-
outDir: rootOutDir,
|
|
1613
|
-
ontology
|
|
1614
|
-
}, v2) {
|
|
1615
|
-
const relOutDir = path16__default.join(".", "ontology", "queries");
|
|
1616
|
-
const outDir = path16__default.join(rootOutDir, "ontology", "queries");
|
|
1617
|
-
await fs2.mkdir(outDir, {
|
|
1618
|
-
recursive: true
|
|
1619
|
-
});
|
|
1620
|
-
await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {
|
|
1621
|
-
await generateV1QueryFile(fs2, outDir, query);
|
|
1622
|
-
}));
|
|
1623
|
-
await fs2.writeFile(path16__default.join(outDir, "index.ts"), await formatTs(`
|
|
1624
|
-
${Object.values(ontology.queryTypes).map((query) => `export * from "${query.getImportPathRelTo(path16__default.join(relOutDir, "index.ts"))}";`).join("\n")}
|
|
1625
|
-
${Object.keys(ontology.queryTypes).length === 0 ? "export {};" : ""}
|
|
1626
|
-
`));
|
|
1627
|
-
}
|
|
1628
|
-
async function generateV1QueryFile(fs2, outDir, query) {
|
|
1629
|
-
const objectTypes = getObjectTypeApiNamesFromQuery(query);
|
|
1630
|
-
await fs2.writeFile(path16__default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
|
|
1631
|
-
import { QueryDefinition } from "@osdk/api";
|
|
1632
|
-
|
|
1633
|
-
export const ${query.shortApiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query.og))} ${getQueryDefSatisfies(query.fullApiName, objectTypes)}`));
|
|
1634
|
-
}
|
|
1635
|
-
function getQueryDefSatisfies(apiName, objectTypes) {
|
|
1636
|
-
return `satisfies QueryDefinition<"${apiName}", ${objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never"}>;`;
|
|
1637
|
-
}
|
|
1638
|
-
async function generateQueries(ontology, fs2, outDir, importExt = "") {
|
|
1639
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
1640
|
-
const signatures = [];
|
|
1641
|
-
for (const query of Object.values(ontology.queryTypes)) {
|
|
1642
|
-
const jsDocBlock = ["/**"];
|
|
1643
|
-
if (query.description) {
|
|
1644
|
-
jsDocBlock.push(`* ${query.description}`);
|
|
1645
|
-
}
|
|
1646
|
-
const outputType = handleQueryDataType(query.output, importedObjects, true);
|
|
1647
|
-
const paramEntries = [];
|
|
1648
|
-
for (const [name, parameter] of Object.entries(query.parameters)) {
|
|
1649
|
-
const nullable = isNullableQueryDataType(parameter.dataType);
|
|
1650
|
-
const type = handleQueryDataType(parameter.dataType, importedObjects, false);
|
|
1651
|
-
paramEntries.push(`"${name}"${nullable ? "?" : ""}: ${type}`);
|
|
1652
|
-
jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : ""}`);
|
|
1653
|
-
}
|
|
1654
|
-
const param = paramEntries.length === 0 ? "" : `params: { ${paramEntries.join("; ")} }`;
|
|
1655
|
-
jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, "*/");
|
|
1656
|
-
signatures.push(`
|
|
1657
|
-
${jsDocBlock.join("\n")}
|
|
1658
|
-
${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;
|
|
1659
|
-
`);
|
|
1660
|
-
}
|
|
1661
|
-
await fs2.mkdir(outDir, {
|
|
1662
|
-
recursive: true
|
|
1663
|
-
});
|
|
1664
|
-
await fs2.writeFile(path16__default.join(outDir, "Queries.ts"), await formatTs(`
|
|
1665
|
-
import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from "@osdk/legacy-client";
|
|
1666
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
1667
|
-
|
|
1668
|
-
export interface Queries {
|
|
1669
|
-
${signatures.join("\n")}
|
|
1670
|
-
}
|
|
1671
|
-
`));
|
|
331
|
+
function wireActionParameterV2ToSdkParameterDefinition(value) {
|
|
332
|
+
return {
|
|
333
|
+
multiplicity: value.dataType.type === "array",
|
|
334
|
+
type: actionPropertyToSdkPropertyDefinition(value.dataType.type === "array" ? value.dataType.subType : value.dataType),
|
|
335
|
+
nullable: !value.required,
|
|
336
|
+
description: value.description
|
|
337
|
+
};
|
|
1672
338
|
}
|
|
1673
|
-
function
|
|
1674
|
-
switch (
|
|
1675
|
-
case "boolean":
|
|
1676
|
-
return "boolean";
|
|
339
|
+
function actionPropertyToSdkPropertyDefinition(parameterType) {
|
|
340
|
+
switch (parameterType.type) {
|
|
1677
341
|
case "string":
|
|
1678
|
-
|
|
342
|
+
case "boolean":
|
|
343
|
+
case "attachment":
|
|
1679
344
|
case "double":
|
|
1680
|
-
case "float":
|
|
1681
345
|
case "integer":
|
|
1682
|
-
return "number";
|
|
1683
346
|
case "long":
|
|
1684
|
-
return isReturnValue ? "string" : "string | number";
|
|
1685
|
-
case "date":
|
|
1686
|
-
return "LocalDate";
|
|
1687
347
|
case "timestamp":
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
348
|
+
case "marking":
|
|
349
|
+
return parameterType.type;
|
|
350
|
+
case "date":
|
|
351
|
+
return "datetime";
|
|
352
|
+
case "objectSet":
|
|
353
|
+
return {
|
|
354
|
+
type: "objectSet",
|
|
355
|
+
objectSet: parameterType.objectTypeApiName
|
|
356
|
+
};
|
|
357
|
+
case "object":
|
|
358
|
+
return {
|
|
359
|
+
type: "object",
|
|
360
|
+
object: parameterType.objectTypeApiName
|
|
361
|
+
};
|
|
1691
362
|
case "array":
|
|
1692
|
-
return
|
|
1693
|
-
case "object": {
|
|
1694
|
-
const objectType = dataType.objectTypeApiName;
|
|
1695
|
-
importedObjects.add(objectType);
|
|
1696
|
-
return isReturnValue ? objectType : `${objectType} | ${objectType}["__primaryKey"]`;
|
|
1697
|
-
}
|
|
1698
|
-
case "objectSet": {
|
|
1699
|
-
const objectType = dataType.objectTypeApiName;
|
|
1700
|
-
importedObjects.add(objectType);
|
|
1701
|
-
return `ObjectSet<${objectType}>`;
|
|
1702
|
-
}
|
|
1703
|
-
case "set":
|
|
1704
|
-
return `Set<${handleQueryDataType(dataType.subType, importedObjects, isReturnValue)}>`;
|
|
1705
|
-
case "struct":
|
|
1706
|
-
const properties = dataType.fields.map((field) => {
|
|
1707
|
-
const isNullable = isNullableQueryDataType(field.fieldType);
|
|
1708
|
-
return `${field.name}${isNullable ? "?" : ""}: ${handleQueryDataType(field.fieldType, importedObjects, isReturnValue)}`;
|
|
1709
|
-
});
|
|
1710
|
-
return `{ ${properties.join(",\n")} }`;
|
|
1711
|
-
case "union":
|
|
1712
|
-
return dataType.unionTypes.map((type) => handleQueryDataType(type, importedObjects, isReturnValue)).filter((type) => type !== "null").join("|");
|
|
1713
|
-
case "twoDimensionalAggregation":
|
|
1714
|
-
dataType.valueType;
|
|
1715
|
-
return `TwoDimensionalAggregation<
|
|
1716
|
-
${aggregationKeyToTypescriptType(dataType.keyType)},
|
|
1717
|
-
${aggregationValueToTypescriptType(dataType.valueType)}
|
|
1718
|
-
>`;
|
|
1719
|
-
case "threeDimensionalAggregation":
|
|
1720
|
-
return `ThreeDimensionalAggregation<
|
|
1721
|
-
${aggregationKeyToTypescriptType(dataType.keyType)},
|
|
1722
|
-
${aggregationKeyToTypescriptType(dataType.valueType.keyType)},
|
|
1723
|
-
${aggregationValueToTypescriptType(dataType.valueType.valueType)}
|
|
1724
|
-
>`;
|
|
1725
|
-
case "null":
|
|
1726
|
-
return "null";
|
|
1727
|
-
case "unsupported":
|
|
1728
|
-
throw new Error("Cannot generate queries for unsupported type");
|
|
1729
|
-
default:
|
|
1730
|
-
throw new Error(`Cannot generate queries for type ${dataType.type}`);
|
|
363
|
+
return actionPropertyToSdkPropertyDefinition(parameterType.subType);
|
|
1731
364
|
}
|
|
1732
365
|
}
|
|
1733
|
-
function
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
case "string":
|
|
1741
|
-
return "string";
|
|
1742
|
-
case "date":
|
|
1743
|
-
return "LocalDate";
|
|
1744
|
-
case "timestamp":
|
|
1745
|
-
return "Timestamp";
|
|
1746
|
-
case "range":
|
|
1747
|
-
return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;
|
|
1748
|
-
default:
|
|
1749
|
-
throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);
|
|
366
|
+
function createModifiedEntities(addedObjects, modifiedObjects) {
|
|
367
|
+
let entities = {};
|
|
368
|
+
for (const key of addedObjects) {
|
|
369
|
+
entities[key] = {
|
|
370
|
+
created: true,
|
|
371
|
+
modified: false
|
|
372
|
+
};
|
|
1750
373
|
}
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
return "Timestamp";
|
|
1761
|
-
default:
|
|
1762
|
-
throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);
|
|
374
|
+
for (const key of modifiedObjects) {
|
|
375
|
+
if (entities[key]) {
|
|
376
|
+
entities[key].modified = true;
|
|
377
|
+
} else {
|
|
378
|
+
entities[key] = {
|
|
379
|
+
created: false,
|
|
380
|
+
modified: true
|
|
381
|
+
};
|
|
382
|
+
}
|
|
1763
383
|
}
|
|
384
|
+
return entities;
|
|
1764
385
|
}
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
386
|
+
|
|
387
|
+
// src/util/stringify.ts
|
|
388
|
+
var defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatter) => {
|
|
389
|
+
return [defaultKeyFormatter(key), defaultValueFormatter(value)];
|
|
390
|
+
};
|
|
391
|
+
function stringify(obj, customizer = {}, separator = ",\n") {
|
|
392
|
+
const defaultKeyFormatter = (key) => `${JSON.stringify(key)}`;
|
|
393
|
+
const entries = [];
|
|
394
|
+
const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
|
|
395
|
+
for (const key of sortedKeys) {
|
|
396
|
+
const value = obj[key];
|
|
397
|
+
const res = (customizer[key] ?? customizer["*"] ?? defaultCustomizer)(value, (value2) => JSON.stringify(value2, null, 2), key, defaultKeyFormatter);
|
|
398
|
+
if (res) {
|
|
399
|
+
if (typeof res === "string") {
|
|
400
|
+
entries.push(`${defaultKeyFormatter(key)}: ${res}`);
|
|
401
|
+
} else {
|
|
402
|
+
entries.push(`${res[0]}: ${res[1]}`);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
1775
405
|
}
|
|
1776
|
-
|
|
1777
|
-
function sanitizeDocTypeName(type) {
|
|
1778
|
-
return type.replace(/\s/g, "");
|
|
406
|
+
return entries.join(separator);
|
|
1779
407
|
}
|
|
1780
408
|
|
|
1781
|
-
// src/
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
await fs2.mkdir(outDir, {
|
|
1789
|
-
recursive: true
|
|
1790
|
-
});
|
|
1791
|
-
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
1792
|
-
const enhancedOntology = enhanceOntology(sanitizedOntology, void 0, /* @__PURE__ */ new Map(), importExt);
|
|
1793
|
-
await generateFoundryClientFile(fs2, outDir, importExt);
|
|
1794
|
-
await generateMetadataFile(sanitizedOntology, userAgent, fs2, outDir, importExt);
|
|
1795
|
-
await generateOntologyIndexFile(fs2, path16.join(outDir, "ontology"));
|
|
1796
|
-
await generateObjectsInterfaceFile(sanitizedOntology, fs2, objectsDir, importExt);
|
|
1797
|
-
await generateObjectsInterfaceSupportFiles(sanitizedOntology, fs2, path16.join(objectsDir, "objects-api"), importExt);
|
|
1798
|
-
await generatePerObjectInterfaceAndDataFiles(enhancedOntology, fs2, objectsDir, importExt);
|
|
1799
|
-
const common = {
|
|
1800
|
-
sanitizedOntology,
|
|
1801
|
-
fs: fs2,
|
|
1802
|
-
outDir,
|
|
1803
|
-
ontology: enhancedOntology
|
|
1804
|
-
};
|
|
1805
|
-
await generateActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1806
|
-
await generateBatchActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1807
|
-
await generateBulkActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1808
|
-
await generatePerActionDataFilesV1(common);
|
|
1809
|
-
await generateQueries(sanitizedOntology, fs2, queriesDir, importExt);
|
|
1810
|
-
await generatePerQueryDataFiles(common);
|
|
1811
|
-
await generateIndexFile(fs2, outDir, importExt);
|
|
1812
|
-
await generateBackCompatDeprecatedExports(fs2, outDir, importExt);
|
|
409
|
+
// src/util/stringUnionFrom.ts
|
|
410
|
+
function stringUnionFrom(values) {
|
|
411
|
+
if (values.length === 0) {
|
|
412
|
+
return "never";
|
|
413
|
+
} else {
|
|
414
|
+
return values.map((v) => `"${v}"`).join("|");
|
|
415
|
+
}
|
|
1813
416
|
}
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
export const $osdkMetadata = { extraUserAgent: "${userAgent}" };
|
|
1824
|
-
${ontologyApiNamespace == null ? `
|
|
1825
|
-
export const $ontologyRid = "${ontology.ontology.rid}";
|
|
1826
|
-
` : ""}
|
|
1827
|
-
`));
|
|
417
|
+
|
|
418
|
+
// src/v2.0/getDescriptionIfPresent.ts
|
|
419
|
+
function getDescriptionIfPresent(description, includeNewline) {
|
|
420
|
+
if (description) {
|
|
421
|
+
return `/**
|
|
422
|
+
* ${description}
|
|
423
|
+
*/${""}`;
|
|
424
|
+
}
|
|
425
|
+
return "";
|
|
1828
426
|
}
|
|
1829
427
|
|
|
1830
428
|
// src/shared/propertyJsdoc.ts
|
|
@@ -1866,7 +464,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
1866
464
|
}, currentFilePath) {
|
|
1867
465
|
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
1868
466
|
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
1869
|
-
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.
|
|
467
|
+
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.raw, true));
|
|
1870
468
|
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
1871
469
|
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
1872
470
|
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
@@ -1875,7 +473,7 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
1875
473
|
const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
|
|
1876
474
|
const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
|
|
1877
475
|
const identifiers = {
|
|
1878
|
-
objectDefIdentifier: `${object.shortApiName}
|
|
476
|
+
objectDefIdentifier: `${object.shortApiName}`,
|
|
1879
477
|
osdkObjectLinksIdentifier,
|
|
1880
478
|
osdkObjectPropsIdentifier,
|
|
1881
479
|
osdkObjectStrictPropsIdentifier,
|
|
@@ -1885,42 +483,18 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
1885
483
|
};
|
|
1886
484
|
function getV2Types() {
|
|
1887
485
|
return `import type {
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
DefaultToFalse as $DefaultToFalse,
|
|
1894
|
-
FetchPageArgs as $FetchPageArgs,
|
|
1895
|
-
FetchPageResult as $FetchPageResult,
|
|
1896
|
-
IsAny as $IsAny,
|
|
1897
|
-
LinkedType as $LinkedType,
|
|
1898
|
-
LinkNames as $LinkNames,
|
|
1899
|
-
NullabilityAdherence as $NullabilityAdherence,
|
|
1900
|
-
NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
|
|
486
|
+
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
487
|
+
MinObjectDef as $ObjectTypeDefinition,
|
|
488
|
+
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
489
|
+
} from "@osdk/api";
|
|
490
|
+
import type {
|
|
1901
491
|
ObjectSet as $ObjectSet,
|
|
1902
492
|
Osdk as $Osdk,
|
|
1903
493
|
OsdkObject as $OsdkObject,
|
|
1904
|
-
OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
|
|
1905
|
-
OsdkObjectLinksObject as $OsdkObjectLinksObject,
|
|
1906
|
-
OsdkObjectPropertyType as $OsdkObjectPropertyType,
|
|
1907
|
-
PageResult as $PageResult,
|
|
1908
|
-
PropertyValueClientToWire as $PropertyValueClientToWire,
|
|
1909
494
|
PropertyValueWireToClient as $PropType,
|
|
1910
|
-
Result as $Result,
|
|
1911
|
-
SelectArg as $SelectArg,
|
|
1912
495
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
1913
|
-
SingleLinkAccessor as $SingleLinkAccessor
|
|
1914
|
-
SingleOsdkResult as $SingleOsdkResult,
|
|
1915
|
-
ValidToFrom as $ValidToFrom,
|
|
1916
|
-
WhereClause as $WhereClause,
|
|
1917
496
|
} from "@osdk/client.api";
|
|
1918
|
-
|
|
1919
|
-
import type {
|
|
1920
|
-
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
1921
|
-
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1922
|
-
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
1923
|
-
} from "@osdk/api";
|
|
497
|
+
|
|
1924
498
|
|
|
1925
499
|
export namespace ${object.shortApiName} {
|
|
1926
500
|
|
|
@@ -1933,34 +507,23 @@ function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
|
1933
507
|
${createProps(object, "StrictProps", true)}
|
|
1934
508
|
|
|
1935
509
|
${createObjectSet(object, identifiers)}
|
|
1936
|
-
|
|
1937
|
-
${createDefinition(object, ontology, "Definition", identifiers)}
|
|
510
|
+
|
|
1938
511
|
${createOsdkObject(object, "OsdkObject", identifiers)}
|
|
1939
512
|
}
|
|
1940
513
|
|
|
1941
514
|
|
|
1942
515
|
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
export type ${objectDefIdentifier} = ${object.shortApiName}.Definition;
|
|
1946
|
-
|
|
1947
|
-
|
|
516
|
+
${createDefinition(object, ontology, object.shortApiName, identifiers)}
|
|
1948
517
|
`;
|
|
1949
518
|
}
|
|
1950
519
|
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
1951
520
|
return `${imports}${getV2Types()}
|
|
1952
521
|
|
|
1953
|
-
export const ${object.shortApiName}: ${objectDefIdentifier}
|
|
522
|
+
export const ${object.shortApiName}: ${objectDefIdentifier}
|
|
1954
523
|
= {
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1958
|
-
linksType: undefined as any,
|
|
1959
|
-
strictProps: undefined as any,
|
|
1960
|
-
${stringify(definition, {
|
|
1961
|
-
osdkMetadata: (value) => void 0
|
|
1962
|
-
})}
|
|
1963
|
-
|
|
524
|
+
type: "${object instanceof EnhancedObjectType ? "object" : "interface"}",
|
|
525
|
+
apiName: "${object.fullApiName}",
|
|
526
|
+
osdkMetadata: $osdkMetadata,
|
|
1964
527
|
};`;
|
|
1965
528
|
}
|
|
1966
529
|
function createOsdkObject(object, identifier, {
|
|
@@ -1969,7 +532,7 @@ function createOsdkObject(object, identifier, {
|
|
|
1969
532
|
osdkObjectStrictPropsIdentifier,
|
|
1970
533
|
osdkObjectLinksIdentifier
|
|
1971
534
|
}) {
|
|
1972
|
-
|
|
535
|
+
object.getCleanedUpDefinition(true);
|
|
1973
536
|
return `
|
|
1974
537
|
export type ${identifier}<
|
|
1975
538
|
OPTIONS extends never | "$notStrict" | "$rid" = never,
|
|
@@ -1979,23 +542,10 @@ function createOsdkObject(object, identifier, {
|
|
|
1979
542
|
= $Osdk<
|
|
1980
543
|
${objectDefIdentifier},
|
|
1981
544
|
K | OPTIONS
|
|
1982
|
-
>
|
|
1983
|
-
|
|
1984
|
-
? ${osdkObjectStrictPropsIdentifier} :
|
|
1985
|
-
OPTIONS extends "$notStrict" ? ${osdkObjectPropsIdentifier} : ${osdkObjectStrictPropsIdentifier}
|
|
1986
|
-
, K
|
|
1987
|
-
> & {
|
|
1988
|
-
readonly $link: ${osdkObjectLinksIdentifier};
|
|
1989
|
-
readonly $title: string | undefined; // FIXME
|
|
1990
|
-
readonly $primaryKey: ${"primaryKeyApiName" in definition ? `
|
|
1991
|
-
$OsdkObjectPropertyType<${JSON.stringify(definition.properties[definition.primaryKeyApiName])},${true}>` : "string | number"}
|
|
545
|
+
>
|
|
546
|
+
|
|
1992
547
|
;
|
|
1993
|
-
|
|
1994
|
-
readonly $as: <NEW_Q extends $ValidToFrom<${objectDefIdentifier}>>(type: NEW_Q | string) => $Osdk<
|
|
1995
|
-
NEW_Q,
|
|
1996
|
-
$ConvertProps<${objectDefIdentifier}, NEW_Q, K>
|
|
1997
|
-
>;
|
|
1998
|
-
} & $OsdkObject<"${object.fullApiName}">;`;
|
|
548
|
+
`;
|
|
1999
549
|
}
|
|
2000
550
|
function createObjectSet(object, {
|
|
2001
551
|
objectDefIdentifier,
|
|
@@ -2010,74 +560,7 @@ $ObjectSet<${objectDefIdentifier},
|
|
|
2010
560
|
${objectSetIdentifier}
|
|
2011
561
|
>
|
|
2012
562
|
{
|
|
2013
|
-
readonly aggregate: <const AO extends $AggregateOpts<${objectDefIdentifier}>>(
|
|
2014
|
-
req: $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<${objectDefIdentifier}, AO>,
|
|
2015
|
-
) => Promise<$AggregationsResults<${objectDefIdentifier}, AO>>;
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
readonly pivotTo: <const L extends $LinkNames<${objectDefIdentifier}>>(type: L) => $LinkedType<${objectDefIdentifier}, L>["objectSet"];
|
|
2019
|
-
${object instanceof EnhancedObjectType ? `
|
|
2020
|
-
readonly fetchOne: <
|
|
2021
|
-
const L extends ${propertyKeysIdentifier},
|
|
2022
|
-
const R extends boolean,
|
|
2023
|
-
const S extends false | "throw" = $NullabilityAdherenceDefault,
|
|
2024
|
-
>(
|
|
2025
|
-
primaryKey: $PropertyValueClientToWire[${objectDefIdentifier}["primaryKeyType"]],
|
|
2026
|
-
options?: $SelectArg<${objectDefIdentifier}, L, R, S>,
|
|
2027
|
-
) => Promise<
|
|
2028
|
-
${osdkObjectIdentifier}<
|
|
2029
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never: "$rid" ),
|
|
2030
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2031
|
-
>>
|
|
2032
|
-
;
|
|
2033
563
|
|
|
2034
|
-
readonly fetchOneWithErrors: <
|
|
2035
|
-
const L extends ${propertyKeysIdentifier},
|
|
2036
|
-
const R extends boolean,
|
|
2037
|
-
const S extends false | "throw" = $NullabilityAdherenceDefault,
|
|
2038
|
-
>(
|
|
2039
|
-
primaryKey: $PropertyValueClientToWire[${objectDefIdentifier}["primaryKeyType"]],
|
|
2040
|
-
options?: $SelectArg<${objectDefIdentifier}, L, R, S>,
|
|
2041
|
-
) => Promise<$Result<
|
|
2042
|
-
${osdkObjectIdentifier}<
|
|
2043
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false?never: "$rid"),
|
|
2044
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2045
|
-
>
|
|
2046
|
-
>>
|
|
2047
|
-
|
|
2048
|
-
;
|
|
2049
|
-
|
|
2050
|
-
` : ""}
|
|
2051
|
-
|
|
2052
|
-
readonly fetchPage: <
|
|
2053
|
-
const L extends ${propertyKeysIdentifier},
|
|
2054
|
-
const R extends boolean,
|
|
2055
|
-
const const A extends $Augments,
|
|
2056
|
-
const S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
|
|
2057
|
-
>(
|
|
2058
|
-
args?: $FetchPageArgs<${objectDefIdentifier}, L, R, A, S>,
|
|
2059
|
-
) => Promise<
|
|
2060
|
-
$PageResult<${osdkObjectIdentifier}<
|
|
2061
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never: "$rid"),
|
|
2062
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2063
|
-
>>
|
|
2064
|
-
>;
|
|
2065
|
-
|
|
2066
|
-
readonly fetchPageWithErrors: <
|
|
2067
|
-
const L extends ${propertyKeysIdentifier},
|
|
2068
|
-
const R extends boolean,
|
|
2069
|
-
const A extends $Augments,
|
|
2070
|
-
const S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
|
|
2071
|
-
>(
|
|
2072
|
-
args?: $FetchPageArgs<${objectDefIdentifier}, L, R, A, S>,
|
|
2073
|
-
) => Promise<$Result<
|
|
2074
|
-
$PageResult<${osdkObjectIdentifier}<
|
|
2075
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never : "$rid"),
|
|
2076
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2077
|
-
>>
|
|
2078
|
-
>>;
|
|
2079
|
-
|
|
2080
|
-
readonly asyncIter: () => AsyncIterableIterator<${osdkObjectIdentifier}>;
|
|
2081
564
|
}
|
|
2082
565
|
`;
|
|
2083
566
|
}
|
|
@@ -2109,8 +592,11 @@ function createDefinition(object, ontology, identifier, {
|
|
|
2109
592
|
}) {
|
|
2110
593
|
const definition = object.getCleanedUpDefinition(true);
|
|
2111
594
|
return `
|
|
2112
|
-
export interface ${identifier} extends ${object instanceof EnhancedObjectType ? `$ObjectTypeDefinition` : `$InterfaceDefinition`}<"${object.fullApiName}", ${objectDefIdentifier}
|
|
595
|
+
export interface ${identifier} extends ${object instanceof EnhancedObjectType ? `$ObjectTypeDefinition` : `$InterfaceDefinition`}<"${object.fullApiName}", ${objectDefIdentifier}> {
|
|
2113
596
|
osdkMetadata: typeof $osdkMetadata;
|
|
597
|
+
type: "${object instanceof EnhancedObjectType ? "object" : "interface"}";
|
|
598
|
+
apiName: "${object.fullApiName}";
|
|
599
|
+
__DefinitionMetadata?: {
|
|
2114
600
|
objectSet: ${objectSetIdentifier};
|
|
2115
601
|
props: ${osdkObjectPropsIdentifier};
|
|
2116
602
|
linksType: ${osdkObjectLinksIdentifier};
|
|
@@ -2118,8 +604,6 @@ function createDefinition(object, ontology, identifier, {
|
|
|
2118
604
|
${stringify(definition, {
|
|
2119
605
|
osdkMetadata: () => void 0,
|
|
2120
606
|
// we are going to reference another object instead
|
|
2121
|
-
type: () => void 0,
|
|
2122
|
-
apiName: () => void 0,
|
|
2123
607
|
links: (_value) => `{
|
|
2124
608
|
${stringify(definition.links, {
|
|
2125
609
|
"*": (definition2) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true)}, ${definition2.multiplicity}>`
|
|
@@ -2133,6 +617,7 @@ function createDefinition(object, ontology, identifier, {
|
|
|
2133
617
|
})}
|
|
2134
618
|
}`
|
|
2135
619
|
})}
|
|
620
|
+
}
|
|
2136
621
|
}
|
|
2137
622
|
`;
|
|
2138
623
|
}
|
|
@@ -2144,7 +629,7 @@ function createLinks(ontology, object, identifier) {
|
|
|
2144
629
|
${stringify(definition.links, {
|
|
2145
630
|
"*": (definition2, _, key) => {
|
|
2146
631
|
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true);
|
|
2147
|
-
return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}
|
|
632
|
+
return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}>`}
|
|
2148
633
|
`];
|
|
2149
634
|
}
|
|
2150
635
|
})}
|
|
@@ -2163,22 +648,18 @@ async function generatePerActionDataFiles({
|
|
|
2163
648
|
importExt = "",
|
|
2164
649
|
ontology: enhancedOntology
|
|
2165
650
|
}) {
|
|
2166
|
-
const outDir =
|
|
651
|
+
const outDir = path5__default.join(rootOutDir, "ontology", "actions");
|
|
2167
652
|
await fs2.mkdir(outDir, {
|
|
2168
653
|
recursive: true
|
|
2169
654
|
});
|
|
2170
655
|
await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
|
|
2171
|
-
const currentFilePath = `${
|
|
2172
|
-
const uniqueApiNamesArray =
|
|
656
|
+
const currentFilePath = `${path5__default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
|
|
657
|
+
const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.raw);
|
|
2173
658
|
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
2174
|
-
const uniqueApiNamesString =
|
|
2175
|
-
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.
|
|
2176
|
-
const {
|
|
2177
|
-
parameters,
|
|
2178
|
-
...actionDefSansParameters
|
|
2179
|
-
} = fullActionDef;
|
|
659
|
+
const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
|
|
660
|
+
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
|
|
2180
661
|
function createParamsDef() {
|
|
2181
|
-
const entries = Object.entries(parameters);
|
|
662
|
+
const entries = Object.entries(fullActionDef.parameters ?? {});
|
|
2182
663
|
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
2183
664
|
if (entries.length === 0) {
|
|
2184
665
|
return `// Represents the definition of the parameters for the action
|
|
@@ -2196,9 +677,9 @@ async function generatePerActionDataFiles({
|
|
|
2196
677
|
return JSON.stringify(type);
|
|
2197
678
|
} else if (type.type === "object") {
|
|
2198
679
|
const obj = enhancedOntology.requireObjectType(type.object);
|
|
2199
|
-
return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}
|
|
680
|
+
return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}>`;
|
|
2200
681
|
} else if (type.type === "objectSet") {
|
|
2201
|
-
return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}
|
|
682
|
+
return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}>`;
|
|
2202
683
|
}
|
|
2203
684
|
return void 0;
|
|
2204
685
|
}
|
|
@@ -2211,13 +692,17 @@ async function generatePerActionDataFiles({
|
|
|
2211
692
|
if (typeof input === "string") {
|
|
2212
693
|
return `ActionParam.PrimitiveType<${JSON.stringify(input)}>`;
|
|
2213
694
|
} else if (input.type === "object") {
|
|
2214
|
-
return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}
|
|
695
|
+
return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
2215
696
|
} else if (input.type === "objectSet") {
|
|
2216
|
-
return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}
|
|
697
|
+
return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
2217
698
|
}
|
|
2218
699
|
}
|
|
2219
700
|
function createV2Types() {
|
|
2220
|
-
|
|
701
|
+
`${action.shortApiName}$Params`;
|
|
702
|
+
let jsDocBlock = ["/**"];
|
|
703
|
+
if (action.description != null) {
|
|
704
|
+
jsDocBlock.push(`* ${action.description}`);
|
|
705
|
+
}
|
|
2221
706
|
return `
|
|
2222
707
|
|
|
2223
708
|
export namespace ${action.shortApiName}{
|
|
@@ -2225,27 +710,16 @@ async function generatePerActionDataFiles({
|
|
|
2225
710
|
|
|
2226
711
|
${getDescriptionIfPresent(action.description)}
|
|
2227
712
|
export interface Params {
|
|
2228
|
-
${stringify(parameters, {
|
|
713
|
+
${stringify(fullActionDef.parameters, {
|
|
2229
714
|
"*": (ogValue, _, ogKey) => {
|
|
2230
715
|
const key = `${getDescriptionIfPresent(ogValue.description)}
|
|
2231
716
|
readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
|
|
2232
717
|
const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
|
|
718
|
+
jsDocBlock.push(`* @param {${getActionParamType(ogValue.type)}} ${ogValue.nullable ? `[${ogKey}]` : `${ogKey}`} ${ogValue.description ?? ""} `);
|
|
2233
719
|
return [key, value];
|
|
2234
720
|
}
|
|
2235
721
|
})}
|
|
2236
722
|
}
|
|
2237
|
-
/** @deprecated **/
|
|
2238
|
-
export type Parameters = Params;
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
// Represents the definition of the action
|
|
2242
|
-
export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
|
|
2243
|
-
${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
|
|
2244
|
-
return `${key}: ${JSON.stringify(value)};`;
|
|
2245
|
-
}).join("\n")}
|
|
2246
|
-
parameters: ${action.definitionParamsIdentifier};
|
|
2247
|
-
osdkMetadata: typeof $osdkMetadata;
|
|
2248
|
-
}
|
|
2249
723
|
|
|
2250
724
|
// Represents a fqn of the action
|
|
2251
725
|
export interface Signatures {
|
|
@@ -2257,19 +731,36 @@ async function generatePerActionDataFiles({
|
|
|
2257
731
|
|
|
2258
732
|
}
|
|
2259
733
|
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
export
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
734
|
+
|
|
735
|
+
${jsDocBlock.join("\n")}
|
|
736
|
+
*/
|
|
737
|
+
export interface ${action.shortApiName} extends MinActionDef<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
|
|
738
|
+
__DefinitionMetadata?: {
|
|
739
|
+
${stringify(fullActionDef, {
|
|
740
|
+
"parameters": () => action.definitionParamsIdentifier
|
|
741
|
+
})}
|
|
742
|
+
|
|
743
|
+
signatures: ${action.shortApiName}.Signatures;
|
|
744
|
+
},
|
|
745
|
+
${stringify(fullActionDef, {
|
|
746
|
+
"description": () => void 0,
|
|
747
|
+
"displayName": () => void 0,
|
|
748
|
+
"modifiedEntities": () => void 0,
|
|
749
|
+
"parameters": () => void 0
|
|
750
|
+
})}
|
|
751
|
+
osdkMetadata: typeof $osdkMetadata;
|
|
752
|
+
}
|
|
2267
753
|
`;
|
|
2268
754
|
}
|
|
2269
755
|
function createV2Object() {
|
|
2270
|
-
return ` export const ${action.shortApiName}: ${action.
|
|
756
|
+
return ` export const ${action.shortApiName}: ${action.shortApiName} =
|
|
2271
757
|
{
|
|
2272
|
-
${stringify(fullActionDef
|
|
758
|
+
${stringify(fullActionDef, {
|
|
759
|
+
"description": () => void 0,
|
|
760
|
+
"displayName": () => void 0,
|
|
761
|
+
"modifiedEntities": () => void 0,
|
|
762
|
+
"parameters": () => void 0
|
|
763
|
+
})},
|
|
2273
764
|
osdkMetadata: $osdkMetadata
|
|
2274
765
|
}
|
|
2275
766
|
`;
|
|
@@ -2294,11 +785,10 @@ async function generatePerActionDataFiles({
|
|
|
2294
785
|
}
|
|
2295
786
|
}
|
|
2296
787
|
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
|
|
2297
|
-
await fs2.writeFile(
|
|
2298
|
-
import type {
|
|
2299
|
-
import type {
|
|
788
|
+
await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
789
|
+
import type { MinActionDef, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
|
|
790
|
+
import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
|
|
2300
791
|
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
2301
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2302
792
|
${imports}
|
|
2303
793
|
|
|
2304
794
|
|
|
@@ -2307,8 +797,8 @@ async function generatePerActionDataFiles({
|
|
|
2307
797
|
${createV2Object()}
|
|
2308
798
|
`));
|
|
2309
799
|
}));
|
|
2310
|
-
const indexFileRelPath =
|
|
2311
|
-
await fs2.writeFile(
|
|
800
|
+
const indexFileRelPath = path5__default.join("ontology", "actions.ts");
|
|
801
|
+
await fs2.writeFile(path5__default.join(rootOutDir, indexFileRelPath), await formatTs(`
|
|
2312
802
|
${Object.values(enhancedOntology.actionTypes).map((action) => {
|
|
2313
803
|
const exportConstLine = `export {${action.shortApiName} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
2314
804
|
return exportConstLine;
|
|
@@ -2316,11 +806,11 @@ async function generatePerActionDataFiles({
|
|
|
2316
806
|
${Object.keys(ontology.actionTypes).length === 0 ? "export {};" : ""}
|
|
2317
807
|
`));
|
|
2318
808
|
}
|
|
2319
|
-
function
|
|
809
|
+
function extractReferencedObjectsFromAction(actionType) {
|
|
2320
810
|
const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({
|
|
2321
811
|
dataType
|
|
2322
812
|
}) => {
|
|
2323
|
-
const objectTypeReference =
|
|
813
|
+
const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);
|
|
2324
814
|
return objectTypeReference ? [objectTypeReference] : [];
|
|
2325
815
|
});
|
|
2326
816
|
const referenceObjectsInEdits = actionType.operations.flatMap((value) => {
|
|
@@ -2332,18 +822,19 @@ function extractReferencedObjectsFromAction2(actionType) {
|
|
|
2332
822
|
case "deleteObject":
|
|
2333
823
|
case "createLink":
|
|
2334
824
|
case "deleteLink":
|
|
825
|
+
default:
|
|
2335
826
|
return [];
|
|
2336
827
|
}
|
|
2337
828
|
});
|
|
2338
829
|
return [...referenceObjectsInEdits, ...referencedObjectsInParameters];
|
|
2339
830
|
}
|
|
2340
|
-
function
|
|
831
|
+
function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
2341
832
|
switch (actionParameter.type) {
|
|
2342
833
|
case "objectSet":
|
|
2343
834
|
case "object":
|
|
2344
835
|
return actionParameter.objectTypeApiName;
|
|
2345
836
|
case "array":
|
|
2346
|
-
return
|
|
837
|
+
return extractReferencedObjectsFromActionParameter(actionParameter.subType);
|
|
2347
838
|
case "string":
|
|
2348
839
|
case "boolean":
|
|
2349
840
|
case "attachment":
|
|
@@ -2355,14 +846,70 @@ function extractReferencedObjectsFromActionParameter2(actionParameter) {
|
|
|
2355
846
|
return void 0;
|
|
2356
847
|
}
|
|
2357
848
|
}
|
|
849
|
+
|
|
850
|
+
// src/shared/getObjectTypesFromQueryDataType.ts
|
|
851
|
+
function getObjectTypesFromQueryDataType(dataType, types) {
|
|
852
|
+
switch (dataType.type) {
|
|
853
|
+
case "array":
|
|
854
|
+
case "set":
|
|
855
|
+
getObjectTypesFromQueryDataType(dataType.subType, types);
|
|
856
|
+
return;
|
|
857
|
+
case "object":
|
|
858
|
+
types.add(dataType.objectTypeApiName);
|
|
859
|
+
return;
|
|
860
|
+
case "objectSet":
|
|
861
|
+
types.add(dataType.objectTypeApiName);
|
|
862
|
+
return;
|
|
863
|
+
case "struct":
|
|
864
|
+
for (const prop of Object.values(dataType.fields)) {
|
|
865
|
+
getObjectTypesFromQueryDataType(prop.fieldType, types);
|
|
866
|
+
}
|
|
867
|
+
return;
|
|
868
|
+
case "union":
|
|
869
|
+
for (const type of dataType.unionTypes) {
|
|
870
|
+
getObjectTypesFromQueryDataType(type, types);
|
|
871
|
+
}
|
|
872
|
+
return;
|
|
873
|
+
case "attachment":
|
|
874
|
+
case "boolean":
|
|
875
|
+
case "date":
|
|
876
|
+
case "double":
|
|
877
|
+
case "float":
|
|
878
|
+
case "integer":
|
|
879
|
+
case "long":
|
|
880
|
+
case "null":
|
|
881
|
+
case "string":
|
|
882
|
+
case "threeDimensionalAggregation":
|
|
883
|
+
case "timestamp":
|
|
884
|
+
case "twoDimensionalAggregation":
|
|
885
|
+
case "unsupported":
|
|
886
|
+
return;
|
|
887
|
+
default:
|
|
888
|
+
throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
|
|
892
|
+
// src/shared/getObjectTypeApiNamesFromQuery.ts
|
|
893
|
+
function getObjectTypeApiNamesFromQuery(query) {
|
|
894
|
+
const types = /* @__PURE__ */ new Set();
|
|
895
|
+
for (const {
|
|
896
|
+
dataType
|
|
897
|
+
} of Object.values(query.parameters)) {
|
|
898
|
+
getObjectTypesFromQueryDataType(dataType, types);
|
|
899
|
+
}
|
|
900
|
+
getObjectTypesFromQueryDataType(query.output, types);
|
|
901
|
+
return Array.from(types);
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
// src/v2.0/generatePerQueryDataFiles.ts
|
|
2358
905
|
async function generatePerQueryDataFilesV2({
|
|
2359
906
|
fs: fs2,
|
|
2360
907
|
outDir: rootOutDir,
|
|
2361
908
|
ontology,
|
|
2362
909
|
importExt = ""
|
|
2363
910
|
}, v2) {
|
|
2364
|
-
const relOutDir =
|
|
2365
|
-
const outDir =
|
|
911
|
+
const relOutDir = path5__default.join(".", "ontology", "queries");
|
|
912
|
+
const outDir = path5__default.join(rootOutDir, "ontology", "queries");
|
|
2366
913
|
await fs2.mkdir(outDir, {
|
|
2367
914
|
recursive: true
|
|
2368
915
|
});
|
|
@@ -2376,14 +923,15 @@ async function generatePerQueryDataFilesV2({
|
|
|
2376
923
|
`));
|
|
2377
924
|
}
|
|
2378
925
|
async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology) {
|
|
2379
|
-
const relFilePath =
|
|
926
|
+
const relFilePath = path5__default.join(relOutDir, `${query.shortApiName}.ts`);
|
|
2380
927
|
const objectTypes = getObjectTypeApiNamesFromQuery(query);
|
|
2381
|
-
const
|
|
2382
|
-
const
|
|
928
|
+
const objectTypeObjects = new Set(objectTypes.map((o) => ontology.requireObjectType(o)));
|
|
929
|
+
const importObjects = getObjectImports(objectTypeObjects, "", relFilePath, true);
|
|
930
|
+
const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw));
|
|
2383
931
|
const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
|
|
2384
932
|
const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
|
|
2385
|
-
await fs2.writeFile(
|
|
2386
|
-
import type {
|
|
933
|
+
await fs2.writeFile(path5__default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
|
|
934
|
+
import type { MinQueryDef , VersionBound} from "@osdk/api";
|
|
2387
935
|
import type { QueryParam, QueryResult } from "@osdk/client.api";
|
|
2388
936
|
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2389
937
|
${importObjects}
|
|
@@ -2411,7 +959,7 @@ async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ont
|
|
|
2411
959
|
|
|
2412
960
|
` : ""}
|
|
2413
961
|
|
|
2414
|
-
export interface Definition extends
|
|
962
|
+
export interface Definition extends MinQueryDef<
|
|
2415
963
|
"${query.fullApiName}",
|
|
2416
964
|
${referencedObjectTypes},
|
|
2417
965
|
${query.shortApiName}.Signature
|
|
@@ -2485,15 +1033,6 @@ function queryParamJsDoc(param, {
|
|
|
2485
1033
|
`;
|
|
2486
1034
|
return ret;
|
|
2487
1035
|
}
|
|
2488
|
-
function getObjectImports2(enhancedOntology, objectTypes, filePath) {
|
|
2489
|
-
let ret = "";
|
|
2490
|
-
for (const fqObjectApiName of objectTypes) {
|
|
2491
|
-
const obj = enhancedOntology.requireObjectType(fqObjectApiName);
|
|
2492
|
-
ret += `import type { ${obj.getDefinitionIdentifier(true)} as ${obj.getImportedDefinitionIdentifier(true)} } from "${obj.getImportPathRelTo(filePath)}";
|
|
2493
|
-
`;
|
|
2494
|
-
}
|
|
2495
|
-
return ret;
|
|
2496
|
-
}
|
|
2497
1036
|
function getQueryParamType(enhancedOntology, input, type) {
|
|
2498
1037
|
let inner = `unknown /* ${input.type} */`;
|
|
2499
1038
|
switch (input.type) {
|
|
@@ -2534,11 +1073,11 @@ function getQueryParamType(enhancedOntology, input, type) {
|
|
|
2534
1073
|
return inner;
|
|
2535
1074
|
}
|
|
2536
1075
|
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
|
|
2537
|
-
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.
|
|
1076
|
+
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
|
|
2538
1077
|
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
2539
1078
|
const parents = definition.implements?.map((p) => {
|
|
2540
1079
|
!(ontology.interfaceTypes[p] != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : invariant(false) : void 0;
|
|
2541
|
-
const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).
|
|
1080
|
+
const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));
|
|
2542
1081
|
return it;
|
|
2543
1082
|
}) ?? [];
|
|
2544
1083
|
const mergedProperties = {
|
|
@@ -2579,43 +1118,15 @@ function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology,
|
|
|
2579
1118
|
propertyKeysIdentifier
|
|
2580
1119
|
};
|
|
2581
1120
|
function getV2Types() {
|
|
2582
|
-
return `import type {
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
Augments as $Augments,
|
|
2587
|
-
ConvertProps as $ConvertProps,
|
|
2588
|
-
DefaultToFalse as $DefaultToFalse,
|
|
2589
|
-
FetchPageArgs as $FetchPageArgs,
|
|
2590
|
-
FetchPageResult as $FetchPageResult,
|
|
2591
|
-
IsAny as $IsAny,
|
|
2592
|
-
LinkedType as $LinkedType,
|
|
2593
|
-
LinkNames as $LinkNames,
|
|
2594
|
-
NullabilityAdherence as $NullabilityAdherence,
|
|
2595
|
-
NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
|
|
1121
|
+
return ` import type {
|
|
1122
|
+
InterfaceDefinition as $InterfaceDefinition,
|
|
1123
|
+
} from "@osdk/api";
|
|
1124
|
+
import type {
|
|
2596
1125
|
ObjectSet as $ObjectSet,
|
|
2597
1126
|
Osdk as $Osdk,
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
OsdkObjectPropertyType as $OsdkObjectPropertyType,
|
|
2602
|
-
PageResult as $PageResult,
|
|
2603
|
-
PropertyValueClientToWire as $PropertyValueClientToWire,
|
|
2604
|
-
PropertyValueWireToClient as $PropType,
|
|
2605
|
-
Result as $Result,
|
|
2606
|
-
SelectArg as $SelectArg,
|
|
2607
|
-
SingleLinkAccessor as $SingleLinkAccessor,
|
|
2608
|
-
SingleOsdkResult as $SingleOsdkResult,
|
|
2609
|
-
ValidToFrom as $ValidToFrom,
|
|
2610
|
-
WhereClause as $WhereClause,
|
|
2611
|
-
} from "@osdk/client.api";
|
|
2612
|
-
import type * as $clientApi from "@osdk/client.api";
|
|
2613
|
-
import type {
|
|
2614
|
-
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
2615
|
-
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
2616
|
-
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
2617
|
-
InterfaceDefinition as $InterfaceDefinition,
|
|
2618
|
-
} from "@osdk/api";
|
|
1127
|
+
PropertyValueWireToClient as $PropType, } from "@osdk/client.api";
|
|
1128
|
+
|
|
1129
|
+
|
|
2619
1130
|
|
|
2620
1131
|
|
|
2621
1132
|
|
|
@@ -2688,11 +1199,15 @@ async function generateRootIndexTsFile({
|
|
|
2688
1199
|
importExt,
|
|
2689
1200
|
ontologyApiNamespace
|
|
2690
1201
|
}) {
|
|
2691
|
-
fs2.writeFile(
|
|
2692
|
-
export * from "./ontology/actions${importExt}";
|
|
2693
|
-
export * from "./ontology/objects${importExt}";
|
|
1202
|
+
fs2.writeFile(path5__default.join(outDir, "index.ts"), await formatTs(`export * from "./ontology/actions${importExt}";
|
|
1203
|
+
export * as $Actions from "./ontology/actions${importExt}";
|
|
2694
1204
|
export * from "./ontology/interfaces${importExt}";
|
|
1205
|
+
export * as $Interfaces from "./ontology/interfaces${importExt}";
|
|
1206
|
+
export * from "./ontology/objects${importExt}";
|
|
1207
|
+
export * as $Objects from "./ontology/objects${importExt}";
|
|
2695
1208
|
export * from "./ontology/queries${importExt}";
|
|
1209
|
+
export * as $Queries from "./ontology/queries${importExt}";
|
|
1210
|
+
${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
|
|
2696
1211
|
`));
|
|
2697
1212
|
}
|
|
2698
1213
|
async function generateEachObjectFile(ctx) {
|
|
@@ -2702,18 +1217,17 @@ async function generateEachObjectFile(ctx) {
|
|
|
2702
1217
|
ontology,
|
|
2703
1218
|
importExt
|
|
2704
1219
|
} = ctx;
|
|
2705
|
-
await fs2.mkdir(
|
|
1220
|
+
await fs2.mkdir(path5__default.join(outDir, "ontology", "objects"), {
|
|
2706
1221
|
recursive: true
|
|
2707
1222
|
});
|
|
2708
1223
|
for (const obj of Object.values(ontology.objectTypes)) {
|
|
2709
|
-
const relPath =
|
|
2710
|
-
const outFilePath =
|
|
1224
|
+
const relPath = path5__default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
|
|
1225
|
+
const outFilePath = path5__default.join(outDir, relPath);
|
|
2711
1226
|
await fs2.writeFile(outFilePath, await formatTs(`
|
|
2712
|
-
import type {
|
|
2713
|
-
import type { Osdk } from "@osdk/client.api";
|
|
1227
|
+
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
2714
1228
|
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
2715
1229
|
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2716
|
-
${wireObjectTypeV2ToSdkObjectConstV2(obj.
|
|
1230
|
+
${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
|
|
2717
1231
|
`));
|
|
2718
1232
|
}
|
|
2719
1233
|
}
|
|
@@ -2738,12 +1252,12 @@ async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, ou
|
|
|
2738
1252
|
await generateOntologyMetadataFile(ctx, userAgent);
|
|
2739
1253
|
await generateEachObjectFile(ctx);
|
|
2740
1254
|
await generateOntologyInterfaces(ctx);
|
|
2741
|
-
const actionsDir =
|
|
1255
|
+
const actionsDir = path5__default.join(outDir, "ontology", "actions");
|
|
2742
1256
|
await fs2.mkdir(actionsDir, {
|
|
2743
1257
|
recursive: true
|
|
2744
1258
|
});
|
|
2745
1259
|
await generatePerActionDataFiles(ctx);
|
|
2746
|
-
await fs2.writeFile(
|
|
1260
|
+
await fs2.writeFile(path5__default.join(outDir, "ontology", "objects.ts"), await formatTs(`
|
|
2747
1261
|
${Object.values(enhancedOntology.objectTypes).map((objType) => `export * from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
|
|
2748
1262
|
${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
|
|
2749
1263
|
`));
|
|
@@ -2755,16 +1269,14 @@ async function generateOntologyInterfaces({
|
|
|
2755
1269
|
ontology,
|
|
2756
1270
|
importExt
|
|
2757
1271
|
}) {
|
|
2758
|
-
const interfacesDir =
|
|
1272
|
+
const interfacesDir = path5__default.join(outDir, "ontology", "interfaces");
|
|
2759
1273
|
await fs2.mkdir(interfacesDir, {
|
|
2760
1274
|
recursive: true
|
|
2761
1275
|
});
|
|
2762
1276
|
for (const obj of Object.values(ontology.interfaceTypes)) {
|
|
2763
|
-
await fs2.writeFile(
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
import { $osdkMetadata, $expectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2767
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
1277
|
+
await fs2.writeFile(path5__default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
|
|
1278
|
+
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
1279
|
+
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
2768
1280
|
${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
|
|
2769
1281
|
`));
|
|
2770
1282
|
}
|
|
@@ -2776,26 +1288,29 @@ async function generateOntologyInterfaces({
|
|
|
2776
1288
|
|
|
2777
1289
|
// src/generateClientSdkPackage.ts
|
|
2778
1290
|
async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, ontologyApiNamespace, apiNamespacePackageMap) {
|
|
2779
|
-
if (!packageName) throw new Error("Package name is
|
|
1291
|
+
if (!packageName) throw new Error("Package name is required");
|
|
1292
|
+
if (sdkVersion === "1.1") {
|
|
1293
|
+
throw new Error("This generator version does not support generating v1 sdks");
|
|
1294
|
+
}
|
|
2780
1295
|
for (const packageType of ["module", "commonjs"]) {
|
|
2781
|
-
const outDir =
|
|
2782
|
-
|
|
1296
|
+
const outDir = path5.join(baseOutDir, "dist", packageType);
|
|
1297
|
+
generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, ontologyApiNamespace, apiNamespacePackageMap);
|
|
2783
1298
|
await fs.promises.mkdir(outDir, {
|
|
2784
1299
|
recursive: true
|
|
2785
1300
|
});
|
|
2786
|
-
await writeJson(minimalFs,
|
|
1301
|
+
await writeJson(minimalFs, path5.join(outDir, "package.json"), {
|
|
2787
1302
|
type: packageType
|
|
2788
1303
|
});
|
|
2789
|
-
await writeJson(minimalFs,
|
|
1304
|
+
await writeJson(minimalFs, path5.join(outDir, `tsconfig.json`), {
|
|
2790
1305
|
compilerOptions: getTsCompilerOptions(packageType)
|
|
2791
1306
|
});
|
|
2792
1307
|
}
|
|
2793
|
-
await writeJson(minimalFs,
|
|
2794
|
-
await minimalFs.mkdir(
|
|
1308
|
+
await writeJson(minimalFs, path5.join(baseOutDir, "package.json"), await getPackageJsonContents(packageName, packageVersion, dependencyVersions));
|
|
1309
|
+
await minimalFs.mkdir(path5.join(baseOutDir, "ontology"), {
|
|
2795
1310
|
recursive: true
|
|
2796
1311
|
});
|
|
2797
|
-
await minimalFs.writeFile(
|
|
2798
|
-
await minimalFs.writeFile(
|
|
1312
|
+
await minimalFs.writeFile(path5.join(baseOutDir, "ontology", "objects.js"), `module.exports = require("../../dist/module/ontology/objects")`);
|
|
1313
|
+
await minimalFs.writeFile(path5.join(baseOutDir, "ontology", "objects.d.ts"), `export * from "../dist/module/ontology/objects"`);
|
|
2799
1314
|
}
|
|
2800
1315
|
function getTsCompilerOptions(packageType) {
|
|
2801
1316
|
const commonTsconfig = {
|
|
@@ -2818,39 +1333,30 @@ function getTsCompilerOptions(packageType) {
|
|
|
2818
1333
|
};
|
|
2819
1334
|
return compilerOptions;
|
|
2820
1335
|
}
|
|
2821
|
-
function getExpectedDependencies(
|
|
1336
|
+
function getExpectedDependencies({
|
|
2822
1337
|
osdkApiVersion,
|
|
2823
1338
|
osdkClientVersion,
|
|
2824
|
-
osdkClientApiVersion
|
|
2825
|
-
osdkLegacyClientVersion
|
|
1339
|
+
osdkClientApiVersion
|
|
2826
1340
|
}) {
|
|
2827
1341
|
return {
|
|
2828
1342
|
devDependencies: {
|
|
2829
1343
|
"@osdk/api": osdkApiVersion,
|
|
2830
|
-
|
|
2831
|
-
"@osdk/client.api": osdkClientApiVersion
|
|
2832
|
-
} : {
|
|
2833
|
-
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
2834
|
-
}
|
|
1344
|
+
"@osdk/client.api": osdkClientApiVersion
|
|
2835
1345
|
},
|
|
2836
1346
|
peerDependencies: {
|
|
2837
1347
|
"@osdk/api": osdkApiVersion,
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
"@osdk/client": osdkClientVersion
|
|
2841
|
-
} : {
|
|
2842
|
-
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
2843
|
-
}
|
|
1348
|
+
"@osdk/client.api": osdkClientApiVersion,
|
|
1349
|
+
"@osdk/client": osdkClientVersion
|
|
2844
1350
|
}
|
|
2845
1351
|
};
|
|
2846
1352
|
}
|
|
2847
|
-
function getExpectedDependenciesFull(
|
|
1353
|
+
function getExpectedDependenciesFull(dependencyVersions) {
|
|
2848
1354
|
const {
|
|
2849
1355
|
typescriptVersion,
|
|
2850
1356
|
tslibVersion,
|
|
2851
1357
|
areTheTypesWrongVersion
|
|
2852
1358
|
} = dependencyVersions;
|
|
2853
|
-
const base = getExpectedDependencies(
|
|
1359
|
+
const base = getExpectedDependencies(dependencyVersions);
|
|
2854
1360
|
return {
|
|
2855
1361
|
devDependencies: {
|
|
2856
1362
|
...base.devDependencies,
|
|
@@ -2863,7 +1369,7 @@ function getExpectedDependenciesFull(sdkVersion, dependencyVersions) {
|
|
|
2863
1369
|
}
|
|
2864
1370
|
};
|
|
2865
1371
|
}
|
|
2866
|
-
function getPackageJsonContents(name, version,
|
|
1372
|
+
function getPackageJsonContents(name, version, dependencyVersions) {
|
|
2867
1373
|
const esmPrefix = "./dist/module";
|
|
2868
1374
|
const commonjsPrefix = "./dist/commonjs";
|
|
2869
1375
|
return {
|
|
@@ -2875,17 +1381,13 @@ function getPackageJsonContents(name, version, sdkVersion, dependencyVersions) {
|
|
|
2875
1381
|
".": {
|
|
2876
1382
|
import: `${esmPrefix}/index.js`,
|
|
2877
1383
|
require: `${commonjsPrefix}/index.js`
|
|
2878
|
-
},
|
|
2879
|
-
"./ontology/objects": {
|
|
2880
|
-
import: `${esmPrefix}/ontology/objects${sdkVersion === "2.0" ? "" : "/index"}.js`,
|
|
2881
|
-
require: `${commonjsPrefix}/ontology/objects${sdkVersion === "2.0" ? "" : "/index"}.js`
|
|
2882
1384
|
}
|
|
2883
1385
|
},
|
|
2884
1386
|
scripts: {
|
|
2885
1387
|
prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,
|
|
2886
1388
|
check: "npm exec attw $(npm pack)"
|
|
2887
1389
|
},
|
|
2888
|
-
...getExpectedDependenciesFull(
|
|
1390
|
+
...getExpectedDependenciesFull(dependencyVersions),
|
|
2889
1391
|
files: ["**/*.js", "**/*.d.ts", "dist/**/package.json"]
|
|
2890
1392
|
};
|
|
2891
1393
|
}
|
|
@@ -2893,6 +1395,6 @@ async function writeJson(minimalFs, filePath, body) {
|
|
|
2893
1395
|
return await minimalFs.writeFile(filePath, JSON.stringify(body, void 0, 2) + "\n");
|
|
2894
1396
|
}
|
|
2895
1397
|
|
|
2896
|
-
export { generateClientSdkPackage as __UNSTABLE_generateClientSdkPackage,
|
|
1398
|
+
export { generateClientSdkPackage as __UNSTABLE_generateClientSdkPackage, generateClientSdkVersionTwoPointZero, getExpectedDependencies };
|
|
2897
1399
|
//# sourceMappingURL=index.js.map
|
|
2898
1400
|
//# sourceMappingURL=index.js.map
|