@opengis/fastify-table 2.4.3 → 2.4.5

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.
@@ -1,8 +1,9 @@
1
- export default function startUpload({ host, id, fileName, size, subdir, }: {
1
+ export default function startUpload({ host, id, fileName, size, subdir, originalFilename, }: {
2
2
  host?: string;
3
3
  id?: string;
4
4
  fileName: string;
5
5
  size: number;
6
6
  subdir?: string;
7
+ originalFilename?: boolean;
7
8
  }): Promise<any>;
8
9
  //# sourceMappingURL=startUpload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"startUpload.d.ts","sourceRoot":"","sources":["../../../../server/plugins/upload/startUpload.ts"],"names":[],"mappings":"AAoBA,wBAA8B,WAAW,CAAC,EACxC,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,MAAM,GACP,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,gBAyFA"}
1
+ {"version":3,"file":"startUpload.d.ts","sourceRoot":"","sources":["../../../../server/plugins/upload/startUpload.ts"],"names":[],"mappings":"AAoBA,wBAA8B,WAAW,CAAC,EACxC,IAAI,EACJ,EAAE,EACF,QAAQ,EACR,IAAI,EACJ,MAAM,EACN,gBAAwB,GACzB,EAAE;IACD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,gBA6FA"}
@@ -6,17 +6,21 @@ import getUploadStatus from "./getUploadStatus.js";
6
6
  import { prefix, fileDir, metaDir, uploadChunkDirectory, fetchTimeoutMs, } from "./index.js";
7
7
  import mimes from "../file/providers/mime/mimes.js";
8
8
  import { startUpload as startUploadS3 } from "./s3.js";
9
- import { BadRequestError } from "../../../errors.js";
9
+ import { BadRequestError, NotImplementedError } from "../../../errors.js";
10
10
  const { chunkSize = 5242880 } = config;
11
- export default async function startUpload({ host, id, fileName, size, subdir, }) {
11
+ export default async function startUpload({ host, id, fileName, size, subdir, originalFilename = false, }) {
12
12
  if (subdir && (typeof subdir !== "string" || subdir.includes(".."))) {
13
13
  throw BadRequestError("invalid params: subdir");
14
14
  }
15
+ if (originalFilename) {
16
+ throw NotImplementedError("currently not supported");
17
+ }
15
18
  if (!host) {
16
19
  const id1 = id || randomUUID();
17
20
  const extension = path.extname(fileName).substring(1);
21
+ const yearMonthDay = subdir ? "" : new Date().toISOString().split("T")[0];
18
22
  const relativeDirpath = path
19
- .join(uploadChunkDirectory, subdir || "")
23
+ .join(uploadChunkDirectory, subdir || "", yearMonthDay || "")
20
24
  .replace(/\\/g, "/");
21
25
  if (config.s3) {
22
26
  const filepath = path.posix.join(config.folder || "", relativeDirpath, `${id1}.${extension}`);
@@ -18,7 +18,7 @@ export default async function filterAPI(req, reply, iscalled) {
18
18
  table: params.table,
19
19
  }));
20
20
  const loadTable = await getTemplate("table", params.table);
21
- const { key, table, sql, query: tableQuery, form, extra, filterState, filterCustom, } = hookData || loadTable || {};
21
+ const { key, table = params.table, sql, query: tableQuery, form, extra, filterState, filterCustom, } = hookData || loadTable || {};
22
22
  if (!table) {
23
23
  throw NotFoundError("table not found");
24
24
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengis/fastify-table",
3
- "version": "2.4.3",
3
+ "version": "2.4.5",
4
4
  "type": "module",
5
5
  "description": "core-plugins",
6
6
  "keywords": [