@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/cjs/index.cjs
DELETED
|
@@ -1,2928 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path16 = require('path');
|
|
5
|
-
var generatorConverters = require('@osdk/generator-converters');
|
|
6
|
-
var prettier = require('prettier');
|
|
7
|
-
var organizeImports = require('prettier-plugin-organize-imports');
|
|
8
|
-
var fastDeepEqual = require('fast-deep-equal');
|
|
9
|
-
var invariant = require('tiny-invariant');
|
|
10
|
-
|
|
11
|
-
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
-
|
|
13
|
-
function _interopNamespace(e) {
|
|
14
|
-
if (e && e.__esModule) return e;
|
|
15
|
-
var n = Object.create(null);
|
|
16
|
-
if (e) {
|
|
17
|
-
Object.keys(e).forEach(function (k) {
|
|
18
|
-
if (k !== 'default') {
|
|
19
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
20
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () { return e[k]; }
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
n.default = e;
|
|
28
|
-
return Object.freeze(n);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
32
|
-
var path16__namespace = /*#__PURE__*/_interopNamespace(path16);
|
|
33
|
-
var organizeImports__default = /*#__PURE__*/_interopDefault(organizeImports);
|
|
34
|
-
var fastDeepEqual__default = /*#__PURE__*/_interopDefault(fastDeepEqual);
|
|
35
|
-
var invariant__default = /*#__PURE__*/_interopDefault(invariant);
|
|
36
|
-
|
|
37
|
-
// src/generateClientSdkPackage.ts
|
|
38
|
-
var AbstractImportable = class {
|
|
39
|
-
/**
|
|
40
|
-
* Either a path relative to the ourDir (e.g. "./ontology/objects/foo.js") or a normal
|
|
41
|
-
* module import (e.g. "@something/foo")/
|
|
42
|
-
*/
|
|
43
|
-
constructor(common, fullApiName, basePath) {
|
|
44
|
-
this._common = common;
|
|
45
|
-
this.fullApiName = fullApiName;
|
|
46
|
-
[this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);
|
|
47
|
-
const {
|
|
48
|
-
ontologyApiNamespace,
|
|
49
|
-
apiNamespacePackageMap,
|
|
50
|
-
importExt
|
|
51
|
-
} = common;
|
|
52
|
-
this.isLocal = ontologyApiNamespace === this.apiNamespace;
|
|
53
|
-
this.sourcePackage = this.apiNamespace && !this.isLocal ? apiNamespacePackageMap.get(this.apiNamespace) : void 0;
|
|
54
|
-
this.importPath = this.isLocal ? `${basePath}/${this.shortApiName}${importExt}` : this.sourcePackage;
|
|
55
|
-
this.uniqueImportName = this.shortApiName;
|
|
56
|
-
}
|
|
57
|
-
getImportPathRelTo = (filePath) => {
|
|
58
|
-
if (this.importPath.startsWith(".")) {
|
|
59
|
-
const result = path16__namespace.relative(path16__namespace.dirname(filePath), this.importPath);
|
|
60
|
-
if (result.startsWith(".")) {
|
|
61
|
-
return result;
|
|
62
|
-
} else {
|
|
63
|
-
return `./${result}`;
|
|
64
|
-
}
|
|
65
|
-
} else {
|
|
66
|
-
return this.importPath;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
var EnhancedBase = class extends AbstractImportable {
|
|
71
|
-
constructor(common, og, fullApiName, basePath) {
|
|
72
|
-
super(common, fullApiName, basePath);
|
|
73
|
-
this.og = og;
|
|
74
|
-
if (!this.isLocal && !this.sourcePackage) {
|
|
75
|
-
throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
function extractNamespace(fqApiName) {
|
|
80
|
-
const last = fqApiName.lastIndexOf(".");
|
|
81
|
-
if (last === -1) return [void 0, fqApiName];
|
|
82
|
-
return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// src/GenerateContext/EnhancedAction.ts
|
|
86
|
-
var EnhancedAction = class extends EnhancedBase {
|
|
87
|
-
constructor(common, og) {
|
|
88
|
-
super(common, og, og.apiName, "./ontology/actions");
|
|
89
|
-
this.og = og;
|
|
90
|
-
}
|
|
91
|
-
get description() {
|
|
92
|
-
return this.og.description;
|
|
93
|
-
}
|
|
94
|
-
get parameters() {
|
|
95
|
-
return this.og.parameters;
|
|
96
|
-
}
|
|
97
|
-
get operations() {
|
|
98
|
-
return this.og.operations;
|
|
99
|
-
}
|
|
100
|
-
get paramsIdentifier() {
|
|
101
|
-
return `${this.shortApiName}.Params`;
|
|
102
|
-
}
|
|
103
|
-
get definitionIdentifier() {
|
|
104
|
-
return `${this.shortApiName}.Definition`;
|
|
105
|
-
}
|
|
106
|
-
get definitionParamsIdentifier() {
|
|
107
|
-
return `${this.shortApiName}.ParamsDefinition`;
|
|
108
|
-
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
// src/util/deleteUndefineds.ts
|
|
112
|
-
function deleteUndefineds(obj) {
|
|
113
|
-
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0));
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
// src/GenerateContext/EnhancedInterfaceType.ts
|
|
117
|
-
var EnhancedInterfaceType = class extends EnhancedBase {
|
|
118
|
-
constructor(common, og) {
|
|
119
|
-
super(common, og, og.apiName, "./ontology/interfaces");
|
|
120
|
-
this.og = og;
|
|
121
|
-
}
|
|
122
|
-
getDefinitionIdentifier(v2) {
|
|
123
|
-
return v2 ? this.shortApiName : `${this.shortApiName}Def`;
|
|
124
|
-
}
|
|
125
|
-
getImportedDefinitionIdentifier(v2) {
|
|
126
|
-
return this.getDefinitionIdentifier(v2);
|
|
127
|
-
}
|
|
128
|
-
get properties() {
|
|
129
|
-
return this.og.properties;
|
|
130
|
-
}
|
|
131
|
-
getCleanedUpDefinition(v2) {
|
|
132
|
-
return deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.og, v2));
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
var EnhancedObjectType = class extends EnhancedBase {
|
|
136
|
-
constructor(common, og) {
|
|
137
|
-
super(common, og, og.objectType.apiName, "./ontology/objects");
|
|
138
|
-
this.og = og;
|
|
139
|
-
}
|
|
140
|
-
getDefinitionIdentifier(v2) {
|
|
141
|
-
return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
|
|
142
|
-
}
|
|
143
|
-
getImportedDefinitionIdentifier(v2) {
|
|
144
|
-
return this.getDefinitionIdentifier(v2);
|
|
145
|
-
}
|
|
146
|
-
getCleanedUpDefinition(v2) {
|
|
147
|
-
return deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.og, v2));
|
|
148
|
-
}
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
// src/GenerateContext/EnhancedQuery.ts
|
|
152
|
-
var EnhancedQuery = class extends EnhancedBase {
|
|
153
|
-
constructor(common, og) {
|
|
154
|
-
super(common, og, og.apiName, "./ontology/queries");
|
|
155
|
-
this.og = og;
|
|
156
|
-
}
|
|
157
|
-
get description() {
|
|
158
|
-
return this.og.description;
|
|
159
|
-
}
|
|
160
|
-
get parameters() {
|
|
161
|
-
return this.og.parameters;
|
|
162
|
-
}
|
|
163
|
-
get output() {
|
|
164
|
-
return this.og.output;
|
|
165
|
-
}
|
|
166
|
-
get paramsIdentifier() {
|
|
167
|
-
return `${this.shortApiName}.Parameters`;
|
|
168
|
-
}
|
|
169
|
-
get definitionIdentifier() {
|
|
170
|
-
return `${this.shortApiName}.Definition`;
|
|
171
|
-
}
|
|
172
|
-
get definitionParamsIdentifier() {
|
|
173
|
-
return `${this.definitionIdentifier}$Params`;
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// src/GenerateContext/EnhancedSharedPropertyType.ts
|
|
178
|
-
var EnhancedSharedPropertyType = class extends EnhancedBase {
|
|
179
|
-
constructor(common, og) {
|
|
180
|
-
super(common, og, og.apiName, "./ontology/interfaces");
|
|
181
|
-
this.og = og;
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
// src/GenerateContext/ForeignType.ts
|
|
186
|
-
var ForeignType = class extends AbstractImportable {
|
|
187
|
-
constructor(_common, type, apiNamespace, shortApiName) {
|
|
188
|
-
super(_common, `${apiNamespace}.${shortApiName}`, _common.apiNamespacePackageMap.get(apiNamespace));
|
|
189
|
-
this._common = _common;
|
|
190
|
-
this.type = type;
|
|
191
|
-
}
|
|
192
|
-
getImportedDefinitionIdentifier(v2) {
|
|
193
|
-
return `$Imported$${this.type}$${this.apiNamespace.replace(/\./g, "$")}$${this.shortApiName}`;
|
|
194
|
-
}
|
|
195
|
-
getDefinitionIdentifier(v2) {
|
|
196
|
-
if (this.type === "objectTypes") {
|
|
197
|
-
return v2 ? this.uniqueImportName : `${this.uniqueImportName}Def`;
|
|
198
|
-
} else {
|
|
199
|
-
return this.uniqueImportName;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
// src/GenerateContext/EnhancedOntologyDefinition.ts
|
|
205
|
-
var EnhancedOntologyDefinition = class {
|
|
206
|
-
constructor(original, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
|
|
207
|
-
this.common = {
|
|
208
|
-
apiNamespacePackageMap,
|
|
209
|
-
enhancedOntology: this,
|
|
210
|
-
importExt,
|
|
211
|
-
ontologyApiNamespace
|
|
212
|
-
};
|
|
213
|
-
this.og = original;
|
|
214
|
-
this.ontology = original.ontology;
|
|
215
|
-
this.objectTypes = remap(original.objectTypes, this.common, EnhancedObjectType);
|
|
216
|
-
this.actionTypes = remap(original.actionTypes, this.common, EnhancedAction);
|
|
217
|
-
this.queryTypes = remap(original.queryTypes, this.common, EnhancedQuery);
|
|
218
|
-
this.interfaceTypes = remap(original.interfaceTypes, this.common, EnhancedInterfaceType);
|
|
219
|
-
this.sharedPropertyTypes = remap(original.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
|
|
220
|
-
}
|
|
221
|
-
#createRequireType = (type) => {
|
|
222
|
-
return (fullApiName, localOnly) => {
|
|
223
|
-
const ret = this[type][fullApiName];
|
|
224
|
-
if (!ret) {
|
|
225
|
-
const [apiNamespace, shortApiName] = extractNamespace(fullApiName);
|
|
226
|
-
if (localOnly || !apiNamespace) {
|
|
227
|
-
throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);
|
|
228
|
-
}
|
|
229
|
-
if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
|
|
230
|
-
throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
|
|
231
|
-
}
|
|
232
|
-
return new ForeignType(this.common, type, apiNamespace, shortApiName);
|
|
233
|
-
}
|
|
234
|
-
return ret;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
requireObjectType = this.#createRequireType("objectTypes");
|
|
238
|
-
requireInterfaceType = this.#createRequireType("interfaceTypes");
|
|
239
|
-
requireActionType = this.#createRequireType("actionTypes");
|
|
240
|
-
requireQueryType = this.#createRequireType("queryTypes");
|
|
241
|
-
requireSharedPropertyType = this.#createRequireType("sharedPropertyTypes");
|
|
242
|
-
};
|
|
243
|
-
function remap(r, common, Constructor) {
|
|
244
|
-
return Object.fromEntries(Object.entries(r ?? {}).map(([fullApiName, v]) => {
|
|
245
|
-
return [fullApiName, new Constructor(common, v)];
|
|
246
|
-
}).sort((a, b) => a[0].localeCompare(b[0])));
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// src/GenerateContext/enhanceOntology.ts
|
|
250
|
-
function enhanceOntology(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
|
|
251
|
-
return new EnhancedOntologyDefinition(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// src/shared/sanitizeMetadata.ts
|
|
255
|
-
function sanitizeMetadata(ontology) {
|
|
256
|
-
return {
|
|
257
|
-
...ontology,
|
|
258
|
-
actionTypes: Object.fromEntries(Object.values(ontology.actionTypes).map((actionType) => {
|
|
259
|
-
return [camelize(actionType.apiName), {
|
|
260
|
-
...actionType,
|
|
261
|
-
apiName: camelize(actionType.apiName)
|
|
262
|
-
}];
|
|
263
|
-
}))
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function camelize(name) {
|
|
267
|
-
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
// src/util/verifyOutDir.ts
|
|
271
|
-
async function verifyOutDir(outDir, fs2) {
|
|
272
|
-
try {
|
|
273
|
-
const contents = await fs2.readdir(outDir);
|
|
274
|
-
if (contents.length !== 0) {
|
|
275
|
-
throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);
|
|
276
|
-
}
|
|
277
|
-
} catch (e) {
|
|
278
|
-
if (e.code === "ENOENT") ; else {
|
|
279
|
-
throw e;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
// src/shared/getEditedEntities.ts
|
|
285
|
-
function getModifiedEntityTypes(action) {
|
|
286
|
-
const addedObjects = /* @__PURE__ */ new Set();
|
|
287
|
-
const modifiedObjects = /* @__PURE__ */ new Set();
|
|
288
|
-
for (const operation of action.operations) {
|
|
289
|
-
switch (operation.type) {
|
|
290
|
-
case "createObject":
|
|
291
|
-
addedObjects.add(operation.objectTypeApiName);
|
|
292
|
-
break;
|
|
293
|
-
case "modifyObject":
|
|
294
|
-
modifiedObjects.add(operation.objectTypeApiName);
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
return {
|
|
299
|
-
addedObjects,
|
|
300
|
-
modifiedObjects
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
function formatTs(contents) {
|
|
304
|
-
try {
|
|
305
|
-
return prettier.format(contents, {
|
|
306
|
-
parser: "typescript",
|
|
307
|
-
singleQuote: true,
|
|
308
|
-
trailingComma: "all",
|
|
309
|
-
plugins: [organizeImports__default.default],
|
|
310
|
-
tabWidth: 2,
|
|
311
|
-
printWidth: 120
|
|
312
|
-
});
|
|
313
|
-
} catch (e) {
|
|
314
|
-
console.error("Failed to format file", e);
|
|
315
|
-
console.log(contents);
|
|
316
|
-
return contents;
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
// src/v1.1/generateActions.ts
|
|
321
|
-
async function generateActions(ontology, fs2, outDir, importExt = "") {
|
|
322
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
323
|
-
let actionSignatures = [];
|
|
324
|
-
for (const action of Object.values(ontology.actionTypes)) {
|
|
325
|
-
const entries = Object.entries(action.parameters);
|
|
326
|
-
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
327
|
-
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
328
|
-
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
329
|
-
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
330
|
-
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
331
|
-
let jsDocBlock = ["/**"];
|
|
332
|
-
if (action.description) {
|
|
333
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
334
|
-
}
|
|
335
|
-
let parameterBlock = "";
|
|
336
|
-
if (entries.length > 0) {
|
|
337
|
-
parameterBlock = `params: {
|
|
338
|
-
`;
|
|
339
|
-
for (const [parameterName, parameterData] of entries) {
|
|
340
|
-
parameterBlock += `"${parameterName}"`;
|
|
341
|
-
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
342
|
-
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
343
|
-
parameterBlock += `${typeScriptType};
|
|
344
|
-
`;
|
|
345
|
-
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
346
|
-
}
|
|
347
|
-
parameterBlock += "}, ";
|
|
348
|
-
}
|
|
349
|
-
jsDocBlock.push(`*/`);
|
|
350
|
-
actionSignatures.push(`
|
|
351
|
-
${jsDocBlock.join("\n")}
|
|
352
|
-
${action.apiName}<O extends ActionExecutionOptions>(${parameterBlock}options?: O):
|
|
353
|
-
Promise<Result<ActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;`);
|
|
354
|
-
}
|
|
355
|
-
await fs2.mkdir(outDir, {
|
|
356
|
-
recursive: true
|
|
357
|
-
});
|
|
358
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "Actions.ts"), await formatTs(`
|
|
359
|
-
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, ActionError, Result, ActionResponseFromOptions } from "@osdk/legacy-client";
|
|
360
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
361
|
-
export interface Actions {
|
|
362
|
-
${actionSignatures.join("\n")}
|
|
363
|
-
}
|
|
364
|
-
`));
|
|
365
|
-
}
|
|
366
|
-
function getTypeScriptTypeFromDataType(actionParameter, importedObjects) {
|
|
367
|
-
switch (actionParameter.type) {
|
|
368
|
-
case "objectSet": {
|
|
369
|
-
const objectType = actionParameter.objectTypeApiName;
|
|
370
|
-
importedObjects.add(objectType);
|
|
371
|
-
return `ObjectSet<${objectType}>`;
|
|
372
|
-
}
|
|
373
|
-
case "object": {
|
|
374
|
-
const objectType = actionParameter.objectTypeApiName;
|
|
375
|
-
importedObjects.add(objectType);
|
|
376
|
-
return `${objectType} | ${objectType}["__primaryKey"]`;
|
|
377
|
-
}
|
|
378
|
-
case "array":
|
|
379
|
-
return `Array<${getTypeScriptTypeFromDataType(actionParameter.subType, importedObjects)}>`;
|
|
380
|
-
case "string":
|
|
381
|
-
return `string`;
|
|
382
|
-
case "boolean":
|
|
383
|
-
return `boolean`;
|
|
384
|
-
case "attachment":
|
|
385
|
-
return `Attachment`;
|
|
386
|
-
case "date":
|
|
387
|
-
return `LocalDate`;
|
|
388
|
-
case "double":
|
|
389
|
-
case "integer":
|
|
390
|
-
case "long":
|
|
391
|
-
return `number`;
|
|
392
|
-
case "timestamp":
|
|
393
|
-
return `Timestamp`;
|
|
394
|
-
case "marking":
|
|
395
|
-
return "string";
|
|
396
|
-
default:
|
|
397
|
-
throw new Error(`Unsupported action parameter type: ${actionParameter}`);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
// src/v1.1/backcompat/util/reexportConsts.ts
|
|
402
|
-
function reexportConsts(typesToExport) {
|
|
403
|
-
return `
|
|
404
|
-
import { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
|
|
405
|
-
|
|
406
|
-
${typesToExport.map((q) => `
|
|
407
|
-
/** @deprecated submodule imports aren't public api **/
|
|
408
|
-
export const ${q} = OG_${q};
|
|
409
|
-
`).join("\n\n")}
|
|
410
|
-
`;
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// src/v1.1/backcompat/internal-foundry-oauth-dist/generateConfidentialClientDir.ts
|
|
414
|
-
async function generateConfidentialClientDir(fs2, oauthDistDir, importExt = "") {
|
|
415
|
-
const confidentialClientDistDir = path16__namespace.default.join(oauthDistDir, "ConfidentialClient");
|
|
416
|
-
await fs2.mkdir(confidentialClientDistDir, {
|
|
417
|
-
recursive: true
|
|
418
|
-
});
|
|
419
|
-
await fs2.writeFile(path16__namespace.default.join(confidentialClientDistDir, "index.ts"), await formatTs(`
|
|
420
|
-
export * from "./ConfidentialClientAuth${importExt}";
|
|
421
|
-
`));
|
|
422
|
-
await fs2.writeFile(path16__namespace.default.join(confidentialClientDistDir, "ConfidentialClientAuth.ts"), await formatTs(`
|
|
423
|
-
${reexportConsts(["ConfidentialClientAuth"])}
|
|
424
|
-
`));
|
|
425
|
-
}
|
|
426
|
-
async function generatePublicClientDir(fs2, oauthDistDir, importExt = "") {
|
|
427
|
-
const publicClientDistDir = path16__namespace.default.join(oauthDistDir, "PublicClient");
|
|
428
|
-
await fs2.mkdir(publicClientDistDir, {
|
|
429
|
-
recursive: true
|
|
430
|
-
});
|
|
431
|
-
await fs2.writeFile(path16__namespace.default.join(publicClientDistDir, "index.ts"), await formatTs(`
|
|
432
|
-
export * from "./PublicClientAuth${importExt}";
|
|
433
|
-
`));
|
|
434
|
-
await fs2.writeFile(path16__namespace.default.join(publicClientDistDir, "PublicClientAuth.ts"), await formatTs(`
|
|
435
|
-
${reexportConsts(["PublicClientAuth"])}
|
|
436
|
-
`));
|
|
437
|
-
}
|
|
438
|
-
async function generateUserTokenDir(fs2, oauthDistDir, importExt = "") {
|
|
439
|
-
const userTokenDistDir = path16__namespace.default.join(oauthDistDir, "UserToken");
|
|
440
|
-
await fs2.mkdir(userTokenDistDir, {
|
|
441
|
-
recursive: true
|
|
442
|
-
});
|
|
443
|
-
await fs2.writeFile(path16__namespace.default.join(userTokenDistDir, "index.ts"), await formatTs(`
|
|
444
|
-
export * from "./UserTokenAuth${importExt}";
|
|
445
|
-
`));
|
|
446
|
-
await fs2.writeFile(path16__namespace.default.join(userTokenDistDir, "UserTokenAuth.ts"), await formatTs(`
|
|
447
|
-
${reexportConsts(["UserTokenAuth"])}
|
|
448
|
-
`));
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// src/v1.1/backcompat/util/reexportTypes.ts
|
|
452
|
-
function reexportTypes(typesToExport, genericArgsLeft = "", genericArgsRight = cleanup(genericArgsLeft)) {
|
|
453
|
-
return `
|
|
454
|
-
import type { ${typesToExport.map((q) => `${q} as OG_${q}`).join(", ")}} from "@osdk/legacy-client";
|
|
455
|
-
|
|
456
|
-
${typesToExport.map((q) => `
|
|
457
|
-
/** @deprecated submodule imports aren't public api **/
|
|
458
|
-
export type ${q}${genericArgsLeft} = OG_${q}${genericArgsRight};
|
|
459
|
-
`).join("\n\n")}
|
|
460
|
-
`;
|
|
461
|
-
}
|
|
462
|
-
var captureInBracketsRegex = /<(.*?)>/;
|
|
463
|
-
var captureGenericParamNameRegex = /^\s?(.+?)( extends .*?)?( = .*?)?\s?$/;
|
|
464
|
-
function cleanup(s) {
|
|
465
|
-
if (s.length === 0) return "";
|
|
466
|
-
const genericParameterNames = captureInBracketsRegex.exec(s)?.[1]?.split(",")?.map((a) => {
|
|
467
|
-
return captureGenericParamNameRegex.exec(a)?.[1] ?? a;
|
|
468
|
-
});
|
|
469
|
-
return `<${genericParameterNames?.join(",")}>`;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// src/v1.1/backcompat/generateOAuthDistDir.ts
|
|
473
|
-
async function generateOAuthClientDistDir(outDir, fs2, importExt = "") {
|
|
474
|
-
const oauthDistDir = path16__namespace.join(outDir, "internal", "@foundry", "oauth-client", "dist");
|
|
475
|
-
await fs2.mkdir(oauthDistDir, {
|
|
476
|
-
recursive: true
|
|
477
|
-
});
|
|
478
|
-
await fs2.writeFile(path16__namespace.join(oauthDistDir, "index.ts"), await formatTs(`
|
|
479
|
-
export * from "./Auth${importExt}";
|
|
480
|
-
export * from "./ConfidentialClient/index${importExt}";
|
|
481
|
-
export * from "./OAuthClient${importExt}";
|
|
482
|
-
export * from "./PublicClient/index${importExt}";
|
|
483
|
-
export * from "./Token${importExt}";
|
|
484
|
-
export * from "./UserToken/index${importExt}";
|
|
485
|
-
`));
|
|
486
|
-
await fs2.writeFile(path16__namespace.join(oauthDistDir, "Auth.ts"), await formatTs(reexportTypes(["Auth"])));
|
|
487
|
-
await fs2.writeFile(path16__namespace.join(oauthDistDir, "Token.ts"), await formatTs(reexportTypes(["Token", "TokenValue"])));
|
|
488
|
-
await fs2.writeFile(path16__namespace.join(oauthDistDir, "OAuthClient.ts"), await formatTs(reexportTypes(["AuthSubscription", "UnsubscribeFunction", "SignInResponse", "RefreshResponse", "SignOutResponse"])));
|
|
489
|
-
await fs2.writeFile(path16__namespace.join(oauthDistDir, "OAuthToken.ts"), await formatTs(reexportConsts(["OAuthToken"])));
|
|
490
|
-
await fs2.writeFile(path16__namespace.join(oauthDistDir, "Auth.ts"), await formatTs(reexportTypes(["Auth"])));
|
|
491
|
-
await generateConfidentialClientDir(fs2, oauthDistDir, importExt);
|
|
492
|
-
await generatePublicClientDir(fs2, oauthDistDir, importExt);
|
|
493
|
-
await generateUserTokenDir(fs2, oauthDistDir, importExt);
|
|
494
|
-
}
|
|
495
|
-
async function generateAggregationsAggregations(fs2, aggregationsDir) {
|
|
496
|
-
await fs2.writeFile(path16__namespace.join(aggregationsDir, "Aggregations.ts"), await formatTs(`
|
|
497
|
-
import { LocalDate, Timestamp } from "@osdk/legacy-client";
|
|
498
|
-
` + 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 = {}>")));
|
|
499
|
-
}
|
|
500
|
-
async function generateGroupBy(fs2, aggregationsDir, importExt = "") {
|
|
501
|
-
await fs2.mkdir(path16__namespace.join(aggregationsDir, "groupBy"), {
|
|
502
|
-
recursive: true
|
|
503
|
-
});
|
|
504
|
-
const groupBys = ["BooleanGroupBy", "LocalDateGroupBy", "NumericGroupBy", "StringGroupBy", "TimestampGroupBy"];
|
|
505
|
-
const reexportFiles = [...groupBys, "GroupKeyType"];
|
|
506
|
-
for (const key of reexportFiles) {
|
|
507
|
-
await fs2.writeFile(path16__namespace.join(aggregationsDir, "groupBy", `${key}.ts`), await formatTs(`export {${key}} from "./index${importExt}";`));
|
|
508
|
-
}
|
|
509
|
-
await fs2.writeFile(path16__namespace.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";
|
|
510
|
-
`));
|
|
511
|
-
}
|
|
512
|
-
async function generateMetrics(fs2, aggregationsDir, importExt = "") {
|
|
513
|
-
const metricsDir = path16__namespace.join(aggregationsDir, "metrics");
|
|
514
|
-
await fs2.mkdir(metricsDir, {
|
|
515
|
-
recursive: true
|
|
516
|
-
});
|
|
517
|
-
await fs2.writeFile(path16__namespace.join(metricsDir, "metrics.ts"), await formatTs(`export {MetricValueType} from "@osdk/legacy-client";`));
|
|
518
|
-
await fs2.writeFile(path16__namespace.join(metricsDir, "ApproximateDistinctCountAggregatableProperty.ts"), await formatTs(reexportConsts(["ApproximateDistinctCountAggregatableProperty"]) + reexportTypes(["ApproximateDistinctCountAggregatableProperty"])));
|
|
519
|
-
await fs2.writeFile(path16__namespace.join(metricsDir, "MultipleAggregatableProperty.ts"), await formatTs(`
|
|
520
|
-
import { Double, MetricValue, MultipleAggregationsOperations } from "../Aggregations${importExt}";
|
|
521
|
-
import { MetricValueType } from "./metrics/index${importExt}";
|
|
522
|
-
` + reexportConsts(["MultipleAggregatableProperty"]) + reexportTypes(["MultipleAggregatableProperty"], "<TResult extends MetricValue = Double>")));
|
|
523
|
-
for (const typeName of ["DefaultAggregatableProperty", "LocalDatePropertyMetric", "NumericPropertyMetric", "TimestampPropertyMetric"]) {
|
|
524
|
-
await fs2.writeFile(path16__namespace.join(metricsDir, `${typeName}.ts`), await formatTs(`
|
|
525
|
-
import { MultipleAggregatableProperty } from "./MultipleAggregatableProperty${importExt}";
|
|
526
|
-
` + reexportConsts([typeName])));
|
|
527
|
-
}
|
|
528
|
-
await fs2.writeFile(path16__namespace.join(metricsDir, "index.ts"), await formatTs(`
|
|
529
|
-
export * from "./ApproximateDistinctCountAggregatableProperty${importExt}";
|
|
530
|
-
export * from "./DefaultAggregatableProperty${importExt}";
|
|
531
|
-
export * from "./LocalDatePropertyMetric${importExt}";
|
|
532
|
-
export * from "./metrics${importExt}";
|
|
533
|
-
export * from "./MultipleAggregatableProperty${importExt}";
|
|
534
|
-
export * from "./NumericPropertyMetric${importExt}";
|
|
535
|
-
export * from "./TimestampPropertyMetric${importExt}";
|
|
536
|
-
`));
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateAggregationsDir.ts
|
|
540
|
-
async function generateAggregationsDir(fs2, runtimeDistDir, importExt = "") {
|
|
541
|
-
const aggregationsDir = path16__namespace.join(runtimeDistDir, "aggregations");
|
|
542
|
-
await fs2.mkdir(aggregationsDir, {
|
|
543
|
-
recursive: true
|
|
544
|
-
});
|
|
545
|
-
await generateGroupBy(fs2, aggregationsDir, importExt);
|
|
546
|
-
await generateAggregationsAggregations(fs2, aggregationsDir);
|
|
547
|
-
await generateMetrics(fs2, aggregationsDir, importExt);
|
|
548
|
-
await fs2.writeFile(path16__namespace.join(aggregationsDir, "index.ts"), await formatTs(`
|
|
549
|
-
${""}
|
|
550
|
-
${""}
|
|
551
|
-
|
|
552
|
-
export * from "./Aggregations${importExt}";
|
|
553
|
-
export * from "./ComputeStep${importExt}";
|
|
554
|
-
export * from "./CountOperation${importExt}";
|
|
555
|
-
export * from "./groupBy/index${importExt}";
|
|
556
|
-
export * from "./internalAggregationRequest${importExt}";
|
|
557
|
-
export * from "./metrics/index${importExt}";
|
|
558
|
-
`));
|
|
559
|
-
await fs2.writeFile(path16__namespace.join(aggregationsDir, "ComputeStep.ts"), await formatTs(`
|
|
560
|
-
import { ObjectSetDefinition } from "../baseTypes/index${importExt}";
|
|
561
|
-
import { FoundryClientOptions } from "../client/${importExt}";
|
|
562
|
-
import { AggregateObjectsError, OntologyMetadata, Result } from "../ontologyProvider/index${importExt}";
|
|
563
|
-
import { AggregationClause, AggregationResult, BucketGroup, BucketValue, InternalBucketing, Metrics, MetricValue } from "./Aggregations${importExt}";
|
|
564
|
-
` + reexportConsts(["ComputeStep"]) + reexportTypes(["ComputeStep"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue> ") + reexportTypes(["AggregationComputeStep"], "<TBucketGroup extends BucketGroup, TMetrics extends Metrics | MetricValue>") + `
|
|
565
|
-
|
|
566
|
-
`));
|
|
567
|
-
await fs2.writeFile(path16__namespace.join(aggregationsDir, "CountOperation.ts"), await formatTs(`` + reexportConsts(["CountOperation", "isCountOperation"]) + reexportTypes(["CountOperation"])));
|
|
568
|
-
await fs2.writeFile(path16__namespace.join(aggregationsDir, "internalAggregationRequest.ts"), await formatTs(reexportTypes(["InternalAggregationRequest"])));
|
|
569
|
-
}
|
|
570
|
-
async function generateAttachmentsDir(attachmentsDir, fs2, importExt = "") {
|
|
571
|
-
await fs2.mkdir(attachmentsDir, {
|
|
572
|
-
recursive: true
|
|
573
|
-
});
|
|
574
|
-
await fs2.writeFile(path16__namespace.default.join(attachmentsDir, "index.ts"), await formatTs(`export * from "./Attachment${importExt}";
|
|
575
|
-
export * from "./Attachments${importExt}";
|
|
576
|
-
`));
|
|
577
|
-
await fs2.writeFile(path16__namespace.default.join(attachmentsDir, "Attachment.ts"), await formatTs(reexportTypes(["Attachment", "AttachmentMetadata"])));
|
|
578
|
-
await fs2.writeFile(path16__namespace.default.join(attachmentsDir, "Attachments.ts"), await formatTs(reexportTypes(["Attachments"])));
|
|
579
|
-
}
|
|
580
|
-
async function generateGeoshapesDir(runtimeDistDir, fs2, importExt = "") {
|
|
581
|
-
await fs2.mkdir(runtimeDistDir, {
|
|
582
|
-
recursive: true
|
|
583
|
-
});
|
|
584
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "index.ts"), await formatTs(`export * from "./Distance${importExt}";
|
|
585
|
-
export * from "./GeoJson${importExt}";
|
|
586
|
-
export * from "./GeometryCollection${importExt}";
|
|
587
|
-
export * from "./GeoPoint${importExt}";
|
|
588
|
-
export * from "./GeoShape${importExt}";
|
|
589
|
-
export * from "./LineString${importExt}";
|
|
590
|
-
export * from "./MultiGeoPoint${importExt}";
|
|
591
|
-
export * from "./MultiLineString${importExt}";
|
|
592
|
-
export * from "./MultiPolygon${importExt}";
|
|
593
|
-
export * from "./Polygon${importExt}";`));
|
|
594
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "Distance.ts"), await formatTs(`` + reexportConsts(["Distance", "DistanceUnit"]) + reexportTypes(["Distance", "DistanceUnit"])));
|
|
595
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "GeoJson.ts"), await formatTs(reexportTypes(["GeoJsonPoint", "GeoJsonPolygon", "GeoJsonLineString", "GeoJsonMultiPoint", "GeoJsonMultiPolygon", "GeoJsonMultiLineString", "GeoJsonGeometryCollection", "GeoJsonGeometry", "GeoJson"])));
|
|
596
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "GeometryCollection.ts"), await formatTs(reexportConsts(["GeometryCollection"])));
|
|
597
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "GeoPoint.ts"), await formatTs(`` + reexportConsts(["isGeoPoint", "GeoPoint", "mapCoordinatesToGeoPoint"]) + reexportTypes(["GeoHash", "Coordinates", "GeoPoint"])));
|
|
598
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "GeoShape.ts"), await formatTs(reexportConsts(["GeoShape"]) + reexportTypes(["GeoShape"])));
|
|
599
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "LineString.ts"), await formatTs(reexportConsts(["LineString"]) + reexportTypes(["LineString"])));
|
|
600
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "MultiGeoPoint.ts"), await formatTs(reexportConsts(["MultiGeoPoint"]) + reexportTypes(["MultiGeoPoint"])));
|
|
601
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "MultiLineString.ts"), await formatTs(reexportConsts(["MultiLineString"]) + reexportTypes(["MultiLineString"])));
|
|
602
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "MultiPolygon.ts"), await formatTs(reexportConsts(["MultiPolygon"]) + reexportTypes(["MultiPolygon"])));
|
|
603
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "Polygon.ts"), await formatTs(reexportConsts(["Polygon"]) + reexportTypes(["LinearRing", "Polygon"])));
|
|
604
|
-
}
|
|
605
|
-
async function generateObjectSetDir(objectSetDir, fs2, importExt = "") {
|
|
606
|
-
await fs2.mkdir(objectSetDir, {
|
|
607
|
-
recursive: true
|
|
608
|
-
});
|
|
609
|
-
await fs2.writeFile(path16__namespace.default.join(objectSetDir, "index.ts"), await formatTs(`
|
|
610
|
-
export * from "./ObjectSetDefinition${importExt}";
|
|
611
|
-
export * from "./OntologyObjectSet${importExt}";
|
|
612
|
-
`));
|
|
613
|
-
await fs2.writeFile(path16__namespace.default.join(objectSetDir, "ObjectSetDefinition.ts"), await formatTs(reexportTypes(["BaseObjectSetDefinition", "ReferenceObjectSetDefinition", "StaticObjectSetDefinition", "IntersectObjectSetDefinition", "SubtractObjectSetDefinition", "SearchAroundObjectSetDefinition", "FilterObjectSetDefinition", "ObjectSetDefinition"])));
|
|
614
|
-
await fs2.writeFile(path16__namespace.default.join(objectSetDir, "OntologyObjectSet.ts"), await formatTs(reexportTypes(["OntologyObjectSet"])));
|
|
615
|
-
}
|
|
616
|
-
async function generateSharedObjectCodeDir(sharedObjectCodeDir, fs2, importExt = "") {
|
|
617
|
-
await fs2.mkdir(sharedObjectCodeDir, {
|
|
618
|
-
recursive: true
|
|
619
|
-
});
|
|
620
|
-
await fs2.writeFile(path16__namespace.default.join(sharedObjectCodeDir, "index.ts"), await formatTs(`
|
|
621
|
-
export * from "./FilteredPropertiesTerminalOperations${importExt}";
|
|
622
|
-
`));
|
|
623
|
-
await fs2.writeFile(path16__namespace.default.join(sharedObjectCodeDir, "FilteredPropertiesTerminalOperations.ts"), await formatTs(`import { OntologyObject } from "../OntologyObject${importExt}` + reexportTypes(["FilteredPropertiesTerminalOperations", "FilteredPropertiesTerminalOperationsWithGet"], "<T extends OntologyObject, V extends Array<keyof T>>")));
|
|
624
|
-
}
|
|
625
|
-
async function generateTimeSeriesDir(timeseriesDir, fs2, importExt = "") {
|
|
626
|
-
await fs2.mkdir(timeseriesDir, {
|
|
627
|
-
recursive: true
|
|
628
|
-
});
|
|
629
|
-
await fs2.writeFile(path16__namespace.join(timeseriesDir, "index.ts"), await formatTs(`
|
|
630
|
-
export * from "./TimeSeries${importExt}";
|
|
631
|
-
export * from "./TimeSeriesDuration${importExt}";
|
|
632
|
-
export * from "./TimeSeriesPoint${importExt}";
|
|
633
|
-
${""}
|
|
634
|
-
export * from "./TimeSeriesQuery${importExt}";
|
|
635
|
-
export * from "./TimeSeriesTerminalOperations${importExt}";
|
|
636
|
-
`));
|
|
637
|
-
await fs2.writeFile(path16__namespace.join(timeseriesDir, "TimeSeries.ts"), await formatTs(reexportTypes(["TimeSeries"], `<T extends number | string>`)));
|
|
638
|
-
await fs2.writeFile(path16__namespace.join(timeseriesDir, "TimeSeriesDuration.ts"), await formatTs(reexportTypes([`WhenUnit`, `DurationUnit`, `TimeSeriesDuration`])));
|
|
639
|
-
await fs2.writeFile(path16__namespace.join(timeseriesDir, "TimeSeriesPoint.ts"), await formatTs(reexportTypes(["TimeSeriesPoint"], `<T extends number | string>`)));
|
|
640
|
-
await fs2.writeFile(path16__namespace.join(timeseriesDir, "TimeSeriesQuery.ts"), await formatTs(reexportTypes(["TimeSeriesQuery"], `<T extends number | string>`)));
|
|
641
|
-
await fs2.writeFile(path16__namespace.join(timeseriesDir, "TimeSeriesTerminalOperations.ts"), await formatTs(reexportTypes(["TimeSeriesTerminalOperations", "TimeSeriesIterator"], `<T extends number | string>`)));
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateBaseTypesDir.ts
|
|
645
|
-
async function generateBaseTypesDir(runtimeDistDir, fs2, importExt = "") {
|
|
646
|
-
const baseTypesDir = path16__namespace.join(runtimeDistDir, "baseTypes");
|
|
647
|
-
await fs2.mkdir(baseTypesDir, {
|
|
648
|
-
recursive: true
|
|
649
|
-
});
|
|
650
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "index.ts"), await formatTs(`export * from "./ActionType${importExt}";
|
|
651
|
-
export * from "./attachments/index${importExt}";
|
|
652
|
-
export * from "./geoshapes/index${importExt}";
|
|
653
|
-
export * from "./links${importExt}";
|
|
654
|
-
export * from "./localDate${importExt}";
|
|
655
|
-
export * from "./objectset/index${importExt}";
|
|
656
|
-
export * from "./ObjectType${importExt}";
|
|
657
|
-
export * from "./OntologyObject${importExt}";
|
|
658
|
-
export * from "./Queries${importExt}";
|
|
659
|
-
export * from "./timeseries/index${importExt}";
|
|
660
|
-
export * from "./timestamp${importExt}";`));
|
|
661
|
-
const geoshapesDir = path16__namespace.join(baseTypesDir, "geoshapes");
|
|
662
|
-
await generateGeoshapesDir(geoshapesDir, fs2, importExt);
|
|
663
|
-
const timeseriesDir = path16__namespace.join(baseTypesDir, "timeseries");
|
|
664
|
-
await generateTimeSeriesDir(timeseriesDir, fs2, importExt);
|
|
665
|
-
const attachmentsDir = path16__namespace.join(baseTypesDir, "attachments");
|
|
666
|
-
await generateAttachmentsDir(attachmentsDir, fs2, importExt);
|
|
667
|
-
const objectSetDir = path16__namespace.join(baseTypesDir, "objectset");
|
|
668
|
-
await generateObjectSetDir(objectSetDir, fs2, importExt);
|
|
669
|
-
const sharedObjectCodeDir = path16__namespace.join(baseTypesDir, "sharedObjectCode");
|
|
670
|
-
await generateSharedObjectCodeDir(sharedObjectCodeDir, fs2, importExt);
|
|
671
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "ActionType.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject${importExt}";
|
|
672
|
-
` + 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>")));
|
|
673
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "OntologyObject.ts"), await formatTs(reexportTypes(["OntologyObject"]) + reexportConsts(["isOntologyObject"])));
|
|
674
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "links.ts"), await formatTs(`import { OntologyObject } from "./OntologyObject${importExt}` + reexportTypes(["SingleLink", "MultiLink"], "<T extends OntologyObject = OntologyObject>")));
|
|
675
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "localDate.ts"), await formatTs(reexportConsts(["LocalDate"]) + reexportTypes(["LocalDate"])));
|
|
676
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "timestamp.ts"), await formatTs(reexportConsts(["Timestamp"]) + reexportTypes(["Timestamp"])));
|
|
677
|
-
await fs2.writeFile(path16__namespace.join(baseTypesDir, "Queries.ts"), await formatTs(`import { BucketValue, Range, Rangeable } from "../aggregations/index${importExt}";
|
|
678
|
-
` + 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"])));
|
|
679
|
-
await fs2.writeFile(path16__namespace.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>")));
|
|
680
|
-
}
|
|
681
|
-
async function generateClientDir(runtimeDistDir, fs2, importExt = "") {
|
|
682
|
-
const pagingDir = path16__namespace.default.join(runtimeDistDir, "client");
|
|
683
|
-
await fs2.mkdir(pagingDir, {
|
|
684
|
-
recursive: true
|
|
685
|
-
});
|
|
686
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "index.ts"), await formatTs(`export * from "./clientOptions${importExt}";`));
|
|
687
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "clientOptions.ts"), await formatTs(`import {Auth} from "@osdk/legacy-client";` + reexportTypes(["FoundryClientOptions"], "<TAuth extends Auth = Auth>")));
|
|
688
|
-
}
|
|
689
|
-
async function generateFiltersDir(runtimeDistDir, fs2, importExt = "") {
|
|
690
|
-
const pagingDir = path16__namespace.default.join(runtimeDistDir, "filters");
|
|
691
|
-
await fs2.mkdir(pagingDir, {
|
|
692
|
-
recursive: true
|
|
693
|
-
});
|
|
694
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "index.ts"), await formatTs(`export * from "./ArrayFilter${importExt}";
|
|
695
|
-
export * from "./AttachmentFilter${importExt}";
|
|
696
|
-
export * from "./BooleanFilter${importExt}";
|
|
697
|
-
export * from "./DateTimeFilters${importExt}";
|
|
698
|
-
export * from "./Filters${importExt}";
|
|
699
|
-
export * from "./GeoPointFilter${importExt}";
|
|
700
|
-
export * from "./GeoShapeFilter${importExt}";
|
|
701
|
-
export * from "./NumericFilter${importExt}";
|
|
702
|
-
export * from "./Op${importExt}";
|
|
703
|
-
export * from "./OrderByOption${importExt}";
|
|
704
|
-
export * from "./StringFilter${importExt}";`));
|
|
705
|
-
await fs2.writeFile(path16__namespace.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>")));
|
|
706
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "AttachmentFilter.ts"), await formatTs(reexportConsts(["AttachmentFilter"]) + reexportTypes(["AttachmentFilter"])));
|
|
707
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "BooleanFilter.ts"), await formatTs(reexportConsts(["BooleanFilter"]) + reexportTypes(["BooleanFilter"])));
|
|
708
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "GeoPointFilter.ts"), await formatTs(reexportConsts(["GeoPointFilter"]) + reexportTypes(["GeoPointFilter", "BoundingBox"])));
|
|
709
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "DateTimeFilters.ts"), await formatTs(reexportConsts(["TimestampFilter", "LocalDateFilter"]) + reexportTypes(["TimestampFilter", "LocalDateFilter"])));
|
|
710
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "GeoShapeFilter.ts"), await formatTs(reexportConsts(["GeoShapeFilter"]) + reexportTypes(["GeoShapeFilter"])));
|
|
711
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "NumericFilter.ts"), await formatTs(reexportConsts(["NumericFilter"]) + reexportTypes(["NumericFilter"])));
|
|
712
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "Op.ts"), await formatTs(reexportConsts(["Op"])));
|
|
713
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "OrderByOption.ts"), await formatTs(reexportConsts(["OrderByOption"]) + reexportTypes(["OrderByOption"])));
|
|
714
|
-
await fs2.writeFile(path16__namespace.default.join(pagingDir, "StringFilter.ts"), await formatTs(reexportConsts(["StringFilter"]) + reexportTypes(["StringFilter"])));
|
|
715
|
-
await fs2.writeFile(path16__namespace.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>")));
|
|
716
|
-
}
|
|
717
|
-
async function generateErrors(fs2, ontologyProviderDir) {
|
|
718
|
-
await fs2.writeFile(path16__namespace.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"])));
|
|
719
|
-
}
|
|
720
|
-
async function generateOntologyMetadata(fs2, ontologyProviderDir) {
|
|
721
|
-
await fs2.writeFile(path16__namespace.join(ontologyProviderDir, "OntologyMetadata.ts"), await formatTs(reexportTypes(["OntologyMetadata"])));
|
|
722
|
-
}
|
|
723
|
-
async function generateResult(fs2, ontologyProviderDir) {
|
|
724
|
-
await fs2.writeFile(path16__namespace.join(ontologyProviderDir, "Result.ts"), await formatTs(`import {FoundryApiError} from "@osdk/legacy-client";
|
|
725
|
-
` + 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>")));
|
|
726
|
-
}
|
|
727
|
-
|
|
728
|
-
// src/v1.1/backcompat/internal-foundry-ontology-runtime-dist/generateOntologyProviderDir.ts
|
|
729
|
-
async function generateOntologyProviderDir(fs2, runtimeDistDir, importExt = "") {
|
|
730
|
-
const ontologyProviderDir = path16__namespace.join(runtimeDistDir, "ontologyProvider");
|
|
731
|
-
await fs2.mkdir(ontologyProviderDir, {
|
|
732
|
-
recursive: true
|
|
733
|
-
});
|
|
734
|
-
await generateErrors(fs2, ontologyProviderDir);
|
|
735
|
-
await generateOntologyMetadata(fs2, ontologyProviderDir);
|
|
736
|
-
await generateResult(fs2, ontologyProviderDir);
|
|
737
|
-
await fs2.writeFile(path16__namespace.join(ontologyProviderDir, "index.ts"), await formatTs(`
|
|
738
|
-
${""}
|
|
739
|
-
export * from "./Errors${importExt}";
|
|
740
|
-
export * from "./OntologyMetadata${importExt}";
|
|
741
|
-
${""}
|
|
742
|
-
${""}
|
|
743
|
-
// export * from "./Result${importExt}";
|
|
744
|
-
`));
|
|
745
|
-
}
|
|
746
|
-
async function generatePagingDir(runtimeDistDir, fs2, importExt = "") {
|
|
747
|
-
const pagingDir = path16__namespace.join(runtimeDistDir, "paging");
|
|
748
|
-
await fs2.mkdir(pagingDir, {
|
|
749
|
-
recursive: true
|
|
750
|
-
});
|
|
751
|
-
await fs2.writeFile(path16__namespace.join(pagingDir, "index.ts"), await formatTs(`export * from "./Page${importExt}";`));
|
|
752
|
-
await fs2.writeFile(path16__namespace.join(pagingDir, "Page.ts"), await formatTs(reexportTypes(["Page"], "<T>")));
|
|
753
|
-
}
|
|
754
|
-
|
|
755
|
-
// src/v1.1/backcompat/generateOntologyRuntimeDistDir.ts
|
|
756
|
-
async function generateOntologyRuntimeDistDir(outDir, fs2, importExt = "") {
|
|
757
|
-
const runtimeDistDir = path16__namespace.join(outDir, "internal", "@foundry", "ontology-runtime", "dist");
|
|
758
|
-
await fs2.mkdir(runtimeDistDir, {
|
|
759
|
-
recursive: true
|
|
760
|
-
});
|
|
761
|
-
await generateOntologyProviderDir(fs2, runtimeDistDir, importExt);
|
|
762
|
-
await generateAggregationsDir(fs2, runtimeDistDir, importExt);
|
|
763
|
-
await generatePagingDir(runtimeDistDir, fs2, importExt);
|
|
764
|
-
await generateBaseTypesDir(runtimeDistDir, fs2, importExt);
|
|
765
|
-
await generateClientDir(runtimeDistDir, fs2, importExt);
|
|
766
|
-
await generateFiltersDir(runtimeDistDir, fs2, importExt);
|
|
767
|
-
await fs2.writeFile(path16__namespace.join(runtimeDistDir, "index.ts"), await formatTs(`
|
|
768
|
-
export * from "./aggregations/index${importExt}";
|
|
769
|
-
export * from "./baseTypes/index${importExt}";
|
|
770
|
-
${""}
|
|
771
|
-
// export * from "./filters/index${importExt}";
|
|
772
|
-
${""}
|
|
773
|
-
${""}
|
|
774
|
-
|
|
775
|
-
export * from "./ontologyProvider/index${importExt}";
|
|
776
|
-
export * from "./paging/index${importExt}";
|
|
777
|
-
`));
|
|
778
|
-
}
|
|
779
|
-
|
|
780
|
-
// src/v1.1/generateBackCompatDeprecatedExports.ts
|
|
781
|
-
async function generateBackCompatDeprecatedExports(fs2, outDir, importExt = "") {
|
|
782
|
-
await generateOntologyRuntimeDistDir(outDir, fs2, importExt);
|
|
783
|
-
await generateOAuthClientDistDir(outDir, fs2, importExt);
|
|
784
|
-
}
|
|
785
|
-
async function generateBatchActions(ontology, fs2, outDir, importExt = "") {
|
|
786
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
787
|
-
let actionSignatures = [];
|
|
788
|
-
for (const action of Object.values(ontology.actionTypes)) {
|
|
789
|
-
const entries = Object.entries(action.parameters);
|
|
790
|
-
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
791
|
-
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
792
|
-
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
793
|
-
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
794
|
-
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
795
|
-
let jsDocBlock = ["/**"];
|
|
796
|
-
if (action.description) {
|
|
797
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
798
|
-
}
|
|
799
|
-
let parameterBlock = "";
|
|
800
|
-
if (entries.length > 0) {
|
|
801
|
-
parameterBlock = `params: {
|
|
802
|
-
`;
|
|
803
|
-
for (const [parameterName, parameterData] of entries) {
|
|
804
|
-
parameterBlock += `"${parameterName}"`;
|
|
805
|
-
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
806
|
-
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
807
|
-
parameterBlock += `${typeScriptType};
|
|
808
|
-
`;
|
|
809
|
-
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
810
|
-
}
|
|
811
|
-
parameterBlock += "}[], ";
|
|
812
|
-
} else {
|
|
813
|
-
parameterBlock = `params: Record<string,never>[], `;
|
|
814
|
-
}
|
|
815
|
-
jsDocBlock.push(`*/`);
|
|
816
|
-
actionSignatures.push(`
|
|
817
|
-
${jsDocBlock.join("\n")}
|
|
818
|
-
${action.apiName}<O extends BatchActionExecutionOptions>(${parameterBlock}options?: O):
|
|
819
|
-
Promise<Result<BatchActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;
|
|
820
|
-
`);
|
|
821
|
-
}
|
|
822
|
-
await fs2.mkdir(outDir, {
|
|
823
|
-
recursive: true
|
|
824
|
-
});
|
|
825
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "BatchActions.ts"), await formatTs(`
|
|
826
|
-
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, BatchActionExecutionOptions, ActionError, Result, ActionResponseFromOptions, BatchActionResponseFromOptions } from "@osdk/legacy-client";
|
|
827
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
828
|
-
export interface BatchActions {
|
|
829
|
-
${actionSignatures.join("\n")}
|
|
830
|
-
}
|
|
831
|
-
`));
|
|
832
|
-
}
|
|
833
|
-
async function generateBulkActions(ontology, fs2, outDir, importExt = "") {
|
|
834
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
835
|
-
let actionSignatures = [];
|
|
836
|
-
for (const action of Object.values(ontology.actionTypes)) {
|
|
837
|
-
const entries = Object.entries(action.parameters);
|
|
838
|
-
const modifiedEntityTypes = getModifiedEntityTypes(action);
|
|
839
|
-
const addedObjects = Array.from(modifiedEntityTypes.addedObjects);
|
|
840
|
-
const modifiedObjects = Array.from(modifiedEntityTypes.modifiedObjects);
|
|
841
|
-
addedObjects.forEach(importedObjects.add, importedObjects);
|
|
842
|
-
modifiedObjects.forEach(importedObjects.add, importedObjects);
|
|
843
|
-
let jsDocBlock = ["/**"];
|
|
844
|
-
if (action.description) {
|
|
845
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
846
|
-
}
|
|
847
|
-
let parameterBlock = "";
|
|
848
|
-
if (entries.length > 0) {
|
|
849
|
-
parameterBlock = `params: {
|
|
850
|
-
`;
|
|
851
|
-
for (const [parameterName, parameterData] of entries) {
|
|
852
|
-
parameterBlock += `"${parameterName}"`;
|
|
853
|
-
parameterBlock += parameterData.required ? ": " : "?: ";
|
|
854
|
-
const typeScriptType = getTypeScriptTypeFromDataType(parameterData.dataType, importedObjects);
|
|
855
|
-
parameterBlock += `${typeScriptType};
|
|
856
|
-
`;
|
|
857
|
-
jsDocBlock.push(`* @param {${typeScriptType}} params.${parameterName}`);
|
|
858
|
-
}
|
|
859
|
-
parameterBlock += "}[], ";
|
|
860
|
-
} else {
|
|
861
|
-
parameterBlock = `params: Record<string,never>[], `;
|
|
862
|
-
}
|
|
863
|
-
jsDocBlock.push(`*/`);
|
|
864
|
-
actionSignatures.push(`
|
|
865
|
-
${jsDocBlock.join("\n")}
|
|
866
|
-
${action.apiName}<O extends BulkActionExecutionOptions>(${parameterBlock}options?: O):
|
|
867
|
-
Promise<Result<BulkActionResponseFromOptions<O, Edits<${addedObjects.length > 0 ? addedObjects.join(" | ") : "void"}, ${modifiedObjects.length > 0 ? modifiedObjects.join(" | ") : "void"}>>, ActionError>>;
|
|
868
|
-
`);
|
|
869
|
-
}
|
|
870
|
-
await fs2.mkdir(outDir, {
|
|
871
|
-
recursive: true
|
|
872
|
-
});
|
|
873
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "BulkActions.ts"), await formatTs(`
|
|
874
|
-
import type { ObjectSet, LocalDate, Timestamp, Attachment, Edits, ActionExecutionOptions, BulkActionExecutionOptions, ActionError, Result, ActionResponseFromOptions, BulkActionResponseFromOptions } from "@osdk/legacy-client";
|
|
875
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
876
|
-
export interface BulkActions {
|
|
877
|
-
${actionSignatures.join("\n")}
|
|
878
|
-
}
|
|
879
|
-
`));
|
|
880
|
-
}
|
|
881
|
-
async function generateFoundryClientFile(fs2, outDir, importExt = "") {
|
|
882
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "FoundryClient.ts"), await formatTs(`
|
|
883
|
-
import { BaseFoundryClient } from "@osdk/legacy-client";
|
|
884
|
-
import type { Auth, FoundryClientOptions } from "@osdk/legacy-client";
|
|
885
|
-
import { Ontology } from "./Ontology${importExt}";
|
|
886
|
-
|
|
887
|
-
export class FoundryClient<TAuth extends Auth = Auth> extends BaseFoundryClient<typeof Ontology, TAuth> {
|
|
888
|
-
constructor(options: FoundryClientOptions<TAuth>) {
|
|
889
|
-
super(options, Ontology);
|
|
890
|
-
}
|
|
891
|
-
|
|
892
|
-
get ontology(): Ontology {
|
|
893
|
-
return super.ontology;
|
|
894
|
-
}
|
|
895
|
-
}`));
|
|
896
|
-
}
|
|
897
|
-
async function generateIndexFile(fs2, outDir, importExt) {
|
|
898
|
-
await fs2.mkdir(outDir, {
|
|
899
|
-
recursive: true
|
|
900
|
-
});
|
|
901
|
-
await fs2.writeFile(path16__namespace.join(outDir, "index.ts"), await formatTs(`
|
|
902
|
-
export * from "@osdk/legacy-client";
|
|
903
|
-
export type { Ontology } from "./Ontology${importExt}";
|
|
904
|
-
export { FoundryClient } from "./FoundryClient${importExt}";
|
|
905
|
-
`));
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
// src/util/commaSeparatedIdentifiers.ts
|
|
909
|
-
function commaSeparatedIdentifiers(identifiers, alternateNames) {
|
|
910
|
-
return identifiers.map((i) => {
|
|
911
|
-
const alt = alternateNames?.get(i);
|
|
912
|
-
if (alt) {
|
|
913
|
-
return `${i}: ${alt}`;
|
|
914
|
-
}
|
|
915
|
-
return i;
|
|
916
|
-
}).join(",");
|
|
917
|
-
}
|
|
918
|
-
|
|
919
|
-
// src/util/commaSeparatedTypeIdentifiers.ts
|
|
920
|
-
function commaSeparatedTypeIdentifiers(identifiers, altNames) {
|
|
921
|
-
return identifiers.map((i) => `${i}: typeof ${altNames?.get(i) ?? i}`).join(",");
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
// src/v1.1/generateMetadataFile.ts
|
|
925
|
-
async function generateMetadataFile(ontology, userAgent, fs2, outDir, importExt = "") {
|
|
926
|
-
const objectNames = Object.keys(ontology.objectTypes);
|
|
927
|
-
const actionNames = Object.keys(ontology.actionTypes);
|
|
928
|
-
const queryNames = Object.keys(ontology.queryTypes);
|
|
929
|
-
const actionAltNames = /* @__PURE__ */ new Map();
|
|
930
|
-
const queryAltNames = /* @__PURE__ */ new Map();
|
|
931
|
-
const seenIdentifiers = new Set(objectNames);
|
|
932
|
-
for (const actionName of actionNames) {
|
|
933
|
-
if (seenIdentifiers.has(actionName)) {
|
|
934
|
-
actionAltNames.set(actionName, `${actionName}Action`);
|
|
935
|
-
} else {
|
|
936
|
-
seenIdentifiers.add(actionName);
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
for (const queryName of queryNames) {
|
|
940
|
-
if (seenIdentifiers.has(queryName)) {
|
|
941
|
-
queryAltNames.set(queryName, `${queryName}Query`);
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
const getImportClause = (name, altNames) => {
|
|
945
|
-
const alt = altNames.get(name);
|
|
946
|
-
if (alt) {
|
|
947
|
-
return `${name} as ${alt}`;
|
|
948
|
-
} else {
|
|
949
|
-
return name;
|
|
950
|
-
}
|
|
951
|
-
};
|
|
952
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "Ontology.ts"), await formatTs(`
|
|
953
|
-
import type { OntologyDefinition } from "@osdk/api";
|
|
954
|
-
import type { Ontology as ClientOntology } from "@osdk/legacy-client";
|
|
955
|
-
import type { Objects } from "./ontology/objects/Objects${importExt}";
|
|
956
|
-
import type { Actions } from "./ontology/actions/Actions${importExt}";
|
|
957
|
-
import type { Queries } from "./ontology/queries/Queries${importExt}";
|
|
958
|
-
import type { BatchActions } from "./ontology/actions/BatchActions${importExt}";
|
|
959
|
-
import type { BulkActions } from "./ontology/actions/BulkActions${importExt}";
|
|
960
|
-
${objectNames.map((name) => `import {${name}} from "./ontology/objects/${name}${importExt}";`).join("\n")}
|
|
961
|
-
${actionNames.map((name) => `import {${getImportClause(name, actionAltNames)}} from "./ontology/actions/${name}${importExt}";`).join("\n")}
|
|
962
|
-
${queryNames.map((name) => `import {${getImportClause(name, queryAltNames)}} from "./ontology/queries/${name}${importExt}";`).join("\n")}
|
|
963
|
-
|
|
964
|
-
export const Ontology : {
|
|
965
|
-
metadata: {
|
|
966
|
-
ontologyRid: "${ontology.ontology.rid}",
|
|
967
|
-
ontologyApiName: "${ontology.ontology.apiName}",
|
|
968
|
-
userAgent: "${userAgent}",
|
|
969
|
-
},
|
|
970
|
-
objects: {
|
|
971
|
-
${commaSeparatedTypeIdentifiers(objectNames)}
|
|
972
|
-
},
|
|
973
|
-
actions: {
|
|
974
|
-
${commaSeparatedTypeIdentifiers(actionNames, actionAltNames)}
|
|
975
|
-
},
|
|
976
|
-
queries: {
|
|
977
|
-
${commaSeparatedTypeIdentifiers(queryNames, queryAltNames)}
|
|
978
|
-
},
|
|
979
|
-
} = {
|
|
980
|
-
metadata: {
|
|
981
|
-
ontologyRid: "${ontology.ontology.rid}" as const,
|
|
982
|
-
ontologyApiName: "${ontology.ontology.apiName}" as const,
|
|
983
|
-
userAgent: "${userAgent}" as const,
|
|
984
|
-
},
|
|
985
|
-
objects: {
|
|
986
|
-
${commaSeparatedIdentifiers(objectNames)}
|
|
987
|
-
},
|
|
988
|
-
actions: {
|
|
989
|
-
${commaSeparatedIdentifiers(actionNames, actionAltNames)}
|
|
990
|
-
},
|
|
991
|
-
queries: {
|
|
992
|
-
${commaSeparatedIdentifiers(queryNames, queryAltNames)}
|
|
993
|
-
}
|
|
994
|
-
} satisfies OntologyDefinition<
|
|
995
|
-
${stringUnionFrom(objectNames)},
|
|
996
|
-
${stringUnionFrom(Object.values(ontology.actionTypes).map((actionType) => actionType.apiName))},
|
|
997
|
-
${stringUnionFrom(Object.values(ontology.queryTypes).map((queryType) => queryType.apiName))}>;
|
|
998
|
-
|
|
999
|
-
export interface Ontology extends ClientOntology<typeof Ontology> {
|
|
1000
|
-
objects: Objects;
|
|
1001
|
-
actions: Actions;
|
|
1002
|
-
/** @deprecated use batchActions */
|
|
1003
|
-
bulkActions: BulkActions;
|
|
1004
|
-
batchActions: BatchActions;
|
|
1005
|
-
queries: Queries;
|
|
1006
|
-
}`));
|
|
1007
|
-
}
|
|
1008
|
-
function stringUnionFrom(values) {
|
|
1009
|
-
if (values.length === 0) {
|
|
1010
|
-
return "never";
|
|
1011
|
-
}
|
|
1012
|
-
return values.map((n) => `"${n}"`).join("|");
|
|
1013
|
-
}
|
|
1014
|
-
async function generateObjectsInterfaceFile(ontology, fs2, outDir, importExt = "") {
|
|
1015
|
-
await fs2.mkdir(outDir, {
|
|
1016
|
-
recursive: true
|
|
1017
|
-
});
|
|
1018
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "Objects.ts"), await formatTs(`
|
|
1019
|
-
import { BaseObjectSet } from "@osdk/legacy-client";
|
|
1020
|
-
${Array.from(Object.keys(ontology.objectTypes)).map((importedObject) => `import type { ${importedObject} } from "./${importedObject}${importExt}";`).join("\n")}
|
|
1021
|
-
|
|
1022
|
-
export interface Objects {
|
|
1023
|
-
${Object.keys(ontology.objectTypes).map((apiName) => `${apiName} : BaseObjectSet<${apiName}>;`).join("\n")}
|
|
1024
|
-
}
|
|
1025
|
-
;`));
|
|
1026
|
-
}
|
|
1027
|
-
async function generateObjectsInterfaceSupportFiles(ontology, fs2, outDir, importExt = "") {
|
|
1028
|
-
await fs2.mkdir(outDir, {
|
|
1029
|
-
recursive: true
|
|
1030
|
-
});
|
|
1031
|
-
for (const {
|
|
1032
|
-
objectType: {
|
|
1033
|
-
apiName
|
|
1034
|
-
}
|
|
1035
|
-
} of Object.values(ontology.objectTypes)) {
|
|
1036
|
-
const fileName = path16.join(outDir, `${apiName}.ts`);
|
|
1037
|
-
const localApiName = `OG_${apiName}`;
|
|
1038
|
-
const contents = [];
|
|
1039
|
-
contents.push(`import { ObjectSetAggregateArg, ObjectSetFilterArg, ObjectSetGroupByArg, ObjectSetMultipleAggregateArg, ObjectSetOrderByArg } from "@osdk/legacy-client";`);
|
|
1040
|
-
contents.push(`import { ${apiName} as ${localApiName} } from "../${apiName}${importExt}";`);
|
|
1041
|
-
contents.push("");
|
|
1042
|
-
contents.push(`/** @deprecated Use ${apiName} from ontology/objects instead */`, `export type ${apiName} = ${localApiName};`);
|
|
1043
|
-
contents.push(`/** @deprecated Use ObjectSetFilterArg<${apiName}> instead */`, `export type ${apiName}Filter = ObjectSetFilterArg<${localApiName}>;`);
|
|
1044
|
-
contents.push(`/** @deprecated Use ObjectSetOrderByArg<${apiName}> instead */`, `export type ${apiName}OrderBy = ObjectSetOrderByArg<${localApiName}>;`);
|
|
1045
|
-
contents.push(`/** @deprecated Use ObjectSetGroupByArg<${apiName}> instead */`, `export type ${apiName}GroupByProperties = ObjectSetGroupByArg<${localApiName}>;`);
|
|
1046
|
-
contents.push(`
|
|
1047
|
-
/**
|
|
1048
|
-
* Aggregation properties for ${apiName}
|
|
1049
|
-
* @deprecated Use ObjectSetAggregateArg<${apiName}> instead
|
|
1050
|
-
*/`, `export type ${apiName}AggregationProperties = ObjectSetAggregateArg<${localApiName}>;`);
|
|
1051
|
-
contents.push(`
|
|
1052
|
-
/**
|
|
1053
|
-
* Multiple aggregation properties for ${apiName}.
|
|
1054
|
-
* @deprecated Use ObjectSetMultipleAggregateArg<${apiName}> instead
|
|
1055
|
-
*/`, `export type ${apiName}MultipleAggregationProperties = ObjectSetMultipleAggregateArg<${localApiName}>;`);
|
|
1056
|
-
await fs2.writeFile(fileName, contents.join("\n"));
|
|
1057
|
-
}
|
|
1058
|
-
}
|
|
1059
|
-
async function generateOntologyIndexFile(fs2, outDir) {
|
|
1060
|
-
await fs2.mkdir(outDir, {
|
|
1061
|
-
recursive: true
|
|
1062
|
-
});
|
|
1063
|
-
await fs2.writeFile(path16__namespace.join(outDir, "index.ts"), await formatTs(`
|
|
1064
|
-
export type { ObjectSet } from "@osdk/legacy-client";
|
|
1065
|
-
`));
|
|
1066
|
-
}
|
|
1067
|
-
|
|
1068
|
-
// src/shared/getObjectImports.ts
|
|
1069
|
-
function getObjectImports(objects, curApiName, currentFilePath, v2) {
|
|
1070
|
-
return Array.from(objects).filter((obj) => obj.fullApiName !== curApiName).map((obj) => {
|
|
1071
|
-
return `import type { ${obj.getDefinitionIdentifier(v2)} as ${obj.getImportedDefinitionIdentifier(v2)} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
|
|
1072
|
-
}).join("\n");
|
|
1073
|
-
}
|
|
1074
|
-
|
|
1075
|
-
// src/shared/wireActionTypeV2ToSdkActionDefinition.ts
|
|
1076
|
-
function wireActionTypeV2ToSdkActionDefinition(input) {
|
|
1077
|
-
const modifiedEntityTypes = getModifiedEntityTypes(input);
|
|
1078
|
-
return {
|
|
1079
|
-
type: "action",
|
|
1080
|
-
apiName: input.apiName,
|
|
1081
|
-
parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),
|
|
1082
|
-
displayName: input.displayName,
|
|
1083
|
-
description: input.description,
|
|
1084
|
-
modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects)
|
|
1085
|
-
};
|
|
1086
|
-
}
|
|
1087
|
-
function wireActionParameterV2ToSdkParameterDefinition(value) {
|
|
1088
|
-
return {
|
|
1089
|
-
multiplicity: value.dataType.type === "array",
|
|
1090
|
-
type: actionPropertyToSdkPropertyDefinition(value.dataType.type === "array" ? value.dataType.subType : value.dataType),
|
|
1091
|
-
nullable: !value.required,
|
|
1092
|
-
description: value.description
|
|
1093
|
-
};
|
|
1094
|
-
}
|
|
1095
|
-
function actionPropertyToSdkPropertyDefinition(parameterType) {
|
|
1096
|
-
switch (parameterType.type) {
|
|
1097
|
-
case "string":
|
|
1098
|
-
case "boolean":
|
|
1099
|
-
case "attachment":
|
|
1100
|
-
case "double":
|
|
1101
|
-
case "integer":
|
|
1102
|
-
case "long":
|
|
1103
|
-
case "timestamp":
|
|
1104
|
-
case "marking":
|
|
1105
|
-
return parameterType.type;
|
|
1106
|
-
case "date":
|
|
1107
|
-
return "datetime";
|
|
1108
|
-
case "objectSet":
|
|
1109
|
-
return {
|
|
1110
|
-
type: "objectSet",
|
|
1111
|
-
objectSet: parameterType.objectTypeApiName
|
|
1112
|
-
};
|
|
1113
|
-
case "object":
|
|
1114
|
-
return {
|
|
1115
|
-
type: "object",
|
|
1116
|
-
object: parameterType.objectTypeApiName
|
|
1117
|
-
};
|
|
1118
|
-
case "array":
|
|
1119
|
-
return actionPropertyToSdkPropertyDefinition(parameterType.subType);
|
|
1120
|
-
}
|
|
1121
|
-
}
|
|
1122
|
-
function createModifiedEntities(addedObjects, modifiedObjects) {
|
|
1123
|
-
let entities = {};
|
|
1124
|
-
for (const key of addedObjects) {
|
|
1125
|
-
entities[key] = {
|
|
1126
|
-
created: true,
|
|
1127
|
-
modified: false
|
|
1128
|
-
};
|
|
1129
|
-
}
|
|
1130
|
-
for (const key of modifiedObjects) {
|
|
1131
|
-
if (entities[key]) {
|
|
1132
|
-
entities[key].modified = true;
|
|
1133
|
-
} else {
|
|
1134
|
-
entities[key] = {
|
|
1135
|
-
created: false,
|
|
1136
|
-
modified: true
|
|
1137
|
-
};
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1140
|
-
return entities;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
// src/util/stringUnionFrom.ts
|
|
1144
|
-
function stringUnionFrom2(values) {
|
|
1145
|
-
if (values.length === 0) {
|
|
1146
|
-
return "never";
|
|
1147
|
-
} else {
|
|
1148
|
-
return values.map((v) => `"${v}"`).join("|");
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
|
|
1152
|
-
// src/v1.1/generatePerActionDataFilesV1.ts
|
|
1153
|
-
async function generatePerActionDataFilesV1({
|
|
1154
|
-
sanitizedOntology: ontology,
|
|
1155
|
-
fs: fs2,
|
|
1156
|
-
outDir: rootOutDir,
|
|
1157
|
-
importExt = "",
|
|
1158
|
-
ontology: enhancedOntology
|
|
1159
|
-
}) {
|
|
1160
|
-
const outDir = path16__namespace.default.join(rootOutDir, "ontology", "actions");
|
|
1161
|
-
await fs2.mkdir(outDir, {
|
|
1162
|
-
recursive: true
|
|
1163
|
-
});
|
|
1164
|
-
await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
|
|
1165
|
-
const currentFilePath = `${path16__namespace.default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
|
|
1166
|
-
const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.og);
|
|
1167
|
-
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
1168
|
-
const uniqueApiNamesString = stringUnionFrom2([...uniqueApiNames]);
|
|
1169
|
-
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.og));
|
|
1170
|
-
function createV1Object() {
|
|
1171
|
-
return ` export const ${action.shortApiName} = ${JSON.stringify(fullActionDef, null, 2)} satisfies ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}>;`;
|
|
1172
|
-
}
|
|
1173
|
-
const referencedObjectDefs = /* @__PURE__ */ new Set();
|
|
1174
|
-
for (const p of Object.values(action.parameters)) {
|
|
1175
|
-
if (p.dataType.type === "object" || p.dataType.type === "objectSet") {
|
|
1176
|
-
if (p.dataType.objectApiName) {
|
|
1177
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectApiName));
|
|
1178
|
-
}
|
|
1179
|
-
if (p.dataType.objectTypeApiName) {
|
|
1180
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectTypeApiName));
|
|
1181
|
-
}
|
|
1182
|
-
}
|
|
1183
|
-
if (p.dataType.type === "array" && (p.dataType.subType.type === "object" || p.dataType.subType.type === "objectSet")) {
|
|
1184
|
-
if (p.dataType.subType.objectApiName) {
|
|
1185
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectApiName));
|
|
1186
|
-
}
|
|
1187
|
-
if (p.dataType.subType.objectTypeApiName) {
|
|
1188
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectTypeApiName));
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, false);
|
|
1193
|
-
await fs2.writeFile(path16__namespace.default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
1194
|
-
import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
|
|
1195
|
-
import type { ApplyActionOptions, ApplyBatchActionOptions, ActionReturnTypeForOptions, ActionParam } from '@osdk/client.api';
|
|
1196
|
-
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
1197
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
1198
|
-
${imports}
|
|
1199
|
-
|
|
1200
|
-
${createV1Object()}
|
|
1201
|
-
`));
|
|
1202
|
-
}));
|
|
1203
|
-
const indexFileRelPath = path16__namespace.default.join("ontology", "actions", `index.ts`);
|
|
1204
|
-
await fs2.writeFile(path16__namespace.default.join(rootOutDir, indexFileRelPath), await formatTs(`
|
|
1205
|
-
${Object.values(enhancedOntology.actionTypes).map((action) => {
|
|
1206
|
-
const exportConstLine = `export {${action.shortApiName} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
1207
|
-
`export type { ${action.paramsIdentifier} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
1208
|
-
return exportConstLine;
|
|
1209
|
-
}).join("\n")}
|
|
1210
|
-
${Object.keys(ontology.actionTypes).length === 0 ? "export {};" : ""}
|
|
1211
|
-
`));
|
|
1212
|
-
}
|
|
1213
|
-
function extractReferencedObjectsFromAction(actionType) {
|
|
1214
|
-
const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({
|
|
1215
|
-
dataType
|
|
1216
|
-
}) => {
|
|
1217
|
-
const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);
|
|
1218
|
-
return objectTypeReference ? [objectTypeReference] : [];
|
|
1219
|
-
});
|
|
1220
|
-
const referenceObjectsInEdits = actionType.operations.flatMap((value) => {
|
|
1221
|
-
switch (value.type) {
|
|
1222
|
-
case "createObject":
|
|
1223
|
-
return [value.objectTypeApiName];
|
|
1224
|
-
case "modifyObject":
|
|
1225
|
-
return [value.objectTypeApiName];
|
|
1226
|
-
case "deleteObject":
|
|
1227
|
-
case "createLink":
|
|
1228
|
-
case "deleteLink":
|
|
1229
|
-
return [];
|
|
1230
|
-
}
|
|
1231
|
-
});
|
|
1232
|
-
return [...referenceObjectsInEdits, ...referencedObjectsInParameters];
|
|
1233
|
-
}
|
|
1234
|
-
function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
1235
|
-
switch (actionParameter.type) {
|
|
1236
|
-
case "objectSet":
|
|
1237
|
-
case "object":
|
|
1238
|
-
return actionParameter.objectTypeApiName;
|
|
1239
|
-
case "array":
|
|
1240
|
-
return extractReferencedObjectsFromActionParameter(actionParameter.subType);
|
|
1241
|
-
case "string":
|
|
1242
|
-
case "boolean":
|
|
1243
|
-
case "attachment":
|
|
1244
|
-
case "date":
|
|
1245
|
-
case "double":
|
|
1246
|
-
case "integer":
|
|
1247
|
-
case "long":
|
|
1248
|
-
case "timestamp":
|
|
1249
|
-
return void 0;
|
|
1250
|
-
}
|
|
1251
|
-
}
|
|
1252
|
-
|
|
1253
|
-
// src/util/stringify.ts
|
|
1254
|
-
var defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatter) => {
|
|
1255
|
-
return [defaultKeyFormatter(key), defaultValueFormatter(value)];
|
|
1256
|
-
};
|
|
1257
|
-
function stringify(obj, customizer = {}, separator = ",\n") {
|
|
1258
|
-
const defaultKeyFormatter = (key) => `${JSON.stringify(key)}`;
|
|
1259
|
-
const entries = [];
|
|
1260
|
-
const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
|
|
1261
|
-
for (const key of sortedKeys) {
|
|
1262
|
-
const value = obj[key];
|
|
1263
|
-
const res = (customizer[key] ?? customizer["*"] ?? defaultCustomizer)(value, (value2) => JSON.stringify(value2, null, 2), key, defaultKeyFormatter);
|
|
1264
|
-
if (res) {
|
|
1265
|
-
if (typeof res === "string") {
|
|
1266
|
-
entries.push(`${defaultKeyFormatter(key)}: ${res}`);
|
|
1267
|
-
} else {
|
|
1268
|
-
entries.push(`${res[0]}: ${res[1]}`);
|
|
1269
|
-
}
|
|
1270
|
-
}
|
|
1271
|
-
}
|
|
1272
|
-
return entries.join(separator);
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
// src/v1.1/wireObjectTypeV2ToSdkObjectConstV1.ts
|
|
1276
|
-
function wireObjectTypeV2ToSdkObjectConstV1(wireObject, {
|
|
1277
|
-
ontology
|
|
1278
|
-
}, currentFilePath) {
|
|
1279
|
-
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
1280
|
-
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
1281
|
-
const definition = deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.og, false));
|
|
1282
|
-
const objectDefIdentifier = object.getDefinitionIdentifier(false);
|
|
1283
|
-
function getV1Types() {
|
|
1284
|
-
return `
|
|
1285
|
-
export interface ${objectDefIdentifier} extends ObjectTypeDefinition<"${object.fullApiName}", ${object.uniqueImportName}> {
|
|
1286
|
-
${stringify(definition, {
|
|
1287
|
-
osdkMetadata: () => void 0,
|
|
1288
|
-
// not used in v1
|
|
1289
|
-
links: (_value) => `{
|
|
1290
|
-
${stringify(definition.links, {
|
|
1291
|
-
"*": (definition2) => `ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(false)}, ${definition2.multiplicity}>`
|
|
1292
|
-
})}
|
|
1293
|
-
}`
|
|
1294
|
-
})}
|
|
1295
|
-
}
|
|
1296
|
-
`;
|
|
1297
|
-
}
|
|
1298
|
-
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, false);
|
|
1299
|
-
return `${imports}${getV1Types()}
|
|
1300
|
-
|
|
1301
|
-
export const ${object.shortApiName}: ${objectDefIdentifier} = {
|
|
1302
|
-
${stringify(definition, {
|
|
1303
|
-
osdkMetadata: (value) => void 0
|
|
1304
|
-
})}
|
|
1305
|
-
|
|
1306
|
-
};`;
|
|
1307
|
-
}
|
|
1308
|
-
|
|
1309
|
-
// src/util/reservedKeywords.ts
|
|
1310
|
-
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"]);
|
|
1311
|
-
function isReservedKeyword(name) {
|
|
1312
|
-
return reservedKeywords.has(name);
|
|
1313
|
-
}
|
|
1314
|
-
|
|
1315
|
-
// src/v1.1/wireObjectTypeV2ToV1ObjectInterfaceString.ts
|
|
1316
|
-
function wireObjectTypeV2ToObjectInterfaceStringV1(objectTypeWithLinks, importExt = "") {
|
|
1317
|
-
const uniqueLinkTargets = new Set(objectTypeWithLinks.linkTypes.map((a) => a.objectTypeApiName).filter((a) => a !== objectTypeWithLinks.objectType.apiName));
|
|
1318
|
-
return `import type { OntologyObject, LocalDate, Timestamp, GeoShape, GeoPoint, Attachment, TimeSeries, MultiLink, SingleLink, StringLong } from "@osdk/legacy-client";
|
|
1319
|
-
${Array.from(uniqueLinkTargets).map((linkTarget) => `import type { ${linkTarget} } from "./${linkTarget}${importExt}";`).join("\n")}
|
|
1320
|
-
|
|
1321
|
-
${getDescriptionIfPresent(objectTypeWithLinks.objectType.description)}
|
|
1322
|
-
export interface ${objectTypeWithLinks.objectType.apiName} extends OntologyObject {
|
|
1323
|
-
/** @deprecated please migrate to $apiName instead */
|
|
1324
|
-
readonly __apiName: "${objectTypeWithLinks.objectType.apiName}" & {${objectTypeWithLinks.linkTypes.map((linkType) => {
|
|
1325
|
-
return `/** @deprecated please migrate to pivotTo(${linkType.apiName}) instead */ searchAround${linkType.apiName.charAt(0).toUpperCase() + linkType.apiName.slice(1)}?: never`;
|
|
1326
|
-
})}};
|
|
1327
|
-
/** @deprecated please migrate to $primaryKey instead */
|
|
1328
|
-
readonly __primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
1329
|
-
readonly $apiName: "${objectTypeWithLinks.objectType.apiName}";
|
|
1330
|
-
readonly $primaryKey: ${wirePropertyTypeV2ToTypeScriptType(objectTypeWithLinks.objectType.properties[objectTypeWithLinks.objectType.primaryKey].dataType)};
|
|
1331
|
-
${Object.entries(objectTypeWithLinks.objectType.properties).sort((a, b) => a[0].localeCompare(b[0])).flatMap(([propertyName, propertyDefinition]) => {
|
|
1332
|
-
const propertyType = wirePropertyTypeV2ToTypeScriptType(propertyDefinition.dataType);
|
|
1333
|
-
const entries = [`${getDescriptionIfPresent(propertyDefinition.description, true)}readonly ${propertyName}: ${propertyType} | undefined`];
|
|
1334
|
-
if (isReservedKeyword(propertyName)) {
|
|
1335
|
-
entries.push(`/** @deprecated please migrate to '${propertyName}' instead */
|
|
1336
|
-
readonly ${propertyName}_: ${propertyType} | undefined`);
|
|
1337
|
-
}
|
|
1338
|
-
return entries;
|
|
1339
|
-
}).join(";\n")}
|
|
1340
|
-
${objectTypeWithLinks.linkTypes.flatMap((linkType) => {
|
|
1341
|
-
const entries = [`readonly ${linkType.apiName}: ${linkType.cardinality === "MANY" ? "MultiLink" : "SingleLink"}<${linkType.objectTypeApiName}>`];
|
|
1342
|
-
return entries;
|
|
1343
|
-
}).join(";\n")}
|
|
1344
|
-
}
|
|
1345
|
-
`;
|
|
1346
|
-
}
|
|
1347
|
-
function wirePropertyTypeV2ToTypeScriptType(property) {
|
|
1348
|
-
switch (property.type) {
|
|
1349
|
-
case "string":
|
|
1350
|
-
return "string";
|
|
1351
|
-
case "boolean":
|
|
1352
|
-
return "boolean";
|
|
1353
|
-
case "array":
|
|
1354
|
-
return wirePropertyTypeV2ToTypeScriptType(property.subType) + "[]";
|
|
1355
|
-
case "integer":
|
|
1356
|
-
return "number";
|
|
1357
|
-
case "attachment":
|
|
1358
|
-
return "Attachment";
|
|
1359
|
-
case "byte":
|
|
1360
|
-
return "number";
|
|
1361
|
-
case "date":
|
|
1362
|
-
return "LocalDate";
|
|
1363
|
-
case "decimal":
|
|
1364
|
-
return "string";
|
|
1365
|
-
case "double":
|
|
1366
|
-
return "number";
|
|
1367
|
-
case "float":
|
|
1368
|
-
return "number";
|
|
1369
|
-
case "geopoint":
|
|
1370
|
-
return "GeoPoint";
|
|
1371
|
-
case "geoshape":
|
|
1372
|
-
return "GeoShape";
|
|
1373
|
-
case "long":
|
|
1374
|
-
return "StringLong";
|
|
1375
|
-
case "short":
|
|
1376
|
-
return "number";
|
|
1377
|
-
case "timestamp":
|
|
1378
|
-
return "Timestamp";
|
|
1379
|
-
case "timeseries":
|
|
1380
|
-
return property.itemType.type === "string" ? `TimeSeries<string>` : `TimeSeries<number>`;
|
|
1381
|
-
case "marking":
|
|
1382
|
-
return "string";
|
|
1383
|
-
default:
|
|
1384
|
-
throw new Error(`Unknown property type ${property}`);
|
|
1385
|
-
}
|
|
1386
|
-
}
|
|
1387
|
-
function getDescriptionIfPresent(description, includeNewline) {
|
|
1388
|
-
if (description) {
|
|
1389
|
-
return `/**
|
|
1390
|
-
* ${description}
|
|
1391
|
-
*/${includeNewline ? "\n" : ""}`;
|
|
1392
|
-
}
|
|
1393
|
-
return "";
|
|
1394
|
-
}
|
|
1395
|
-
|
|
1396
|
-
// src/v1.1/generatePerObjectInterfaceAndDataFiles.ts
|
|
1397
|
-
async function generatePerObjectInterfaceAndDataFiles(ontology, fs2, outDir, importExt = "") {
|
|
1398
|
-
await fs2.mkdir(outDir, {
|
|
1399
|
-
recursive: true
|
|
1400
|
-
});
|
|
1401
|
-
await Promise.all(Object.values(ontology.og.objectTypes).map(async (object) => {
|
|
1402
|
-
const relPath = path16__namespace.default.join(".", "ontology", `objects`, `${object.objectType.apiName}.ts`);
|
|
1403
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, `${object.objectType.apiName}.ts`), await formatTs(`
|
|
1404
|
-
import type { ObjectTypeDefinition, ObjectTypeLinkDefinition, PropertyDef } from "@osdk/api";
|
|
1405
|
-
${wireObjectTypeV2ToObjectInterfaceStringV1(object, importExt)}
|
|
1406
|
-
|
|
1407
|
-
${wireObjectTypeV2ToSdkObjectConstV1(object, {
|
|
1408
|
-
ontology
|
|
1409
|
-
}, relPath)}
|
|
1410
|
-
`));
|
|
1411
|
-
}));
|
|
1412
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "index.ts"), await formatTs(`
|
|
1413
|
-
${Object.keys(ontology.og.objectTypes).map((apiName) => `export * from "./${apiName}${importExt}";`).join("\n")}
|
|
1414
|
-
export type { ObjectSet } from "@osdk/legacy-client";
|
|
1415
|
-
|
|
1416
|
-
`));
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
// src/shared/getObjectTypesFromQueryDataType.ts
|
|
1420
|
-
function getObjectTypesFromQueryDataType(dataType, types) {
|
|
1421
|
-
switch (dataType.type) {
|
|
1422
|
-
case "array":
|
|
1423
|
-
case "set":
|
|
1424
|
-
getObjectTypesFromQueryDataType(dataType.subType, types);
|
|
1425
|
-
return;
|
|
1426
|
-
case "object":
|
|
1427
|
-
types.add(dataType.objectTypeApiName);
|
|
1428
|
-
return;
|
|
1429
|
-
case "objectSet":
|
|
1430
|
-
types.add(dataType.objectTypeApiName);
|
|
1431
|
-
return;
|
|
1432
|
-
case "struct":
|
|
1433
|
-
for (const prop of Object.values(dataType.fields)) {
|
|
1434
|
-
getObjectTypesFromQueryDataType(prop.fieldType, types);
|
|
1435
|
-
}
|
|
1436
|
-
return;
|
|
1437
|
-
case "union":
|
|
1438
|
-
for (const type of dataType.unionTypes) {
|
|
1439
|
-
getObjectTypesFromQueryDataType(type, types);
|
|
1440
|
-
}
|
|
1441
|
-
return;
|
|
1442
|
-
case "attachment":
|
|
1443
|
-
case "boolean":
|
|
1444
|
-
case "date":
|
|
1445
|
-
case "double":
|
|
1446
|
-
case "float":
|
|
1447
|
-
case "integer":
|
|
1448
|
-
case "long":
|
|
1449
|
-
case "null":
|
|
1450
|
-
case "string":
|
|
1451
|
-
case "threeDimensionalAggregation":
|
|
1452
|
-
case "timestamp":
|
|
1453
|
-
case "twoDimensionalAggregation":
|
|
1454
|
-
case "unsupported":
|
|
1455
|
-
return;
|
|
1456
|
-
default:
|
|
1457
|
-
throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
// src/shared/getObjectTypeApiNamesFromQuery.ts
|
|
1462
|
-
function getObjectTypeApiNamesFromQuery(query) {
|
|
1463
|
-
const types = /* @__PURE__ */ new Set();
|
|
1464
|
-
for (const {
|
|
1465
|
-
dataType
|
|
1466
|
-
} of Object.values(query.parameters)) {
|
|
1467
|
-
getObjectTypesFromQueryDataType(dataType, types);
|
|
1468
|
-
}
|
|
1469
|
-
getObjectTypesFromQueryDataType(query.output, types);
|
|
1470
|
-
return Array.from(types);
|
|
1471
|
-
}
|
|
1472
|
-
|
|
1473
|
-
// src/shared/isNullableQueryDataType.ts
|
|
1474
|
-
function isNullableQueryDataType(input) {
|
|
1475
|
-
if (input.type === "null") {
|
|
1476
|
-
return true;
|
|
1477
|
-
}
|
|
1478
|
-
if (input.type === "union") {
|
|
1479
|
-
return input.unionTypes.some((t) => isNullableQueryDataType(t));
|
|
1480
|
-
}
|
|
1481
|
-
return false;
|
|
1482
|
-
}
|
|
1483
|
-
|
|
1484
|
-
// src/shared/wireQueryDataTypeToQueryDataTypeDefinition.ts
|
|
1485
|
-
function wireQueryDataTypeToQueryDataTypeDefinition(input) {
|
|
1486
|
-
switch (input.type) {
|
|
1487
|
-
case "double":
|
|
1488
|
-
case "float":
|
|
1489
|
-
case "integer":
|
|
1490
|
-
case "long":
|
|
1491
|
-
case "attachment":
|
|
1492
|
-
case "boolean":
|
|
1493
|
-
case "date":
|
|
1494
|
-
case "string":
|
|
1495
|
-
case "timestamp":
|
|
1496
|
-
return {
|
|
1497
|
-
type: input.type,
|
|
1498
|
-
nullable: false
|
|
1499
|
-
};
|
|
1500
|
-
case "object":
|
|
1501
|
-
return {
|
|
1502
|
-
type: "object",
|
|
1503
|
-
object: input.objectTypeApiName,
|
|
1504
|
-
nullable: false
|
|
1505
|
-
};
|
|
1506
|
-
case "objectSet":
|
|
1507
|
-
return {
|
|
1508
|
-
type: "objectSet",
|
|
1509
|
-
objectSet: input.objectTypeApiName,
|
|
1510
|
-
nullable: false
|
|
1511
|
-
};
|
|
1512
|
-
case "array":
|
|
1513
|
-
return {
|
|
1514
|
-
...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
1515
|
-
multiplicity: true
|
|
1516
|
-
};
|
|
1517
|
-
case "set":
|
|
1518
|
-
return {
|
|
1519
|
-
type: "set",
|
|
1520
|
-
set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
1521
|
-
nullable: false
|
|
1522
|
-
};
|
|
1523
|
-
case "union":
|
|
1524
|
-
const allowNulls = isNullableQueryDataType(input);
|
|
1525
|
-
if (allowNulls && input.unionTypes.length === 2) {
|
|
1526
|
-
const nonNull = input.unionTypes.find((t) => t.type != null);
|
|
1527
|
-
if (nonNull) {
|
|
1528
|
-
return {
|
|
1529
|
-
...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),
|
|
1530
|
-
nullable: true
|
|
1531
|
-
};
|
|
1532
|
-
}
|
|
1533
|
-
}
|
|
1534
|
-
return {
|
|
1535
|
-
type: "union",
|
|
1536
|
-
union: input.unionTypes.reduce((acc, t) => {
|
|
1537
|
-
if (t.type === "null") {
|
|
1538
|
-
return acc;
|
|
1539
|
-
}
|
|
1540
|
-
acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));
|
|
1541
|
-
return acc;
|
|
1542
|
-
}, []),
|
|
1543
|
-
nullable: allowNulls
|
|
1544
|
-
};
|
|
1545
|
-
case "struct":
|
|
1546
|
-
return {
|
|
1547
|
-
type: "struct",
|
|
1548
|
-
struct: Object.fromEntries(input.fields.map((f) => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),
|
|
1549
|
-
nullable: false
|
|
1550
|
-
};
|
|
1551
|
-
case "twoDimensionalAggregation":
|
|
1552
|
-
return {
|
|
1553
|
-
type: "twoDimensionalAggregation",
|
|
1554
|
-
twoDimensionalAggregation: get2DQueryAggregationProps(input),
|
|
1555
|
-
nullable: false
|
|
1556
|
-
};
|
|
1557
|
-
case "threeDimensionalAggregation":
|
|
1558
|
-
return {
|
|
1559
|
-
type: "threeDimensionalAggregation",
|
|
1560
|
-
threeDimensionalAggregation: get3DQueryAggregationProps(input),
|
|
1561
|
-
nullable: false
|
|
1562
|
-
};
|
|
1563
|
-
case "null":
|
|
1564
|
-
case "unsupported":
|
|
1565
|
-
throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);
|
|
1566
|
-
default:
|
|
1567
|
-
throw new Error(`Unsupported QueryDataType.type ${input.type}`);
|
|
1568
|
-
}
|
|
1569
|
-
}
|
|
1570
|
-
function get2DQueryAggregationProps(input) {
|
|
1571
|
-
if (input.keyType.type === "range") {
|
|
1572
|
-
return {
|
|
1573
|
-
keyType: input.keyType.type,
|
|
1574
|
-
keySubtype: input.keyType.subType.type,
|
|
1575
|
-
valueType: input.valueType.type
|
|
1576
|
-
};
|
|
1577
|
-
} else {
|
|
1578
|
-
if (guardInvalidKeyTypes(input.keyType)) {
|
|
1579
|
-
return {
|
|
1580
|
-
keyType: input.keyType.type,
|
|
1581
|
-
valueType: input.valueType.type
|
|
1582
|
-
};
|
|
1583
|
-
}
|
|
1584
|
-
throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);
|
|
1585
|
-
}
|
|
1586
|
-
}
|
|
1587
|
-
function get3DQueryAggregationProps(input) {
|
|
1588
|
-
if (input.keyType.type === "range") {
|
|
1589
|
-
return {
|
|
1590
|
-
keyType: input.keyType.type,
|
|
1591
|
-
keySubtype: input.keyType.subType.type,
|
|
1592
|
-
valueType: get2DQueryAggregationProps(input.valueType)
|
|
1593
|
-
};
|
|
1594
|
-
} else {
|
|
1595
|
-
if (guardInvalidKeyTypes(input.keyType)) {
|
|
1596
|
-
return {
|
|
1597
|
-
keyType: input.keyType.type,
|
|
1598
|
-
valueType: get2DQueryAggregationProps(input.valueType)
|
|
1599
|
-
};
|
|
1600
|
-
}
|
|
1601
|
-
throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
function guardInvalidKeyTypes(key) {
|
|
1605
|
-
return key.type === "string" || key.type === "boolean";
|
|
1606
|
-
}
|
|
1607
|
-
|
|
1608
|
-
// src/shared/wireQueryTypeV2ToSdkQueryDefinition.ts
|
|
1609
|
-
function wireQueryTypeV2ToSdkQueryDefinition(input) {
|
|
1610
|
-
return {
|
|
1611
|
-
type: "query",
|
|
1612
|
-
apiName: input.apiName,
|
|
1613
|
-
description: input.description,
|
|
1614
|
-
displayName: input.displayName,
|
|
1615
|
-
version: input.version,
|
|
1616
|
-
parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),
|
|
1617
|
-
output: wireQueryDataTypeToQueryDataTypeDefinition(input.output)
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {
|
|
1621
|
-
return {
|
|
1622
|
-
type: "query",
|
|
1623
|
-
apiName: input.apiName,
|
|
1624
|
-
description: input.description,
|
|
1625
|
-
displayName: input.displayName,
|
|
1626
|
-
version: input.version
|
|
1627
|
-
};
|
|
1628
|
-
}
|
|
1629
|
-
function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
|
|
1630
|
-
return {
|
|
1631
|
-
description: parameter.description,
|
|
1632
|
-
...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)
|
|
1633
|
-
};
|
|
1634
|
-
}
|
|
1635
|
-
|
|
1636
|
-
// src/v1.1/generatePerQueryDataFiles.ts
|
|
1637
|
-
async function generatePerQueryDataFiles({
|
|
1638
|
-
fs: fs2,
|
|
1639
|
-
outDir: rootOutDir,
|
|
1640
|
-
ontology
|
|
1641
|
-
}, v2) {
|
|
1642
|
-
const relOutDir = path16__namespace.default.join(".", "ontology", "queries");
|
|
1643
|
-
const outDir = path16__namespace.default.join(rootOutDir, "ontology", "queries");
|
|
1644
|
-
await fs2.mkdir(outDir, {
|
|
1645
|
-
recursive: true
|
|
1646
|
-
});
|
|
1647
|
-
await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {
|
|
1648
|
-
await generateV1QueryFile(fs2, outDir, query);
|
|
1649
|
-
}));
|
|
1650
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "index.ts"), await formatTs(`
|
|
1651
|
-
${Object.values(ontology.queryTypes).map((query) => `export * from "${query.getImportPathRelTo(path16__namespace.default.join(relOutDir, "index.ts"))}";`).join("\n")}
|
|
1652
|
-
${Object.keys(ontology.queryTypes).length === 0 ? "export {};" : ""}
|
|
1653
|
-
`));
|
|
1654
|
-
}
|
|
1655
|
-
async function generateV1QueryFile(fs2, outDir, query) {
|
|
1656
|
-
const objectTypes = getObjectTypeApiNamesFromQuery(query);
|
|
1657
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
|
|
1658
|
-
import { QueryDefinition } from "@osdk/api";
|
|
1659
|
-
|
|
1660
|
-
export const ${query.shortApiName} = ${JSON.stringify(wireQueryTypeV2ToSdkQueryDefinition(query.og))} ${getQueryDefSatisfies(query.fullApiName, objectTypes)}`));
|
|
1661
|
-
}
|
|
1662
|
-
function getQueryDefSatisfies(apiName, objectTypes) {
|
|
1663
|
-
return `satisfies QueryDefinition<"${apiName}", ${objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never"}>;`;
|
|
1664
|
-
}
|
|
1665
|
-
async function generateQueries(ontology, fs2, outDir, importExt = "") {
|
|
1666
|
-
const importedObjects = /* @__PURE__ */ new Set();
|
|
1667
|
-
const signatures = [];
|
|
1668
|
-
for (const query of Object.values(ontology.queryTypes)) {
|
|
1669
|
-
const jsDocBlock = ["/**"];
|
|
1670
|
-
if (query.description) {
|
|
1671
|
-
jsDocBlock.push(`* ${query.description}`);
|
|
1672
|
-
}
|
|
1673
|
-
const outputType = handleQueryDataType(query.output, importedObjects, true);
|
|
1674
|
-
const paramEntries = [];
|
|
1675
|
-
for (const [name, parameter] of Object.entries(query.parameters)) {
|
|
1676
|
-
const nullable = isNullableQueryDataType(parameter.dataType);
|
|
1677
|
-
const type = handleQueryDataType(parameter.dataType, importedObjects, false);
|
|
1678
|
-
paramEntries.push(`"${name}"${nullable ? "?" : ""}: ${type}`);
|
|
1679
|
-
jsDocBlock.push(`* @param {${sanitizeDocTypeName(type)}} params.${name}${parameter.description ? ` - ${parameter.description}` : ""}`);
|
|
1680
|
-
}
|
|
1681
|
-
const param = paramEntries.length === 0 ? "" : `params: { ${paramEntries.join("; ")} }`;
|
|
1682
|
-
jsDocBlock.push(`* @returns ${sanitizeDocTypeName(outputType)}`, "*/");
|
|
1683
|
-
signatures.push(`
|
|
1684
|
-
${jsDocBlock.join("\n")}
|
|
1685
|
-
${query.apiName}(${param}): Promise<Result<QueryResponse<${outputType}>, QueryError>>;
|
|
1686
|
-
`);
|
|
1687
|
-
}
|
|
1688
|
-
await fs2.mkdir(outDir, {
|
|
1689
|
-
recursive: true
|
|
1690
|
-
});
|
|
1691
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "Queries.ts"), await formatTs(`
|
|
1692
|
-
import type { QueryResponse, QueryError, Result, Timestamp, LocalDate, Range, Attachment, ObjectSet, TwoDimensionalAggregation, ThreeDimensionalAggregation } from "@osdk/legacy-client";
|
|
1693
|
-
${Array.from(importedObjects).map((importedObject) => `import type { ${importedObject} } from "../objects/${importedObject}${importExt}";`).join("\n")}
|
|
1694
|
-
|
|
1695
|
-
export interface Queries {
|
|
1696
|
-
${signatures.join("\n")}
|
|
1697
|
-
}
|
|
1698
|
-
`));
|
|
1699
|
-
}
|
|
1700
|
-
function handleQueryDataType(dataType, importedObjects, isReturnValue) {
|
|
1701
|
-
switch (dataType.type) {
|
|
1702
|
-
case "boolean":
|
|
1703
|
-
return "boolean";
|
|
1704
|
-
case "string":
|
|
1705
|
-
return "string";
|
|
1706
|
-
case "double":
|
|
1707
|
-
case "float":
|
|
1708
|
-
case "integer":
|
|
1709
|
-
return "number";
|
|
1710
|
-
case "long":
|
|
1711
|
-
return isReturnValue ? "string" : "string | number";
|
|
1712
|
-
case "date":
|
|
1713
|
-
return "LocalDate";
|
|
1714
|
-
case "timestamp":
|
|
1715
|
-
return "Timestamp";
|
|
1716
|
-
case "attachment":
|
|
1717
|
-
return "Attachment";
|
|
1718
|
-
case "array":
|
|
1719
|
-
return `Array<${handleQueryDataType(dataType.subType, importedObjects, isReturnValue)}>`;
|
|
1720
|
-
case "object": {
|
|
1721
|
-
const objectType = dataType.objectTypeApiName;
|
|
1722
|
-
importedObjects.add(objectType);
|
|
1723
|
-
return isReturnValue ? objectType : `${objectType} | ${objectType}["__primaryKey"]`;
|
|
1724
|
-
}
|
|
1725
|
-
case "objectSet": {
|
|
1726
|
-
const objectType = dataType.objectTypeApiName;
|
|
1727
|
-
importedObjects.add(objectType);
|
|
1728
|
-
return `ObjectSet<${objectType}>`;
|
|
1729
|
-
}
|
|
1730
|
-
case "set":
|
|
1731
|
-
return `Set<${handleQueryDataType(dataType.subType, importedObjects, isReturnValue)}>`;
|
|
1732
|
-
case "struct":
|
|
1733
|
-
const properties = dataType.fields.map((field) => {
|
|
1734
|
-
const isNullable = isNullableQueryDataType(field.fieldType);
|
|
1735
|
-
return `${field.name}${isNullable ? "?" : ""}: ${handleQueryDataType(field.fieldType, importedObjects, isReturnValue)}`;
|
|
1736
|
-
});
|
|
1737
|
-
return `{ ${properties.join(",\n")} }`;
|
|
1738
|
-
case "union":
|
|
1739
|
-
return dataType.unionTypes.map((type) => handleQueryDataType(type, importedObjects, isReturnValue)).filter((type) => type !== "null").join("|");
|
|
1740
|
-
case "twoDimensionalAggregation":
|
|
1741
|
-
dataType.valueType;
|
|
1742
|
-
return `TwoDimensionalAggregation<
|
|
1743
|
-
${aggregationKeyToTypescriptType(dataType.keyType)},
|
|
1744
|
-
${aggregationValueToTypescriptType(dataType.valueType)}
|
|
1745
|
-
>`;
|
|
1746
|
-
case "threeDimensionalAggregation":
|
|
1747
|
-
return `ThreeDimensionalAggregation<
|
|
1748
|
-
${aggregationKeyToTypescriptType(dataType.keyType)},
|
|
1749
|
-
${aggregationKeyToTypescriptType(dataType.valueType.keyType)},
|
|
1750
|
-
${aggregationValueToTypescriptType(dataType.valueType.valueType)}
|
|
1751
|
-
>`;
|
|
1752
|
-
case "null":
|
|
1753
|
-
return "null";
|
|
1754
|
-
case "unsupported":
|
|
1755
|
-
throw new Error("Cannot generate queries for unsupported type");
|
|
1756
|
-
default:
|
|
1757
|
-
throw new Error(`Cannot generate queries for type ${dataType.type}`);
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
function aggregationKeyToTypescriptType(keyType) {
|
|
1761
|
-
switch (keyType.type) {
|
|
1762
|
-
case "boolean":
|
|
1763
|
-
return "boolean";
|
|
1764
|
-
case "double":
|
|
1765
|
-
case "integer":
|
|
1766
|
-
return "number";
|
|
1767
|
-
case "string":
|
|
1768
|
-
return "string";
|
|
1769
|
-
case "date":
|
|
1770
|
-
return "LocalDate";
|
|
1771
|
-
case "timestamp":
|
|
1772
|
-
return "Timestamp";
|
|
1773
|
-
case "range":
|
|
1774
|
-
return `Range<${aggregationRangeToTypescriptType(keyType.subType)}>`;
|
|
1775
|
-
default:
|
|
1776
|
-
throw new Error(`Unknown TwoDimensionalAggregation keyType ${keyType.type}`);
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
function aggregationRangeToTypescriptType(subType) {
|
|
1780
|
-
switch (subType.type) {
|
|
1781
|
-
case "date":
|
|
1782
|
-
return "LocalDate";
|
|
1783
|
-
case "double":
|
|
1784
|
-
case "integer":
|
|
1785
|
-
return "number";
|
|
1786
|
-
case "timestamp":
|
|
1787
|
-
return "Timestamp";
|
|
1788
|
-
default:
|
|
1789
|
-
throw new Error(`Unsupported QueryAggregationRangeSubType ${subType.type}`);
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
function aggregationValueToTypescriptType(valueType) {
|
|
1793
|
-
switch (valueType.type) {
|
|
1794
|
-
case "date":
|
|
1795
|
-
return "LocalDate";
|
|
1796
|
-
case "double":
|
|
1797
|
-
return "number";
|
|
1798
|
-
case "timestamp":
|
|
1799
|
-
return "Timestamp";
|
|
1800
|
-
default:
|
|
1801
|
-
throw new Error(`Unsupported QueryAggregationValueType ${valueType.type}`);
|
|
1802
|
-
}
|
|
1803
|
-
}
|
|
1804
|
-
function sanitizeDocTypeName(type) {
|
|
1805
|
-
return type.replace(/\s/g, "");
|
|
1806
|
-
}
|
|
1807
|
-
|
|
1808
|
-
// src/v1.1/generateClientSdkVersionOneDotOne.ts
|
|
1809
|
-
async function generateClientSdkVersionOneDotOne(ontology, userAgent, fs2, outDir, packageType = "commonjs") {
|
|
1810
|
-
const importExt = packageType === "module" ? ".js" : "";
|
|
1811
|
-
const objectsDir = path16__namespace.join(outDir, "ontology", "objects");
|
|
1812
|
-
const actionsDir = path16__namespace.join(outDir, "ontology", "actions");
|
|
1813
|
-
const queriesDir = path16__namespace.join(outDir, "ontology", "queries");
|
|
1814
|
-
await verifyOutDir(outDir, fs2);
|
|
1815
|
-
await fs2.mkdir(outDir, {
|
|
1816
|
-
recursive: true
|
|
1817
|
-
});
|
|
1818
|
-
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
1819
|
-
const enhancedOntology = enhanceOntology(sanitizedOntology, void 0, /* @__PURE__ */ new Map(), importExt);
|
|
1820
|
-
await generateFoundryClientFile(fs2, outDir, importExt);
|
|
1821
|
-
await generateMetadataFile(sanitizedOntology, userAgent, fs2, outDir, importExt);
|
|
1822
|
-
await generateOntologyIndexFile(fs2, path16__namespace.join(outDir, "ontology"));
|
|
1823
|
-
await generateObjectsInterfaceFile(sanitizedOntology, fs2, objectsDir, importExt);
|
|
1824
|
-
await generateObjectsInterfaceSupportFiles(sanitizedOntology, fs2, path16__namespace.join(objectsDir, "objects-api"), importExt);
|
|
1825
|
-
await generatePerObjectInterfaceAndDataFiles(enhancedOntology, fs2, objectsDir, importExt);
|
|
1826
|
-
const common = {
|
|
1827
|
-
sanitizedOntology,
|
|
1828
|
-
fs: fs2,
|
|
1829
|
-
outDir,
|
|
1830
|
-
ontology: enhancedOntology
|
|
1831
|
-
};
|
|
1832
|
-
await generateActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1833
|
-
await generateBatchActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1834
|
-
await generateBulkActions(sanitizedOntology, fs2, actionsDir, importExt);
|
|
1835
|
-
await generatePerActionDataFilesV1(common);
|
|
1836
|
-
await generateQueries(sanitizedOntology, fs2, queriesDir, importExt);
|
|
1837
|
-
await generatePerQueryDataFiles(common);
|
|
1838
|
-
await generateIndexFile(fs2, outDir, importExt);
|
|
1839
|
-
await generateBackCompatDeprecatedExports(fs2, outDir, importExt);
|
|
1840
|
-
}
|
|
1841
|
-
var ExpectedOsdkVersion = "0.22.0";
|
|
1842
|
-
async function generateOntologyMetadataFile({
|
|
1843
|
-
fs: fs2,
|
|
1844
|
-
outDir,
|
|
1845
|
-
ontology,
|
|
1846
|
-
ontologyApiNamespace
|
|
1847
|
-
}, userAgent) {
|
|
1848
|
-
fs2.writeFile(path16__namespace.default.join(outDir, "OntologyMetadata.ts"), await formatTs(`
|
|
1849
|
-
export type $ExpectedClientVersion = "${ExpectedOsdkVersion}";
|
|
1850
|
-
export const $osdkMetadata = { extraUserAgent: "${userAgent}" };
|
|
1851
|
-
${ontologyApiNamespace == null ? `
|
|
1852
|
-
export const $ontologyRid = "${ontology.ontology.rid}";
|
|
1853
|
-
` : ""}
|
|
1854
|
-
`));
|
|
1855
|
-
}
|
|
1856
|
-
|
|
1857
|
-
// src/shared/propertyJsdoc.ts
|
|
1858
|
-
function propertyJsdoc(property, {
|
|
1859
|
-
isInherited,
|
|
1860
|
-
apiName
|
|
1861
|
-
}) {
|
|
1862
|
-
let ret = `/**
|
|
1863
|
-
`;
|
|
1864
|
-
const renderDisplayName = property.displayName && property.displayName !== apiName;
|
|
1865
|
-
if (isInherited || renderDisplayName || property.description) {
|
|
1866
|
-
if (isInherited) {
|
|
1867
|
-
ret += ` * (inherited from parent)
|
|
1868
|
-
`;
|
|
1869
|
-
}
|
|
1870
|
-
if (renderDisplayName) {
|
|
1871
|
-
ret += ` * display name: '${property.displayName}'${property.description ? "," : ""}
|
|
1872
|
-
`;
|
|
1873
|
-
}
|
|
1874
|
-
if (property.description) {
|
|
1875
|
-
ret += ` * description: ${property.description}
|
|
1876
|
-
`;
|
|
1877
|
-
}
|
|
1878
|
-
} else {
|
|
1879
|
-
ret += ` * (no ontology metadata)
|
|
1880
|
-
`;
|
|
1881
|
-
}
|
|
1882
|
-
ret += ` */
|
|
1883
|
-
`;
|
|
1884
|
-
return ret;
|
|
1885
|
-
}
|
|
1886
|
-
|
|
1887
|
-
// src/v2.0/wireObjectTypeV2ToSdkObjectConstV2.ts
|
|
1888
|
-
function getObjectDefIdentifier(name, v2) {
|
|
1889
|
-
return v2 ? name : `${name}Def`;
|
|
1890
|
-
}
|
|
1891
|
-
function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
1892
|
-
ontology
|
|
1893
|
-
}, currentFilePath) {
|
|
1894
|
-
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
1895
|
-
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
1896
|
-
const definition = deleteUndefineds(generatorConverters.wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.og, true));
|
|
1897
|
-
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
1898
|
-
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
1899
|
-
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
1900
|
-
const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;
|
|
1901
|
-
const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;
|
|
1902
|
-
const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
|
|
1903
|
-
const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
|
|
1904
|
-
const identifiers = {
|
|
1905
|
-
objectDefIdentifier: `${object.shortApiName}.Definition`,
|
|
1906
|
-
osdkObjectLinksIdentifier,
|
|
1907
|
-
osdkObjectPropsIdentifier,
|
|
1908
|
-
osdkObjectStrictPropsIdentifier,
|
|
1909
|
-
objectSetIdentifier,
|
|
1910
|
-
osdkObjectIdentifier,
|
|
1911
|
-
propertyKeysIdentifier
|
|
1912
|
-
};
|
|
1913
|
-
function getV2Types() {
|
|
1914
|
-
return `import type {
|
|
1915
|
-
AggregateOpts as $AggregateOpts,
|
|
1916
|
-
AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,
|
|
1917
|
-
AggregationsResults as $AggregationsResults,
|
|
1918
|
-
Augments as $Augments,
|
|
1919
|
-
ConvertProps as $ConvertProps,
|
|
1920
|
-
DefaultToFalse as $DefaultToFalse,
|
|
1921
|
-
FetchPageArgs as $FetchPageArgs,
|
|
1922
|
-
FetchPageResult as $FetchPageResult,
|
|
1923
|
-
IsAny as $IsAny,
|
|
1924
|
-
LinkedType as $LinkedType,
|
|
1925
|
-
LinkNames as $LinkNames,
|
|
1926
|
-
NullabilityAdherence as $NullabilityAdherence,
|
|
1927
|
-
NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
|
|
1928
|
-
ObjectSet as $ObjectSet,
|
|
1929
|
-
Osdk as $Osdk,
|
|
1930
|
-
OsdkObject as $OsdkObject,
|
|
1931
|
-
OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
|
|
1932
|
-
OsdkObjectLinksObject as $OsdkObjectLinksObject,
|
|
1933
|
-
OsdkObjectPropertyType as $OsdkObjectPropertyType,
|
|
1934
|
-
PageResult as $PageResult,
|
|
1935
|
-
PropertyValueClientToWire as $PropertyValueClientToWire,
|
|
1936
|
-
PropertyValueWireToClient as $PropType,
|
|
1937
|
-
Result as $Result,
|
|
1938
|
-
SelectArg as $SelectArg,
|
|
1939
|
-
SingleLinkAccessor as $SingleLinkAccessor,
|
|
1940
|
-
SingleLinkAccessor as $SingleLinkAccessor
|
|
1941
|
-
SingleOsdkResult as $SingleOsdkResult,
|
|
1942
|
-
ValidToFrom as $ValidToFrom,
|
|
1943
|
-
WhereClause as $WhereClause,
|
|
1944
|
-
} from "@osdk/client.api";
|
|
1945
|
-
import type * as $clientApi from "@osdk/client.api";
|
|
1946
|
-
import type {
|
|
1947
|
-
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
1948
|
-
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1949
|
-
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
1950
|
-
} from "@osdk/api";
|
|
1951
|
-
|
|
1952
|
-
export namespace ${object.shortApiName} {
|
|
1953
|
-
|
|
1954
|
-
${createPropertyKeys(object)}
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
${createLinks(ontology, object, "Links")}
|
|
1958
|
-
|
|
1959
|
-
${createProps(object, "Props", false)}
|
|
1960
|
-
${createProps(object, "StrictProps", true)}
|
|
1961
|
-
|
|
1962
|
-
${createObjectSet(object, identifiers)}
|
|
1963
|
-
|
|
1964
|
-
${createDefinition(object, ontology, "Definition", identifiers)}
|
|
1965
|
-
${createOsdkObject(object, "OsdkObject", identifiers)}
|
|
1966
|
-
}
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
export type ${objectDefIdentifier} = ${object.shortApiName}.Definition;
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
`;
|
|
1976
|
-
}
|
|
1977
|
-
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
1978
|
-
return `${imports}${getV2Types()}
|
|
1979
|
-
|
|
1980
|
-
export const ${object.shortApiName}: ${objectDefIdentifier} & $VersionBound<$ExpectedClientVersion>
|
|
1981
|
-
= {
|
|
1982
|
-
osdkMetadata: $osdkMetadata,
|
|
1983
|
-
objectSet: undefined as any,
|
|
1984
|
-
props: undefined as any,
|
|
1985
|
-
linksType: undefined as any,
|
|
1986
|
-
strictProps: undefined as any,
|
|
1987
|
-
${stringify(definition, {
|
|
1988
|
-
osdkMetadata: (value) => void 0
|
|
1989
|
-
})}
|
|
1990
|
-
|
|
1991
|
-
};`;
|
|
1992
|
-
}
|
|
1993
|
-
function createOsdkObject(object, identifier, {
|
|
1994
|
-
osdkObjectPropsIdentifier,
|
|
1995
|
-
objectDefIdentifier,
|
|
1996
|
-
osdkObjectStrictPropsIdentifier,
|
|
1997
|
-
osdkObjectLinksIdentifier
|
|
1998
|
-
}) {
|
|
1999
|
-
const definition = object.getCleanedUpDefinition(true);
|
|
2000
|
-
return `
|
|
2001
|
-
export type ${identifier}<
|
|
2002
|
-
OPTIONS extends never | "$notStrict" | "$rid" = never,
|
|
2003
|
-
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
2004
|
-
|
|
2005
|
-
>
|
|
2006
|
-
= $Osdk<
|
|
2007
|
-
${objectDefIdentifier},
|
|
2008
|
-
K | OPTIONS
|
|
2009
|
-
> & Pick<
|
|
2010
|
-
[OPTIONS] extends [never]
|
|
2011
|
-
? ${osdkObjectStrictPropsIdentifier} :
|
|
2012
|
-
OPTIONS extends "$notStrict" ? ${osdkObjectPropsIdentifier} : ${osdkObjectStrictPropsIdentifier}
|
|
2013
|
-
, K
|
|
2014
|
-
> & {
|
|
2015
|
-
readonly $link: ${osdkObjectLinksIdentifier};
|
|
2016
|
-
readonly $title: string | undefined; // FIXME
|
|
2017
|
-
readonly $primaryKey: ${"primaryKeyApiName" in definition ? `
|
|
2018
|
-
$OsdkObjectPropertyType<${JSON.stringify(definition.properties[definition.primaryKeyApiName])},${true}>` : "string | number"}
|
|
2019
|
-
;
|
|
2020
|
-
|
|
2021
|
-
readonly $as: <NEW_Q extends $ValidToFrom<${objectDefIdentifier}>>(type: NEW_Q | string) => $Osdk<
|
|
2022
|
-
NEW_Q,
|
|
2023
|
-
$ConvertProps<${objectDefIdentifier}, NEW_Q, K>
|
|
2024
|
-
>;
|
|
2025
|
-
} & $OsdkObject<"${object.fullApiName}">;`;
|
|
2026
|
-
}
|
|
2027
|
-
function createObjectSet(object, {
|
|
2028
|
-
objectDefIdentifier,
|
|
2029
|
-
objectSetIdentifier,
|
|
2030
|
-
propertyKeysIdentifier,
|
|
2031
|
-
osdkObjectIdentifier
|
|
2032
|
-
}) {
|
|
2033
|
-
return `
|
|
2034
|
-
export interface ObjectSet extends
|
|
2035
|
-
$ObjectSet<${objectDefIdentifier},
|
|
2036
|
-
|
|
2037
|
-
${objectSetIdentifier}
|
|
2038
|
-
>
|
|
2039
|
-
{
|
|
2040
|
-
readonly aggregate: <const AO extends $AggregateOpts<${objectDefIdentifier}>>(
|
|
2041
|
-
req: $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy<${objectDefIdentifier}, AO>,
|
|
2042
|
-
) => Promise<$AggregationsResults<${objectDefIdentifier}, AO>>;
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
readonly pivotTo: <const L extends $LinkNames<${objectDefIdentifier}>>(type: L) => $LinkedType<${objectDefIdentifier}, L>["objectSet"];
|
|
2046
|
-
${object instanceof EnhancedObjectType ? `
|
|
2047
|
-
readonly fetchOne: <
|
|
2048
|
-
const L extends ${propertyKeysIdentifier},
|
|
2049
|
-
const R extends boolean,
|
|
2050
|
-
const S extends false | "throw" = $NullabilityAdherenceDefault,
|
|
2051
|
-
>(
|
|
2052
|
-
primaryKey: $PropertyValueClientToWire[${objectDefIdentifier}["primaryKeyType"]],
|
|
2053
|
-
options?: $SelectArg<${objectDefIdentifier}, L, R, S>,
|
|
2054
|
-
) => Promise<
|
|
2055
|
-
${osdkObjectIdentifier}<
|
|
2056
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never: "$rid" ),
|
|
2057
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2058
|
-
>>
|
|
2059
|
-
;
|
|
2060
|
-
|
|
2061
|
-
readonly fetchOneWithErrors: <
|
|
2062
|
-
const L extends ${propertyKeysIdentifier},
|
|
2063
|
-
const R extends boolean,
|
|
2064
|
-
const S extends false | "throw" = $NullabilityAdherenceDefault,
|
|
2065
|
-
>(
|
|
2066
|
-
primaryKey: $PropertyValueClientToWire[${objectDefIdentifier}["primaryKeyType"]],
|
|
2067
|
-
options?: $SelectArg<${objectDefIdentifier}, L, R, S>,
|
|
2068
|
-
) => Promise<$Result<
|
|
2069
|
-
${osdkObjectIdentifier}<
|
|
2070
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false?never: "$rid"),
|
|
2071
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2072
|
-
>
|
|
2073
|
-
>>
|
|
2074
|
-
|
|
2075
|
-
;
|
|
2076
|
-
|
|
2077
|
-
` : ""}
|
|
2078
|
-
|
|
2079
|
-
readonly fetchPage: <
|
|
2080
|
-
const L extends ${propertyKeysIdentifier},
|
|
2081
|
-
const R extends boolean,
|
|
2082
|
-
const const A extends $Augments,
|
|
2083
|
-
const S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
|
|
2084
|
-
>(
|
|
2085
|
-
args?: $FetchPageArgs<${objectDefIdentifier}, L, R, A, S>,
|
|
2086
|
-
) => Promise<
|
|
2087
|
-
$PageResult<${osdkObjectIdentifier}<
|
|
2088
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never: "$rid"),
|
|
2089
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2090
|
-
>>
|
|
2091
|
-
>;
|
|
2092
|
-
|
|
2093
|
-
readonly fetchPageWithErrors: <
|
|
2094
|
-
const L extends ${propertyKeysIdentifier},
|
|
2095
|
-
const R extends boolean,
|
|
2096
|
-
const A extends $Augments,
|
|
2097
|
-
const S extends $NullabilityAdherence = $NullabilityAdherenceDefault,
|
|
2098
|
-
>(
|
|
2099
|
-
args?: $FetchPageArgs<${objectDefIdentifier}, L, R, A, S>,
|
|
2100
|
-
) => Promise<$Result<
|
|
2101
|
-
$PageResult<${osdkObjectIdentifier}<
|
|
2102
|
-
(S extends false ? "$notStrict" : never) | ($DefaultToFalse<R> extends false? never : "$rid"),
|
|
2103
|
-
$IsAny<L> extends true ? ${propertyKeysIdentifier} : L
|
|
2104
|
-
>>
|
|
2105
|
-
>>;
|
|
2106
|
-
|
|
2107
|
-
readonly asyncIter: () => AsyncIterableIterator<${osdkObjectIdentifier}>;
|
|
2108
|
-
}
|
|
2109
|
-
`;
|
|
2110
|
-
}
|
|
2111
|
-
function maybeStripNamespace(type, q) {
|
|
2112
|
-
if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {
|
|
2113
|
-
return q.slice(type.apiNamespace.length + 1);
|
|
2114
|
-
} else {
|
|
2115
|
-
return q;
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
function createProps(type, identifier, strict) {
|
|
2119
|
-
const definition = type.getCleanedUpDefinition(true);
|
|
2120
|
-
return `export interface ${identifier} {
|
|
2121
|
-
${stringify(definition.properties, {
|
|
2122
|
-
"*": (propertyDefinition, _, apiName) => {
|
|
2123
|
-
return [`readonly "${maybeStripNamespace(type, apiName)}"${// after we convert everything over we can do this:
|
|
2124
|
-
// !strict || propertyDefinition.nullable ? "?" : ""
|
|
2125
|
-
""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict ? `| undefined` : ""}`];
|
|
2126
|
-
}
|
|
2127
|
-
})}
|
|
2128
|
-
}`;
|
|
2129
|
-
}
|
|
2130
|
-
function createDefinition(object, ontology, identifier, {
|
|
2131
|
-
objectDefIdentifier,
|
|
2132
|
-
objectSetIdentifier,
|
|
2133
|
-
osdkObjectPropsIdentifier,
|
|
2134
|
-
osdkObjectStrictPropsIdentifier,
|
|
2135
|
-
osdkObjectLinksIdentifier
|
|
2136
|
-
}) {
|
|
2137
|
-
const definition = object.getCleanedUpDefinition(true);
|
|
2138
|
-
return `
|
|
2139
|
-
export interface ${identifier} extends ${object instanceof EnhancedObjectType ? `$ObjectTypeDefinition` : `$InterfaceDefinition`}<"${object.fullApiName}", ${objectDefIdentifier}>, $VersionBound<$ExpectedClientVersion> {
|
|
2140
|
-
osdkMetadata: typeof $osdkMetadata;
|
|
2141
|
-
objectSet: ${objectSetIdentifier};
|
|
2142
|
-
props: ${osdkObjectPropsIdentifier};
|
|
2143
|
-
linksType: ${osdkObjectLinksIdentifier};
|
|
2144
|
-
strictProps: ${osdkObjectStrictPropsIdentifier};
|
|
2145
|
-
${stringify(definition, {
|
|
2146
|
-
osdkMetadata: () => void 0,
|
|
2147
|
-
// we are going to reference another object instead
|
|
2148
|
-
type: () => void 0,
|
|
2149
|
-
apiName: () => void 0,
|
|
2150
|
-
links: (_value) => `{
|
|
2151
|
-
${stringify(definition.links, {
|
|
2152
|
-
"*": (definition2) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true)}, ${definition2.multiplicity}>`
|
|
2153
|
-
})}
|
|
2154
|
-
}`,
|
|
2155
|
-
properties: (_value) => `{
|
|
2156
|
-
${stringify(definition.properties, {
|
|
2157
|
-
"*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
|
|
2158
|
-
apiName
|
|
2159
|
-
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
|
|
2160
|
-
})}
|
|
2161
|
-
}`
|
|
2162
|
-
})}
|
|
2163
|
-
}
|
|
2164
|
-
`;
|
|
2165
|
-
}
|
|
2166
|
-
function createLinks(ontology, object, identifier) {
|
|
2167
|
-
const definition = object.getCleanedUpDefinition(true);
|
|
2168
|
-
return `
|
|
2169
|
-
${Object.keys(definition.links).length === 0 ? `export type ${identifier} = {};` : `
|
|
2170
|
-
export interface ${identifier} {
|
|
2171
|
-
${stringify(definition.links, {
|
|
2172
|
-
"*": (definition2, _, key) => {
|
|
2173
|
-
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true);
|
|
2174
|
-
return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}.Definition>`}
|
|
2175
|
-
`];
|
|
2176
|
-
}
|
|
2177
|
-
})}
|
|
2178
|
-
}
|
|
2179
|
-
`}`;
|
|
2180
|
-
}
|
|
2181
|
-
function createPropertyKeys(type) {
|
|
2182
|
-
return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map((a) => `"${a}"`).join("|")};`;
|
|
2183
|
-
}
|
|
2184
|
-
|
|
2185
|
-
// src/v2.0/generatePerActionDataFiles.ts
|
|
2186
|
-
async function generatePerActionDataFiles({
|
|
2187
|
-
sanitizedOntology: ontology,
|
|
2188
|
-
fs: fs2,
|
|
2189
|
-
outDir: rootOutDir,
|
|
2190
|
-
importExt = "",
|
|
2191
|
-
ontology: enhancedOntology
|
|
2192
|
-
}) {
|
|
2193
|
-
const outDir = path16__namespace.default.join(rootOutDir, "ontology", "actions");
|
|
2194
|
-
await fs2.mkdir(outDir, {
|
|
2195
|
-
recursive: true
|
|
2196
|
-
});
|
|
2197
|
-
await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
|
|
2198
|
-
const currentFilePath = `${path16__namespace.default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
|
|
2199
|
-
const uniqueApiNamesArray = extractReferencedObjectsFromAction2(action.og);
|
|
2200
|
-
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
2201
|
-
const uniqueApiNamesString = stringUnionFrom2([...uniqueApiNames]);
|
|
2202
|
-
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.og));
|
|
2203
|
-
const {
|
|
2204
|
-
parameters,
|
|
2205
|
-
...actionDefSansParameters
|
|
2206
|
-
} = fullActionDef;
|
|
2207
|
-
function createParamsDef() {
|
|
2208
|
-
const entries = Object.entries(parameters);
|
|
2209
|
-
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
2210
|
-
if (entries.length === 0) {
|
|
2211
|
-
return `// Represents the definition of the parameters for the action
|
|
2212
|
-
export type ParamsDefinition = Record<string, never>;`;
|
|
2213
|
-
}
|
|
2214
|
-
return `// Represents the definition of the parameters for the action
|
|
2215
|
-
export type ParamsDefinition = {
|
|
2216
|
-
${entries.map(([key, value]) => {
|
|
2217
|
-
return `"${key}": {
|
|
2218
|
-
${stringify(value, {
|
|
2219
|
-
description: (value2, d) => value2 ? d(value2) : void 0,
|
|
2220
|
-
// trick to remove undefineds
|
|
2221
|
-
type: (type) => {
|
|
2222
|
-
if (typeof type === "string") {
|
|
2223
|
-
return JSON.stringify(type);
|
|
2224
|
-
} else if (type.type === "object") {
|
|
2225
|
-
const obj = enhancedOntology.requireObjectType(type.object);
|
|
2226
|
-
return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}.Definition>`;
|
|
2227
|
-
} else if (type.type === "objectSet") {
|
|
2228
|
-
return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}.Definition>`;
|
|
2229
|
-
}
|
|
2230
|
-
return void 0;
|
|
2231
|
-
}
|
|
2232
|
-
})}
|
|
2233
|
-
}`;
|
|
2234
|
-
}).join(";\n")}
|
|
2235
|
-
}`;
|
|
2236
|
-
}
|
|
2237
|
-
function getActionParamType(input) {
|
|
2238
|
-
if (typeof input === "string") {
|
|
2239
|
-
return `ActionParam.PrimitiveType<${JSON.stringify(input)}>`;
|
|
2240
|
-
} else if (input.type === "object") {
|
|
2241
|
-
return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}.Definition>`;
|
|
2242
|
-
} else if (input.type === "objectSet") {
|
|
2243
|
-
return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}.Definition>`;
|
|
2244
|
-
}
|
|
2245
|
-
}
|
|
2246
|
-
function createV2Types() {
|
|
2247
|
-
const oldParamsIdentifier = `${action.shortApiName}$Params`;
|
|
2248
|
-
return `
|
|
2249
|
-
|
|
2250
|
-
export namespace ${action.shortApiName}{
|
|
2251
|
-
${createParamsDef()}
|
|
2252
|
-
|
|
2253
|
-
${getDescriptionIfPresent(action.description)}
|
|
2254
|
-
export interface Params {
|
|
2255
|
-
${stringify(parameters, {
|
|
2256
|
-
"*": (ogValue, _, ogKey) => {
|
|
2257
|
-
const key = `${getDescriptionIfPresent(ogValue.description)}
|
|
2258
|
-
readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
|
|
2259
|
-
const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
|
|
2260
|
-
return [key, value];
|
|
2261
|
-
}
|
|
2262
|
-
})}
|
|
2263
|
-
}
|
|
2264
|
-
/** @deprecated **/
|
|
2265
|
-
export type Parameters = Params;
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
// Represents the definition of the action
|
|
2269
|
-
export interface Definition extends ActionDefinition<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures>, VersionBound<$ExpectedClientVersion> {
|
|
2270
|
-
${Object.entries(actionDefSansParameters).sort((a, b) => a[0].localeCompare(b[0])).map(([key, value]) => {
|
|
2271
|
-
return `${key}: ${JSON.stringify(value)};`;
|
|
2272
|
-
}).join("\n")}
|
|
2273
|
-
parameters: ${action.definitionParamsIdentifier};
|
|
2274
|
-
osdkMetadata: typeof $osdkMetadata;
|
|
2275
|
-
}
|
|
2276
|
-
|
|
2277
|
-
// Represents a fqn of the action
|
|
2278
|
-
export interface Signatures {
|
|
2279
|
-
${getDescriptionIfPresent(action.description)}
|
|
2280
|
-
applyAction<P extends ${action.paramsIdentifier}, OP extends ApplyActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
|
|
2281
|
-
|
|
2282
|
-
batchApplyAction<P extends ReadonlyArray<${action.paramsIdentifier}>, OP extends ApplyBatchActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
}
|
|
2286
|
-
|
|
2287
|
-
/**
|
|
2288
|
-
* @deprecated Use \`${action.paramsIdentifier}\`
|
|
2289
|
-
*/
|
|
2290
|
-
export type ${oldParamsIdentifier} = ${action.paramsIdentifier} | ReadonlyArray<${action.paramsIdentifier}>;
|
|
2291
|
-
|
|
2292
|
-
/** @deprecated Use \`${action.definitionIdentifier}\` **/
|
|
2293
|
-
export type ${action.shortApiName} = ${action.shortApiName}.Signatures;
|
|
2294
|
-
`;
|
|
2295
|
-
}
|
|
2296
|
-
function createV2Object() {
|
|
2297
|
-
return ` export const ${action.shortApiName}: ${action.definitionIdentifier} =
|
|
2298
|
-
{
|
|
2299
|
-
${stringify(fullActionDef)},
|
|
2300
|
-
osdkMetadata: $osdkMetadata
|
|
2301
|
-
}
|
|
2302
|
-
`;
|
|
2303
|
-
}
|
|
2304
|
-
const referencedObjectDefs = /* @__PURE__ */ new Set();
|
|
2305
|
-
for (const p of Object.values(action.parameters)) {
|
|
2306
|
-
if (p.dataType.type === "object" || p.dataType.type === "objectSet") {
|
|
2307
|
-
if (p.dataType.objectApiName) {
|
|
2308
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectApiName));
|
|
2309
|
-
}
|
|
2310
|
-
if (p.dataType.objectTypeApiName) {
|
|
2311
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectTypeApiName));
|
|
2312
|
-
}
|
|
2313
|
-
}
|
|
2314
|
-
if (p.dataType.type === "array" && (p.dataType.subType.type === "object" || p.dataType.subType.type === "objectSet")) {
|
|
2315
|
-
if (p.dataType.subType.objectApiName) {
|
|
2316
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectApiName));
|
|
2317
|
-
}
|
|
2318
|
-
if (p.dataType.subType.objectTypeApiName) {
|
|
2319
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectTypeApiName));
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
|
-
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
|
|
2324
|
-
await fs2.writeFile(path16__namespace.default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
2325
|
-
import type { ActionDefinition, ObjectActionDataType, ObjectSetActionDataType, VersionBound} from "@osdk/api";
|
|
2326
|
-
import type { ApplyActionOptions, ApplyBatchActionOptions, ActionReturnTypeForOptions, ActionParam } from '@osdk/client.api';
|
|
2327
|
-
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
2328
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2329
|
-
${imports}
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
${createV2Types()}
|
|
2333
|
-
|
|
2334
|
-
${createV2Object()}
|
|
2335
|
-
`));
|
|
2336
|
-
}));
|
|
2337
|
-
const indexFileRelPath = path16__namespace.default.join("ontology", "actions.ts");
|
|
2338
|
-
await fs2.writeFile(path16__namespace.default.join(rootOutDir, indexFileRelPath), await formatTs(`
|
|
2339
|
-
${Object.values(enhancedOntology.actionTypes).map((action) => {
|
|
2340
|
-
const exportConstLine = `export {${action.shortApiName} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
2341
|
-
return exportConstLine;
|
|
2342
|
-
}).join("\n")}
|
|
2343
|
-
${Object.keys(ontology.actionTypes).length === 0 ? "export {};" : ""}
|
|
2344
|
-
`));
|
|
2345
|
-
}
|
|
2346
|
-
function extractReferencedObjectsFromAction2(actionType) {
|
|
2347
|
-
const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({
|
|
2348
|
-
dataType
|
|
2349
|
-
}) => {
|
|
2350
|
-
const objectTypeReference = extractReferencedObjectsFromActionParameter2(dataType);
|
|
2351
|
-
return objectTypeReference ? [objectTypeReference] : [];
|
|
2352
|
-
});
|
|
2353
|
-
const referenceObjectsInEdits = actionType.operations.flatMap((value) => {
|
|
2354
|
-
switch (value.type) {
|
|
2355
|
-
case "createObject":
|
|
2356
|
-
return [value.objectTypeApiName];
|
|
2357
|
-
case "modifyObject":
|
|
2358
|
-
return [value.objectTypeApiName];
|
|
2359
|
-
case "deleteObject":
|
|
2360
|
-
case "createLink":
|
|
2361
|
-
case "deleteLink":
|
|
2362
|
-
return [];
|
|
2363
|
-
}
|
|
2364
|
-
});
|
|
2365
|
-
return [...referenceObjectsInEdits, ...referencedObjectsInParameters];
|
|
2366
|
-
}
|
|
2367
|
-
function extractReferencedObjectsFromActionParameter2(actionParameter) {
|
|
2368
|
-
switch (actionParameter.type) {
|
|
2369
|
-
case "objectSet":
|
|
2370
|
-
case "object":
|
|
2371
|
-
return actionParameter.objectTypeApiName;
|
|
2372
|
-
case "array":
|
|
2373
|
-
return extractReferencedObjectsFromActionParameter2(actionParameter.subType);
|
|
2374
|
-
case "string":
|
|
2375
|
-
case "boolean":
|
|
2376
|
-
case "attachment":
|
|
2377
|
-
case "date":
|
|
2378
|
-
case "double":
|
|
2379
|
-
case "integer":
|
|
2380
|
-
case "long":
|
|
2381
|
-
case "timestamp":
|
|
2382
|
-
return void 0;
|
|
2383
|
-
}
|
|
2384
|
-
}
|
|
2385
|
-
async function generatePerQueryDataFilesV2({
|
|
2386
|
-
fs: fs2,
|
|
2387
|
-
outDir: rootOutDir,
|
|
2388
|
-
ontology,
|
|
2389
|
-
importExt = ""
|
|
2390
|
-
}, v2) {
|
|
2391
|
-
const relOutDir = path16__namespace.default.join(".", "ontology", "queries");
|
|
2392
|
-
const outDir = path16__namespace.default.join(rootOutDir, "ontology", "queries");
|
|
2393
|
-
await fs2.mkdir(outDir, {
|
|
2394
|
-
recursive: true
|
|
2395
|
-
});
|
|
2396
|
-
await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {
|
|
2397
|
-
await generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology);
|
|
2398
|
-
}));
|
|
2399
|
-
const indexFilePath = `${outDir}.ts`;
|
|
2400
|
-
await fs2.writeFile(indexFilePath, await formatTs(`
|
|
2401
|
-
${Object.values(ontology.queryTypes).map((query) => `export * from "${query.getImportPathRelTo(relOutDir)}";`).join("\n")}
|
|
2402
|
-
${Object.keys(ontology.queryTypes).length === 0 ? "export {};" : ""}
|
|
2403
|
-
`));
|
|
2404
|
-
}
|
|
2405
|
-
async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology) {
|
|
2406
|
-
const relFilePath = path16__namespace.default.join(relOutDir, `${query.shortApiName}.ts`);
|
|
2407
|
-
const objectTypes = getObjectTypeApiNamesFromQuery(query);
|
|
2408
|
-
const importObjects = getObjectImports2(ontology, objectTypes, relFilePath);
|
|
2409
|
-
const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.og));
|
|
2410
|
-
const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
|
|
2411
|
-
const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
|
|
2412
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
|
|
2413
|
-
import type { QueryDefinition , VersionBound} from "@osdk/api";
|
|
2414
|
-
import type { QueryParam, QueryResult } from "@osdk/client.api";
|
|
2415
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2416
|
-
${importObjects}
|
|
2417
|
-
|
|
2418
|
-
export namespace ${query.shortApiName} {
|
|
2419
|
-
export interface Signature {
|
|
2420
|
-
${getDescriptionIfPresent(query.description)}
|
|
2421
|
-
(${Object.keys(query.parameters).length > 0 ? `query: ${query.paramsIdentifier}` : ""}): Promise<${getQueryParamType(ontology, wireQueryParameterV2ToQueryParameterDefinition({
|
|
2422
|
-
dataType: query.output
|
|
2423
|
-
}), "Result")}>
|
|
2424
|
-
}
|
|
2425
|
-
|
|
2426
|
-
${Object.keys(query.parameters).length > 0 ? `
|
|
2427
|
-
export interface Parameters {
|
|
2428
|
-
${stringify(query.parameters, {
|
|
2429
|
-
"*": (parameter, formatter, apiName) => {
|
|
2430
|
-
const q = wireQueryParameterV2ToQueryParameterDefinition(parameter);
|
|
2431
|
-
return [`
|
|
2432
|
-
${queryParamJsDoc(wireQueryParameterV2ToQueryParameterDefinition(parameter), {
|
|
2433
|
-
apiName
|
|
2434
|
-
})}readonly "${apiName}"${q.nullable ? "?" : ""}`, `${getQueryParamType(ontology, q, "Param")}`];
|
|
2435
|
-
}
|
|
2436
|
-
})}
|
|
2437
|
-
}
|
|
2438
|
-
|
|
2439
|
-
` : ""}
|
|
2440
|
-
|
|
2441
|
-
export interface Definition extends QueryDefinition<
|
|
2442
|
-
"${query.fullApiName}",
|
|
2443
|
-
${referencedObjectTypes},
|
|
2444
|
-
${query.shortApiName}.Signature
|
|
2445
|
-
>, VersionBound<$ExpectedClientVersion>{
|
|
2446
|
-
${stringify(baseProps)},
|
|
2447
|
-
parameters: {
|
|
2448
|
-
${parameterDefsForType(ontology, query)}
|
|
2449
|
-
};
|
|
2450
|
-
output: {
|
|
2451
|
-
${stringify(outputBase)},
|
|
2452
|
-
${getLineFor__OsdkTargetType(ontology, query.output)}
|
|
2453
|
-
};
|
|
2454
|
-
}
|
|
2455
|
-
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
/** @deprecated use \`${query.shortApiName}.Signature' instead */
|
|
2459
|
-
export type ${query.shortApiName} = ${query.shortApiName}.Signature;
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
export const ${query.shortApiName}: ${query.definitionIdentifier} = {
|
|
2466
|
-
${stringify(baseProps)},
|
|
2467
|
-
parameters: {
|
|
2468
|
-
${parametersForConst(query)}
|
|
2469
|
-
},
|
|
2470
|
-
output: {
|
|
2471
|
-
${stringify(outputBase)},
|
|
2472
|
-
}
|
|
2473
|
-
};
|
|
2474
|
-
`));
|
|
2475
|
-
}
|
|
2476
|
-
function parametersForConst(query) {
|
|
2477
|
-
return stringify(query.parameters, {
|
|
2478
|
-
"*": (parameter, formatter) => formatter(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))
|
|
2479
|
-
});
|
|
2480
|
-
}
|
|
2481
|
-
function parameterDefsForType(ontology, query) {
|
|
2482
|
-
return stringify(query.parameters, {
|
|
2483
|
-
"*": (parameter, valueFormatter, apiName) => [`${queryParamJsDoc(wireQueryParameterV2ToQueryParameterDefinition(parameter), {
|
|
2484
|
-
apiName
|
|
2485
|
-
})} ${apiName}`, ` {
|
|
2486
|
-
${stringify(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))},
|
|
2487
|
-
${getLineFor__OsdkTargetType(ontology, parameter.dataType)}
|
|
2488
|
-
}`]
|
|
2489
|
-
});
|
|
2490
|
-
}
|
|
2491
|
-
function getLineFor__OsdkTargetType(ontology, qdt) {
|
|
2492
|
-
if (qdt.type === "object" || qdt.type === "objectSet") {
|
|
2493
|
-
return `__OsdkTargetType?: ${ontology.requireObjectType(qdt.objectTypeApiName).getImportedDefinitionIdentifier(true)}`;
|
|
2494
|
-
}
|
|
2495
|
-
return "";
|
|
2496
|
-
}
|
|
2497
|
-
function queryParamJsDoc(param, {
|
|
2498
|
-
apiName
|
|
2499
|
-
}) {
|
|
2500
|
-
let ret = `/**
|
|
2501
|
-
`;
|
|
2502
|
-
if (param.description) {
|
|
2503
|
-
if (param.description) {
|
|
2504
|
-
ret += ` * description: ${param.description}
|
|
2505
|
-
`;
|
|
2506
|
-
}
|
|
2507
|
-
} else {
|
|
2508
|
-
ret += ` * (no ontology metadata)
|
|
2509
|
-
`;
|
|
2510
|
-
}
|
|
2511
|
-
ret += ` */
|
|
2512
|
-
`;
|
|
2513
|
-
return ret;
|
|
2514
|
-
}
|
|
2515
|
-
function getObjectImports2(enhancedOntology, objectTypes, filePath) {
|
|
2516
|
-
let ret = "";
|
|
2517
|
-
for (const fqObjectApiName of objectTypes) {
|
|
2518
|
-
const obj = enhancedOntology.requireObjectType(fqObjectApiName);
|
|
2519
|
-
ret += `import type { ${obj.getDefinitionIdentifier(true)} as ${obj.getImportedDefinitionIdentifier(true)} } from "${obj.getImportPathRelTo(filePath)}";
|
|
2520
|
-
`;
|
|
2521
|
-
}
|
|
2522
|
-
return ret;
|
|
2523
|
-
}
|
|
2524
|
-
function getQueryParamType(enhancedOntology, input, type) {
|
|
2525
|
-
let inner = `unknown /* ${input.type} */`;
|
|
2526
|
-
switch (input.type) {
|
|
2527
|
-
case "date":
|
|
2528
|
-
inner = `Query${type}.PrimitiveType<${JSON.stringify("datetime")}>`;
|
|
2529
|
-
break;
|
|
2530
|
-
case "attachment":
|
|
2531
|
-
case "boolean":
|
|
2532
|
-
case "double":
|
|
2533
|
-
case "float":
|
|
2534
|
-
case "integer":
|
|
2535
|
-
case "long":
|
|
2536
|
-
case "string":
|
|
2537
|
-
case "struct":
|
|
2538
|
-
case "threeDimensionalAggregation":
|
|
2539
|
-
case "timestamp":
|
|
2540
|
-
case "twoDimensionalAggregation":
|
|
2541
|
-
inner = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;
|
|
2542
|
-
break;
|
|
2543
|
-
case "object":
|
|
2544
|
-
inner = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
2545
|
-
break;
|
|
2546
|
-
case "objectSet":
|
|
2547
|
-
inner = `Query${type}.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
2548
|
-
break;
|
|
2549
|
-
case "set":
|
|
2550
|
-
inner = `${type === "Param" ? "Readonly" : ""}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;
|
|
2551
|
-
break;
|
|
2552
|
-
case "union":
|
|
2553
|
-
inner = input.union.map((u) => getQueryParamType(enhancedOntology, u, type)).join(" | ");
|
|
2554
|
-
break;
|
|
2555
|
-
}
|
|
2556
|
-
if (input.multiplicity && type === "Param") {
|
|
2557
|
-
return `ReadonlyArray<${inner}>`;
|
|
2558
|
-
} else if (input.multiplicity) {
|
|
2559
|
-
return `Array<${inner}>`;
|
|
2560
|
-
}
|
|
2561
|
-
return inner;
|
|
2562
|
-
}
|
|
2563
|
-
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
|
|
2564
|
-
const definition = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.og, v2));
|
|
2565
|
-
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
2566
|
-
const parents = definition.implements?.map((p) => {
|
|
2567
|
-
!(ontology.interfaceTypes[p] != null) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : invariant__default.default(false) : void 0;
|
|
2568
|
-
const it = deleteUndefineds(generatorConverters.__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).og, v2));
|
|
2569
|
-
return it;
|
|
2570
|
-
}) ?? [];
|
|
2571
|
-
const mergedProperties = {
|
|
2572
|
-
...definition.properties
|
|
2573
|
-
};
|
|
2574
|
-
for (const parent of parents) {
|
|
2575
|
-
for (const apiName of Object.keys(parent.properties)) {
|
|
2576
|
-
if (definition.properties[apiName] != null) {
|
|
2577
|
-
!fastDeepEqual__default.default(definition.properties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : invariant__default.default(false) : void 0;
|
|
2578
|
-
} else if (mergedProperties[apiName] != null) {
|
|
2579
|
-
!fastDeepEqual__default.default(mergedProperties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant__default.default(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : invariant__default.default(false) : void 0;
|
|
2580
|
-
}
|
|
2581
|
-
mergedProperties[apiName] = parent.properties[apiName];
|
|
2582
|
-
}
|
|
2583
|
-
}
|
|
2584
|
-
definition.properties;
|
|
2585
|
-
definition.properties = mergedProperties;
|
|
2586
|
-
function maybeStripNamespace2(q) {
|
|
2587
|
-
if (interfaceDef.apiNamespace && q.startsWith(`${interfaceDef.apiNamespace}.`)) {
|
|
2588
|
-
return q.slice(interfaceDef.apiNamespace.length + 1);
|
|
2589
|
-
} else {
|
|
2590
|
-
return q;
|
|
2591
|
-
}
|
|
2592
|
-
}
|
|
2593
|
-
const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
|
|
2594
|
-
const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
|
|
2595
|
-
const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
|
|
2596
|
-
const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;
|
|
2597
|
-
const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
|
|
2598
|
-
const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
|
|
2599
|
-
const ids = {
|
|
2600
|
-
objectDefIdentifier: `${interfaceDef.shortApiName}.Definition`,
|
|
2601
|
-
osdkObjectLinksIdentifier,
|
|
2602
|
-
osdkObjectPropsIdentifier,
|
|
2603
|
-
osdkObjectStrictPropsIdentifier,
|
|
2604
|
-
objectSetIdentifier,
|
|
2605
|
-
osdkObjectIdentifier,
|
|
2606
|
-
propertyKeysIdentifier
|
|
2607
|
-
};
|
|
2608
|
-
function getV2Types() {
|
|
2609
|
-
return `import type {
|
|
2610
|
-
AggregateOpts as $AggregateOpts,
|
|
2611
|
-
AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy as $AggregateOptsThatErrorsAndDisallowsOrderingWithMultipleGroupBy,
|
|
2612
|
-
AggregationsResults as $AggregationsResults,
|
|
2613
|
-
Augments as $Augments,
|
|
2614
|
-
ConvertProps as $ConvertProps,
|
|
2615
|
-
DefaultToFalse as $DefaultToFalse,
|
|
2616
|
-
FetchPageArgs as $FetchPageArgs,
|
|
2617
|
-
FetchPageResult as $FetchPageResult,
|
|
2618
|
-
IsAny as $IsAny,
|
|
2619
|
-
LinkedType as $LinkedType,
|
|
2620
|
-
LinkNames as $LinkNames,
|
|
2621
|
-
NullabilityAdherence as $NullabilityAdherence,
|
|
2622
|
-
NullabilityAdherenceDefault as $NullabilityAdherenceDefault,
|
|
2623
|
-
ObjectSet as $ObjectSet,
|
|
2624
|
-
Osdk as $Osdk,
|
|
2625
|
-
OsdkObject as $OsdkObject,
|
|
2626
|
-
OsdkObjectLinksEntry as $OsdkObjectLinksEntry,
|
|
2627
|
-
OsdkObjectLinksObject as $OsdkObjectLinksObject,
|
|
2628
|
-
OsdkObjectPropertyType as $OsdkObjectPropertyType,
|
|
2629
|
-
PageResult as $PageResult,
|
|
2630
|
-
PropertyValueClientToWire as $PropertyValueClientToWire,
|
|
2631
|
-
PropertyValueWireToClient as $PropType,
|
|
2632
|
-
Result as $Result,
|
|
2633
|
-
SelectArg as $SelectArg,
|
|
2634
|
-
SingleLinkAccessor as $SingleLinkAccessor,
|
|
2635
|
-
SingleOsdkResult as $SingleOsdkResult,
|
|
2636
|
-
ValidToFrom as $ValidToFrom,
|
|
2637
|
-
WhereClause as $WhereClause,
|
|
2638
|
-
} from "@osdk/client.api";
|
|
2639
|
-
import type * as $clientApi from "@osdk/client.api";
|
|
2640
|
-
import type {
|
|
2641
|
-
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
2642
|
-
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
2643
|
-
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
2644
|
-
InterfaceDefinition as $InterfaceDefinition,
|
|
2645
|
-
} from "@osdk/api";
|
|
2646
|
-
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
${Object.keys(definition.links).length === 0 ? `export type ${osdkObjectLinksIdentifier} = {};` : `
|
|
2650
|
-
export interface ${osdkObjectLinksIdentifier} {
|
|
2651
|
-
${stringify(definition.links, {
|
|
2652
|
-
"*": (definition2) => {
|
|
2653
|
-
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(v2);
|
|
2654
|
-
return `${definition2.multiplicity ? `${linkTarget}["objectSet"]` : `SingleLinkAccessor<${linkTarget}>`}
|
|
2655
|
-
`;
|
|
2656
|
-
}
|
|
2657
|
-
})}
|
|
2658
|
-
}
|
|
2659
|
-
`}
|
|
2660
|
-
|
|
2661
|
-
export namespace ${interfaceDef.shortApiName} {
|
|
2662
|
-
|
|
2663
|
-
${createPropertyKeys(interfaceDef)}
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
${createProps(interfaceDef, "Props", false)}
|
|
2667
|
-
${createProps(interfaceDef, "StrictProps", true)}
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
${createObjectSet(interfaceDef, ids)}
|
|
2671
|
-
|
|
2672
|
-
${createDefinition(interfaceDef, ontology, "Definition", ids)}
|
|
2673
|
-
|
|
2674
|
-
${createOsdkObject(interfaceDef, "OsdkObject", ids)}
|
|
2675
|
-
|
|
2676
|
-
}
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
/** @deprecated use ${interfaceDef.shortApiName}.Definition **/
|
|
2682
|
-
export type ${objectDefIdentifier} = ${interfaceDef.shortApiName}.Definition;
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
`;
|
|
2688
|
-
}
|
|
2689
|
-
const imports = [];
|
|
2690
|
-
return `${imports.join("\n")}
|
|
2691
|
-
${v2 ? getV2Types() : ""}
|
|
2692
|
-
|
|
2693
|
-
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName}.Definition = {
|
|
2694
|
-
osdkMetadata: $osdkMetadata,
|
|
2695
|
-
objectSet: undefined as any,
|
|
2696
|
-
props: undefined as any,
|
|
2697
|
-
linksType: undefined as any,
|
|
2698
|
-
strictProps: undefined as any,
|
|
2699
|
-
${stringify(definition, {
|
|
2700
|
-
osdkMetadata: () => void 0,
|
|
2701
|
-
properties: (properties) => `{
|
|
2702
|
-
${stringify(properties, {
|
|
2703
|
-
"*": (propertyDefinition, _, key) => [`"${maybeStripNamespace2(key)}"`, _(propertyDefinition)]
|
|
2704
|
-
})}
|
|
2705
|
-
}`
|
|
2706
|
-
})}
|
|
2707
|
-
|
|
2708
|
-
};`;
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
// src/v2.0/generateClientSdkVersionTwoPointZero.ts
|
|
2712
|
-
async function generateRootIndexTsFile({
|
|
2713
|
-
fs: fs2,
|
|
2714
|
-
outDir,
|
|
2715
|
-
importExt,
|
|
2716
|
-
ontologyApiNamespace
|
|
2717
|
-
}) {
|
|
2718
|
-
fs2.writeFile(path16__namespace.default.join(outDir, "index.ts"), await formatTs(`${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
|
|
2719
|
-
export * from "./ontology/actions${importExt}";
|
|
2720
|
-
export * from "./ontology/objects${importExt}";
|
|
2721
|
-
export * from "./ontology/interfaces${importExt}";
|
|
2722
|
-
export * from "./ontology/queries${importExt}";
|
|
2723
|
-
`));
|
|
2724
|
-
}
|
|
2725
|
-
async function generateEachObjectFile(ctx) {
|
|
2726
|
-
const {
|
|
2727
|
-
fs: fs2,
|
|
2728
|
-
outDir,
|
|
2729
|
-
ontology,
|
|
2730
|
-
importExt
|
|
2731
|
-
} = ctx;
|
|
2732
|
-
await fs2.mkdir(path16__namespace.default.join(outDir, "ontology", "objects"), {
|
|
2733
|
-
recursive: true
|
|
2734
|
-
});
|
|
2735
|
-
for (const obj of Object.values(ontology.objectTypes)) {
|
|
2736
|
-
const relPath = path16__namespace.default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
|
|
2737
|
-
const outFilePath = path16__namespace.default.join(outDir, relPath);
|
|
2738
|
-
await fs2.writeFile(outFilePath, await formatTs(`
|
|
2739
|
-
import type { VersionBound as $VersionBound, PropertyDef as $PropertyDef } from "@osdk/api";
|
|
2740
|
-
import type { Osdk } from "@osdk/client.api";
|
|
2741
|
-
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
2742
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2743
|
-
${wireObjectTypeV2ToSdkObjectConstV2(obj.og, ctx, relPath)}
|
|
2744
|
-
`));
|
|
2745
|
-
}
|
|
2746
|
-
}
|
|
2747
|
-
async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, outDir, packageType = "commonjs", ontologyApiNamespace, apiNamespacePackageMap = /* @__PURE__ */ new Map()) {
|
|
2748
|
-
const importExt = packageType === "module" ? ".js" : "";
|
|
2749
|
-
await verifyOutDir(outDir, fs2);
|
|
2750
|
-
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
2751
|
-
await fs2.mkdir(outDir, {
|
|
2752
|
-
recursive: true
|
|
2753
|
-
});
|
|
2754
|
-
const enhancedOntology = enhanceOntology(sanitizedOntology, ontologyApiNamespace, apiNamespacePackageMap, importExt);
|
|
2755
|
-
const ctx = {
|
|
2756
|
-
sanitizedOntology,
|
|
2757
|
-
ontology: enhancedOntology,
|
|
2758
|
-
importExt,
|
|
2759
|
-
fs: fs2,
|
|
2760
|
-
outDir,
|
|
2761
|
-
ontologyApiNamespace,
|
|
2762
|
-
apiNamespacePackageMap
|
|
2763
|
-
};
|
|
2764
|
-
await generateRootIndexTsFile(ctx);
|
|
2765
|
-
await generateOntologyMetadataFile(ctx, userAgent);
|
|
2766
|
-
await generateEachObjectFile(ctx);
|
|
2767
|
-
await generateOntologyInterfaces(ctx);
|
|
2768
|
-
const actionsDir = path16__namespace.default.join(outDir, "ontology", "actions");
|
|
2769
|
-
await fs2.mkdir(actionsDir, {
|
|
2770
|
-
recursive: true
|
|
2771
|
-
});
|
|
2772
|
-
await generatePerActionDataFiles(ctx);
|
|
2773
|
-
await fs2.writeFile(path16__namespace.default.join(outDir, "ontology", "objects.ts"), await formatTs(`
|
|
2774
|
-
${Object.values(enhancedOntology.objectTypes).map((objType) => `export * from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
|
|
2775
|
-
${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
|
|
2776
|
-
`));
|
|
2777
|
-
await generatePerQueryDataFilesV2(ctx);
|
|
2778
|
-
}
|
|
2779
|
-
async function generateOntologyInterfaces({
|
|
2780
|
-
fs: fs2,
|
|
2781
|
-
outDir,
|
|
2782
|
-
ontology,
|
|
2783
|
-
importExt
|
|
2784
|
-
}) {
|
|
2785
|
-
const interfacesDir = path16__namespace.default.join(outDir, "ontology", "interfaces");
|
|
2786
|
-
await fs2.mkdir(interfacesDir, {
|
|
2787
|
-
recursive: true
|
|
2788
|
-
});
|
|
2789
|
-
for (const obj of Object.values(ontology.interfaceTypes)) {
|
|
2790
|
-
await fs2.writeFile(path16__namespace.default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
|
|
2791
|
-
|
|
2792
|
-
import type { PropertyDef as $PropertyDef, VersionBound as $VersionBound } from "@osdk/api";
|
|
2793
|
-
import { $osdkMetadata, $expectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2794
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
2795
|
-
${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
|
|
2796
|
-
`));
|
|
2797
|
-
}
|
|
2798
|
-
await fs2.writeFile(interfacesDir + ".ts", await formatTs(`
|
|
2799
|
-
${Object.values(ontology.interfaceTypes).map((interfaceType) => `export * from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
|
|
2800
|
-
${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
|
|
2801
|
-
`));
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
// src/generateClientSdkPackage.ts
|
|
2805
|
-
async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, ontologyApiNamespace, apiNamespacePackageMap) {
|
|
2806
|
-
if (!packageName) throw new Error("Package name is require");
|
|
2807
|
-
for (const packageType of ["module", "commonjs"]) {
|
|
2808
|
-
const outDir = path16__namespace.join(baseOutDir, "dist", packageType);
|
|
2809
|
-
await (sdkVersion === "1.1" ? generateClientSdkVersionOneDotOne : sdkVersion === "2.0" ? generateClientSdkVersionTwoPointZero : void 0)(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, ontologyApiNamespace, apiNamespacePackageMap);
|
|
2810
|
-
await fs__namespace.promises.mkdir(outDir, {
|
|
2811
|
-
recursive: true
|
|
2812
|
-
});
|
|
2813
|
-
await writeJson(minimalFs, path16__namespace.join(outDir, "package.json"), {
|
|
2814
|
-
type: packageType
|
|
2815
|
-
});
|
|
2816
|
-
await writeJson(minimalFs, path16__namespace.join(outDir, `tsconfig.json`), {
|
|
2817
|
-
compilerOptions: getTsCompilerOptions(packageType)
|
|
2818
|
-
});
|
|
2819
|
-
}
|
|
2820
|
-
await writeJson(minimalFs, path16__namespace.join(baseOutDir, "package.json"), await getPackageJsonContents(packageName, packageVersion, sdkVersion, dependencyVersions));
|
|
2821
|
-
await minimalFs.mkdir(path16__namespace.join(baseOutDir, "ontology"), {
|
|
2822
|
-
recursive: true
|
|
2823
|
-
});
|
|
2824
|
-
await minimalFs.writeFile(path16__namespace.join(baseOutDir, "ontology", "objects.js"), `module.exports = require("../../dist/module/ontology/objects")`);
|
|
2825
|
-
await minimalFs.writeFile(path16__namespace.join(baseOutDir, "ontology", "objects.d.ts"), `export * from "../dist/module/ontology/objects"`);
|
|
2826
|
-
}
|
|
2827
|
-
function getTsCompilerOptions(packageType) {
|
|
2828
|
-
const commonTsconfig = {
|
|
2829
|
-
importHelpers: true,
|
|
2830
|
-
declaration: true,
|
|
2831
|
-
isolatedModules: true,
|
|
2832
|
-
esModuleInterop: true,
|
|
2833
|
-
forceConsistentCasingInFileNames: true,
|
|
2834
|
-
strict: true,
|
|
2835
|
-
skipLibCheck: true
|
|
2836
|
-
};
|
|
2837
|
-
const compilerOptions = packageType === "commonjs" ? {
|
|
2838
|
-
...commonTsconfig,
|
|
2839
|
-
module: "commonjs",
|
|
2840
|
-
target: "es2018"
|
|
2841
|
-
} : {
|
|
2842
|
-
...commonTsconfig,
|
|
2843
|
-
module: "NodeNext",
|
|
2844
|
-
target: "ES2020"
|
|
2845
|
-
};
|
|
2846
|
-
return compilerOptions;
|
|
2847
|
-
}
|
|
2848
|
-
function getExpectedDependencies(sdkVersion, {
|
|
2849
|
-
osdkApiVersion,
|
|
2850
|
-
osdkClientVersion,
|
|
2851
|
-
osdkClientApiVersion,
|
|
2852
|
-
osdkLegacyClientVersion
|
|
2853
|
-
}) {
|
|
2854
|
-
return {
|
|
2855
|
-
devDependencies: {
|
|
2856
|
-
"@osdk/api": osdkApiVersion,
|
|
2857
|
-
...sdkVersion === "2.0" ? {
|
|
2858
|
-
"@osdk/client.api": osdkClientApiVersion
|
|
2859
|
-
} : {
|
|
2860
|
-
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
2861
|
-
}
|
|
2862
|
-
},
|
|
2863
|
-
peerDependencies: {
|
|
2864
|
-
"@osdk/api": osdkApiVersion,
|
|
2865
|
-
...sdkVersion === "2.0" ? {
|
|
2866
|
-
"@osdk/client.api": osdkClientApiVersion,
|
|
2867
|
-
"@osdk/client": osdkClientVersion
|
|
2868
|
-
} : {
|
|
2869
|
-
"@osdk/legacy-client": osdkLegacyClientVersion
|
|
2870
|
-
}
|
|
2871
|
-
}
|
|
2872
|
-
};
|
|
2873
|
-
}
|
|
2874
|
-
function getExpectedDependenciesFull(sdkVersion, dependencyVersions) {
|
|
2875
|
-
const {
|
|
2876
|
-
typescriptVersion,
|
|
2877
|
-
tslibVersion,
|
|
2878
|
-
areTheTypesWrongVersion
|
|
2879
|
-
} = dependencyVersions;
|
|
2880
|
-
const base = getExpectedDependencies(sdkVersion, dependencyVersions);
|
|
2881
|
-
return {
|
|
2882
|
-
devDependencies: {
|
|
2883
|
-
...base.devDependencies,
|
|
2884
|
-
"typescript": typescriptVersion,
|
|
2885
|
-
"tslib": tslibVersion,
|
|
2886
|
-
"@arethetypeswrong/cli": areTheTypesWrongVersion
|
|
2887
|
-
},
|
|
2888
|
-
peerDependencies: {
|
|
2889
|
-
...base.peerDependencies
|
|
2890
|
-
}
|
|
2891
|
-
};
|
|
2892
|
-
}
|
|
2893
|
-
function getPackageJsonContents(name, version, sdkVersion, dependencyVersions) {
|
|
2894
|
-
const esmPrefix = "./dist/module";
|
|
2895
|
-
const commonjsPrefix = "./dist/commonjs";
|
|
2896
|
-
return {
|
|
2897
|
-
name,
|
|
2898
|
-
version,
|
|
2899
|
-
main: `${commonjsPrefix}/index.js`,
|
|
2900
|
-
module: `${esmPrefix}/index.js`,
|
|
2901
|
-
exports: {
|
|
2902
|
-
".": {
|
|
2903
|
-
import: `${esmPrefix}/index.js`,
|
|
2904
|
-
require: `${commonjsPrefix}/index.js`
|
|
2905
|
-
},
|
|
2906
|
-
"./ontology/objects": {
|
|
2907
|
-
import: `${esmPrefix}/ontology/objects${sdkVersion === "2.0" ? "" : "/index"}.js`,
|
|
2908
|
-
require: `${commonjsPrefix}/ontology/objects${sdkVersion === "2.0" ? "" : "/index"}.js`
|
|
2909
|
-
}
|
|
2910
|
-
},
|
|
2911
|
-
scripts: {
|
|
2912
|
-
prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,
|
|
2913
|
-
check: "npm exec attw $(npm pack)"
|
|
2914
|
-
},
|
|
2915
|
-
...getExpectedDependenciesFull(sdkVersion, dependencyVersions),
|
|
2916
|
-
files: ["**/*.js", "**/*.d.ts", "dist/**/package.json"]
|
|
2917
|
-
};
|
|
2918
|
-
}
|
|
2919
|
-
async function writeJson(minimalFs, filePath, body) {
|
|
2920
|
-
return await minimalFs.writeFile(filePath, JSON.stringify(body, void 0, 2) + "\n");
|
|
2921
|
-
}
|
|
2922
|
-
|
|
2923
|
-
exports.__UNSTABLE_generateClientSdkPackage = generateClientSdkPackage;
|
|
2924
|
-
exports.generateClientSdkVersionOneDotOne = generateClientSdkVersionOneDotOne;
|
|
2925
|
-
exports.generateClientSdkVersionTwoPointZero = generateClientSdkVersionTwoPointZero;
|
|
2926
|
-
exports.getExpectedDependencies = getExpectedDependencies;
|
|
2927
|
-
//# sourceMappingURL=index.cjs.map
|
|
2928
|
-
//# sourceMappingURL=index.cjs.map
|