telepact 1.0.0-alpha.120
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/README.md +71 -0
- package/dist/LICENSE +201 -0
- package/dist/NOTICE +15 -0
- package/dist/inc/auth.telepact.json +29 -0
- package/dist/inc/internal.telepact.json +258 -0
- package/dist/inc/json-schema.json +245 -0
- package/dist/inc/mock-internal.telepact.json +157 -0
- package/dist/index.cjs.js +5186 -0
- package/dist/index.esm.js +5167 -0
- package/dist/index.iife.js +5188 -0
- package/dist/src/Client.d.ts +20 -0
- package/dist/src/Client.js +59 -0
- package/dist/src/Client.js.map +1 -0
- package/dist/src/DefaultSerialization.d.ts +9 -0
- package/dist/src/DefaultSerialization.js +35 -0
- package/dist/src/DefaultSerialization.js.map +1 -0
- package/dist/src/Message.d.ts +7 -0
- package/dist/src/Message.js +32 -0
- package/dist/src/Message.js.map +1 -0
- package/dist/src/MockServer.d.ts +27 -0
- package/dist/src/MockServer.js +68 -0
- package/dist/src/MockServer.js.map +1 -0
- package/dist/src/MockTelepactSchema.d.ts +17 -0
- package/dist/src/MockTelepactSchema.js +45 -0
- package/dist/src/MockTelepactSchema.js.map +1 -0
- package/dist/src/RandomGenerator.d.ts +15 -0
- package/dist/src/RandomGenerator.js +107 -0
- package/dist/src/RandomGenerator.js.map +1 -0
- package/dist/src/Serialization.d.ts +13 -0
- package/dist/src/Serialization.js +17 -0
- package/dist/src/Serialization.js.map +1 -0
- package/dist/src/SerializationError.d.ts +3 -0
- package/dist/src/SerializationError.js +22 -0
- package/dist/src/SerializationError.js.map +1 -0
- package/dist/src/Serializer.d.ts +15 -0
- package/dist/src/Serializer.js +43 -0
- package/dist/src/Serializer.js.map +1 -0
- package/dist/src/Server.d.ts +22 -0
- package/dist/src/Server.js +61 -0
- package/dist/src/Server.js.map +1 -0
- package/dist/src/TelepactError.d.ts +4 -0
- package/dist/src/TelepactError.js +24 -0
- package/dist/src/TelepactError.js.map +1 -0
- package/dist/src/TelepactSchema.d.ts +21 -0
- package/dist/src/TelepactSchema.js +50 -0
- package/dist/src/TelepactSchema.js.map +1 -0
- package/dist/src/TelepactSchemaFiles.d.ts +5 -0
- package/dist/src/TelepactSchemaFiles.js +23 -0
- package/dist/src/TelepactSchemaFiles.js.map +1 -0
- package/dist/src/TelepactSchemaParseError.d.ts +9 -0
- package/dist/src/TelepactSchemaParseError.js +31 -0
- package/dist/src/TelepactSchemaParseError.js.map +1 -0
- package/dist/src/fileSystem.d.ts +18 -0
- package/dist/src/fileSystem.js +17 -0
- package/dist/src/fileSystem.js.map +1 -0
- package/dist/src/index.d.ts +19 -0
- package/dist/src/index.js +35 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/ClientHandleMessage.d.ts +3 -0
- package/dist/src/internal/ClientHandleMessage.js +52 -0
- package/dist/src/internal/ClientHandleMessage.js.map +1 -0
- package/dist/src/internal/DeserializeInternal.d.ts +5 -0
- package/dist/src/internal/DeserializeInternal.js +65 -0
- package/dist/src/internal/DeserializeInternal.js.map +1 -0
- package/dist/src/internal/HandleMessage.d.ts +3 -0
- package/dist/src/internal/HandleMessage.js +168 -0
- package/dist/src/internal/HandleMessage.js.map +1 -0
- package/dist/src/internal/ObjectsAreEqual.d.ts +1 -0
- package/dist/src/internal/ObjectsAreEqual.js +40 -0
- package/dist/src/internal/ObjectsAreEqual.js.map +1 -0
- package/dist/src/internal/ParseRequestMessage.d.ts +4 -0
- package/dist/src/internal/ParseRequestMessage.js +46 -0
- package/dist/src/internal/ParseRequestMessage.js.map +1 -0
- package/dist/src/internal/ProcessBytes.d.ts +8 -0
- package/dist/src/internal/ProcessBytes.js +47 -0
- package/dist/src/internal/ProcessBytes.js.map +1 -0
- package/dist/src/internal/SelectStructFields.d.ts +4 -0
- package/dist/src/internal/SelectStructFields.js +87 -0
- package/dist/src/internal/SelectStructFields.js.map +1 -0
- package/dist/src/internal/SerializeInternal.d.ts +5 -0
- package/dist/src/internal/SerializeInternal.js +49 -0
- package/dist/src/internal/SerializeInternal.js.map +1 -0
- package/dist/src/internal/binary/Base64Encoder.d.ts +4 -0
- package/dist/src/internal/binary/Base64Encoder.js +18 -0
- package/dist/src/internal/binary/Base64Encoder.js.map +1 -0
- package/dist/src/internal/binary/Base64Util.d.ts +2 -0
- package/dist/src/internal/binary/Base64Util.js +36 -0
- package/dist/src/internal/binary/Base64Util.js.map +1 -0
- package/dist/src/internal/binary/BinaryEncoder.d.ts +4 -0
- package/dist/src/internal/binary/BinaryEncoder.js +18 -0
- package/dist/src/internal/binary/BinaryEncoder.js.map +1 -0
- package/dist/src/internal/binary/BinaryEncoderUnavailableError.d.ts +2 -0
- package/dist/src/internal/binary/BinaryEncoderUnavailableError.js +18 -0
- package/dist/src/internal/binary/BinaryEncoderUnavailableError.js.map +1 -0
- package/dist/src/internal/binary/BinaryEncoding.d.ts +6 -0
- package/dist/src/internal/binary/BinaryEncoding.js +30 -0
- package/dist/src/internal/binary/BinaryEncoding.js.map +1 -0
- package/dist/src/internal/binary/BinaryEncodingCache.d.ts +7 -0
- package/dist/src/internal/binary/BinaryEncodingCache.js +18 -0
- package/dist/src/internal/binary/BinaryEncodingCache.js.map +1 -0
- package/dist/src/internal/binary/BinaryEncodingMissing.d.ts +3 -0
- package/dist/src/internal/binary/BinaryEncodingMissing.js +21 -0
- package/dist/src/internal/binary/BinaryEncodingMissing.js.map +1 -0
- package/dist/src/internal/binary/BinaryPackNode.d.ts +5 -0
- package/dist/src/internal/binary/BinaryPackNode.js +24 -0
- package/dist/src/internal/binary/BinaryPackNode.js.map +1 -0
- package/dist/src/internal/binary/CannotPack.d.ts +3 -0
- package/dist/src/internal/binary/CannotPack.js +22 -0
- package/dist/src/internal/binary/CannotPack.js.map +1 -0
- package/dist/src/internal/binary/ClientBase64Decode.d.ts +1 -0
- package/dist/src/internal/binary/ClientBase64Decode.js +80 -0
- package/dist/src/internal/binary/ClientBase64Decode.js.map +1 -0
- package/dist/src/internal/binary/ClientBase64Encode.d.ts +1 -0
- package/dist/src/internal/binary/ClientBase64Encode.js +43 -0
- package/dist/src/internal/binary/ClientBase64Encode.js.map +1 -0
- package/dist/src/internal/binary/ClientBase64Encoder.d.ts +5 -0
- package/dist/src/internal/binary/ClientBase64Encoder.js +29 -0
- package/dist/src/internal/binary/ClientBase64Encoder.js.map +1 -0
- package/dist/src/internal/binary/ClientBinaryDecode.d.ts +3 -0
- package/dist/src/internal/binary/ClientBinaryDecode.js +42 -0
- package/dist/src/internal/binary/ClientBinaryDecode.js.map +1 -0
- package/dist/src/internal/binary/ClientBinaryEncode.d.ts +3 -0
- package/dist/src/internal/binary/ClientBinaryEncode.js +46 -0
- package/dist/src/internal/binary/ClientBinaryEncode.js.map +1 -0
- package/dist/src/internal/binary/ClientBinaryEncoder.d.ts +9 -0
- package/dist/src/internal/binary/ClientBinaryEncoder.js +33 -0
- package/dist/src/internal/binary/ClientBinaryEncoder.js.map +1 -0
- package/dist/src/internal/binary/ClientBinaryStrategy.d.ts +15 -0
- package/dist/src/internal/binary/ClientBinaryStrategy.js +84 -0
- package/dist/src/internal/binary/ClientBinaryStrategy.js.map +1 -0
- package/dist/src/internal/binary/ConstructBinaryEncoding.d.ts +3 -0
- package/dist/src/internal/binary/ConstructBinaryEncoding.js +85 -0
- package/dist/src/internal/binary/ConstructBinaryEncoding.js.map +1 -0
- package/dist/src/internal/binary/ConvertMapsToObjects.d.ts +1 -0
- package/dist/src/internal/binary/ConvertMapsToObjects.js +42 -0
- package/dist/src/internal/binary/ConvertMapsToObjects.js.map +1 -0
- package/dist/src/internal/binary/CreateChecksum.d.ts +1 -0
- package/dist/src/internal/binary/CreateChecksum.js +21 -0
- package/dist/src/internal/binary/CreateChecksum.js.map +1 -0
- package/dist/src/internal/binary/DecodeBody.d.ts +2 -0
- package/dist/src/internal/binary/DecodeBody.js +20 -0
- package/dist/src/internal/binary/DecodeBody.js.map +1 -0
- package/dist/src/internal/binary/DecodeKeys.d.ts +2 -0
- package/dist/src/internal/binary/DecodeKeys.js +37 -0
- package/dist/src/internal/binary/DecodeKeys.js.map +1 -0
- package/dist/src/internal/binary/DefaultBinaryEncodingCache.d.ts +10 -0
- package/dist/src/internal/binary/DefaultBinaryEncodingCache.js +38 -0
- package/dist/src/internal/binary/DefaultBinaryEncodingCache.js.map +1 -0
- package/dist/src/internal/binary/EncodeBody.d.ts +2 -0
- package/dist/src/internal/binary/EncodeBody.js +20 -0
- package/dist/src/internal/binary/EncodeBody.js.map +1 -0
- package/dist/src/internal/binary/EncodeKeys.d.ts +2 -0
- package/dist/src/internal/binary/EncodeKeys.js +36 -0
- package/dist/src/internal/binary/EncodeKeys.js.map +1 -0
- package/dist/src/internal/binary/LocalStorageBackedBinaryEncodingCache.d.ts +13 -0
- package/dist/src/internal/binary/LocalStorageBackedBinaryEncodingCache.js +65 -0
- package/dist/src/internal/binary/LocalStorageBackedBinaryEncodingCache.js.map +1 -0
- package/dist/src/internal/binary/Pack.d.ts +1 -0
- package/dist/src/internal/binary/Pack.js +32 -0
- package/dist/src/internal/binary/Pack.js.map +1 -0
- package/dist/src/internal/binary/PackBody.d.ts +1 -0
- package/dist/src/internal/binary/PackBody.js +25 -0
- package/dist/src/internal/binary/PackBody.js.map +1 -0
- package/dist/src/internal/binary/PackList.d.ts +4 -0
- package/dist/src/internal/binary/PackList.js +68 -0
- package/dist/src/internal/binary/PackList.js.map +1 -0
- package/dist/src/internal/binary/PackMap.d.ts +5 -0
- package/dist/src/internal/binary/PackMap.js +87 -0
- package/dist/src/internal/binary/PackMap.js.map +1 -0
- package/dist/src/internal/binary/ServerBase64Decode.d.ts +1 -0
- package/dist/src/internal/binary/ServerBase64Decode.js +76 -0
- package/dist/src/internal/binary/ServerBase64Decode.js.map +1 -0
- package/dist/src/internal/binary/ServerBase64Encode.d.ts +1 -0
- package/dist/src/internal/binary/ServerBase64Encode.js +76 -0
- package/dist/src/internal/binary/ServerBase64Encode.js.map +1 -0
- package/dist/src/internal/binary/ServerBase64Encoder.d.ts +5 -0
- package/dist/src/internal/binary/ServerBase64Encoder.js +28 -0
- package/dist/src/internal/binary/ServerBase64Encoder.js.map +1 -0
- package/dist/src/internal/binary/ServerBinaryDecode.d.ts +2 -0
- package/dist/src/internal/binary/ServerBinaryDecode.js +39 -0
- package/dist/src/internal/binary/ServerBinaryDecode.js.map +1 -0
- package/dist/src/internal/binary/ServerBinaryEncode.d.ts +2 -0
- package/dist/src/internal/binary/ServerBinaryEncode.js +42 -0
- package/dist/src/internal/binary/ServerBinaryEncode.js.map +1 -0
- package/dist/src/internal/binary/ServerBinaryEncoder.d.ts +8 -0
- package/dist/src/internal/binary/ServerBinaryEncoder.js +30 -0
- package/dist/src/internal/binary/ServerBinaryEncoder.js.map +1 -0
- package/dist/src/internal/binary/Unpack.d.ts +1 -0
- package/dist/src/internal/binary/Unpack.js +32 -0
- package/dist/src/internal/binary/Unpack.js.map +1 -0
- package/dist/src/internal/binary/UnpackBody.d.ts +1 -0
- package/dist/src/internal/binary/UnpackBody.js +25 -0
- package/dist/src/internal/binary/UnpackBody.js.map +1 -0
- package/dist/src/internal/binary/UnpackList.d.ts +1 -0
- package/dist/src/internal/binary/UnpackList.js +39 -0
- package/dist/src/internal/binary/UnpackList.js.map +1 -0
- package/dist/src/internal/binary/UnpackMap.d.ts +1 -0
- package/dist/src/internal/binary/UnpackMap.js +40 -0
- package/dist/src/internal/binary/UnpackMap.js.map +1 -0
- package/dist/src/internal/generation/GenerateContext.d.ts +16 -0
- package/dist/src/internal/generation/GenerateContext.js +33 -0
- package/dist/src/internal/generation/GenerateContext.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomAny.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomAny.js +28 -0
- package/dist/src/internal/generation/GenerateRandomAny.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomArray.d.ts +3 -0
- package/dist/src/internal/generation/GenerateRandomArray.js +37 -0
- package/dist/src/internal/generation/GenerateRandomArray.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomBoolean.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomBoolean.js +24 -0
- package/dist/src/internal/generation/GenerateRandomBoolean.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomBytes.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomBytes.js +24 -0
- package/dist/src/internal/generation/GenerateRandomBytes.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomInteger.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomInteger.js +24 -0
- package/dist/src/internal/generation/GenerateRandomInteger.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomMockCall.d.ts +5 -0
- package/dist/src/internal/generation/GenerateRandomMockCall.js +26 -0
- package/dist/src/internal/generation/GenerateRandomMockCall.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomMockStub.d.ts +5 -0
- package/dist/src/internal/generation/GenerateRandomMockStub.js +38 -0
- package/dist/src/internal/generation/GenerateRandomMockStub.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomNumber.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomNumber.js +24 -0
- package/dist/src/internal/generation/GenerateRandomNumber.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomObject.d.ts +3 -0
- package/dist/src/internal/generation/GenerateRandomObject.js +38 -0
- package/dist/src/internal/generation/GenerateRandomObject.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomSelect.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomSelect.js +49 -0
- package/dist/src/internal/generation/GenerateRandomSelect.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomString.d.ts +2 -0
- package/dist/src/internal/generation/GenerateRandomString.js +24 -0
- package/dist/src/internal/generation/GenerateRandomString.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomStruct.d.ts +5 -0
- package/dist/src/internal/generation/GenerateRandomStruct.js +60 -0
- package/dist/src/internal/generation/GenerateRandomStruct.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomUnion.d.ts +5 -0
- package/dist/src/internal/generation/GenerateRandomUnion.js +35 -0
- package/dist/src/internal/generation/GenerateRandomUnion.js.map +1 -0
- package/dist/src/internal/generation/GenerateRandomValueOfType.d.ts +4 -0
- package/dist/src/internal/generation/GenerateRandomValueOfType.js +24 -0
- package/dist/src/internal/generation/GenerateRandomValueOfType.js.map +1 -0
- package/dist/src/internal/mock/IsSubMap.d.ts +1 -0
- package/dist/src/internal/mock/IsSubMap.js +28 -0
- package/dist/src/internal/mock/IsSubMap.js.map +1 -0
- package/dist/src/internal/mock/IsSubMapEntryEqual.d.ts +1 -0
- package/dist/src/internal/mock/IsSubMapEntryEqual.js +37 -0
- package/dist/src/internal/mock/IsSubMapEntryEqual.js.map +1 -0
- package/dist/src/internal/mock/MockHandle.d.ts +6 -0
- package/dist/src/internal/mock/MockHandle.js +121 -0
- package/dist/src/internal/mock/MockHandle.js.map +1 -0
- package/dist/src/internal/mock/MockInvocation.d.ts +6 -0
- package/dist/src/internal/mock/MockInvocation.js +26 -0
- package/dist/src/internal/mock/MockInvocation.js.map +1 -0
- package/dist/src/internal/mock/MockStub.d.ts +8 -0
- package/dist/src/internal/mock/MockStub.js +30 -0
- package/dist/src/internal/mock/MockStub.js.map +1 -0
- package/dist/src/internal/mock/PartiallyMatches.d.ts +1 -0
- package/dist/src/internal/mock/PartiallyMatches.js +25 -0
- package/dist/src/internal/mock/PartiallyMatches.js.map +1 -0
- package/dist/src/internal/mock/Verify.d.ts +8 -0
- package/dist/src/internal/mock/Verify.js +94 -0
- package/dist/src/internal/mock/Verify.js.map +1 -0
- package/dist/src/internal/mock/VerifyNoMoreInteractions.d.ts +4 -0
- package/dist/src/internal/mock/VerifyNoMoreInteractions.js +30 -0
- package/dist/src/internal/mock/VerifyNoMoreInteractions.js.map +1 -0
- package/dist/src/internal/schema/ApplyErrorToParsedTypes.d.ts +13 -0
- package/dist/src/internal/schema/ApplyErrorToParsedTypes.js +61 -0
- package/dist/src/internal/schema/ApplyErrorToParsedTypes.js.map +1 -0
- package/dist/src/internal/schema/CatchErrorCollisions.d.ts +1 -0
- package/dist/src/internal/schema/CatchErrorCollisions.js +73 -0
- package/dist/src/internal/schema/CatchErrorCollisions.js.map +1 -0
- package/dist/src/internal/schema/CatchHeaderCollisions.d.ts +1 -0
- package/dist/src/internal/schema/CatchHeaderCollisions.js +74 -0
- package/dist/src/internal/schema/CatchHeaderCollisions.js.map +1 -0
- package/dist/src/internal/schema/CreateMockTelepactSchemaFromFileJsonMap.d.ts +2 -0
- package/dist/src/internal/schema/CreateMockTelepactSchemaFromFileJsonMap.js +25 -0
- package/dist/src/internal/schema/CreateMockTelepactSchemaFromFileJsonMap.js.map +1 -0
- package/dist/src/internal/schema/CreateTelepactSchemaFromFileJsonMap.d.ts +2 -0
- package/dist/src/internal/schema/CreateTelepactSchemaFromFileJsonMap.js +33 -0
- package/dist/src/internal/schema/CreateTelepactSchemaFromFileJsonMap.js.map +1 -0
- package/dist/src/internal/schema/DerivePossibleSelect.d.ts +2 -0
- package/dist/src/internal/schema/DerivePossibleSelect.js +87 -0
- package/dist/src/internal/schema/DerivePossibleSelect.js.map +1 -0
- package/dist/src/internal/schema/FindMatchingSchemaKey.d.ts +1 -0
- package/dist/src/internal/schema/FindMatchingSchemaKey.js +27 -0
- package/dist/src/internal/schema/FindMatchingSchemaKey.js.map +1 -0
- package/dist/src/internal/schema/FindSchemaKey.d.ts +1 -0
- package/dist/src/internal/schema/FindSchemaKey.js +40 -0
- package/dist/src/internal/schema/FindSchemaKey.js.map +1 -0
- package/dist/src/internal/schema/GetAuthTelepactJson.d.ts +1 -0
- package/dist/src/internal/schema/GetAuthTelepactJson.js +20 -0
- package/dist/src/internal/schema/GetAuthTelepactJson.js.map +1 -0
- package/dist/src/internal/schema/GetInternalTelepactJson.d.ts +1 -0
- package/dist/src/internal/schema/GetInternalTelepactJson.js +20 -0
- package/dist/src/internal/schema/GetInternalTelepactJson.js.map +1 -0
- package/dist/src/internal/schema/GetMockTelepactJson.d.ts +1 -0
- package/dist/src/internal/schema/GetMockTelepactJson.js +20 -0
- package/dist/src/internal/schema/GetMockTelepactJson.js.map +1 -0
- package/dist/src/internal/schema/GetOrParseType.d.ts +3 -0
- package/dist/src/internal/schema/GetOrParseType.js +108 -0
- package/dist/src/internal/schema/GetOrParseType.js.map +1 -0
- package/dist/src/internal/schema/GetPathDocumentCoordinatesPseudoJson.d.ts +7 -0
- package/dist/src/internal/schema/GetPathDocumentCoordinatesPseudoJson.js +218 -0
- package/dist/src/internal/schema/GetPathDocumentCoordinatesPseudoJson.js.map +1 -0
- package/dist/src/internal/schema/GetSchemaFileMap.d.ts +2 -0
- package/dist/src/internal/schema/GetSchemaFileMap.js +40 -0
- package/dist/src/internal/schema/GetSchemaFileMap.js.map +1 -0
- package/dist/src/internal/schema/GetTypeUnexpectedParseFailure.d.ts +2 -0
- package/dist/src/internal/schema/GetTypeUnexpectedParseFailure.js +26 -0
- package/dist/src/internal/schema/GetTypeUnexpectedParseFailure.js.map +1 -0
- package/dist/src/internal/schema/MapSchemaParseFailuresToPseudoJson.d.ts +2 -0
- package/dist/src/internal/schema/MapSchemaParseFailuresToPseudoJson.js +31 -0
- package/dist/src/internal/schema/MapSchemaParseFailuresToPseudoJson.js.map +1 -0
- package/dist/src/internal/schema/ParseContext.d.ts +41 -0
- package/dist/src/internal/schema/ParseContext.js +41 -0
- package/dist/src/internal/schema/ParseContext.js.map +1 -0
- package/dist/src/internal/schema/ParseErrorType.d.ts +5 -0
- package/dist/src/internal/schema/ParseErrorType.js +35 -0
- package/dist/src/internal/schema/ParseErrorType.js.map +1 -0
- package/dist/src/internal/schema/ParseField.d.ts +3 -0
- package/dist/src/internal/schema/ParseField.js +36 -0
- package/dist/src/internal/schema/ParseField.js.map +1 -0
- package/dist/src/internal/schema/ParseFunctionType.d.ts +8 -0
- package/dist/src/internal/schema/ParseFunctionType.js +75 -0
- package/dist/src/internal/schema/ParseFunctionType.js.map +1 -0
- package/dist/src/internal/schema/ParseHeadersType.d.ts +5 -0
- package/dist/src/internal/schema/ParseHeadersType.js +92 -0
- package/dist/src/internal/schema/ParseHeadersType.js.map +1 -0
- package/dist/src/internal/schema/ParseStructFields.d.ts +7 -0
- package/dist/src/internal/schema/ParseStructFields.js +58 -0
- package/dist/src/internal/schema/ParseStructFields.js.map +1 -0
- package/dist/src/internal/schema/ParseStructType.d.ts +5 -0
- package/dist/src/internal/schema/ParseStructType.js +53 -0
- package/dist/src/internal/schema/ParseStructType.js.map +1 -0
- package/dist/src/internal/schema/ParseTelepactSchema.d.ts +2 -0
- package/dist/src/internal/schema/ParseTelepactSchema.js +257 -0
- package/dist/src/internal/schema/ParseTelepactSchema.js.map +1 -0
- package/dist/src/internal/schema/ParseTypeDeclaration.d.ts +2 -0
- package/dist/src/internal/schema/ParseTypeDeclaration.js +84 -0
- package/dist/src/internal/schema/ParseTypeDeclaration.js.map +1 -0
- package/dist/src/internal/schema/ParseUnionType.d.ts +5 -0
- package/dist/src/internal/schema/ParseUnionType.js +138 -0
- package/dist/src/internal/schema/ParseUnionType.js.map +1 -0
- package/dist/src/internal/schema/SchemaParseFailure.d.ts +8 -0
- package/dist/src/internal/schema/SchemaParseFailure.js +29 -0
- package/dist/src/internal/schema/SchemaParseFailure.js.map +1 -0
- package/dist/src/internal/types/GetType.d.ts +1 -0
- package/dist/src/internal/types/GetType.js +39 -0
- package/dist/src/internal/types/GetType.js.map +1 -0
- package/dist/src/internal/types/TAny.d.ts +11 -0
- package/dist/src/internal/types/TAny.js +33 -0
- package/dist/src/internal/types/TAny.js.map +1 -0
- package/dist/src/internal/types/TArray.d.ts +12 -0
- package/dist/src/internal/types/TArray.js +34 -0
- package/dist/src/internal/types/TArray.js.map +1 -0
- package/dist/src/internal/types/TBoolean.d.ts +12 -0
- package/dist/src/internal/types/TBoolean.js +34 -0
- package/dist/src/internal/types/TBoolean.js.map +1 -0
- package/dist/src/internal/types/TBytes.d.ts +12 -0
- package/dist/src/internal/types/TBytes.js +34 -0
- package/dist/src/internal/types/TBytes.js.map +1 -0
- package/dist/src/internal/types/TError.d.ts +6 -0
- package/dist/src/internal/types/TError.js +24 -0
- package/dist/src/internal/types/TError.js.map +1 -0
- package/dist/src/internal/types/TFieldDeclaration.d.ts +7 -0
- package/dist/src/internal/types/TFieldDeclaration.js +26 -0
- package/dist/src/internal/types/TFieldDeclaration.js.map +1 -0
- package/dist/src/internal/types/THeaders.d.ts +15 -0
- package/dist/src/internal/types/THeaders.js +26 -0
- package/dist/src/internal/types/THeaders.js.map +1 -0
- package/dist/src/internal/types/TInteger.d.ts +12 -0
- package/dist/src/internal/types/TInteger.js +34 -0
- package/dist/src/internal/types/TInteger.js.map +1 -0
- package/dist/src/internal/types/TMockCall.d.ts +16 -0
- package/dist/src/internal/types/TMockCall.js +39 -0
- package/dist/src/internal/types/TMockCall.js.map +1 -0
- package/dist/src/internal/types/TMockStub.d.ts +18 -0
- package/dist/src/internal/types/TMockStub.js +39 -0
- package/dist/src/internal/types/TMockStub.js.map +1 -0
- package/dist/src/internal/types/TNumber.d.ts +12 -0
- package/dist/src/internal/types/TNumber.js +34 -0
- package/dist/src/internal/types/TNumber.js.map +1 -0
- package/dist/src/internal/types/TObject.d.ts +12 -0
- package/dist/src/internal/types/TObject.js +33 -0
- package/dist/src/internal/types/TObject.js.map +1 -0
- package/dist/src/internal/types/TSelect.d.ts +13 -0
- package/dist/src/internal/types/TSelect.js +34 -0
- package/dist/src/internal/types/TSelect.js.map +1 -0
- package/dist/src/internal/types/TString.d.ts +12 -0
- package/dist/src/internal/types/TString.js +34 -0
- package/dist/src/internal/types/TString.js.map +1 -0
- package/dist/src/internal/types/TStruct.d.ts +20 -0
- package/dist/src/internal/types/TStruct.js +39 -0
- package/dist/src/internal/types/TStruct.js.map +1 -0
- package/dist/src/internal/types/TType.d.ts +10 -0
- package/dist/src/internal/types/TType.js +18 -0
- package/dist/src/internal/types/TType.js.map +1 -0
- package/dist/src/internal/types/TTypeDeclaration.d.ts +12 -0
- package/dist/src/internal/types/TTypeDeclaration.js +34 -0
- package/dist/src/internal/types/TTypeDeclaration.js.map +1 -0
- package/dist/src/internal/types/TUnion.d.ts +25 -0
- package/dist/src/internal/types/TUnion.js +41 -0
- package/dist/src/internal/types/TUnion.js.map +1 -0
- package/dist/src/internal/validation/GetInvalidErrorMessage.d.ts +6 -0
- package/dist/src/internal/validation/GetInvalidErrorMessage.js +29 -0
- package/dist/src/internal/validation/GetInvalidErrorMessage.js.map +1 -0
- package/dist/src/internal/validation/GetTypeUnexpectedValidationFailure.d.ts +2 -0
- package/dist/src/internal/validation/GetTypeUnexpectedValidationFailure.js +26 -0
- package/dist/src/internal/validation/GetTypeUnexpectedValidationFailure.js.map +1 -0
- package/dist/src/internal/validation/InvalidMessage.d.ts +3 -0
- package/dist/src/internal/validation/InvalidMessage.js +21 -0
- package/dist/src/internal/validation/InvalidMessage.js.map +1 -0
- package/dist/src/internal/validation/InvalidMessageBody.d.ts +2 -0
- package/dist/src/internal/validation/InvalidMessageBody.js +18 -0
- package/dist/src/internal/validation/InvalidMessageBody.js.map +1 -0
- package/dist/src/internal/validation/MapValidationFailuresToInvalidFieldCases.d.ts +2 -0
- package/dist/src/internal/validation/MapValidationFailuresToInvalidFieldCases.js +27 -0
- package/dist/src/internal/validation/MapValidationFailuresToInvalidFieldCases.js.map +1 -0
- package/dist/src/internal/validation/ValidateArray.d.ts +4 -0
- package/dist/src/internal/validation/ValidateArray.js +42 -0
- package/dist/src/internal/validation/ValidateArray.js.map +1 -0
- package/dist/src/internal/validation/ValidateBoolean.d.ts +2 -0
- package/dist/src/internal/validation/ValidateBoolean.js +26 -0
- package/dist/src/internal/validation/ValidateBoolean.js.map +1 -0
- package/dist/src/internal/validation/ValidateBytes.d.ts +3 -0
- package/dist/src/internal/validation/ValidateBytes.js +56 -0
- package/dist/src/internal/validation/ValidateBytes.js.map +1 -0
- package/dist/src/internal/validation/ValidateContext.d.ts +13 -0
- package/dist/src/internal/validation/ValidateContext.js +32 -0
- package/dist/src/internal/validation/ValidateContext.js.map +1 -0
- package/dist/src/internal/validation/ValidateHeaders.d.ts +3 -0
- package/dist/src/internal/validation/ValidateHeaders.js +34 -0
- package/dist/src/internal/validation/ValidateHeaders.js.map +1 -0
- package/dist/src/internal/validation/ValidateInteger.d.ts +2 -0
- package/dist/src/internal/validation/ValidateInteger.js +33 -0
- package/dist/src/internal/validation/ValidateInteger.js.map +1 -0
- package/dist/src/internal/validation/ValidateMockCall.d.ts +4 -0
- package/dist/src/internal/validation/ValidateMockCall.js +50 -0
- package/dist/src/internal/validation/ValidateMockCall.js.map +1 -0
- package/dist/src/internal/validation/ValidateMockStub.d.ts +6 -0
- package/dist/src/internal/validation/ValidateMockStub.js +73 -0
- package/dist/src/internal/validation/ValidateMockStub.js.map +1 -0
- package/dist/src/internal/validation/ValidateNumber.d.ts +2 -0
- package/dist/src/internal/validation/ValidateNumber.js +33 -0
- package/dist/src/internal/validation/ValidateNumber.js.map +1 -0
- package/dist/src/internal/validation/ValidateObject.d.ts +4 -0
- package/dist/src/internal/validation/ValidateObject.js +40 -0
- package/dist/src/internal/validation/ValidateObject.js.map +1 -0
- package/dist/src/internal/validation/ValidateResult.d.ts +2 -0
- package/dist/src/internal/validation/ValidateResult.js +25 -0
- package/dist/src/internal/validation/ValidateResult.js.map +1 -0
- package/dist/src/internal/validation/ValidateSelect.d.ts +3 -0
- package/dist/src/internal/validation/ValidateSelect.js +56 -0
- package/dist/src/internal/validation/ValidateSelect.js.map +1 -0
- package/dist/src/internal/validation/ValidateString.d.ts +2 -0
- package/dist/src/internal/validation/ValidateString.js +26 -0
- package/dist/src/internal/validation/ValidateString.js.map +1 -0
- package/dist/src/internal/validation/ValidateStruct.d.ts +4 -0
- package/dist/src/internal/validation/ValidateStruct.js +28 -0
- package/dist/src/internal/validation/ValidateStruct.js.map +1 -0
- package/dist/src/internal/validation/ValidateStructFields.d.ts +4 -0
- package/dist/src/internal/validation/ValidateStructFields.js +53 -0
- package/dist/src/internal/validation/ValidateStructFields.js.map +1 -0
- package/dist/src/internal/validation/ValidateUnion.d.ts +4 -0
- package/dist/src/internal/validation/ValidateUnion.js +34 -0
- package/dist/src/internal/validation/ValidateUnion.js.map +1 -0
- package/dist/src/internal/validation/ValidateUnionStruct.d.ts +4 -0
- package/dist/src/internal/validation/ValidateUnionStruct.js +24 -0
- package/dist/src/internal/validation/ValidateUnionStruct.js.map +1 -0
- package/dist/src/internal/validation/ValidateUnionTags.d.ts +4 -0
- package/dist/src/internal/validation/ValidateUnionTags.js +46 -0
- package/dist/src/internal/validation/ValidateUnionTags.js.map +1 -0
- package/dist/src/internal/validation/ValidateValueOfType.d.ts +5 -0
- package/dist/src/internal/validation/ValidateValueOfType.js +28 -0
- package/dist/src/internal/validation/ValidateValueOfType.js.map +1 -0
- package/dist/src/internal/validation/ValidationFailure.d.ts +6 -0
- package/dist/src/internal/validation/ValidationFailure.js +26 -0
- package/dist/src/internal/validation/ValidationFailure.js.map +1 -0
- package/package.json +57 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 mockInternalTelepact from '../../../inc/mock-internal.telepact.json';
|
|
17
|
+
export function getMockTelepactJson() {
|
|
18
|
+
return JSON.stringify(mockInternalTelepact);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=GetMockTelepactJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetMockTelepactJson.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetMockTelepactJson.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAEH,OAAO,oBAAoB,MAAM,0CAA0C,CAAC;AAE5E,MAAM,UAAU,mBAAmB;IAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 { TelepactSchemaParseError } from '../../TelepactSchemaParseError';
|
|
17
|
+
import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
|
|
18
|
+
import { TBoolean } from '../types/TBoolean';
|
|
19
|
+
import { TInteger } from '../types/TInteger';
|
|
20
|
+
import { TNumber } from '../types/TNumber';
|
|
21
|
+
import { TString } from '../types/TString';
|
|
22
|
+
import { TAny } from '../types/TAny';
|
|
23
|
+
import { TBytes } from '../types/TBytes';
|
|
24
|
+
import { parseFunctionErrorsRegex, parseFunctionResultType } from '../../internal/schema/ParseFunctionType';
|
|
25
|
+
import { parseStructType } from '../../internal/schema/ParseStructType';
|
|
26
|
+
import { parseUnionType } from '../../internal/schema/ParseUnionType';
|
|
27
|
+
import { TSelect } from '../types/TSelect';
|
|
28
|
+
import { TMockCall } from '../types/TMockCall';
|
|
29
|
+
import { TMockStub } from '../types/TMockStub';
|
|
30
|
+
import { TUnion } from '../types/TUnion';
|
|
31
|
+
export function getOrParseType(path, typeName, ctx) {
|
|
32
|
+
if (ctx.failedTypes.has(typeName)) {
|
|
33
|
+
throw new TelepactSchemaParseError([], ctx.telepactSchemaDocumentNamesToJson);
|
|
34
|
+
}
|
|
35
|
+
const existingType = ctx.parsedTypes[typeName];
|
|
36
|
+
if (existingType !== undefined) {
|
|
37
|
+
return existingType;
|
|
38
|
+
}
|
|
39
|
+
const regexString = `^(boolean|integer|number|string|any|bytes)|((fn|(union|struct|_ext))\\.([a-zA-Z_]\\w*))$`;
|
|
40
|
+
const regex = new RegExp(regexString);
|
|
41
|
+
const matcher = typeName.match(regex);
|
|
42
|
+
if (!matcher) {
|
|
43
|
+
throw new TelepactSchemaParseError([new SchemaParseFailure(ctx.documentName, path, 'StringRegexMatchFailed', { regex: regexString })], ctx.telepactSchemaDocumentNamesToJson);
|
|
44
|
+
}
|
|
45
|
+
const standardTypeName = matcher[1];
|
|
46
|
+
if (standardTypeName) {
|
|
47
|
+
return ({
|
|
48
|
+
boolean: new TBoolean(),
|
|
49
|
+
integer: new TInteger(),
|
|
50
|
+
number: new TNumber(),
|
|
51
|
+
string: new TString(),
|
|
52
|
+
bytes: new TBytes(),
|
|
53
|
+
}[standardTypeName] || new TAny());
|
|
54
|
+
}
|
|
55
|
+
const customTypeName = matcher[2];
|
|
56
|
+
const thisIndex = ctx.schemaKeysToIndex[customTypeName];
|
|
57
|
+
const thisDocumentName = ctx.schemaKeysToDocumentName[customTypeName];
|
|
58
|
+
if (thisIndex === undefined) {
|
|
59
|
+
throw new TelepactSchemaParseError([new SchemaParseFailure(ctx.documentName, path, 'TypeUnknown', { name: customTypeName })], ctx.telepactSchemaDocumentNamesToJson);
|
|
60
|
+
}
|
|
61
|
+
const definition = ctx.telepactSchemaDocumentNamesToPseudoJson[thisDocumentName][thisIndex];
|
|
62
|
+
let type;
|
|
63
|
+
try {
|
|
64
|
+
if (customTypeName.startsWith('struct')) {
|
|
65
|
+
type = parseStructType([thisIndex], definition, customTypeName, [], ctx.copy({ documentName: thisDocumentName }));
|
|
66
|
+
ctx.parsedTypes[customTypeName] = type;
|
|
67
|
+
}
|
|
68
|
+
else if (customTypeName.startsWith('union')) {
|
|
69
|
+
type = parseUnionType([thisIndex], definition, customTypeName, [], [], ctx.copy({ documentName: thisDocumentName }));
|
|
70
|
+
ctx.parsedTypes[customTypeName] = type;
|
|
71
|
+
}
|
|
72
|
+
else if (customTypeName.startsWith('fn')) {
|
|
73
|
+
const argType = parseStructType([thisIndex], definition, customTypeName, ['->', '_errors'], ctx.copy({ documentName: thisDocumentName }));
|
|
74
|
+
type = new TUnion(customTypeName, { [customTypeName]: argType }, { [customTypeName]: 0 });
|
|
75
|
+
ctx.parsedTypes[customTypeName] = type;
|
|
76
|
+
const resultType = parseFunctionResultType([thisIndex], definition, customTypeName, ctx.copy({ documentName: thisDocumentName }));
|
|
77
|
+
ctx.parsedTypes[customTypeName + '.->'] = resultType;
|
|
78
|
+
const errorsRegex = parseFunctionErrorsRegex([thisIndex], definition, customTypeName, ctx.copy({ documentName: thisDocumentName }));
|
|
79
|
+
ctx.fnErrorRegexes[customTypeName] = errorsRegex;
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
const possibleTypeExtension = {
|
|
83
|
+
'_ext.Select_': new TSelect(),
|
|
84
|
+
'_ext.Call_': new TMockCall(ctx.parsedTypes),
|
|
85
|
+
'_ext.Stub_': new TMockStub(ctx.parsedTypes),
|
|
86
|
+
}[customTypeName];
|
|
87
|
+
if (!possibleTypeExtension) {
|
|
88
|
+
throw new TelepactSchemaParseError([
|
|
89
|
+
new SchemaParseFailure(ctx.documentName, [thisIndex], 'TypeExtensionImplementationMissing', {
|
|
90
|
+
name: customTypeName,
|
|
91
|
+
}),
|
|
92
|
+
], ctx.telepactSchemaDocumentNamesToJson);
|
|
93
|
+
}
|
|
94
|
+
type = possibleTypeExtension;
|
|
95
|
+
ctx.parsedTypes[customTypeName] = type;
|
|
96
|
+
}
|
|
97
|
+
return type;
|
|
98
|
+
}
|
|
99
|
+
catch (e) {
|
|
100
|
+
if (e instanceof TelepactSchemaParseError) {
|
|
101
|
+
ctx.allParseFailures.push(...e.schemaParseFailures);
|
|
102
|
+
ctx.failedTypes.add(customTypeName);
|
|
103
|
+
throw new TelepactSchemaParseError([], ctx.telepactSchemaDocumentNamesToJson);
|
|
104
|
+
}
|
|
105
|
+
throw e;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=GetOrParseType.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetOrParseType.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetOrParseType.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAEH,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAI9E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,E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cAAc,CAAC,GAAG,WAAW,CAAC;QACrD,CAAC;aAAM,CAAC;YACJ,MAAM,qBAAqB,GAAG;gBAC1B,cAAc,EAAE,IAAI,OAAO,EAAE;gBAC7B,YAAY,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;gBAC5C,YAAY,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,WAAW,CAAC;aAC/C,CAAC,cAAc,CAAC,CAAC;YAClB,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBACzB,MAAM,IAAI,wBAAwB,CAC9B;oBACI,IAAI,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,SAAS,CAAC,EAAE,oCAAoC,EAAE;wBACxF,IAAI,EAAE,cAAc;qBACvB,CAAC;iBACL,EACD,GAAG,CAAC,iCAAiC,CACxC,CAAC;YACN,CAAC;YACD,IAAI,GAAG,qBAAqB,CAAC;YAE7B,GAAG,CAAC,WAAW,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;QAC3C,CAAC;QAGD,OAAO,IAAI,CAAC;IAChB,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,IAAI,CAAC,YAAY,wBAAwB,EAAE,CAAC;YACxC,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC;YACpD,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;YACpC,MAAM,IAAI,wBAAwB,CAAC,EAAE,EAAE,GAAG,CAAC,iCAAiC,CAAC,CAAC;QAClF,CAAC;QACD,MAAM,CAAC,CAAC;IACZ,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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
|
+
class StringReader {
|
|
17
|
+
s;
|
|
18
|
+
index;
|
|
19
|
+
row;
|
|
20
|
+
col;
|
|
21
|
+
constructor(s) {
|
|
22
|
+
this.s = s;
|
|
23
|
+
this.index = 0;
|
|
24
|
+
this.row = 1;
|
|
25
|
+
this.col = 0;
|
|
26
|
+
}
|
|
27
|
+
next() {
|
|
28
|
+
if (this.index >= this.s.length) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const c = this.s[this.index++];
|
|
32
|
+
if (c === '\n') {
|
|
33
|
+
this.row += 1;
|
|
34
|
+
this.col = 0;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
this.col += 1;
|
|
38
|
+
}
|
|
39
|
+
//console.log(`reader: char=${c}, row=${this.row}, col=${this.col}`);
|
|
40
|
+
return [c, this.row, this.col];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function getPathDocumentCoordinatesPseudoJson(path, document) {
|
|
44
|
+
//console.log(`getPathDocumentCoordinatesPseudoJson: path=${path}, document=${document}`);
|
|
45
|
+
try {
|
|
46
|
+
const reader = new StringReader(document);
|
|
47
|
+
return findCoordinates(path, reader);
|
|
48
|
+
}
|
|
49
|
+
catch (e) {
|
|
50
|
+
console.log('Could not determine document coordinates');
|
|
51
|
+
console.log(`path: ${path}`);
|
|
52
|
+
console.log(`document: ${document}`);
|
|
53
|
+
console.log(`e: ${e}`);
|
|
54
|
+
console.log(`e.trace: ${e.trace}`);
|
|
55
|
+
throw e;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function findCoordinates(path, reader, ovRow, ovCol) {
|
|
59
|
+
//console.log(`findCoordinates: path=${path}`);
|
|
60
|
+
let result;
|
|
61
|
+
while ((result = reader.next()) !== null) {
|
|
62
|
+
const [c, row, col] = result;
|
|
63
|
+
if (path.length === 0) {
|
|
64
|
+
return {
|
|
65
|
+
row: ovRow ?? row,
|
|
66
|
+
col: ovCol ?? col,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//console.log(`findCoordinates: char=${c}, row=${row}, col=${col}`);
|
|
70
|
+
if (c === '{') {
|
|
71
|
+
const result = findCoordinatesObject(path, reader);
|
|
72
|
+
if (result) {
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (c === '[') {
|
|
77
|
+
const result = findCoordinatesArray(path, reader);
|
|
78
|
+
if (result) {
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
throw new Error('findCoordinates: Path not found in document');
|
|
84
|
+
}
|
|
85
|
+
function findCoordinatesObject(path, reader) {
|
|
86
|
+
//console.log(`findCoordinatesObject: path=${path}`);
|
|
87
|
+
let workingKeyRowStart = null;
|
|
88
|
+
let workingKeyColStart = null;
|
|
89
|
+
let workingKey;
|
|
90
|
+
let result;
|
|
91
|
+
while ((result = reader.next()) !== null) {
|
|
92
|
+
const [c, row, col] = result;
|
|
93
|
+
//console.log(`findCoordinatesObject: char=${c}, row=${row}, col=${col}`);
|
|
94
|
+
if (c === '}') {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
else if (c === '"') {
|
|
98
|
+
workingKeyRowStart = row;
|
|
99
|
+
workingKeyColStart = col;
|
|
100
|
+
workingKey = findString(reader);
|
|
101
|
+
}
|
|
102
|
+
else if (c === ':') {
|
|
103
|
+
if (workingKey === path[0]) {
|
|
104
|
+
return findCoordinates(path.slice(1), reader, workingKeyRowStart, workingKeyColStart);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
findValue(reader);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
throw new Error('findCoordinatesObject: Path not found in document');
|
|
112
|
+
}
|
|
113
|
+
function findCoordinatesArray(path, reader) {
|
|
114
|
+
//console.log(`findCoordinatesArray: path=${path}`);
|
|
115
|
+
let workingIndex = 0;
|
|
116
|
+
if (workingIndex === path[0]) {
|
|
117
|
+
return findCoordinates(path.slice(1), reader);
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
findValue(reader);
|
|
121
|
+
}
|
|
122
|
+
let result;
|
|
123
|
+
while ((result = reader.next()) !== null) {
|
|
124
|
+
const [c, row, col] = result;
|
|
125
|
+
//console.log(`findCoordinatesArray: char=${c}, row=${row}, col=${col}`);
|
|
126
|
+
workingIndex += 1;
|
|
127
|
+
//console.log(`findCoordinatesArray: workingIndex=${workingIndex}`);
|
|
128
|
+
if (workingIndex === path[0]) {
|
|
129
|
+
return findCoordinates(path.slice(1), reader);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
findValue(reader);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
throw new Error('findCoordinatesArray: Path not found in document');
|
|
136
|
+
}
|
|
137
|
+
function findValue(reader) {
|
|
138
|
+
let result;
|
|
139
|
+
while ((result = reader.next()) !== null) {
|
|
140
|
+
const [c, row, col] = result;
|
|
141
|
+
//console.log(`findValue: char=${c}, row=${row}, col=${col}`);
|
|
142
|
+
if (c === '{') {
|
|
143
|
+
findObject(reader);
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
146
|
+
else if (c === '[') {
|
|
147
|
+
findArray(reader);
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
else if (c === '"') {
|
|
151
|
+
findString(reader);
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
else if (c === '}') {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
else if (c === ']') {
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
else if (c === ',') {
|
|
161
|
+
return false;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
throw new Error('Value not found in document');
|
|
165
|
+
}
|
|
166
|
+
function findObject(reader) {
|
|
167
|
+
let result;
|
|
168
|
+
while ((result = reader.next()) !== null) {
|
|
169
|
+
const [c, row, col] = result;
|
|
170
|
+
//console.log(`findObject: char=${c}, row=${row}, col=${col}`);
|
|
171
|
+
if (c === '}') {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
else if (c === '"') {
|
|
175
|
+
findString(reader);
|
|
176
|
+
}
|
|
177
|
+
else if (c === ':') {
|
|
178
|
+
if (findValue(reader)) {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function findArray(reader) {
|
|
185
|
+
//console.log('findArray');
|
|
186
|
+
if (findValue(reader)) {
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
let workingIndex = 0;
|
|
190
|
+
let result;
|
|
191
|
+
while ((result = reader.next()) !== null) {
|
|
192
|
+
const [c, row, col] = result;
|
|
193
|
+
//console.log(`findArray: char=${c}, row=${row}, col=${col}`);
|
|
194
|
+
if (c === ']') {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
workingIndex += 1;
|
|
198
|
+
if (findValue(reader)) {
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
function findString(reader) {
|
|
204
|
+
let workingString = '';
|
|
205
|
+
let result;
|
|
206
|
+
while ((result = reader.next()) !== null) {
|
|
207
|
+
const [c, row, col] = result;
|
|
208
|
+
//console.log(`findString: char=${c}`);
|
|
209
|
+
if (c === '"') {
|
|
210
|
+
return workingString;
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
workingString += c;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
throw new Error('String not closed');
|
|
217
|
+
}
|
|
218
|
+
//# sourceMappingURL=GetPathDocumentCoordinatesPseudoJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetPathDocumentCoordinatesPseudoJson.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetPathDocumentCoordinatesPseudoJson.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAKH,MAAM,YAAY;IACN,CAAC,CAAS;IACV,KAAK,CAAS;IACd,GAAG,CAAS;IACZ,GAAG,CAAS;IAEpB,YAAY,CAAS;QACjB,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC;QACX,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;QACf,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACb,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;IACjB,CAAC;IAED,IAAI;QACA,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;YAC9B,OAAO,IAAI,CAAC;QAChB,CAAC;QACD,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACb,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;YACd,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC;QACjB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAClB,CAAC;QACD,qEAAqE;QACrE,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,C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AAM,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;QAC7B,8DAA8D;QAC9D,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,OAAO;QACX,CAAC;QACD,YAAY,IAAI,CAAC,CAAC;QAClB,IAAI,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;YACpB,OAAO;QACX,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,UAAU,CAAC,MAAoB;IACpC,IAAI,aAAa,GAAG,EAAE,CAAC;IACvB,IAAI,MAAM,CAAC;IACX,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,EAAE,CAAC;QACvC,MAAM,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC;QAC7B,uCAAuC;QACvC,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,OAAO,aAAa,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,aAAa,IAAI,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
|
|
17
|
+
import { TelepactSchemaParseError } from '../../TelepactSchemaParseError';
|
|
18
|
+
export function getSchemaFileMap(directory, fs, path) {
|
|
19
|
+
const finalJsonDocuments = {};
|
|
20
|
+
const schemaParseFailures = [];
|
|
21
|
+
const paths = fs.readdirSync(directory).map((file) => path.join(directory, file));
|
|
22
|
+
for (const filePath of paths) {
|
|
23
|
+
const relativePath = path.relative(directory, filePath);
|
|
24
|
+
if (fs.statSync(filePath).isDirectory()) {
|
|
25
|
+
schemaParseFailures.push(new SchemaParseFailure(relativePath, [], 'DirectoryDisallowed', {}));
|
|
26
|
+
finalJsonDocuments[relativePath] = '[]';
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
30
|
+
finalJsonDocuments[relativePath] = content;
|
|
31
|
+
if (!filePath.endsWith('.telepact.json')) {
|
|
32
|
+
schemaParseFailures.push(new SchemaParseFailure(relativePath, [], 'FileNamePatternInvalid', { expected: '*.telepact.json' }));
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (schemaParseFailures.length > 0) {
|
|
36
|
+
throw new TelepactSchemaParseError(schemaParseFailures, finalJsonDocuments);
|
|
37
|
+
}
|
|
38
|
+
return finalJsonDocuments;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=GetSchemaFileMap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetSchemaFileMap.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetSchemaFileMap.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E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,IAAI,mBAAmB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,wBAAwB,CAAC,mBAAmB,EAAE,kBAAkB,CAAC,CAAC;IAChF,CAAC;IAED,OAAO,kBAAkB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
|
|
17
|
+
import { getType } from '../../internal/types/GetType';
|
|
18
|
+
export function getTypeUnexpectedParseFailure(documentName, path, value, expectedType) {
|
|
19
|
+
const actualType = getType(value);
|
|
20
|
+
const data = {
|
|
21
|
+
actual: { [actualType]: {} },
|
|
22
|
+
expected: { [expectedType]: {} },
|
|
23
|
+
};
|
|
24
|
+
return [new SchemaParseFailure(documentName, path, 'TypeUnexpected', data)];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=GetTypeUnexpectedParseFailure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GetTypeUnexpectedParseFailure.js","sourceRoot":"","sources":["../../../../src/internal/schema/GetTypeUnexpectedParseFailure.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAEvD,MAAM,UAAU,6BAA6B,CACzC,YAAoB,EACpB,IAAW,EACX,KAAU,EACV,YAAoB;IAEpB,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAyE;QAC/E,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,EAAE;QAC5B,QAAQ,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE;KACnC,CAAC;IACF,OAAO,CAAC,IAAI,kBAAkB,CAAC,YAAY,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 { getPathDocumentCoordinatesPseudoJson } from './GetPathDocumentCoordinatesPseudoJson';
|
|
17
|
+
export function mapSchemaParseFailuresToPseudoJson(schemaParseFailures, documentNamesToJson) {
|
|
18
|
+
const pseudoJsonList = [];
|
|
19
|
+
for (const f of schemaParseFailures) {
|
|
20
|
+
const documentJson = documentNamesToJson[f.documentName];
|
|
21
|
+
const location = getPathDocumentCoordinatesPseudoJson(f.path, documentJson);
|
|
22
|
+
const pseudoJson = {};
|
|
23
|
+
pseudoJson.document = f.documentName;
|
|
24
|
+
pseudoJson.location = location;
|
|
25
|
+
pseudoJson.path = f.path;
|
|
26
|
+
pseudoJson.reason = { [f.reason]: f.data };
|
|
27
|
+
pseudoJsonList.push(Object.assign({}, pseudoJson));
|
|
28
|
+
}
|
|
29
|
+
return pseudoJsonList;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=MapSchemaParseFailuresToPseudoJson.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MapSchemaParseFailuresToPseudoJson.js","sourceRoot":"","sources":["../../../../src/internal/schema/MapSchemaParseFailuresToPseudoJson.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAGH,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAE9F,MAAM,UAAU,kCAAkC,CAC9C,mBAAyC,EACzC,mBAA2C;IAE3C,MAAM,cAAc,GAAU,EAAE,CAAC;IACjC,KAAK,MAAM,CAAC,IAAI,mBAAmB,EAAE,CAAC;QAClC,MAAM,YAAY,GAAG,mBAAmB,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC;QACzD,MAAM,QAAQ,GAAG,oCAAoC,CAAC,CAAC,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QAC5E,MAAM,UAAU,GAAQ,EAAE,CAAC;QAC3B,UAAU,CAAC,QAAQ,GAAG,CAAC,CAAC,YAAY,CAAC;QACrC,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;QACzB,UAAU,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QAC3C,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,OAAO,cAAc,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
|
|
2
|
+
import { TType } from '../types/TType';
|
|
3
|
+
export declare class ParseContext {
|
|
4
|
+
readonly documentName: string;
|
|
5
|
+
readonly telepactSchemaDocumentNamesToPseudoJson: {
|
|
6
|
+
[key: string]: any[];
|
|
7
|
+
};
|
|
8
|
+
readonly telepactSchemaDocumentNamesToJson: {
|
|
9
|
+
[key: string]: string;
|
|
10
|
+
};
|
|
11
|
+
readonly schemaKeysToDocumentName: {
|
|
12
|
+
[key: string]: string;
|
|
13
|
+
};
|
|
14
|
+
readonly schemaKeysToIndex: {
|
|
15
|
+
[key: string]: number;
|
|
16
|
+
};
|
|
17
|
+
readonly parsedTypes: {
|
|
18
|
+
[key: string]: TType;
|
|
19
|
+
};
|
|
20
|
+
readonly fnErrorRegexes: {
|
|
21
|
+
[key: string]: string;
|
|
22
|
+
};
|
|
23
|
+
readonly allParseFailures: SchemaParseFailure[];
|
|
24
|
+
readonly failedTypes: Set<string>;
|
|
25
|
+
constructor(documentName: string, telepactSchemaDocumentNamesToPseudoJson: {
|
|
26
|
+
[key: string]: any[];
|
|
27
|
+
}, telepactSchemaDocumentNamesToJson: {
|
|
28
|
+
[key: string]: string;
|
|
29
|
+
}, schemaKeysToDocumentName: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
}, schemaKeysToIndex: {
|
|
32
|
+
[key: string]: number;
|
|
33
|
+
}, parsedTypes: {
|
|
34
|
+
[key: string]: TType;
|
|
35
|
+
}, fnErrorRegexes: {
|
|
36
|
+
[key: string]: string;
|
|
37
|
+
}, allParseFailures: SchemaParseFailure[], failedTypes: Set<string>);
|
|
38
|
+
copy({ documentName }: {
|
|
39
|
+
documentName?: string;
|
|
40
|
+
}): ParseContext;
|
|
41
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 class ParseContext {
|
|
17
|
+
documentName;
|
|
18
|
+
telepactSchemaDocumentNamesToPseudoJson;
|
|
19
|
+
telepactSchemaDocumentNamesToJson;
|
|
20
|
+
schemaKeysToDocumentName;
|
|
21
|
+
schemaKeysToIndex;
|
|
22
|
+
parsedTypes;
|
|
23
|
+
fnErrorRegexes;
|
|
24
|
+
allParseFailures;
|
|
25
|
+
failedTypes;
|
|
26
|
+
constructor(documentName, telepactSchemaDocumentNamesToPseudoJson, telepactSchemaDocumentNamesToJson, schemaKeysToDocumentName, schemaKeysToIndex, parsedTypes, fnErrorRegexes, allParseFailures, failedTypes) {
|
|
27
|
+
this.documentName = documentName;
|
|
28
|
+
this.telepactSchemaDocumentNamesToPseudoJson = telepactSchemaDocumentNamesToPseudoJson;
|
|
29
|
+
this.telepactSchemaDocumentNamesToJson = telepactSchemaDocumentNamesToJson;
|
|
30
|
+
this.schemaKeysToDocumentName = schemaKeysToDocumentName;
|
|
31
|
+
this.schemaKeysToIndex = schemaKeysToIndex;
|
|
32
|
+
this.parsedTypes = parsedTypes;
|
|
33
|
+
this.fnErrorRegexes = fnErrorRegexes;
|
|
34
|
+
this.allParseFailures = allParseFailures;
|
|
35
|
+
this.failedTypes = failedTypes;
|
|
36
|
+
}
|
|
37
|
+
copy({ documentName }) {
|
|
38
|
+
return new ParseContext(documentName ?? this.documentName, this.telepactSchemaDocumentNamesToPseudoJson, this.telepactSchemaDocumentNamesToJson, this.schemaKeysToDocumentName, this.schemaKeysToIndex, this.parsedTypes, this.fnErrorRegexes, this.allParseFailures, this.failedTypes);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=ParseContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ParseContext.js","sourceRoot":"","sources":["../../../../src/internal/schema/ParseContext.ts"],"names":[],"mappings":"AAAA,GAAG;AACH,mCAAmC;AACnC,GAAG;AACH,oEAAoE;AACpE,qEAAqE;AACrE,4CAA4C;AAC5C,GAAG;AACH,gDAAgD;AAChD,GAAG;AACH,wEAAwE;AACxE,sEAAsE;AACtE,6EAA6E;AAC7E,wEAAwE;AACxE,mCAAmC;AACnC,GAAG;AAKH,MAAM,OAAO,YAAY;IACL,YAAY,CAAS;IACrB,uCAAuC,CAA2B;IAClE,iCAAiC,CAA4B;IAC7D,wBAAwB,CAA4B;IACpD,iBAAiB,CAA4B;IAC7C,WAAW,CAA2B;IACtC,cAAc,CAA4B;IAC1C,gBAAgB,CAAuB;IACvC,WAAW,CAAc;IAEzC,YACI,YAAoB,EACpB,uCAAiE,EACjE,iCAA4D,EAC5D,wBAAmD,EACnD,iBAA4C,EAC5C,WAAqC,EACrC,cAAyC,EACzC,gBAAsC,EACtC,WAAwB;QAExB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,uCAAuC,GAAG,uCAAuC,CAAC;QACvF,IAAI,CAAC,iCAAiC,GAAG,iCAAiC,CAAC;QAC3E,IAAI,CAAC,wBAAwB,GAAG,wBAAwB,CAAC;QACzD,IAAI,CAAC,iBAAiB,GAAG,iBAAiB,CAAC;QAC3C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;QACrC,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;IAEM,IAAI,CAAC,EAAE,YAAY,EAA6B;QACnD,OAAO,IAAI,YAAY,CACnB,YAAY,IAAI,IAAI,CAAC,YAAY,EACjC,IAAI,CAAC,uCAAuC,EAC5C,IAAI,CAAC,iCAAiC,EACtC,IAAI,CAAC,wBAAwB,EAC7B,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,cAAc,EACnB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,WAAW,CACnB,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//|
|
|
2
|
+
//| Copyright The Telepact Authors
|
|
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
|
+
//| https://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 { SchemaParseFailure } from '../../internal/schema/SchemaParseFailure';
|
|
17
|
+
import { TError } from '../types/TError';
|
|
18
|
+
import { TelepactSchemaParseError } from '../../TelepactSchemaParseError';
|
|
19
|
+
import { parseUnionType } from '../../internal/schema/ParseUnionType';
|
|
20
|
+
export function parseErrorType(path, errorDefinitionAsParsedJson, schemaKey, ctx) {
|
|
21
|
+
const parseFailures = [];
|
|
22
|
+
const otherKeys = Object.keys(errorDefinitionAsParsedJson).filter((key) => key !== schemaKey && key !== '///');
|
|
23
|
+
if (otherKeys.length > 0) {
|
|
24
|
+
for (const k of otherKeys) {
|
|
25
|
+
const loopPath = path.concat(k);
|
|
26
|
+
parseFailures.push(new SchemaParseFailure(ctx.documentName, loopPath, 'ObjectKeyDisallowed', {}));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (parseFailures.length > 0) {
|
|
30
|
+
throw new TelepactSchemaParseError(parseFailures, ctx.telepactSchemaDocumentNamesToJson);
|
|
31
|
+
}
|
|
32
|
+
const error = parseUnionType(path, errorDefinitionAsParsedJson, schemaKey, [], [], ctx);
|
|
33
|
+
return new TError(schemaKey, error);
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=ParseErrorType.js.map
|