spec-3nweb-server 1.8.4 → 1.8.6
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/routes/owner/archive-obj-version.js +2 -2
- package/build/3nstorage/routes/owner/cancel-trans.js +2 -2
- package/build/3nstorage/routes/owner/delete-obj.js +2 -2
- package/build/3nstorage/routes/owner/get-current-obj.js +3 -4
- package/build/3nstorage/routes/owner/param-setter.js +2 -6
- package/build/asmail/routes/config/param-setter.js +2 -2
- package/build/asmail/routes/delivery/finalize-delivery.js +2 -2
- package/build/asmail/routes/delivery/put-obj.js +2 -2
- package/build/asmail/routes/delivery/sender-authorization.js +2 -2
- package/build/asmail/routes/retrieval/remove-message.js +2 -2
- package/build/cli/signup-cmd.js +0 -1
- package/build/lib-server/routes/sessions/close.js +2 -2
- package/build/lib-server/routes/sessions/mid-auth.js +2 -5
- package/build/main.js +12 -15
- package/build/mock/tls-options.js +46 -44
- package/build/signup/routes/add.js +4 -4
- 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/routes/owner/archive-obj-version.ts +73 -0
- package/ts-code/3nstorage/routes/owner/cancel-trans.ts +58 -0
- package/ts-code/3nstorage/routes/owner/delete-obj.ts +103 -0
- package/ts-code/3nstorage/routes/owner/get-archived-obj-ver.ts +111 -0
- package/ts-code/3nstorage/routes/owner/get-current-obj.ts +122 -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 +284 -0
- package/ts-code/3nstorage/routes/owner/session-params.ts +49 -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/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 +50 -0
- package/ts-code/asmail/routes/delivery/pre-flight.ts +132 -0
- package/ts-code/asmail/routes/delivery/provide-recipient-pubkey.ts +58 -0
- package/ts-code/asmail/routes/delivery/put-metadata.ts +94 -0
- package/ts-code/asmail/routes/delivery/put-obj.ts +166 -0
- package/ts-code/asmail/routes/delivery/restart-session.ts +130 -0
- package/ts-code/asmail/routes/delivery/sender-authorization.ts +81 -0
- package/ts-code/asmail/routes/delivery/start-session.ts +151 -0
- package/ts-code/asmail/routes/retrieval/get-message-meta.ts +53 -0
- package/ts-code/asmail/routes/retrieval/get-message-obj.ts +109 -0
- package/ts-code/asmail/routes/retrieval/list-messages.ts +70 -0
- package/ts-code/asmail/routes/retrieval/remove-message.ts +47 -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,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 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.ServerRunner = void 0;
|
|
20
|
+
const https = require("https");
|
|
21
|
+
const tls_options_1 = require("../../mock/tls-options");
|
|
22
|
+
const processes_1 = require("../../lib-common/processes");
|
|
23
|
+
// allow client test calls to trust above self-signed cert
|
|
24
|
+
https.globalAgent.options.ca = tls_options_1.sslOpts.cert;
|
|
25
|
+
class ServerRunner {
|
|
26
|
+
constructor(servicePort) {
|
|
27
|
+
this.servicePort = servicePort;
|
|
28
|
+
this.state = 'stopped';
|
|
29
|
+
this.app = undefined;
|
|
30
|
+
}
|
|
31
|
+
isRunning() {
|
|
32
|
+
return (this.state === 'running');
|
|
33
|
+
}
|
|
34
|
+
async start() {
|
|
35
|
+
if (this.state !== 'stopped') {
|
|
36
|
+
throw new Error(`Home server is already in ${this.state} state.`);
|
|
37
|
+
}
|
|
38
|
+
this.state = 'starting';
|
|
39
|
+
this.app = await this.prepToRun();
|
|
40
|
+
await this.app.start(tls_options_1.sslOpts, this.servicePort);
|
|
41
|
+
await (0, processes_1.sleep)(100);
|
|
42
|
+
this.state = 'running';
|
|
43
|
+
}
|
|
44
|
+
async stop(doCleanup = true) {
|
|
45
|
+
if (this.state !== 'running') {
|
|
46
|
+
throw new Error(`Home server is in ${this.state} state instead of running state`);
|
|
47
|
+
}
|
|
48
|
+
this.state = 'stopping';
|
|
49
|
+
await this.app.stop();
|
|
50
|
+
this.app = undefined;
|
|
51
|
+
if (doCleanup) {
|
|
52
|
+
await this.clean();
|
|
53
|
+
}
|
|
54
|
+
this.state = 'stopped';
|
|
55
|
+
}
|
|
56
|
+
async restart() {
|
|
57
|
+
if (this.isRunning()) {
|
|
58
|
+
await this.stop(false);
|
|
59
|
+
}
|
|
60
|
+
await this.start();
|
|
61
|
+
}
|
|
62
|
+
get url() {
|
|
63
|
+
return `https://localhost:${this.servicePort}/`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.ServerRunner = ServerRunner;
|
|
67
|
+
Object.freeze(ServerRunner.prototype);
|
|
68
|
+
Object.freeze(ServerRunner);
|
|
69
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016 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.addSpecsFrom = void 0;
|
|
20
|
+
const path_1 = require("path");
|
|
21
|
+
const fs_1 = require("fs");
|
|
22
|
+
function setupSpecs(specs, setup) {
|
|
23
|
+
if (!specs.definition) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (specs.focused) {
|
|
27
|
+
fdescribe(specs.description, specs.definition(setup));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
describe(specs.description, specs.definition(setup));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function addSpecsFrom(specsFolder, setup) {
|
|
34
|
+
for (let fName of (0, fs_1.readdirSync)(specsFolder)) {
|
|
35
|
+
if (!fName.endsWith('.js')) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
let modPath = (0, path_1.join)(specsFolder, fName);
|
|
39
|
+
let specs = require(modPath).specs;
|
|
40
|
+
if (!specs) {
|
|
41
|
+
console.error(`Module ${fName} is not exposing specs objects with tests`);
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (Array.isArray(specs)) {
|
|
45
|
+
for (let s of specs) {
|
|
46
|
+
setupSpecs(s, setup);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
setupSpecs(specs, setup);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.addSpecsFrom = addSpecsFrom;
|
|
55
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2017, 2019 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.openSocket = void 0;
|
|
20
|
+
const WebSocket = require("ws");
|
|
21
|
+
const xhr_utils_1 = require("./xhr-utils");
|
|
22
|
+
const processes_1 = require("../../lib-common/processes");
|
|
23
|
+
const http_1 = require("../../lib-common/exceptions/http");
|
|
24
|
+
const https_1 = require("https");
|
|
25
|
+
function openSocket(url, sessionId) {
|
|
26
|
+
if (!url.startsWith('wss://')) {
|
|
27
|
+
throw new Error(`Url protocol must be wss`);
|
|
28
|
+
}
|
|
29
|
+
const headers = {};
|
|
30
|
+
headers[xhr_utils_1.SESSION_ID_HEADER] = sessionId;
|
|
31
|
+
const ws = new WebSocket(url, { headers, agent: https_1.globalAgent });
|
|
32
|
+
const opening = (0, processes_1.defer)();
|
|
33
|
+
const initOnError = err => opening.reject((0, http_1.makeConnectionException)(url, undefined, `Cannot open websocket connection due to error: ${err.message}`));
|
|
34
|
+
const onNonOkReply = (req, res) => {
|
|
35
|
+
const errReply = {
|
|
36
|
+
url,
|
|
37
|
+
method: 'GET',
|
|
38
|
+
status: res.statusCode,
|
|
39
|
+
data: undefined
|
|
40
|
+
};
|
|
41
|
+
opening.resolve(errReply);
|
|
42
|
+
};
|
|
43
|
+
ws.on('error', initOnError);
|
|
44
|
+
ws.on('unexpected-response', onNonOkReply);
|
|
45
|
+
ws.once('open', () => {
|
|
46
|
+
const okReply = {
|
|
47
|
+
url,
|
|
48
|
+
method: 'GET',
|
|
49
|
+
status: 200,
|
|
50
|
+
data: ws
|
|
51
|
+
};
|
|
52
|
+
opening.resolve(okReply);
|
|
53
|
+
ws.removeListener('error', initOnError);
|
|
54
|
+
ws.removeListener('unexpected-response', onNonOkReply);
|
|
55
|
+
});
|
|
56
|
+
return opening.promise;
|
|
57
|
+
}
|
|
58
|
+
exports.openSocket = openSocket;
|
|
59
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { HTTPException } from '../../lib-common/exceptions/http';
|
|
2
|
+
export declare const SESSION_ID_HEADER = "X-Session-Id";
|
|
3
|
+
export interface Reply<T> {
|
|
4
|
+
url: string;
|
|
5
|
+
method: string;
|
|
6
|
+
status: number;
|
|
7
|
+
data: T;
|
|
8
|
+
headers?: Headers;
|
|
9
|
+
}
|
|
10
|
+
export interface RequestOpts {
|
|
11
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
12
|
+
url?: string;
|
|
13
|
+
path?: string;
|
|
14
|
+
responseType?: 'json' | 'arraybuffer';
|
|
15
|
+
sessionId?: string;
|
|
16
|
+
responseHeaders?: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface Headers {
|
|
19
|
+
get(name: string): string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export declare function request<T>(contentType: string | undefined, opts: RequestOpts): {
|
|
22
|
+
xhr: XMLHttpRequest;
|
|
23
|
+
promise: Promise<Reply<T>>;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* This assembles XMLHttpRequest with 'Content-Type: application/json' and
|
|
27
|
+
* sends given json.
|
|
28
|
+
* @param opts
|
|
29
|
+
* @param json
|
|
30
|
+
* @return a promise, resolvable to reply object
|
|
31
|
+
*/
|
|
32
|
+
export declare function doJsonRequest<T>(opts: RequestOpts, json: any): Promise<Reply<T>>;
|
|
33
|
+
/**
|
|
34
|
+
* This assembles XMLHttpRequest with 'Content-Type: application/octet-stream'
|
|
35
|
+
* and sends given bytes.
|
|
36
|
+
* @param opts
|
|
37
|
+
* @param bytes
|
|
38
|
+
* @return a promise, resolvable to reply object
|
|
39
|
+
*/
|
|
40
|
+
export declare function doBinaryRequest<T>(opts: RequestOpts, bytes: Uint8Array | Uint8Array[]): Promise<Reply<T>>;
|
|
41
|
+
/**
|
|
42
|
+
* This assembles XMLHttpRequest with 'Content-Type: text/plain'
|
|
43
|
+
* and sends given text
|
|
44
|
+
* @param opts
|
|
45
|
+
* @param txt
|
|
46
|
+
* @return a promise, resolvable to reply object
|
|
47
|
+
*/
|
|
48
|
+
export declare function doTextRequest<T>(opts: RequestOpts, txt: string): Promise<Reply<T>>;
|
|
49
|
+
/**
|
|
50
|
+
* This assembles XMLHttpRequest without 'Content-Type'.
|
|
51
|
+
* @param opts
|
|
52
|
+
* @return a promise, resolvable to reply object
|
|
53
|
+
*/
|
|
54
|
+
export declare function doBodylessRequest<T>(opts: RequestOpts): Promise<Reply<T>>;
|
|
55
|
+
/**
|
|
56
|
+
* @param rep
|
|
57
|
+
* @param errMsg
|
|
58
|
+
* @return http exception based on given reply, with an optional message
|
|
59
|
+
*/
|
|
60
|
+
export declare function makeException(rep: Reply<any>, errMsg?: string): HTTPException;
|
|
61
|
+
export declare function extractIntHeader(rep: Reply<any>, headerName: string): number;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2015 - 2017, 2025 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.extractIntHeader = exports.makeException = exports.doBodylessRequest = exports.doTextRequest = exports.doBinaryRequest = exports.doJsonRequest = exports.request = exports.SESSION_ID_HEADER = void 0;
|
|
20
|
+
const http_1 = require("../../lib-common/exceptions/http");
|
|
21
|
+
const common_1 = require("../../lib-common/byte-streaming/common");
|
|
22
|
+
const xhr2 = require('xhr2');
|
|
23
|
+
exports.SESSION_ID_HEADER = "X-Session-Id";
|
|
24
|
+
function makeHeadersInstanceFrom(xhr, selectHeaders) {
|
|
25
|
+
const m = new Map();
|
|
26
|
+
for (const h of selectHeaders) {
|
|
27
|
+
if (typeof h !== 'string') {
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
30
|
+
const value = xhr.getResponseHeader(h);
|
|
31
|
+
if (typeof value !== 'string') {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
m.set(h.toLowerCase(), value);
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
get(name) {
|
|
38
|
+
return m.get(name.toLowerCase());
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function request(contentType, opts) {
|
|
43
|
+
const xhr = new xhr2();
|
|
44
|
+
const promise = new Promise((resolve, reject) => {
|
|
45
|
+
xhr.open(opts.method, opts.url);
|
|
46
|
+
xhr.onload = () => {
|
|
47
|
+
let data = xhr.response;
|
|
48
|
+
if ((opts.responseType === 'arraybuffer') &&
|
|
49
|
+
(data instanceof ArrayBuffer)) {
|
|
50
|
+
data = new Uint8Array(data);
|
|
51
|
+
}
|
|
52
|
+
const rep = {
|
|
53
|
+
url: opts.url,
|
|
54
|
+
method: opts.method,
|
|
55
|
+
status: xhr.status,
|
|
56
|
+
data: data
|
|
57
|
+
};
|
|
58
|
+
if (Array.isArray(opts.responseHeaders)) {
|
|
59
|
+
rep.headers = makeHeadersInstanceFrom(xhr, opts.responseHeaders);
|
|
60
|
+
}
|
|
61
|
+
resolve(rep);
|
|
62
|
+
};
|
|
63
|
+
xhr.onerror = ev => reject((0, http_1.makeConnectionException)(opts.url, opts.method, 'Cannot connect', ev));
|
|
64
|
+
if (contentType) {
|
|
65
|
+
xhr.setRequestHeader('Content-Type', contentType);
|
|
66
|
+
}
|
|
67
|
+
if (opts.sessionId) {
|
|
68
|
+
xhr.setRequestHeader(exports.SESSION_ID_HEADER, opts.sessionId);
|
|
69
|
+
}
|
|
70
|
+
if (opts.responseType) {
|
|
71
|
+
xhr.responseType = opts.responseType;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
return { xhr, promise };
|
|
75
|
+
}
|
|
76
|
+
exports.request = request;
|
|
77
|
+
/**
|
|
78
|
+
* This assembles XMLHttpRequest with 'Content-Type: application/json' and
|
|
79
|
+
* sends given json.
|
|
80
|
+
* @param opts
|
|
81
|
+
* @param json
|
|
82
|
+
* @return a promise, resolvable to reply object
|
|
83
|
+
*/
|
|
84
|
+
function doJsonRequest(opts, json) {
|
|
85
|
+
const req = request('application/json', opts);
|
|
86
|
+
const body = ((json === undefined) ? '' : JSON.stringify(json));
|
|
87
|
+
req.xhr.send(body);
|
|
88
|
+
return req.promise;
|
|
89
|
+
}
|
|
90
|
+
exports.doJsonRequest = doJsonRequest;
|
|
91
|
+
/**
|
|
92
|
+
* This assembles XMLHttpRequest with 'Content-Type: application/octet-stream'
|
|
93
|
+
* and sends given bytes.
|
|
94
|
+
* @param opts
|
|
95
|
+
* @param bytes
|
|
96
|
+
* @return a promise, resolvable to reply object
|
|
97
|
+
*/
|
|
98
|
+
function doBinaryRequest(opts, bytes) {
|
|
99
|
+
const req = request('application/octet-stream', opts);
|
|
100
|
+
if (Array.isArray(bytes)) {
|
|
101
|
+
const fifo = new common_1.BytesFIFOBuffer();
|
|
102
|
+
for (const arr of bytes) {
|
|
103
|
+
fifo.push(arr);
|
|
104
|
+
}
|
|
105
|
+
req.xhr.send(fifo.getBytes(undefined));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
req.xhr.send(bytes);
|
|
109
|
+
}
|
|
110
|
+
return req.promise;
|
|
111
|
+
}
|
|
112
|
+
exports.doBinaryRequest = doBinaryRequest;
|
|
113
|
+
/**
|
|
114
|
+
* This assembles XMLHttpRequest with 'Content-Type: text/plain'
|
|
115
|
+
* and sends given text
|
|
116
|
+
* @param opts
|
|
117
|
+
* @param txt
|
|
118
|
+
* @return a promise, resolvable to reply object
|
|
119
|
+
*/
|
|
120
|
+
function doTextRequest(opts, txt) {
|
|
121
|
+
const req = request('text/plain', opts);
|
|
122
|
+
req.xhr.send(txt);
|
|
123
|
+
return req.promise;
|
|
124
|
+
}
|
|
125
|
+
exports.doTextRequest = doTextRequest;
|
|
126
|
+
/**
|
|
127
|
+
* This assembles XMLHttpRequest without 'Content-Type'.
|
|
128
|
+
* @param opts
|
|
129
|
+
* @return a promise, resolvable to reply object
|
|
130
|
+
*/
|
|
131
|
+
function doBodylessRequest(opts) {
|
|
132
|
+
const req = request(undefined, opts);
|
|
133
|
+
req.xhr.send();
|
|
134
|
+
return req.promise;
|
|
135
|
+
}
|
|
136
|
+
exports.doBodylessRequest = doBodylessRequest;
|
|
137
|
+
/**
|
|
138
|
+
* @param rep
|
|
139
|
+
* @param errMsg
|
|
140
|
+
* @return http exception based on given reply, with an optional message
|
|
141
|
+
*/
|
|
142
|
+
function makeException(rep, errMsg) {
|
|
143
|
+
return (0, http_1.makeHTTPException)(rep.url, rep.method, rep.status, errMsg);
|
|
144
|
+
}
|
|
145
|
+
exports.makeException = makeException;
|
|
146
|
+
function extractIntHeader(rep, headerName) {
|
|
147
|
+
const intHeader = parseInt(rep.headers.get(headerName));
|
|
148
|
+
if (isNaN(intHeader)) {
|
|
149
|
+
throw makeException(rep, `Malformed response: header ${headerName} is missing or malformed`);
|
|
150
|
+
}
|
|
151
|
+
return intHeader;
|
|
152
|
+
}
|
|
153
|
+
exports.extractIntHeader = extractIntHeader;
|
|
154
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2022 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.specs = void 0;
|
|
20
|
+
const test_utils_1 = require("../test-utils");
|
|
21
|
+
const owner_1 = require("../../../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
23
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
24
|
+
const _3nstorage_1 = require("../../../../libs-for-tests/3nstorage");
|
|
25
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
26
|
+
const random_node_1 = require("../../../../../lib-common/random-node");
|
|
27
|
+
const url_1 = require("url");
|
|
28
|
+
const json_copy_1 = require("../../../../libs-for-tests/json-copy");
|
|
29
|
+
exports.specs = {
|
|
30
|
+
description: `Request to archive object's versions`
|
|
31
|
+
};
|
|
32
|
+
const obj = {
|
|
33
|
+
objId: 'aaaa',
|
|
34
|
+
version: 1,
|
|
35
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
36
|
+
segs: (0, random_node_1.bytesSync)(573)
|
|
37
|
+
};
|
|
38
|
+
exports.specs.definition = (setup) => (() => {
|
|
39
|
+
let reqOpts;
|
|
40
|
+
let storageServer;
|
|
41
|
+
let user;
|
|
42
|
+
let sessionId;
|
|
43
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
44
|
+
storageServer = setup().storageServer;
|
|
45
|
+
user = setup().user;
|
|
46
|
+
await storageServer.restartAndClearStorageFor(user.id);
|
|
47
|
+
sessionId = await (0, test_utils_1.startSession)(user);
|
|
48
|
+
reqOpts = {
|
|
49
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveObj.postAndDelReqUrlEnd(obj.objId, obj.version)),
|
|
50
|
+
method: 'POST',
|
|
51
|
+
sessionId
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
(0, async_jasmine_1.itAsync)('will not work outside of a valid session', async () => {
|
|
55
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
56
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(opts);
|
|
57
|
+
});
|
|
58
|
+
(0, async_jasmine_1.itAsync)('fails when object does not exist', async () => {
|
|
59
|
+
const unknownObj = 'unknown-obj';
|
|
60
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
61
|
+
opts.url = (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveObj.postAndDelReqUrlEnd(unknownObj, 42));
|
|
62
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
63
|
+
expect(rep.status).toBe(owner_1.archiveObj.SC.unknownObj);
|
|
64
|
+
});
|
|
65
|
+
(0, async_jasmine_1.itAsync)('fails when object version does not exist', async () => {
|
|
66
|
+
await (0, _3nstorage_1.saveObj)(user.storageOwnerUrl, sessionId, obj.objId, 1, obj);
|
|
67
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
68
|
+
opts.url = (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveObj.postAndDelReqUrlEnd(obj.objId, 42));
|
|
69
|
+
opts.responseType = 'json';
|
|
70
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
71
|
+
expect(rep.status).toBe(owner_1.archiveObj.SC.mismatchedObjVer);
|
|
72
|
+
expect(rep.data.current_version).toBe(1);
|
|
73
|
+
});
|
|
74
|
+
(0, async_jasmine_1.itAsync)('sets current version archived', async () => {
|
|
75
|
+
await (0, _3nstorage_1.saveObj)(user.storageOwnerUrl, sessionId, obj.objId, 1, obj);
|
|
76
|
+
let archived = (await (0, test_utils_1.getObjStatus)(user, obj.objId, sessionId)).archived;
|
|
77
|
+
expect(archived).toBeUndefined();
|
|
78
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
79
|
+
expect(rep.status).toBe(owner_1.archiveObj.SC.okPost);
|
|
80
|
+
archived = (await (0, test_utils_1.getObjStatus)(user, obj.objId, sessionId)).archived;
|
|
81
|
+
expect(archived).toContain(1);
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2022 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.specs = void 0;
|
|
20
|
+
const test_utils_1 = require("../test-utils");
|
|
21
|
+
const owner_1 = require("../../../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
23
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
24
|
+
const _3nstorage_1 = require("../../../../libs-for-tests/3nstorage");
|
|
25
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
26
|
+
const random_node_1 = require("../../../../../lib-common/random-node");
|
|
27
|
+
const url_1 = require("url");
|
|
28
|
+
const json_copy_1 = require("../../../../libs-for-tests/json-copy");
|
|
29
|
+
exports.specs = {
|
|
30
|
+
description: `Request to archive root's versions`
|
|
31
|
+
};
|
|
32
|
+
const obj = {
|
|
33
|
+
objId: null,
|
|
34
|
+
version: 1,
|
|
35
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
36
|
+
segs: (0, random_node_1.bytesSync)(573)
|
|
37
|
+
};
|
|
38
|
+
exports.specs.definition = (setup) => (() => {
|
|
39
|
+
let reqOpts;
|
|
40
|
+
let storageServer;
|
|
41
|
+
let user;
|
|
42
|
+
let sessionId;
|
|
43
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
44
|
+
storageServer = setup().storageServer;
|
|
45
|
+
user = setup().user;
|
|
46
|
+
await storageServer.restartAndClearStorageFor(user.id);
|
|
47
|
+
sessionId = await (0, test_utils_1.startSession)(user);
|
|
48
|
+
reqOpts = {
|
|
49
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveRoot.postAndDelReqUrlEnd(obj.version)),
|
|
50
|
+
method: 'POST',
|
|
51
|
+
responseType: 'json',
|
|
52
|
+
sessionId
|
|
53
|
+
};
|
|
54
|
+
});
|
|
55
|
+
(0, async_jasmine_1.itAsync)('will not work outside of a valid session', async () => {
|
|
56
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
57
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(opts);
|
|
58
|
+
});
|
|
59
|
+
(0, async_jasmine_1.itAsync)('fails when object version does not exist', async () => {
|
|
60
|
+
await (0, _3nstorage_1.saveObj)(user.storageOwnerUrl, sessionId, obj.objId, 1, obj);
|
|
61
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
62
|
+
opts.url = (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveRoot.postAndDelReqUrlEnd(42));
|
|
63
|
+
opts.responseType = 'json';
|
|
64
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
65
|
+
expect(rep.status).toBe(owner_1.archiveRoot.SC.mismatchedObjVer);
|
|
66
|
+
expect(rep.data.current_version).toBe(1);
|
|
67
|
+
});
|
|
68
|
+
(0, async_jasmine_1.itAsync)('sets current version archived', async () => {
|
|
69
|
+
await (0, _3nstorage_1.saveObj)(user.storageOwnerUrl, sessionId, obj.objId, 1, obj);
|
|
70
|
+
let archived = (await (0, test_utils_1.getObjStatus)(user, obj.objId, sessionId)).archived;
|
|
71
|
+
expect(archived).toBeUndefined();
|
|
72
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
73
|
+
expect(rep.status).toBe(owner_1.archiveRoot.SC.okPost);
|
|
74
|
+
archived = (await (0, test_utils_1.getObjStatus)(user, obj.objId, sessionId)).archived;
|
|
75
|
+
expect(archived).toContain(1);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
Object.freeze(exports);
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2022 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.specs = void 0;
|
|
20
|
+
const test_utils_1 = require("../test-utils");
|
|
21
|
+
const owner_1 = require("../../../../../lib-common/service-api/3nstorage/owner");
|
|
22
|
+
const async_jasmine_1 = require("../../../../libs-for-tests/async-jasmine");
|
|
23
|
+
const xhr_utils_1 = require("../../../../libs-for-tests/xhr-utils");
|
|
24
|
+
const _3nstorage_1 = require("../../../../libs-for-tests/3nstorage");
|
|
25
|
+
const requests_1 = require("../../../../shared-checks/requests");
|
|
26
|
+
const random_node_1 = require("../../../../../lib-common/random-node");
|
|
27
|
+
const url_1 = require("url");
|
|
28
|
+
const json_copy_1 = require("../../../../libs-for-tests/json-copy");
|
|
29
|
+
exports.specs = {
|
|
30
|
+
description: `Request to archive object's versions`
|
|
31
|
+
};
|
|
32
|
+
const obj = {
|
|
33
|
+
objId: 'aaaa',
|
|
34
|
+
version: 1,
|
|
35
|
+
header: (0, random_node_1.bytesSync)(100),
|
|
36
|
+
segs: (0, random_node_1.bytesSync)(573)
|
|
37
|
+
};
|
|
38
|
+
exports.specs.definition = (setup) => (() => {
|
|
39
|
+
let reqOpts;
|
|
40
|
+
let storageServer;
|
|
41
|
+
let user;
|
|
42
|
+
let sessionId;
|
|
43
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
44
|
+
storageServer = setup().storageServer;
|
|
45
|
+
user = setup().user;
|
|
46
|
+
await storageServer.restartAndClearStorageFor(user.id);
|
|
47
|
+
sessionId = await (0, test_utils_1.startSession)(user);
|
|
48
|
+
reqOpts = {
|
|
49
|
+
url: (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveObj.postAndDelReqUrlEnd(obj.objId, obj.version)),
|
|
50
|
+
method: 'DELETE',
|
|
51
|
+
sessionId
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
(0, async_jasmine_1.itAsync)('will not work outside of a valid session', async () => {
|
|
55
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
56
|
+
await (0, requests_1.expectNonAcceptanceOfBadSessionId)(opts);
|
|
57
|
+
});
|
|
58
|
+
(0, async_jasmine_1.itAsync)('fails when object does not exist', async () => {
|
|
59
|
+
const unknownObj = 'unknown-obj';
|
|
60
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
61
|
+
opts.url = (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveObj.postAndDelReqUrlEnd(unknownObj, 42));
|
|
62
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
63
|
+
expect(rep.status).toBe(owner_1.archiveObj.SC.unknownObj);
|
|
64
|
+
});
|
|
65
|
+
(0, async_jasmine_1.itAsync)('fails when object version does not exist', async () => {
|
|
66
|
+
await (0, _3nstorage_1.saveObj)(user.storageOwnerUrl, sessionId, obj.objId, 1, obj);
|
|
67
|
+
const opts = (0, json_copy_1.copy)(reqOpts);
|
|
68
|
+
opts.url = (0, url_1.resolve)(user.storageOwnerUrl, owner_1.archiveObj.postAndDelReqUrlEnd(obj.objId, 42));
|
|
69
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(opts);
|
|
70
|
+
expect(rep.status).toBe(owner_1.archiveObj.SC.unknownObjVer);
|
|
71
|
+
});
|
|
72
|
+
(0, async_jasmine_1.itAsync)('Removes archived version', async () => {
|
|
73
|
+
await (0, _3nstorage_1.saveObj)(user.storageOwnerUrl, sessionId, obj.objId, 1, obj);
|
|
74
|
+
await (0, test_utils_1.archiveObjVer)(user, obj.objId, 1, sessionId);
|
|
75
|
+
let archived = (await (0, test_utils_1.getObjStatus)(user, obj.objId, sessionId)).archived;
|
|
76
|
+
expect(archived).toContain(1);
|
|
77
|
+
const rep = await (0, xhr_utils_1.doBodylessRequest)(reqOpts);
|
|
78
|
+
expect(rep.status).toBe(owner_1.archiveObj.SC.okDelete);
|
|
79
|
+
archived = (await (0, test_utils_1.getObjStatus)(user, obj.objId, sessionId)).archived;
|
|
80
|
+
expect(archived).toBeUndefined();
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
Object.freeze(exports);
|