dxfl 0.5.5 → 0.6.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dxfl",
3
- "version": "0.5.5",
3
+ "version": "0.6.1",
4
4
  "description": "",
5
5
  "license": "EUPL-1.2",
6
6
  "author": "Deuxfleurs Team <coucou@deuxfleurs.fr>",
@@ -23,7 +23,7 @@
23
23
  "prettier-check": "npx prettier . --check"
24
24
  },
25
25
  "dependencies": {
26
- "@aws-sdk/client-s3": "^3.1012.0",
26
+ "@aws-sdk/client-s3": "^3.1014.0",
27
27
  "@commander-js/extra-typings": "^14.0.0",
28
28
  "@supercharge/promise-pool": "^3.2.0",
29
29
  "@types/node": "^25.2.1",
@@ -32,9 +32,9 @@
32
32
  "fast-uri": "^3.1.0",
33
33
  "guichet-sdk-ts": "^0.1.0",
34
34
  "mime": "^4.1.0",
35
- "picomatch": "^4.0.3",
35
+ "picomatch": "^4.0.4",
36
36
  "read": "^5.0.1",
37
- "smol-toml": "^1.6.0",
37
+ "smol-toml": "^1.6.1",
38
38
  "typescript": "^5.9.3",
39
39
  "zod": "^3.24.4",
40
40
  "zod-validation-error": "^3.4.1"
@@ -42,10 +42,5 @@
42
42
  "devDependencies": {
43
43
  "onchange": "^7.1.0",
44
44
  "prettier": "3.5.3"
45
- },
46
- "overrides": {
47
- "@aws-sdk/xml-builder": {
48
- "fast-xml-parser": "^5.5.6"
49
- }
50
45
  }
51
46
  }
package/deuxfleurs.toml DELETED
@@ -1,18 +0,0 @@
1
- error_page = "error.html"
2
-
3
- # [[redirects]]
4
- # from = "TinyCorePure64-15.0.iso"
5
- # to = "/bbc"
6
-
7
- [[redirects]]
8
- from = "/a"
9
- to = "/def"
10
-
11
- [[cors]]
12
- allowed_origins = "foo"
13
-
14
- [[headers]]
15
- for = ["**/*.txt"]
16
- compress = "gzip"
17
- [headers.values]
18
- Cache-Control = "hello44"
@@ -1,108 +0,0 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- import { PromisePool } from "@supercharge/promise-pool";
11
- import { GetBucketWebsiteCommand, HeadObjectCommand, } from "@aws-sdk/client-s3";
12
- export function getBucketWebsite(client, Bucket) {
13
- return __awaiter(this, void 0, void 0, function* () {
14
- var _a, _b;
15
- const cmd = new GetBucketWebsiteCommand({ Bucket });
16
- const response = yield client.send(cmd);
17
- if (response.RedirectAllRequestsTo) {
18
- // NB: garage does not currently support RedirectAllRequestsTo so this should never happen
19
- throw `remote website configuration: RedirectAllRequestsTo is specified; \
20
- this is currently unsupported by dxfl`;
21
- }
22
- const index_page = (_a = response.ErrorDocument) === null || _a === void 0 ? void 0 : _a.Key;
23
- const error_page = (_b = response.IndexDocument) === null || _b === void 0 ? void 0 : _b.Suffix;
24
- let redirects = [];
25
- if (response.RoutingRules) {
26
- for (const rule of response.RoutingRules) {
27
- // If no Condition is specified, then the redirect always applies, which is equivalent
28
- // to matching on an empty prefix
29
- let prefix = "";
30
- let if_error = undefined;
31
- if (rule.Condition) {
32
- if (rule.Condition.HttpErrorCodeReturnedEquals) {
33
- if (rule.Condition.HttpErrorCodeReturnedEquals == "404") {
34
- if_error = 404;
35
- }
36
- else {
37
- // currently not supported by garage
38
- throw `remote website configuration: 'if_error' specified with a different \
39
- code than 404; this is currently unsupported by dxfl`;
40
- }
41
- }
42
- if (rule.Condition.KeyPrefixEquals) {
43
- prefix = rule.Condition.KeyPrefixEquals;
44
- }
45
- }
46
- const hostname = rule.Redirect.HostName;
47
- const code = rule.Redirect.HttpRedirectCode
48
- ? parseInt(rule.Redirect.HttpRedirectCode)
49
- : undefined;
50
- let protocol = undefined;
51
- if (rule.Redirect.Protocol) {
52
- if (rule.Redirect.Protocol == "http" ||
53
- rule.Redirect.Protocol == "https") {
54
- protocol = rule.Redirect.Protocol;
55
- }
56
- else {
57
- // currently not supported by garage
58
- throw `remote website configuration: 'protocol' is neither http or https; \
59
- this is currently unsupported by dxfl`;
60
- }
61
- }
62
- let to;
63
- if (rule.Redirect.ReplaceKeyPrefixWith) {
64
- to = {
65
- kind: "replace_prefix",
66
- prefix: rule.Redirect.ReplaceKeyPrefixWith,
67
- };
68
- }
69
- else if (rule.Redirect.ReplaceKeyWith) {
70
- to = { kind: "replace", target: rule.Redirect.ReplaceKeyWith };
71
- }
72
- else {
73
- // not completely sure whether this is the correct behavior, but it should
74
- // match garage's implementation
75
- to = { kind: "replace", target: "" };
76
- }
77
- redirects.push({
78
- kind: "bucket",
79
- r: { prefix, if_error, hostname, code, protocol, to },
80
- });
81
- }
82
- }
83
- return { index_page, error_page, redirects };
84
- });
85
- }
86
- // XXX
87
- const MD5METAFIELD = "dfl-md5sum";
88
- export function getBucketFilesDetails(client, Bucket, files) {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- let res = new Map();
91
- function doFile(file) {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- var _a;
94
- const resp = yield client.send(new HeadObjectCommand({ Bucket, Key: file }));
95
- if (resp.$metadata.httpStatusCode != 200) {
96
- // TODO: better error handling?
97
- throw resp;
98
- }
99
- res.set(file, {
100
- md5: (_a = resp.Metadata) === null || _a === void 0 ? void 0 : _a[MD5METAFIELD],
101
- redirect: resp.WebsiteRedirectLocation,
102
- });
103
- });
104
- }
105
- yield PromisePool.for(files).withConcurrency(50).process(doFile);
106
- return res;
107
- });
108
- }
package/dist/errors.js DELETED
@@ -1,7 +0,0 @@
1
- import { err } from "neverthrow";
2
- export function errMsg(msg) {
3
- return err({ kind: "msg", msg });
4
- }
5
- export function errS3(resp) {
6
- return err({ kind: "s3", resp: resp.$metadata });
7
- }
@@ -1 +0,0 @@
1
- toto
package/public/d/b DELETED
@@ -1,2 +0,0 @@
1
- b
2
- foo
package/public/d/c DELETED
@@ -1,2 +0,0 @@
1
- c
2
- foo
package/public/d/dd/bla DELETED
@@ -1 +0,0 @@
1
- bla
@@ -1 +0,0 @@
1
- test
package/public/def DELETED
@@ -1,2 +0,0 @@
1
- abc
2
- abc
package/public/error.html DELETED
@@ -1 +0,0 @@
1
- oops, 404 error!
package/public/index.html DELETED
@@ -1 +0,0 @@
1
- hello there! 花見 toto312
@@ -1 +0,0 @@
1
- hello there! 花見 toto2
package/public/slt DELETED
@@ -1 +0,0 @@
1
- abc
package/public/test.html DELETED
File without changes
package/public/toto.jpg DELETED
File without changes
package/public/toto.txt DELETED
@@ -1 +0,0 @@
1
- abc defuieu
package/public/toto2.txt DELETED
@@ -1 +0,0 @@
1
- abc