Skip to content

Commit ef2ddbc

Browse files
authored
Merge pull request #143 from caltechlibrary/v2
V2 merge
2 parents 16ff323 + 0a2cb0f commit ef2ddbc

30 files changed

+57
-53
lines changed

CITATION.cff

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ contacts:
2525
email: tmorrell@caltech.edu
2626

2727
repository-code: "https://github.com/caltechlibrary/dataset"
28-
version: 2.2.4
29-
date-released: 2025-04-18
28+
version: 2.2.6
29+
date-released: 2025-06-02
3030

3131
license-url: "https://caltechlibrary.github.io/dataset/LICENSE"
3232
keywords:
33-
- GitHub
3433
- metadata
3534
- data
3635
- software

about.html

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,9 @@
2424

2525
<section>
2626
<h1 id="about-this-software">About this software</h1>
27-
<h2 id="dataset-2.2.4">dataset 2.2.4</h2>
28-
<p>Added the following functions to the dataset package</p>
29-
<ul>
30-
<li>(c *Collection) KeysJSON</li>
31-
<li>(c *Collection) UpdatedKeysJSON</li>
32-
<li>(c *Collection) QueryJSON</li>
33-
</ul>
34-
<p>These provide JSON encoded object support for their base
35-
functions.</p>
27+
<h2 id="dataset-2.2.6">dataset 2.2.6</h2>
28+
<p>Fix runtime error, issue 142. Added cors setting when serving
29+
JavaScript files.</p>
3630
<h3 id="authors">Authors</h3>
3731
<ul>
3832
<li>R. S. Doiel, <a href="https://orcid.org/0000-0003-0900-6903"
@@ -60,11 +54,12 @@ <h3 id="maintainers">Maintainers</h3>
6054
<h3 id="programming-languages">Programming languages</h3>
6155
<ul>
6256
<li>Go</li>
57+
<li>SQL</li>
6358
</ul>
6459
<h3 id="software-requirements">Software Requirements</h3>
6560
<ul>
66-
<li>Golang &gt;= 1.24.2</li>
67-
<li>CMTOlls &gt;= 0.0.20</li>
61+
<li>Golang &gt;= 1.24.3</li>
62+
<li>CMTools &gt;= 0.0.29</li>
6863
<li>Pandoc &gt;= 3.1</li>
6964
<li>GNU Make &gt;= 3.8</li>
7065
</ul>

about.md

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,28 @@ maintainer:
1919
id: https://orcid.org/0000-0001-9266-5146
2020

2121
repository_code: https://github.com/caltechlibrary/dataset
22-
version: 2.2.4
22+
version: 2.2.6
2323
license_url: https://caltechlibrary.github.io/dataset/LICENSE
2424

2525
programming_language:
2626
- Go
27+
- SQL
2728

2829
keywords:
29-
- GitHub
3030
- metadata
3131
- data
3232
- software
3333
- json
3434

35-
date_released: 2025-04-18
35+
date_released: 2025-06-02
3636
---
3737

3838
About this software
3939
===================
4040

41-
## dataset 2.2.4
41+
## dataset 2.2.6
4242

43-
Added the following functions to the dataset package
44-
45-
- (c *Collection) KeysJSON
46-
- (c *Collection) UpdatedKeysJSON
47-
- (c *Collection) QueryJSON
48-
49-
These provide JSON encoded object support for their base functions.
43+
Fix runtime error, issue 142. Added cors setting when serving JavaScript files.
5044

5145
### Authors
5246

@@ -71,14 +65,15 @@ Tools for working with JSON documents as a collection hosted on the file system
7165
### Programming languages
7266

7367
- Go
68+
- SQL
7469

7570

7671

7772

7873
### Software Requirements
7974

80-
- Golang &gt;&#x3D; 1.24.2
81-
- CMTOlls &gt;&#x3D; 0.0.20
75+
- Golang &gt;&#x3D; 1.24.3
76+
- CMTools &gt;&#x3D; 0.0.29
8277
- Pandoc &gt;&#x3D; 3.1
8378
- GNU Make &gt;&#x3D; 3.8
8479

api.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ type API struct {
7373

7474
var (
7575
settings *Settings
76+
debug bool
7677
)
7778

7879
// hasDotPath checks to see if a path is requested with a dot file (e.g. docs/.git/* or docs/.htaccess)
@@ -119,9 +120,19 @@ func staticRouter(next http.Handler) http.Handler {
119120
}
120121
// See if we need to set a header of JavaScript or TypeScript files.
121122
if strings.HasSuffix(r.URL.Path, ".js") || strings.HasSuffix(r.URL.Path, ".mjs") {
123+
if (debug) {
124+
log.Printf("DEBUG Response Header %s = %q", "Content-Type", "application/javascript; charset=utf-8")
125+
}
126+
w.Header().Set("Referrer-Policy", "no-referrer-when-downgrade") // or any other value you prefer
127+
w.Header().Set("Access-Control-Allow-Origin", "*")
122128
w.Header().Add("Content-Type", "application/javascript; charset=utf-8")
123129
}
124130
if strings.HasSuffix(r.URL.Path, ".ts") {
131+
if (debug) {
132+
log.Printf("DEBUG Response Header %s = %q", "Content-Type", "application/typescript; charset=utf-8")
133+
}
134+
w.Header().Set("Referrer-Policy", "no-referrer-when-downgrade") // or any other value you prefer
135+
w.Header().Set("Access-Control-Allow-Origin", "*")
125136
w.Header().Add("Content-Type", "application/typescript; charset=utf-8")
126137
}
127138
// If we make it this far, fall back to the default handler
@@ -179,6 +190,7 @@ func (api *API) WebService() error {
179190
api.Router(w, r)
180191
})
181192
if api.Settings.Htdocs != "" {
193+
debug = api.Debug
182194
mux.Handle("/", staticRouter(http.FileServer(http.Dir(api.Settings.Htdocs))))
183195
}
184196
log.Printf("%s start, listening on %s", api.AppName, api.Settings.Host)

api_routes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ func Create(w http.ResponseWriter, r *http.Request, api *API, cName string, verb
408408
default:
409409
//NOTE: Need to know the form field names, this is in .Model
410410
r.ParseForm()
411-
idName = c.Model.GetPrimaryId()
412411
if c.Model == nil {
413412
if api.Debug {
414413
log.Printf("DEBUG c.Model is nil, accept all fields without validation")
@@ -418,6 +417,7 @@ func Create(w http.ResponseWriter, r *http.Request, api *API, cName string, verb
418417
}
419418
} else {
420419
// NOTE: We only want to grab the fields defined in the model!!
420+
idName = c.Model.GetPrimaryId()
421421
if api.Debug {
422422
log.Printf("DEBUG c.Model is populated, validating model's fields")
423423
}

codemeta.json

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@
5050
"email": "tmorrell@caltech.edu"
5151
}
5252
],
53-
"dateModified": "2025-04-18",
54-
"datePublished": "2025-04-18",
53+
"dateCreated": "2016-09-12",
54+
"dateModified": "2025-06-02",
55+
"datePublished": "2025-06-02",
5556
"description": "Tools for working with JSON documents as a collection hosted on the file system or SQL JSON store",
5657
"funder": [
5758
{
@@ -61,7 +62,6 @@
6162
}
6263
],
6364
"keywords": [
64-
"GitHub",
6565
"metadata",
6666
"data",
6767
"software",
@@ -70,17 +70,20 @@
7070
"name": "dataset",
7171
"license": "https://caltechlibrary.github.io/dataset/LICENSE",
7272
"programmingLanguage": [
73-
"Go"
73+
"Go",
74+
"SQL"
7475
],
7576
"softwareRequirements": [
76-
"Golang >= 1.24.2",
77-
"CMTOlls >= 0.0.20",
77+
"Golang >= 1.24.3",
78+
"CMTools >= 0.0.29",
7879
"Pandoc >= 3.1",
7980
"GNU Make >= 3.8"
8081
],
81-
"version": "2.2.4",
82+
"version": "2.2.6",
8283
"developmentStatus": "active",
8384
"issueTracker": "https://github.com/caltechlibrary/dataset/issues",
8485
"downloadUrl": "https://github.com/caltechlibrary/dataset/archives/main.zip",
85-
"releaseNotes": "Added the following functions to the dataset package\n\n- (c *Collection) KeysJSON\n- (c *Collection) UpdatedKeysJSON\n- (c *Collection) QueryJSON\n\nThese provide JSON encoded object support for their base functions."
86+
"releaseNotes": "Fix runtime error, issue 142. Added cors setting when serving JavaScript files.",
87+
"copyrightYear": 2025,
88+
"copyrightHolder": "California Institute of Technology"
8689
}

dataset.1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ <h1 id="examples">EXAMPLES</h1>
242242
and DB_NAME is used for the Postgres database name. The sslmode option
243243
was specified because Postgres in this example was restricted to
244244
localhost on a single user machine.</p>
245-
<p>dataset 2.2.4</p>
245+
<p>dataset 2.2.6</p>
246246
</section>
247247

248248
<footer>

dataset.1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
%dataset(1) user manual | version 2.2.4 0f027f2
1+
%dataset(1) user manual | version 2.2.6 5fd165d
22
% R. S. Doiel and Tom Morrell
3-
% 2025-04-18
3+
% 2025-06-02
44

55
# NAME
66

@@ -218,6 +218,6 @@ database name. The sslmode option was specified because Postgres
218218
in this example was restricted to localhost on a single user machine.
219219

220220

221-
dataset 2.2.4
221+
dataset 2.2.6
222222

223223

datasetd.1.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ <h1 id="examples">EXAMPLES</h1>
233233
<pre><code> curl http://localhost:8485/api/t1.ds/keys</code></pre>
234234
<p>In the shell session where datasetd is running press “ctr-C” to
235235
terminate the service.</p>
236-
<p>datasetd 2.2.4</p>
236+
<p>datasetd 2.2.6</p>
237237
</section>
238238

239239
<footer>

datasetd.1.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
%datasetd(1) user manual | version 2.2.4 0f027f2
1+
%datasetd(1) user manual | version 2.2.6 5fd165d
22
% R. S. Doiel
3-
% 2025-04-18
3+
% 2025-06-02
44

55
# NAME
66

@@ -222,6 +222,6 @@ In the shell session where datasetd is running press "ctr-C"
222222
to terminate the service.
223223

224224

225-
datasetd 2.2.4
225+
datasetd 2.2.6
226226

227227

0 commit comments

Comments
 (0)