pangea-server 3.3.161 → 3.3.163

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.
@@ -11,6 +11,5 @@ export * from './models';
11
11
  export * from './base-service.class';
12
12
  export * from './database.types';
13
13
  export * from './db-client';
14
- export * from './db.class';
15
14
  export * from './seed.helpers';
16
15
  export * from './use-auto-commit';
@@ -24,6 +24,5 @@ __exportStar(require("./models"), exports);
24
24
  __exportStar(require("./base-service.class"), exports);
25
25
  __exportStar(require("./database.types"), exports);
26
26
  __exportStar(require("./db-client"), exports);
27
- __exportStar(require("./db.class"), exports);
28
27
  __exportStar(require("./seed.helpers"), exports);
29
28
  __exportStar(require("./use-auto-commit"), exports);
@@ -7,6 +7,7 @@ export * from './file-storage.helpers';
7
7
  export * from './gemini.helpers';
8
8
  export * from './google.helpers';
9
9
  export * from './html-sanitize.helpers';
10
+ export * from './instagram.helpers';
10
11
  export * from './job.helpers';
11
12
  export * from './mailer.helpers';
12
13
  export * from './multer.helpers';
@@ -23,6 +23,7 @@ __exportStar(require("./file-storage.helpers"), exports);
23
23
  __exportStar(require("./gemini.helpers"), exports);
24
24
  __exportStar(require("./google.helpers"), exports);
25
25
  __exportStar(require("./html-sanitize.helpers"), exports);
26
+ __exportStar(require("./instagram.helpers"), exports);
26
27
  __exportStar(require("./job.helpers"), exports);
27
28
  __exportStar(require("./mailer.helpers"), exports);
28
29
  __exportStar(require("./multer.helpers"), exports);
@@ -0,0 +1,9 @@
1
+ export declare class Instagram {
2
+ private __accountId;
3
+ private __accessToken;
4
+ constructor(config: {
5
+ accountId: string;
6
+ accessToken: string;
7
+ });
8
+ sendText(to: string, text: string): Promise<any>;
9
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Instagram = void 0;
4
+ const GRAPH_VERSION = 'v21.0';
5
+ class Instagram {
6
+ constructor(config) {
7
+ this.__accountId = config.accountId;
8
+ this.__accessToken = config.accessToken;
9
+ }
10
+ async sendText(to, text) {
11
+ const response = await fetch(`https://graph.facebook.com/${GRAPH_VERSION}/${this.__accountId}/messages`, {
12
+ method: 'POST',
13
+ headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${this.__accessToken}` },
14
+ body: JSON.stringify({ recipient: { id: to }, message: { text } }),
15
+ });
16
+ const data = await response.json();
17
+ if (!response.ok)
18
+ throw new Error(`instagram sendText failed: ${JSON.stringify(data)}`);
19
+ return data;
20
+ }
21
+ }
22
+ exports.Instagram = Instagram;
@@ -1,9 +1,9 @@
1
1
  export declare class Whatsapp {
2
+ private __phoneNumberId;
2
3
  private __accessToken;
3
- private __phoneNumber;
4
4
  constructor(config: {
5
+ phoneNumberId: string;
5
6
  accessToken: string;
6
- phoneNumber: string;
7
7
  });
8
8
  sendText(to: string, text: string): Promise<import("@whatsapp-cloudapi/types/cloudapi", { with: { "resolution-mode": "import" } }).CloudAPIResponse>;
9
9
  }
@@ -7,11 +7,11 @@ exports.Whatsapp = void 0;
7
7
  const client_1 = __importDefault(require("@whatsapp-cloudapi/client"));
8
8
  class Whatsapp {
9
9
  constructor(config) {
10
+ this.__phoneNumberId = config.phoneNumberId;
10
11
  this.__accessToken = config.accessToken;
11
- this.__phoneNumber = config.phoneNumber;
12
12
  }
13
13
  sendText(to, text) {
14
- return client_1.default.sendTextMessage({ accessToken: this.__accessToken, from: this.__phoneNumber, to, text });
14
+ return client_1.default.sendTextMessage({ from: this.__phoneNumberId, to, text, accessToken: this.__accessToken });
15
15
  }
16
16
  }
17
17
  exports.Whatsapp = Whatsapp;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pangea-server",
3
3
  "description": "",
4
- "version": "3.3.161",
4
+ "version": "3.3.163",
5
5
  "engines": {
6
6
  "node": "22.14.0"
7
7
  },