spec-3nweb-server 1.8.5 → 1.8.7
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/.gitlab-ci-linux.yml +50 -0
- package/.gitlab-ci-mac.yml +29 -0
- package/.gitlab-ci-windows.yml +29 -0
- package/.gitlab-ci.yml +63 -0
- package/build/3nstorage/resources/store.d.ts +2 -2
- package/build/3nstorage/resources/store.js +1 -1
- package/build/3nstorage/resources/users.d.ts +3 -3
- package/build/3nstorage/resources/users.js +1 -1
- package/build/3nstorage/resources/utils.d.ts +6 -0
- package/build/3nstorage/resources/utils.js +41 -0
- package/build/3nstorage/routes/owner/archive-obj-version.js +8 -10
- package/build/3nstorage/routes/owner/cancel-trans.js +5 -4
- package/build/3nstorage/routes/owner/delete-obj.js +7 -8
- package/build/3nstorage/routes/owner/get-archived-obj-ver.js +11 -13
- package/build/3nstorage/routes/owner/get-current-obj.js +7 -6
- package/build/3nstorage/routes/owner/get-obj-status.js +8 -8
- package/build/3nstorage/routes/owner/put-current-obj.js +25 -55
- package/build/3nstorage/routes/owner/session-params.js +2 -0
- package/build/asmail/resources/utils.d.ts +6 -0
- package/build/asmail/resources/utils.js +36 -0
- package/build/asmail/routes/delivery/finalize-delivery.js +3 -2
- package/build/asmail/routes/delivery/pre-flight.js +9 -26
- package/build/asmail/routes/delivery/provide-recipient-pubkey.js +4 -3
- package/build/asmail/routes/delivery/put-metadata.js +13 -21
- package/build/asmail/routes/delivery/put-obj.js +19 -25
- package/build/asmail/routes/delivery/restart-session.d.ts +4 -8
- package/build/asmail/routes/delivery/restart-session.js +10 -23
- package/build/asmail/routes/delivery/sender-authorization.js +5 -5
- package/build/asmail/routes/delivery/start-session.js +9 -24
- package/build/asmail/routes/retrieval/get-message-meta.js +4 -7
- package/build/asmail/routes/retrieval/get-message-obj.js +10 -7
- package/build/asmail/routes/retrieval/list-messages.js +4 -4
- package/build/asmail/routes/retrieval/remove-message.js +3 -2
- package/build/mock/tls-options.js +46 -44
- package/build/tests/admin-proto/signup.d.ts +1 -0
- package/build/tests/admin-proto/signup.js +235 -0
- package/build/tests/jasmine.d.ts +1 -0
- package/build/tests/jasmine.js +32 -0
- package/build/tests/libs-for-tests/3nstorage.d.ts +22 -0
- package/build/tests/libs-for-tests/3nstorage.js +123 -0
- package/build/tests/libs-for-tests/asmail.d.ts +22 -0
- package/build/tests/libs-for-tests/asmail.js +179 -0
- package/build/tests/libs-for-tests/assert.d.ts +1 -0
- package/build/tests/libs-for-tests/assert.js +26 -0
- package/build/tests/libs-for-tests/async-jasmine.d.ts +7 -0
- package/build/tests/libs-for-tests/async-jasmine.js +77 -0
- package/build/tests/libs-for-tests/bytes-equal.d.ts +1 -0
- package/build/tests/libs-for-tests/bytes-equal.js +34 -0
- package/build/tests/libs-for-tests/json-copy.d.ts +1 -0
- package/build/tests/libs-for-tests/json-copy.js +45 -0
- package/build/tests/libs-for-tests/json-equal.d.ts +4 -0
- package/build/tests/libs-for-tests/json-equal.js +67 -0
- package/build/tests/libs-for-tests/mailerid.d.ts +13 -0
- package/build/tests/libs-for-tests/mailerid.js +114 -0
- package/build/tests/libs-for-tests/pkl.d.ts +28 -0
- package/build/tests/libs-for-tests/pkl.js +89 -0
- package/build/tests/libs-for-tests/server-components/3nstorage.d.ts +20 -0
- package/build/tests/libs-for-tests/server-components/3nstorage.js +200 -0
- package/build/tests/libs-for-tests/server-components/admin.d.ts +6 -0
- package/build/tests/libs-for-tests/server-components/admin.js +43 -0
- package/build/tests/libs-for-tests/server-components/asmail.d.ts +16 -0
- package/build/tests/libs-for-tests/server-components/asmail.js +143 -0
- package/build/tests/libs-for-tests/server-components/component.d.ts +13 -0
- package/build/tests/libs-for-tests/server-components/component.js +77 -0
- package/build/tests/libs-for-tests/server-components/mailerid.d.ts +10 -0
- package/build/tests/libs-for-tests/server-components/mailerid.js +103 -0
- package/build/tests/libs-for-tests/server-runner.d.ts +15 -0
- package/build/tests/libs-for-tests/server-runner.js +69 -0
- package/build/tests/libs-for-tests/spec-assembly.d.ts +6 -0
- package/build/tests/libs-for-tests/spec-assembly.js +55 -0
- package/build/tests/libs-for-tests/ws-utils.d.ts +3 -0
- package/build/tests/libs-for-tests/ws-utils.js +59 -0
- package/build/tests/libs-for-tests/xhr-utils.d.ts +61 -0
- package/build/tests/libs-for-tests/xhr-utils.js +154 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-obj-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-obj-ver.js +84 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-root-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/archive-root-ver.js +78 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-obj-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-obj-ver.js +83 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-root-ver.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-archive-root-ver.js +77 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-obj.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/delete-obj.js +75 -0
- package/build/tests/protocols/3nstorage/owner/specs/events.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/events.js +91 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-obj.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-obj.js +269 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-root.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-current-root.js +262 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-obj-status.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-obj-status.js +79 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-root-status.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/get-root-status.js +72 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-obj.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-obj.js +287 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-root.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/put-current-root.js +274 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel-root.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel-root.js +73 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel.d.ts +2 -0
- package/build/tests/protocols/3nstorage/owner/specs/trans-cancel.js +72 -0
- package/build/tests/protocols/3nstorage/owner/test-utils.d.ts +14 -0
- package/build/tests/protocols/3nstorage/owner/test-utils.js +54 -0
- package/build/tests/protocols/3nstorage/owner.d.ts +1 -0
- package/build/tests/protocols/3nstorage/owner.js +138 -0
- package/build/tests/protocols/asmail/config.d.ts +1 -0
- package/build/tests/protocols/asmail/config.js +117 -0
- package/build/tests/protocols/asmail/delivery/specs/finalize-delivery.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/finalize-delivery.js +60 -0
- package/build/tests/protocols/asmail/delivery/specs/provide-recipient-pubkey.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/provide-recipient-pubkey.js +68 -0
- package/build/tests/protocols/asmail/delivery/specs/put-metadata.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/put-metadata.js +83 -0
- package/build/tests/protocols/asmail/delivery/specs/put-obj.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/put-obj.js +123 -0
- package/build/tests/protocols/asmail/delivery/specs/restart-session.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/restart-session.js +79 -0
- package/build/tests/protocols/asmail/delivery/specs/start-session.d.ts +2 -0
- package/build/tests/protocols/asmail/delivery/specs/start-session.js +64 -0
- package/build/tests/protocols/asmail/delivery/test-utils.d.ts +16 -0
- package/build/tests/protocols/asmail/delivery/test-utils.js +46 -0
- package/build/tests/protocols/asmail/delivery.d.ts +1 -0
- package/build/tests/protocols/asmail/delivery.js +46 -0
- package/build/tests/protocols/asmail/retrieval/specs/events.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/events.js +62 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-meta.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-meta.js +70 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-obj.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/get-message-obj.js +166 -0
- package/build/tests/protocols/asmail/retrieval/specs/list-messages.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/list-messages.js +96 -0
- package/build/tests/protocols/asmail/retrieval/specs/remove-message.d.ts +2 -0
- package/build/tests/protocols/asmail/retrieval/specs/remove-message.js +66 -0
- package/build/tests/protocols/asmail/retrieval/test-utils.d.ts +17 -0
- package/build/tests/protocols/asmail/retrieval/test-utils.js +46 -0
- package/build/tests/protocols/asmail/retrieval.d.ts +1 -0
- package/build/tests/protocols/asmail/retrieval.js +92 -0
- package/build/tests/protocols/mailerid.d.ts +1 -0
- package/build/tests/protocols/mailerid.js +210 -0
- package/build/tests/shared-checks/check-mid-login.d.ts +2 -0
- package/build/tests/shared-checks/check-mid-login.js +131 -0
- package/build/tests/shared-checks/requests.d.ts +20 -0
- package/build/tests/shared-checks/requests.js +123 -0
- package/package.json +1 -1
- package/packing/create-deb.sh +57 -0
- package/packing/deb/lib/systemd/system/3nweb.service +11 -0
- package/packing/deb/postinst +44 -0
- package/packing/deb/usr/share/doc/3nweb-server/conf-for-postinstall.yaml +19 -0
- package/packing/deb/usr/share/doc/3nweb-server/copyright +22 -0
- package/publish-task.sh +10 -0
- package/push-to-github.sh +105 -0
- package/ts-code/3nstorage/3nstorage-app.ts +99 -0
- package/ts-code/3nstorage/owner.ts +178 -0
- package/ts-code/3nstorage/resources/sessions.ts +37 -0
- package/ts-code/3nstorage/resources/store.ts +896 -0
- package/ts-code/3nstorage/resources/users.ts +258 -0
- package/ts-code/3nstorage/resources/utils.ts +45 -0
- package/ts-code/3nstorage/routes/owner/archive-obj-version.ts +71 -0
- package/ts-code/3nstorage/routes/owner/cancel-trans.ts +60 -0
- package/ts-code/3nstorage/routes/owner/delete-obj.ts +99 -0
- package/ts-code/3nstorage/routes/owner/get-archived-obj-ver.ts +109 -0
- package/ts-code/3nstorage/routes/owner/get-current-obj.ts +124 -0
- package/ts-code/3nstorage/routes/owner/get-obj-status.ts +55 -0
- package/ts-code/3nstorage/routes/owner/param-getter.ts +51 -0
- package/ts-code/3nstorage/routes/owner/param-setter.ts +50 -0
- package/ts-code/3nstorage/routes/owner/put-current-obj.ts +257 -0
- package/ts-code/3nstorage/routes/owner/session-params.ts +50 -0
- package/ts-code/3nstorage/shared.ts +43 -0
- package/ts-code/asmail/asmail-app.ts +91 -0
- package/ts-code/asmail/config.ts +96 -0
- package/ts-code/asmail/delivery.ts +94 -0
- package/ts-code/asmail/resources/delivery-sessions.ts +118 -0
- package/ts-code/asmail/resources/inbox.ts +696 -0
- package/ts-code/asmail/resources/recipients.ts +495 -0
- package/ts-code/asmail/resources/sessions.ts +37 -0
- package/ts-code/asmail/resources/utils.ts +41 -0
- package/ts-code/asmail/retrieval.ts +96 -0
- package/ts-code/asmail/routes/config/param-getter.ts +49 -0
- package/ts-code/asmail/routes/config/param-setter.ts +49 -0
- package/ts-code/asmail/routes/delivery/finalize-delivery.ts +51 -0
- package/ts-code/asmail/routes/delivery/pre-flight.ts +118 -0
- package/ts-code/asmail/routes/delivery/provide-recipient-pubkey.ts +58 -0
- package/ts-code/asmail/routes/delivery/put-metadata.ts +85 -0
- package/ts-code/asmail/routes/delivery/put-obj.ts +152 -0
- package/ts-code/asmail/routes/delivery/restart-session.ts +117 -0
- package/ts-code/asmail/routes/delivery/sender-authorization.ts +81 -0
- package/ts-code/asmail/routes/delivery/start-session.ts +136 -0
- package/ts-code/asmail/routes/retrieval/get-message-meta.ts +50 -0
- package/ts-code/asmail/routes/retrieval/get-message-obj.ts +106 -0
- package/ts-code/asmail/routes/retrieval/list-messages.ts +68 -0
- package/ts-code/asmail/routes/retrieval/remove-message.ts +48 -0
- package/ts-code/cli/index.ts +82 -0
- package/ts-code/cli/run-cmd.ts +81 -0
- package/ts-code/cli/show-sample-config.ts +78 -0
- package/ts-code/cli/signup-cmd.ts +229 -0
- package/ts-code/cli/user-cmd.ts +68 -0
- package/ts-code/cli/utils.ts +105 -0
- package/ts-code/config/default-confs.ts +22 -0
- package/ts-code/config/from-yaml.ts +35 -0
- package/ts-code/config/letsencrypt.ts +77 -0
- package/ts-code/config/signup.ts +137 -0
- package/ts-code/lib-common/admin-api/signup.ts +120 -0
- package/ts-code/lib-common/assert.ts +22 -0
- package/ts-code/lib-common/async-fs-node.ts +656 -0
- package/ts-code/lib-common/buffer-utils.ts +124 -0
- package/ts-code/lib-common/byte-streaming/common.ts +166 -0
- package/ts-code/lib-common/bytes-equal.ts +25 -0
- package/ts-code/lib-common/canonical-address.ts +92 -0
- package/ts-code/lib-common/exceptions/error.ts +44 -0
- package/ts-code/lib-common/exceptions/file.ts +84 -0
- package/ts-code/lib-common/exceptions/http.ts +69 -0
- package/ts-code/lib-common/ipc/generic-ipc.ts +750 -0
- package/ts-code/lib-common/ipc/ws-ipc.ts +117 -0
- package/ts-code/lib-common/json-equal.ts +55 -0
- package/ts-code/lib-common/json-utils.ts +130 -0
- package/ts-code/lib-common/jwkeys.ts +246 -0
- package/ts-code/lib-common/map-of-sets.ts +60 -0
- package/ts-code/lib-common/mid-sigs-NaCl-Ed.ts +677 -0
- package/ts-code/lib-common/objs-on-disk/file-layout.ts +480 -0
- package/ts-code/lib-common/objs-on-disk/obj-file.ts +325 -0
- package/ts-code/lib-common/objs-on-disk/utils.ts +201 -0
- package/ts-code/lib-common/objs-on-disk/v1-obj-file-format.ts +329 -0
- package/ts-code/lib-common/processes.ts +501 -0
- package/ts-code/lib-common/random-node.ts +79 -0
- package/ts-code/lib-common/service-api/3nstorage/owner.ts +559 -0
- package/ts-code/lib-common/service-api/3nstorage/root-route.ts +22 -0
- package/ts-code/lib-common/service-api/asmail/config.ts +144 -0
- package/ts-code/lib-common/service-api/asmail/delivery.ts +250 -0
- package/ts-code/lib-common/service-api/asmail/retrieval.ts +238 -0
- package/ts-code/lib-common/service-api/asmail/root-route.ts +22 -0
- package/ts-code/lib-common/service-api/ipc-api.ts +44 -0
- package/ts-code/lib-common/service-api/locker.ts +44 -0
- package/ts-code/lib-common/service-api/mailer-id/login.ts +80 -0
- package/ts-code/lib-common/service-api/mailer-id/provisioning.ts +64 -0
- package/ts-code/lib-common/service-api/mailer-id/root-route.ts +25 -0
- package/ts-code/lib-common/service-api/pub-key-login.ts +75 -0
- package/ts-code/lib-common/service-api/web-socket-base.ts +87 -0
- package/ts-code/lib-common/session-encryptor.ts +54 -0
- package/ts-code/lib-common/time-window-cache.ts +74 -0
- package/ts-code/lib-common/transferable.d.ts +30 -0
- package/ts-code/lib-server/conf-util.ts +35 -0
- package/ts-code/lib-server/mid-access.ts +45 -0
- package/ts-code/lib-server/middleware/body-parsers.ts +248 -0
- package/ts-code/lib-server/middleware/error-handler.ts +79 -0
- package/ts-code/lib-server/pkl-access.ts +46 -0
- package/ts-code/lib-server/resources/dns.ts +151 -0
- package/ts-code/lib-server/resources/mailerid-authorizer.ts +115 -0
- package/ts-code/lib-server/resources/mem-backed-sessions-factory.ts +132 -0
- package/ts-code/lib-server/resources/server-data-folders.ts +160 -0
- package/ts-code/lib-server/resources/server-key-for-pkl-challenge.ts +41 -0
- package/ts-code/lib-server/resources/sessions.ts +232 -0
- package/ts-code/lib-server/resources/user-files.ts +147 -0
- package/ts-code/lib-server/routes/pub-key-login/complete-exchange.ts +63 -0
- package/ts-code/lib-server/routes/pub-key-login/start-exchange.ts +189 -0
- package/ts-code/lib-server/routes/sessions/close.ts +27 -0
- package/ts-code/lib-server/routes/sessions/mid-auth.ts +77 -0
- package/ts-code/lib-server/routes/sessions/start.ts +116 -0
- package/ts-code/lib-server/web-sockets/app.ts +339 -0
- package/ts-code/lib-server/web-sockets/server-events.ts +63 -0
- package/ts-code/lib.ts +29 -0
- package/ts-code/locker/locker-app.ts +60 -0
- package/ts-code/locker/resources/lockers.ts +17 -0
- package/ts-code/locker/resources/sessions.ts +37 -0
- package/ts-code/locker/routes/create-locker.ts +47 -0
- package/ts-code/mailerId/mailerId-app.ts +107 -0
- package/ts-code/mailerId/resources/certifier.ts +181 -0
- package/ts-code/mailerId/resources/sessions.ts +44 -0
- package/ts-code/mailerId/resources/users.ts +88 -0
- package/ts-code/mailerId/routes/certify.ts +68 -0
- package/ts-code/main.ts +304 -0
- package/ts-code/mock/dns.ts +106 -0
- package/ts-code/mock/mock-as-child-proc.ts +130 -0
- package/ts-code/mock/node-child-ipc.ts +69 -0
- package/ts-code/mock/run-in-proc.ts +111 -0
- package/ts-code/mock/tls-options.ts +73 -0
- package/ts-code/services.ts +138 -0
- package/ts-code/signup/resources/users.ts +429 -0
- package/ts-code/signup/routes/add.ts +65 -0
- package/ts-code/signup/routes/get-available-addresses.ts +49 -0
- package/ts-code/signup/routes/get-available-domains.ts +45 -0
- package/ts-code/signup/signup-app.ts +54 -0
- package/ts-code/signup/signup-tokens.ts +148 -0
- package/ts-code/tests/admin-proto/signup.ts +277 -0
- package/ts-code/tests/jasmine.ts +37 -0
- package/ts-code/tests/libs-for-tests/3nstorage.ts +144 -0
- package/ts-code/tests/libs-for-tests/asmail.ts +220 -0
- package/ts-code/tests/libs-for-tests/assert.ts +22 -0
- package/ts-code/tests/libs-for-tests/async-jasmine.ts +89 -0
- package/ts-code/tests/libs-for-tests/bytes-equal.ts +25 -0
- package/ts-code/tests/libs-for-tests/json-copy.ts +38 -0
- package/ts-code/tests/libs-for-tests/json-equal.ts +55 -0
- package/ts-code/tests/libs-for-tests/mailerid.ts +123 -0
- package/ts-code/tests/libs-for-tests/pkl.ts +127 -0
- package/ts-code/tests/libs-for-tests/server-components/3nstorage.ts +206 -0
- package/ts-code/tests/libs-for-tests/server-components/admin.ts +49 -0
- package/ts-code/tests/libs-for-tests/server-components/asmail.ts +152 -0
- package/ts-code/tests/libs-for-tests/server-components/component.ts +90 -0
- package/ts-code/tests/libs-for-tests/server-components/mailerid.ts +114 -0
- package/ts-code/tests/libs-for-tests/server-runner.ts +82 -0
- package/ts-code/tests/libs-for-tests/spec-assembly.ts +60 -0
- package/ts-code/tests/libs-for-tests/ws-utils.ts +61 -0
- package/ts-code/tests/libs-for-tests/xhr-utils.ts +179 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/archive-obj-ver.ts +100 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/archive-root-ver.ts +91 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/delete-archive-obj-ver.ts +99 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/delete-archive-root-ver.ts +90 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/delete-obj.ts +84 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/events.ts +125 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-current-obj.ts +298 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-current-root.ts +290 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-obj-status.ts +88 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/get-root-status.ts +80 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/put-current-obj.ts +366 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/put-current-root.ts +329 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/trans-cancel-root.ts +86 -0
- package/ts-code/tests/protocols/3nstorage/owner/specs/trans-cancel.ts +86 -0
- package/ts-code/tests/protocols/3nstorage/owner/test-utils.ts +72 -0
- package/ts-code/tests/protocols/3nstorage/owner.ts +198 -0
- package/ts-code/tests/protocols/asmail/config.ts +172 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/finalize-delivery.ts +69 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/provide-recipient-pubkey.ts +88 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/put-metadata.ts +102 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/put-obj.ts +156 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/restart-session.ts +97 -0
- package/ts-code/tests/protocols/asmail/delivery/specs/start-session.ts +79 -0
- package/ts-code/tests/protocols/asmail/delivery/test-utils.ts +64 -0
- package/ts-code/tests/protocols/asmail/delivery.ts +56 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/events.ts +78 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/get-message-meta.ts +80 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/get-message-obj.ts +197 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/list-messages.ts +110 -0
- package/ts-code/tests/protocols/asmail/retrieval/specs/remove-message.ts +74 -0
- package/ts-code/tests/protocols/asmail/retrieval/test-utils.ts +60 -0
- package/ts-code/tests/protocols/asmail/retrieval.ts +115 -0
- package/ts-code/tests/protocols/mailerid.ts +271 -0
- package/ts-code/tests/shared-checks/check-mid-login.ts +164 -0
- package/ts-code/tests/shared-checks/requests.ts +135 -0
- package/ts-code/tsconfig.json +11 -0
- package/ts-code/web3n.d.ts +1068 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
|
|
2
|
+
#########
|
|
3
|
+
# Linux #
|
|
4
|
+
#########
|
|
5
|
+
|
|
6
|
+
build for linux:
|
|
7
|
+
extends: build
|
|
8
|
+
rules: [ { when: on_success } ]
|
|
9
|
+
image: node-22
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
test on linux:
|
|
13
|
+
extends: test
|
|
14
|
+
rules: [ { when: on_success } ]
|
|
15
|
+
needs:
|
|
16
|
+
- build for linux
|
|
17
|
+
image: node-22
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
pack for linux:
|
|
21
|
+
extends: pack
|
|
22
|
+
rules: [ { when: on_success } ]
|
|
23
|
+
needs:
|
|
24
|
+
- build for linux
|
|
25
|
+
- test on linux
|
|
26
|
+
image: node-22
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
pack mock for linux:
|
|
30
|
+
extends: pack mock
|
|
31
|
+
rules: [ { when: on_success } ]
|
|
32
|
+
needs:
|
|
33
|
+
- build for linux
|
|
34
|
+
- test on linux
|
|
35
|
+
image: node-22
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# pack deb:
|
|
39
|
+
# extends: pack
|
|
40
|
+
# rules: [ { when: on_success } ]
|
|
41
|
+
# needs:
|
|
42
|
+
# - build for linux
|
|
43
|
+
# - test on linux
|
|
44
|
+
# image: node-16
|
|
45
|
+
# script:
|
|
46
|
+
# - npm run pack-deb
|
|
47
|
+
# artifacts:
|
|
48
|
+
# paths:
|
|
49
|
+
# - 3nweb-*.deb
|
|
50
|
+
# expire_in: 3d
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
#########
|
|
3
|
+
# MacOS #
|
|
4
|
+
#########
|
|
5
|
+
|
|
6
|
+
build for mac:
|
|
7
|
+
extends: build
|
|
8
|
+
rules: [ { when: on_success } ]
|
|
9
|
+
tags:
|
|
10
|
+
- mac-m1
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
test on mac:
|
|
14
|
+
extends: test
|
|
15
|
+
rules: [ { when: on_success } ]
|
|
16
|
+
needs:
|
|
17
|
+
- build for mac
|
|
18
|
+
tags:
|
|
19
|
+
- mac-m1
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
pack mock for mac:
|
|
23
|
+
extends: pack mock
|
|
24
|
+
rules: [ { when: on_success } ]
|
|
25
|
+
tags:
|
|
26
|
+
- mac-m1
|
|
27
|
+
needs:
|
|
28
|
+
- build for mac
|
|
29
|
+
- test on mac
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
###########
|
|
3
|
+
# Windows #
|
|
4
|
+
###########
|
|
5
|
+
|
|
6
|
+
build for windows:
|
|
7
|
+
extends: build
|
|
8
|
+
rules: [ { when: on_success } ]
|
|
9
|
+
tags:
|
|
10
|
+
- windows
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
test on windows:
|
|
14
|
+
extends: test
|
|
15
|
+
rules: [ { when: on_success } ]
|
|
16
|
+
needs:
|
|
17
|
+
- build for windows
|
|
18
|
+
tags:
|
|
19
|
+
- windows
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
pack mock for windows:
|
|
23
|
+
extends: pack mock
|
|
24
|
+
rules: [ { when: on_success } ]
|
|
25
|
+
tags:
|
|
26
|
+
- windows
|
|
27
|
+
needs:
|
|
28
|
+
- build for windows
|
|
29
|
+
- test on windows
|
package/.gitlab-ci.yml
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
stages:
|
|
2
|
+
- build
|
|
3
|
+
- test
|
|
4
|
+
- pack
|
|
5
|
+
- publish
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
build:
|
|
9
|
+
rules: [ { when: never } ]
|
|
10
|
+
stage: build
|
|
11
|
+
script:
|
|
12
|
+
- npm ci
|
|
13
|
+
- npm run build
|
|
14
|
+
artifacts:
|
|
15
|
+
paths:
|
|
16
|
+
- node_modules/
|
|
17
|
+
- build/
|
|
18
|
+
expire_in: 1h
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
test:
|
|
22
|
+
rules: [ { when: never } ]
|
|
23
|
+
stage: test
|
|
24
|
+
script:
|
|
25
|
+
- npm run test
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
pack:
|
|
29
|
+
rules: [ { when: never } ]
|
|
30
|
+
stage: pack
|
|
31
|
+
script:
|
|
32
|
+
- npm run clear-for-packing
|
|
33
|
+
artifacts:
|
|
34
|
+
paths:
|
|
35
|
+
- build/
|
|
36
|
+
- node_modules/
|
|
37
|
+
- LICENSE
|
|
38
|
+
- package-lock.json
|
|
39
|
+
- package.json
|
|
40
|
+
- README.md
|
|
41
|
+
expire_in: 3d
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
pack mock:
|
|
45
|
+
extends: pack
|
|
46
|
+
script:
|
|
47
|
+
- npm run clear-for-packing-mock
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
publish to npm:
|
|
51
|
+
stage: publish
|
|
52
|
+
rules:
|
|
53
|
+
- if: '$CI_COMMIT_BRANCH == "master"'
|
|
54
|
+
when: manual
|
|
55
|
+
image: node-22
|
|
56
|
+
script:
|
|
57
|
+
- bash publish-task.sh $NPM_PUBLISH_TOKEN
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
include:
|
|
61
|
+
- .gitlab-ci-linux.yml
|
|
62
|
+
- .gitlab-ci-windows.yml
|
|
63
|
+
- .gitlab-ci-mac.yml
|
|
@@ -113,7 +113,7 @@ export declare class Store extends UserFiles<StorageParams> {
|
|
|
113
113
|
* @return a promise, resolvable when version files are removed.
|
|
114
114
|
*/
|
|
115
115
|
private rmObjFiles;
|
|
116
|
-
archiveCurrentObjVersion(objId: string, version: number): Promise<void>;
|
|
117
|
-
getObjStatus(objId: string): Promise<ObjStatus>;
|
|
116
|
+
archiveCurrentObjVersion(objId: string | null, version: number): Promise<void>;
|
|
117
|
+
getObjStatus(objId: string | null): Promise<ObjStatus>;
|
|
118
118
|
setKeyDerivParams(params: any, setDefault: boolean): Promise<boolean>;
|
|
119
119
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2019 - 2020, 2022, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2019 - 2020, 2022, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -15,9 +15,9 @@ export type GetCurrentObj = (userId: string, objId: string | null, header: boole
|
|
|
15
15
|
}>;
|
|
16
16
|
export type SaveNewObjVersion = (userId: string, objId: string | null, fstReq: PutObjFirstQueryOpts | undefined, diff: DiffInfo | undefined, sndReq: PutObjSecondQueryOpts | undefined, bytesLen: number, bytes: ReadableStream) => Promise<string | undefined>;
|
|
17
17
|
export type GetArchivedObjVersion = (userId: string, objId: string | null, version: number, header: boolean, segsOffset: number, segsLimit: number | undefined) => Promise<ObjReader>;
|
|
18
|
-
export type CancelTransaction = (userId: string, objId: string, transactionId?: string) => Promise<void>;
|
|
19
|
-
export type ArchiveObjCurrentVersion = (userId: string, objId: string, version: number) => Promise<void>;
|
|
20
|
-
export type GetObjStatus = (userId: string, objId: string) => Promise<ObjStatus>;
|
|
18
|
+
export type CancelTransaction = (userId: string, objId: string | null, transactionId?: string) => Promise<void>;
|
|
19
|
+
export type ArchiveObjCurrentVersion = (userId: string, objId: string | null, version: number) => Promise<void>;
|
|
20
|
+
export type GetObjStatus = (userId: string, objId: string | null) => Promise<ObjStatus>;
|
|
21
21
|
export type DeleteCurrentObjVersion = (userId: string, objId: string, version?: number) => Promise<void>;
|
|
22
22
|
export type DeleteArchivedObjVersion = (userId: string, objId: string | null, version: number) => Promise<void>;
|
|
23
23
|
export type GetSpaceQuota = (userId: string) => Promise<number>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2015 - 2017, 2020, 2025 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2015 - 2017, 2020, 2025 - 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Response, Request } from 'express';
|
|
2
|
+
export declare function getObjIdFromParams(rootObj: boolean, req: Request): {
|
|
3
|
+
objId: string | null;
|
|
4
|
+
objIdParseErr?: string;
|
|
5
|
+
};
|
|
6
|
+
export declare function replyWithErr(status: number, msg: string, res: Response, reqToDrainBytesFrom?: Request): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2026 3NSoft Inc.
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
7
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
8
|
+
version.
|
|
9
|
+
|
|
10
|
+
This program is distributed in the hope that it will be useful, but
|
|
11
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
13
|
+
See the GNU General Public License for more details.
|
|
14
|
+
|
|
15
|
+
You should have received a copy of the GNU General Public License along with
|
|
16
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.replyWithErr = exports.getObjIdFromParams = void 0;
|
|
20
|
+
const buffer_utils_1 = require("../../lib-common/buffer-utils");
|
|
21
|
+
const body_parsers_1 = require("../../lib-server/middleware/body-parsers");
|
|
22
|
+
function getObjIdFromParams(rootObj, req) {
|
|
23
|
+
if (rootObj) {
|
|
24
|
+
return { objId: null };
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
const objId = req.params.objId;
|
|
28
|
+
return ((!!objId && buffer_utils_1.base64urlSafe.allCharsFromAlphabet(objId)) ?
|
|
29
|
+
{ objId } :
|
|
30
|
+
{ objId: undefined, objIdParseErr: "Bad object id" });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.getObjIdFromParams = getObjIdFromParams;
|
|
34
|
+
function replyWithErr(status, msg, res, reqToDrainBytesFrom) {
|
|
35
|
+
if (reqToDrainBytesFrom) {
|
|
36
|
+
(0, body_parsers_1.attachByteDrainToRequest)(reqToDrainBytesFrom);
|
|
37
|
+
}
|
|
38
|
+
res.status(status).json({ error: msg });
|
|
39
|
+
}
|
|
40
|
+
exports.replyWithErr = replyWithErr;
|
|
41
|
+
Object.freeze(exports);
|
|
@@ -19,18 +19,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.archiveCurrentObjVersion = void 0;
|
|
20
20
|
const users_1 = require("../../resources/users");
|
|
21
21
|
const owner_1 = require("../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const utils_1 = require("../../resources/utils");
|
|
22
23
|
const SC = owner_1.archiveObj.SC;
|
|
23
24
|
function archiveCurrentObjVersion(root, archiveObjVerFunc) {
|
|
24
|
-
if ('function' !== typeof archiveObjVerFunc) {
|
|
25
|
-
throw new TypeError("Given argument 'archiveObjVerFunc' must be function, but is not.");
|
|
26
|
-
}
|
|
27
25
|
return async (req, res, next) => {
|
|
28
26
|
const userId = req.session.params.userId;
|
|
29
|
-
const objId = (root
|
|
27
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(root, req);
|
|
28
|
+
if (objIdParseErr) {
|
|
29
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, objIdParseErr, res);
|
|
30
|
+
}
|
|
30
31
|
const version = parseInt(req.query.ver);
|
|
31
32
|
if (isNaN(version) || (version < 1)) {
|
|
32
|
-
|
|
33
|
-
return;
|
|
33
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, "Bad query parameters", res);
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
36
|
await archiveObjVerFunc(userId, objId, version);
|
|
@@ -51,12 +51,10 @@ function archiveCurrentObjVersion(root, archiveObjVerFunc) {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
else if (err === users_1.SC.OBJ_UNKNOWN) {
|
|
54
|
-
|
|
55
|
-
`Root object is not set.` :
|
|
56
|
-
`Object ${objId} is unknown.`);
|
|
54
|
+
(0, utils_1.replyWithErr)(SC.unknownObj, (root ? `Root object is not set.` : `Object ${objId} is unknown.`), res);
|
|
57
55
|
}
|
|
58
56
|
else if (err === users_1.SC.USER_UNKNOWN) {
|
|
59
|
-
|
|
57
|
+
(0, utils_1.replyWithErr)(owner_1.ERR_SC.server, "Recipient disappeared from the system.", res);
|
|
60
58
|
req.session.close();
|
|
61
59
|
}
|
|
62
60
|
else {
|
|
@@ -19,13 +19,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.cancelTransaction = void 0;
|
|
20
20
|
const users_1 = require("../../resources/users");
|
|
21
21
|
const owner_1 = require("../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const utils_1 = require("../../resources/utils");
|
|
22
23
|
function cancelTransaction(root, cancelTransFunc) {
|
|
23
|
-
if ('function' !== typeof cancelTransFunc) {
|
|
24
|
-
throw new TypeError("Given argument 'cancelTransFunc' must be function, but is not.");
|
|
25
|
-
}
|
|
26
24
|
return async (req, res, next) => {
|
|
27
25
|
const userId = req.session.params.userId;
|
|
28
|
-
const objId = (root
|
|
26
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(root, req);
|
|
27
|
+
if (objIdParseErr) {
|
|
28
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, objIdParseErr, res);
|
|
29
|
+
}
|
|
29
30
|
const transactionId = req.params.transactionId;
|
|
30
31
|
try {
|
|
31
32
|
await cancelTransFunc(userId, objId, ((transactionId === '-') ? undefined : transactionId));
|
|
@@ -20,16 +20,17 @@ exports.deleteArchivedObjVer = exports.deleteCurrentObjVer = void 0;
|
|
|
20
20
|
const users_1 = require("../../resources/users");
|
|
21
21
|
const owner_1 = require("../../../lib-common/service-api/3nstorage/owner");
|
|
22
22
|
const assert_1 = require("../../../lib-common/assert");
|
|
23
|
+
const utils_1 = require("../../resources/utils");
|
|
23
24
|
function deleteObj(root, delCurrent, deleteObjFunc) {
|
|
24
|
-
if ('function' !== typeof deleteObjFunc) {
|
|
25
|
-
throw new TypeError("Given argument 'deleteObjFunc' must be function, but is not.");
|
|
26
|
-
}
|
|
27
25
|
if (delCurrent) {
|
|
28
26
|
(0, assert_1.assert)(!root);
|
|
29
27
|
}
|
|
30
28
|
return async (req, res, next) => {
|
|
31
29
|
const userId = req.session.params.userId;
|
|
32
|
-
const objId = (root
|
|
30
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(root, req);
|
|
31
|
+
if (objIdParseErr) {
|
|
32
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, objIdParseErr, res);
|
|
33
|
+
}
|
|
33
34
|
const ver = parseInt(req.query.ver);
|
|
34
35
|
let version;
|
|
35
36
|
if (isNaN(ver)) {
|
|
@@ -37,14 +38,12 @@ function deleteObj(root, delCurrent, deleteObjFunc) {
|
|
|
37
38
|
version = undefined;
|
|
38
39
|
}
|
|
39
40
|
else {
|
|
40
|
-
|
|
41
|
-
return;
|
|
41
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, "Bad query parameters", res);
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
else {
|
|
45
45
|
if (ver < 1) {
|
|
46
|
-
|
|
47
|
-
return;
|
|
46
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, "Bad query parameters", res);
|
|
48
47
|
}
|
|
49
48
|
version = ver;
|
|
50
49
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2017, 2020 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2017, 2020, 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -21,6 +21,7 @@ const users_1 = require("../../resources/users");
|
|
|
21
21
|
const owner_1 = require("../../../lib-common/service-api/3nstorage/owner");
|
|
22
22
|
const error_1 = require("../../../lib-common/exceptions/error");
|
|
23
23
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
24
|
+
const utils_1 = require("../../resources/utils");
|
|
24
25
|
function extractQueryOptions(req) {
|
|
25
26
|
// query fields are string or undefined, yet, type info helps the show
|
|
26
27
|
const query = req.query;
|
|
@@ -46,16 +47,15 @@ function extractQueryOptions(req) {
|
|
|
46
47
|
return { header, limit, ofs, ver };
|
|
47
48
|
}
|
|
48
49
|
function getArchivedObjVersion(root, getArchivedObjFunc) {
|
|
49
|
-
if ('function' !== typeof getArchivedObjFunc) {
|
|
50
|
-
throw new TypeError("Given argument 'getArchivedObjFunc' must be function, but is not.");
|
|
51
|
-
}
|
|
52
50
|
return async (req, res, next) => {
|
|
53
51
|
const userId = req.session.params.userId;
|
|
54
|
-
const objId = (root
|
|
52
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(root, req);
|
|
53
|
+
if (objIdParseErr) {
|
|
54
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, objIdParseErr, res);
|
|
55
|
+
}
|
|
55
56
|
const opts = extractQueryOptions(req);
|
|
56
57
|
if (!opts) {
|
|
57
|
-
|
|
58
|
-
return;
|
|
58
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, "Bad query parameters", res);
|
|
59
59
|
}
|
|
60
60
|
try {
|
|
61
61
|
const reader = await getArchivedObjFunc(userId, objId, opts.ver, opts.header, opts.ofs, opts.limit);
|
|
@@ -86,16 +86,14 @@ function getArchivedObjVersion(root, getArchivedObjFunc) {
|
|
|
86
86
|
next(err);
|
|
87
87
|
}
|
|
88
88
|
else if (err === users_1.SC.OBJ_UNKNOWN) {
|
|
89
|
-
|
|
90
|
-
`Object ${objId}is unknown.` : `Root object is not set`);
|
|
89
|
+
(0, utils_1.replyWithErr)(owner_1.archivedObjVersion.SC.unknownObj, (objId ? `Object ${objId}is unknown.` : `Root object is not set`), res);
|
|
91
90
|
}
|
|
92
91
|
else if (err === users_1.SC.OBJ_VER_UNKNOWN) {
|
|
93
|
-
|
|
94
|
-
`Object ${objId}, version ${opts.ver} is unknown.` :
|
|
95
|
-
`Root object version ${opts.ver} is not known.`);
|
|
92
|
+
(0, utils_1.replyWithErr)(owner_1.archivedObjVersion.SC.unknownObjVer, (objId ?
|
|
93
|
+
`Object ${objId}, version ${opts.ver} is unknown.` : `Root object version ${opts.ver} is not known.`), res);
|
|
96
94
|
}
|
|
97
95
|
else if (err === users_1.SC.USER_UNKNOWN) {
|
|
98
|
-
|
|
96
|
+
(0, utils_1.replyWithErr)(owner_1.ERR_SC.server, `Recipient disappeared from the system.`, res);
|
|
99
97
|
req.session.close();
|
|
100
98
|
}
|
|
101
99
|
else {
|
|
@@ -21,6 +21,7 @@ const users_1 = require("../../resources/users");
|
|
|
21
21
|
const owner_1 = require("../../../lib-common/service-api/3nstorage/owner");
|
|
22
22
|
const error_1 = require("../../../lib-common/exceptions/error");
|
|
23
23
|
const buffer_utils_1 = require("../../../lib-common/buffer-utils");
|
|
24
|
+
const utils_1 = require("../../resources/utils");
|
|
24
25
|
function extractQueryOptions(req) {
|
|
25
26
|
// query fields are string or undefined, yet, type info helps the show
|
|
26
27
|
const query = req.query;
|
|
@@ -51,12 +52,12 @@ function extractQueryOptions(req) {
|
|
|
51
52
|
return { header, limit, ofs, ver };
|
|
52
53
|
}
|
|
53
54
|
function getCurrentObj(root, getCurrentObjFunc) {
|
|
54
|
-
if ('function' !== typeof getCurrentObjFunc) {
|
|
55
|
-
throw new TypeError("Given argument 'getCurrentObjFunc' must be function, but is not.");
|
|
56
|
-
}
|
|
57
55
|
return async (req, res, next) => {
|
|
58
56
|
const userId = req.session.params.userId;
|
|
59
|
-
const objId = (root
|
|
57
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(root, req);
|
|
58
|
+
if (objIdParseErr) {
|
|
59
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, objIdParseErr, res);
|
|
60
|
+
}
|
|
60
61
|
const opts = extractQueryOptions(req);
|
|
61
62
|
if (!opts) {
|
|
62
63
|
res.status(owner_1.ERR_SC.malformed).send("Bad query parameters");
|
|
@@ -102,10 +103,10 @@ function getCurrentObj(root, getCurrentObjFunc) {
|
|
|
102
103
|
}
|
|
103
104
|
else if ((err === users_1.SC.OBJ_UNKNOWN)
|
|
104
105
|
|| (err === users_1.SC.OBJ_VER_UNKNOWN)) {
|
|
105
|
-
|
|
106
|
+
(0, utils_1.replyWithErr)(owner_1.currentObj.SC.unknownObj, (objId ? `Object ${objId} is unknown.` : `Root object is not set.`), res);
|
|
106
107
|
}
|
|
107
108
|
else if (err === users_1.SC.USER_UNKNOWN) {
|
|
108
|
-
|
|
109
|
+
(0, utils_1.replyWithErr)(owner_1.ERR_SC.server, `Recipient disappeared from the system.`, res);
|
|
109
110
|
req.session.close();
|
|
110
111
|
}
|
|
111
112
|
else {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*
|
|
3
|
-
Copyright (C) 2022 3NSoft Inc.
|
|
3
|
+
Copyright (C) 2022, 2026 3NSoft Inc.
|
|
4
4
|
|
|
5
5
|
This program is free software: you can redistribute it and/or modify it under
|
|
6
6
|
the terms of the GNU General Public License as published by the Free Software
|
|
@@ -19,13 +19,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.getObjStatus = void 0;
|
|
20
20
|
const users_1 = require("../../resources/users");
|
|
21
21
|
const owner_1 = require("../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const utils_1 = require("../../resources/utils");
|
|
22
23
|
function getObjStatus(root, getObjStatusFunc) {
|
|
23
|
-
if ('function' !== typeof getObjStatusFunc) {
|
|
24
|
-
throw new TypeError("Given argument 'getObjStatusFunc' must be function, but is not.");
|
|
25
|
-
}
|
|
26
24
|
return async (req, res, next) => {
|
|
27
25
|
const userId = req.session.params.userId;
|
|
28
|
-
const objId = (root
|
|
26
|
+
const { objId, objIdParseErr } = (0, utils_1.getObjIdFromParams)(root, req);
|
|
27
|
+
if (objIdParseErr) {
|
|
28
|
+
return (0, utils_1.replyWithErr)(owner_1.ERR_SC.malformed, objIdParseErr, res);
|
|
29
|
+
}
|
|
29
30
|
try {
|
|
30
31
|
const lst = await getObjStatusFunc(userId, objId);
|
|
31
32
|
res.status(owner_1.objStatus.SC.ok).json(lst);
|
|
@@ -35,11 +36,10 @@ function getObjStatus(root, getObjStatusFunc) {
|
|
|
35
36
|
next(err);
|
|
36
37
|
}
|
|
37
38
|
else if (err === users_1.SC.OBJ_UNKNOWN) {
|
|
38
|
-
|
|
39
|
-
`Root object is set.` : `Object ${objId} is unknown.`);
|
|
39
|
+
(0, utils_1.replyWithErr)(owner_1.objStatus.SC.unknownObj, (root ? `Root object is set.` : `Object ${objId} is unknown.`), res);
|
|
40
40
|
}
|
|
41
41
|
else if (err === users_1.SC.USER_UNKNOWN) {
|
|
42
|
-
|
|
42
|
+
(0, utils_1.replyWithErr)(owner_1.ERR_SC.server, "Recipient disappeared from the system.", res);
|
|
43
43
|
req.session.close();
|
|
44
44
|
}
|
|
45
45
|
else {
|