marcattacks 1.0.0

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/Dockerfile ADDED
@@ -0,0 +1,23 @@
1
+ FROM node:20
2
+
3
+ WORKDIR /app
4
+
5
+ COPY package*.json ./
6
+
7
+ RUN npm install
8
+
9
+ FROM node:20-alpine3.20
10
+
11
+ ENV NODE_ENV=production
12
+
13
+ WORKDIR /app
14
+
15
+ COPY package*.json ./
16
+
17
+ COPY --from=0 /app/node_modules /app/node_modules
18
+
19
+ COPY . .
20
+
21
+ ENTRYPOINT [ "node","dist/index.js" ]
22
+
23
+ CMD [ "--help"]
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Patrick Hochstenbach
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,39 @@
1
+ # Docker
2
+
3
+ ## Build marcattacks
4
+
5
+ Build a version of a docker image:
6
+
7
+ ```
8
+ docker build . -t hochstenbach/marcattacks:v0.0.1
9
+ ```
10
+
11
+ Run a docker image:
12
+
13
+ ```
14
+ docker run --rm -v `pwd`/data:/app/data -it hochstenbach/marcattacks:v0.0.1 --rdf data/sample.xml
15
+ ```
16
+
17
+ Push it to DockerHub:
18
+
19
+ ```
20
+ docker push hochstenbach/marcattacks:v0.0.1
21
+ ```
22
+
23
+ ### S3 development
24
+
25
+ Start S3 service:
26
+
27
+ ```
28
+ docker compose up -d
29
+ ```
30
+
31
+ Stop everything:
32
+
33
+ ```
34
+ docker compose down
35
+ ```
36
+
37
+ Connect to the admin interface: http://localhost:3372/login
38
+
39
+ Username/password: minioadmin/minioadmin
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # marcattacks!
2
+
3
+ <img src="logo.jpg" width="10%">
4
+
5
+ Turn your MARC exports into something else.
6
+
7
+
8
+ ## Build
9
+
10
+ ```
11
+ npm install
12
+ ```
13
+
14
+ ```
15
+ npm run build:ts
16
+ ```
17
+
18
+ ```
19
+ npm link
20
+ ```
21
+
22
+ ### Run
23
+
24
+ Generate JSON:
25
+
26
+ ```
27
+ marcattacks --to json <file>
28
+ ```
29
+
30
+ Generate Aleph sequential:
31
+
32
+ ```
33
+ marcattacks --to alephseq <file>
34
+ ```
35
+
36
+ Generate RDF:
37
+
38
+ ```
39
+ marcattacks --to rdf --map rdf <file>
40
+ ```
41
+
42
+ Generate XML:
43
+
44
+ ```
45
+ marcattacks --to xml <file>
46
+ ```
47
+
48
+ Transform the MARC input using a [JSONata](https://docs.jsonata.org/overview.html) expression or file:
49
+
50
+ ```
51
+ marcattacks <file> --fix ./demo/demo.jsonata
52
+ ```
53
+
54
+ ## Remote files
55
+
56
+ A remote SFTP path:
57
+
58
+ ```
59
+ marcattacks --key ~/.ssh/privatekey sftp://username@hostname:port/remote/path
60
+ ```
61
+
62
+ The latest XML file in a remote SFTP:
63
+
64
+ ```
65
+ marcattacks --key ~/.ssh/privatekey sftp://username@hostname:port/remote/path/@latest:xml
66
+ ```
67
+
68
+ An HTTP path
69
+
70
+ ```
71
+ marcattacks http://somewhere.org/data.xml
72
+ ```
73
+
74
+ An S3 path
75
+
76
+ ```
77
+ marcattacks s3://accessKey:secretKey@host:port/bucket/key
78
+ ```
79
+
80
+ use `s3s://...` for using a SSL layer.
81
+
82
+ ## Formats
83
+
84
+ ### Input (--from)
85
+
86
+ - xml
87
+ - alephseq (Aleph sequential)
88
+ - json
89
+ - jsonl
90
+
91
+ ### Output (--to)
92
+
93
+ - xml
94
+ - alephseq (Aleph sequential)
95
+ - json
96
+ - jsonl
97
+ - rdf
98
+
99
+ ### Transform (--map)
100
+
101
+ - rdf
102
+
103
+ Provide your own transformers using JavaScript plugins. See: ./plugin/demo.js for an example.
104
+
105
+ ### Writable (--out)
106
+
107
+ - _default_: stdout
108
+ - _file path_
109
+ - sftp://username@host:port/path
110
+ - s3://accessKey:secretKey@host:port/bucket/key (or s3s://)
111
+
package/TYPESCRIPT.txt ADDED
@@ -0,0 +1,6 @@
1
+ npm init -y && npm i -D typescript ts-node eslint prettier @types/node && npx tsc --init
2
+
3
+ tsconfig.json:
4
+ - uncomment rootDir, outDir
5
+
6
+ npx tsc