@mybe/sdk 1.0.1 → 1.0.3

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/README.md CHANGED
@@ -50,7 +50,9 @@ const sdk = new MybeSDK({
50
50
 
51
51
  The SDK automatically detects the environment:
52
52
  - **Development** (`NODE_ENV=development`): Uses `http://localhost:3001/api/v1`
53
- - **Production**: Uses `https://api.mybe.app/api/v1`
53
+ - **Production**: Uses `https://fizsdck7l0.execute-api.us-east-1.amazonaws.com/dev/api/v1`
54
+
55
+ > **Note:** The production endpoint uses AWS API Gateway REST API with API key validation and automatic usage tracking.
54
56
 
55
57
  ### Custom Base URL (Optional)
56
58
 
package/dist/client.d.ts CHANGED
@@ -31,4 +31,15 @@ export declare class MybeSDK {
31
31
  * Get all content entries for a project
32
32
  */
33
33
  getContentByProject(projectId: string, options?: ContentFilterOptions): Promise<ContentListResponse>;
34
+ /**
35
+ * Get a single content entry by field value
36
+ * Similar to Contentful's getEntries with field filters
37
+ * @example
38
+ * // Get service by href field
39
+ * const service = await sdk.getContentByField('service-type-id', 'href', '/services/web-dev');
40
+ *
41
+ * // Get blog post by slug field
42
+ * const post = await sdk.getContentByField('blog-type-id', 'slug', 'my-first-post');
43
+ */
44
+ getContentByField(contentTypeId: string, fieldName: string, fieldValue: string): Promise<ContentEntry | null>;
34
45
  }
package/dist/client.js CHANGED
@@ -13,9 +13,10 @@ export class MybeSDK {
13
13
  else {
14
14
  const isDevelopment = typeof process !== 'undefined' &&
15
15
  process.env.NODE_ENV === 'development';
16
+ // Use REST API endpoint for production (with API key validation and usage tracking)
16
17
  this.baseUrl = isDevelopment
17
18
  ? 'http://localhost:3001/api/v1'
18
- : 'https://api.mybe.app/api/v1';
19
+ : 'https://fizsdck7l0.execute-api.us-east-1.amazonaws.com/dev/api/v1';
19
20
  }
20
21
  }
21
22
  /**
@@ -125,4 +126,28 @@ export class MybeSDK {
125
126
  const queryString = this.buildQueryString(options);
126
127
  return await this.request(`/content-entry/project/${projectId}${queryString}`);
127
128
  }
129
+ /**
130
+ * Get a single content entry by field value
131
+ * Similar to Contentful's getEntries with field filters
132
+ * @example
133
+ * // Get service by href field
134
+ * const service = await sdk.getContentByField('service-type-id', 'href', '/services/web-dev');
135
+ *
136
+ * // Get blog post by slug field
137
+ * const post = await sdk.getContentByField('blog-type-id', 'slug', 'my-first-post');
138
+ */
139
+ async getContentByField(contentTypeId, fieldName, fieldValue) {
140
+ try {
141
+ const encodedValue = encodeURIComponent(fieldValue);
142
+ const response = await this.request(`/type/${contentTypeId}/field/${fieldName}/${encodedValue}`);
143
+ return response.data;
144
+ }
145
+ catch (error) {
146
+ // If it's a 404, return null instead of throwing
147
+ if (error instanceof NotFoundError) {
148
+ return null;
149
+ }
150
+ throw error;
151
+ }
152
+ }
128
153
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mybe/sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",