@ai-appforge/react-native 1.0.0 → 1.0.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/dist/client.d.ts CHANGED
@@ -1,10 +1,14 @@
1
- import { WorkflowsModule } from '@ai-appforge/core';
1
+ import { WorkflowsModule, ActivityModule } from '@ai-appforge/core';
2
2
  export declare class AiAppForgeClient {
3
3
  private baseUrl;
4
4
  private apiKey;
5
+ private authToken?;
5
6
  workflows: WorkflowsModule;
6
- constructor(options: {
7
- apiKey: string;
7
+ activity: ActivityModule;
8
+ constructor(options?: {
9
+ apiKey?: string;
10
+ baseUrl?: string;
11
+ authToken?: string;
8
12
  });
9
13
  private request;
10
14
  }
package/dist/client.js CHANGED
@@ -4,12 +4,14 @@ exports.AiAppForgeClient = void 0;
4
4
  const core_1 = require("@ai-appforge/core");
5
5
  class AiAppForgeClient {
6
6
  constructor(options) {
7
- this.baseUrl = process.env.AI_APP_FORGE_BASE_URL || 'http://localhost:3001';
7
+ this.baseUrl = options?.baseUrl || process.env.AI_APP_FORGE_BASE_URL || 'http://localhost:3001';
8
8
  // Remove trailing slash from baseUrl if present
9
9
  this.baseUrl = this.baseUrl.replace(/\/$/, '');
10
10
  this.apiKey = options?.apiKey || process.env.AI_APP_FORGE_API_KEY || '';
11
+ this.authToken = options?.authToken;
11
12
  // Initialize modules
12
13
  this.workflows = new core_1.WorkflowsModule(this.request.bind(this));
14
+ this.activity = new core_1.ActivityModule(this.request.bind(this));
13
15
  }
14
16
  async request(endpoint, options) {
15
17
  const headers = {
@@ -19,6 +21,9 @@ class AiAppForgeClient {
19
21
  if (this.apiKey) {
20
22
  headers['x-api-key'] = this.apiKey;
21
23
  }
24
+ if (this.authToken) {
25
+ headers['Authorization'] = `Bearer ${this.authToken}`;
26
+ }
22
27
  const res = await fetch(`${this.baseUrl}${endpoint}`, {
23
28
  ...options,
24
29
  headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-appforge/react-native",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "React Native SDK for AI App Forge",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/client.ts CHANGED
@@ -1,20 +1,24 @@
1
- import { WorkflowsModule, APIError } from '@ai-appforge/core';
1
+ import { WorkflowsModule, APIError, ActivityModule } from '@ai-appforge/core';
2
2
 
3
3
  export class AiAppForgeClient {
4
4
  private baseUrl: string;
5
5
  private apiKey: string;
6
+ private authToken?: string;
6
7
 
7
8
  public workflows: WorkflowsModule;
9
+ public activity: ActivityModule;
8
10
 
9
- constructor(options: { apiKey: string }) {
10
- this.baseUrl = process.env.AI_APP_FORGE_BASE_URL || 'http://localhost:3001';
11
+ constructor(options?: { apiKey?: string; baseUrl?: string; authToken?: string }) {
12
+ this.baseUrl = options?.baseUrl || process.env.AI_APP_FORGE_BASE_URL || 'http://localhost:3001';
11
13
  // Remove trailing slash from baseUrl if present
12
14
  this.baseUrl = this.baseUrl.replace(/\/$/, '');
13
15
 
14
16
  this.apiKey = options?.apiKey || process.env.AI_APP_FORGE_API_KEY || '';
17
+ this.authToken = options?.authToken;
15
18
 
16
19
  // Initialize modules
17
20
  this.workflows = new WorkflowsModule(this.request.bind(this));
21
+ this.activity = new ActivityModule(this.request.bind(this));
18
22
  }
19
23
 
20
24
 
@@ -28,6 +32,10 @@ export class AiAppForgeClient {
28
32
  headers['x-api-key'] = this.apiKey;
29
33
  }
30
34
 
35
+ if (this.authToken) {
36
+ headers['Authorization'] = `Bearer ${this.authToken}`;
37
+ }
38
+
31
39
  const res = await fetch(`${this.baseUrl}${endpoint}`, {
32
40
  ...options,
33
41
  headers,