aeria-sdk 0.0.159 → 0.0.161

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/dist/upload.d.ts CHANGED
@@ -6,5 +6,5 @@ type UploadParams = {
6
6
  content: unknown;
7
7
  format?: 'raw' | 'base64';
8
8
  };
9
- export declare const uploader: (config: InstanceConfig) => (bearerToken?: string) => (collectionName: string, params: UploadParams) => Promise<Result.Either<EndpointError, TempId>>;
9
+ export declare const uploader: (config: InstanceConfig) => (bearerToken?: string) => (collectionName: keyof Collections, params: UploadParams) => Promise<Result.Either<EndpointError, TempId>>;
10
10
  export {};
package/dist/upload.js CHANGED
@@ -1,16 +1,23 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.uploader = void 0;
4
+ const querystring = require("node:querystring");
4
5
  const http_js_1 = require("./http.js");
5
6
  const utils_js_1 = require("./utils.js");
6
7
  const uploader = (config) => (bearerToken) => async (collectionName, params) => {
7
- const url = `${(0, utils_js_1.publicUrl)(config)}/${collectionName}/upload?name=${params.name}&format=${params.format || 'raw'}`;
8
+ const qs = querystring.encode({
9
+ name: params.name,
10
+ format: params.format || 'raw',
11
+ });
12
+ const url = `${(0, utils_js_1.publicUrl)(config)}/${collectionName}/upload?${qs}`;
13
+ const headers = {
14
+ 'x-stream-request': '1',
15
+ 'content-type': params.type,
16
+ };
8
17
  const requestConfig = {
9
18
  params: {
10
- headers: {
11
- 'x-stream-request': '1',
12
- 'content-type': params.type,
13
- },
19
+ method: 'POST',
20
+ headers,
14
21
  },
15
22
  };
16
23
  if (bearerToken) {
package/dist/upload.mjs CHANGED
@@ -1,14 +1,21 @@
1
1
  "use strict";
2
+ import * as querystring from "node:querystring";
2
3
  import { request } from "./http.mjs";
3
4
  import { publicUrl } from "./utils.mjs";
4
5
  export const uploader = (config) => (bearerToken) => async (collectionName, params) => {
5
- const url = `${publicUrl(config)}/${collectionName}/upload?name=${params.name}&format=${params.format || "raw"}`;
6
+ const qs = querystring.encode({
7
+ name: params.name,
8
+ format: params.format || "raw"
9
+ });
10
+ const url = `${publicUrl(config)}/${collectionName}/upload?${qs}`;
11
+ const headers = {
12
+ "x-stream-request": "1",
13
+ "content-type": params.type
14
+ };
6
15
  const requestConfig = {
7
16
  params: {
8
- headers: {
9
- "x-stream-request": "1",
10
- "content-type": params.type
11
- }
17
+ method: "POST",
18
+ headers
12
19
  }
13
20
  };
14
21
  if (bearerToken) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aeria-sdk",
3
- "version": "0.0.159",
3
+ "version": "0.0.161",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -47,8 +47,8 @@
47
47
  "@aeriajs/types": "link:../types"
48
48
  },
49
49
  "peerDependencies": {
50
- "@aeriajs/common": "^0.0.126",
51
- "@aeriajs/types": "^0.0.108"
50
+ "@aeriajs/common": "^0.0.127",
51
+ "@aeriajs/types": "^0.0.109"
52
52
  },
53
53
  "scripts": {
54
54
  "test": "echo skipping",