tessa 1.0.0.pre.rc2 → 1.0.1
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.
- checksums.yaml +4 -4
- data/app/assets/javascripts/tessa.esm.js +8 -10
- data/app/assets/javascripts/tessa.js +8 -10
- data/app/javascript/tessa/index.js.coffee +2 -2
- data/lib/tessa/active_storage/asset_wrapper.rb +8 -1
- data/lib/tessa/config.rb +5 -1
- data/lib/tessa/version.rb +1 -1
- data/spec/tessa/config_spec.rb +0 -4
- data/spec/tessa/upload/uploads_file_spec.rb +0 -10
- data/tessa.gemspec +1 -1
- data/yarn.lock +0 -5
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 153d1d11991ae3282b26a80ef33694cb8aae8773fe0ceddc5176243beb137581
|
4
|
+
data.tar.gz: 6c98f75781366eca6d43ba73789fa85e8470f0f2b47971392ee0d8afe61bab18
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7aac9e710299385ed4fc9fa6845b9a0974046817149994d8ca15f1c746501a1b9573e9c3455f8707806df69f519d04b5b6f4ac185c70af4f802eec5416bb87f2
|
7
|
+
data.tar.gz: 938d746824307da74813f937184fee8fb32f2f286e01301a695b5a2871410d2a7bfc1e796e1e2365aa0144898a16d73364b4bb58b78eac5b0526746ef1e4d262
|
@@ -468,15 +468,10 @@ Dropzone.autoDiscover = false;
|
|
468
468
|
|
469
469
|
window.WCC.Dropzone = class Dropzone extends window.Dropzone {
|
470
470
|
uploadFile(file) {
|
471
|
-
var handleError, headerName, headerValue, headers, progressObj, ref,
|
471
|
+
var handleError, headerName, headerValue, headers, progressObj, ref, response, updateProgress, xhr;
|
472
472
|
xhr = new XMLHttpRequest;
|
473
473
|
file.xhr = xhr;
|
474
474
|
xhr.open(file.uploadMethod, file.uploadURL, true);
|
475
|
-
ref = file.uploadHeaders;
|
476
|
-
for (headerName in ref) {
|
477
|
-
headerValue = ref[headerName];
|
478
|
-
xhr.setRequestHeader(headerName, headerValue);
|
479
|
-
}
|
480
475
|
response = null;
|
481
476
|
handleError = () => this._errorProcessing([ file ], response || this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
|
482
477
|
updateProgress = e => {
|
@@ -503,7 +498,7 @@ window.WCC.Dropzone = class Dropzone extends window.Dropzone {
|
|
503
498
|
return this.emit("uploadprogress", file, progress, file.upload.bytesSent);
|
504
499
|
};
|
505
500
|
xhr.onload = e => {
|
506
|
-
var
|
501
|
+
var ref;
|
507
502
|
if (file.status === WCC.Dropzone.CANCELED) {
|
508
503
|
return;
|
509
504
|
}
|
@@ -520,7 +515,7 @@ window.WCC.Dropzone = class Dropzone extends window.Dropzone {
|
|
520
515
|
}
|
521
516
|
}
|
522
517
|
updateProgress();
|
523
|
-
if (!(200 <= (
|
518
|
+
if (!(200 <= (ref = xhr.status) && ref < 300)) {
|
524
519
|
return handleError();
|
525
520
|
} else {
|
526
521
|
return this._finished([ file ], response, e);
|
@@ -532,7 +527,7 @@ window.WCC.Dropzone = class Dropzone extends window.Dropzone {
|
|
532
527
|
}
|
533
528
|
return handleError();
|
534
529
|
};
|
535
|
-
progressObj = (
|
530
|
+
progressObj = (ref = xhr.upload) != null ? ref : xhr;
|
536
531
|
progressObj.onprogress = updateProgress;
|
537
532
|
headers = {
|
538
533
|
Accept: "application/json",
|
@@ -540,7 +535,10 @@ window.WCC.Dropzone = class Dropzone extends window.Dropzone {
|
|
540
535
|
"X-Requested-With": "XMLHttpRequest"
|
541
536
|
};
|
542
537
|
if (this.options.headers) {
|
543
|
-
extend(headers, this.options.headers);
|
538
|
+
$.extend(headers, this.options.headers);
|
539
|
+
}
|
540
|
+
if (file.uploadHeaders) {
|
541
|
+
$.extend(headers, file.uploadHeaders);
|
544
542
|
}
|
545
543
|
for (headerName in headers) {
|
546
544
|
headerValue = headers[headerName];
|
@@ -463,15 +463,10 @@
|
|
463
463
|
Dropzone.autoDiscover = false;
|
464
464
|
window.WCC.Dropzone = class Dropzone extends window.Dropzone {
|
465
465
|
uploadFile(file) {
|
466
|
-
var handleError, headerName, headerValue, headers, progressObj, ref,
|
466
|
+
var handleError, headerName, headerValue, headers, progressObj, ref, response, updateProgress, xhr;
|
467
467
|
xhr = new XMLHttpRequest;
|
468
468
|
file.xhr = xhr;
|
469
469
|
xhr.open(file.uploadMethod, file.uploadURL, true);
|
470
|
-
ref = file.uploadHeaders;
|
471
|
-
for (headerName in ref) {
|
472
|
-
headerValue = ref[headerName];
|
473
|
-
xhr.setRequestHeader(headerName, headerValue);
|
474
|
-
}
|
475
470
|
response = null;
|
476
471
|
handleError = () => this._errorProcessing([ file ], response || this.options.dictResponseError.replace("{{statusCode}}", xhr.status), xhr);
|
477
472
|
updateProgress = e => {
|
@@ -498,7 +493,7 @@
|
|
498
493
|
return this.emit("uploadprogress", file, progress, file.upload.bytesSent);
|
499
494
|
};
|
500
495
|
xhr.onload = e => {
|
501
|
-
var
|
496
|
+
var ref;
|
502
497
|
if (file.status === WCC.Dropzone.CANCELED) {
|
503
498
|
return;
|
504
499
|
}
|
@@ -515,7 +510,7 @@
|
|
515
510
|
}
|
516
511
|
}
|
517
512
|
updateProgress();
|
518
|
-
if (!(200 <= (
|
513
|
+
if (!(200 <= (ref = xhr.status) && ref < 300)) {
|
519
514
|
return handleError();
|
520
515
|
} else {
|
521
516
|
return this._finished([ file ], response, e);
|
@@ -527,7 +522,7 @@
|
|
527
522
|
}
|
528
523
|
return handleError();
|
529
524
|
};
|
530
|
-
progressObj = (
|
525
|
+
progressObj = (ref = xhr.upload) != null ? ref : xhr;
|
531
526
|
progressObj.onprogress = updateProgress;
|
532
527
|
headers = {
|
533
528
|
Accept: "application/json",
|
@@ -535,7 +530,10 @@
|
|
535
530
|
"X-Requested-With": "XMLHttpRequest"
|
536
531
|
};
|
537
532
|
if (this.options.headers) {
|
538
|
-
extend(headers, this.options.headers);
|
533
|
+
$.extend(headers, this.options.headers);
|
534
|
+
}
|
535
|
+
if (file.uploadHeaders) {
|
536
|
+
$.extend(headers, file.uploadHeaders);
|
539
537
|
}
|
540
538
|
for (headerName in headers) {
|
541
539
|
headerValue = headers[headerName];
|
@@ -13,7 +13,6 @@ class window.WCC.Dropzone extends window.Dropzone
|
|
13
13
|
|
14
14
|
# Set in our custom accept method
|
15
15
|
xhr.open file.uploadMethod, file.uploadURL, true
|
16
|
-
xhr.setRequestHeader headerName, headerValue for headerName, headerValue of file.uploadHeaders
|
17
16
|
|
18
17
|
response = null
|
19
18
|
|
@@ -76,7 +75,8 @@ class window.WCC.Dropzone extends window.Dropzone
|
|
76
75
|
"Cache-Control": "no-cache",
|
77
76
|
"X-Requested-With": "XMLHttpRequest",
|
78
77
|
|
79
|
-
extend headers, @options.headers if @options.headers
|
78
|
+
$.extend headers, @options.headers if @options.headers
|
79
|
+
$.extend headers, file.uploadHeaders if file.uploadHeaders
|
80
80
|
|
81
81
|
xhr.setRequestHeader headerName, headerValue for headerName, headerValue of headers
|
82
82
|
|
@@ -1,5 +1,9 @@
|
|
1
1
|
module Tessa::ActiveStorage
|
2
2
|
class AssetWrapper < SimpleDelegator
|
3
|
+
def id
|
4
|
+
key
|
5
|
+
end
|
6
|
+
|
3
7
|
def public_url
|
4
8
|
Rails.application.routes.url_helpers.
|
5
9
|
rails_blob_url(__getobj__, disposition: :inline)
|
@@ -14,7 +18,10 @@ module Tessa::ActiveStorage
|
|
14
18
|
end
|
15
19
|
|
16
20
|
def meta
|
17
|
-
{
|
21
|
+
{
|
22
|
+
mime_type: content_type,
|
23
|
+
size: byte_size
|
24
|
+
}
|
18
25
|
end
|
19
26
|
|
20
27
|
def failure?
|
data/lib/tessa/config.rb
CHANGED
@@ -11,7 +11,11 @@ module Tessa
|
|
11
11
|
|
12
12
|
def connection
|
13
13
|
@connection ||= Faraday.new(url: url) do |conn|
|
14
|
-
conn.basic_auth
|
14
|
+
if conn.respond_to?(:basic_auth)
|
15
|
+
conn.basic_auth username, password
|
16
|
+
else # Faraday >= 1.0
|
17
|
+
conn.request :authorization, :basic, username, password
|
18
|
+
end
|
15
19
|
conn.request :url_encoded
|
16
20
|
conn.adapter Faraday.default_adapter
|
17
21
|
end
|
data/lib/tessa/version.rb
CHANGED
data/spec/tessa/config_spec.rb
CHANGED
@@ -95,10 +95,6 @@ RSpec.describe Tessa::Config do
|
|
95
95
|
connection
|
96
96
|
end
|
97
97
|
|
98
|
-
it "sets up basic auth params" do
|
99
|
-
expect(spy).to have_received(:basic_auth).with(args[:username], args[:password])
|
100
|
-
end
|
101
|
-
|
102
98
|
it "sets up url_encoded request handler" do
|
103
99
|
expect(spy).to have_received(:request).with(:url_encoded)
|
104
100
|
end
|
@@ -69,14 +69,4 @@ RSpec.describe Tessa::Upload::UploadsFile do
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
72
|
-
|
73
|
-
describe ".connection_factory" do
|
74
|
-
it "returns a new Faraday::Connection with the default adapter" do
|
75
|
-
obj = described_class.connection_factory
|
76
|
-
expect(obj).to be_a(Faraday::Connection)
|
77
|
-
expect(obj.builder.handlers)
|
78
|
-
.to eq([Faraday::Adapter::NetHttp])
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
72
|
end
|
data/tessa.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
24
24
|
spec.require_paths = ["lib"]
|
25
25
|
|
26
|
-
spec.add_dependency "faraday"
|
26
|
+
spec.add_dependency "faraday"
|
27
27
|
spec.add_dependency "virtus", "~>1.0.4"
|
28
28
|
|
29
29
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/yarn.lock
CHANGED
@@ -415,11 +415,6 @@ doctrine@^2.1.0:
|
|
415
415
|
dependencies:
|
416
416
|
esutils "^2.0.2"
|
417
417
|
|
418
|
-
dropzone@^4:
|
419
|
-
version "4.3.0"
|
420
|
-
resolved "https://registry.yarnpkg.com/dropzone/-/dropzone-4.3.0.tgz#48b0b8f2ad092872e4b535b672a7c3f1a1d67c91"
|
421
|
-
integrity sha512-KAP4sc9wjaU5xLhZ7olSH1ni72IbXk2l9iF9Ai5p3slwDtKTJunKkQpdFg7voyOcUU+6j75xEhHh+yPqd/Z/PA==
|
422
|
-
|
423
418
|
es-abstract@^1.19.0, es-abstract@^1.19.1, es-abstract@^1.19.2, es-abstract@^1.19.5:
|
424
419
|
version "1.20.1"
|
425
420
|
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.1.tgz#027292cd6ef44bd12b1913b828116f54787d1814"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tessa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Powell
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-06-
|
12
|
+
date: 2022-06-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: '
|
20
|
+
version: '0'
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
|
-
- - "
|
25
|
+
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: '
|
27
|
+
version: '0'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: virtus
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -262,9 +262,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
262
262
|
version: '2.3'
|
263
263
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
264
264
|
requirements:
|
265
|
-
- - "
|
265
|
+
- - ">="
|
266
266
|
- !ruby/object:Gem::Version
|
267
|
-
version:
|
267
|
+
version: '0'
|
268
268
|
requirements: []
|
269
269
|
rubygems_version: 3.0.3.1
|
270
270
|
signing_key:
|