@osdk/generator 2.0.0-beta.12 → 2.0.0-beta.14
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 +40 -0
- package/build/browser/GenerateContext/EnhanceCommon.d.ts +9 -0
- package/build/browser/GenerateContext/EnhanceCommon.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhanceCommon.js +17 -0
- package/build/browser/GenerateContext/EnhanceCommon.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedAction.d.ts +14 -0
- package/build/browser/GenerateContext/EnhancedAction.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedAction.js +42 -0
- package/build/browser/GenerateContext/EnhancedAction.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedBase.d.ts +23 -0
- package/build/browser/GenerateContext/EnhancedBase.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedBase.js +72 -0
- package/build/browser/GenerateContext/EnhancedBase.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts +13 -0
- package/build/browser/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedInterfaceType.js +38 -0
- package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedObjectType.d.ts +12 -0
- package/build/browser/GenerateContext/EnhancedObjectType.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedObjectType.js +35 -0
- package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts +27 -0
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.js +77 -0
- package/build/browser/GenerateContext/EnhancedOntologyDefinition.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedQuery.d.ts +14 -0
- package/build/browser/GenerateContext/EnhancedQuery.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedQuery.js +42 -0
- package/build/browser/GenerateContext/EnhancedQuery.js.map +1 -0
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts +8 -0
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.d.ts.map +1 -0
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.js +24 -0
- package/build/browser/GenerateContext/EnhancedSharedPropertyType.js.map +1 -0
- package/build/browser/GenerateContext/ForeignType.d.ts +10 -0
- package/build/browser/GenerateContext/ForeignType.d.ts.map +1 -0
- package/build/browser/GenerateContext/ForeignType.js +36 -0
- package/build/browser/GenerateContext/ForeignType.js.map +1 -0
- package/build/browser/GenerateContext/GenerateContext.d.ts +13 -0
- package/build/browser/GenerateContext/GenerateContext.d.ts.map +1 -0
- package/build/browser/GenerateContext/GenerateContext.js +17 -0
- package/build/browser/GenerateContext/GenerateContext.js.map +1 -0
- package/build/browser/GenerateContext/enhanceOntology.d.ts +4 -0
- package/build/browser/GenerateContext/enhanceOntology.d.ts.map +1 -0
- package/build/browser/GenerateContext/enhanceOntology.js +20 -0
- package/build/browser/GenerateContext/enhanceOntology.js.map +1 -0
- package/build/browser/MinimalFs.d.ts +10 -0
- package/build/browser/MinimalFs.d.ts.map +1 -0
- package/build/browser/MinimalFs.js +17 -0
- package/build/browser/MinimalFs.js.map +1 -0
- package/build/browser/WireOntologyDefinition.d.ts +4 -0
- package/build/browser/WireOntologyDefinition.d.ts.map +1 -0
- package/build/browser/WireOntologyDefinition.js +17 -0
- package/build/browser/WireOntologyDefinition.js.map +1 -0
- package/build/browser/generateClientSdkPackage.d.ts +47 -0
- package/build/browser/generateClientSdkPackage.d.ts.map +1 -0
- package/build/browser/generateClientSdkPackage.js +126 -0
- package/build/browser/generateClientSdkPackage.js.map +1 -0
- package/build/browser/generateClientSdkPackage.test.d.ts +2 -0
- package/build/browser/generateClientSdkPackage.test.d.ts.map +1 -0
- package/build/browser/generateClientSdkPackage.test.js +67 -0
- package/build/browser/generateClientSdkPackage.test.js.map +1 -0
- package/build/browser/index.d.ts +5 -0
- package/build/browser/index.d.ts.map +1 -0
- package/build/browser/index.js +17 -1311
- package/build/browser/index.js.map +1 -1
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts +2 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.d.ts.map +1 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js +23 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts +2 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.d.ts.map +1 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js +46 -0
- package/build/browser/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -0
- package/build/browser/shared/getObjectImports.d.ts +4 -0
- package/build/browser/shared/getObjectImports.d.ts.map +1 -0
- package/build/browser/shared/getObjectImports.js +24 -0
- package/build/browser/shared/getObjectImports.js.map +1 -0
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts +4 -0
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.d.ts.map +1 -0
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.js +27 -0
- package/build/browser/shared/getObjectTypeApiNamesFromQuery.js.map +1 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts +3 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.d.ts.map +1 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.js +57 -0
- package/build/browser/shared/getObjectTypesFromQueryDataType.js.map +1 -0
- package/build/browser/shared/propertyJsdoc.d.ts +6 -0
- package/build/browser/shared/propertyJsdoc.d.ts.map +1 -0
- package/build/browser/shared/propertyJsdoc.js +38 -0
- package/build/browser/shared/propertyJsdoc.js.map +1 -0
- package/build/browser/shared/sanitizeMetadata.d.ts +2 -0
- package/build/browser/shared/sanitizeMetadata.d.ts.map +1 -0
- package/build/browser/shared/sanitizeMetadata.js +33 -0
- package/build/browser/shared/sanitizeMetadata.js.map +1 -0
- package/build/browser/shared/sanitizeMetadata.test.d.ts +2 -0
- package/build/browser/shared/sanitizeMetadata.test.d.ts.map +1 -0
- package/build/browser/shared/sanitizeMetadata.test.js +44 -0
- package/build/browser/shared/sanitizeMetadata.test.js.map +1 -0
- package/build/browser/util/InMemoryFs.d.ts +7 -0
- package/build/browser/util/InMemoryFs.d.ts.map +1 -0
- package/build/browser/util/InMemoryFs.js +30 -0
- package/build/browser/util/InMemoryFs.js.map +1 -0
- package/build/browser/util/commaSeparatedIdentifiers.d.ts +2 -0
- package/build/browser/util/commaSeparatedIdentifiers.d.ts.map +1 -0
- package/build/browser/util/commaSeparatedIdentifiers.js +25 -0
- package/build/browser/util/commaSeparatedIdentifiers.js.map +1 -0
- package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts +2 -0
- package/build/browser/util/commaSeparatedTypeIdentifiers.d.ts.map +1 -0
- package/build/browser/util/commaSeparatedTypeIdentifiers.js +19 -0
- package/build/browser/util/commaSeparatedTypeIdentifiers.js.map +1 -0
- package/build/browser/util/deleteUndefineds.d.ts +2 -0
- package/build/browser/util/deleteUndefineds.d.ts.map +1 -0
- package/build/browser/util/deleteUndefineds.js +19 -0
- package/build/browser/util/deleteUndefineds.js.map +1 -0
- package/build/browser/util/reservedKeywords.d.ts +2 -0
- package/build/browser/util/reservedKeywords.d.ts.map +1 -0
- package/build/browser/util/reservedKeywords.js +21 -0
- package/build/browser/util/reservedKeywords.js.map +1 -0
- package/build/browser/util/stringUnionFrom.d.ts +2 -0
- package/build/browser/util/stringUnionFrom.d.ts.map +1 -0
- package/build/browser/util/stringUnionFrom.js +23 -0
- package/build/browser/util/stringUnionFrom.js.map +1 -0
- package/build/browser/util/stringify.d.ts +20 -0
- package/build/browser/util/stringify.d.ts.map +1 -0
- package/build/browser/util/stringify.js +36 -0
- package/build/browser/util/stringify.js.map +1 -0
- package/build/browser/util/test/TodoWireOntology.d.ts +217 -0
- package/build/browser/util/test/TodoWireOntology.d.ts.map +1 -0
- package/build/browser/util/test/TodoWireOntology.js +232 -0
- package/build/browser/util/test/TodoWireOntology.js.map +1 -0
- package/build/browser/util/test/compileThis.d.ts +3 -0
- package/build/browser/util/test/compileThis.d.ts.map +1 -0
- package/build/browser/util/test/compileThis.js +41 -0
- package/build/browser/util/test/compileThis.js.map +1 -0
- package/build/browser/util/test/createMockMinimalFiles.d.ts +13 -0
- package/build/browser/util/test/createMockMinimalFiles.d.ts.map +1 -0
- package/build/browser/util/test/createMockMinimalFiles.js +37 -0
- package/build/browser/util/test/createMockMinimalFiles.js.map +1 -0
- package/build/browser/util/test/formatTs.d.ts +2 -0
- package/build/browser/util/test/formatTs.d.ts.map +1 -0
- package/build/browser/util/test/formatTs.js +32 -0
- package/build/browser/util/test/formatTs.js.map +1 -0
- package/build/browser/util/verifyOutDir.d.ts +9 -0
- package/build/browser/util/verifyOutDir.d.ts.map +1 -0
- package/build/browser/util/verifyOutDir.js +35 -0
- package/build/browser/util/verifyOutDir.js.map +1 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts +2 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.d.ts.map +1 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +114 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts +2 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.d.ts.map +1 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +273 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +4 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +119 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts +2 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.d.ts.map +1 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +1949 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -0
- package/build/browser/v2.0/generateMetadata.d.ts +3 -0
- package/build/browser/v2.0/generateMetadata.d.ts.map +1 -0
- package/build/browser/v2.0/generateMetadata.js +35 -0
- package/build/browser/v2.0/generateMetadata.js.map +1 -0
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts +3 -0
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +1 -0
- package/build/browser/v2.0/generatePerActionDataFiles.js +240 -0
- package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -0
- package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts +2 -0
- package/build/browser/v2.0/generatePerActionDataFiles.test.d.ts.map +1 -0
- package/build/browser/v2.0/generatePerActionDataFiles.test.js +51 -0
- package/build/browser/v2.0/generatePerActionDataFiles.test.js.map +1 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts +9 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.js +194 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts +2 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.test.d.ts.map +1 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +199 -0
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -0
- package/build/browser/v2.0/getDescriptionIfPresent.d.ts +2 -0
- package/build/browser/v2.0/getDescriptionIfPresent.d.ts.map +1 -0
- package/build/browser/v2.0/getDescriptionIfPresent.js +24 -0
- package/build/browser/v2.0/getDescriptionIfPresent.js.map +1 -0
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts +13 -0
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -0
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +205 -0
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -0
- package/build/browser/validateWireOntologyAssumptions.d.ts +3 -0
- package/build/browser/validateWireOntologyAssumptions.d.ts.map +1 -0
- package/build/browser/validateWireOntologyAssumptions.js +33 -0
- package/build/browser/validateWireOntologyAssumptions.js.map +1 -0
- package/build/esm/GenerateContext/EnhanceCommon.js +17 -0
- package/build/esm/GenerateContext/EnhanceCommon.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedAction.js +42 -0
- package/build/esm/GenerateContext/EnhancedAction.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedBase.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedBase.js +72 -0
- package/build/esm/GenerateContext/EnhancedBase.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts +2 -2
- package/build/esm/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.js +38 -0
- package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts +2 -2
- package/build/esm/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
- package/build/esm/GenerateContext/EnhancedObjectType.js +35 -0
- package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.js +77 -0
- package/build/esm/GenerateContext/EnhancedOntologyDefinition.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedQuery.js +42 -0
- package/build/esm/GenerateContext/EnhancedQuery.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.js +24 -0
- package/build/esm/GenerateContext/EnhancedSharedPropertyType.js.map +1 -0
- package/build/esm/GenerateContext/ForeignType.js +36 -0
- package/build/esm/GenerateContext/ForeignType.js.map +1 -0
- package/build/esm/GenerateContext/GenerateContext.js +17 -0
- package/build/esm/GenerateContext/GenerateContext.js.map +1 -0
- package/build/esm/GenerateContext/enhanceOntology.js +20 -0
- package/build/esm/GenerateContext/enhanceOntology.js.map +1 -0
- package/build/esm/MinimalFs.js +17 -0
- package/build/esm/MinimalFs.js.map +1 -0
- package/build/esm/WireOntologyDefinition.js +17 -0
- package/build/esm/WireOntologyDefinition.js.map +1 -0
- package/build/esm/generateClientSdkPackage.d.ts +1 -6
- package/build/esm/generateClientSdkPackage.d.ts.map +1 -1
- package/build/esm/generateClientSdkPackage.js +126 -0
- package/build/esm/generateClientSdkPackage.js.map +1 -0
- package/build/esm/generateClientSdkPackage.test.js +67 -0
- package/build/esm/generateClientSdkPackage.test.js.map +1 -0
- package/build/esm/index.js +17 -1311
- package/build/esm/index.js.map +1 -1
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js +23 -0
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.js.map +1 -0
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js +46 -0
- package/build/esm/shared/apiNamespaces/startsWithApiNamespace.test.js.map +1 -0
- package/build/esm/shared/getObjectImports.js +24 -0
- package/build/esm/shared/getObjectImports.js.map +1 -0
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.js +27 -0
- package/build/esm/shared/getObjectTypeApiNamesFromQuery.js.map +1 -0
- package/build/esm/shared/getObjectTypesFromQueryDataType.js +57 -0
- package/build/esm/shared/getObjectTypesFromQueryDataType.js.map +1 -0
- package/build/esm/shared/propertyJsdoc.js +38 -0
- package/build/esm/shared/propertyJsdoc.js.map +1 -0
- package/build/esm/shared/sanitizeMetadata.js +33 -0
- package/build/esm/shared/sanitizeMetadata.js.map +1 -0
- package/build/esm/shared/sanitizeMetadata.test.js +44 -0
- package/build/esm/shared/sanitizeMetadata.test.js.map +1 -0
- package/build/esm/util/InMemoryFs.js +30 -0
- package/build/esm/util/InMemoryFs.js.map +1 -0
- package/build/esm/util/commaSeparatedIdentifiers.js +25 -0
- package/build/esm/util/commaSeparatedIdentifiers.js.map +1 -0
- package/build/esm/util/commaSeparatedTypeIdentifiers.js +19 -0
- package/build/esm/util/commaSeparatedTypeIdentifiers.js.map +1 -0
- package/build/esm/util/deleteUndefineds.js +19 -0
- package/build/esm/util/deleteUndefineds.js.map +1 -0
- package/build/esm/util/reservedKeywords.js +21 -0
- package/build/esm/util/reservedKeywords.js.map +1 -0
- package/build/esm/util/stringUnionFrom.js +23 -0
- package/build/esm/util/stringUnionFrom.js.map +1 -0
- package/build/esm/util/stringify.js +36 -0
- package/build/esm/util/stringify.js.map +1 -0
- package/build/esm/util/test/TodoWireOntology.js +232 -0
- package/build/esm/util/test/TodoWireOntology.js.map +1 -0
- package/build/esm/util/test/compileThis.js +41 -0
- package/build/esm/util/test/compileThis.js.map +1 -0
- package/build/esm/util/test/createMockMinimalFiles.js +37 -0
- package/build/esm/util/test/createMockMinimalFiles.js.map +1 -0
- package/build/esm/util/test/formatTs.js +32 -0
- package/build/esm/util/test/formatTs.js.map +1 -0
- package/build/esm/util/verifyOutDir.js +35 -0
- package/build/esm/util/verifyOutDir.js.map +1 -0
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +114 -0
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -0
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +273 -0
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +119 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +1949 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -0
- package/build/esm/v2.0/generateMetadata.js +35 -0
- package/build/esm/v2.0/generateMetadata.js.map +1 -0
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.js +240 -0
- package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -0
- package/build/esm/v2.0/generatePerActionDataFiles.test.js +51 -0
- package/build/esm/v2.0/generatePerActionDataFiles.test.js.map +1 -0
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +194 -0
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -0
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +199 -0
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -0
- package/build/esm/v2.0/getDescriptionIfPresent.js +24 -0
- package/build/esm/v2.0/getDescriptionIfPresent.js.map +1 -0
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +205 -0
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -0
- package/build/esm/validateWireOntologyAssumptions.js +33 -0
- package/build/esm/validateWireOntologyAssumptions.js.map +1 -0
- package/package.json +6 -8
package/build/esm/index.js
CHANGED
|
@@ -1,1312 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
[this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);
|
|
19
|
-
const {
|
|
20
|
-
ontologyApiNamespace,
|
|
21
|
-
apiNamespacePackageMap,
|
|
22
|
-
importExt
|
|
23
|
-
} = common;
|
|
24
|
-
this.isLocal = ontologyApiNamespace === this.apiNamespace;
|
|
25
|
-
this.sourcePackage = this.apiNamespace && !this.isLocal ? apiNamespacePackageMap.get(this.apiNamespace) : void 0;
|
|
26
|
-
this.importPath = this.isLocal ? `${basePath}/${this.shortApiName}${importExt}` : this.sourcePackage;
|
|
27
|
-
this.uniqueImportName = this.shortApiName;
|
|
28
|
-
}
|
|
29
|
-
getImportPathRelTo = (filePath) => {
|
|
30
|
-
if (this.importPath.startsWith(".")) {
|
|
31
|
-
const result = path5.relative(path5.dirname(filePath), this.importPath);
|
|
32
|
-
if (result.startsWith(".")) {
|
|
33
|
-
return result;
|
|
34
|
-
} else {
|
|
35
|
-
return `./${result}`;
|
|
36
|
-
}
|
|
37
|
-
} else {
|
|
38
|
-
return this.importPath;
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
var EnhancedBase = class extends AbstractImportable {
|
|
43
|
-
constructor(common, raw, fullApiName, basePath) {
|
|
44
|
-
super(common, fullApiName, basePath);
|
|
45
|
-
this.raw = raw;
|
|
46
|
-
if (!this.isLocal && !this.sourcePackage) {
|
|
47
|
-
throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
function extractNamespace(fqApiName) {
|
|
52
|
-
const last = fqApiName.lastIndexOf(".");
|
|
53
|
-
if (last === -1) return [void 0, fqApiName];
|
|
54
|
-
return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
// src/GenerateContext/EnhancedAction.ts
|
|
58
|
-
var EnhancedAction = class extends EnhancedBase {
|
|
59
|
-
constructor(common, raw) {
|
|
60
|
-
super(common, raw, raw.apiName, "./ontology/actions");
|
|
61
|
-
this.raw = raw;
|
|
62
|
-
}
|
|
63
|
-
get description() {
|
|
64
|
-
return this.raw.description;
|
|
65
|
-
}
|
|
66
|
-
get parameters() {
|
|
67
|
-
return this.raw.parameters;
|
|
68
|
-
}
|
|
69
|
-
get operations() {
|
|
70
|
-
return this.raw.operations;
|
|
71
|
-
}
|
|
72
|
-
get paramsIdentifier() {
|
|
73
|
-
return `${this.shortApiName}.Params`;
|
|
74
|
-
}
|
|
75
|
-
get definitionIdentifier() {
|
|
76
|
-
return `${this.shortApiName}.Definition`;
|
|
77
|
-
}
|
|
78
|
-
get definitionParamsIdentifier() {
|
|
79
|
-
return `${this.shortApiName}.ParamsDefinition`;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/util/deleteUndefineds.ts
|
|
84
|
-
function deleteUndefineds(obj) {
|
|
85
|
-
return Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== void 0));
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
// src/GenerateContext/EnhancedInterfaceType.ts
|
|
89
|
-
var EnhancedInterfaceType = class extends EnhancedBase {
|
|
90
|
-
constructor(common, raw) {
|
|
91
|
-
super(common, raw, raw.apiName, "./ontology/interfaces");
|
|
92
|
-
this.raw = raw;
|
|
93
|
-
}
|
|
94
|
-
getDefinitionIdentifier(v2) {
|
|
95
|
-
return v2 ? this.shortApiName : `${this.shortApiName}Def`;
|
|
96
|
-
}
|
|
97
|
-
getImportedDefinitionIdentifier(v2) {
|
|
98
|
-
return this.getDefinitionIdentifier(v2);
|
|
99
|
-
}
|
|
100
|
-
get properties() {
|
|
101
|
-
return this.raw.properties;
|
|
102
|
-
}
|
|
103
|
-
getCleanedUpDefinition(v2) {
|
|
104
|
-
return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
var EnhancedObjectType = class extends EnhancedBase {
|
|
108
|
-
constructor(common, raw) {
|
|
109
|
-
super(common, raw, raw.objectType.apiName, "./ontology/objects");
|
|
110
|
-
this.raw = raw;
|
|
111
|
-
}
|
|
112
|
-
getDefinitionIdentifier(v2) {
|
|
113
|
-
return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
|
|
114
|
-
}
|
|
115
|
-
getImportedDefinitionIdentifier(v2) {
|
|
116
|
-
return this.getDefinitionIdentifier(v2);
|
|
117
|
-
}
|
|
118
|
-
getCleanedUpDefinition(v2) {
|
|
119
|
-
return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(this.raw, v2));
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// src/GenerateContext/EnhancedQuery.ts
|
|
124
|
-
var EnhancedQuery = class extends EnhancedBase {
|
|
125
|
-
constructor(common, raw) {
|
|
126
|
-
super(common, raw, raw.apiName, "./ontology/queries");
|
|
127
|
-
this.raw = raw;
|
|
128
|
-
}
|
|
129
|
-
get description() {
|
|
130
|
-
return this.raw.description;
|
|
131
|
-
}
|
|
132
|
-
get parameters() {
|
|
133
|
-
return this.raw.parameters;
|
|
134
|
-
}
|
|
135
|
-
get output() {
|
|
136
|
-
return this.raw.output;
|
|
137
|
-
}
|
|
138
|
-
get paramsIdentifier() {
|
|
139
|
-
return `${this.shortApiName}.Parameters`;
|
|
140
|
-
}
|
|
141
|
-
get definitionIdentifier() {
|
|
142
|
-
return `${this.shortApiName}.Definition`;
|
|
143
|
-
}
|
|
144
|
-
get definitionParamsIdentifier() {
|
|
145
|
-
return `${this.definitionIdentifier}$Params`;
|
|
146
|
-
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
// src/GenerateContext/EnhancedSharedPropertyType.ts
|
|
150
|
-
var EnhancedSharedPropertyType = class extends EnhancedBase {
|
|
151
|
-
constructor(common, raw) {
|
|
152
|
-
super(common, raw, raw.apiName, "./ontology/interfaces");
|
|
153
|
-
this.raw = raw;
|
|
154
|
-
}
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
// src/GenerateContext/ForeignType.ts
|
|
158
|
-
var ForeignType = class extends AbstractImportable {
|
|
159
|
-
constructor(_common, type, apiNamespace, shortApiName) {
|
|
160
|
-
super(_common, `${apiNamespace}.${shortApiName}`, _common.apiNamespacePackageMap.get(apiNamespace));
|
|
161
|
-
this._common = _common;
|
|
162
|
-
this.type = type;
|
|
163
|
-
}
|
|
164
|
-
getImportedDefinitionIdentifier(v2) {
|
|
165
|
-
return `$Imported$${this.type}$${this.apiNamespace.replace(/\./g, "$")}$${this.shortApiName}`;
|
|
166
|
-
}
|
|
167
|
-
getDefinitionIdentifier(v2) {
|
|
168
|
-
if (this.type === "objectTypes") {
|
|
169
|
-
return v2 ? this.uniqueImportName : `${this.uniqueImportName}Def`;
|
|
170
|
-
} else {
|
|
171
|
-
return this.uniqueImportName;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
// src/GenerateContext/EnhancedOntologyDefinition.ts
|
|
177
|
-
var EnhancedOntologyDefinition = class {
|
|
178
|
-
#foreignTypes = {};
|
|
179
|
-
constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
|
|
180
|
-
this.common = {
|
|
181
|
-
apiNamespacePackageMap,
|
|
182
|
-
enhancedOntology: this,
|
|
183
|
-
importExt,
|
|
184
|
-
ontologyApiNamespace
|
|
185
|
-
};
|
|
186
|
-
this.raw = raw;
|
|
187
|
-
this.ontology = raw.ontology;
|
|
188
|
-
this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
|
|
189
|
-
this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
|
|
190
|
-
this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
|
|
191
|
-
this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
|
|
192
|
-
this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
|
|
193
|
-
}
|
|
194
|
-
#createRequireType = (type) => {
|
|
195
|
-
return (fullApiName, localOnly) => {
|
|
196
|
-
const ret = this[type][fullApiName];
|
|
197
|
-
if (!ret) {
|
|
198
|
-
const [apiNamespace, shortApiName] = extractNamespace(fullApiName);
|
|
199
|
-
if (localOnly || !apiNamespace) {
|
|
200
|
-
throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);
|
|
201
|
-
}
|
|
202
|
-
if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
|
|
203
|
-
throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
|
|
204
|
-
}
|
|
205
|
-
const ret2 = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);
|
|
206
|
-
this.#foreignTypes[fullApiName] = ret2;
|
|
207
|
-
return ret2;
|
|
208
|
-
}
|
|
209
|
-
return ret;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
requireObjectType = this.#createRequireType("objectTypes");
|
|
213
|
-
requireInterfaceType = this.#createRequireType("interfaceTypes");
|
|
214
|
-
requireActionType = this.#createRequireType("actionTypes");
|
|
215
|
-
requireQueryType = this.#createRequireType("queryTypes");
|
|
216
|
-
requireSharedPropertyType = this.#createRequireType("sharedPropertyTypes");
|
|
217
|
-
};
|
|
218
|
-
function remap(r, common, Constructor) {
|
|
219
|
-
return Object.fromEntries(Object.entries(r ?? {}).map(([fullApiName, v]) => {
|
|
220
|
-
return [fullApiName, new Constructor(common, v)];
|
|
221
|
-
}).sort((a, b) => a[0].localeCompare(b[0])));
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// src/GenerateContext/enhanceOntology.ts
|
|
225
|
-
function enhanceOntology(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
|
|
226
|
-
return new EnhancedOntologyDefinition(sanitized, ontologyApiNamespace, apiNamespacePackageMap, importExt);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
// src/shared/sanitizeMetadata.ts
|
|
230
|
-
function sanitizeMetadata(ontology) {
|
|
231
|
-
return {
|
|
232
|
-
...ontology,
|
|
233
|
-
actionTypes: Object.fromEntries(Object.values(ontology.actionTypes).map((actionType) => {
|
|
234
|
-
return [camelize(actionType.apiName), {
|
|
235
|
-
...actionType,
|
|
236
|
-
apiName: camelize(actionType.apiName)
|
|
237
|
-
}];
|
|
238
|
-
}))
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
function camelize(name) {
|
|
242
|
-
return name.replace(/-./g, (segment) => segment[1].toUpperCase());
|
|
243
|
-
}
|
|
244
|
-
function formatTs(contents) {
|
|
245
|
-
try {
|
|
246
|
-
return format(contents, {
|
|
247
|
-
parser: "typescript",
|
|
248
|
-
singleQuote: true,
|
|
249
|
-
trailingComma: "all",
|
|
250
|
-
tabWidth: 2,
|
|
251
|
-
printWidth: 120
|
|
252
|
-
});
|
|
253
|
-
} catch (e) {
|
|
254
|
-
console.error("Failed to format file", e);
|
|
255
|
-
console.log(contents);
|
|
256
|
-
return contents;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// src/util/verifyOutDir.ts
|
|
261
|
-
async function verifyOutDir(outDir, fs2) {
|
|
262
|
-
try {
|
|
263
|
-
const contents = await fs2.readdir(outDir);
|
|
264
|
-
if (contents.length !== 0) {
|
|
265
|
-
throw new Error(`outDir ${outDir} is not empty, please delete its contents and try again`);
|
|
266
|
-
}
|
|
267
|
-
} catch (e) {
|
|
268
|
-
if (e.code === "ENOENT") ; else {
|
|
269
|
-
throw e;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
var ExpectedOsdkVersion = "2.0.0";
|
|
274
|
-
async function generateOntologyMetadataFile({
|
|
275
|
-
fs: fs2,
|
|
276
|
-
outDir,
|
|
277
|
-
ontology,
|
|
278
|
-
ontologyApiNamespace
|
|
279
|
-
}, userAgent) {
|
|
280
|
-
fs2.writeFile(path5__default.join(outDir, "OntologyMetadata.ts"), await formatTs(`
|
|
281
|
-
export type $ExpectedClientVersion = "${ExpectedOsdkVersion}";
|
|
282
|
-
export const $osdkMetadata = { extraUserAgent: "${userAgent}" };
|
|
283
|
-
${ontologyApiNamespace == null ? `
|
|
284
|
-
export const $ontologyRid = "${ontology.ontology.rid}";
|
|
285
|
-
` : ""}
|
|
286
|
-
`));
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
// src/shared/getObjectImports.ts
|
|
290
|
-
function getObjectImports(objects, curApiName, currentFilePath, v2) {
|
|
291
|
-
return Array.from(objects).filter((obj) => obj.fullApiName !== curApiName).map((obj) => {
|
|
292
|
-
const defId = obj.getDefinitionIdentifier(v2);
|
|
293
|
-
const importedId = obj.getImportedDefinitionIdentifier(v2);
|
|
294
|
-
const nameOrAlias = defId === importedId ? defId : `${defId} as ${importedId}`;
|
|
295
|
-
return `import type { ${nameOrAlias} } from "${obj.getImportPathRelTo("./" + currentFilePath)}";`;
|
|
296
|
-
}).join("\n");
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// src/util/stringify.ts
|
|
300
|
-
var defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatter) => {
|
|
301
|
-
return [defaultKeyFormatter(key), defaultValueFormatter(value)];
|
|
302
|
-
};
|
|
303
|
-
function stringify(obj, customizer = {}, separator = ",\n") {
|
|
304
|
-
const defaultKeyFormatter = (key) => `${JSON.stringify(key)}`;
|
|
305
|
-
const entries = [];
|
|
306
|
-
const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
|
|
307
|
-
for (const key of sortedKeys) {
|
|
308
|
-
const value = obj[key];
|
|
309
|
-
const res = (customizer[key] ?? customizer["*"] ?? defaultCustomizer)(value, (value2) => JSON.stringify(value2, null, 2), key, defaultKeyFormatter);
|
|
310
|
-
if (res) {
|
|
311
|
-
if (typeof res === "string") {
|
|
312
|
-
entries.push(`${defaultKeyFormatter(key)}: ${res}`);
|
|
313
|
-
} else {
|
|
314
|
-
entries.push(`${res[0]}: ${res[1]}`);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
return entries.join(separator);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// src/util/stringUnionFrom.ts
|
|
322
|
-
function stringUnionFrom(values) {
|
|
323
|
-
if (values.length === 0) {
|
|
324
|
-
return "never";
|
|
325
|
-
} else {
|
|
326
|
-
return values.map((v) => `"${v}"`).join("|");
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// src/v2.0/getDescriptionIfPresent.ts
|
|
331
|
-
function getDescriptionIfPresent(description, includeNewline) {
|
|
332
|
-
if (description) {
|
|
333
|
-
return `/**
|
|
334
|
-
* ${description}
|
|
335
|
-
*/${""}`;
|
|
336
|
-
}
|
|
337
|
-
return "";
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
// src/shared/propertyJsdoc.ts
|
|
341
|
-
function propertyJsdoc(property, {
|
|
342
|
-
isInherited,
|
|
343
|
-
apiName
|
|
344
|
-
}) {
|
|
345
|
-
let ret = `/**
|
|
346
|
-
`;
|
|
347
|
-
const renderDisplayName = property.displayName && property.displayName !== apiName;
|
|
348
|
-
if (isInherited || renderDisplayName || property.description) {
|
|
349
|
-
if (isInherited) {
|
|
350
|
-
ret += ` * (inherited from parent)
|
|
351
|
-
`;
|
|
352
|
-
}
|
|
353
|
-
if (renderDisplayName) {
|
|
354
|
-
ret += ` * display name: '${property.displayName}'${property.description ? "," : ""}
|
|
355
|
-
`;
|
|
356
|
-
}
|
|
357
|
-
if (property.description) {
|
|
358
|
-
ret += ` * description: ${property.description}
|
|
359
|
-
`;
|
|
360
|
-
}
|
|
361
|
-
} else {
|
|
362
|
-
ret += ` * (no ontology metadata)
|
|
363
|
-
`;
|
|
364
|
-
}
|
|
365
|
-
ret += ` */
|
|
366
|
-
`;
|
|
367
|
-
return ret;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
// src/v2.0/wireObjectTypeV2ToSdkObjectConstV2.ts
|
|
371
|
-
function getObjectDefIdentifier(name, v2) {
|
|
372
|
-
return v2 ? name : `${name}Def`;
|
|
373
|
-
}
|
|
374
|
-
function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
375
|
-
ontology
|
|
376
|
-
}, currentFilePath) {
|
|
377
|
-
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
378
|
-
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map((a) => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
379
|
-
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectTypeDefinition(object.raw, true));
|
|
380
|
-
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
381
|
-
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
382
|
-
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
383
|
-
const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;
|
|
384
|
-
const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;
|
|
385
|
-
const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
|
|
386
|
-
const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
|
|
387
|
-
const identifiers = {
|
|
388
|
-
objectDefIdentifier: `${object.shortApiName}`,
|
|
389
|
-
osdkObjectLinksIdentifier,
|
|
390
|
-
osdkObjectPropsIdentifier,
|
|
391
|
-
osdkObjectStrictPropsIdentifier,
|
|
392
|
-
objectSetIdentifier,
|
|
393
|
-
osdkObjectIdentifier,
|
|
394
|
-
propertyKeysIdentifier
|
|
395
|
-
};
|
|
396
|
-
function getV2Types() {
|
|
397
|
-
return `import type {
|
|
398
|
-
ObjectOrInterfacePropertyKeysFrom2 as $ObjectOrInterfacePropertyKeysFrom2,
|
|
399
|
-
MinObjectDef as $ObjectTypeDefinition,
|
|
400
|
-
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
401
|
-
} from "@osdk/api";
|
|
402
|
-
import type {
|
|
403
|
-
ObjectSet as $ObjectSet,
|
|
404
|
-
Osdk as $Osdk,
|
|
405
|
-
OsdkObject as $OsdkObject,
|
|
406
|
-
PropertyValueWireToClient as $PropType,
|
|
407
|
-
SingleLinkAccessor as $SingleLinkAccessor,
|
|
408
|
-
} from "@osdk/client.api";
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
export namespace ${object.shortApiName} {
|
|
412
|
-
|
|
413
|
-
${createPropertyKeys(object)}
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
${createLinks(ontology, object, "Links")}
|
|
417
|
-
|
|
418
|
-
${createProps(object, "Props", false)}
|
|
419
|
-
${createProps(object, "StrictProps", true)}
|
|
420
|
-
|
|
421
|
-
${createObjectSet(object, identifiers)}
|
|
422
|
-
|
|
423
|
-
${createOsdkObject(object, "OsdkObject", identifiers)}
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
${createDefinition(object, ontology, object.shortApiName, identifiers)}
|
|
429
|
-
`;
|
|
430
|
-
}
|
|
431
|
-
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
432
|
-
return `${imports}${getV2Types()}
|
|
433
|
-
|
|
434
|
-
export const ${object.shortApiName}: ${objectDefIdentifier}
|
|
435
|
-
= {
|
|
436
|
-
type: "${object instanceof EnhancedObjectType ? "object" : "interface"}",
|
|
437
|
-
apiName: "${object.fullApiName}",
|
|
438
|
-
osdkMetadata: $osdkMetadata,
|
|
439
|
-
};`;
|
|
440
|
-
}
|
|
441
|
-
function createOsdkObject(object, identifier, {
|
|
442
|
-
osdkObjectPropsIdentifier,
|
|
443
|
-
objectDefIdentifier,
|
|
444
|
-
osdkObjectStrictPropsIdentifier,
|
|
445
|
-
osdkObjectLinksIdentifier
|
|
446
|
-
}) {
|
|
447
|
-
object.getCleanedUpDefinition(true);
|
|
448
|
-
return `
|
|
449
|
-
export type ${identifier}<
|
|
450
|
-
OPTIONS extends never | "$notStrict" | "$rid" = never,
|
|
451
|
-
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
452
|
-
|
|
453
|
-
>
|
|
454
|
-
= $Osdk<
|
|
455
|
-
${objectDefIdentifier},
|
|
456
|
-
K | OPTIONS
|
|
457
|
-
>
|
|
458
|
-
|
|
459
|
-
;
|
|
460
|
-
`;
|
|
461
|
-
}
|
|
462
|
-
function createObjectSet(object, {
|
|
463
|
-
objectDefIdentifier,
|
|
464
|
-
objectSetIdentifier,
|
|
465
|
-
propertyKeysIdentifier,
|
|
466
|
-
osdkObjectIdentifier
|
|
467
|
-
}) {
|
|
468
|
-
return `
|
|
469
|
-
export interface ObjectSet extends
|
|
470
|
-
$ObjectSet<${objectDefIdentifier},
|
|
471
|
-
|
|
472
|
-
${objectSetIdentifier}
|
|
473
|
-
>
|
|
474
|
-
{
|
|
475
|
-
|
|
476
|
-
}
|
|
477
|
-
`;
|
|
478
|
-
}
|
|
479
|
-
function maybeStripNamespace(type, q) {
|
|
480
|
-
if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {
|
|
481
|
-
return q.slice(type.apiNamespace.length + 1);
|
|
482
|
-
} else {
|
|
483
|
-
return q;
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
function createProps(type, identifier, strict) {
|
|
487
|
-
const definition = type.getCleanedUpDefinition(true);
|
|
488
|
-
return `export interface ${identifier} {
|
|
489
|
-
${stringify(definition.properties, {
|
|
490
|
-
"*": (propertyDefinition, _, apiName) => {
|
|
491
|
-
return [`readonly "${maybeStripNamespace(type, apiName)}"${// after we convert everything over we can do this:
|
|
492
|
-
// !strict || propertyDefinition.nullable ? "?" : ""
|
|
493
|
-
""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict ? `| undefined` : ""}`];
|
|
494
|
-
}
|
|
495
|
-
})}
|
|
496
|
-
}`;
|
|
497
|
-
}
|
|
498
|
-
function createDefinition(object, ontology, identifier, {
|
|
499
|
-
objectDefIdentifier,
|
|
500
|
-
objectSetIdentifier,
|
|
501
|
-
osdkObjectPropsIdentifier,
|
|
502
|
-
osdkObjectStrictPropsIdentifier,
|
|
503
|
-
osdkObjectLinksIdentifier
|
|
504
|
-
}) {
|
|
505
|
-
const definition = object.getCleanedUpDefinition(true);
|
|
506
|
-
return `
|
|
507
|
-
export interface ${identifier} extends ${object instanceof EnhancedObjectType ? `$ObjectTypeDefinition` : `$InterfaceDefinition`}<"${object.fullApiName}", ${objectDefIdentifier}> {
|
|
508
|
-
osdkMetadata: typeof $osdkMetadata;
|
|
509
|
-
type: "${object instanceof EnhancedObjectType ? "object" : "interface"}";
|
|
510
|
-
apiName: "${object.fullApiName}";
|
|
511
|
-
__DefinitionMetadata?: {
|
|
512
|
-
objectSet: ${objectSetIdentifier};
|
|
513
|
-
props: ${osdkObjectPropsIdentifier};
|
|
514
|
-
linksType: ${osdkObjectLinksIdentifier};
|
|
515
|
-
strictProps: ${osdkObjectStrictPropsIdentifier};
|
|
516
|
-
${stringify(definition, {
|
|
517
|
-
osdkMetadata: () => void 0,
|
|
518
|
-
// we are going to reference another object instead
|
|
519
|
-
links: (_value) => `{
|
|
520
|
-
${stringify(definition.links, {
|
|
521
|
-
"*": (definition2) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true)}, ${definition2.multiplicity}>`
|
|
522
|
-
})}
|
|
523
|
-
}`,
|
|
524
|
-
properties: (_value) => `{
|
|
525
|
-
${stringify(definition.properties, {
|
|
526
|
-
"*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
|
|
527
|
-
apiName
|
|
528
|
-
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
|
|
529
|
-
})}
|
|
530
|
-
}`
|
|
531
|
-
})}
|
|
532
|
-
}
|
|
533
|
-
}
|
|
534
|
-
`;
|
|
535
|
-
}
|
|
536
|
-
function createLinks(ontology, object, identifier) {
|
|
537
|
-
const definition = object.getCleanedUpDefinition(true);
|
|
538
|
-
return `
|
|
539
|
-
${Object.keys(definition.links).length === 0 ? `export type ${identifier} = {};` : `
|
|
540
|
-
export interface ${identifier} {
|
|
541
|
-
${stringify(definition.links, {
|
|
542
|
-
"*": (definition2, _, key) => {
|
|
543
|
-
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(true);
|
|
544
|
-
return [`readonly ${key}`, `${definition2.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}>`}
|
|
545
|
-
`];
|
|
546
|
-
}
|
|
547
|
-
})}
|
|
548
|
-
}
|
|
549
|
-
`}`;
|
|
550
|
-
}
|
|
551
|
-
function createPropertyKeys(type) {
|
|
552
|
-
return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map((a) => `"${a}"`).join("|")};`;
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
// src/v2.0/generatePerActionDataFiles.ts
|
|
556
|
-
async function generatePerActionDataFiles({
|
|
557
|
-
sanitizedOntology: ontology,
|
|
558
|
-
fs: fs2,
|
|
559
|
-
outDir: rootOutDir,
|
|
560
|
-
importExt = "",
|
|
561
|
-
ontology: enhancedOntology
|
|
562
|
-
}) {
|
|
563
|
-
const outDir = path5__default.join(rootOutDir, "ontology", "actions");
|
|
564
|
-
await fs2.mkdir(outDir, {
|
|
565
|
-
recursive: true
|
|
566
|
-
});
|
|
567
|
-
await Promise.all(Object.values(enhancedOntology.actionTypes).map(async (action) => {
|
|
568
|
-
const currentFilePath = `${path5__default.join("ontology", "actions", `${action.shortApiName}.ts`)}`;
|
|
569
|
-
const uniqueApiNamesArray = extractReferencedObjectsFromAction(action.raw);
|
|
570
|
-
const uniqueApiNames = new Set(uniqueApiNamesArray);
|
|
571
|
-
const uniqueApiNamesString = stringUnionFrom([...uniqueApiNames]);
|
|
572
|
-
const fullActionDef = deleteUndefineds(wireActionTypeV2ToSdkActionDefinition(action.raw));
|
|
573
|
-
function createParamsDef() {
|
|
574
|
-
const entries = Object.entries(fullActionDef.parameters ?? {});
|
|
575
|
-
entries.sort((a, b) => a[0].localeCompare(b[0]));
|
|
576
|
-
if (entries.length === 0) {
|
|
577
|
-
return `// Represents the definition of the parameters for the action
|
|
578
|
-
export type ParamsDefinition = Record<string, never>;`;
|
|
579
|
-
}
|
|
580
|
-
return `// Represents the definition of the parameters for the action
|
|
581
|
-
export type ParamsDefinition = {
|
|
582
|
-
${entries.map(([key, value]) => {
|
|
583
|
-
return `"${key}": {
|
|
584
|
-
${stringify(value, {
|
|
585
|
-
description: (value2, d) => value2 ? d(value2) : void 0,
|
|
586
|
-
// trick to remove undefineds
|
|
587
|
-
type: (type) => {
|
|
588
|
-
if (typeof type === "string") {
|
|
589
|
-
return JSON.stringify(type);
|
|
590
|
-
} else if (type.type === "object") {
|
|
591
|
-
const obj = enhancedOntology.requireObjectType(type.object);
|
|
592
|
-
return `ObjectActionDataType<"${obj.fullApiName}", ${obj.getImportedDefinitionIdentifier(true)}>`;
|
|
593
|
-
} else if (type.type === "objectSet") {
|
|
594
|
-
return `ObjectSetActionDataType<"${type.objectSet}", ${getObjectDefIdentifier(type.objectSet, true)}>`;
|
|
595
|
-
}
|
|
596
|
-
return void 0;
|
|
597
|
-
}
|
|
598
|
-
})}
|
|
599
|
-
}`;
|
|
600
|
-
}).join(";\n")}
|
|
601
|
-
}`;
|
|
602
|
-
}
|
|
603
|
-
function getActionParamType(input) {
|
|
604
|
-
if (typeof input === "string") {
|
|
605
|
-
return `ActionParam.PrimitiveType<${JSON.stringify(input)}>`;
|
|
606
|
-
} else if (input.type === "object") {
|
|
607
|
-
return `ActionParam.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
608
|
-
} else if (input.type === "objectSet") {
|
|
609
|
-
return `ActionParam.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
function createV2Types() {
|
|
613
|
-
`${action.shortApiName}$Params`;
|
|
614
|
-
let jsDocBlock = ["/**"];
|
|
615
|
-
if (action.description != null) {
|
|
616
|
-
jsDocBlock.push(`* ${action.description}`);
|
|
617
|
-
}
|
|
618
|
-
return `
|
|
619
|
-
|
|
620
|
-
export namespace ${action.shortApiName}{
|
|
621
|
-
${createParamsDef()}
|
|
622
|
-
|
|
623
|
-
${getDescriptionIfPresent(action.description)}
|
|
624
|
-
export interface Params {
|
|
625
|
-
${stringify(fullActionDef.parameters, {
|
|
626
|
-
"*": (ogValue, _, ogKey) => {
|
|
627
|
-
const key = `${getDescriptionIfPresent(ogValue.description)}
|
|
628
|
-
readonly "${ogKey}"${ogValue.nullable ? "?" : ""}`;
|
|
629
|
-
const value = ogValue.multiplicity ? `ReadonlyArray<${getActionParamType(ogValue.type)}>` : `${getActionParamType(ogValue.type)}`;
|
|
630
|
-
jsDocBlock.push(`* @param {${getActionParamType(ogValue.type)}} ${ogValue.nullable ? `[${ogKey}]` : `${ogKey}`} ${ogValue.description ?? ""} `);
|
|
631
|
-
return [key, value];
|
|
632
|
-
}
|
|
633
|
-
})}
|
|
634
|
-
}
|
|
635
|
-
|
|
636
|
-
// Represents a fqn of the action
|
|
637
|
-
export interface Signatures {
|
|
638
|
-
${getDescriptionIfPresent(action.description)}
|
|
639
|
-
applyAction<P extends ${action.paramsIdentifier}, OP extends ApplyActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
|
|
640
|
-
|
|
641
|
-
batchApplyAction<P extends ReadonlyArray<${action.paramsIdentifier}>, OP extends ApplyBatchActionOptions>(args: P, options?: OP): Promise<ActionReturnTypeForOptions<OP>>;
|
|
642
|
-
}
|
|
643
|
-
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
${jsDocBlock.join("\n")}
|
|
648
|
-
*/
|
|
649
|
-
export interface ${action.shortApiName} extends MinActionDef<"${action.shortApiName}", ${uniqueApiNamesString}, ${action.shortApiName}.Signatures> {
|
|
650
|
-
__DefinitionMetadata?: {
|
|
651
|
-
${stringify(fullActionDef, {
|
|
652
|
-
"parameters": () => action.definitionParamsIdentifier
|
|
653
|
-
})}
|
|
654
|
-
|
|
655
|
-
signatures: ${action.shortApiName}.Signatures;
|
|
656
|
-
},
|
|
657
|
-
${stringify(fullActionDef, {
|
|
658
|
-
"description": () => void 0,
|
|
659
|
-
"displayName": () => void 0,
|
|
660
|
-
"modifiedEntities": () => void 0,
|
|
661
|
-
"parameters": () => void 0
|
|
662
|
-
})}
|
|
663
|
-
osdkMetadata: typeof $osdkMetadata;
|
|
664
|
-
}
|
|
665
|
-
`;
|
|
666
|
-
}
|
|
667
|
-
function createV2Object() {
|
|
668
|
-
return ` export const ${action.shortApiName}: ${action.shortApiName} =
|
|
669
|
-
{
|
|
670
|
-
${stringify(fullActionDef, {
|
|
671
|
-
"description": () => void 0,
|
|
672
|
-
"displayName": () => void 0,
|
|
673
|
-
"modifiedEntities": () => void 0,
|
|
674
|
-
"parameters": () => void 0
|
|
675
|
-
})},
|
|
676
|
-
osdkMetadata: $osdkMetadata
|
|
677
|
-
}
|
|
678
|
-
`;
|
|
679
|
-
}
|
|
680
|
-
const referencedObjectDefs = /* @__PURE__ */ new Set();
|
|
681
|
-
for (const p of Object.values(action.parameters)) {
|
|
682
|
-
if (p.dataType.type === "object" || p.dataType.type === "objectSet") {
|
|
683
|
-
if (p.dataType.objectApiName) {
|
|
684
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectApiName));
|
|
685
|
-
}
|
|
686
|
-
if (p.dataType.objectTypeApiName) {
|
|
687
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.objectTypeApiName));
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
if (p.dataType.type === "array" && (p.dataType.subType.type === "object" || p.dataType.subType.type === "objectSet")) {
|
|
691
|
-
if (p.dataType.subType.objectApiName) {
|
|
692
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectApiName));
|
|
693
|
-
}
|
|
694
|
-
if (p.dataType.subType.objectTypeApiName) {
|
|
695
|
-
referencedObjectDefs.add(enhancedOntology.requireObjectType(p.dataType.subType.objectTypeApiName));
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
}
|
|
699
|
-
const imports = getObjectImports(referencedObjectDefs, void 0, currentFilePath, true);
|
|
700
|
-
await fs2.writeFile(path5__default.join(rootOutDir, currentFilePath), await formatTs(`
|
|
701
|
-
import type { MinActionDef, ObjectActionDataType, ObjectSetActionDataType } from "@osdk/api";
|
|
702
|
-
import type { ActionParam, ActionReturnTypeForOptions, ApplyActionOptions, ApplyBatchActionOptions, } from '@osdk/client.api';
|
|
703
|
-
import { $osdkMetadata} from "../../OntologyMetadata${importExt}";
|
|
704
|
-
${imports}
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
${createV2Types()}
|
|
708
|
-
|
|
709
|
-
${createV2Object()}
|
|
710
|
-
`));
|
|
711
|
-
}));
|
|
712
|
-
const indexFileRelPath = path5__default.join("ontology", "actions.ts");
|
|
713
|
-
await fs2.writeFile(path5__default.join(rootOutDir, indexFileRelPath), await formatTs(`
|
|
714
|
-
${Object.values(enhancedOntology.actionTypes).map((action) => {
|
|
715
|
-
const exportConstLine = `export {${action.shortApiName} } from "${action.getImportPathRelTo(indexFileRelPath)}";`;
|
|
716
|
-
return exportConstLine;
|
|
717
|
-
}).join("\n")}
|
|
718
|
-
${Object.keys(ontology.actionTypes).length === 0 ? "export {};" : ""}
|
|
719
|
-
`));
|
|
720
|
-
}
|
|
721
|
-
function extractReferencedObjectsFromAction(actionType) {
|
|
722
|
-
const referencedObjectsInParameters = Object.values(actionType.parameters).flatMap(({
|
|
723
|
-
dataType
|
|
724
|
-
}) => {
|
|
725
|
-
const objectTypeReference = extractReferencedObjectsFromActionParameter(dataType);
|
|
726
|
-
return objectTypeReference ? [objectTypeReference] : [];
|
|
727
|
-
});
|
|
728
|
-
const referenceObjectsInEdits = actionType.operations.flatMap((value) => {
|
|
729
|
-
switch (value.type) {
|
|
730
|
-
case "createObject":
|
|
731
|
-
return [value.objectTypeApiName];
|
|
732
|
-
case "modifyObject":
|
|
733
|
-
return [value.objectTypeApiName];
|
|
734
|
-
case "deleteObject":
|
|
735
|
-
case "createLink":
|
|
736
|
-
case "deleteLink":
|
|
737
|
-
default:
|
|
738
|
-
return [];
|
|
739
|
-
}
|
|
740
|
-
});
|
|
741
|
-
return [...referenceObjectsInEdits, ...referencedObjectsInParameters];
|
|
742
|
-
}
|
|
743
|
-
function extractReferencedObjectsFromActionParameter(actionParameter) {
|
|
744
|
-
switch (actionParameter.type) {
|
|
745
|
-
case "objectSet":
|
|
746
|
-
case "object":
|
|
747
|
-
return actionParameter.objectTypeApiName;
|
|
748
|
-
case "array":
|
|
749
|
-
return extractReferencedObjectsFromActionParameter(actionParameter.subType);
|
|
750
|
-
case "string":
|
|
751
|
-
case "boolean":
|
|
752
|
-
case "attachment":
|
|
753
|
-
case "date":
|
|
754
|
-
case "double":
|
|
755
|
-
case "integer":
|
|
756
|
-
case "long":
|
|
757
|
-
case "timestamp":
|
|
758
|
-
return void 0;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
// src/shared/getObjectTypesFromQueryDataType.ts
|
|
763
|
-
function getObjectTypesFromQueryDataType(dataType, types) {
|
|
764
|
-
switch (dataType.type) {
|
|
765
|
-
case "array":
|
|
766
|
-
case "set":
|
|
767
|
-
getObjectTypesFromQueryDataType(dataType.subType, types);
|
|
768
|
-
return;
|
|
769
|
-
case "object":
|
|
770
|
-
types.add(dataType.objectTypeApiName);
|
|
771
|
-
return;
|
|
772
|
-
case "objectSet":
|
|
773
|
-
types.add(dataType.objectTypeApiName);
|
|
774
|
-
return;
|
|
775
|
-
case "struct":
|
|
776
|
-
for (const prop of Object.values(dataType.fields)) {
|
|
777
|
-
getObjectTypesFromQueryDataType(prop.fieldType, types);
|
|
778
|
-
}
|
|
779
|
-
return;
|
|
780
|
-
case "union":
|
|
781
|
-
for (const type of dataType.unionTypes) {
|
|
782
|
-
getObjectTypesFromQueryDataType(type, types);
|
|
783
|
-
}
|
|
784
|
-
return;
|
|
785
|
-
case "attachment":
|
|
786
|
-
case "boolean":
|
|
787
|
-
case "date":
|
|
788
|
-
case "double":
|
|
789
|
-
case "float":
|
|
790
|
-
case "integer":
|
|
791
|
-
case "long":
|
|
792
|
-
case "null":
|
|
793
|
-
case "string":
|
|
794
|
-
case "threeDimensionalAggregation":
|
|
795
|
-
case "timestamp":
|
|
796
|
-
case "twoDimensionalAggregation":
|
|
797
|
-
case "unsupported":
|
|
798
|
-
return;
|
|
799
|
-
default:
|
|
800
|
-
throw new Error(`Cannot find object types from unsupported QueryDataType ${dataType.type}`);
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
|
|
804
|
-
// src/shared/getObjectTypeApiNamesFromQuery.ts
|
|
805
|
-
function getObjectTypeApiNamesFromQuery(query) {
|
|
806
|
-
const types = /* @__PURE__ */ new Set();
|
|
807
|
-
for (const {
|
|
808
|
-
dataType
|
|
809
|
-
} of Object.values(query.parameters)) {
|
|
810
|
-
getObjectTypesFromQueryDataType(dataType, types);
|
|
811
|
-
}
|
|
812
|
-
getObjectTypesFromQueryDataType(query.output, types);
|
|
813
|
-
return Array.from(types);
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
// src/v2.0/generatePerQueryDataFiles.ts
|
|
817
|
-
async function generatePerQueryDataFilesV2({
|
|
818
|
-
fs: fs2,
|
|
819
|
-
outDir: rootOutDir,
|
|
820
|
-
ontology,
|
|
821
|
-
importExt = ""
|
|
822
|
-
}, v2) {
|
|
823
|
-
const relOutDir = path5__default.join(".", "ontology", "queries");
|
|
824
|
-
const outDir = path5__default.join(rootOutDir, "ontology", "queries");
|
|
825
|
-
await fs2.mkdir(outDir, {
|
|
826
|
-
recursive: true
|
|
827
|
-
});
|
|
828
|
-
await Promise.all(Object.values(ontology.queryTypes).map(async (query) => {
|
|
829
|
-
await generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology);
|
|
830
|
-
}));
|
|
831
|
-
const indexFilePath = `${outDir}.ts`;
|
|
832
|
-
await fs2.writeFile(indexFilePath, await formatTs(`
|
|
833
|
-
${Object.values(ontology.queryTypes).map((query) => `export * from "${query.getImportPathRelTo(relOutDir)}";`).join("\n")}
|
|
834
|
-
${Object.keys(ontology.queryTypes).length === 0 ? "export {};" : ""}
|
|
835
|
-
`));
|
|
836
|
-
}
|
|
837
|
-
async function generateV2QueryFile(fs2, outDir, relOutDir, query, importExt, ontology) {
|
|
838
|
-
const relFilePath = path5__default.join(relOutDir, `${query.shortApiName}.ts`);
|
|
839
|
-
const objectTypes = getObjectTypeApiNamesFromQuery(query);
|
|
840
|
-
const objectTypeObjects = new Set(objectTypes.map((o) => ontology.requireObjectType(o)));
|
|
841
|
-
const importObjects = getObjectImports(objectTypeObjects, "", relFilePath, true);
|
|
842
|
-
const baseProps = deleteUndefineds(wireQueryTypeV2ToSdkQueryDefinitionNoParams(query.raw));
|
|
843
|
-
const outputBase = deleteUndefineds(wireQueryDataTypeToQueryDataTypeDefinition(query.output));
|
|
844
|
-
const referencedObjectTypes = objectTypes.length > 0 ? objectTypes.map((apiNameObj) => `"${apiNameObj}"`).join("|") : "never";
|
|
845
|
-
await fs2.writeFile(path5__default.join(outDir, `${query.shortApiName}.ts`), await formatTs(`
|
|
846
|
-
import type { MinQueryDef , VersionBound} from "@osdk/api";
|
|
847
|
-
import type { QueryParam, QueryResult } from "@osdk/client.api";
|
|
848
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
849
|
-
${importObjects}
|
|
850
|
-
|
|
851
|
-
export namespace ${query.shortApiName} {
|
|
852
|
-
export interface Signature {
|
|
853
|
-
${getDescriptionIfPresent(query.description)}
|
|
854
|
-
(${Object.keys(query.parameters).length > 0 ? `query: ${query.paramsIdentifier}` : ""}): Promise<${getQueryParamType(ontology, wireQueryParameterV2ToQueryParameterDefinition({
|
|
855
|
-
dataType: query.output
|
|
856
|
-
}), "Result")}>
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
${Object.keys(query.parameters).length > 0 ? `
|
|
860
|
-
export interface Parameters {
|
|
861
|
-
${stringify(query.parameters, {
|
|
862
|
-
"*": (parameter, formatter, apiName) => {
|
|
863
|
-
const q = wireQueryParameterV2ToQueryParameterDefinition(parameter);
|
|
864
|
-
return [`
|
|
865
|
-
${queryParamJsDoc(wireQueryParameterV2ToQueryParameterDefinition(parameter), {
|
|
866
|
-
apiName
|
|
867
|
-
})}readonly "${apiName}"${q.nullable ? "?" : ""}`, `${getQueryParamType(ontology, q, "Param")}`];
|
|
868
|
-
}
|
|
869
|
-
})}
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
` : ""}
|
|
873
|
-
|
|
874
|
-
export interface Definition extends MinQueryDef<
|
|
875
|
-
"${query.fullApiName}",
|
|
876
|
-
${referencedObjectTypes},
|
|
877
|
-
${query.shortApiName}.Signature
|
|
878
|
-
>, VersionBound<$ExpectedClientVersion>{
|
|
879
|
-
${stringify(baseProps)},
|
|
880
|
-
parameters: {
|
|
881
|
-
${parameterDefsForType(ontology, query)}
|
|
882
|
-
};
|
|
883
|
-
output: {
|
|
884
|
-
${stringify(outputBase)},
|
|
885
|
-
${getLineFor__OsdkTargetType(ontology, query.output)}
|
|
886
|
-
};
|
|
887
|
-
}
|
|
888
|
-
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
/** @deprecated use \`${query.shortApiName}.Signature' instead */
|
|
892
|
-
export type ${query.shortApiName} = ${query.shortApiName}.Signature;
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
export const ${query.shortApiName}: ${query.definitionIdentifier} = {
|
|
899
|
-
${stringify(baseProps)},
|
|
900
|
-
parameters: {
|
|
901
|
-
${parametersForConst(query)}
|
|
902
|
-
},
|
|
903
|
-
output: {
|
|
904
|
-
${stringify(outputBase)},
|
|
905
|
-
}
|
|
906
|
-
};
|
|
907
|
-
`));
|
|
908
|
-
}
|
|
909
|
-
function parametersForConst(query) {
|
|
910
|
-
return stringify(query.parameters, {
|
|
911
|
-
"*": (parameter, formatter) => formatter(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))
|
|
912
|
-
});
|
|
913
|
-
}
|
|
914
|
-
function parameterDefsForType(ontology, query) {
|
|
915
|
-
return stringify(query.parameters, {
|
|
916
|
-
"*": (parameter, valueFormatter, apiName) => [`${queryParamJsDoc(wireQueryParameterV2ToQueryParameterDefinition(parameter), {
|
|
917
|
-
apiName
|
|
918
|
-
})} ${apiName}`, ` {
|
|
919
|
-
${stringify(deleteUndefineds(wireQueryParameterV2ToQueryParameterDefinition(parameter)))},
|
|
920
|
-
${getLineFor__OsdkTargetType(ontology, parameter.dataType)}
|
|
921
|
-
}`]
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
function getLineFor__OsdkTargetType(ontology, qdt) {
|
|
925
|
-
if (qdt.type === "object" || qdt.type === "objectSet") {
|
|
926
|
-
return `__OsdkTargetType?: ${ontology.requireObjectType(qdt.objectTypeApiName).getImportedDefinitionIdentifier(true)}`;
|
|
927
|
-
}
|
|
928
|
-
return "";
|
|
929
|
-
}
|
|
930
|
-
function queryParamJsDoc(param, {
|
|
931
|
-
apiName
|
|
932
|
-
}) {
|
|
933
|
-
let ret = `/**
|
|
934
|
-
`;
|
|
935
|
-
if (param.description) {
|
|
936
|
-
if (param.description) {
|
|
937
|
-
ret += ` * description: ${param.description}
|
|
938
|
-
`;
|
|
939
|
-
}
|
|
940
|
-
} else {
|
|
941
|
-
ret += ` * (no ontology metadata)
|
|
942
|
-
`;
|
|
943
|
-
}
|
|
944
|
-
ret += ` */
|
|
945
|
-
`;
|
|
946
|
-
return ret;
|
|
947
|
-
}
|
|
948
|
-
function getQueryParamType(enhancedOntology, input, type) {
|
|
949
|
-
let inner = `unknown /* ${input.type} */`;
|
|
950
|
-
switch (input.type) {
|
|
951
|
-
case "date":
|
|
952
|
-
inner = `Query${type}.PrimitiveType<${JSON.stringify("datetime")}>`;
|
|
953
|
-
break;
|
|
954
|
-
case "attachment":
|
|
955
|
-
case "boolean":
|
|
956
|
-
case "double":
|
|
957
|
-
case "float":
|
|
958
|
-
case "integer":
|
|
959
|
-
case "long":
|
|
960
|
-
case "string":
|
|
961
|
-
case "struct":
|
|
962
|
-
case "threeDimensionalAggregation":
|
|
963
|
-
case "timestamp":
|
|
964
|
-
case "twoDimensionalAggregation":
|
|
965
|
-
inner = `Query${type}.PrimitiveType<${JSON.stringify(input.type)}>`;
|
|
966
|
-
break;
|
|
967
|
-
case "object":
|
|
968
|
-
inner = `Query${type}.ObjectType<${enhancedOntology.requireObjectType(input.object).getImportedDefinitionIdentifier(true)}>`;
|
|
969
|
-
break;
|
|
970
|
-
case "objectSet":
|
|
971
|
-
inner = `Query${type}.ObjectSetType<${enhancedOntology.requireObjectType(input.objectSet).getImportedDefinitionIdentifier(true)}>`;
|
|
972
|
-
break;
|
|
973
|
-
case "set":
|
|
974
|
-
inner = `${type === "Param" ? "Readonly" : ""}Set<${getQueryParamType(enhancedOntology, input.set, type)}>`;
|
|
975
|
-
break;
|
|
976
|
-
case "union":
|
|
977
|
-
inner = input.union.map((u) => getQueryParamType(enhancedOntology, u, type)).join(" | ");
|
|
978
|
-
break;
|
|
979
|
-
}
|
|
980
|
-
if (input.multiplicity && type === "Param") {
|
|
981
|
-
return `ReadonlyArray<${inner}>`;
|
|
982
|
-
} else if (input.multiplicity) {
|
|
983
|
-
return `Array<${inner}>`;
|
|
984
|
-
}
|
|
985
|
-
return inner;
|
|
986
|
-
}
|
|
987
|
-
function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {
|
|
988
|
-
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
|
|
989
|
-
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
990
|
-
const parents = definition.implements?.map((p) => {
|
|
991
|
-
!(ontology.interfaceTypes[p] != null) ? process.env.NODE_ENV !== "production" ? invariant(false, `Expected to find a parent interface named ${p} in the ontology and did not.`) : invariant(false) : void 0;
|
|
992
|
-
const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(ontology.requireInterfaceType(p, true).raw, v2));
|
|
993
|
-
return it;
|
|
994
|
-
}) ?? [];
|
|
995
|
-
const mergedProperties = {
|
|
996
|
-
...definition.properties
|
|
997
|
-
};
|
|
998
|
-
for (const parent of parents) {
|
|
999
|
-
for (const apiName of Object.keys(parent.properties)) {
|
|
1000
|
-
if (definition.properties[apiName] != null) {
|
|
1001
|
-
!fastDeepEqual(definition.properties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : invariant(false) : void 0;
|
|
1002
|
-
} else if (mergedProperties[apiName] != null) {
|
|
1003
|
-
!fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : invariant(false) : void 0;
|
|
1004
|
-
}
|
|
1005
|
-
mergedProperties[apiName] = parent.properties[apiName];
|
|
1006
|
-
}
|
|
1007
|
-
}
|
|
1008
|
-
definition.properties;
|
|
1009
|
-
definition.properties = mergedProperties;
|
|
1010
|
-
function maybeStripNamespace2(q) {
|
|
1011
|
-
if (interfaceDef.apiNamespace && q.startsWith(`${interfaceDef.apiNamespace}.`)) {
|
|
1012
|
-
return q.slice(interfaceDef.apiNamespace.length + 1);
|
|
1013
|
-
} else {
|
|
1014
|
-
return q;
|
|
1015
|
-
}
|
|
1016
|
-
}
|
|
1017
|
-
const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;
|
|
1018
|
-
const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;
|
|
1019
|
-
const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;
|
|
1020
|
-
const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;
|
|
1021
|
-
const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;
|
|
1022
|
-
const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;
|
|
1023
|
-
const ids = {
|
|
1024
|
-
objectDefIdentifier: `${interfaceDef.shortApiName}.Definition`,
|
|
1025
|
-
osdkObjectLinksIdentifier,
|
|
1026
|
-
osdkObjectPropsIdentifier,
|
|
1027
|
-
osdkObjectStrictPropsIdentifier,
|
|
1028
|
-
objectSetIdentifier,
|
|
1029
|
-
osdkObjectIdentifier,
|
|
1030
|
-
propertyKeysIdentifier
|
|
1031
|
-
};
|
|
1032
|
-
function getV2Types() {
|
|
1033
|
-
return ` import type {
|
|
1034
|
-
InterfaceDefinition as $InterfaceDefinition,
|
|
1035
|
-
} from "@osdk/api";
|
|
1036
|
-
import type {
|
|
1037
|
-
ObjectSet as $ObjectSet,
|
|
1038
|
-
Osdk as $Osdk,
|
|
1039
|
-
PropertyValueWireToClient as $PropType, } from "@osdk/client.api";
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
${Object.keys(definition.links).length === 0 ? `export type ${osdkObjectLinksIdentifier} = {};` : `
|
|
1046
|
-
export interface ${osdkObjectLinksIdentifier} {
|
|
1047
|
-
${stringify(definition.links, {
|
|
1048
|
-
"*": (definition2) => {
|
|
1049
|
-
const linkTarget = ontology.requireObjectType(definition2.targetType).getImportedDefinitionIdentifier(v2);
|
|
1050
|
-
return `${definition2.multiplicity ? `${linkTarget}["objectSet"]` : `SingleLinkAccessor<${linkTarget}>`}
|
|
1051
|
-
`;
|
|
1052
|
-
}
|
|
1053
|
-
})}
|
|
1054
|
-
}
|
|
1055
|
-
`}
|
|
1056
|
-
|
|
1057
|
-
export namespace ${interfaceDef.shortApiName} {
|
|
1058
|
-
|
|
1059
|
-
${createPropertyKeys(interfaceDef)}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
${createProps(interfaceDef, "Props", false)}
|
|
1063
|
-
${createProps(interfaceDef, "StrictProps", true)}
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
${createObjectSet(interfaceDef, ids)}
|
|
1067
|
-
|
|
1068
|
-
${createDefinition(interfaceDef, ontology, "Definition", ids)}
|
|
1069
|
-
|
|
1070
|
-
${createOsdkObject(interfaceDef, "OsdkObject", ids)}
|
|
1071
|
-
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
/** @deprecated use ${interfaceDef.shortApiName}.Definition **/
|
|
1078
|
-
export type ${objectDefIdentifier} = ${interfaceDef.shortApiName}.Definition;
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
`;
|
|
1084
|
-
}
|
|
1085
|
-
const imports = [];
|
|
1086
|
-
return `${imports.join("\n")}
|
|
1087
|
-
${v2 ? getV2Types() : ""}
|
|
1088
|
-
|
|
1089
|
-
export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName}.Definition = {
|
|
1090
|
-
osdkMetadata: $osdkMetadata,
|
|
1091
|
-
objectSet: undefined as any,
|
|
1092
|
-
props: undefined as any,
|
|
1093
|
-
linksType: undefined as any,
|
|
1094
|
-
strictProps: undefined as any,
|
|
1095
|
-
${stringify(definition, {
|
|
1096
|
-
osdkMetadata: () => void 0,
|
|
1097
|
-
properties: (properties) => `{
|
|
1098
|
-
${stringify(properties, {
|
|
1099
|
-
"*": (propertyDefinition, _, key) => [`"${maybeStripNamespace2(key)}"`, _(propertyDefinition)]
|
|
1100
|
-
})}
|
|
1101
|
-
}`
|
|
1102
|
-
})}
|
|
1103
|
-
|
|
1104
|
-
};`;
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
// src/v2.0/generateClientSdkVersionTwoPointZero.ts
|
|
1108
|
-
async function generateRootIndexTsFile({
|
|
1109
|
-
fs: fs2,
|
|
1110
|
-
outDir,
|
|
1111
|
-
importExt,
|
|
1112
|
-
ontologyApiNamespace
|
|
1113
|
-
}) {
|
|
1114
|
-
fs2.writeFile(path5__default.join(outDir, "index.ts"), await formatTs(`export * from "./ontology/actions${importExt}";
|
|
1115
|
-
export * as $Actions from "./ontology/actions${importExt}";
|
|
1116
|
-
export * from "./ontology/interfaces${importExt}";
|
|
1117
|
-
export * as $Interfaces from "./ontology/interfaces${importExt}";
|
|
1118
|
-
export * from "./ontology/objects${importExt}";
|
|
1119
|
-
export * as $Objects from "./ontology/objects${importExt}";
|
|
1120
|
-
export * from "./ontology/queries${importExt}";
|
|
1121
|
-
export * as $Queries from "./ontology/queries${importExt}";
|
|
1122
|
-
${ontologyApiNamespace == null ? `export { $ontologyRid } from "./OntologyMetadata${importExt}";` : ``}
|
|
1123
|
-
`));
|
|
1124
|
-
}
|
|
1125
|
-
async function generateEachObjectFile(ctx) {
|
|
1126
|
-
const {
|
|
1127
|
-
fs: fs2,
|
|
1128
|
-
outDir,
|
|
1129
|
-
ontology,
|
|
1130
|
-
importExt
|
|
1131
|
-
} = ctx;
|
|
1132
|
-
await fs2.mkdir(path5__default.join(outDir, "ontology", "objects"), {
|
|
1133
|
-
recursive: true
|
|
1134
|
-
});
|
|
1135
|
-
for (const obj of Object.values(ontology.objectTypes)) {
|
|
1136
|
-
const relPath = path5__default.join(".", "ontology", `objects`, `${obj.shortApiName}.ts`);
|
|
1137
|
-
const outFilePath = path5__default.join(outDir, relPath);
|
|
1138
|
-
await fs2.writeFile(outFilePath, await formatTs(`
|
|
1139
|
-
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
1140
|
-
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
1141
|
-
import type { $ExpectedClientVersion } from "../../OntologyMetadata${importExt}";
|
|
1142
|
-
${wireObjectTypeV2ToSdkObjectConstV2(obj.raw, ctx, relPath)}
|
|
1143
|
-
`));
|
|
1144
|
-
}
|
|
1145
|
-
}
|
|
1146
|
-
async function generateClientSdkVersionTwoPointZero(ontology, userAgent, fs2, outDir, packageType = "commonjs", ontologyApiNamespace, apiNamespacePackageMap = /* @__PURE__ */ new Map()) {
|
|
1147
|
-
const importExt = packageType === "module" ? ".js" : "";
|
|
1148
|
-
await verifyOutDir(outDir, fs2);
|
|
1149
|
-
const sanitizedOntology = sanitizeMetadata(ontology);
|
|
1150
|
-
await fs2.mkdir(outDir, {
|
|
1151
|
-
recursive: true
|
|
1152
|
-
});
|
|
1153
|
-
const enhancedOntology = enhanceOntology(sanitizedOntology, ontologyApiNamespace, apiNamespacePackageMap, importExt);
|
|
1154
|
-
const ctx = {
|
|
1155
|
-
sanitizedOntology,
|
|
1156
|
-
ontology: enhancedOntology,
|
|
1157
|
-
importExt,
|
|
1158
|
-
fs: fs2,
|
|
1159
|
-
outDir,
|
|
1160
|
-
ontologyApiNamespace,
|
|
1161
|
-
apiNamespacePackageMap
|
|
1162
|
-
};
|
|
1163
|
-
await generateRootIndexTsFile(ctx);
|
|
1164
|
-
await generateOntologyMetadataFile(ctx, userAgent);
|
|
1165
|
-
await generateEachObjectFile(ctx);
|
|
1166
|
-
await generateOntologyInterfaces(ctx);
|
|
1167
|
-
const actionsDir = path5__default.join(outDir, "ontology", "actions");
|
|
1168
|
-
await fs2.mkdir(actionsDir, {
|
|
1169
|
-
recursive: true
|
|
1170
|
-
});
|
|
1171
|
-
await generatePerActionDataFiles(ctx);
|
|
1172
|
-
await fs2.writeFile(path5__default.join(outDir, "ontology", "objects.ts"), await formatTs(`
|
|
1173
|
-
${Object.values(enhancedOntology.objectTypes).map((objType) => `export * from "./objects/${objType.shortApiName}${importExt}";`).join("\n")}
|
|
1174
|
-
${Object.keys(ontology.objectTypes).length === 0 ? "export {};" : ""}
|
|
1175
|
-
`));
|
|
1176
|
-
await generatePerQueryDataFilesV2(ctx);
|
|
1177
|
-
}
|
|
1178
|
-
async function generateOntologyInterfaces({
|
|
1179
|
-
fs: fs2,
|
|
1180
|
-
outDir,
|
|
1181
|
-
ontology,
|
|
1182
|
-
importExt
|
|
1183
|
-
}) {
|
|
1184
|
-
const interfacesDir = path5__default.join(outDir, "ontology", "interfaces");
|
|
1185
|
-
await fs2.mkdir(interfacesDir, {
|
|
1186
|
-
recursive: true
|
|
1187
|
-
});
|
|
1188
|
-
for (const obj of Object.values(ontology.interfaceTypes)) {
|
|
1189
|
-
await fs2.writeFile(path5__default.join(interfacesDir, `${obj.shortApiName}.ts`), await formatTs(`
|
|
1190
|
-
import type { PropertyDef as $PropertyDef } from "@osdk/api";
|
|
1191
|
-
import { $osdkMetadata } from "../../OntologyMetadata${importExt}";
|
|
1192
|
-
${__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(obj, ontology, true)}
|
|
1193
|
-
`));
|
|
1194
|
-
}
|
|
1195
|
-
await fs2.writeFile(interfacesDir + ".ts", await formatTs(`
|
|
1196
|
-
${Object.values(ontology.interfaceTypes).map((interfaceType) => `export * from "./interfaces/${interfaceType.shortApiName}${importExt}";`).join("\n")}
|
|
1197
|
-
${Object.keys(ontology.interfaceTypes).length === 0 ? "export {}" : ""}
|
|
1198
|
-
`));
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
// src/generateClientSdkPackage.ts
|
|
1202
|
-
async function generateClientSdkPackage(packageName, packageVersion, sdkVersion, baseOutDir, ontology, minimalFs, dependencyVersions, cliVersion, ontologyApiNamespace, apiNamespacePackageMap) {
|
|
1203
|
-
if (!packageName) throw new Error("Package name is required");
|
|
1204
|
-
if (sdkVersion === "1.1") {
|
|
1205
|
-
throw new Error("This generator version does not support generating v1 sdks");
|
|
1206
|
-
}
|
|
1207
|
-
for (const packageType of ["module", "commonjs"]) {
|
|
1208
|
-
const outDir = path5.join(baseOutDir, "dist", packageType);
|
|
1209
|
-
generateClientSdkVersionTwoPointZero(ontology, `typescript-sdk/${packageVersion} osdk-cli/${cliVersion}`, minimalFs, outDir, packageType, ontologyApiNamespace, apiNamespacePackageMap);
|
|
1210
|
-
await fs.promises.mkdir(outDir, {
|
|
1211
|
-
recursive: true
|
|
1212
|
-
});
|
|
1213
|
-
await writeJson(minimalFs, path5.join(outDir, "package.json"), {
|
|
1214
|
-
type: packageType
|
|
1215
|
-
});
|
|
1216
|
-
await writeJson(minimalFs, path5.join(outDir, `tsconfig.json`), {
|
|
1217
|
-
compilerOptions: getTsCompilerOptions(packageType)
|
|
1218
|
-
});
|
|
1219
|
-
}
|
|
1220
|
-
await writeJson(minimalFs, path5.join(baseOutDir, "package.json"), await getPackageJsonContents(packageName, packageVersion, dependencyVersions));
|
|
1221
|
-
await minimalFs.mkdir(path5.join(baseOutDir, "ontology"), {
|
|
1222
|
-
recursive: true
|
|
1223
|
-
});
|
|
1224
|
-
await minimalFs.writeFile(path5.join(baseOutDir, "ontology", "objects.js"), `module.exports = require("../../dist/module/ontology/objects")`);
|
|
1225
|
-
await minimalFs.writeFile(path5.join(baseOutDir, "ontology", "objects.d.ts"), `export * from "../dist/module/ontology/objects"`);
|
|
1226
|
-
}
|
|
1227
|
-
function getTsCompilerOptions(packageType) {
|
|
1228
|
-
const commonTsconfig = {
|
|
1229
|
-
importHelpers: true,
|
|
1230
|
-
declaration: true,
|
|
1231
|
-
isolatedModules: true,
|
|
1232
|
-
esModuleInterop: true,
|
|
1233
|
-
forceConsistentCasingInFileNames: true,
|
|
1234
|
-
strict: true,
|
|
1235
|
-
skipLibCheck: true
|
|
1236
|
-
};
|
|
1237
|
-
const compilerOptions = packageType === "commonjs" ? {
|
|
1238
|
-
...commonTsconfig,
|
|
1239
|
-
module: "commonjs",
|
|
1240
|
-
target: "es2018"
|
|
1241
|
-
} : {
|
|
1242
|
-
...commonTsconfig,
|
|
1243
|
-
module: "NodeNext",
|
|
1244
|
-
target: "ES2020"
|
|
1245
|
-
};
|
|
1246
|
-
return compilerOptions;
|
|
1247
|
-
}
|
|
1248
|
-
function getExpectedDependencies({
|
|
1249
|
-
osdkApiVersion,
|
|
1250
|
-
osdkClientVersion,
|
|
1251
|
-
osdkClientApiVersion
|
|
1252
|
-
}) {
|
|
1253
|
-
return {
|
|
1254
|
-
devDependencies: {
|
|
1255
|
-
"@osdk/api": osdkApiVersion,
|
|
1256
|
-
"@osdk/client.api": osdkClientApiVersion
|
|
1257
|
-
},
|
|
1258
|
-
peerDependencies: {
|
|
1259
|
-
"@osdk/api": osdkApiVersion,
|
|
1260
|
-
"@osdk/client.api": osdkClientApiVersion,
|
|
1261
|
-
"@osdk/client": osdkClientVersion
|
|
1262
|
-
}
|
|
1263
|
-
};
|
|
1264
|
-
}
|
|
1265
|
-
function getExpectedDependenciesFull(dependencyVersions) {
|
|
1266
|
-
const {
|
|
1267
|
-
typescriptVersion,
|
|
1268
|
-
tslibVersion,
|
|
1269
|
-
areTheTypesWrongVersion
|
|
1270
|
-
} = dependencyVersions;
|
|
1271
|
-
const base = getExpectedDependencies(dependencyVersions);
|
|
1272
|
-
return {
|
|
1273
|
-
devDependencies: {
|
|
1274
|
-
...base.devDependencies,
|
|
1275
|
-
"typescript": typescriptVersion,
|
|
1276
|
-
"tslib": tslibVersion,
|
|
1277
|
-
"@arethetypeswrong/cli": areTheTypesWrongVersion
|
|
1278
|
-
},
|
|
1279
|
-
peerDependencies: {
|
|
1280
|
-
...base.peerDependencies
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
}
|
|
1284
|
-
function getPackageJsonContents(name, version, dependencyVersions) {
|
|
1285
|
-
const esmPrefix = "./dist/module";
|
|
1286
|
-
const commonjsPrefix = "./dist/commonjs";
|
|
1287
|
-
return {
|
|
1288
|
-
name,
|
|
1289
|
-
version,
|
|
1290
|
-
main: `${commonjsPrefix}/index.js`,
|
|
1291
|
-
module: `${esmPrefix}/index.js`,
|
|
1292
|
-
exports: {
|
|
1293
|
-
".": {
|
|
1294
|
-
import: `${esmPrefix}/index.js`,
|
|
1295
|
-
require: `${commonjsPrefix}/index.js`
|
|
1296
|
-
}
|
|
1297
|
-
},
|
|
1298
|
-
scripts: {
|
|
1299
|
-
prepack: `tsc -p ${esmPrefix}/tsconfig.json && tsc -p ${commonjsPrefix}/tsconfig.json`,
|
|
1300
|
-
check: "npm exec attw $(npm pack)"
|
|
1301
|
-
},
|
|
1302
|
-
...getExpectedDependenciesFull(dependencyVersions),
|
|
1303
|
-
files: ["**/*.js", "**/*.d.ts", "dist/**/package.json"]
|
|
1304
|
-
};
|
|
1305
|
-
}
|
|
1306
|
-
async function writeJson(minimalFs, filePath, body) {
|
|
1307
|
-
return await minimalFs.writeFile(filePath, JSON.stringify(body, void 0, 2) + "\n");
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
export { generateClientSdkPackage as __UNSTABLE_generateClientSdkPackage, generateClientSdkVersionTwoPointZero, getExpectedDependencies };
|
|
1311
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { generateClientSdkPackage as __UNSTABLE_generateClientSdkPackage, getExpectedDependencies } from "./generateClientSdkPackage.js";
|
|
17
|
+
export { generateClientSdkVersionTwoPointZero } from "./v2.0/generateClientSdkVersionTwoPointZero.js";
|
|
1312
18
|
//# sourceMappingURL=index.js.map
|