mirror of
https://github.com/Bayselonarrend/OpenIntegrations.git
synced 2026-06-20 09:19:27 +02:00
Main build (Jenkins)
This commit is contained in:
@@ -1 +1 @@
|
||||
2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C
|
||||
465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F
|
||||
+11
-11
@@ -34,24 +34,24 @@
|
||||
|
||||
Package = New Structure;
|
||||
|
||||
Items = New Array;
|
||||
Products = New Array;
|
||||
|
||||
Item = New Structure;
|
||||
Product = New Structure;
|
||||
|
||||
Payment = New Structure;
|
||||
Payment.Insert("value", 3000);
|
||||
|
||||
Item.Insert("payment" , Payment);
|
||||
Item.Insert("ware_key", "00055");
|
||||
Item.Insert("name" , "Product");
|
||||
Item.Insert("cost" , 300);
|
||||
Item.Insert("amount" , 2);
|
||||
Item.Insert("weight" , 700);
|
||||
Item.Insert("url" , "www.item.ru");
|
||||
Product.Insert("payment" , Payment);
|
||||
Product.Insert("ware_key", "00055");
|
||||
Product.Insert("name" , "Product");
|
||||
Product.Insert("cost" , 300);
|
||||
Product.Insert("amount" , 2);
|
||||
Product.Insert("weight" , 700);
|
||||
Product.Insert("url" , "www.item.ru");
|
||||
|
||||
Items.Add(Item);
|
||||
Product.Add(Product);
|
||||
|
||||
Package.Insert("items" , Items);
|
||||
Package.Insert("items" , Product);
|
||||
Package.Insert("number" , "bar-001");
|
||||
Package.Insert("comment", "Packaging");
|
||||
Package.Insert("height" , 10);
|
||||
|
||||
+11
-11
@@ -92,24 +92,24 @@ Method at API documentation: [Order registration](https://api-docs.cdek.ru/33828
|
||||
|
||||
Package = New Structure;
|
||||
|
||||
Items = New Array;
|
||||
Products = New Array;
|
||||
|
||||
Item = New Structure;
|
||||
Product = New Structure;
|
||||
|
||||
Payment = New Structure;
|
||||
Payment.Insert("value", 3000);
|
||||
|
||||
Item.Insert("payment" , Payment);
|
||||
Item.Insert("ware_key", "00055");
|
||||
Item.Insert("name" , "Product");
|
||||
Item.Insert("cost" , 300);
|
||||
Item.Insert("amount" , 2);
|
||||
Item.Insert("weight" , 700);
|
||||
Item.Insert("url" , "www.item.ru");
|
||||
Product.Insert("payment" , Payment);
|
||||
Product.Insert("ware_key", "00055");
|
||||
Product.Insert("name" , "Product");
|
||||
Product.Insert("cost" , 300);
|
||||
Product.Insert("amount" , 2);
|
||||
Product.Insert("weight" , 700);
|
||||
Product.Insert("url" , "www.item.ru");
|
||||
|
||||
Items.Add(Item);
|
||||
Product.Add(Product);
|
||||
|
||||
Package.Insert("items" , Items);
|
||||
Package.Insert("items" , Product);
|
||||
Package.Insert("number" , "bar-001");
|
||||
Package.Insert("comment", "Packaging");
|
||||
Package.Insert("height" , 10);
|
||||
|
||||
+11
-11
@@ -34,24 +34,24 @@
|
||||
|
||||
Пакет = Новый Структура;
|
||||
|
||||
Позиции = Новый Массив;
|
||||
Товары = Новый Массив;
|
||||
|
||||
Позиция = Новый Структура;
|
||||
Товар = Новый Структура;
|
||||
|
||||
Оплата = Новый Структура;
|
||||
Оплата.Вставить("value", 3000);
|
||||
|
||||
Позиция.Вставить("payment" , Оплата);
|
||||
Позиция.Вставить("ware_key", "00055");
|
||||
Позиция.Вставить("name" , "Товар");
|
||||
Позиция.Вставить("cost" , 300);
|
||||
Позиция.Вставить("amount" , 2);
|
||||
Позиция.Вставить("weight" , 700);
|
||||
Позиция.Вставить("url" , "www.item.ru");
|
||||
Товар.Вставить("payment" , Оплата);
|
||||
Товар.Вставить("ware_key", "00055");
|
||||
Товар.Вставить("name" , "Товар");
|
||||
Товар.Вставить("cost" , 300);
|
||||
Товар.Вставить("amount" , 2);
|
||||
Товар.Вставить("weight" , 700);
|
||||
Товар.Вставить("url" , "www.item.ru");
|
||||
|
||||
Позиции.Добавить(Позиция);
|
||||
Товар.Добавить(Товар);
|
||||
|
||||
Пакет.Вставить("items" , Позиции);
|
||||
Пакет.Вставить("items" , Товар);
|
||||
Пакет.Вставить("number" , "bar-001");
|
||||
Пакет.Вставить("comment", "Упаковка");
|
||||
Пакет.Вставить("height" , 10);
|
||||
|
||||
+11
-11
@@ -92,24 +92,24 @@ import Admonition from '@theme/Admonition';
|
||||
|
||||
Пакет = Новый Структура;
|
||||
|
||||
Позиции = Новый Массив;
|
||||
Товары = Новый Массив;
|
||||
|
||||
Позиция = Новый Структура;
|
||||
Товар = Новый Структура;
|
||||
|
||||
Оплата = Новый Структура;
|
||||
Оплата.Вставить("value", 3000);
|
||||
|
||||
Позиция.Вставить("payment" , Оплата);
|
||||
Позиция.Вставить("ware_key", "00055");
|
||||
Позиция.Вставить("name" , "Товар");
|
||||
Позиция.Вставить("cost" , 300);
|
||||
Позиция.Вставить("amount" , 2);
|
||||
Позиция.Вставить("weight" , 700);
|
||||
Позиция.Вставить("url" , "www.item.ru");
|
||||
Товар.Вставить("payment" , Оплата);
|
||||
Товар.Вставить("ware_key", "00055");
|
||||
Товар.Вставить("name" , "Товар");
|
||||
Товар.Вставить("cost" , 300);
|
||||
Товар.Вставить("amount" , 2);
|
||||
Товар.Вставить("weight" , 700);
|
||||
Товар.Вставить("url" , "www.item.ru");
|
||||
|
||||
Позиции.Добавить(Позиция);
|
||||
Товар.Добавить(Товар);
|
||||
|
||||
Пакет.Вставить("items" , Позиции);
|
||||
Пакет.Вставить("items" , Товар);
|
||||
Пакет.Вставить("number" , "bar-001");
|
||||
Пакет.Вставить("comment", "Упаковка");
|
||||
Пакет.Вставить("height" , 10);
|
||||
|
||||
+11689
-11689
File diff suppressed because it is too large
Load Diff
@@ -1 +1 @@
|
||||
2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C
|
||||
465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
Function GetHashSum() Export
|
||||
|
||||
LastBuildHash = "2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C";
|
||||
LastBuildHash = "465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F";
|
||||
|
||||
Return LastBuildHash;
|
||||
|
||||
|
||||
@@ -305,12 +305,12 @@ Function PackInt32BEJanx(Val Number)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadInt32BEJanx(Val Buffer, Val Item)
|
||||
Function ReadInt32BEJanx(Val Buffer, Val Position)
|
||||
|
||||
Byte0 = Buffer.Get(Item);
|
||||
Byte1 = Buffer.Get(Item + 1);
|
||||
Byte2 = Buffer.Get(Item + 2);
|
||||
Byte3 = Buffer.Get(Item + 3);
|
||||
Byte0 = Buffer.Get(Position);
|
||||
Byte1 = Buffer.Get(Position + 1);
|
||||
Byte2 = Buffer.Get(Position + 2);
|
||||
Byte3 = Buffer.Get(Position + 3);
|
||||
|
||||
Return Byte0 * 16777216 + Byte1 * 65536 + Byte2 * 256 + Byte3;
|
||||
|
||||
|
||||
+160
-160
@@ -106,93 +106,93 @@ Procedure WriteValue(Val Data, Context)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadValue(Val Buffer, Val Item)
|
||||
Function ReadValue(Val Buffer, Val Position)
|
||||
|
||||
Tag = Buffer.Get(Item);
|
||||
Tag = Buffer.Get(Position);
|
||||
|
||||
If Tag <= _posFixintMax() Then
|
||||
Return ReadingResult(Tag, Item + 1);
|
||||
Return ReadingResult(Tag, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _negFixintMin() Then
|
||||
Return ReadingResult(Tag - 256, Item + 1);
|
||||
Return ReadingResult(Tag - 256, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _fixstr() And Tag <= _fixstrMax() Then
|
||||
Return ReadStringFromBuffer(Buffer, Item + 1, Tag - _fixstr());
|
||||
Return ReadStringFromBuffer(Buffer, Position + 1, Tag - _fixstr());
|
||||
EndIf;
|
||||
|
||||
If Tag = _str8() Then
|
||||
Length = Buffer.Get(Item + 1);
|
||||
Return ReadStringFromBuffer(Buffer, Item + 2, Length);
|
||||
Length = Buffer.Get(Position + 1);
|
||||
Return ReadStringFromBuffer(Buffer, Position + 2, Length);
|
||||
EndIf;
|
||||
|
||||
If Tag = _str16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _str32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _nil() Then
|
||||
Return ReadingResult(Undefined, Item + 1);
|
||||
Return ReadingResult(Undefined, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _false() Then
|
||||
Return ReadingResult(False, Item + 1);
|
||||
Return ReadingResult(False, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _true() Then
|
||||
Return ReadingResult(True, Item + 1);
|
||||
Return ReadingResult(True, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _bin8() Then
|
||||
Length = Buffer.Get(Item + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, Item + 2, Length);
|
||||
Length = Buffer.Get(Position + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, Position + 2, Length);
|
||||
EndIf;
|
||||
|
||||
If Tag = _bin16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _bin32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _fixmap() And Tag <= _fixmapMax() Then
|
||||
Return ReadMapFromBuffer(Buffer, Item + 1, Tag - _fixmap());
|
||||
Return ReadMapFromBuffer(Buffer, Position + 1, Tag - _fixmap());
|
||||
EndIf;
|
||||
|
||||
If Tag = _map16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _map32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _fixarray() And Tag <= _fixarrayMax() Then
|
||||
Return ReadArrayFromBuffer(Buffer, Item + 1, Tag - _fixarray());
|
||||
Return ReadArrayFromBuffer(Buffer, Position + 1, Tag - _fixarray());
|
||||
EndIf;
|
||||
|
||||
If Tag = _array16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _array32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
NumberReading = ReadNumber(Buffer, Item, Tag);
|
||||
NumberReading = ReadNumber(Buffer, Position, Tag);
|
||||
|
||||
If NumberReading <> Undefined Then
|
||||
Return NumberReading;
|
||||
@@ -221,20 +221,20 @@ EndFunction
|
||||
|
||||
Procedure EnsureContextCapacity(Context, Val NeedByte)
|
||||
|
||||
If NeedByte <= Context.Capacity - Context.Item Then
|
||||
If NeedByte <= Context.Capacity - Context.Position Then
|
||||
Return;
|
||||
EndIf;
|
||||
|
||||
NewCapacity = Context.Capacity;
|
||||
|
||||
While NewCapacity - Context.Item < NeedByte Do
|
||||
While NewCapacity - Context.Position < NeedByte Do
|
||||
NewCapacity = NewCapacity * 2;
|
||||
EndDo;
|
||||
|
||||
NewBuffer = New BinaryDataBuffer(NewCapacity, ByteOrder.BigEndian);
|
||||
|
||||
If Context.Item > 0 Then
|
||||
Fragment = Context.Buffer.Read(0, Context.Item);
|
||||
If Context.Position > 0 Then
|
||||
Fragment = Context.Buffer.Read(0, Context.Position);
|
||||
NewBuffer.Write(0, Fragment);
|
||||
EndIf;
|
||||
|
||||
@@ -246,45 +246,45 @@ EndProcedure
|
||||
Procedure WriteByteToContext(Context, Val Byte)
|
||||
|
||||
EnsureContextCapacity(Context, 1);
|
||||
Context.Buffer.Set(Context.Item, Byte);
|
||||
Context.Item = Context.Item + 1;
|
||||
Context.Buffer.Set(Context.Position, Byte);
|
||||
Context.Position = Context.Position + 1;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function GetBinaryDataFromRecordContext(Val Context)
|
||||
|
||||
If Context.Item = 0 Then
|
||||
If Context.Position = 0 Then
|
||||
Return GetBinaryDataFromString("");
|
||||
EndIf;
|
||||
|
||||
If Context.Item = Context.Capacity Then
|
||||
If Context.Position = Context.Capacity Then
|
||||
Return GetBinaryDataFromBinaryDataBuffer(Context.Buffer);
|
||||
EndIf;
|
||||
|
||||
Fragment = Context.Buffer.Read(0, Context.Item);
|
||||
Fragment = Context.Buffer.Read(0, Context.Position);
|
||||
|
||||
Return GetBinaryDataFromBinaryDataBuffer(Fragment);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadingResult(Val Value, Val Item)
|
||||
Function ReadingResult(Val Value, Val Position)
|
||||
|
||||
Return New Structure("Value, Position", Value, Position);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadUnsignedInteger16FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadUnsignedInteger16FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Byte0 = Buffer.Get(Item);
|
||||
Byte1 = Buffer.Get(Item + 1);
|
||||
Byte0 = Buffer.Get(Position);
|
||||
Byte1 = Buffer.Get(Position + 1);
|
||||
|
||||
Return ReadingResult(Byte0 * 256 + Byte1, Item + 2);
|
||||
Return ReadingResult(Byte0 * 256 + Byte1, Position + 2);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadUnsignedInteger32FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadUnsignedInteger32FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt32(Item);
|
||||
Value = Buffer.ReadInt32(Position);
|
||||
|
||||
If Value < 0 Then
|
||||
Value = Value + 4294967296;
|
||||
@@ -294,9 +294,9 @@ Function ReadUnsignedInteger32FromBuffer(Val Buffer, Val Item)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadUnsignedInteger64FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadUnsignedInteger64FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt64(Item);
|
||||
Value = Buffer.ReadInt64(Position);
|
||||
|
||||
If Value < 0 Then
|
||||
Value = Value + 18446744073709551616;
|
||||
@@ -306,54 +306,54 @@ Function ReadUnsignedInteger64FromBuffer(Val Buffer, Val Item)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger8FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger8FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Byte = Buffer.Get(Item);
|
||||
Byte = Buffer.Get(Position);
|
||||
|
||||
If Byte >= 128 Then
|
||||
Byte = Byte - 256;
|
||||
EndIf;
|
||||
|
||||
Return ReadingResult(Byte, Item + 1);
|
||||
Return ReadingResult(Byte, Position + 1);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger16FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger16FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt16(Item);
|
||||
Value = Buffer.ReadInt16(Position);
|
||||
|
||||
Return ReadingResult(Value, Position + 2);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger32FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger32FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt32(Item);
|
||||
Value = Buffer.ReadInt32(Position);
|
||||
|
||||
Return ReadingResult(Value, Position + 4);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger64FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger64FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt64(Item);
|
||||
Value = Buffer.ReadInt64(Position);
|
||||
|
||||
Return ReadingResult(Value, Position + 8);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadFloat32FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadFloat32FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
NumberBuffer = Buffer.Read(Item, 4);
|
||||
NumberBuffer = Buffer.Read(Position, 4);
|
||||
Value = DecodeFloat32BE(NumberBuffer);
|
||||
|
||||
Return ReadingResult(Value, Position + 4);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadFloat64FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadFloat64FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
NumberBuffer = Buffer.Read(Item, 8);
|
||||
NumberBuffer = Buffer.Read(Position, 8);
|
||||
Value = DecodeFloat64BE(NumberBuffer);
|
||||
|
||||
Return ReadingResult(Value, Position + 8);
|
||||
@@ -514,49 +514,49 @@ Procedure WriteStringToContext(Val Data, Context)
|
||||
If DataSize < 32 Then
|
||||
|
||||
EnsureContextCapacity(Context, 1 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _fixstr() + DataSize);
|
||||
Context.Buffer.Write(Context.Item + 1, BufferString);
|
||||
Context.Item = Context.Item + 1 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _fixstr() + DataSize);
|
||||
Context.Buffer.Write(Context.Position + 1, BufferString);
|
||||
Context.Position = Context.Position + 1 + DataSize;
|
||||
|
||||
ElsIf DataSize < 256 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2 + DataSize);
|
||||
Context.Buffer.Set(Context.Item , _str8());
|
||||
Context.Buffer.Set(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 2, BufferString);
|
||||
Context.Item = Context.Item + 2 + DataSize;
|
||||
Context.Buffer.Set(Context.Position , _str8());
|
||||
Context.Buffer.Set(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 2, BufferString);
|
||||
Context.Position = Context.Position + 2 + DataSize;
|
||||
|
||||
ElsIf DataSize < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _str16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 3, BufferString);
|
||||
Context.Item = Context.Item + 3 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _str16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 3, BufferString);
|
||||
Context.Position = Context.Position + 3 + DataSize;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _str32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 5, BufferString);
|
||||
Context.Item = Context.Item + 5 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _str32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 5, BufferString);
|
||||
Context.Position = Context.Position + 5 + DataSize;
|
||||
|
||||
EndIf;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadStringFromBuffer(Val Buffer, Val Item, Val Length)
|
||||
Function ReadStringFromBuffer(Val Buffer, Val Position, Val Length)
|
||||
|
||||
If Length = 0 Then
|
||||
Return ReadingResult("", Item);
|
||||
Return ReadingResult("", Position);
|
||||
EndIf;
|
||||
|
||||
FragmentBuffer = Buffer.Read(Item, Length);
|
||||
FragmentBuffer = Buffer.Read(Position, Length);
|
||||
BDFragment = GetBinaryDataFromBinaryDataBuffer(FragmentBuffer);
|
||||
String = GetStringFromBinaryData(BDFragment, "UTF-8");
|
||||
|
||||
Return ReadingResult(String, Item + Length);
|
||||
Return ReadingResult(String, Position + Length);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -572,41 +572,41 @@ Procedure RecordBinaryDataInContext(Val Data, Context)
|
||||
If DataSize < 256 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2 + DataSize);
|
||||
Context.Buffer.Set(Context.Item , _bin8());
|
||||
Context.Buffer.Set(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 2, BufferBody);
|
||||
Context.Item = Context.Item + 2 + DataSize;
|
||||
Context.Buffer.Set(Context.Position , _bin8());
|
||||
Context.Buffer.Set(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 2, BufferBody);
|
||||
Context.Position = Context.Position + 2 + DataSize;
|
||||
|
||||
ElsIf DataSize < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _bin16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 3, BufferBody);
|
||||
Context.Item = Context.Item + 3 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _bin16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 3, BufferBody);
|
||||
Context.Position = Context.Position + 3 + DataSize;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _bin32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 5, BufferBody);
|
||||
Context.Item = Context.Item + 5 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _bin32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 5, BufferBody);
|
||||
Context.Position = Context.Position + 5 + DataSize;
|
||||
|
||||
EndIf;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadBinaryDataFromBuffer(Val Buffer, Val Item, Val Length)
|
||||
Function ReadBinaryDataFromBuffer(Val Buffer, Val Position, Val Length)
|
||||
|
||||
If Length = 0 Then
|
||||
Return ReadingResult(GetBinaryDataFromString(""), Item);
|
||||
Return ReadingResult(GetBinaryDataFromString(""), Position);
|
||||
EndIf;
|
||||
|
||||
FragmentBuffer = Buffer.Read(Item, Length);
|
||||
FragmentBuffer = Buffer.Read(Position, Length);
|
||||
BDFragment = GetBinaryDataFromBinaryDataBuffer(FragmentBuffer);
|
||||
|
||||
Return ReadingResult(BDFragment, Item + Length);
|
||||
Return ReadingResult(BDFragment, Position + Length);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -625,16 +625,16 @@ Procedure WriteArrayToContext(Val Data, Context)
|
||||
ElsIf ItemCount < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _array16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, ItemCount);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _array16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, ItemCount);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _array32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, ItemCount);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _array32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, ItemCount);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -644,19 +644,19 @@ Procedure WriteArrayToContext(Val Data, Context)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadArrayFromBuffer(Val Buffer, Val Item, Val ItemCount)
|
||||
Function ReadArrayFromBuffer(Val Buffer, Val Position, Val ItemCount)
|
||||
|
||||
Array = New Array;
|
||||
|
||||
For Index = 1 To ItemCount Do
|
||||
|
||||
ItemReading = ReadValue(Buffer, Item);
|
||||
ItemReading = ReadValue(Buffer, Position);
|
||||
Array.Add(ItemReading.Value);
|
||||
Item = ItemReading.Item;
|
||||
Position = ItemReading.Position;
|
||||
|
||||
EndDo;
|
||||
|
||||
Return ReadingResult(Array, Item);
|
||||
Return ReadingResult(Array, Position);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -679,16 +679,16 @@ Procedure WriteMapToContext(Val Data, Context)
|
||||
ElsIf PairCount < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _map16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, PairCount);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _map16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, PairCount);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _map32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, PairCount);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _map32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, PairCount);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -706,26 +706,26 @@ Procedure WriteMapToContext(Val Data, Context)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadMapFromBuffer(Val Buffer, Val Item, Val PairCount)
|
||||
Function ReadMapFromBuffer(Val Buffer, Val Position, Val PairCount)
|
||||
|
||||
Map = New Map;
|
||||
|
||||
For Index = 1 To PairCount Do
|
||||
|
||||
KeyReading = ReadValue(Buffer, Item);
|
||||
Item = KeyReading.Item;
|
||||
KeyReading = ReadValue(Buffer, Position);
|
||||
Position = KeyReading.Position;
|
||||
|
||||
If TypeOf(KeyReading.Value) <> Type("String") Then
|
||||
Raise "MessagePack map key must be a string";
|
||||
EndIf;
|
||||
|
||||
ValueReading = ReadValue(Buffer, Item);
|
||||
ValueReading = ReadValue(Buffer, Position);
|
||||
Map.Insert(KeyReading.Value, ValueReading.Value);
|
||||
Item = ValueReading.Item;
|
||||
Position = ValueReading.Position;
|
||||
|
||||
EndDo;
|
||||
|
||||
Return ReadingResult(Map, Item);
|
||||
Return ReadingResult(Map, Position);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -766,9 +766,9 @@ Procedure RecordFloat32InContext(Val Number, Context)
|
||||
Body = EncodeFloat32BE(Number);
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _float32());
|
||||
Context.Buffer.Write(Context.Item + 1, Body);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _float32());
|
||||
Context.Buffer.Write(Context.Position + 1, Body);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -777,9 +777,9 @@ Procedure RecordFloat64InContext(Val Number, Context)
|
||||
Body = EncodeFloat64BE(Number);
|
||||
|
||||
EnsureContextCapacity(Context, 9);
|
||||
Context.Buffer.Set(Context.Item, _float64());
|
||||
Context.Buffer.Write(Context.Item + 1, Body);
|
||||
Context.Item = Context.Item + 9;
|
||||
Context.Buffer.Set(Context.Position, _float64());
|
||||
Context.Buffer.Write(Context.Position + 1, Body);
|
||||
Context.Position = Context.Position + 9;
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -792,30 +792,30 @@ Procedure RecordPositiveIntegerInContext(Val Number, Context)
|
||||
ElsIf Number < 256 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2);
|
||||
Context.Buffer.Set(Context.Item , _uint8());
|
||||
Context.Buffer.Set(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 2;
|
||||
Context.Buffer.Set(Context.Position , _uint8());
|
||||
Context.Buffer.Set(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 2;
|
||||
|
||||
ElsIf Number < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _uint16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _uint16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
ElsIf Number < 4294967296 Then
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _uint32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _uint32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 9);
|
||||
Context.Buffer.Set(Context.Item, _uint64());
|
||||
Context.Buffer.WriteInt64(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 9;
|
||||
Context.Buffer.Set(Context.Position, _uint64());
|
||||
Context.Buffer.WriteInt64(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 9;
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -830,75 +830,75 @@ Procedure RecordNegativeIntegerInContext(Val Number, Context)
|
||||
ElsIf Number >= -128 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2);
|
||||
Context.Buffer.Set(Context.Item , _int8());
|
||||
Context.Buffer.Set(Context.Item + 1, _negFixintMin() + 32 + Number);
|
||||
Context.Item = Context.Item + 2;
|
||||
Context.Buffer.Set(Context.Position , _int8());
|
||||
Context.Buffer.Set(Context.Position + 1, _negFixintMin() + 32 + Number);
|
||||
Context.Position = Context.Position + 2;
|
||||
|
||||
ElsIf Number >= -32768 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _int16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _int16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
ElsIf Number >= -2147483648 Then
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _int32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _int32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 9);
|
||||
Context.Buffer.Set(Context.Item, _int64());
|
||||
Context.Buffer.WriteInt64(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 9;
|
||||
Context.Buffer.Set(Context.Position, _int64());
|
||||
Context.Buffer.WriteInt64(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 9;
|
||||
|
||||
EndIf;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadNumber(Val Buffer, Val Item, Val Tag)
|
||||
Function ReadNumber(Val Buffer, Val Position, Val Tag)
|
||||
|
||||
If Tag = _uint8() Then
|
||||
Return ReadingResult(Buffer.Get(Item + 1), Item + 2);
|
||||
Return ReadingResult(Buffer.Get(Position + 1), Position + 2);
|
||||
EndIf;
|
||||
|
||||
If Tag = _uint16() Then
|
||||
Return ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _uint32() Then
|
||||
Return ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _uint64() Then
|
||||
Return ReadUnsignedInteger64FromBuffer(Buffer, Item + 1);
|
||||
Return ReadUnsignedInteger64FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int8() Then
|
||||
Return ReadSignedInteger8FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger8FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int16() Then
|
||||
Return ReadSignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int32() Then
|
||||
Return ReadSignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int64() Then
|
||||
Return ReadSignedInteger64FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger64FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _float32() Then
|
||||
Return ReadFloat32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadFloat32FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _float64() Then
|
||||
Return ReadFloat64FromBuffer(Buffer, Item + 1);
|
||||
Return ReadFloat64FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
Return Undefined;
|
||||
|
||||
@@ -1444,7 +1444,7 @@ Function GetObjectInChunks(Val BasicData
|
||||
Try
|
||||
|
||||
ChunkHeader = CurrentSet["Title"];
|
||||
CurrentPosition = CurrentSet["Item"];
|
||||
CurrentPosition = CurrentSet["Position"];
|
||||
|
||||
SourceHeader = New Map();
|
||||
SourceHeader.Insert("Range", ChunkHeader);
|
||||
|
||||
@@ -15038,9 +15038,9 @@ Function ConvertReferenceValueMessagePack(Val Value)
|
||||
|
||||
Return Base64Value(Value["__msgpack_bytes__"]);
|
||||
|
||||
ElsIf IsNodeJSBufferMessagePack(Value) Then
|
||||
ElsIf IsNodeJSMessagePackBuffer(Value) Then
|
||||
|
||||
Return BinaryDataFromNodeJSBufferMessagePack(Value);
|
||||
Return BinaryDataFromNodeJSMessagePackDataBuffer(Value);
|
||||
|
||||
ElsIf TypeOf(Value) = Type("Array") Then
|
||||
|
||||
@@ -15074,7 +15074,7 @@ Function ConvertReferenceValueMessagePack(Val Value)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function IsNodeJSBufferMessagePack(Val Value)
|
||||
Function IsNodeJSMessagePackBuffer(Val Value)
|
||||
|
||||
If Not OPI_Tools.ThisIsCollection(Value, True) Then
|
||||
Return False;
|
||||
@@ -15085,12 +15085,12 @@ Function IsNodeJSBufferMessagePack(Val Value)
|
||||
Return False;
|
||||
EndIf;
|
||||
|
||||
Return Value["type"] = "Buffer"
|
||||
Return Value["type"] = "Buffer"
|
||||
And TypeOf(Value["data"]) = Type("Array");
|
||||
|
||||
EndFunction
|
||||
|
||||
Function BinaryDataFromNodeJSBufferMessagePack(Val Value)
|
||||
Function BinaryDataFromNodeJSMessagePackDataBuffer(Val Value)
|
||||
|
||||
Bytes = Value["data"];
|
||||
Buffer = New BinaryDataBuffer(Bytes.Count());
|
||||
|
||||
+11
-11
@@ -243,24 +243,24 @@ Procedure CDEK_CreateOrder(FunctionParameters)
|
||||
|
||||
Package = New Structure;
|
||||
|
||||
Items = New Array;
|
||||
Products = New Array;
|
||||
|
||||
Item = New Structure;
|
||||
Product = New Structure;
|
||||
|
||||
Payment = New Structure;
|
||||
Payment.Insert("value", 3000);
|
||||
|
||||
Item.Insert("payment" , Payment);
|
||||
Item.Insert("ware_key", "00055");
|
||||
Item.Insert("name" , "Product");
|
||||
Item.Insert("cost" , 300);
|
||||
Item.Insert("amount" , 2);
|
||||
Item.Insert("weight" , 700);
|
||||
Item.Insert("url" , "www.item.ru");
|
||||
Product.Insert("payment" , Payment);
|
||||
Product.Insert("ware_key", "00055");
|
||||
Product.Insert("name" , "Product");
|
||||
Product.Insert("cost" , 300);
|
||||
Product.Insert("amount" , 2);
|
||||
Product.Insert("weight" , 700);
|
||||
Product.Insert("url" , "www.item.ru");
|
||||
|
||||
Items.Add(Item);
|
||||
Product.Add(Product);
|
||||
|
||||
Package.Insert("items" , Items);
|
||||
Package.Insert("items" , Product);
|
||||
Package.Insert("number" , "bar-001");
|
||||
Package.Insert("comment", "Packaging");
|
||||
Package.Insert("height" , 10);
|
||||
|
||||
@@ -140,7 +140,7 @@ Function MessagePackPackReference(BaseURL, Data)
|
||||
.SetDataType("application/json")
|
||||
.SetStringBody("null");
|
||||
|
||||
ElsIf OPI_Tools.IsCollection(Data, True) Then
|
||||
ElsIf OPI_Tools.ThisIsCollection(Data, True) Then
|
||||
|
||||
Request = Request.SetJsonBody(Data);
|
||||
|
||||
|
||||
+11
-11
@@ -254,24 +254,24 @@ Procedure CDEK_CreateOrder(FunctionParameters)
|
||||
|
||||
Package = New Structure;
|
||||
|
||||
Items = New Array;
|
||||
Products = New Array;
|
||||
|
||||
Item = New Structure;
|
||||
Product = New Structure;
|
||||
|
||||
Payment = New Structure;
|
||||
Payment.Insert("value", 3000);
|
||||
|
||||
Item.Insert("payment" , Payment);
|
||||
Item.Insert("ware_key", "00055");
|
||||
Item.Insert("name" , "Product");
|
||||
Item.Insert("cost" , 300);
|
||||
Item.Insert("amount" , 2);
|
||||
Item.Insert("weight" , 700);
|
||||
Item.Insert("url" , "www.item.ru");
|
||||
Product.Insert("payment" , Payment);
|
||||
Product.Insert("ware_key", "00055");
|
||||
Product.Insert("name" , "Product");
|
||||
Product.Insert("cost" , 300);
|
||||
Product.Insert("amount" , 2);
|
||||
Product.Insert("weight" , 700);
|
||||
Product.Insert("url" , "www.item.ru");
|
||||
|
||||
Items.Add(Item);
|
||||
Product.Add(Product);
|
||||
|
||||
Package.Insert("items" , Items);
|
||||
Package.Insert("items" , Product);
|
||||
Package.Insert("number" , "bar-001");
|
||||
Package.Insert("comment", "Packaging");
|
||||
Package.Insert("height" , 10);
|
||||
|
||||
@@ -141,10 +141,16 @@ Function MessagePackPackReference(BaseURL, Data)
|
||||
.SetDataType("application/json")
|
||||
.SetStringBody("null");
|
||||
|
||||
Else
|
||||
ElsIf OPI_Tools.ThisIsCollection(Data, True) Then
|
||||
|
||||
Request = Request.SetJsonBody(Data);
|
||||
|
||||
Else
|
||||
|
||||
Request = Request
|
||||
.SetDataType("application/json; charset=utf-8")
|
||||
.SetStringBody(OPI_Tools.JSONString(Data, "None", False));
|
||||
|
||||
EndIf;
|
||||
|
||||
Return Request.ProcessRequest("POST").ReturnResponseAsBinaryData();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C
|
||||
465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F
|
||||
Vendored
+1
-1
@@ -1443,7 +1443,7 @@ Function GetObjectInChunks(Val BasicData
|
||||
Try
|
||||
|
||||
ChunkHeader = CurrentSet["Title"];
|
||||
CurrentPosition = CurrentSet["Item"];
|
||||
CurrentPosition = CurrentSet["Position"];
|
||||
|
||||
SourceHeader = New Map();
|
||||
SourceHeader.Insert("Range", ChunkHeader);
|
||||
|
||||
+5
-5
@@ -304,12 +304,12 @@ Function PackInt32BEJanx(Val Number)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadInt32BEJanx(Val Buffer, Val Item)
|
||||
Function ReadInt32BEJanx(Val Buffer, Val Position)
|
||||
|
||||
Byte0 = Buffer.Get(Item);
|
||||
Byte1 = Buffer.Get(Item + 1);
|
||||
Byte2 = Buffer.Get(Item + 2);
|
||||
Byte3 = Buffer.Get(Item + 3);
|
||||
Byte0 = Buffer.Get(Position);
|
||||
Byte1 = Buffer.Get(Position + 1);
|
||||
Byte2 = Buffer.Get(Position + 2);
|
||||
Byte3 = Buffer.Get(Position + 3);
|
||||
|
||||
Return Byte0 * 16777216 + Byte1 * 65536 + Byte2 * 256 + Byte3;
|
||||
|
||||
|
||||
+160
-160
@@ -105,93 +105,93 @@ Procedure WriteValue(Val Data, Context)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadValue(Val Buffer, Val Item)
|
||||
Function ReadValue(Val Buffer, Val Position)
|
||||
|
||||
Tag = Buffer.Get(Item);
|
||||
Tag = Buffer.Get(Position);
|
||||
|
||||
If Tag <= _posFixintMax() Then
|
||||
Return ReadingResult(Tag, Item + 1);
|
||||
Return ReadingResult(Tag, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _negFixintMin() Then
|
||||
Return ReadingResult(Tag - 256, Item + 1);
|
||||
Return ReadingResult(Tag - 256, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _fixstr() And Tag <= _fixstrMax() Then
|
||||
Return ReadStringFromBuffer(Buffer, Item + 1, Tag - _fixstr());
|
||||
Return ReadStringFromBuffer(Buffer, Position + 1, Tag - _fixstr());
|
||||
EndIf;
|
||||
|
||||
If Tag = _str8() Then
|
||||
Length = Buffer.Get(Item + 1);
|
||||
Return ReadStringFromBuffer(Buffer, Item + 2, Length);
|
||||
Length = Buffer.Get(Position + 1);
|
||||
Return ReadStringFromBuffer(Buffer, Position + 2, Length);
|
||||
EndIf;
|
||||
|
||||
If Tag = _str16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _str32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadStringFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _nil() Then
|
||||
Return ReadingResult(Undefined, Item + 1);
|
||||
Return ReadingResult(Undefined, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _false() Then
|
||||
Return ReadingResult(False, Item + 1);
|
||||
Return ReadingResult(False, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _true() Then
|
||||
Return ReadingResult(True, Item + 1);
|
||||
Return ReadingResult(True, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _bin8() Then
|
||||
Length = Buffer.Get(Item + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, Item + 2, Length);
|
||||
Length = Buffer.Get(Position + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, Position + 2, Length);
|
||||
EndIf;
|
||||
|
||||
If Tag = _bin16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _bin32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadBinaryDataFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _fixmap() And Tag <= _fixmapMax() Then
|
||||
Return ReadMapFromBuffer(Buffer, Item + 1, Tag - _fixmap());
|
||||
Return ReadMapFromBuffer(Buffer, Position + 1, Tag - _fixmap());
|
||||
EndIf;
|
||||
|
||||
If Tag = _map16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _map32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadMapFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag >= _fixarray() And Tag <= _fixarrayMax() Then
|
||||
Return ReadArrayFromBuffer(Buffer, Item + 1, Tag - _fixarray());
|
||||
Return ReadArrayFromBuffer(Buffer, Position + 1, Tag - _fixarray());
|
||||
EndIf;
|
||||
|
||||
If Tag = _array16() Then
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
If Tag = _array32() Then
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Item, LengthReading.Value);
|
||||
LengthReading = ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
Return ReadArrayFromBuffer(Buffer, LengthReading.Position, LengthReading.Value);
|
||||
EndIf;
|
||||
|
||||
NumberReading = ReadNumber(Buffer, Item, Tag);
|
||||
NumberReading = ReadNumber(Buffer, Position, Tag);
|
||||
|
||||
If NumberReading <> Undefined Then
|
||||
Return NumberReading;
|
||||
@@ -220,20 +220,20 @@ EndFunction
|
||||
|
||||
Procedure EnsureContextCapacity(Context, Val NeedByte)
|
||||
|
||||
If NeedByte <= Context.Capacity - Context.Item Then
|
||||
If NeedByte <= Context.Capacity - Context.Position Then
|
||||
Return;
|
||||
EndIf;
|
||||
|
||||
NewCapacity = Context.Capacity;
|
||||
|
||||
While NewCapacity - Context.Item < NeedByte Do
|
||||
While NewCapacity - Context.Position < NeedByte Do
|
||||
NewCapacity = NewCapacity * 2;
|
||||
EndDo;
|
||||
|
||||
NewBuffer = New BinaryDataBuffer(NewCapacity, ByteOrder.BigEndian);
|
||||
|
||||
If Context.Item > 0 Then
|
||||
Fragment = Context.Buffer.Read(0, Context.Item);
|
||||
If Context.Position > 0 Then
|
||||
Fragment = Context.Buffer.Read(0, Context.Position);
|
||||
NewBuffer.Write(0, Fragment);
|
||||
EndIf;
|
||||
|
||||
@@ -245,45 +245,45 @@ EndProcedure
|
||||
Procedure WriteByteToContext(Context, Val Byte)
|
||||
|
||||
EnsureContextCapacity(Context, 1);
|
||||
Context.Buffer.Set(Context.Item, Byte);
|
||||
Context.Item = Context.Item + 1;
|
||||
Context.Buffer.Set(Context.Position, Byte);
|
||||
Context.Position = Context.Position + 1;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function GetBinaryDataFromRecordContext(Val Context)
|
||||
|
||||
If Context.Item = 0 Then
|
||||
If Context.Position = 0 Then
|
||||
Return GetBinaryDataFromString("");
|
||||
EndIf;
|
||||
|
||||
If Context.Item = Context.Capacity Then
|
||||
If Context.Position = Context.Capacity Then
|
||||
Return GetBinaryDataFromBinaryDataBuffer(Context.Buffer);
|
||||
EndIf;
|
||||
|
||||
Fragment = Context.Buffer.Read(0, Context.Item);
|
||||
Fragment = Context.Buffer.Read(0, Context.Position);
|
||||
|
||||
Return GetBinaryDataFromBinaryDataBuffer(Fragment);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadingResult(Val Value, Val Item)
|
||||
Function ReadingResult(Val Value, Val Position)
|
||||
|
||||
Return New Structure("Value, Position", Value, Position);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadUnsignedInteger16FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadUnsignedInteger16FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Byte0 = Buffer.Get(Item);
|
||||
Byte1 = Buffer.Get(Item + 1);
|
||||
Byte0 = Buffer.Get(Position);
|
||||
Byte1 = Buffer.Get(Position + 1);
|
||||
|
||||
Return ReadingResult(Byte0 * 256 + Byte1, Item + 2);
|
||||
Return ReadingResult(Byte0 * 256 + Byte1, Position + 2);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadUnsignedInteger32FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadUnsignedInteger32FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt32(Item);
|
||||
Value = Buffer.ReadInt32(Position);
|
||||
|
||||
If Value < 0 Then
|
||||
Value = Value + 4294967296;
|
||||
@@ -293,9 +293,9 @@ Function ReadUnsignedInteger32FromBuffer(Val Buffer, Val Item)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadUnsignedInteger64FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadUnsignedInteger64FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt64(Item);
|
||||
Value = Buffer.ReadInt64(Position);
|
||||
|
||||
If Value < 0 Then
|
||||
Value = Value + 18446744073709551616;
|
||||
@@ -305,54 +305,54 @@ Function ReadUnsignedInteger64FromBuffer(Val Buffer, Val Item)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger8FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger8FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Byte = Buffer.Get(Item);
|
||||
Byte = Buffer.Get(Position);
|
||||
|
||||
If Byte >= 128 Then
|
||||
Byte = Byte - 256;
|
||||
EndIf;
|
||||
|
||||
Return ReadingResult(Byte, Item + 1);
|
||||
Return ReadingResult(Byte, Position + 1);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger16FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger16FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt16(Item);
|
||||
Value = Buffer.ReadInt16(Position);
|
||||
|
||||
Return ReadingResult(Value, Position + 2);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger32FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger32FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt32(Item);
|
||||
Value = Buffer.ReadInt32(Position);
|
||||
|
||||
Return ReadingResult(Value, Position + 4);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadSignedInteger64FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadSignedInteger64FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
Value = Buffer.ReadInt64(Item);
|
||||
Value = Buffer.ReadInt64(Position);
|
||||
|
||||
Return ReadingResult(Value, Position + 8);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadFloat32FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadFloat32FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
NumberBuffer = Buffer.Read(Item, 4);
|
||||
NumberBuffer = Buffer.Read(Position, 4);
|
||||
Value = DecodeFloat32BE(NumberBuffer);
|
||||
|
||||
Return ReadingResult(Value, Position + 4);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function ReadFloat64FromBuffer(Val Buffer, Val Item)
|
||||
Function ReadFloat64FromBuffer(Val Buffer, Val Position)
|
||||
|
||||
NumberBuffer = Buffer.Read(Item, 8);
|
||||
NumberBuffer = Buffer.Read(Position, 8);
|
||||
Value = DecodeFloat64BE(NumberBuffer);
|
||||
|
||||
Return ReadingResult(Value, Position + 8);
|
||||
@@ -513,49 +513,49 @@ Procedure WriteStringToContext(Val Data, Context)
|
||||
If DataSize < 32 Then
|
||||
|
||||
EnsureContextCapacity(Context, 1 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _fixstr() + DataSize);
|
||||
Context.Buffer.Write(Context.Item + 1, BufferString);
|
||||
Context.Item = Context.Item + 1 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _fixstr() + DataSize);
|
||||
Context.Buffer.Write(Context.Position + 1, BufferString);
|
||||
Context.Position = Context.Position + 1 + DataSize;
|
||||
|
||||
ElsIf DataSize < 256 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2 + DataSize);
|
||||
Context.Buffer.Set(Context.Item , _str8());
|
||||
Context.Buffer.Set(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 2, BufferString);
|
||||
Context.Item = Context.Item + 2 + DataSize;
|
||||
Context.Buffer.Set(Context.Position , _str8());
|
||||
Context.Buffer.Set(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 2, BufferString);
|
||||
Context.Position = Context.Position + 2 + DataSize;
|
||||
|
||||
ElsIf DataSize < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _str16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 3, BufferString);
|
||||
Context.Item = Context.Item + 3 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _str16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 3, BufferString);
|
||||
Context.Position = Context.Position + 3 + DataSize;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _str32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 5, BufferString);
|
||||
Context.Item = Context.Item + 5 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _str32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 5, BufferString);
|
||||
Context.Position = Context.Position + 5 + DataSize;
|
||||
|
||||
EndIf;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadStringFromBuffer(Val Buffer, Val Item, Val Length)
|
||||
Function ReadStringFromBuffer(Val Buffer, Val Position, Val Length)
|
||||
|
||||
If Length = 0 Then
|
||||
Return ReadingResult("", Item);
|
||||
Return ReadingResult("", Position);
|
||||
EndIf;
|
||||
|
||||
FragmentBuffer = Buffer.Read(Item, Length);
|
||||
FragmentBuffer = Buffer.Read(Position, Length);
|
||||
BDFragment = GetBinaryDataFromBinaryDataBuffer(FragmentBuffer);
|
||||
String = GetStringFromBinaryData(BDFragment, "UTF-8");
|
||||
|
||||
Return ReadingResult(String, Item + Length);
|
||||
Return ReadingResult(String, Position + Length);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -571,41 +571,41 @@ Procedure RecordBinaryDataInContext(Val Data, Context)
|
||||
If DataSize < 256 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2 + DataSize);
|
||||
Context.Buffer.Set(Context.Item , _bin8());
|
||||
Context.Buffer.Set(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 2, BufferBody);
|
||||
Context.Item = Context.Item + 2 + DataSize;
|
||||
Context.Buffer.Set(Context.Position , _bin8());
|
||||
Context.Buffer.Set(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 2, BufferBody);
|
||||
Context.Position = Context.Position + 2 + DataSize;
|
||||
|
||||
ElsIf DataSize < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _bin16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 3, BufferBody);
|
||||
Context.Item = Context.Item + 3 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _bin16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 3, BufferBody);
|
||||
Context.Position = Context.Position + 3 + DataSize;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5 + DataSize);
|
||||
Context.Buffer.Set(Context.Item, _bin32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Item + 5, BufferBody);
|
||||
Context.Item = Context.Item + 5 + DataSize;
|
||||
Context.Buffer.Set(Context.Position, _bin32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, DataSize);
|
||||
Context.Buffer.Write(Context.Position + 5, BufferBody);
|
||||
Context.Position = Context.Position + 5 + DataSize;
|
||||
|
||||
EndIf;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadBinaryDataFromBuffer(Val Buffer, Val Item, Val Length)
|
||||
Function ReadBinaryDataFromBuffer(Val Buffer, Val Position, Val Length)
|
||||
|
||||
If Length = 0 Then
|
||||
Return ReadingResult(GetBinaryDataFromString(""), Item);
|
||||
Return ReadingResult(GetBinaryDataFromString(""), Position);
|
||||
EndIf;
|
||||
|
||||
FragmentBuffer = Buffer.Read(Item, Length);
|
||||
FragmentBuffer = Buffer.Read(Position, Length);
|
||||
BDFragment = GetBinaryDataFromBinaryDataBuffer(FragmentBuffer);
|
||||
|
||||
Return ReadingResult(BDFragment, Item + Length);
|
||||
Return ReadingResult(BDFragment, Position + Length);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -624,16 +624,16 @@ Procedure WriteArrayToContext(Val Data, Context)
|
||||
ElsIf ItemCount < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _array16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, ItemCount);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _array16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, ItemCount);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _array32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, ItemCount);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _array32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, ItemCount);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -643,19 +643,19 @@ Procedure WriteArrayToContext(Val Data, Context)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadArrayFromBuffer(Val Buffer, Val Item, Val ItemCount)
|
||||
Function ReadArrayFromBuffer(Val Buffer, Val Position, Val ItemCount)
|
||||
|
||||
Array = New Array;
|
||||
|
||||
For Index = 1 To ItemCount Do
|
||||
|
||||
ItemReading = ReadValue(Buffer, Item);
|
||||
ItemReading = ReadValue(Buffer, Position);
|
||||
Array.Add(ItemReading.Value);
|
||||
Item = ItemReading.Item;
|
||||
Position = ItemReading.Position;
|
||||
|
||||
EndDo;
|
||||
|
||||
Return ReadingResult(Array, Item);
|
||||
Return ReadingResult(Array, Position);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -678,16 +678,16 @@ Procedure WriteMapToContext(Val Data, Context)
|
||||
ElsIf PairCount < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _map16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, PairCount);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _map16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, PairCount);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _map32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, PairCount);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _map32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, PairCount);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -705,26 +705,26 @@ Procedure WriteMapToContext(Val Data, Context)
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadMapFromBuffer(Val Buffer, Val Item, Val PairCount)
|
||||
Function ReadMapFromBuffer(Val Buffer, Val Position, Val PairCount)
|
||||
|
||||
Map = New Map;
|
||||
|
||||
For Index = 1 To PairCount Do
|
||||
|
||||
KeyReading = ReadValue(Buffer, Item);
|
||||
Item = KeyReading.Item;
|
||||
KeyReading = ReadValue(Buffer, Position);
|
||||
Position = KeyReading.Position;
|
||||
|
||||
If TypeOf(KeyReading.Value) <> Type("String") Then
|
||||
Raise "MessagePack map key must be a string";
|
||||
EndIf;
|
||||
|
||||
ValueReading = ReadValue(Buffer, Item);
|
||||
ValueReading = ReadValue(Buffer, Position);
|
||||
Map.Insert(KeyReading.Value, ValueReading.Value);
|
||||
Item = ValueReading.Item;
|
||||
Position = ValueReading.Position;
|
||||
|
||||
EndDo;
|
||||
|
||||
Return ReadingResult(Map, Item);
|
||||
Return ReadingResult(Map, Position);
|
||||
|
||||
EndFunction
|
||||
|
||||
@@ -765,9 +765,9 @@ Procedure RecordFloat32InContext(Val Number, Context)
|
||||
Body = EncodeFloat32BE(Number);
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _float32());
|
||||
Context.Buffer.Write(Context.Item + 1, Body);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _float32());
|
||||
Context.Buffer.Write(Context.Position + 1, Body);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -776,9 +776,9 @@ Procedure RecordFloat64InContext(Val Number, Context)
|
||||
Body = EncodeFloat64BE(Number);
|
||||
|
||||
EnsureContextCapacity(Context, 9);
|
||||
Context.Buffer.Set(Context.Item, _float64());
|
||||
Context.Buffer.Write(Context.Item + 1, Body);
|
||||
Context.Item = Context.Item + 9;
|
||||
Context.Buffer.Set(Context.Position, _float64());
|
||||
Context.Buffer.Write(Context.Position + 1, Body);
|
||||
Context.Position = Context.Position + 9;
|
||||
|
||||
EndProcedure
|
||||
|
||||
@@ -791,30 +791,30 @@ Procedure RecordPositiveIntegerInContext(Val Number, Context)
|
||||
ElsIf Number < 256 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2);
|
||||
Context.Buffer.Set(Context.Item , _uint8());
|
||||
Context.Buffer.Set(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 2;
|
||||
Context.Buffer.Set(Context.Position , _uint8());
|
||||
Context.Buffer.Set(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 2;
|
||||
|
||||
ElsIf Number < 65536 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _uint16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _uint16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
ElsIf Number < 4294967296 Then
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _uint32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _uint32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 9);
|
||||
Context.Buffer.Set(Context.Item, _uint64());
|
||||
Context.Buffer.WriteInt64(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 9;
|
||||
Context.Buffer.Set(Context.Position, _uint64());
|
||||
Context.Buffer.WriteInt64(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 9;
|
||||
|
||||
EndIf;
|
||||
|
||||
@@ -829,75 +829,75 @@ Procedure RecordNegativeIntegerInContext(Val Number, Context)
|
||||
ElsIf Number >= -128 Then
|
||||
|
||||
EnsureContextCapacity(Context, 2);
|
||||
Context.Buffer.Set(Context.Item , _int8());
|
||||
Context.Buffer.Set(Context.Item + 1, _negFixintMin() + 32 + Number);
|
||||
Context.Item = Context.Item + 2;
|
||||
Context.Buffer.Set(Context.Position , _int8());
|
||||
Context.Buffer.Set(Context.Position + 1, _negFixintMin() + 32 + Number);
|
||||
Context.Position = Context.Position + 2;
|
||||
|
||||
ElsIf Number >= -32768 Then
|
||||
|
||||
EnsureContextCapacity(Context, 3);
|
||||
Context.Buffer.Set(Context.Item, _int16());
|
||||
Context.Buffer.WriteInt16(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 3;
|
||||
Context.Buffer.Set(Context.Position, _int16());
|
||||
Context.Buffer.WriteInt16(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 3;
|
||||
|
||||
ElsIf Number >= -2147483648 Then
|
||||
|
||||
EnsureContextCapacity(Context, 5);
|
||||
Context.Buffer.Set(Context.Item, _int32());
|
||||
Context.Buffer.WriteInt32(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 5;
|
||||
Context.Buffer.Set(Context.Position, _int32());
|
||||
Context.Buffer.WriteInt32(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 5;
|
||||
|
||||
Else
|
||||
|
||||
EnsureContextCapacity(Context, 9);
|
||||
Context.Buffer.Set(Context.Item, _int64());
|
||||
Context.Buffer.WriteInt64(Context.Item + 1, Number);
|
||||
Context.Item = Context.Item + 9;
|
||||
Context.Buffer.Set(Context.Position, _int64());
|
||||
Context.Buffer.WriteInt64(Context.Position + 1, Number);
|
||||
Context.Position = Context.Position + 9;
|
||||
|
||||
EndIf;
|
||||
|
||||
EndProcedure
|
||||
|
||||
Function ReadNumber(Val Buffer, Val Item, Val Tag)
|
||||
Function ReadNumber(Val Buffer, Val Position, Val Tag)
|
||||
|
||||
If Tag = _uint8() Then
|
||||
Return ReadingResult(Buffer.Get(Item + 1), Item + 2);
|
||||
Return ReadingResult(Buffer.Get(Position + 1), Position + 2);
|
||||
EndIf;
|
||||
|
||||
If Tag = _uint16() Then
|
||||
Return ReadUnsignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadUnsignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _uint32() Then
|
||||
Return ReadUnsignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadUnsignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _uint64() Then
|
||||
Return ReadUnsignedInteger64FromBuffer(Buffer, Item + 1);
|
||||
Return ReadUnsignedInteger64FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int8() Then
|
||||
Return ReadSignedInteger8FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger8FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int16() Then
|
||||
Return ReadSignedInteger16FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger16FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int32() Then
|
||||
Return ReadSignedInteger32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger32FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _int64() Then
|
||||
Return ReadSignedInteger64FromBuffer(Buffer, Item + 1);
|
||||
Return ReadSignedInteger64FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _float32() Then
|
||||
Return ReadFloat32FromBuffer(Buffer, Item + 1);
|
||||
Return ReadFloat32FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
If Tag = _float64() Then
|
||||
Return ReadFloat64FromBuffer(Buffer, Item + 1);
|
||||
Return ReadFloat64FromBuffer(Buffer, Position + 1);
|
||||
EndIf;
|
||||
|
||||
Return Undefined;
|
||||
|
||||
+11
-11
@@ -242,24 +242,24 @@ Procedure CDEK_CreateOrder(FunctionParameters)
|
||||
|
||||
Package = New Structure;
|
||||
|
||||
Items = New Array;
|
||||
Products = New Array;
|
||||
|
||||
Item = New Structure;
|
||||
Product = New Structure;
|
||||
|
||||
Payment = New Structure;
|
||||
Payment.Insert("value", 3000);
|
||||
|
||||
Item.Insert("payment" , Payment);
|
||||
Item.Insert("ware_key", "00055");
|
||||
Item.Insert("name" , "Product");
|
||||
Item.Insert("cost" , 300);
|
||||
Item.Insert("amount" , 2);
|
||||
Item.Insert("weight" , 700);
|
||||
Item.Insert("url" , "www.item.ru");
|
||||
Product.Insert("payment" , Payment);
|
||||
Product.Insert("ware_key", "00055");
|
||||
Product.Insert("name" , "Product");
|
||||
Product.Insert("cost" , 300);
|
||||
Product.Insert("amount" , 2);
|
||||
Product.Insert("weight" , 700);
|
||||
Product.Insert("url" , "www.item.ru");
|
||||
|
||||
Items.Add(Item);
|
||||
Product.Add(Product);
|
||||
|
||||
Package.Insert("items" , Items);
|
||||
Package.Insert("items" , Product);
|
||||
Package.Insert("number" , "bar-001");
|
||||
Package.Insert("comment", "Packaging");
|
||||
Package.Insert("height" , 10);
|
||||
|
||||
+1
-1
@@ -139,7 +139,7 @@ Function MessagePackPackReference(BaseURL, Data)
|
||||
.SetDataType("application/json")
|
||||
.SetStringBody("null");
|
||||
|
||||
ElsIf OPI_Tools.IsCollection(Data, True) Then
|
||||
ElsIf OPI_Tools.ThisIsCollection(Data, True) Then
|
||||
|
||||
Request = Request.SetJsonBody(Data);
|
||||
|
||||
|
||||
+11
-11
@@ -254,24 +254,24 @@ Procedure CDEK_CreateOrder(FunctionParameters)
|
||||
|
||||
Package = New Structure;
|
||||
|
||||
Items = New Array;
|
||||
Products = New Array;
|
||||
|
||||
Item = New Structure;
|
||||
Product = New Structure;
|
||||
|
||||
Payment = New Structure;
|
||||
Payment.Insert("value", 3000);
|
||||
|
||||
Item.Insert("payment" , Payment);
|
||||
Item.Insert("ware_key", "00055");
|
||||
Item.Insert("name" , "Product");
|
||||
Item.Insert("cost" , 300);
|
||||
Item.Insert("amount" , 2);
|
||||
Item.Insert("weight" , 700);
|
||||
Item.Insert("url" , "www.item.ru");
|
||||
Product.Insert("payment" , Payment);
|
||||
Product.Insert("ware_key", "00055");
|
||||
Product.Insert("name" , "Product");
|
||||
Product.Insert("cost" , 300);
|
||||
Product.Insert("amount" , 2);
|
||||
Product.Insert("weight" , 700);
|
||||
Product.Insert("url" , "www.item.ru");
|
||||
|
||||
Items.Add(Item);
|
||||
Product.Add(Product);
|
||||
|
||||
Package.Insert("items" , Items);
|
||||
Package.Insert("items" , Product);
|
||||
Package.Insert("number" , "bar-001");
|
||||
Package.Insert("comment", "Packaging");
|
||||
Package.Insert("height" , 10);
|
||||
|
||||
+7
-1
@@ -141,10 +141,16 @@ Function MessagePackPackReference(BaseURL, Data)
|
||||
.SetDataType("application/json")
|
||||
.SetStringBody("null");
|
||||
|
||||
Else
|
||||
ElsIf OPI_Tools.ThisIsCollection(Data, True) Then
|
||||
|
||||
Request = Request.SetJsonBody(Data);
|
||||
|
||||
Else
|
||||
|
||||
Request = Request
|
||||
.SetDataType("application/json; charset=utf-8")
|
||||
.SetStringBody(OPI_Tools.JSONString(Data, "None", False));
|
||||
|
||||
EndIf;
|
||||
|
||||
Return Request.ProcessRequest("POST").ReturnResponseAsBinaryData();
|
||||
|
||||
+33
@@ -15034,6 +15034,10 @@ Function ConvertReferenceValueMessagePack(Val Value)
|
||||
|
||||
Return Base64Value(Value["__msgpack_bytes__"]);
|
||||
|
||||
ElsIf IsNodeJSMessagePackBuffer(Value) Then
|
||||
|
||||
Return BinaryDataFromNodeJSMessagePackDataBuffer(Value);
|
||||
|
||||
ElsIf TypeOf(Value) = Type("Array") Then
|
||||
|
||||
Result = New Array;
|
||||
@@ -15066,6 +15070,35 @@ Function ConvertReferenceValueMessagePack(Val Value)
|
||||
|
||||
EndFunction
|
||||
|
||||
Function IsNodeJSMessagePackBuffer(Val Value)
|
||||
|
||||
If Not OPI_Tools.ThisIsCollection(Value, True) Then
|
||||
Return False;
|
||||
EndIf;
|
||||
|
||||
If Not MapContainsKeyMessagePack(Value, "type")
|
||||
Or Not MapContainsKeyMessagePack(Value, "data") Then
|
||||
Return False;
|
||||
EndIf;
|
||||
|
||||
Return Value["type"] = "Buffer"
|
||||
And TypeOf(Value["data"]) = Type("Array");
|
||||
|
||||
EndFunction
|
||||
|
||||
Function BinaryDataFromNodeJSMessagePackDataBuffer(Val Value)
|
||||
|
||||
Bytes = Value["data"];
|
||||
Buffer = New BinaryDataBuffer(Bytes.Count());
|
||||
|
||||
For Index = 0 To Bytes.Count() - 1 Do
|
||||
Buffer.Set(Index, Bytes[Index]);
|
||||
EndDo;
|
||||
|
||||
Return GetBinaryDataFromBinaryDataBuffer(Buffer);
|
||||
|
||||
EndFunction
|
||||
|
||||
Function Check_MessagePack_Benchmark(Val Result, Val Option, Original = Undefined)
|
||||
|
||||
CheckMapMessagePack(Result["JsonRestored"] , Original);
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
|
||||
Function GetHashSum() Export
|
||||
|
||||
LastBuildHash = "2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C";
|
||||
LastBuildHash = "465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F";
|
||||
|
||||
Return LastBuildHash;
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C
|
||||
465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F
|
||||
+5
-5
@@ -86,7 +86,7 @@ Function ParseString(MessageText, TextColor)
|
||||
Pos = 1;
|
||||
For Each ColorField In tbColoredFields Do
|
||||
If Pos < ColorField.Item Then
|
||||
Text = Mid(MessageText, Pos, ColorField.Item - Pos);
|
||||
Text = Mid(MessageText, Pos, ColorField.Position - Pos);
|
||||
Str = Table.Add();
|
||||
Str.Text = Text;
|
||||
Str.Color = TextColor;
|
||||
@@ -96,7 +96,7 @@ Function ParseString(MessageText, TextColor)
|
||||
Str.Text = ColorField.Text;
|
||||
Str.Color = ColorField.Color;
|
||||
|
||||
Pos = ColorField.Item + ColorField.Length;
|
||||
Pos = ColorField.Position + ColorField.Length;
|
||||
EndDo;
|
||||
|
||||
If Pos-1 <= Length Then
|
||||
@@ -116,7 +116,7 @@ Function ColoredFields(MessageText)
|
||||
Coincidences = RX.Matches(MessageText);
|
||||
|
||||
ColoredFields = New ValueTable;
|
||||
ColoredFields.Columns.Add("Item");
|
||||
ColoredFields.Columns.Add("Position");
|
||||
ColoredFields.Columns.Add("Text");
|
||||
ColoredFields.Columns.Add("Length");
|
||||
ColoredFields.Columns.Add("Color");
|
||||
@@ -124,14 +124,14 @@ Function ColoredFields(MessageText)
|
||||
For Each Coincidence In Coincidences Do
|
||||
Groups = Coincidence.Groups;
|
||||
str = ColoredFields.Add();
|
||||
str.Item = Coincidence.Index+1;
|
||||
str.Position = Coincidence.Index+1;
|
||||
str.Text = Groups[1].Value;
|
||||
str.Length = Coincidence.Length;
|
||||
ColorName = Groups[2].Value;
|
||||
str.Color = ColorName;
|
||||
EndDo;
|
||||
|
||||
ColoredFields.Sort("Item");
|
||||
ColoredFields.Sort("Position");
|
||||
|
||||
Return ColoredFields;
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
Function GetHashSum() Export
|
||||
|
||||
LastBuildHash = "2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C";
|
||||
LastBuildHash = "465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F";
|
||||
|
||||
Return LastBuildHash;
|
||||
|
||||
|
||||
@@ -15085,7 +15085,7 @@
|
||||
Возврат Ложь;
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Значение["type"] = "Buffer"
|
||||
Возврат Значение["type"] = "Buffer"
|
||||
И ТипЗнч(Значение["data"]) = Тип("Массив");
|
||||
|
||||
КонецФункции
|
||||
|
||||
+11
-11
@@ -254,24 +254,24 @@
|
||||
|
||||
Пакет = Новый Структура;
|
||||
|
||||
Позиции = Новый Массив;
|
||||
Товары = Новый Массив;
|
||||
|
||||
Позиция = Новый Структура;
|
||||
Товар = Новый Структура;
|
||||
|
||||
Оплата = Новый Структура;
|
||||
Оплата.Вставить("value", 3000);
|
||||
|
||||
Позиция.Вставить("payment" , Оплата);
|
||||
Позиция.Вставить("ware_key", "00055");
|
||||
Позиция.Вставить("name" , "Товар");
|
||||
Позиция.Вставить("cost" , 300);
|
||||
Позиция.Вставить("amount" , 2);
|
||||
Позиция.Вставить("weight" , 700);
|
||||
Позиция.Вставить("url" , "www.item.ru");
|
||||
Товар.Вставить("payment" , Оплата);
|
||||
Товар.Вставить("ware_key", "00055");
|
||||
Товар.Вставить("name" , "Товар");
|
||||
Товар.Вставить("cost" , 300);
|
||||
Товар.Вставить("amount" , 2);
|
||||
Товар.Вставить("weight" , 700);
|
||||
Товар.Вставить("url" , "www.item.ru");
|
||||
|
||||
Позиции.Добавить(Позиция);
|
||||
Товар.Добавить(Товар);
|
||||
|
||||
Пакет.Вставить("items" , Позиции);
|
||||
Пакет.Вставить("items" , Товар);
|
||||
Пакет.Вставить("number" , "bar-001");
|
||||
Пакет.Вставить("comment", "Упаковка");
|
||||
Пакет.Вставить("height" , 10);
|
||||
|
||||
@@ -141,10 +141,16 @@
|
||||
.УстановитьТипДанных("application/json")
|
||||
.УстановитьСтроковоеТело("null");
|
||||
|
||||
Иначе
|
||||
ИначеЕсли OPI_Инструменты.ЭтоКоллекция(Данные, Истина) Тогда
|
||||
|
||||
Запрос = Запрос.УстановитьJsonТело(Данные);
|
||||
|
||||
Иначе
|
||||
|
||||
Запрос = Запрос
|
||||
.УстановитьТипДанных("application/json; charset=utf-8")
|
||||
.УстановитьСтроковоеТело(OPI_Инструменты.JSONСтрокой(Данные, "Нет", Ложь));
|
||||
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Запрос.ОбработатьЗапрос("POST").ВернутьОтветКакДвоичныеДанные();
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C
|
||||
465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F
|
||||
+11
-11
@@ -242,24 +242,24 @@
|
||||
|
||||
Пакет = Новый Структура;
|
||||
|
||||
Позиции = Новый Массив;
|
||||
Товары = Новый Массив;
|
||||
|
||||
Позиция = Новый Структура;
|
||||
Товар = Новый Структура;
|
||||
|
||||
Оплата = Новый Структура;
|
||||
Оплата.Вставить("value", 3000);
|
||||
|
||||
Позиция.Вставить("payment" , Оплата);
|
||||
Позиция.Вставить("ware_key", "00055");
|
||||
Позиция.Вставить("name" , "Товар");
|
||||
Позиция.Вставить("cost" , 300);
|
||||
Позиция.Вставить("amount" , 2);
|
||||
Позиция.Вставить("weight" , 700);
|
||||
Позиция.Вставить("url" , "www.item.ru");
|
||||
Товар.Вставить("payment" , Оплата);
|
||||
Товар.Вставить("ware_key", "00055");
|
||||
Товар.Вставить("name" , "Товар");
|
||||
Товар.Вставить("cost" , 300);
|
||||
Товар.Вставить("amount" , 2);
|
||||
Товар.Вставить("weight" , 700);
|
||||
Товар.Вставить("url" , "www.item.ru");
|
||||
|
||||
Позиции.Добавить(Позиция);
|
||||
Товар.Добавить(Товар);
|
||||
|
||||
Пакет.Вставить("items" , Позиции);
|
||||
Пакет.Вставить("items" , Товар);
|
||||
Пакет.Вставить("number" , "bar-001");
|
||||
Пакет.Вставить("comment", "Упаковка");
|
||||
Пакет.Вставить("height" , 10);
|
||||
|
||||
+11
-11
@@ -254,24 +254,24 @@
|
||||
|
||||
Пакет = Новый Структура;
|
||||
|
||||
Позиции = Новый Массив;
|
||||
Товары = Новый Массив;
|
||||
|
||||
Позиция = Новый Структура;
|
||||
Товар = Новый Структура;
|
||||
|
||||
Оплата = Новый Структура;
|
||||
Оплата.Вставить("value", 3000);
|
||||
|
||||
Позиция.Вставить("payment" , Оплата);
|
||||
Позиция.Вставить("ware_key", "00055");
|
||||
Позиция.Вставить("name" , "Товар");
|
||||
Позиция.Вставить("cost" , 300);
|
||||
Позиция.Вставить("amount" , 2);
|
||||
Позиция.Вставить("weight" , 700);
|
||||
Позиция.Вставить("url" , "www.item.ru");
|
||||
Товар.Вставить("payment" , Оплата);
|
||||
Товар.Вставить("ware_key", "00055");
|
||||
Товар.Вставить("name" , "Товар");
|
||||
Товар.Вставить("cost" , 300);
|
||||
Товар.Вставить("amount" , 2);
|
||||
Товар.Вставить("weight" , 700);
|
||||
Товар.Вставить("url" , "www.item.ru");
|
||||
|
||||
Позиции.Добавить(Позиция);
|
||||
Товар.Добавить(Товар);
|
||||
|
||||
Пакет.Вставить("items" , Позиции);
|
||||
Пакет.Вставить("items" , Товар);
|
||||
Пакет.Вставить("number" , "bar-001");
|
||||
Пакет.Вставить("comment", "Упаковка");
|
||||
Пакет.Вставить("height" , 10);
|
||||
|
||||
+7
-1
@@ -141,10 +141,16 @@
|
||||
.УстановитьТипДанных("application/json")
|
||||
.УстановитьСтроковоеТело("null");
|
||||
|
||||
Иначе
|
||||
ИначеЕсли OPI_Инструменты.ЭтоКоллекция(Данные, Истина) Тогда
|
||||
|
||||
Запрос = Запрос.УстановитьJsonТело(Данные);
|
||||
|
||||
Иначе
|
||||
|
||||
Запрос = Запрос
|
||||
.УстановитьТипДанных("application/json; charset=utf-8")
|
||||
.УстановитьСтроковоеТело(OPI_Инструменты.JSONСтрокой(Данные, "Нет", Ложь));
|
||||
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Запрос.ОбработатьЗапрос("POST").ВернутьОтветКакДвоичныеДанные();
|
||||
|
||||
+33
@@ -15034,6 +15034,10 @@
|
||||
|
||||
Возврат Base64Значение(Значение["__msgpack_bytes__"]);
|
||||
|
||||
ИначеЕсли ЭтоБуферNodeJSMessagePack(Значение) Тогда
|
||||
|
||||
Возврат ДвоичныеДанныеИзБуфераNodeJSMessagePack(Значение);
|
||||
|
||||
ИначеЕсли ТипЗнч(Значение) = Тип("Массив") Тогда
|
||||
|
||||
Результат = Новый Массив;
|
||||
@@ -15066,6 +15070,35 @@
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция ЭтоБуферNodeJSMessagePack(Знач Значение)
|
||||
|
||||
Если Не OPI_Инструменты.ЭтоКоллекция(Значение, Истина) Тогда
|
||||
Возврат Ложь;
|
||||
КонецЕсли;
|
||||
|
||||
Если Не КартаСодержитКлючMessagePack(Значение, "type")
|
||||
Или Не КартаСодержитКлючMessagePack(Значение, "data") Тогда
|
||||
Возврат Ложь;
|
||||
КонецЕсли;
|
||||
|
||||
Возврат Значение["type"] = "Buffer"
|
||||
И ТипЗнч(Значение["data"]) = Тип("Массив");
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция ДвоичныеДанныеИзБуфераNodeJSMessagePack(Знач Значение)
|
||||
|
||||
Байты = Значение["data"];
|
||||
Буфер = Новый БуферДвоичныхДанных(Байты.Количество());
|
||||
|
||||
Для Индекс = 0 По Байты.Количество() - 1 Цикл
|
||||
Буфер.Установить(Индекс, Байты[Индекс]);
|
||||
КонецЦикла;
|
||||
|
||||
Возврат ПолучитьДвоичныеДанныеИзБуфераДвоичныхДанных(Буфер);
|
||||
|
||||
КонецФункции
|
||||
|
||||
Функция Проверка_MessagePack_Бенчмарк(Знач Результат, Знач Вариант, Исходное = Неопределено)
|
||||
|
||||
ПроверитьКартуMessagePack(Результат["JsonВосстановленное"] , Исходное);
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@
|
||||
|
||||
Function GetHashSum() Export
|
||||
|
||||
LastBuildHash = "2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C";
|
||||
LastBuildHash = "465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F";
|
||||
|
||||
Return LastBuildHash;
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
2E3C0D6F326A5DE5B1B1CB763C555EEEF3451C4AC7DCFF7BF2D10F263574FF4C
|
||||
465455E2B9E66F85E2A19CD994158361222AC04AECAF7BDA4A0B96AA6314119F
|
||||
Reference in New Issue
Block a user