@jsonjoy.com/json-pack 1.21.0 → 17.59.0
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/lib/JsonPackExtension.d.ts +8 -0
- package/lib/JsonPackExtension.js +8 -0
- package/lib/JsonPackExtension.js.map +1 -1
- package/lib/JsonPackMpint.d.ts +25 -0
- package/lib/JsonPackMpint.js +31 -1
- package/lib/JsonPackMpint.js.map +1 -1
- package/lib/JsonPackValue.d.ts +10 -0
- package/lib/JsonPackValue.js +10 -0
- package/lib/JsonPackValue.js.map +1 -1
- package/lib/avro/AvroDecoder.d.ts +67 -0
- package/lib/avro/AvroDecoder.js +77 -5
- package/lib/avro/AvroDecoder.js.map +1 -1
- package/lib/avro/AvroEncoder.d.ts +71 -0
- package/lib/avro/AvroEncoder.js +90 -12
- package/lib/avro/AvroEncoder.js.map +1 -1
- package/lib/avro/AvroSchemaDecoder.d.ts +53 -0
- package/lib/avro/AvroSchemaDecoder.js +60 -3
- package/lib/avro/AvroSchemaDecoder.js.map +1 -1
- package/lib/avro/AvroSchemaEncoder.d.ts +65 -0
- package/lib/avro/AvroSchemaEncoder.js +84 -5
- package/lib/avro/AvroSchemaEncoder.js.map +1 -1
- package/lib/avro/AvroSchemaValidator.d.ts +10 -0
- package/lib/avro/AvroSchemaValidator.js +18 -1
- package/lib/avro/AvroSchemaValidator.js.map +1 -1
- package/lib/avro/types.d.ts +31 -0
- package/lib/avro/types.js +4 -0
- package/lib/avro/types.js.map +1 -1
- package/lib/bencode/BencodeDecoder.js +9 -9
- package/lib/bencode/BencodeDecoder.js.map +1 -1
- package/lib/bencode/BencodeEncoder.d.ts +5 -0
- package/lib/bencode/BencodeEncoder.js +25 -20
- package/lib/bencode/BencodeEncoder.js.map +1 -1
- package/lib/bson/BsonDecoder.js +48 -33
- package/lib/bson/BsonDecoder.js.map +1 -1
- package/lib/bson/BsonEncoder.js +11 -3
- package/lib/bson/BsonEncoder.js.map +1 -1
- package/lib/cbor/CborDecoder.d.ts +24 -0
- package/lib/cbor/CborDecoder.js +94 -56
- package/lib/cbor/CborDecoder.js.map +1 -1
- package/lib/cbor/CborDecoderBase.d.ts +1 -0
- package/lib/cbor/CborDecoderBase.js +63 -53
- package/lib/cbor/CborDecoderBase.js.map +1 -1
- package/lib/cbor/CborEncoder.d.ts +5 -0
- package/lib/cbor/CborEncoder.js +9 -3
- package/lib/cbor/CborEncoder.js.map +1 -1
- package/lib/cbor/CborEncoderFast.d.ts +7 -0
- package/lib/cbor/CborEncoderFast.js +22 -14
- package/lib/cbor/CborEncoderFast.js.map +1 -1
- package/lib/cbor/CborEncoderStable.d.ts +1 -0
- package/lib/cbor/CborEncoderStable.js +2 -1
- package/lib/cbor/CborEncoderStable.js.map +1 -1
- package/lib/cbor/shared.d.ts +1 -1
- package/lib/codecs/Codecs.d.ts +1 -1
- package/lib/codecs/cbor.js +1 -1
- package/lib/codecs/cbor.js.map +1 -1
- package/lib/codecs/json.js +1 -1
- package/lib/codecs/json.js.map +1 -1
- package/lib/codecs/msgpack.js +1 -1
- package/lib/codecs/msgpack.js.map +1 -1
- package/lib/ejson/EjsonDecoder.d.ts +5 -0
- package/lib/ejson/EjsonDecoder.js +72 -37
- package/lib/ejson/EjsonDecoder.js.map +1 -1
- package/lib/ejson/EjsonEncoder.d.ts +5 -0
- package/lib/ejson/EjsonEncoder.js +149 -114
- package/lib/ejson/EjsonEncoder.js.map +1 -1
- package/lib/ejson/index.js +1 -0
- package/lib/ejson/index.js.map +1 -1
- package/lib/ion/Import.d.ts +1 -1
- package/lib/ion/Import.js.map +1 -1
- package/lib/ion/IonDecoder.d.ts +0 -1
- package/lib/ion/IonDecoder.js +4 -3
- package/lib/ion/IonDecoder.js.map +1 -1
- package/lib/ion/IonDecoderBase.js +29 -18
- package/lib/ion/IonDecoderBase.js.map +1 -1
- package/lib/ion/IonEncoderFast.d.ts +1 -1
- package/lib/ion/IonEncoderFast.js +30 -30
- package/lib/ion/IonEncoderFast.js.map +1 -1
- package/lib/ion/ast.d.ts +4 -1
- package/lib/ion/symbols.d.ts +1 -1
- package/lib/json/JsonDecoder.js +72 -66
- package/lib/json/JsonDecoder.js.map +1 -1
- package/lib/json/JsonDecoderDag.js +14 -0
- package/lib/json/JsonDecoderDag.js.map +1 -1
- package/lib/json/JsonDecoderPartial.d.ts +22 -0
- package/lib/json/JsonDecoderPartial.js +30 -8
- package/lib/json/JsonDecoderPartial.js.map +1 -1
- package/lib/json/JsonEncoder.d.ts +5 -0
- package/lib/json/JsonEncoder.js +59 -51
- package/lib/json/JsonEncoder.js.map +1 -1
- package/lib/json/JsonEncoderDag.d.ts +17 -0
- package/lib/json/JsonEncoderDag.js +27 -10
- package/lib/json/JsonEncoderDag.js.map +1 -1
- package/lib/json/JsonEncoderStable.js +5 -5
- package/lib/json/JsonEncoderStable.js.map +1 -1
- package/lib/json-binary/codec.d.ts +8 -1
- package/lib/json-binary/codec.js +7 -0
- package/lib/json-binary/codec.js.map +1 -1
- package/lib/msgpack/MsgPackDecoder.d.ts +27 -0
- package/lib/msgpack/MsgPackDecoder.js +55 -23
- package/lib/msgpack/MsgPackDecoder.js.map +1 -1
- package/lib/msgpack/MsgPackDecoderFast.d.ts +8 -0
- package/lib/msgpack/MsgPackDecoderFast.js +14 -5
- package/lib/msgpack/MsgPackDecoderFast.js.map +1 -1
- package/lib/msgpack/MsgPackEncoder.d.ts +3 -0
- package/lib/msgpack/MsgPackEncoder.js +7 -4
- package/lib/msgpack/MsgPackEncoder.js.map +1 -1
- package/lib/msgpack/MsgPackEncoderFast.d.ts +26 -4
- package/lib/msgpack/MsgPackEncoderFast.js +31 -0
- package/lib/msgpack/MsgPackEncoderFast.js.map +1 -1
- package/lib/msgpack/MsgPackEncoderStable.d.ts +3 -0
- package/lib/msgpack/MsgPackEncoderStable.js +3 -0
- package/lib/msgpack/MsgPackEncoderStable.js.map +1 -1
- package/lib/msgpack/MsgPackToJsonConverter.d.ts +30 -4
- package/lib/msgpack/MsgPackToJsonConverter.js +32 -5
- package/lib/msgpack/MsgPackToJsonConverter.js.map +1 -1
- package/lib/msgpack/index.d.ts +29 -0
- package/lib/msgpack/index.js +30 -0
- package/lib/msgpack/index.js.map +1 -1
- package/lib/msgpack/shallow-read.js +7 -7
- package/lib/msgpack/shallow-read.js.map +1 -1
- package/lib/msgpack/types.d.ts +1 -0
- package/lib/msgpack/util.d.ts +1 -1
- package/lib/nfs/v3/FullNfsv3Encoder.d.ts +3 -3
- package/lib/nfs/v3/FullNfsv3Encoder.js +3 -3
- package/lib/nfs/v3/FullNfsv3Encoder.js.map +1 -1
- package/lib/nfs/v3/Nfsv3Decoder.js +51 -50
- package/lib/nfs/v3/Nfsv3Decoder.js.map +1 -1
- package/lib/nfs/v3/Nfsv3Encoder.d.ts +2 -2
- package/lib/nfs/v3/Nfsv3Encoder.js +52 -52
- package/lib/nfs/v3/Nfsv3Encoder.js.map +1 -1
- package/lib/nfs/v3/constants.d.ts +34 -0
- package/lib/nfs/v3/constants.js +4 -0
- package/lib/nfs/v3/constants.js.map +1 -1
- package/lib/nfs/v3/locks/NlmDecoder.js +20 -20
- package/lib/nfs/v3/locks/NlmDecoder.js.map +1 -1
- package/lib/nfs/v3/locks/NlmEncoder.d.ts +2 -2
- package/lib/nfs/v3/locks/NlmEncoder.js +20 -20
- package/lib/nfs/v3/locks/NlmEncoder.js.map +1 -1
- package/lib/nfs/v3/locks/constants.d.ts +9 -0
- package/lib/nfs/v3/locks/messages.d.ts +58 -1
- package/lib/nfs/v3/locks/messages.js +54 -0
- package/lib/nfs/v3/locks/messages.js.map +1 -1
- package/lib/nfs/v3/locks/structs.d.ts +15 -0
- package/lib/nfs/v3/locks/structs.js +15 -0
- package/lib/nfs/v3/locks/structs.js.map +1 -1
- package/lib/nfs/v3/messages.d.ts +249 -0
- package/lib/nfs/v3/messages.js +249 -0
- package/lib/nfs/v3/messages.js.map +1 -1
- package/lib/nfs/v3/mount/MountDecoder.js +12 -12
- package/lib/nfs/v3/mount/MountEncoder.d.ts +2 -2
- package/lib/nfs/v3/mount/MountEncoder.js +13 -13
- package/lib/nfs/v3/mount/MountEncoder.js.map +1 -1
- package/lib/nfs/v3/mount/constants.d.ts +9 -0
- package/lib/nfs/v3/mount/messages.d.ts +31 -1
- package/lib/nfs/v3/mount/messages.js +27 -0
- package/lib/nfs/v3/mount/messages.js.map +1 -1
- package/lib/nfs/v3/mount/structs.d.ts +15 -0
- package/lib/nfs/v3/mount/structs.js +15 -0
- package/lib/nfs/v3/mount/structs.js.map +1 -1
- package/lib/nfs/v3/structs.d.ts +78 -0
- package/lib/nfs/v3/structs.js +78 -0
- package/lib/nfs/v3/structs.js.map +1 -1
- package/lib/nfs/v4/Nfsv4Decoder.d.ts +0 -2
- package/lib/nfs/v4/Nfsv4Decoder.js +96 -102
- package/lib/nfs/v4/Nfsv4Decoder.js.map +1 -1
- package/lib/nfs/v4/Nfsv4Encoder.d.ts +2 -2
- package/lib/nfs/v4/Nfsv4Encoder.js +1 -1
- package/lib/nfs/v4/Nfsv4Encoder.js.map +1 -1
- package/lib/nfs/v4/Nfsv4FullEncoder.d.ts +4 -4
- package/lib/nfs/v4/Nfsv4FullEncoder.js +4 -4
- package/lib/nfs/v4/Nfsv4FullEncoder.js.map +1 -1
- package/lib/nfs/v4/attributes.d.ts +62 -0
- package/lib/nfs/v4/attributes.js +209 -147
- package/lib/nfs/v4/attributes.js.map +1 -1
- package/lib/nfs/v4/builder.d.ts +274 -1
- package/lib/nfs/v4/builder.js +283 -10
- package/lib/nfs/v4/builder.js.map +1 -1
- package/lib/nfs/v4/client/NfsFsDir.d.ts +4 -1
- package/lib/nfs/v4/client/NfsFsDir.js +8 -5
- package/lib/nfs/v4/client/NfsFsDir.js.map +1 -1
- package/lib/nfs/v4/client/NfsFsDirent.d.ts +3 -0
- package/lib/nfs/v4/client/NfsFsDirent.js +10 -7
- package/lib/nfs/v4/client/NfsFsDirent.js.map +1 -1
- package/lib/nfs/v4/client/NfsFsFileHandle.d.ts +4 -3
- package/lib/nfs/v4/client/NfsFsFileHandle.js +13 -10
- package/lib/nfs/v4/client/NfsFsFileHandle.js.map +1 -1
- package/lib/nfs/v4/client/NfsFsStats.d.ts +3 -0
- package/lib/nfs/v4/client/NfsFsStats.js +10 -7
- package/lib/nfs/v4/client/NfsFsStats.js.map +1 -1
- package/lib/nfs/v4/client/Nfsv4FsClient.d.ts +2 -3
- package/lib/nfs/v4/client/Nfsv4FsClient.js +92 -92
- package/lib/nfs/v4/client/Nfsv4FsClient.js.map +1 -1
- package/lib/nfs/v4/client/Nfsv4TcpClient.d.ts +6 -6
- package/lib/nfs/v4/client/Nfsv4TcpClient.js +3 -3
- package/lib/nfs/v4/client/Nfsv4TcpClient.js.map +1 -1
- package/lib/nfs/v4/client/types.d.ts +1 -1
- package/lib/nfs/v4/constants.d.ts +78 -1
- package/lib/nfs/v4/format.d.ts +1 -1
- package/lib/nfs/v4/format.js +229 -229
- package/lib/nfs/v4/format.js.map +1 -1
- package/lib/nfs/v4/messages.js +101 -101
- package/lib/nfs/v4/messages.js.map +1 -1
- package/lib/nfs/v4/server/Nfsv4CompoundProcCtx.d.ts +20 -1
- package/lib/nfs/v4/server/Nfsv4CompoundProcCtx.js +29 -8
- package/lib/nfs/v4/server/Nfsv4CompoundProcCtx.js.map +1 -1
- package/lib/nfs/v4/server/Nfsv4Connection.d.ts +6 -3
- package/lib/nfs/v4/server/Nfsv4Connection.js +11 -8
- package/lib/nfs/v4/server/Nfsv4Connection.js.map +1 -1
- package/lib/nfs/v4/server/Nfsv4TcpServer.d.ts +2 -3
- package/lib/nfs/v4/server/Nfsv4TcpServer.js +1 -0
- package/lib/nfs/v4/server/Nfsv4TcpServer.js.map +1 -1
- package/lib/nfs/v4/server/operations/ByteRangeLock.d.ts +69 -1
- package/lib/nfs/v4/server/operations/ByteRangeLock.js +43 -1
- package/lib/nfs/v4/server/operations/ByteRangeLock.js.map +1 -1
- package/lib/nfs/v4/server/operations/ClientRecord.d.ts +98 -1
- package/lib/nfs/v4/server/operations/ClientRecord.js +54 -1
- package/lib/nfs/v4/server/operations/ClientRecord.js.map +1 -1
- package/lib/nfs/v4/server/operations/FilesystemStats.d.ts +22 -1
- package/lib/nfs/v4/server/operations/FilesystemStats.js +16 -1
- package/lib/nfs/v4/server/operations/FilesystemStats.js.map +1 -1
- package/lib/nfs/v4/server/operations/LockOwnerState.d.ts +75 -2
- package/lib/nfs/v4/server/operations/LockOwnerState.js +43 -1
- package/lib/nfs/v4/server/operations/LockOwnerState.js.map +1 -1
- package/lib/nfs/v4/server/operations/LockStateid.d.ts +55 -1
- package/lib/nfs/v4/server/operations/LockStateid.js +37 -1
- package/lib/nfs/v4/server/operations/LockStateid.js.map +1 -1
- package/lib/nfs/v4/server/operations/Nfsv4Operations.d.ts +2 -1
- package/lib/nfs/v4/server/operations/Nfsv4OperationsNotImpl.d.ts +2 -2
- package/lib/nfs/v4/server/operations/OpenFileState.d.ts +90 -2
- package/lib/nfs/v4/server/operations/OpenFileState.js +52 -1
- package/lib/nfs/v4/server/operations/OpenFileState.js.map +1 -1
- package/lib/nfs/v4/server/operations/OpenOwnerState.d.ts +76 -2
- package/lib/nfs/v4/server/operations/OpenOwnerState.js +44 -1
- package/lib/nfs/v4/server/operations/OpenOwnerState.js.map +1 -1
- package/lib/nfs/v4/server/operations/node/Nfsv4OperationsNode.d.ts +73 -3
- package/lib/nfs/v4/server/operations/node/Nfsv4OperationsNode.js +261 -187
- package/lib/nfs/v4/server/operations/node/Nfsv4OperationsNode.js.map +1 -1
- package/lib/nfs/v4/server/operations/node/attrs.d.ts +13 -1
- package/lib/nfs/v4/server/operations/node/attrs.js +75 -62
- package/lib/nfs/v4/server/operations/node/attrs.js.map +1 -1
- package/lib/nfs/v4/server/operations/node/fh.d.ts +67 -2
- package/lib/nfs/v4/server/operations/node/fh.js +83 -21
- package/lib/nfs/v4/server/operations/node/fh.js.map +1 -1
- package/lib/nfs/v4/server/operations/node/util.js +4 -4
- package/lib/nfs/v4/server/operations/node/util.js.map +1 -1
- package/lib/nfs/v4/server/util.d.ts +0 -1
- package/lib/nfs/v4/server/util.js +40 -40
- package/lib/nfs/v4/structs.d.ts +136 -4
- package/lib/nfs/v4/structs.js +129 -0
- package/lib/nfs/v4/structs.js.map +1 -1
- package/lib/resp/RespDecoder.d.ts +9 -0
- package/lib/resp/RespDecoder.js +93 -76
- package/lib/resp/RespDecoder.js.map +1 -1
- package/lib/resp/RespEncoder.d.ts +8 -0
- package/lib/resp/RespEncoder.js +107 -89
- package/lib/resp/RespEncoder.js.map +1 -1
- package/lib/resp/RespEncoderLegacy.d.ts +3 -0
- package/lib/resp/RespEncoderLegacy.js +7 -4
- package/lib/resp/RespEncoderLegacy.js.map +1 -1
- package/lib/resp/RespStreamingDecoder.d.ts +48 -0
- package/lib/resp/RespStreamingDecoder.js +48 -0
- package/lib/resp/RespStreamingDecoder.js.map +1 -1
- package/lib/resp/constants.d.ts +19 -19
- package/lib/rm/RmRecordEncoder.d.ts +15 -1
- package/lib/rm/RmRecordEncoder.js +15 -1
- package/lib/rm/RmRecordEncoder.js.map +1 -1
- package/lib/rpc/RpcMessageDecoder.d.ts +1 -1
- package/lib/rpc/RpcMessageDecoder.js +8 -7
- package/lib/rpc/RpcMessageDecoder.js.map +1 -1
- package/lib/rpc/RpcMessageEncoder.d.ts +2 -2
- package/lib/rpc/RpcMessageEncoder.js +6 -6
- package/lib/rpc/RpcMessageEncoder.js.map +1 -1
- package/lib/rpc/constants.d.ts +76 -28
- package/lib/rpc/constants.js +10 -0
- package/lib/rpc/constants.js.map +1 -1
- package/lib/ssh/SshDecoder.d.ts +46 -0
- package/lib/ssh/SshDecoder.js +52 -2
- package/lib/ssh/SshDecoder.js.map +1 -1
- package/lib/ssh/SshEncoder.d.ts +69 -0
- package/lib/ssh/SshEncoder.js +81 -8
- package/lib/ssh/SshEncoder.js.map +1 -1
- package/lib/ssh/index.d.ts +6 -0
- package/lib/ssh/index.js +6 -0
- package/lib/ssh/index.js.map +1 -1
- package/lib/ubjson/UbjsonDecoder.js +1 -1
- package/lib/ubjson/UbjsonDecoder.js.map +1 -1
- package/lib/ubjson/UbjsonEncoder.js +6 -5
- package/lib/ubjson/UbjsonEncoder.js.map +1 -1
- package/lib/util/CompressionTable.js +4 -4
- package/lib/util/CompressionTable.js.map +1 -1
- package/lib/util/DecompressionTable.js +3 -2
- package/lib/util/DecompressionTable.js.map +1 -1
- package/lib/ws/WsFrameDecoder.d.ts +18 -0
- package/lib/ws/WsFrameDecoder.js +18 -0
- package/lib/ws/WsFrameDecoder.js.map +1 -1
- package/lib/ws/WsFrameEncoder.d.ts +1 -1
- package/lib/ws/WsFrameEncoder.js +3 -3
- package/lib/ws/WsFrameEncoder.js.map +1 -1
- package/lib/ws/constants.js +5 -0
- package/lib/ws/constants.js.map +1 -1
- package/lib/xdr/XdrDecoder.d.ts +62 -0
- package/lib/xdr/XdrDecoder.js +73 -6
- package/lib/xdr/XdrDecoder.js.map +1 -1
- package/lib/xdr/XdrEncoder.d.ts +71 -0
- package/lib/xdr/XdrEncoder.js +88 -13
- package/lib/xdr/XdrEncoder.js.map +1 -1
- package/lib/xdr/XdrSchemaDecoder.d.ts +40 -0
- package/lib/xdr/XdrSchemaDecoder.js +52 -0
- package/lib/xdr/XdrSchemaDecoder.js.map +1 -1
- package/lib/xdr/XdrSchemaEncoder.d.ts +5 -0
- package/lib/xdr/XdrSchemaEncoder.js +9 -0
- package/lib/xdr/XdrSchemaEncoder.js.map +1 -1
- package/lib/xdr/XdrSchemaValidator.d.ts +9 -0
- package/lib/xdr/XdrSchemaValidator.js +42 -11
- package/lib/xdr/XdrSchemaValidator.js.map +1 -1
- package/lib/xdr/XdrUnion.d.ts +5 -0
- package/lib/xdr/XdrUnion.js +5 -0
- package/lib/xdr/XdrUnion.js.map +1 -1
- package/lib/xdr/index.d.ts +14 -0
- package/lib/xdr/index.js +14 -0
- package/lib/xdr/index.js.map +1 -1
- package/lib/xdr/types.d.ts +46 -0
- package/package.json +32 -55
|
@@ -22,7 +22,7 @@ class Nfsv4FsClient {
|
|
|
22
22
|
const previousSeqid = this.openOwnerSeqids.get(key);
|
|
23
23
|
const seqid = this.nextOpenOwnerSeqid(openOwner);
|
|
24
24
|
const response = await this.fs.compound([builder_1.nfs.CLOSE(seqid, stateid)]);
|
|
25
|
-
if (response.status !== 0) {
|
|
25
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
26
26
|
if (previousSeqid !== undefined) {
|
|
27
27
|
this.openOwnerSeqids.set(key, previousSeqid);
|
|
28
28
|
}
|
|
@@ -41,13 +41,13 @@ class Nfsv4FsClient {
|
|
|
41
41
|
const openOwner = this.createDefaultOpenOwner();
|
|
42
42
|
const claim = builder_1.nfs.OpenClaimNull(filename);
|
|
43
43
|
const openSeqid = this.nextOpenOwnerSeqid(openOwner);
|
|
44
|
-
operations.push(builder_1.nfs.OPEN(openSeqid, 1
|
|
44
|
+
operations.push(builder_1.nfs.OPEN(openSeqid, 1 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_READ */, 0 /* Nfsv4OpenDeny.OPEN4_SHARE_DENY_NONE */, openOwner, builder_1.nfs.OpenHowNoCreate(), claim));
|
|
45
45
|
const openResponse = await this.fs.compound(operations);
|
|
46
|
-
if (openResponse.status !== 0) {
|
|
46
|
+
if (openResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
47
47
|
throw new Error(`Failed to open file: ${openResponse.status}`);
|
|
48
48
|
}
|
|
49
49
|
const openRes = openResponse.resarray[openResponse.resarray.length - 1];
|
|
50
|
-
if (openRes.status !== 0 || !openRes.resok) {
|
|
50
|
+
if (openRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !openRes.resok) {
|
|
51
51
|
throw new Error(`Failed to open file: ${openRes.status}`);
|
|
52
52
|
}
|
|
53
53
|
const stateid = openRes.resok.stateid;
|
|
@@ -57,11 +57,11 @@ class Nfsv4FsClient {
|
|
|
57
57
|
try {
|
|
58
58
|
while (true) {
|
|
59
59
|
const readResponse = await this.fs.compound([builder_1.nfs.READ(offset, chunkSize, stateid)]);
|
|
60
|
-
if (readResponse.status !== 0) {
|
|
60
|
+
if (readResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
61
61
|
throw new Error(`Failed to read file: ${readResponse.status}`);
|
|
62
62
|
}
|
|
63
63
|
const readRes = readResponse.resarray[0];
|
|
64
|
-
if (readRes.status !== 0 || !readRes.resok) {
|
|
64
|
+
if (readRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !readRes.resok) {
|
|
65
65
|
throw new Error(`Failed to read file: ${readRes.status}`);
|
|
66
66
|
}
|
|
67
67
|
if (readRes.resok.data.length > 0) {
|
|
@@ -92,20 +92,20 @@ class Nfsv4FsClient {
|
|
|
92
92
|
const openOwner = this.createDefaultOpenOwner();
|
|
93
93
|
const claim = builder_1.nfs.OpenClaimNull(filename);
|
|
94
94
|
const openSeqid = this.nextOpenOwnerSeqid(openOwner);
|
|
95
|
-
operations.push(builder_1.nfs.OPEN(openSeqid, 2
|
|
95
|
+
operations.push(builder_1.nfs.OPEN(openSeqid, 2 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_WRITE */, 0 /* Nfsv4OpenDeny.OPEN4_SHARE_DENY_NONE */, openOwner, builder_1.nfs.OpenHowCreateUnchecked(), claim));
|
|
96
96
|
const writer = new Writer_1.Writer(16);
|
|
97
97
|
const xdr = new XdrEncoder_1.XdrEncoder(writer);
|
|
98
98
|
xdr.writeUnsignedHyper(BigInt(0));
|
|
99
99
|
const attrVals = writer.flush();
|
|
100
|
-
const truncateAttrs = builder_1.nfs.Fattr([4], attrVals);
|
|
100
|
+
const truncateAttrs = builder_1.nfs.Fattr([4 /* Nfsv4Attr.FATTR4_SIZE */], attrVals);
|
|
101
101
|
const stateid = builder_1.nfs.Stateid(0, new Uint8Array(12));
|
|
102
102
|
operations.push(builder_1.nfs.SETATTR(stateid, truncateAttrs));
|
|
103
103
|
const openResponse = await this.fs.compound(operations);
|
|
104
|
-
if (openResponse.status !== 0) {
|
|
104
|
+
if (openResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
105
105
|
throw new Error(`Failed to open file: ${openResponse.status}`);
|
|
106
106
|
}
|
|
107
107
|
const openRes = openResponse.resarray[openResponse.resarray.length - 2];
|
|
108
|
-
if (openRes.status !== 0 || !openRes.resok) {
|
|
108
|
+
if (openRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !openRes.resok) {
|
|
109
109
|
throw new Error(`Failed to open file: ${openRes.status}`);
|
|
110
110
|
}
|
|
111
111
|
const openStateid = openRes.resok.stateid;
|
|
@@ -116,13 +116,13 @@ class Nfsv4FsClient {
|
|
|
116
116
|
for (let i = 0; i < buffer.length; i += chunkSize) {
|
|
117
117
|
const chunk = buffer.slice(i, Math.min(i + chunkSize, buffer.length));
|
|
118
118
|
const writeResponse = await this.fs.compound([
|
|
119
|
-
builder_1.nfs.WRITE(openStateid, offset, 2
|
|
119
|
+
builder_1.nfs.WRITE(openStateid, offset, 2 /* Nfsv4StableHow.FILE_SYNC4 */, chunk),
|
|
120
120
|
]);
|
|
121
|
-
if (writeResponse.status !== 0) {
|
|
121
|
+
if (writeResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
122
122
|
throw new Error(`Failed to write file: ${writeResponse.status}`);
|
|
123
123
|
}
|
|
124
124
|
const writeRes = writeResponse.resarray[0];
|
|
125
|
-
if (writeRes.status !== 0 || !writeRes.resok) {
|
|
125
|
+
if (writeRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !writeRes.resok) {
|
|
126
126
|
throw new Error(`Failed to write file: ${writeRes.status}`);
|
|
127
127
|
}
|
|
128
128
|
offset += BigInt(writeRes.resok.count);
|
|
@@ -137,31 +137,31 @@ class Nfsv4FsClient {
|
|
|
137
137
|
const parts = this.parsePath(pathStr);
|
|
138
138
|
const operations = this.navigateToPath(parts);
|
|
139
139
|
const attrNums = [
|
|
140
|
-
1
|
|
141
|
-
4
|
|
142
|
-
20
|
|
143
|
-
33
|
|
144
|
-
35
|
|
145
|
-
45
|
|
146
|
-
47
|
|
147
|
-
53
|
|
148
|
-
52
|
|
140
|
+
1 /* Nfsv4Attr.FATTR4_TYPE */,
|
|
141
|
+
4 /* Nfsv4Attr.FATTR4_SIZE */,
|
|
142
|
+
20 /* Nfsv4Attr.FATTR4_FILEID */,
|
|
143
|
+
33 /* Nfsv4Attr.FATTR4_MODE */,
|
|
144
|
+
35 /* Nfsv4Attr.FATTR4_NUMLINKS */,
|
|
145
|
+
45 /* Nfsv4Attr.FATTR4_SPACE_USED */,
|
|
146
|
+
47 /* Nfsv4Attr.FATTR4_TIME_ACCESS */,
|
|
147
|
+
53 /* Nfsv4Attr.FATTR4_TIME_MODIFY */,
|
|
148
|
+
52 /* Nfsv4Attr.FATTR4_TIME_METADATA */,
|
|
149
149
|
];
|
|
150
150
|
const attrMask = this.attrNumsToBitmap(attrNums);
|
|
151
151
|
operations.push(builder_1.nfs.GETATTR(attrMask));
|
|
152
152
|
const response = await this.fs.compound(operations);
|
|
153
|
-
if (response.status !== 0) {
|
|
153
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
154
154
|
throw new Error(`Failed to stat file: ${response.status}`);
|
|
155
155
|
}
|
|
156
156
|
const getattrRes = response.resarray[response.resarray.length - 1];
|
|
157
|
-
if (getattrRes.status !== 0 || !getattrRes.resok) {
|
|
157
|
+
if (getattrRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !getattrRes.resok) {
|
|
158
158
|
throw new Error(`Failed to get attributes: ${getattrRes.status}`);
|
|
159
159
|
}
|
|
160
160
|
const fattr = getattrRes.resok.objAttributes;
|
|
161
161
|
const reader = new Reader_1.Reader();
|
|
162
162
|
reader.reset(fattr.attrVals);
|
|
163
163
|
const xdr = new XdrDecoder_1.XdrDecoder(reader);
|
|
164
|
-
let fileType = 1
|
|
164
|
+
let fileType = 1 /* Nfsv4FType.NF4REG */;
|
|
165
165
|
let size = 0;
|
|
166
166
|
let fileid = 0;
|
|
167
167
|
let mode = 0;
|
|
@@ -180,37 +180,37 @@ class Nfsv4FsClient {
|
|
|
180
180
|
continue;
|
|
181
181
|
const attrNum = i * 32 + bit;
|
|
182
182
|
switch (attrNum) {
|
|
183
|
-
case 1
|
|
183
|
+
case 1 /* Nfsv4Attr.FATTR4_TYPE */:
|
|
184
184
|
fileType = xdr.readUnsignedInt();
|
|
185
185
|
break;
|
|
186
|
-
case 4
|
|
186
|
+
case 4 /* Nfsv4Attr.FATTR4_SIZE */:
|
|
187
187
|
size = Number(xdr.readUnsignedHyper());
|
|
188
188
|
break;
|
|
189
|
-
case 20
|
|
189
|
+
case 20 /* Nfsv4Attr.FATTR4_FILEID */:
|
|
190
190
|
fileid = Number(xdr.readUnsignedHyper());
|
|
191
191
|
break;
|
|
192
|
-
case 33
|
|
192
|
+
case 33 /* Nfsv4Attr.FATTR4_MODE */:
|
|
193
193
|
mode = xdr.readUnsignedInt();
|
|
194
194
|
break;
|
|
195
|
-
case 35
|
|
195
|
+
case 35 /* Nfsv4Attr.FATTR4_NUMLINKS */:
|
|
196
196
|
nlink = xdr.readUnsignedInt();
|
|
197
197
|
break;
|
|
198
|
-
case 45
|
|
198
|
+
case 45 /* Nfsv4Attr.FATTR4_SPACE_USED */:
|
|
199
199
|
spaceUsed = Number(xdr.readUnsignedHyper());
|
|
200
200
|
break;
|
|
201
|
-
case 47
|
|
201
|
+
case 47 /* Nfsv4Attr.FATTR4_TIME_ACCESS */: {
|
|
202
202
|
const seconds = Number(xdr.readHyper());
|
|
203
203
|
const nseconds = xdr.readUnsignedInt();
|
|
204
204
|
atime = new Date(seconds * 1000 + nseconds / 1000000);
|
|
205
205
|
break;
|
|
206
206
|
}
|
|
207
|
-
case 53
|
|
207
|
+
case 53 /* Nfsv4Attr.FATTR4_TIME_MODIFY */: {
|
|
208
208
|
const seconds = Number(xdr.readHyper());
|
|
209
209
|
const nseconds = xdr.readUnsignedInt();
|
|
210
210
|
mtime = new Date(seconds * 1000 + nseconds / 1000000);
|
|
211
211
|
break;
|
|
212
212
|
}
|
|
213
|
-
case 52
|
|
213
|
+
case 52 /* Nfsv4Attr.FATTR4_TIME_METADATA */: {
|
|
214
214
|
const seconds = Number(xdr.readHyper());
|
|
215
215
|
const nseconds = xdr.readUnsignedInt();
|
|
216
216
|
ctime = new Date(seconds * 1000 + nseconds / 1000000);
|
|
@@ -237,11 +237,11 @@ class Nfsv4FsClient {
|
|
|
237
237
|
const emptyAttrs = builder_1.nfs.Fattr([], new Uint8Array(0));
|
|
238
238
|
operations.push(builder_1.nfs.CREATE(createType, dirname, emptyAttrs));
|
|
239
239
|
const response = await this.fs.compound(operations);
|
|
240
|
-
if (response.status !== 0) {
|
|
240
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
241
241
|
throw new Error(`Failed to create directory: ${response.status}`);
|
|
242
242
|
}
|
|
243
243
|
const createRes = response.resarray[response.resarray.length - 1];
|
|
244
|
-
if (createRes.status !== 0) {
|
|
244
|
+
if (createRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
245
245
|
throw new Error(`Failed to create directory: ${createRes.status}`);
|
|
246
246
|
}
|
|
247
247
|
return undefined;
|
|
@@ -252,15 +252,15 @@ class Nfsv4FsClient {
|
|
|
252
252
|
const encoding = typeof options === 'string' ? options : options?.encoding;
|
|
253
253
|
const parts = this.parsePath(pathStr);
|
|
254
254
|
const operations = this.navigateToPath(parts);
|
|
255
|
-
const attrNums = withFileTypes ? [1] : [];
|
|
255
|
+
const attrNums = withFileTypes ? [1 /* Nfsv4Attr.FATTR4_TYPE */] : [];
|
|
256
256
|
const attrMask = this.attrNumsToBitmap(attrNums);
|
|
257
257
|
operations.push(builder_1.nfs.READDIR(attrMask));
|
|
258
258
|
const response = await this.fs.compound(operations);
|
|
259
|
-
if (response.status !== 0) {
|
|
259
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
260
260
|
throw new Error(`Failed to read directory: ${response.status}`);
|
|
261
261
|
}
|
|
262
262
|
const readdirRes = response.resarray[response.resarray.length - 1];
|
|
263
|
-
if (readdirRes.status !== 0 || !readdirRes.resok) {
|
|
263
|
+
if (readdirRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !readdirRes.resok) {
|
|
264
264
|
throw new Error(`Failed to read directory: ${readdirRes.status}`);
|
|
265
265
|
}
|
|
266
266
|
const entries = [];
|
|
@@ -274,7 +274,7 @@ class Nfsv4FsClient {
|
|
|
274
274
|
const reader = new Reader_1.Reader();
|
|
275
275
|
reader.reset(fattr.attrVals);
|
|
276
276
|
const xdr = new XdrDecoder_1.XdrDecoder(reader);
|
|
277
|
-
let fileType = 1
|
|
277
|
+
let fileType = 1 /* Nfsv4FType.NF4REG */;
|
|
278
278
|
const returnedMask = fattr.attrmask.mask;
|
|
279
279
|
for (let i = 0; i < returnedMask.length; i++) {
|
|
280
280
|
const word = returnedMask[i];
|
|
@@ -284,7 +284,7 @@ class Nfsv4FsClient {
|
|
|
284
284
|
if (!(word & (1 << bit)))
|
|
285
285
|
continue;
|
|
286
286
|
const attrNum = i * 32 + bit;
|
|
287
|
-
if (attrNum === 1) {
|
|
287
|
+
if (attrNum === 1 /* Nfsv4Attr.FATTR4_TYPE */) {
|
|
288
288
|
fileType = xdr.readUnsignedInt();
|
|
289
289
|
}
|
|
290
290
|
}
|
|
@@ -311,20 +311,20 @@ class Nfsv4FsClient {
|
|
|
311
311
|
const openOwner = this.createDefaultOpenOwner();
|
|
312
312
|
const claim = builder_1.nfs.OpenClaimNull(filename);
|
|
313
313
|
const openSeqid = this.nextOpenOwnerSeqid(openOwner);
|
|
314
|
-
operations.push(builder_1.nfs.OPEN(openSeqid, 2
|
|
315
|
-
const attrNums = [4];
|
|
314
|
+
operations.push(builder_1.nfs.OPEN(openSeqid, 2 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_WRITE */, 0 /* Nfsv4OpenDeny.OPEN4_SHARE_DENY_NONE */, openOwner, builder_1.nfs.OpenHowNoCreate(), claim));
|
|
315
|
+
const attrNums = [4 /* Nfsv4Attr.FATTR4_SIZE */];
|
|
316
316
|
const attrMask = this.attrNumsToBitmap(attrNums);
|
|
317
317
|
operations.push(builder_1.nfs.GETATTR(attrMask));
|
|
318
318
|
const openResponse = await this.fs.compound(operations);
|
|
319
|
-
if (openResponse.status !== 0) {
|
|
319
|
+
if (openResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
320
320
|
throw new Error(`Failed to open file: ${openResponse.status}`);
|
|
321
321
|
}
|
|
322
322
|
const openRes = openResponse.resarray[openResponse.resarray.length - 2];
|
|
323
|
-
if (openRes.status !== 0 || !openRes.resok) {
|
|
323
|
+
if (openRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !openRes.resok) {
|
|
324
324
|
throw new Error(`Failed to open file: ${openRes.status}`);
|
|
325
325
|
}
|
|
326
326
|
const getattrRes = openResponse.resarray[openResponse.resarray.length - 1];
|
|
327
|
-
if (getattrRes.status !== 0 || !getattrRes.resok) {
|
|
327
|
+
if (getattrRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !getattrRes.resok) {
|
|
328
328
|
throw new Error(`Failed to get attributes: ${getattrRes.status}`);
|
|
329
329
|
}
|
|
330
330
|
const fattr = getattrRes.resok.objAttributes;
|
|
@@ -340,13 +340,13 @@ class Nfsv4FsClient {
|
|
|
340
340
|
for (let i = 0; i < buffer.length; i += chunkSize) {
|
|
341
341
|
const chunk = buffer.slice(i, Math.min(i + chunkSize, buffer.length));
|
|
342
342
|
const writeResponse = await this.fs.compound([
|
|
343
|
-
builder_1.nfs.WRITE(openStateid, offset, 2
|
|
343
|
+
builder_1.nfs.WRITE(openStateid, offset, 2 /* Nfsv4StableHow.FILE_SYNC4 */, chunk),
|
|
344
344
|
]);
|
|
345
|
-
if (writeResponse.status !== 0) {
|
|
345
|
+
if (writeResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
346
346
|
throw new Error(`Failed to write file: ${writeResponse.status}`);
|
|
347
347
|
}
|
|
348
348
|
const writeRes = writeResponse.resarray[0];
|
|
349
|
-
if (writeRes.status !== 0 || !writeRes.resok) {
|
|
349
|
+
if (writeRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !writeRes.resok) {
|
|
350
350
|
throw new Error(`Failed to write file: ${writeRes.status}`);
|
|
351
351
|
}
|
|
352
352
|
offset += BigInt(writeRes.resok.count);
|
|
@@ -364,15 +364,15 @@ class Nfsv4FsClient {
|
|
|
364
364
|
const xdr = new XdrEncoder_1.XdrEncoder(writer);
|
|
365
365
|
xdr.writeUnsignedHyper(BigInt(len));
|
|
366
366
|
const attrVals = writer.flush();
|
|
367
|
-
const sizeAttrs = builder_1.nfs.Fattr([4], attrVals);
|
|
367
|
+
const sizeAttrs = builder_1.nfs.Fattr([4 /* Nfsv4Attr.FATTR4_SIZE */], attrVals);
|
|
368
368
|
const stateid = builder_1.nfs.Stateid(0, new Uint8Array(12));
|
|
369
369
|
operations.push(builder_1.nfs.SETATTR(stateid, sizeAttrs));
|
|
370
370
|
const response = await this.fs.compound(operations);
|
|
371
|
-
if (response.status !== 0) {
|
|
371
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
372
372
|
throw new Error(`Failed to truncate file: ${response.status}`);
|
|
373
373
|
}
|
|
374
374
|
const setattrRes = response.resarray[response.resarray.length - 1];
|
|
375
|
-
if (setattrRes.status !== 0) {
|
|
375
|
+
if (setattrRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
376
376
|
throw new Error(`Failed to truncate file: ${setattrRes.status}`);
|
|
377
377
|
}
|
|
378
378
|
};
|
|
@@ -386,11 +386,11 @@ class Nfsv4FsClient {
|
|
|
386
386
|
const filename = parts[parts.length - 1];
|
|
387
387
|
operations.push(builder_1.nfs.REMOVE(filename));
|
|
388
388
|
const response = await this.fs.compound(operations);
|
|
389
|
-
if (response.status !== 0) {
|
|
389
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
390
390
|
throw new Error(`Failed to unlink file: ${response.status}`);
|
|
391
391
|
}
|
|
392
392
|
const removeRes = response.resarray[response.resarray.length - 1];
|
|
393
|
-
if (removeRes.status !== 0) {
|
|
393
|
+
if (removeRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
394
394
|
throw new Error(`Failed to unlink file: ${removeRes.status}`);
|
|
395
395
|
}
|
|
396
396
|
};
|
|
@@ -404,11 +404,11 @@ class Nfsv4FsClient {
|
|
|
404
404
|
const dirname = parts[parts.length - 1];
|
|
405
405
|
operations.push(builder_1.nfs.REMOVE(dirname));
|
|
406
406
|
const response = await this.fs.compound(operations);
|
|
407
|
-
if (response.status !== 0) {
|
|
407
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
408
408
|
throw new Error(`Failed to remove directory: ${response.status}`);
|
|
409
409
|
}
|
|
410
410
|
const removeRes = response.resarray[response.resarray.length - 1];
|
|
411
|
-
if (removeRes.status !== 0) {
|
|
411
|
+
if (removeRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
412
412
|
throw new Error(`Failed to remove directory: ${removeRes.status}`);
|
|
413
413
|
}
|
|
414
414
|
};
|
|
@@ -442,13 +442,13 @@ class Nfsv4FsClient {
|
|
|
442
442
|
const name = parts[parts.length - 1];
|
|
443
443
|
operations.push(builder_1.nfs.REMOVE(name));
|
|
444
444
|
const response = await this.fs.compound(operations);
|
|
445
|
-
if (response.status !== 0) {
|
|
445
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
446
446
|
if (!force)
|
|
447
447
|
throw new Error(`Failed to remove: ${response.status}`);
|
|
448
448
|
return;
|
|
449
449
|
}
|
|
450
450
|
const removeRes = response.resarray[response.resarray.length - 1];
|
|
451
|
-
if (removeRes.status !== 0) {
|
|
451
|
+
if (removeRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
452
452
|
if (!force)
|
|
453
453
|
throw new Error(`Failed to remove: ${removeRes.status}`);
|
|
454
454
|
}
|
|
@@ -464,23 +464,23 @@ class Nfsv4FsClient {
|
|
|
464
464
|
const operations = this.navigateToPath(parts);
|
|
465
465
|
let accessMask = 0;
|
|
466
466
|
if (mode === 0) {
|
|
467
|
-
accessMask = 1
|
|
467
|
+
accessMask = 1 /* Nfsv4Access.ACCESS4_READ */;
|
|
468
468
|
}
|
|
469
469
|
else {
|
|
470
470
|
if (mode & 4)
|
|
471
|
-
accessMask |= 1
|
|
471
|
+
accessMask |= 1 /* Nfsv4Access.ACCESS4_READ */;
|
|
472
472
|
if (mode & 2)
|
|
473
|
-
accessMask |= 4
|
|
473
|
+
accessMask |= 4 /* Nfsv4Access.ACCESS4_MODIFY */;
|
|
474
474
|
if (mode & 1)
|
|
475
|
-
accessMask |= 32
|
|
475
|
+
accessMask |= 32 /* Nfsv4Access.ACCESS4_EXECUTE */;
|
|
476
476
|
}
|
|
477
477
|
operations.push(builder_1.nfs.ACCESS(accessMask));
|
|
478
478
|
const response = await this.fs.compound(operations);
|
|
479
|
-
if (response.status !== 0) {
|
|
479
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
480
480
|
throw new Error(`Access denied: ${response.status}`);
|
|
481
481
|
}
|
|
482
482
|
const accessRes = response.resarray[response.resarray.length - 1];
|
|
483
|
-
if (accessRes.status !== 0) {
|
|
483
|
+
if (accessRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
484
484
|
throw new Error(`Access denied: ${accessRes.status}`);
|
|
485
485
|
}
|
|
486
486
|
};
|
|
@@ -506,11 +506,11 @@ class Nfsv4FsClient {
|
|
|
506
506
|
const newname = newParts[newParts.length - 1];
|
|
507
507
|
operations.push(builder_1.nfs.RENAME(oldname, newname));
|
|
508
508
|
const response = await this.fs.compound(operations);
|
|
509
|
-
if (response.status !== 0) {
|
|
509
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
510
510
|
throw new Error(`Failed to rename: ${response.status}`);
|
|
511
511
|
}
|
|
512
512
|
const renameRes = response.resarray[response.resarray.length - 1];
|
|
513
|
-
if (renameRes.status !== 0) {
|
|
513
|
+
if (renameRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
514
514
|
throw new Error(`Failed to rename: ${renameRes.status}`);
|
|
515
515
|
}
|
|
516
516
|
};
|
|
@@ -544,11 +544,11 @@ class Nfsv4FsClient {
|
|
|
544
544
|
const newname = newParts[newParts.length - 1];
|
|
545
545
|
operations.push(builder_1.nfs.LINK(newname));
|
|
546
546
|
const response = await this.fs.compound(operations);
|
|
547
|
-
if (response.status !== 0) {
|
|
547
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
548
548
|
throw new Error(`Failed to create link: ${response.status}`);
|
|
549
549
|
}
|
|
550
550
|
const linkRes = response.resarray[response.resarray.length - 1];
|
|
551
|
-
if (linkRes.status !== 0) {
|
|
551
|
+
if (linkRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
552
552
|
throw new Error(`Failed to create link: ${linkRes.status}`);
|
|
553
553
|
}
|
|
554
554
|
};
|
|
@@ -561,15 +561,15 @@ class Nfsv4FsClient {
|
|
|
561
561
|
}
|
|
562
562
|
const operations = this.navigateToParent(parts);
|
|
563
563
|
const linkname = parts[parts.length - 1];
|
|
564
|
-
const createType = new structs.Nfsv4CreateType(5
|
|
564
|
+
const createType = new structs.Nfsv4CreateType(5 /* Nfsv4FType.NF4LNK */, new structs.Nfsv4CreateTypeLink(targetStr));
|
|
565
565
|
const emptyAttrs = builder_1.nfs.Fattr([], new Uint8Array(0));
|
|
566
566
|
operations.push(builder_1.nfs.CREATE(createType, linkname, emptyAttrs));
|
|
567
567
|
const response = await this.fs.compound(operations);
|
|
568
|
-
if (response.status !== 0) {
|
|
568
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
569
569
|
throw new Error(`Failed to create symlink: ${response.status}`);
|
|
570
570
|
}
|
|
571
571
|
const createRes = response.resarray[response.resarray.length - 1];
|
|
572
|
-
if (createRes.status !== 0) {
|
|
572
|
+
if (createRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
573
573
|
throw new Error(`Failed to create symlink: ${createRes.status}`);
|
|
574
574
|
}
|
|
575
575
|
};
|
|
@@ -588,15 +588,15 @@ class Nfsv4FsClient {
|
|
|
588
588
|
xdr.writeHyper(BigInt(Math.floor(mtimeMs / 1000)));
|
|
589
589
|
xdr.writeUnsignedInt((mtimeMs % 1000) * 1000000);
|
|
590
590
|
const attrVals = writer.flush();
|
|
591
|
-
const timeAttrs = builder_1.nfs.Fattr([48
|
|
591
|
+
const timeAttrs = builder_1.nfs.Fattr([48 /* Nfsv4Attr.FATTR4_TIME_ACCESS_SET */, 54 /* Nfsv4Attr.FATTR4_TIME_MODIFY_SET */], attrVals);
|
|
592
592
|
const stateid = builder_1.nfs.Stateid(0, new Uint8Array(12));
|
|
593
593
|
operations.push(builder_1.nfs.SETATTR(stateid, timeAttrs));
|
|
594
594
|
const response = await this.fs.compound(operations);
|
|
595
|
-
if (response.status !== 0) {
|
|
595
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
596
596
|
throw new Error(`Failed to set times: ${response.status}`);
|
|
597
597
|
}
|
|
598
598
|
const setattrRes = response.resarray[response.resarray.length - 1];
|
|
599
|
-
if (setattrRes.status !== 0) {
|
|
599
|
+
if (setattrRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
600
600
|
throw new Error(`Failed to set times: ${setattrRes.status}`);
|
|
601
601
|
}
|
|
602
602
|
};
|
|
@@ -607,11 +607,11 @@ class Nfsv4FsClient {
|
|
|
607
607
|
const operations = this.navigateToPath(parts);
|
|
608
608
|
operations.push(builder_1.nfs.READLINK());
|
|
609
609
|
const response = await this.fs.compound(operations);
|
|
610
|
-
if (response.status !== 0) {
|
|
610
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
611
611
|
throw new Error(`Failed to read link: ${response.status}`);
|
|
612
612
|
}
|
|
613
613
|
const readlinkRes = response.resarray[response.resarray.length - 1];
|
|
614
|
-
if (readlinkRes.status !== 0 || !readlinkRes.resok) {
|
|
614
|
+
if (readlinkRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !readlinkRes.resok) {
|
|
615
615
|
throw new Error(`Failed to read link: ${readlinkRes.status}`);
|
|
616
616
|
}
|
|
617
617
|
if (!encoding || encoding === 'utf8') {
|
|
@@ -643,15 +643,15 @@ class Nfsv4FsClient {
|
|
|
643
643
|
const xdr = new XdrEncoder_1.XdrEncoder(writer);
|
|
644
644
|
xdr.writeUnsignedInt(modeValue);
|
|
645
645
|
const attrVals = writer.flush();
|
|
646
|
-
const attrs = builder_1.nfs.Fattr([33], attrVals);
|
|
646
|
+
const attrs = builder_1.nfs.Fattr([33 /* Nfsv4Attr.FATTR4_MODE */], attrVals);
|
|
647
647
|
const stateid = builder_1.nfs.Stateid(0, new Uint8Array(12));
|
|
648
648
|
operations.push(builder_1.nfs.SETATTR(stateid, attrs));
|
|
649
649
|
const response = await this.fs.compound(operations);
|
|
650
|
-
if (response.status !== 0) {
|
|
650
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
651
651
|
throw new Error(`Failed to chmod: ${response.status}`);
|
|
652
652
|
}
|
|
653
653
|
const setattrRes = response.resarray[response.resarray.length - 1];
|
|
654
|
-
if (setattrRes.status !== 0) {
|
|
654
|
+
if (setattrRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
655
655
|
throw new Error(`Failed to chmod: ${setattrRes.status}`);
|
|
656
656
|
}
|
|
657
657
|
};
|
|
@@ -664,15 +664,15 @@ class Nfsv4FsClient {
|
|
|
664
664
|
xdr.writeStr(uid.toString());
|
|
665
665
|
xdr.writeStr(gid.toString());
|
|
666
666
|
const attrVals = writer.flush();
|
|
667
|
-
const attrs = builder_1.nfs.Fattr([36
|
|
667
|
+
const attrs = builder_1.nfs.Fattr([36 /* Nfsv4Attr.FATTR4_OWNER */, 37 /* Nfsv4Attr.FATTR4_OWNER_GROUP */], attrVals);
|
|
668
668
|
const stateid = builder_1.nfs.Stateid(0, new Uint8Array(12));
|
|
669
669
|
operations.push(builder_1.nfs.SETATTR(stateid, attrs));
|
|
670
670
|
const response = await this.fs.compound(operations);
|
|
671
|
-
if (response.status !== 0) {
|
|
671
|
+
if (response.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
672
672
|
throw new Error(`Failed to chown: ${response.status}`);
|
|
673
673
|
}
|
|
674
674
|
const setattrRes = response.resarray[response.resarray.length - 1];
|
|
675
|
-
if (setattrRes.status !== 0) {
|
|
675
|
+
if (setattrRes.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
676
676
|
throw new Error(`Failed to chown: ${setattrRes.status}`);
|
|
677
677
|
}
|
|
678
678
|
};
|
|
@@ -692,16 +692,16 @@ class Nfsv4FsClient {
|
|
|
692
692
|
const filename = parts[parts.length - 1];
|
|
693
693
|
const openOwner = this.createDefaultOpenOwner();
|
|
694
694
|
const claim = builder_1.nfs.OpenClaimNull(filename);
|
|
695
|
-
let access = 1
|
|
695
|
+
let access = 1 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_READ */;
|
|
696
696
|
const openSeqid = this.nextOpenOwnerSeqid(openOwner);
|
|
697
697
|
if (typeof flags === 'string') {
|
|
698
698
|
if (flags.includes('r') && flags.includes('+')) {
|
|
699
|
-
access = 3
|
|
699
|
+
access = 3 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_BOTH */;
|
|
700
700
|
}
|
|
701
701
|
else if (flags.includes('w') || flags.includes('a')) {
|
|
702
|
-
access = 2
|
|
702
|
+
access = 2 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_WRITE */;
|
|
703
703
|
if (flags.includes('+')) {
|
|
704
|
-
access = 3
|
|
704
|
+
access = 3 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_BOTH */;
|
|
705
705
|
}
|
|
706
706
|
}
|
|
707
707
|
}
|
|
@@ -713,23 +713,23 @@ class Nfsv4FsClient {
|
|
|
713
713
|
const accessMode = flags & O_ACCMODE;
|
|
714
714
|
switch (accessMode) {
|
|
715
715
|
case O_RDONLY:
|
|
716
|
-
access = 1
|
|
716
|
+
access = 1 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_READ */;
|
|
717
717
|
break;
|
|
718
718
|
case O_WRONLY:
|
|
719
|
-
access = 2
|
|
719
|
+
access = 2 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_WRITE */;
|
|
720
720
|
break;
|
|
721
721
|
case O_RDWR:
|
|
722
|
-
access = 3
|
|
722
|
+
access = 3 /* Nfsv4OpenAccess.OPEN4_SHARE_ACCESS_BOTH */;
|
|
723
723
|
break;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
operations.push(builder_1.nfs.OPEN(openSeqid, access, 0
|
|
726
|
+
operations.push(builder_1.nfs.OPEN(openSeqid, access, 0 /* Nfsv4OpenDeny.OPEN4_SHARE_DENY_NONE */, openOwner, builder_1.nfs.OpenHowNoCreate(), claim));
|
|
727
727
|
const openResponse = await this.fs.compound(operations);
|
|
728
|
-
if (openResponse.status !== 0) {
|
|
728
|
+
if (openResponse.status !== 0 /* Nfsv4Stat.NFS4_OK */) {
|
|
729
729
|
throw new Error(`Failed to open file: ${openResponse.status}`);
|
|
730
730
|
}
|
|
731
731
|
const openRes = openResponse.resarray[openResponse.resarray.length - 1];
|
|
732
|
-
if (openRes.status !== 0 || !openRes.resok) {
|
|
732
|
+
if (openRes.status !== 0 /* Nfsv4Stat.NFS4_OK */ || !openRes.resok) {
|
|
733
733
|
throw new Error(`Failed to open file: ${openRes.status}`);
|
|
734
734
|
}
|
|
735
735
|
const stateid = openRes.resok.stateid;
|