@whitewall/blip-warehouse 0.0.4 → 0.0.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.
package/package.json CHANGED
@@ -1,21 +1,23 @@
1
1
  {
2
- "name": "@whitewall/blip-warehouse",
3
- "version": "0.0.4",
4
- "exports": {
5
- "import": "./dist/index.js",
6
- "require": "./dist/index.cjs",
7
- "types": "./dist/api/src/index.d.ts"
8
- },
9
- "files": [
10
- "dist"
11
- ],
12
- "scripts": {
13
- "build": "rolldown --config rolldown.config.ts && tsc --emitDeclarationOnly",
14
- "dev": "rolldown --config rolldown.config.ts --watch"
15
- },
16
- "dependencies": {},
17
- "devDependencies": {
18
- "rolldown": "1.0.0-beta.52",
19
- "typescript": "5.9.3"
20
- }
21
- }
2
+ "name": "@whitewall/blip-warehouse",
3
+ "version": "0.0.5",
4
+ "exports": {
5
+ "import": "./dist/esm/index.js",
6
+ "require": "./dist/cjs/index.js",
7
+ "types": "./dist/api/src/index.d.ts"
8
+ },
9
+ "files": [
10
+ "dist"
11
+ ],
12
+ "scripts": {
13
+ "build": "rolldown --config rolldown.config.ts && tsc --emitDeclarationOnly",
14
+ "dev": "rolldown --config rolldown.config.ts --watch"
15
+ },
16
+ "dependencies": {
17
+ "undici": "7.16.0"
18
+ },
19
+ "devDependencies": {
20
+ "rolldown": "1.0.0-beta.52",
21
+ "typescript": "5.9.3"
22
+ }
23
+ }
package/dist/index.cjs DELETED
@@ -1,62 +0,0 @@
1
-
2
- //#region src/client.ts
3
- var BlipWarehouseClient = class {
4
- baseUrl;
5
- token;
6
- constructor(config) {
7
- this.baseUrl = config.baseUrl?.replace(/\/$/, "") ?? "https://api.warehouse.whitewall.dev";
8
- this.token = config.token;
9
- }
10
- async getContactsCount() {
11
- return (await this.request("/warehouse/contacts")).count;
12
- }
13
- async search(request) {
14
- return this.request("/warehouse/search", {
15
- method: "POST",
16
- body: JSON.stringify({
17
- query: request.query,
18
- limit: request.limit ?? 10,
19
- cursor: request.cursor
20
- })
21
- });
22
- }
23
- async getMessagesByIdentity(identity, options = {}) {
24
- const params = new URLSearchParams();
25
- if (options.limit !== void 0) params.append("limit", options.limit.toString());
26
- if (options.cursor) params.append("cursor", options.cursor);
27
- const queryString = params.toString();
28
- const path = `/warehouse/contacts/${encodeURIComponent(identity)}/messages${queryString ? `?${queryString}` : ""}`;
29
- return this.request(path);
30
- }
31
- async createToken(request) {
32
- return this.request("/auth/tokens", {
33
- method: "POST",
34
- body: JSON.stringify(request)
35
- });
36
- }
37
- async historicalIngest(request) {
38
- return this.request("/blip/historical-ingest", {
39
- method: "POST",
40
- body: JSON.stringify(request)
41
- });
42
- }
43
- async request(path, options = {}) {
44
- const url = `${this.baseUrl}${path}`;
45
- const response = await fetch(url, {
46
- ...options,
47
- headers: {
48
- "Content-Type": "application/json",
49
- Authorization: `Bearer ${this.token}`,
50
- ...options.headers
51
- }
52
- });
53
- if (!response.ok) {
54
- const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
55
- throw new Error(`API request failed: ${response.status} ${response.statusText} - ${JSON.stringify(errorData)}`);
56
- }
57
- return response.json();
58
- }
59
- };
60
-
61
- //#endregion
62
- exports.BlipWarehouseClient = BlipWarehouseClient;
package/dist/index.js DELETED
@@ -1,61 +0,0 @@
1
- //#region src/client.ts
2
- var BlipWarehouseClient = class {
3
- baseUrl;
4
- token;
5
- constructor(config) {
6
- this.baseUrl = config.baseUrl?.replace(/\/$/, "") ?? "https://api.warehouse.whitewall.dev";
7
- this.token = config.token;
8
- }
9
- async getContactsCount() {
10
- return (await this.request("/warehouse/contacts")).count;
11
- }
12
- async search(request) {
13
- return this.request("/warehouse/search", {
14
- method: "POST",
15
- body: JSON.stringify({
16
- query: request.query,
17
- limit: request.limit ?? 10,
18
- cursor: request.cursor
19
- })
20
- });
21
- }
22
- async getMessagesByIdentity(identity, options = {}) {
23
- const params = new URLSearchParams();
24
- if (options.limit !== void 0) params.append("limit", options.limit.toString());
25
- if (options.cursor) params.append("cursor", options.cursor);
26
- const queryString = params.toString();
27
- const path = `/warehouse/contacts/${encodeURIComponent(identity)}/messages${queryString ? `?${queryString}` : ""}`;
28
- return this.request(path);
29
- }
30
- async createToken(request) {
31
- return this.request("/auth/tokens", {
32
- method: "POST",
33
- body: JSON.stringify(request)
34
- });
35
- }
36
- async historicalIngest(request) {
37
- return this.request("/blip/historical-ingest", {
38
- method: "POST",
39
- body: JSON.stringify(request)
40
- });
41
- }
42
- async request(path, options = {}) {
43
- const url = `${this.baseUrl}${path}`;
44
- const response = await fetch(url, {
45
- ...options,
46
- headers: {
47
- "Content-Type": "application/json",
48
- Authorization: `Bearer ${this.token}`,
49
- ...options.headers
50
- }
51
- });
52
- if (!response.ok) {
53
- const errorData = await response.json().catch(() => ({ error: "Unknown error" }));
54
- throw new Error(`API request failed: ${response.status} ${response.statusText} - ${JSON.stringify(errorData)}`);
55
- }
56
- return response.json();
57
- }
58
- };
59
-
60
- //#endregion
61
- export { BlipWarehouseClient };