@osdk/generator 2.0.0-beta.13 → 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 +18 -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 -1286
- 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.js +72 -0
- package/build/esm/GenerateContext/EnhancedBase.js.map +1 -0
- package/build/esm/GenerateContext/EnhancedInterfaceType.js +38 -0
- package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -0
- 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 -1286
- 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.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.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
|
@@ -0,0 +1,205 @@
|
|
|
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
|
+
import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
|
|
17
|
+
import { EnhancedObjectType } from "../GenerateContext/EnhancedObjectType.js";
|
|
18
|
+
import { getObjectImports } from "../shared/getObjectImports.js";
|
|
19
|
+
import { propertyJsdoc } from "../shared/propertyJsdoc.js";
|
|
20
|
+
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
21
|
+
import { stringify } from "../util/stringify.js";
|
|
22
|
+
export function getObjectDefIdentifier(name, v2) {
|
|
23
|
+
return v2 ? name : `${name}Def`;
|
|
24
|
+
}
|
|
25
|
+
/** @internal */
|
|
26
|
+
export function wireObjectTypeV2ToSdkObjectConstV2(wireObject, {
|
|
27
|
+
ontology
|
|
28
|
+
}, currentFilePath) {
|
|
29
|
+
const object = ontology.requireObjectType(wireObject.objectType.apiName, true);
|
|
30
|
+
const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));
|
|
31
|
+
const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));
|
|
32
|
+
const objectDefIdentifier = object.getDefinitionIdentifier(true);
|
|
33
|
+
const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;
|
|
34
|
+
const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;
|
|
35
|
+
// const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;
|
|
36
|
+
const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;
|
|
37
|
+
const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;
|
|
38
|
+
const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;
|
|
39
|
+
const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;
|
|
40
|
+
const identifiers = {
|
|
41
|
+
objectDefIdentifier: `${object.shortApiName}`,
|
|
42
|
+
osdkObjectLinksIdentifier,
|
|
43
|
+
osdkObjectPropsIdentifier,
|
|
44
|
+
osdkObjectStrictPropsIdentifier,
|
|
45
|
+
objectSetIdentifier,
|
|
46
|
+
osdkObjectIdentifier,
|
|
47
|
+
propertyKeysIdentifier
|
|
48
|
+
};
|
|
49
|
+
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
50
|
+
return `${imports}${function () {
|
|
51
|
+
return `import type {
|
|
52
|
+
PropertyKeys as $PropertyKeys,
|
|
53
|
+
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
54
|
+
ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,
|
|
55
|
+
} from "@osdk/api";
|
|
56
|
+
import type {
|
|
57
|
+
ObjectSet as $ObjectSet,
|
|
58
|
+
Osdk as $Osdk,
|
|
59
|
+
OsdkObject as $OsdkObject,
|
|
60
|
+
PropertyValueWireToClient as $PropType,
|
|
61
|
+
SingleLinkAccessor as $SingleLinkAccessor,
|
|
62
|
+
} from "@osdk/api";
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export namespace ${object.shortApiName} {
|
|
66
|
+
|
|
67
|
+
${createPropertyKeys(object)}
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
${createLinks(ontology, object, "Links")}
|
|
71
|
+
|
|
72
|
+
${createProps(object, "Props", false)}
|
|
73
|
+
${createProps(object, "StrictProps", true)}
|
|
74
|
+
|
|
75
|
+
${createObjectSet(object, identifiers)}
|
|
76
|
+
|
|
77
|
+
${createOsdkObject(object, "OsdkObject", identifiers)}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
${createDefinition(object, ontology, object.shortApiName, identifiers)}
|
|
83
|
+
`;
|
|
84
|
+
}()}
|
|
85
|
+
|
|
86
|
+
export const ${object.shortApiName}: ${objectDefIdentifier}
|
|
87
|
+
= {
|
|
88
|
+
type: "${object instanceof EnhancedObjectType ? "object" : "interface"}",
|
|
89
|
+
apiName: "${object.fullApiName}",
|
|
90
|
+
osdkMetadata: $osdkMetadata,
|
|
91
|
+
};`;
|
|
92
|
+
}
|
|
93
|
+
export function createOsdkObject(object, identifier, {
|
|
94
|
+
osdkObjectPropsIdentifier,
|
|
95
|
+
objectDefIdentifier,
|
|
96
|
+
osdkObjectStrictPropsIdentifier,
|
|
97
|
+
osdkObjectLinksIdentifier
|
|
98
|
+
}) {
|
|
99
|
+
object.getCleanedUpDefinition(true);
|
|
100
|
+
return `
|
|
101
|
+
export type ${identifier}<
|
|
102
|
+
OPTIONS extends never | "$notStrict" | "$rid" = never,
|
|
103
|
+
K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},
|
|
104
|
+
|
|
105
|
+
>
|
|
106
|
+
= $Osdk<
|
|
107
|
+
${objectDefIdentifier},
|
|
108
|
+
K | OPTIONS
|
|
109
|
+
>
|
|
110
|
+
|
|
111
|
+
;
|
|
112
|
+
`;
|
|
113
|
+
}
|
|
114
|
+
export function createObjectSet(object, {
|
|
115
|
+
objectDefIdentifier,
|
|
116
|
+
objectSetIdentifier,
|
|
117
|
+
propertyKeysIdentifier,
|
|
118
|
+
osdkObjectIdentifier
|
|
119
|
+
}) {
|
|
120
|
+
return `
|
|
121
|
+
export interface ObjectSet extends
|
|
122
|
+
$ObjectSet<${objectDefIdentifier},
|
|
123
|
+
|
|
124
|
+
${objectSetIdentifier}
|
|
125
|
+
>
|
|
126
|
+
{
|
|
127
|
+
|
|
128
|
+
}
|
|
129
|
+
`;
|
|
130
|
+
}
|
|
131
|
+
function maybeStripNamespace(type, q) {
|
|
132
|
+
if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {
|
|
133
|
+
return q.slice(type.apiNamespace.length + 1);
|
|
134
|
+
} else {
|
|
135
|
+
return q;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
export function createProps(type, identifier, strict) {
|
|
139
|
+
const definition = type.getCleanedUpDefinition(true);
|
|
140
|
+
return `export interface ${identifier} {
|
|
141
|
+
${stringify(definition.properties, {
|
|
142
|
+
"*": (propertyDefinition, _, apiName) => {
|
|
143
|
+
return [`readonly "${maybeStripNamespace(type, apiName)}"${
|
|
144
|
+
// after we convert everything over we can do this:
|
|
145
|
+
// !strict || propertyDefinition.nullable ? "?" : ""
|
|
146
|
+
""}`, `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? "[]" : ""}${propertyDefinition.nullable || !strict ? `| undefined` : ""}`];
|
|
147
|
+
}
|
|
148
|
+
})}
|
|
149
|
+
}`;
|
|
150
|
+
}
|
|
151
|
+
export function createDefinition(object, ontology, identifier, {
|
|
152
|
+
objectDefIdentifier,
|
|
153
|
+
objectSetIdentifier,
|
|
154
|
+
osdkObjectPropsIdentifier,
|
|
155
|
+
osdkObjectStrictPropsIdentifier,
|
|
156
|
+
osdkObjectLinksIdentifier
|
|
157
|
+
}) {
|
|
158
|
+
const definition = object.getCleanedUpDefinition(true);
|
|
159
|
+
return `
|
|
160
|
+
export interface ${identifier} extends ${object instanceof EnhancedObjectType ? `$ObjectTypeDefinition` : `$InterfaceDefinition`}<"${object.fullApiName}", ${objectDefIdentifier}> {
|
|
161
|
+
osdkMetadata: typeof $osdkMetadata;
|
|
162
|
+
type: "${object instanceof EnhancedObjectType ? "object" : "interface"}";
|
|
163
|
+
apiName: "${object.fullApiName}";
|
|
164
|
+
__DefinitionMetadata?: {
|
|
165
|
+
objectSet: ${objectSetIdentifier};
|
|
166
|
+
props: ${osdkObjectPropsIdentifier};
|
|
167
|
+
linksType: ${osdkObjectLinksIdentifier};
|
|
168
|
+
strictProps: ${osdkObjectStrictPropsIdentifier};
|
|
169
|
+
${stringify(definition, {
|
|
170
|
+
links: () => `{
|
|
171
|
+
${stringify(definition.links, {
|
|
172
|
+
"*": definition => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition.targetType).getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`
|
|
173
|
+
})}
|
|
174
|
+
}`,
|
|
175
|
+
properties: () => `{
|
|
176
|
+
${stringify(definition.properties, {
|
|
177
|
+
"*": (propertyDefinition, _, apiName) => [`${propertyJsdoc(propertyDefinition, {
|
|
178
|
+
apiName
|
|
179
|
+
})}"${maybeStripNamespace(object, apiName)}"`, `$PropertyDef<"${propertyDefinition.type}", "${propertyDefinition.nullable ? "nullable" : "non-nullable"}", "${propertyDefinition.multiplicity ? "array" : "single"}">`]
|
|
180
|
+
})}
|
|
181
|
+
}`
|
|
182
|
+
})}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
`;
|
|
186
|
+
}
|
|
187
|
+
export function createLinks(ontology, object, identifier) {
|
|
188
|
+
const definition = object.getCleanedUpDefinition(true);
|
|
189
|
+
return `
|
|
190
|
+
${Object.keys(definition.links).length === 0 ? `export type ${identifier} = {};` : `
|
|
191
|
+
export interface ${identifier} {
|
|
192
|
+
${stringify(definition.links, {
|
|
193
|
+
"*": (definition, _, key) => {
|
|
194
|
+
const linkTarget = ontology.requireObjectType(definition.targetType).getImportedDefinitionIdentifier(true);
|
|
195
|
+
return [`readonly ${key}`, `${definition.multiplicity ? `${linkTarget}.ObjectSet` : `$SingleLinkAccessor<${linkTarget}>`}
|
|
196
|
+
`];
|
|
197
|
+
}
|
|
198
|
+
})}
|
|
199
|
+
}
|
|
200
|
+
`}`;
|
|
201
|
+
}
|
|
202
|
+
export function createPropertyKeys(type) {
|
|
203
|
+
return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map(a => maybeStripNamespace(type, a)).map(a => `"${a}"`).join("|")};`;
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=wireObjectTypeV2ToSdkObjectConstV2.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireObjectTypeV2ToSdkObjectConstV2.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedObjectType","getObjectImports","propertyJsdoc","deleteUndefineds","stringify","getObjectDefIdentifier","name","v2","wireObjectTypeV2ToSdkObjectConstV2","wireObject","ontology","currentFilePath","object","requireObjectType","objectType","apiName","uniqueLinkTargetTypes","Set","linkTypes","map","a","objectTypeApiName","definition","raw","objectDefIdentifier","getDefinitionIdentifier","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","identifiers","imports","createPropertyKeys","createLinks","createProps","createObjectSet","createOsdkObject","createDefinition","fullApiName","identifier","getCleanedUpDefinition","maybeStripNamespace","type","q","apiNamespace","startsWith","slice","length","strict","properties","*","propertyDefinition","_","JSON","multiplicity","nullable","links","targetType","getImportedDefinitionIdentifier","Object","keys","key","linkTarget","join"],"sources":["wireObjectTypeV2ToSdkObjectConstV2.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { EnhancedObjectType } from \"../GenerateContext/EnhancedObjectType.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { propertyJsdoc } from \"../shared/propertyJsdoc.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nexport function getObjectDefIdentifier(name, v2) {\n return v2 ? name : `${name}Def`;\n}\n/** @internal */\nexport function wireObjectTypeV2ToSdkObjectConstV2(wireObject, { ontology }, currentFilePath) {\n const object = ontology.requireObjectType(wireObject.objectType.apiName, true);\n const uniqueLinkTargetTypes = new Set(wireObject.linkTypes.map(a => ontology.requireObjectType(a.objectTypeApiName, false)));\n const definition = deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(object.raw, true));\n const objectDefIdentifier = object.getDefinitionIdentifier(true);\n const objectSetIdentifier = `${object.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${object.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${object.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${object.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `${object.shortApiName}.Links`;\n const osdkObjectIdentifier = `${object.shortApiName}.OsdkObject`;\n const identifiers = {\n objectDefIdentifier: `${object.shortApiName}`,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n function getV2Types() {\n return `import type {\n PropertyKeys as $PropertyKeys, \n ObjectTypeDefinition as $ObjectTypeDefinition,\n ObjectTypeLinkDefinition as $ObjectTypeLinkDefinition,\n } from \"@osdk/api\";\n import type {\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n OsdkObject as $OsdkObject,\n PropertyValueWireToClient as $PropType,\n SingleLinkAccessor as $SingleLinkAccessor,\n } from \"@osdk/api\";\n\n\n export namespace ${object.shortApiName} {\n\n ${createPropertyKeys(object)}\n\n\n ${createLinks(ontology, object, \"Links\")}\n\n ${createProps(object, \"Props\", false)}\n ${createProps(object, \"StrictProps\", true)}\n\n ${createObjectSet(object, identifiers)}\n \n ${createOsdkObject(object, \"OsdkObject\", identifiers)}\n } \n\n\n\n ${createDefinition(object, ontology, object.shortApiName, identifiers)}\n `;\n }\n const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);\n return `${imports}${getV2Types()}\n\n export const ${object.shortApiName}: ${objectDefIdentifier}\n = {\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\",\n apiName: \"${object.fullApiName}\",\n osdkMetadata: $osdkMetadata, \n };`;\n}\nexport function createOsdkObject(object, identifier, { osdkObjectPropsIdentifier, objectDefIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export type ${identifier}<\n OPTIONS extends never | \"$notStrict\" | \"$rid\" = never,\n K extends keyof ${osdkObjectPropsIdentifier}= keyof ${osdkObjectPropsIdentifier},\n\n > \n = $Osdk<\n ${objectDefIdentifier}, \n K | OPTIONS\n > \n \n ;\n `;\n}\nexport function createObjectSet(object, { objectDefIdentifier, objectSetIdentifier, propertyKeysIdentifier, osdkObjectIdentifier, }) {\n return `\nexport interface ObjectSet extends \n$ObjectSet<${objectDefIdentifier},\n\n${objectSetIdentifier}\n>\n{\n\n}\n`;\n}\nfunction maybeStripNamespace(type, q) {\n if (type.apiNamespace && q.startsWith(`${type.apiNamespace}.`)) {\n return q.slice(type.apiNamespace.length + 1);\n }\n else {\n return q;\n }\n}\nexport function createProps(type, identifier, strict) {\n const definition = type.getCleanedUpDefinition(true);\n return `export interface ${identifier} {\n${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => {\n return [\n `readonly \"${maybeStripNamespace(type, apiName)}\"${\n // after we convert everything over we can do this:\n // !strict || propertyDefinition.nullable ? \"?\" : \"\"\n \"\"}`,\n `$PropType[${JSON.stringify(propertyDefinition.type)}]${propertyDefinition.multiplicity ? \"[]\" : \"\"}${propertyDefinition.nullable || !strict ? `| undefined` : \"\"}`,\n ];\n },\n })}\n }`;\n}\nexport function createDefinition(object, ontology, identifier, { objectDefIdentifier, objectSetIdentifier, osdkObjectPropsIdentifier, osdkObjectStrictPropsIdentifier, osdkObjectLinksIdentifier, }) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n export interface ${identifier} extends ${object instanceof EnhancedObjectType\n ? `$ObjectTypeDefinition`\n : `$InterfaceDefinition`}<\"${object.fullApiName}\", ${objectDefIdentifier}> {\n osdkMetadata: typeof $osdkMetadata;\n type: \"${object instanceof EnhancedObjectType ? \"object\" : \"interface\"}\";\n apiName: \"${object.fullApiName}\";\n __DefinitionMetadata?: {\n objectSet: ${objectSetIdentifier};\n props: ${osdkObjectPropsIdentifier};\n linksType: ${osdkObjectLinksIdentifier};\n strictProps: ${osdkObjectStrictPropsIdentifier};\n ${stringify(definition, {\n links: (_value) => `{\n ${stringify(definition.links, {\n \"*\": (definition) => `$ObjectTypeLinkDefinition<${ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true)}, ${definition.multiplicity}>`,\n })}\n }`,\n properties: (_value) => (`{\n ${stringify(definition.properties, {\n \"*\": (propertyDefinition, _, apiName) => [\n `${propertyJsdoc(propertyDefinition, { apiName })}\"${maybeStripNamespace(object, apiName)}\"`,\n `$PropertyDef<\"${propertyDefinition.type}\", \"${propertyDefinition.nullable ? \"nullable\" : \"non-nullable\"}\", \"${propertyDefinition.multiplicity ? \"array\" : \"single\"}\">`,\n ],\n })}\n }`),\n })}\n } \n}\n `;\n}\nexport function createLinks(ontology, object, identifier) {\n const definition = object.getCleanedUpDefinition(true);\n return `\n ${Object.keys(definition.links).length === 0\n ? `export type ${identifier} = {};`\n : `\n export interface ${identifier} {\n${stringify(definition.links, {\n \"*\": (definition, _, key) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(true);\n return [\n `readonly ${key}`,\n `${definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `$SingleLinkAccessor<${linkTarget}>`}\n `,\n ];\n },\n })}\n }\n `}`;\n}\nexport function createPropertyKeys(type) {\n return `export type PropertyKeys = ${Object.keys(type.getCleanedUpDefinition(true).properties).map((a) => maybeStripNamespace(type, a)).map(a => `\"${a}\"`).join(\"|\")};`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,kBAAkB,QAAQ,0CAA0C;AAC7E,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,aAAa,QAAQ,4BAA4B;AAC1D,SAASC,gBAAgB,QAAQ,6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List":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateWireOntologyAssumptions.d.ts","sourceRoot":"","sources":["../../src/validateWireOntologyAssumptions.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAE1E,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,sBAAsB,QAgBjC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
import invariant from "tiny-invariant";
|
|
17
|
+
export function validateWireOntologyAssumptions(ontology) {
|
|
18
|
+
invariantNotStartWithDollarSign(ontology.ontology.apiName);
|
|
19
|
+
for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {
|
|
20
|
+
invariantMapKeyMatchesApiName(objectKey, objectType.objectType);
|
|
21
|
+
invariantNotStartWithDollarSign(objectType.objectType.apiName);
|
|
22
|
+
for (const [propertyKey, propertyType] of Object.entries(objectType.objectType.properties)) {
|
|
23
|
+
invariantNotStartWithDollarSign(propertyKey);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function invariantMapKeyMatchesApiName(key, value) {
|
|
28
|
+
!(key === value.apiName) ? invariant(false, "Key in the map should be the same as the apiName.") : void 0;
|
|
29
|
+
}
|
|
30
|
+
function invariantNotStartWithDollarSign(value) {
|
|
31
|
+
!!value.startsWith("$") ? invariant(false, "apiName should not start with $") : void 0;
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=validateWireOntologyAssumptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validateWireOntologyAssumptions.js","names":["invariant","validateWireOntologyAssumptions","ontology","invariantNotStartWithDollarSign","apiName","objectKey","objectType","Object","entries","objectTypes","invariantMapKeyMatchesApiName","propertyKey","propertyType","properties","key","value","startsWith"],"sources":["validateWireOntologyAssumptions.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport invariant from \"tiny-invariant\";\nexport function validateWireOntologyAssumptions(ontology) {\n invariantNotStartWithDollarSign(ontology.ontology.apiName);\n for (const [objectKey, objectType] of Object.entries(ontology.objectTypes)) {\n invariantMapKeyMatchesApiName(objectKey, objectType.objectType);\n invariantNotStartWithDollarSign(objectType.objectType.apiName);\n for (const [propertyKey, propertyType] of Object.entries(objectType.objectType.properties)) {\n invariantNotStartWithDollarSign(propertyKey);\n }\n }\n}\nfunction invariantMapKeyMatchesApiName(key, value) {\n invariant(key === value.apiName, \"Key in the map should be the same as the apiName.\");\n}\nfunction invariantNotStartWithDollarSign(value) {\n invariant(!value.startsWith(\"$\"), \"apiName should not start with $\");\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,+BAA+BA,CAACC,QAAQ,EAAE;EACtDC,+BAA+B,CAACD,QAAQ,CAACA,QAAQ,CAACE,OAAO,CAAC;EAC1D,KAAK,MAAM,CAACC,SAAS,EAAEC,UAAU,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,QAAQ,CAACO,WAAW,CAAC,EAAE;IACxEC,6BAA6B,CAACL,SAAS,EAAEC,UAAU,CAACA,UAAU,CAAC;IAC/DH,+BAA+B,CAACG,UAAU,CAACA,UAAU,CAACF,OAAO,CAAC;IAC9D,KAAK,MAAM,CAACO,WAAW,EAAEC,YAAY,CAAC,IAAIL,MAAM,CAACC,OAAO,CAACF,UAAU,CAACA,UAAU,CAACO,UAAU,CAAC,EAAE;MACxFV,+BAA+B,CAACQ,WAAW,CAAC;IAChD;EACJ;AACJ;AACA,SAASD,6BAA6BA,CAACI,GAAG,EAAEC,KAAK,EAAE;EAC/C,EAAUD,GAAG,KAAKC,KAAK,CAACX,OAAO,IAA/BJ,SAAS,QAAwB,mDAAmD;AACxF;AACA,SAASG,+BAA+BA,CAACY,KAAK,EAAE;EAC5C,CAAU,CAACA,KAAK,CAACC,UAAU,CAAC,GAAG,CAAC,GAAhChB,SAAS,QAAyB,iCAAiC;AACvE","ignoreList":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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 {};
|
|
17
|
+
//# sourceMappingURL=EnhanceCommon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhanceCommon.js","names":[],"sources":["EnhanceCommon.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
17
|
+
export class EnhancedAction extends EnhancedBase {
|
|
18
|
+
raw;
|
|
19
|
+
constructor(common, raw) {
|
|
20
|
+
super(common, raw, raw.apiName, "./ontology/actions");
|
|
21
|
+
this.raw = raw;
|
|
22
|
+
}
|
|
23
|
+
get description() {
|
|
24
|
+
return this.raw.description;
|
|
25
|
+
}
|
|
26
|
+
get parameters() {
|
|
27
|
+
return this.raw.parameters;
|
|
28
|
+
}
|
|
29
|
+
get operations() {
|
|
30
|
+
return this.raw.operations;
|
|
31
|
+
}
|
|
32
|
+
get paramsIdentifier() {
|
|
33
|
+
return `${this.shortApiName}.Params`;
|
|
34
|
+
}
|
|
35
|
+
get definitionIdentifier() {
|
|
36
|
+
return `${this.shortApiName}.Definition`;
|
|
37
|
+
}
|
|
38
|
+
get definitionParamsIdentifier() {
|
|
39
|
+
return `${this.shortApiName}.ParamsDefinition`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=EnhancedAction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedAction.js","names":["EnhancedBase","EnhancedAction","raw","constructor","common","apiName","description","parameters","operations","paramsIdentifier","shortApiName","definitionIdentifier","definitionParamsIdentifier"],"sources":["EnhancedAction.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EnhancedBase } from \"./EnhancedBase.js\";\nexport class EnhancedAction extends EnhancedBase {\n raw;\n constructor(common, raw) {\n super(common, raw, raw.apiName, \"./ontology/actions\");\n this.raw = raw;\n }\n get description() {\n return this.raw.description;\n }\n get parameters() {\n return this.raw.parameters;\n }\n get operations() {\n return this.raw.operations;\n }\n get paramsIdentifier() {\n return `${this.shortApiName}.Params`;\n }\n get definitionIdentifier() {\n return `${this.shortApiName}.Definition`;\n }\n get definitionParamsIdentifier() {\n return `${this.shortApiName}.ParamsDefinition`;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,QAAQ,mBAAmB;AAChD,OAAO,MAAMC,cAAc,SAASD,YAAY,CAAC;EAC7CE,GAAG;EACHC,WAAWA,CAACC,MAAM,EAAEF,GAAG,EAAE;IACrB,KAAK,CAACE,MAAM,EAAEF,GAAG,EAAEA,GAAG,CAACG,OAAO,EAAE,oBAAoB,CAAC;IACrD,IAAI,CAACH,GAAG,GAAGA,GAAG;EAClB;EACA,IAAII,WAAWA,CAAA,EAAG;IACd,OAAO,IAAI,CAACJ,GAAG,CAACI,WAAW;EAC/B;EACA,IAAIC,UAAUA,CAAA,EAAG;IACb,OAAO,IAAI,CAACL,GAAG,CAACK,UAAU;EAC9B;EACA,IAAIC,UAAUA,CAAA,EAAG;IACb,OAAO,IAAI,CAACN,GAAG,CAACM,UAAU;EAC9B;EACA,IAAIC,gBAAgBA,CAAA,EAAG;IACnB,OAAO,GAAG,IAAI,CAACC,YAAY,SAAS;EACxC;EACA,IAAIC,oBAAoBA,CAAA,EAAG;IACvB,OAAO,GAAG,IAAI,CAACD,YAAY,aAAa;EAC5C;EACA,IAAIE,0BAA0BA,CAAA,EAAG;IAC7B,OAAO,GAAG,IAAI,CAACF,YAAY,mBAAmB;EAClD;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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
|
+
import * as path from "node:path";
|
|
17
|
+
export class AbstractImportable {
|
|
18
|
+
_common;
|
|
19
|
+
shortApiName;
|
|
20
|
+
fullApiName;
|
|
21
|
+
apiNamespace;
|
|
22
|
+
/**
|
|
23
|
+
* Either a path relative to the ourDir (e.g. "./ontology/objects/foo.js") or a normal
|
|
24
|
+
* module import (e.g. "@something/foo")/
|
|
25
|
+
*/
|
|
26
|
+
importPath;
|
|
27
|
+
uniqueImportName;
|
|
28
|
+
isLocal;
|
|
29
|
+
sourcePackage;
|
|
30
|
+
constructor(common, fullApiName, basePath) {
|
|
31
|
+
this._common = common;
|
|
32
|
+
this.fullApiName = fullApiName;
|
|
33
|
+
[this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);
|
|
34
|
+
const {
|
|
35
|
+
ontologyApiNamespace,
|
|
36
|
+
apiNamespacePackageMap,
|
|
37
|
+
importExt
|
|
38
|
+
} = common;
|
|
39
|
+
this.isLocal = ontologyApiNamespace === this.apiNamespace;
|
|
40
|
+
this.sourcePackage = this.apiNamespace && !this.isLocal ? apiNamespacePackageMap.get(this.apiNamespace) : undefined;
|
|
41
|
+
this.importPath = this.isLocal ? `${basePath}/${this.shortApiName}${importExt}` : this.sourcePackage;
|
|
42
|
+
this.uniqueImportName = this.shortApiName;
|
|
43
|
+
}
|
|
44
|
+
getImportPathRelTo = filePath => {
|
|
45
|
+
if (this.importPath.startsWith(".")) {
|
|
46
|
+
const result = path.relative(path.dirname(filePath), this.importPath).split(path.sep).join("/");
|
|
47
|
+
if (result.startsWith(".")) {
|
|
48
|
+
return result;
|
|
49
|
+
} else {
|
|
50
|
+
return `./${result}`;
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
return this.importPath;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export class EnhancedBase extends AbstractImportable {
|
|
58
|
+
raw;
|
|
59
|
+
constructor(common, raw, fullApiName, basePath) {
|
|
60
|
+
super(common, fullApiName, basePath);
|
|
61
|
+
this.raw = raw;
|
|
62
|
+
if (!this.isLocal && !this.sourcePackage) {
|
|
63
|
+
throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export function extractNamespace(fqApiName) {
|
|
68
|
+
const last = fqApiName.lastIndexOf(".");
|
|
69
|
+
if (last === -1) return [undefined, fqApiName];
|
|
70
|
+
return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=EnhancedBase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedBase.js","names":["path","AbstractImportable","_common","shortApiName","fullApiName","apiNamespace","importPath","uniqueImportName","isLocal","sourcePackage","constructor","common","basePath","extractNamespace","ontologyApiNamespace","apiNamespacePackageMap","importExt","get","undefined","getImportPathRelTo","filePath","startsWith","result","relative","dirname","split","sep","join","EnhancedBase","raw","Error","fqApiName","last","lastIndexOf","slice"],"sources":["EnhancedBase.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as path from \"node:path\";\nexport class AbstractImportable {\n _common;\n shortApiName;\n fullApiName;\n apiNamespace;\n /**\n * Either a path relative to the ourDir (e.g. \"./ontology/objects/foo.js\") or a normal\n * module import (e.g. \"@something/foo\")/\n */\n importPath;\n uniqueImportName;\n isLocal;\n sourcePackage;\n constructor(common, fullApiName, basePath) {\n this._common = common;\n this.fullApiName = fullApiName;\n [this.apiNamespace, this.shortApiName] = extractNamespace(this.fullApiName);\n const { ontologyApiNamespace, apiNamespacePackageMap, importExt } = common;\n this.isLocal = ontologyApiNamespace === this.apiNamespace;\n this.sourcePackage = this.apiNamespace && !this.isLocal\n ? apiNamespacePackageMap.get(this.apiNamespace)\n : undefined;\n this.importPath = this.isLocal\n ? `${basePath}/${this.shortApiName}${importExt}`\n : this.sourcePackage;\n this.uniqueImportName = this.shortApiName;\n }\n getImportPathRelTo = (filePath) => {\n if (this.importPath.startsWith(\".\")) {\n const result = path.relative(path.dirname(filePath), this.importPath)\n .split(path.sep).join(\"/\");\n if (result.startsWith(\".\")) {\n return result;\n }\n else {\n return `./${result}`;\n }\n }\n else {\n return this.importPath;\n }\n };\n}\nexport class EnhancedBase extends AbstractImportable {\n raw;\n constructor(common, raw, fullApiName, basePath) {\n super(common, fullApiName, basePath);\n this.raw = raw;\n if (!this.isLocal && !this.sourcePackage) {\n throw new Error(`Expected { ns:'${this.apiNamespace}', shortName: '${this.shortApiName}'} to be in namespace '${common.ontologyApiNamespace}' or in a provided package mapping`);\n }\n }\n}\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,IAAI,MAAM,WAAW;AACjC,OAAO,MAAMC,kBAAkB,CAA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AOC,MAAM;MACjB,CAAC,MACI;QACD,OAAO,KAAKA,MAAM,EAAE;MACxB;IACJ,CAAC,MACI;MACD,OAAO,IAAI,CAAChB,UAAU;IAC1B;EACJ,CAAC;AACL;AACA,OAAO,MAAMsB,YAAY,SAAS3B,kBAAkB,CAAC;EACjD4B,GAAG;EACHnB,WAAWA,CAACC,MAAM,EAAEkB,GAAG,EAAEzB,WAAW,EAAEQ,QAAQ,EAAE;IAC5C,KAAK,CAACD,MAAM,EAAEP,WAAW,EAAEQ,QAAQ,CAAC;IACpC,IAAI,CAACiB,GAAG,GAAGA,GAAG;IACd,IAAI,CAAC,IAAI,CAACrB,OAAO,IAAI,CAAC,IAAI,CAACC,aAAa,EAAE;MACtC,MAAM,IAAIqB,KAAK,CAAC,kBAAkB,IAAI,CAACzB,YAAY,kBAAkB,IAAI,CAACF,YAAY,0BAA0BQ,MAAM,CAACG,oBAAoB,oCAAoC,CAAC;IACpL;EACJ;AACJ;AACA,OAAO,SAASD,gBAAgBA,CAACkB,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OAAO,CAACd,SAAS,EAAEa,SAAS,CAAC;EACjC,OAAO,CAACA,SAAS,CAACG,KAAK,CAAC,CAAC,EAAEF,IAAI,CAAC,EAAED,SAAS,CAACG,KAAK,CAACF,IAAI,GAAG,CAAC,CAAC,CAAC;AAChE","ignoreList":[]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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
|
+
import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
|
|
17
|
+
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
18
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
19
|
+
export class EnhancedInterfaceType extends EnhancedBase {
|
|
20
|
+
raw;
|
|
21
|
+
constructor(common, raw) {
|
|
22
|
+
super(common, raw, raw.apiName, "./ontology/interfaces");
|
|
23
|
+
this.raw = raw;
|
|
24
|
+
}
|
|
25
|
+
getDefinitionIdentifier(v2) {
|
|
26
|
+
return v2 ? this.shortApiName : `${this.shortApiName}Def`;
|
|
27
|
+
}
|
|
28
|
+
getImportedDefinitionIdentifier(v2) {
|
|
29
|
+
return this.getDefinitionIdentifier(v2);
|
|
30
|
+
}
|
|
31
|
+
get properties() {
|
|
32
|
+
return this.raw.properties;
|
|
33
|
+
}
|
|
34
|
+
getCleanedUpDefinition(v2) {
|
|
35
|
+
return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=EnhancedInterfaceType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","deleteUndefineds","EnhancedBase","EnhancedInterfaceType","raw","constructor","common","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","properties","getCleanedUpDefinition"],"sources":["EnhancedInterfaceType.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\nexport class EnhancedInterfaceType extends EnhancedBase {\n raw;\n constructor(common, raw) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n this.raw = raw;\n }\n getDefinitionIdentifier(v2) {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n getImportedDefinitionIdentifier(v2) {\n return this.getDefinitionIdentifier(v2);\n }\n get properties() {\n return this.raw.properties;\n }\n getCleanedUpDefinition(v2) {\n return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAO,MAAMC,qBAAqB,SAASD,YAAY,CAAC;EACpDE,GAAG;EACHC,WAAWA,CAACC,MAAM,EAAEF,GAAG,EAAE;IACrB,KAAK,CAACE,MAAM,EAAEF,GAAG,EAAEA,GAAG,CAACG,OAAO,EAAE,uBAAuB,CAAC;IACxD,IAAI,CAACH,GAAG,GAAGA,GAAG;EAClB;EACAI,uBAAuBA,CAACC,EAAE,EAAE;IACxB,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC7D;EACAC,+BAA+BA,CAACF,EAAE,EAAE;IAChC,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EAC3C;EACA,IAAIG,UAAUA,CAAA,EAAG;IACb,OAAO,IAAI,CAACR,GAAG,CAACQ,UAAU;EAC9B;EACAC,sBAAsBA,CAACJ,EAAE,EAAE;IACvB,OAAOR,gBAAgB,CAACD,mDAAmD,CAAC,IAAI,CAACI,GAAG,EAAEK,EAAE,CAAC,CAAC;EAC9F;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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
|
+
import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
|
|
17
|
+
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
18
|
+
import { EnhancedBase } from "./EnhancedBase.js";
|
|
19
|
+
export class EnhancedObjectType extends EnhancedBase {
|
|
20
|
+
raw;
|
|
21
|
+
constructor(common, raw) {
|
|
22
|
+
super(common, raw, raw.objectType.apiName, "./ontology/objects");
|
|
23
|
+
this.raw = raw;
|
|
24
|
+
}
|
|
25
|
+
getDefinitionIdentifier(v2) {
|
|
26
|
+
return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;
|
|
27
|
+
}
|
|
28
|
+
getImportedDefinitionIdentifier(v2) {
|
|
29
|
+
return this.getDefinitionIdentifier(v2);
|
|
30
|
+
}
|
|
31
|
+
getCleanedUpDefinition(v2) {
|
|
32
|
+
return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(this.raw, v2));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=EnhancedObjectType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","deleteUndefineds","EnhancedBase","EnhancedObjectType","raw","constructor","common","objectType","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","getCleanedUpDefinition"],"sources":["EnhancedObjectType.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\nexport class EnhancedObjectType extends EnhancedBase {\n raw;\n constructor(common, raw) {\n super(common, raw, raw.objectType.apiName, \"./ontology/objects\");\n this.raw = raw;\n }\n getDefinitionIdentifier(v2) {\n return v2 ? `${this.shortApiName}` : `${this.shortApiName}Def`;\n }\n getImportedDefinitionIdentifier(v2) {\n return this.getDefinitionIdentifier(v2);\n }\n getCleanedUpDefinition(v2) {\n return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(this.raw, v2));\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,YAAY,QAAQ,mBAAmB;AAChD,OAAO,MAAMC,kBAAkB,SAASD,YAAY,CAAC;EACjDE,GAAG;EACHC,WAAWA,CAACC,MAAM,EAAEF,GAAG,EAAE;IACrB,KAAK,CAACE,MAAM,EAAEF,GAAG,EAAEA,GAAG,CAACG,UAAU,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAChE,IAAI,CAACJ,GAAG,GAAGA,GAAG;EAClB;EACAK,uBAAuBA,CAACC,EAAE,EAAE;IACxB,OAAOA,EAAE,GAAG,GAAG,IAAI,CAACC,YAAY,EAAE,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAClE;EACAC,+BAA+BA,CAACF,EAAE,EAAE;IAChC,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EAC3C;EACAG,sBAAsBA,CAACH,EAAE,EAAE;IACvB,OAAOT,gBAAgB,CAACD,6CAA6C,CAAC,IAAI,CAACI,GAAG,EAAEM,EAAE,CAAC,CAAC;EACxF;AACJ","ignoreList":[]}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 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
|
+
import { EnhancedAction } from "./EnhancedAction.js";
|
|
17
|
+
import { extractNamespace } from "./EnhancedBase.js";
|
|
18
|
+
import { EnhancedInterfaceType } from "./EnhancedInterfaceType.js";
|
|
19
|
+
import { EnhancedObjectType } from "./EnhancedObjectType.js";
|
|
20
|
+
import { EnhancedQuery } from "./EnhancedQuery.js";
|
|
21
|
+
import { EnhancedSharedPropertyType } from "./EnhancedSharedPropertyType.js";
|
|
22
|
+
import { ForeignType } from "./ForeignType.js";
|
|
23
|
+
export class EnhancedOntologyDefinition {
|
|
24
|
+
ontology;
|
|
25
|
+
objectTypes;
|
|
26
|
+
actionTypes;
|
|
27
|
+
queryTypes;
|
|
28
|
+
interfaceTypes;
|
|
29
|
+
sharedPropertyTypes;
|
|
30
|
+
#foreignTypes = {};
|
|
31
|
+
raw;
|
|
32
|
+
common;
|
|
33
|
+
constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {
|
|
34
|
+
this.common = {
|
|
35
|
+
apiNamespacePackageMap,
|
|
36
|
+
enhancedOntology: this,
|
|
37
|
+
importExt,
|
|
38
|
+
ontologyApiNamespace
|
|
39
|
+
};
|
|
40
|
+
this.raw = raw;
|
|
41
|
+
this.ontology = raw.ontology;
|
|
42
|
+
this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);
|
|
43
|
+
this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);
|
|
44
|
+
this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);
|
|
45
|
+
this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);
|
|
46
|
+
this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);
|
|
47
|
+
}
|
|
48
|
+
#createRequireType = type => {
|
|
49
|
+
return (fullApiName, localOnly) => {
|
|
50
|
+
const ret = this[type][fullApiName];
|
|
51
|
+
if (!ret) {
|
|
52
|
+
const [apiNamespace, shortApiName] = extractNamespace(fullApiName);
|
|
53
|
+
if (localOnly || !apiNamespace) {
|
|
54
|
+
throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);
|
|
55
|
+
}
|
|
56
|
+
if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {
|
|
57
|
+
throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);
|
|
58
|
+
}
|
|
59
|
+
const ret = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);
|
|
60
|
+
this.#foreignTypes[fullApiName] = ret;
|
|
61
|
+
return ret;
|
|
62
|
+
}
|
|
63
|
+
return ret;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
requireObjectType = this.#createRequireType("objectTypes");
|
|
67
|
+
requireInterfaceType = this.#createRequireType("interfaceTypes");
|
|
68
|
+
requireActionType = this.#createRequireType("actionTypes");
|
|
69
|
+
requireQueryType = this.#createRequireType("queryTypes");
|
|
70
|
+
requireSharedPropertyType = this.#createRequireType("sharedPropertyTypes");
|
|
71
|
+
}
|
|
72
|
+
function remap(r, common, Constructor) {
|
|
73
|
+
return Object.fromEntries(Object.entries(r ?? {}).map(([fullApiName, v]) => {
|
|
74
|
+
return [fullApiName, new Constructor(common, v)];
|
|
75
|
+
}).sort((a, b) => a[0].localeCompare(b[0])));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=EnhancedOntologyDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EnhancedOntologyDefinition.js","names":["EnhancedAction","extractNamespace","EnhancedInterfaceType","EnhancedObjectType","EnhancedQuery","EnhancedSharedPropertyType","ForeignType","EnhancedOntologyDefinition","ontology","objectTypes","actionTypes","queryTypes","interfaceTypes","sharedPropertyTypes","foreignTypes","raw","common","constructor","ontologyApiNamespace","apiNamespacePackageMap","importExt","enhancedOntology","remap","createRequireType","type","fullApiName","localOnly","ret","apiNamespace","shortApiName","Error","has","requireObjectType","requireInterfaceType","requireActionType","requireQueryType","requireSharedPropertyType","r","Constructor","Object","fromEntries","entries","map","v","sort","a","b","localeCompare"],"sources":["EnhancedOntologyDefinition.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { EnhancedAction } from \"./EnhancedAction.js\";\nimport { extractNamespace } from \"./EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"./EnhancedInterfaceType.js\";\nimport { EnhancedObjectType } from \"./EnhancedObjectType.js\";\nimport { EnhancedQuery } from \"./EnhancedQuery.js\";\nimport { EnhancedSharedPropertyType } from \"./EnhancedSharedPropertyType.js\";\nimport { ForeignType } from \"./ForeignType.js\";\nexport class EnhancedOntologyDefinition {\n ontology;\n objectTypes;\n actionTypes;\n queryTypes;\n interfaceTypes;\n sharedPropertyTypes;\n #foreignTypes = {};\n raw;\n common;\n constructor(raw, ontologyApiNamespace, apiNamespacePackageMap, importExt) {\n this.common = {\n apiNamespacePackageMap,\n enhancedOntology: this,\n importExt,\n ontologyApiNamespace,\n };\n this.raw = raw;\n this.ontology = raw.ontology;\n this.objectTypes = remap(raw.objectTypes, this.common, EnhancedObjectType);\n this.actionTypes = remap(raw.actionTypes, this.common, EnhancedAction);\n this.queryTypes = remap(raw.queryTypes, this.common, EnhancedQuery);\n this.interfaceTypes = remap(raw.interfaceTypes, this.common, EnhancedInterfaceType);\n this.sharedPropertyTypes = remap(raw.sharedPropertyTypes, this.common, EnhancedSharedPropertyType);\n }\n #createRequireType = (type) => {\n return (fullApiName, localOnly) => {\n const ret = this[type][fullApiName];\n if (!ret) {\n const [apiNamespace, shortApiName] = extractNamespace(fullApiName);\n if (localOnly || !apiNamespace) {\n throw new Error(`Unable to find ${type}: No entry for '${fullApiName}`);\n }\n if (!this.common.apiNamespacePackageMap.has(apiNamespace)) {\n throw new Error(`Unable to find ${type}: Unknown namespace '${apiNamespace}'`);\n }\n const ret = this.#foreignTypes[fullApiName] ?? new ForeignType(this.common, type, apiNamespace, shortApiName);\n this.#foreignTypes[fullApiName] = ret;\n return ret;\n }\n return ret;\n };\n };\n requireObjectType = this.#createRequireType(\"objectTypes\");\n requireInterfaceType = this.#createRequireType(\"interfaceTypes\");\n requireActionType = this.#createRequireType(\"actionTypes\");\n requireQueryType = this.#createRequireType(\"queryTypes\");\n requireSharedPropertyType = this.#createRequireType(\"sharedPropertyTypes\");\n}\nfunction remap(r, common, Constructor) {\n return Object.fromEntries(Object.entries(r ?? {}).map(([fullApiName, v]) => {\n return [\n fullApiName,\n new Constructor(common, v),\n ];\n }).sort((a, b) => a[0].localeCompare(b[0])));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,cAAc,QAAQ,qBAAqB;AACpD,SAASC,gBAAgB,QAAQ,mBAAmB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,kBAAkB,QAAQ,yBAAyB;AAC5D,SAASC,aAAa,QAAQ,oBAAoB;AAClD,SAASC,0BAA0B,QAAQ,iCAAiC;AAC5E,SAASC,WAAW,QAAQ,kBAAkB;AAC9C,OAAO,MAAMC,0BAA0B,CAAC;EACpCC,QAAQ;EACRC,WAAW;EACXC,WAAW;EACXC,UAAU;EACVC,cAAc;EACdC,mBAAmB;EACnB,CAACC,YAAY,GAAG,CAAC,CAAC;EAClBC,GAAG;EACHC,MAAM;EACNC,WAAWA,CAACF,GAAG,EAAEG,oBAAoB,EAAEC,sBAAsB,EAAEC,S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