spec-3nweb-server 1.8.5 → 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/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/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,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
|
|
@@ -19,52 +19,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
exports.sslOpts = void 0;
|
|
20
20
|
exports.sslOpts = {
|
|
21
21
|
key: `-----BEGIN PRIVATE KEY-----
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
22
|
+
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCggRGeSSbXoPby
|
|
23
|
+
CI943Lg80+0XFoJxbinkH+SEbNZ3IpuSQyaoaWTIGqjXH2tIO7D7Htr7XVsqIsQW
|
|
24
|
+
33K9ZxAGwowuDXduRD/TM2Fnt7O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EL/mdkA/d2/H0HIHwGV0A2hpyG8d+RpP2na+
|
|
67
|
+
uwDNifryUwZd8bW2n3UoRtsralEW657sReywAa6iunk8220vjRq8LlceJh3952ov
|
|
68
|
+
EEuI+hxj/ikVBSjQX8aFhX8kx4p4q/mKCOA5q3DCbmrr3Cn8fl0zRZZegrk9kfpV
|
|
69
|
+
QGCnHRJ0yQ==
|
|
68
70
|
-----END CERTIFICATE-----`
|
|
69
71
|
};
|
|
70
72
|
Object.freeze(exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright (C) 2016, 2020 - 2021, 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
|
+
const async_jasmine_1 = require("../libs-for-tests/async-jasmine");
|
|
20
|
+
const admin_1 = require("../libs-for-tests/server-components/admin");
|
|
21
|
+
const xhr_utils_1 = require("../libs-for-tests/xhr-utils");
|
|
22
|
+
const signupApi = require("../../lib-common/admin-api/signup");
|
|
23
|
+
const requests_1 = require("../shared-checks/requests");
|
|
24
|
+
const jwkeys_1 = require("../../lib-common/jwkeys");
|
|
25
|
+
const ecma_nacl_1 = require("ecma-nacl");
|
|
26
|
+
describe('Admin', () => {
|
|
27
|
+
describe('signup subsystem', () => {
|
|
28
|
+
let admin;
|
|
29
|
+
const signupDomains = ['first.org', 'second.org'];
|
|
30
|
+
(0, async_jasmine_1.beforeEachAsync)(async () => {
|
|
31
|
+
admin = new admin_1.AdminComponent(signupDomains);
|
|
32
|
+
await admin.start();
|
|
33
|
+
});
|
|
34
|
+
(0, async_jasmine_1.afterEachAsync)(async () => {
|
|
35
|
+
await admin.stop();
|
|
36
|
+
admin = undefined;
|
|
37
|
+
});
|
|
38
|
+
(0, async_jasmine_1.itAsync)('tells available addresses for a given name', async () => {
|
|
39
|
+
const REQ_SIZE_LIMIT = 1024;
|
|
40
|
+
const name = 'Bob Marley ';
|
|
41
|
+
const reqOpts = {
|
|
42
|
+
url: admin.signupUrl + signupApi.availableAddressesForName.URL_END,
|
|
43
|
+
method: 'POST',
|
|
44
|
+
responseType: 'json'
|
|
45
|
+
};
|
|
46
|
+
// request with ok name
|
|
47
|
+
let req = { name };
|
|
48
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
49
|
+
expect(rep.status).withContext('status code for OK reply').toBe(signupApi.availableAddressesForName.SC.ok);
|
|
50
|
+
expect(Array.isArray(rep.data)).withContext('OK reply is an array').toBe(true);
|
|
51
|
+
expect(rep.data.length).withContext('with no users, all domains should used as options for available addresses').toBe(signupDomains.length);
|
|
52
|
+
for (const domain of signupDomains) {
|
|
53
|
+
expect(rep.data).toContain(name + '@' + domain);
|
|
54
|
+
}
|
|
55
|
+
// requests with bad names and with bad json's
|
|
56
|
+
const badNames = [name + '@something',
|
|
57
|
+
5, null, undefined, {}]; // non-strings
|
|
58
|
+
const badJSONs = [name, 5, null, undefined, [name],
|
|
59
|
+
{ a: 1 }];
|
|
60
|
+
for (const badName of badNames) {
|
|
61
|
+
req = { name: badName };
|
|
62
|
+
badJSONs.push(req);
|
|
63
|
+
}
|
|
64
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
65
|
+
});
|
|
66
|
+
(0, async_jasmine_1.itAsync)('tells available domains', async () => {
|
|
67
|
+
const REQ_SIZE_LIMIT = 1024;
|
|
68
|
+
const reqOpts = {
|
|
69
|
+
url: admin.signupUrl + signupApi.availableDomains.URL_END,
|
|
70
|
+
method: 'POST',
|
|
71
|
+
responseType: 'json'
|
|
72
|
+
};
|
|
73
|
+
const req = {};
|
|
74
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
75
|
+
expect(rep.status).withContext('status code for OK reply').toBe(signupApi.availableDomains.SC.ok);
|
|
76
|
+
expect(Array.isArray(rep.data)).withContext('OK reply is an array').toBe(true);
|
|
77
|
+
expect(rep.data.length).withContext('with no token, all domains should be given as options').toBe(signupDomains.length);
|
|
78
|
+
for (const domain of signupDomains) {
|
|
79
|
+
expect(rep.data).toContain(domain);
|
|
80
|
+
}
|
|
81
|
+
// requests with bad json's
|
|
82
|
+
const badJSONs = [{ signupToken: 4 }];
|
|
83
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
84
|
+
});
|
|
85
|
+
async function getAvailableAddressesFor(name) {
|
|
86
|
+
const reqOpts = {
|
|
87
|
+
url: admin.signupUrl + signupApi.availableAddressesForName.URL_END,
|
|
88
|
+
method: 'POST',
|
|
89
|
+
responseType: 'json'
|
|
90
|
+
};
|
|
91
|
+
const req = { name };
|
|
92
|
+
const rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
93
|
+
expect(rep.status).toBe(signupApi.availableAddressesForName.SC.ok);
|
|
94
|
+
return rep.data;
|
|
95
|
+
}
|
|
96
|
+
function makeAddUserReq(userId, signupToken) {
|
|
97
|
+
return {
|
|
98
|
+
userId,
|
|
99
|
+
storage: {
|
|
100
|
+
kdParams: {}
|
|
101
|
+
},
|
|
102
|
+
mailerId: {
|
|
103
|
+
defaultPKey: {
|
|
104
|
+
pkey: {
|
|
105
|
+
alg: ecma_nacl_1.box.JWK_ALG_NAME,
|
|
106
|
+
kid: (Buffer.alloc(12)).toString('base64'),
|
|
107
|
+
use: jwkeys_1.use.MID_PKLOGIN,
|
|
108
|
+
k: (Buffer.alloc(ecma_nacl_1.box.KEY_LENGTH)).toString('base64')
|
|
109
|
+
},
|
|
110
|
+
kdParams: {}
|
|
111
|
+
},
|
|
112
|
+
otherPKeys: [{
|
|
113
|
+
alg: ecma_nacl_1.box.JWK_ALG_NAME,
|
|
114
|
+
kid: (Buffer.alloc(12)).toString('base64'),
|
|
115
|
+
use: jwkeys_1.use.MID_PKLOGIN,
|
|
116
|
+
k: (Buffer.alloc(ecma_nacl_1.box.KEY_LENGTH)).toString('base64')
|
|
117
|
+
}]
|
|
118
|
+
},
|
|
119
|
+
signupToken
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function makeBadAddUserReq(goodId) {
|
|
123
|
+
const name = 'Bob Marley';
|
|
124
|
+
const badJSONs = [name, 5, null, undefined, [name],
|
|
125
|
+
{ a: 1 }];
|
|
126
|
+
const badIds = ['bad domain str',
|
|
127
|
+
'', ' ', '\t', '\n',
|
|
128
|
+
5, null, undefined, {}]; // non-strings
|
|
129
|
+
for (const id of badIds) {
|
|
130
|
+
const req = makeAddUserReq(id);
|
|
131
|
+
badJSONs.push(req);
|
|
132
|
+
}
|
|
133
|
+
let req = makeAddUserReq(goodId);
|
|
134
|
+
delete req.userId;
|
|
135
|
+
badJSONs.push(req);
|
|
136
|
+
req = makeAddUserReq(goodId);
|
|
137
|
+
delete req.storage;
|
|
138
|
+
badJSONs.push(req);
|
|
139
|
+
req = makeAddUserReq(goodId);
|
|
140
|
+
delete req.storage.kdParams;
|
|
141
|
+
badJSONs.push(req);
|
|
142
|
+
req = makeAddUserReq(goodId);
|
|
143
|
+
delete req.mailerId;
|
|
144
|
+
badJSONs.push(req);
|
|
145
|
+
req = makeAddUserReq(goodId);
|
|
146
|
+
delete req.mailerId.defaultPKey;
|
|
147
|
+
badJSONs.push(req);
|
|
148
|
+
req = makeAddUserReq(goodId);
|
|
149
|
+
delete req.mailerId.defaultPKey.pkey.alg;
|
|
150
|
+
badJSONs.push(req);
|
|
151
|
+
req = makeAddUserReq(goodId);
|
|
152
|
+
delete req.mailerId.defaultPKey.pkey.k;
|
|
153
|
+
badJSONs.push(req);
|
|
154
|
+
req = makeAddUserReq(goodId);
|
|
155
|
+
delete req.mailerId.defaultPKey.pkey.kid;
|
|
156
|
+
badJSONs.push(req);
|
|
157
|
+
req = makeAddUserReq(goodId);
|
|
158
|
+
delete req.mailerId.defaultPKey.pkey.use;
|
|
159
|
+
badJSONs.push(req);
|
|
160
|
+
req = makeAddUserReq(goodId);
|
|
161
|
+
delete req.mailerId.defaultPKey.kdParams;
|
|
162
|
+
badJSONs.push(req);
|
|
163
|
+
req = makeAddUserReq(goodId);
|
|
164
|
+
delete req.mailerId.otherPKeys;
|
|
165
|
+
badJSONs.push(req);
|
|
166
|
+
req = makeAddUserReq(goodId);
|
|
167
|
+
req.mailerId.otherPKeys.shift();
|
|
168
|
+
badJSONs.push(req);
|
|
169
|
+
req = makeAddUserReq(goodId);
|
|
170
|
+
delete req.mailerId.otherPKeys[0].alg;
|
|
171
|
+
badJSONs.push(req);
|
|
172
|
+
req = makeAddUserReq(goodId);
|
|
173
|
+
delete req.mailerId.otherPKeys[0].k;
|
|
174
|
+
badJSONs.push(req);
|
|
175
|
+
req = makeAddUserReq(goodId);
|
|
176
|
+
delete req.mailerId.otherPKeys[0].kid;
|
|
177
|
+
badJSONs.push(req);
|
|
178
|
+
req = makeAddUserReq(goodId);
|
|
179
|
+
delete req.mailerId.otherPKeys[0].use;
|
|
180
|
+
badJSONs.push(req);
|
|
181
|
+
return badJSONs;
|
|
182
|
+
}
|
|
183
|
+
async function addNewUser(userId, signupToken) {
|
|
184
|
+
const reqOpts = {
|
|
185
|
+
url: admin.signupUrl + signupApi.addUser.URL_END,
|
|
186
|
+
method: 'POST'
|
|
187
|
+
};
|
|
188
|
+
const req = makeAddUserReq(userId, signupToken);
|
|
189
|
+
let rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
190
|
+
expect(rep.status).withContext('status when user is added').toBe(signupApi.addUser.SC.ok);
|
|
191
|
+
rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
192
|
+
expect(rep.status).withContext('status when user already exists').toBe(signupApi.addUser.SC.userAlreadyExists);
|
|
193
|
+
}
|
|
194
|
+
(0, async_jasmine_1.itAsync)('adds new user', async () => {
|
|
195
|
+
const REQ_SIZE_LIMIT = 4 * 1024;
|
|
196
|
+
const reqOpts = {
|
|
197
|
+
url: admin.signupUrl + signupApi.addUser.URL_END,
|
|
198
|
+
method: 'POST'
|
|
199
|
+
};
|
|
200
|
+
const name = 'Bob Marley ';
|
|
201
|
+
let addresses = await getAvailableAddressesFor(name);
|
|
202
|
+
let numOfAvailableAddresses = addresses.length;
|
|
203
|
+
expect(numOfAvailableAddresses).toBe(signupDomains.length);
|
|
204
|
+
// requests with bad json's
|
|
205
|
+
const badJSONs = makeBadAddUserReq(addresses[0]);
|
|
206
|
+
await (0, requests_1.expectNonAcceptanceOfBadJsonRequest)(reqOpts, REQ_SIZE_LIMIT, badJSONs);
|
|
207
|
+
// normal adding users
|
|
208
|
+
for (const userId of addresses) {
|
|
209
|
+
expect(addresses).toContain(userId);
|
|
210
|
+
await addNewUser(userId);
|
|
211
|
+
numOfAvailableAddresses -= 1;
|
|
212
|
+
addresses = await getAvailableAddressesFor(name);
|
|
213
|
+
expect(addresses.length).toBe(numOfAvailableAddresses);
|
|
214
|
+
expect(addresses).not.toContain(userId);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
(0, async_jasmine_1.itAsync)(`adds new user with token`, async () => {
|
|
218
|
+
const reqOpts = {
|
|
219
|
+
url: admin.signupUrl + signupApi.addUser.URL_END,
|
|
220
|
+
method: 'POST'
|
|
221
|
+
};
|
|
222
|
+
// note that new id has other domain that isn't set anywhere
|
|
223
|
+
const userId = 'Pink Floyd @home.town';
|
|
224
|
+
// let's try to do this without any token
|
|
225
|
+
let req = makeAddUserReq(userId);
|
|
226
|
+
let rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
227
|
+
expect(rep.status).withContext('status when no token given').toBe(signupApi.addUser.SC.unauthorized);
|
|
228
|
+
// create token, here setup code uses spec-server specific code
|
|
229
|
+
const token = await admin.createSingleUserSignupTokenFor(userId);
|
|
230
|
+
req = makeAddUserReq(userId, token);
|
|
231
|
+
rep = await (0, xhr_utils_1.doJsonRequest)(reqOpts, req);
|
|
232
|
+
expect(rep.status).withContext('status when user is added').toBe(signupApi.addUser.SC.ok);
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const jas: any;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (C) 2016 3NSoft Inc.
|
|
3
|
+
|
|
4
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
5
|
+
the terms of the GNU General Public License as published by the Free Software
|
|
6
|
+
Foundation, either version 3 of the License, or (at your option) any later
|
|
7
|
+
version.
|
|
8
|
+
|
|
9
|
+
This program is distributed in the hope that it will be useful, but
|
|
10
|
+
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
12
|
+
See the GNU General Public License for more details.
|
|
13
|
+
|
|
14
|
+
You should have received a copy of the GNU General Public License along with
|
|
15
|
+
this program. If not, see <http://www.gnu.org/licenses/>.
|
|
16
|
+
*/
|
|
17
|
+
// NOTE: due to bad definition file, typescript below is not very type-strict.
|
|
18
|
+
const jas = new (require('jasmine'))();
|
|
19
|
+
jas.loadConfig({
|
|
20
|
+
spec_dir: 'build/tests',
|
|
21
|
+
spec_files: [
|
|
22
|
+
'admin-proto/**/*.js',
|
|
23
|
+
'protocols/mailerid.js',
|
|
24
|
+
'protocols/3nstorage/*.js',
|
|
25
|
+
'protocols/asmail/*.js',
|
|
26
|
+
],
|
|
27
|
+
random: false
|
|
28
|
+
});
|
|
29
|
+
jas.configureDefaultReporter({
|
|
30
|
+
showColors: true
|
|
31
|
+
});
|
|
32
|
+
jas.execute();
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as api from '../../lib-common/service-api/3nstorage/owner';
|
|
2
|
+
export declare function get3NStorageServiceUrl(storageUrl: string, service: 'owner' | 'shared'): Promise<string>;
|
|
3
|
+
export interface BaseObj {
|
|
4
|
+
objId: string;
|
|
5
|
+
header: Uint8Array;
|
|
6
|
+
segs: Uint8Array;
|
|
7
|
+
}
|
|
8
|
+
export interface Obj extends BaseObj {
|
|
9
|
+
version: number;
|
|
10
|
+
diff?: api.DiffInfo;
|
|
11
|
+
}
|
|
12
|
+
export declare function cancelTransaction(ownerUrl: string, sessionId: string, objId: string, transactionId: string): Promise<void>;
|
|
13
|
+
export declare function getSessionParams(ownerUrl: string, sessionId: string): Promise<api.sessionParams.Reply>;
|
|
14
|
+
/**
|
|
15
|
+
* @param user
|
|
16
|
+
* @param objId is object's id. Null stands for root object.
|
|
17
|
+
* @param ver
|
|
18
|
+
* @param obj
|
|
19
|
+
* @return a promise, resolvable object is writen.
|
|
20
|
+
*/
|
|
21
|
+
export declare function saveObj(ownerUrl: string, sessionId: string, objId: string | null, ver: number, obj: Obj): Promise<void>;
|
|
22
|
+
export declare function removeObj(ownerUrl: string, sessionId: string, objId: string): Promise<void>;
|