proto.io 0.0.224 → 0.0.226
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/dist/adapters/file/aliyun-oss.d.ts +3 -3
- package/dist/adapters/file/aliyun-oss.d.ts.map +1 -1
- package/dist/adapters/file/aliyun-oss.js.map +1 -1
- package/dist/adapters/file/aliyun-oss.mjs.map +1 -1
- package/dist/adapters/file/database.d.ts +2 -2
- package/dist/adapters/file/database.d.ts.map +1 -1
- package/dist/adapters/file/database.js.map +1 -1
- package/dist/adapters/file/database.mjs +2 -2
- package/dist/adapters/file/database.mjs.map +1 -1
- package/dist/adapters/file/filesystem.d.ts +3 -3
- package/dist/adapters/file/filesystem.d.ts.map +1 -1
- package/dist/adapters/file/filesystem.js.map +1 -1
- package/dist/adapters/file/filesystem.mjs.map +1 -1
- package/dist/adapters/file/google-cloud-storage.d.ts +3 -3
- package/dist/adapters/file/google-cloud-storage.d.ts.map +1 -1
- package/dist/adapters/file/google-cloud-storage.js.map +1 -1
- package/dist/adapters/file/google-cloud-storage.mjs.map +1 -1
- package/dist/adapters/storage/progres.d.ts +1 -1
- package/dist/adapters/storage/progres.d.ts.map +1 -1
- package/dist/adapters/storage/progres.js +1 -1
- package/dist/adapters/storage/progres.js.map +1 -1
- package/dist/adapters/storage/progres.mjs +5 -5
- package/dist/adapters/storage/progres.mjs.map +1 -1
- package/dist/client.d.ts +3 -3
- package/dist/client.d.ts.map +1 -1
- package/dist/client.mjs +4 -4
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +48 -19
- package/dist/index.mjs.map +1 -1
- package/dist/internals/{base-NZIvB1zK.d.ts → base-DSo02iAX.d.ts} +4 -3
- package/dist/internals/base-DSo02iAX.d.ts.map +1 -0
- package/dist/internals/base-DYc1_peK.mjs.map +1 -1
- package/dist/internals/base-NsJYo2MG.js.map +1 -1
- package/dist/internals/{chunk-B9i8NMB_.d.ts → chunk-BhwfdCdq.d.ts} +3 -3
- package/dist/internals/chunk-BhwfdCdq.d.ts.map +1 -0
- package/dist/internals/chunk-BuKmyceG.js.map +1 -1
- package/dist/internals/chunk-bpt1C6W4.mjs.map +1 -1
- package/dist/internals/{const-DqPhhmor.mjs → const-68KwNmag.mjs} +2 -2
- package/dist/internals/{const-DqPhhmor.mjs.map → const-68KwNmag.mjs.map} +1 -1
- package/dist/internals/{index-BOboD1oK.d.ts → index-1ZK5N4yb.d.ts} +4 -3
- package/dist/internals/index-1ZK5N4yb.d.ts.map +1 -0
- package/dist/internals/{index-BZ79Ljis.mjs → index-BWZIV3_T.mjs} +4 -4
- package/dist/internals/{index-BZ79Ljis.mjs.map → index-BWZIV3_T.mjs.map} +1 -1
- package/dist/internals/index-CLKTEIj0.js.map +1 -1
- package/dist/internals/{index-gWcE22mf.mjs → index-CSOoWRr1.mjs} +2 -2
- package/dist/internals/{index-gWcE22mf.mjs.map → index-CSOoWRr1.mjs.map} +1 -1
- package/dist/internals/{index-BcNiVp-e.d.ts → index-Cj45GkKv.d.ts} +2 -2
- package/dist/internals/index-Cj45GkKv.d.ts.map +1 -0
- package/dist/internals/index-vOFh8pVc.js.map +1 -1
- package/dist/internals/random-CYjWDvex.mjs.map +1 -1
- package/dist/internals/random-nkOQ9U6S.js.map +1 -1
- package/dist/internals/validator-Bc1jRJfA.js.map +1 -1
- package/dist/internals/{validator-0I1kvhsL.mjs → validator-Boj1PUjM.mjs} +2 -2
- package/dist/internals/{validator-0I1kvhsL.mjs.map → validator-Boj1PUjM.mjs.map} +1 -1
- package/package.json +23 -23
- package/dist/internals/base-NZIvB1zK.d.ts.map +0 -1
- package/dist/internals/chunk-B9i8NMB_.d.ts.map +0 -1
- package/dist/internals/index-BOboD1oK.d.ts.map +0 -1
- package/dist/internals/index-BcNiVp-e.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { d as TFileStorage, T as TSchema, P as ProtoService, G as TFileInfo } from './index-
|
|
1
|
+
import { d as TFileStorage, T as TSchema, P as ProtoService, G as TFileInfo } from './index-1ZK5N4yb.js';
|
|
2
2
|
import { BinaryData } from '@o2ter/utils-js';
|
|
3
3
|
|
|
4
4
|
type FileStorageOptions = {
|
|
@@ -22,5 +22,6 @@ declare abstract class FileStorageBase implements TFileStorage {
|
|
|
22
22
|
fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number): AsyncGenerator<Buffer<ArrayBufferLike>, void, unknown>;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export { FileStorageBase as F
|
|
26
|
-
|
|
25
|
+
export { FileStorageBase as F };
|
|
26
|
+
export type { FileStorageOptions as a };
|
|
27
|
+
//# sourceMappingURL=base-DSo02iAX.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-DSo02iAX.d.ts","sources":["../../src/adapters/file/base/base.ts"],"sourcesContent":["//\n// base.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { BinaryData, binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n"],"names":[],"mappings":";;;AAIO;AACP;AACA;AACA;AACO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-DYc1_peK.mjs","sources":["../../src/adapters/file/base/base.ts"],"sourcesContent":["//\n// base.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { BinaryData, binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n"],"names":["_deflate","_unzip"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA,MAAM,OAAO,GAAG,SAAS,CAACA,SAAQ,CAAC;AACnC,MAAM,KAAK,GAAG,SAAS,CAACC,OAAM,CAAC;MAOT,eAAe,CAAA;AAEnC,IAAA,OAAO;AAEP,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,EAAE,GAAG,IAAI;AACpB,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACvC
|
|
1
|
+
{"version":3,"file":"base-DYc1_peK.mjs","sources":["../../src/adapters/file/base/base.ts"],"sourcesContent":["//\n// base.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { BinaryData, binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n"],"names":["_deflate","_unzip"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA,MAAM,OAAO,GAAG,SAAS,CAACA,SAAQ,CAAC;AACnC,MAAM,KAAK,GAAG,SAAS,CAACC,OAAM,CAAC;MAOT,eAAe,CAAA;AAEnC,IAAA,OAAO;AAEP,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,EAAE,GAAG,IAAI;AACpB,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,I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EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,CAAC,EACtC,IAAI,CAAC,OAAO,CAAC,QAAQ,EACrB,OAAM,KAAK,MAAK;YACd,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,IAAI,EAAE,MAAM,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,CAAC;AACpC,SAAA,CAAC,CACH;AAED,QAAA,WAAW,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,OAAO,EAAE;AAEvD,YAAA,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAE1C,gBAAA,MAAM,IAAI;YAEZ;iBAAO;AAEL,gBAAA,MAAM,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC,MAAM;gBACzC,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,UAAU,GAAG,KAAK,GAAG,UAAU,GAAG,CAAC;gBAC/E,MAAM,IAAI,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,GAAG,QAAQ,GAAG,GAAG,GAAG,UAAU,GAAG,SAAS;gBAE7E,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;YACnC;QACF;IACF;AACD;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-NsJYo2MG.js","sources":["../../src/adapters/file/base/base.ts"],"sourcesContent":["//\n// base.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { BinaryData, binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n"],"names":["promisify","_deflate","_unzip","PVK","parallelEach","binaryStreamChunk","parallelMap"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA,MAAM,OAAO,GAAGA,cAAS,CAACC,YAAQ,CAAC;AACnC,MAAM,KAAK,GAAGD,cAAS,CAACE,UAAM,CAAC;MAOT,eAAe,CAAA;AAEnC,IAAA,OAAO;AAEP,IAAA,WAAA,CAAY,OAA2B,EAAA;QACrC,IAAI,CAAC,OAAO,GAAG;YACb,SAAS,EAAE,EAAE,GAAG,IAAI;AACpB,YAAA,QAAQ,EAAE,CAAC;AACX,YAAA,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SACvC
|
|
1
|
+
{"version":3,"file":"base-NsJYo2MG.js","sources":["../../src/adapters/file/base/base.ts"],"sourcesContent":["//\n// base.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { promisify } from 'util';\nimport { deflate as _deflate, unzip as _unzip } from 'zlib';\nimport { TFileInfo, TFileStorage } from '../../../server/file';\nimport { ProtoService } from '../../../server/proto';\nimport { TSchema } from '../../../internals/schema';\nimport { BinaryData, binaryStreamChunk, parallelEach, parallelMap } from '@o2ter/utils-js';\nimport { PVK } from '../../../internals/private';\n\nconst deflate = promisify(_deflate);\nconst unzip = promisify(_unzip);\n\nexport type FileStorageOptions = {\n chunkSize?: number;\n parallel?: number;\n};\n\nexport abstract class FileStorageBase implements TFileStorage {\n\n options: Required<FileStorageOptions>;\n\n constructor(options: FileStorageOptions) {\n this.options = {\n chunkSize: 16 * 1024,\n parallel: 8,\n ..._.pickBy(options, v => !_.isNil(v)),\n };\n }\n\n get schema(): Record<string, TSchema> {\n return {}\n }\n\n abstract createChunk<E>(proto: ProtoService<E>, token: string, start: number, end: number, compressed: Buffer): PromiseLike<void>;\n abstract readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n data: Buffer | Uint8Array | PromiseLike<Buffer | Uint8Array>;\n }, void>;\n abstract destroy<E>(proto: ProtoService<E>, id: string): PromiseLike<void>;\n\n async create<E>(\n proto: ProtoService<E>,\n stream: BinaryData | AsyncIterable<BinaryData>,\n info: TFileInfo,\n maxUploadSize: number,\n ) {\n\n const token = proto[PVK].generateId();\n\n let size = 0;\n const _stream = async function* (stream: AsyncIterable<Buffer>) {\n for await (const data of stream) {\n yield { data, offset: size };\n size += data.byteLength;\n }\n };\n\n await parallelEach(\n _stream(binaryStreamChunk(stream, this.options.chunkSize)),\n this.options.parallel,\n async ({ data, offset }) => {\n const chunkSize = data.byteLength;\n await this.createChunk(proto, token, offset, offset + chunkSize, await deflate(data));\n if (offset + chunkSize > maxUploadSize) throw Error('Payload too large');\n }\n );\n\n return { _id: token, size };\n }\n\n async* fileData<E>(proto: ProtoService<E>, id: string, start?: number, end?: number) {\n\n const _stream = parallelMap(\n this.readChunks(proto, id, start, end),\n this.options.parallel,\n async chunk => ({\n start: chunk.start,\n data: await unzip(await chunk.data),\n })\n );\n\n for await (const { start: startBytes, data } of _stream) {\n\n if (!_.isNumber(start) && !_.isNumber(end)) {\n\n yield data;\n\n } else {\n\n const endBytes = startBytes + data.length;\n const _start = _.isNumber(start) && start > startBytes ? start - startBytes : 0;\n const _end = _.isNumber(end) && end < endBytes ? end - startBytes : undefined;\n\n yield data.subarray(_start, _end);\n }\n }\n }\n};\n"],"names":["promisify","_deflate","_unzip","PVK","parallelEach","binaryStreamChunk","parallelMap"],"m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,GAAG,SAAS;gBAE7E,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;YACnC;QACF;IACF;AACD;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FileStorageBase } from './base-
|
|
2
|
-
import { P as ProtoService } from './index-
|
|
1
|
+
import { F as FileStorageBase } from './base-DSo02iAX.js';
|
|
2
|
+
import { P as ProtoService } from './index-1ZK5N4yb.js';
|
|
3
3
|
|
|
4
4
|
declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
|
|
5
5
|
abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{
|
|
@@ -14,4 +14,4 @@ declare abstract class FileChunkStorageBase<File> extends FileStorageBase {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
export { FileChunkStorageBase as F };
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-BhwfdCdq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chunk-BhwfdCdq.d.ts","sources":["../../src/adapters/file/base/chunk.ts"],"sourcesContent":["//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { FileStorageBase } from './base';\nimport { ProtoService } from '../../../server/proto';\nimport { asyncIterableToArray } from '@o2ter/utils-js';\n\nexport abstract class FileChunkStorageBase<File> extends FileStorageBase {\n\n abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n file: File;\n }>;\n\n abstract readChunk<E>(proto: ProtoService<E>, file: File): PromiseLike<Buffer>;\n\n async* readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number) {\n const streams = await asyncIterableToArray(this.listChunks(proto, token, start, end));\n const files = _.orderBy(streams, x => x.start);\n for (const [chunk, endBytes] of _.zip(files, _.slice(_.map(files, x => x.start), 1))) {\n if (_.isNumber(start) && _.isNumber(endBytes) && start >= endBytes) continue;\n if (_.isNumber(end) && end <= chunk!.start) continue;\n if (!chunk) continue;\n yield {\n start: chunk.start,\n data: (async () => this.readChunk(proto, chunk.file))(),\n };\n }\n }\n}"],"names":[],"mappings":";;;AAEO,uBAAA,oBAAA,eAAA,eAAA;AACP,kCAAA,YAAA,mDAAA,cAAA;AACA;AACA;AACA;AACA,iCAAA,YAAA,kBAAA,WAAA,CAAA,MAAA;AACA,yBAAA,YAAA,mDAAA,cAAA;AACA;AACA,cAAA,OAAA,CAAA,MAAA,CAAA,eAAA;AACA;AACA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chunk-BuKmyceG.js","sources":["../../src/adapters/file/base/chunk.ts"],"sourcesContent":["//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { FileStorageBase } from './base';\nimport { ProtoService } from '../../../server/proto';\nimport { asyncIterableToArray } from '@o2ter/utils-js';\n\nexport abstract class FileChunkStorageBase<File> extends FileStorageBase {\n\n abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n file: File;\n }>;\n\n abstract readChunk<E>(proto: ProtoService<E>, file: File): PromiseLike<Buffer>;\n\n async* readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number) {\n const streams = await asyncIterableToArray(this.listChunks(proto, token, start, end));\n const files = _.orderBy(streams, x => x.start);\n for (const [chunk, endBytes] of _.zip(files, _.slice(_.map(files, x => x.start), 1))) {\n if (_.isNumber(start) && _.isNumber(endBytes) && start >= endBytes) continue;\n if (_.isNumber(end) && end <= chunk!.start) continue;\n if (!chunk) continue;\n yield {\n start: chunk.start,\n data: (async () => this.readChunk(proto, chunk.file))(),\n };\n }\n }\n}"],"names":["FileStorageBase","asyncIterableToArray"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOM,MAAgB,oBAA2B,SAAQA,oBAAe,CAAA;IAStE,OAAO,UAAU,CAAI,KAAsB,EAAE,KAAa,EAAE,KAAc,EAAE,GAAY,EAAA;AACtF,QAAA,MAAM,OAAO,GAAG,MAAMC,4BAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACrF,QAAA,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;AAC9C,QAAA,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;AACpF,YAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,QAAQ;gBAAE;YACpE,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,KAAM,CAAC,KAAK;gBAAE;AAC5C,YAAA,IAAI,CAAC,KAAK;gBAAE;YACZ,MAAM;gBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,gBAAA,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG;aACxD
|
|
1
|
+
{"version":3,"file":"chunk-BuKmyceG.js","sources":["../../src/adapters/file/base/chunk.ts"],"sourcesContent":["//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { FileStorageBase } from './base';\nimport { ProtoService } from '../../../server/proto';\nimport { asyncIterableToArray } from '@o2ter/utils-js';\n\nexport abstract class FileChunkStorageBase<File> extends FileStorageBase {\n\n abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n file: File;\n }>;\n\n abstract readChunk<E>(proto: ProtoService<E>, file: File): PromiseLike<Buffer>;\n\n async* readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number) {\n const streams = await asyncIterableToArray(this.listChunks(proto, token, start, end));\n const files = _.orderBy(streams, x => x.start);\n for (const [chunk, endBytes] of _.zip(files, _.slice(_.map(files, x => x.start), 1))) {\n if (_.isNumber(start) && _.isNumber(endBytes) && start >= endBytes) continue;\n if (_.isNumber(end) && end <= chunk!.start) continue;\n if (!chunk) continue;\n yield {\n start: chunk.start,\n data: (async () => this.readChunk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1
|
-
{"version":3,"file":"chunk-bpt1C6W4.mjs","sources":["../../src/adapters/file/base/chunk.ts"],"sourcesContent":["//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { FileStorageBase } from './base';\nimport { ProtoService } from '../../../server/proto';\nimport { asyncIterableToArray } from '@o2ter/utils-js';\n\nexport abstract class FileChunkStorageBase<File> extends FileStorageBase {\n\n abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n file: File;\n }>;\n\n abstract readChunk<E>(proto: ProtoService<E>, file: File): PromiseLike<Buffer>;\n\n async* readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number) {\n const streams = await asyncIterableToArray(this.listChunks(proto, token, start, end));\n const files = _.orderBy(streams, x => x.start);\n for (const [chunk, endBytes] of _.zip(files, _.slice(_.map(files, x => x.start), 1))) {\n if (_.isNumber(start) && _.isNumber(endBytes) && start >= endBytes) continue;\n if (_.isNumber(end) && end <= chunk!.start) continue;\n if (!chunk) continue;\n yield {\n start: chunk.start,\n data: (async () => this.readChunk(proto, chunk.file))(),\n };\n }\n }\n}"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOM,MAAgB,oBAA2B,SAAQ,eAAe,CAAA;IAStE,OAAO,UAAU,CAAI,KAAsB,EAAE,KAAa,EAAE,KAAc,EAAE,GAAY,EAAA;AACtF,QAAA,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACrF,QAAA,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;AAC9C,QAAA,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;AACpF,YAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,QAAQ;gBAAE;YACpE,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,KAAM,CAAC,KAAK;gBAAE;AAC5C,YAAA,IAAI,CAAC,KAAK;gBAAE;YACZ,MAAM;gBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,gBAAA,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG;aACxD
|
|
1
|
+
{"version":3,"file":"chunk-bpt1C6W4.mjs","sources":["../../src/adapters/file/base/chunk.ts"],"sourcesContent":["//\n// object.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nimport _ from 'lodash';\nimport { FileStorageBase } from './base';\nimport { ProtoService } from '../../../server/proto';\nimport { asyncIterableToArray } from '@o2ter/utils-js';\n\nexport abstract class FileChunkStorageBase<File> extends FileStorageBase {\n\n abstract listChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number): AsyncGenerator<{\n start: number;\n file: File;\n }>;\n\n abstract readChunk<E>(proto: ProtoService<E>, file: File): PromiseLike<Buffer>;\n\n async* readChunks<E>(proto: ProtoService<E>, token: string, start?: number, end?: number) {\n const streams = await asyncIterableToArray(this.listChunks(proto, token, start, end));\n const files = _.orderBy(streams, x => x.start);\n for (const [chunk, endBytes] of _.zip(files, _.slice(_.map(files, x => x.start), 1))) {\n if (_.isNumber(start) && _.isNumber(endBytes) && start >= endBytes) continue;\n if (_.isNumber(end) && end <= chunk!.start) continue;\n if (!chunk) continue;\n yield {\n start: chunk.start,\n data: (async () => this.readChunk(proto, chunk.file))(),\n };\n }\n }\n}"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOM,MAAgB,oBAA2B,SAAQ,eAAe,CAAA;IAStE,OAAO,UAAU,CAAI,KAAsB,EAAE,KAAa,EAAE,KAAc,EAAE,GAAY,EAAA;AACtF,QAAA,MAAM,OAAO,GAAG,MAAM,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AACrF,QAAA,MAAM,KAAK,GAAG,CAAC,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC;AAC9C,QAAA,KAAK,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;AACpF,YAAA,IAAI,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,KAAK,IAAI,QAAQ;gBAAE;YACpE,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,KAAM,CAAC,KAAK;gBAAE;AAC5C,YAAA,IAAI,CAAC,KAAK;gBAAE;YACZ,MAAM;gBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;AAClB,gBAAA,IAAI,EAAE,CAAC,YAAY,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,GAAG;aACxD;QACH;IACF;AACD;;;;"}
|
|
@@ -31,5 +31,5 @@ const PROTO_EVENT = 'PROTO_EVENT';
|
|
|
31
31
|
const PROTO_NOTY_MSG = 'PROTO_NOTY_MSG';
|
|
32
32
|
const PROTO_LIVEQUERY_MSG = 'PROTO_LIVEQUERY_MSG';
|
|
33
33
|
|
|
34
|
-
export { AUTH_ALT_COOKIE_KEY as A, MASTER_USER_HEADER_NAME as M, PROTO_NOTY_MSG as P, UPLOAD_TOKEN_HEADER_NAME as U, PROTO_LIVEQUERY_MSG as a,
|
|
35
|
-
//# sourceMappingURL=const-
|
|
34
|
+
export { AUTH_ALT_COOKIE_KEY as A, MASTER_USER_HEADER_NAME as M, PROTO_NOTY_MSG as P, UPLOAD_TOKEN_HEADER_NAME as U, PROTO_LIVEQUERY_MSG as a, AUTH_COOKIE_KEY as b, MASTER_PASS_HEADER_NAME as c, PROTO_EVENT as d };
|
|
35
|
+
//# sourceMappingURL=const-68KwNmag.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const-
|
|
1
|
+
{"version":3,"file":"const-68KwNmag.mjs","sources":["../../src/internals/const.ts"],"sourcesContent":["//\n// index.ts\n//\n// The MIT License\n// Copyright (c) 2021 - 2025 O2ter Limited. All rights reserved.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n//\n\nexport const MASTER_USER_HEADER_NAME = 'X-PROTO-MASTER-USER';\nexport const MASTER_PASS_HEADER_NAME = 'X-PROTO-MASTER-PASS';\n\nexport const UPLOAD_TOKEN_HEADER_NAME = 'X-PROTO-UPLOAD-TOKEN';\n\nexport const AUTH_COOKIE_KEY = 'x-proto-auth';\nexport const AUTH_ALT_COOKIE_KEY = 'x-proto-auth-key';\n\nexport const PROTO_EVENT = 'PROTO_EVENT';\nexport const PROTO_NOTY_MSG = 'PROTO_NOTY_MSG';\nexport const PROTO_LIVEQUERY_MSG = 'PROTO_LIVEQUERY_MSG';\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,uBAAuB,GAAG;AAChC,MAAM,uBAAuB,GAAG;AAEhC,MAAM,wBAAwB,GAAG;AAEjC,MAAM,eAAe,GAAG;AACxB,MAAM,mBAAmB,GAAG;AAE5B,MAAM,WAAW,GAAG;AACpB,MAAM,cAAc,GAAG;AACvB,MAAM,mBAAmB,GAAG;;;;"}
|
|
@@ -2042,7 +2042,7 @@ declare class ProtoService<Ext = any> extends ProtoType<Ext> {
|
|
|
2042
2042
|
scheduleJob(name: string, params?: TValueWithoutObject, options?: ExtraOptions<boolean>): Promise<TObjectType<"_Job", Ext>>;
|
|
2043
2043
|
defineJob<P extends TValueWithoutObject = any>(name: string, callback: ProtoJobFunction<Ext, P>, options?: Omit<ProtoJobFunctionOptions<Ext>, 'callback'>): void;
|
|
2044
2044
|
lockTable(className: string | string[], update: boolean): Promise<void>;
|
|
2045
|
-
withTransaction<T>(callback: (connection: ProtoService<Ext>) => PromiseLike<T>, options?: TransactionOptions):
|
|
2045
|
+
withTransaction<T>(callback: (connection: ProtoService<Ext>) => PromiseLike<T>, options?: TransactionOptions): Promise<T>;
|
|
2046
2046
|
generateUploadToken(options?: {
|
|
2047
2047
|
maxUploadSize?: number;
|
|
2048
2048
|
attributes?: Record<string, TValue>;
|
|
@@ -2060,5 +2060,6 @@ declare class ProtoService<Ext = any> extends ProtoType<Ext> {
|
|
|
2060
2060
|
gc(classNames?: string | string[]): Promise<void>;
|
|
2061
2061
|
}
|
|
2062
2062
|
|
|
2063
|
-
export {
|
|
2064
|
-
|
|
2063
|
+
export { FieldSelectorExpression as F, ProtoService as P, QueryExpression as Q, TSchema as T, deserialize as g, ProtoType as i, TQuery as j, TObject as k, TUser as n, serialize as s, QuerySelector as u, QueryAccumulator as y };
|
|
2064
|
+
export type { TransactionOptions as A, QueryRandomOptions as B, TPubSub as C, DeserializeOptions as D, ExtraOptions as E, TFileInfo as G, InsertOptions as I, RelationOptions as R, SerializeOptions as S, ProtoServiceOptions as a, ProtoServiceKeyOptions as b, TValueWithoutObject as c, TFileStorage as d, TNumber as e, TSerializable as f, TExtensions as h, PathName as l, TObjectType as m, EventData as o, TQuerySelector as p, TValueWithUndefined as q, TValue as r, TUpdateOp as t, DecodedQuery as v, FindOptions as w, DecodedSortOption as x, TStorage as z };
|
|
2065
|
+
//# sourceMappingURL=index-1ZK5N4yb.d.ts.map
|