@cloudnux/core-cloud-provider 0.2.0 → 0.3.0

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +65 -67
  2. package/package.json +1 -3
package/dist/index.d.ts CHANGED
@@ -131,77 +131,75 @@ interface EventMessage {
131
131
  publishedAt: Date;
132
132
  }
133
133
 
134
- interface LocationService {
135
- /**
136
- * Search for places based on a query
137
- * @param query Search query
138
- * @param options Search options like bounding box, filters, etc.
139
- * @returns Promise containing search results
140
- */
141
- searchPlaces(query: string, options?: PlaceSearchOptions): Promise<PlaceSearchResult[]>;
142
- /**
143
- * Get detailed information about a specific place
144
- * @param placeId ID of the place to get details for
145
- * @returns Promise containing place details
146
- */
147
- getPlaceDetails(placeId: string): Promise<PlaceDetails>;
134
+ interface LocationProviderConfig {
135
+ apiKey?: string;
136
+ region?: string;
137
+ language?: string;
138
+ countries?: string[];
139
+ timeout?: number;
140
+ retryAttempts?: number;
141
+ metadata?: Record<string, any>;
148
142
  }
149
- interface PlaceSearchOptions {
150
- /** Bounding box to search within */
151
- boundingBox?: {
152
- minLongitude: number;
153
- minLatitude: number;
154
- maxLongitude: number;
155
- maxLatitude: number;
156
- };
157
- /** Maximum number of results to return */
143
+ interface Coordinates {
144
+ lat: number;
145
+ lng: number;
146
+ }
147
+ interface SuggestionParams {
148
+ query: string;
158
149
  maxResults?: number;
159
- /** Filter results by category */
160
- categories?: string[];
161
- /** Language code for results */
162
150
  language?: string;
151
+ countries?: string[];
152
+ biasPosition?: Coordinates;
153
+ placeTypes?: string[];
163
154
  }
164
- interface PlaceSearchResult {
165
- /** Unique identifier for the place */
166
- placeId: string;
167
- /** Place name */
168
- text: string;
169
- }
170
- interface PlaceDetails extends PlaceSearchResult {
171
- /** Place address */
172
- address?: string;
173
- /** Geographic coordinates */
174
- coordinates: {
175
- latitude: number;
176
- longitude: number;
177
- };
178
- /** Distance from search center if applicable */
155
+ interface LocationSuggestion {
156
+ title: string;
157
+ subtitle?: string;
158
+ coordinates?: Coordinates;
159
+ placeId?: string;
160
+ queryId?: string;
161
+ placeType?: string;
179
162
  distance?: number;
180
- /** Place categories/types */
181
- categories?: string[];
182
- /** Full formatted address */
183
- formattedAddress: string;
184
- /** Phone number */
185
- phoneNumber?: string;
186
- /** Website URL */
187
- website?: string;
188
- /** Opening hours */
189
- openingHours?: {
190
- periods: {
191
- day: number;
192
- open?: string;
193
- close?: string;
194
- }[];
195
- weekdayText?: string[];
196
- };
197
- /** Reviews if available */
198
- reviews?: {
199
- rating: number;
200
- text?: string;
201
- time?: number;
202
- }[];
203
- /** Additional place data */
204
- additionalData?: Record<string, any>;
163
+ provider: string;
164
+ rawData?: any;
165
+ }
166
+ interface ReverseGeocodeParams {
167
+ coordinates: Coordinates;
168
+ language?: string;
169
+ maxResults?: number;
170
+ }
171
+ interface LocationAddress {
172
+ fullAddress: string;
173
+ street?: string;
174
+ streetNumber?: string;
175
+ city?: string;
176
+ district?: string;
177
+ region?: string;
178
+ postalCode?: string;
179
+ country?: string;
180
+ countryCode?: string;
181
+ coordinates: Coordinates;
182
+ placeType?: string;
183
+ accuracy?: number;
184
+ provider: string;
185
+ rawData?: any;
186
+ }
187
+ interface LocationService {
188
+ /**
189
+ * Get autocomplete suggestions for search box
190
+ * Use case: User types "Stock..." → Show ["Stockholm", "Stockton", ...]
191
+ */
192
+ getSuggestions(params: SuggestionParams): Promise<LocationSuggestion[]>;
193
+ /**
194
+ * Get address from coordinates (reverse geocoding)
195
+ * Use case: User clicks "Get my location" → Show "Drottninggatan 10, Stockholm"
196
+ */
197
+ reverseGeocode(params: ReverseGeocodeParams): Promise<LocationAddress>;
198
+ /**
199
+ * Optional: Get detailed location info if suggestion doesn't have coordinates
200
+ * Use case: User selects suggestion → Need full coordinates
201
+ */
202
+ getLocationDetails?(placeId: string): Promise<LocationAddress>;
205
203
  }
206
204
 
207
205
  interface StorageService {
@@ -381,4 +379,4 @@ interface CloudProvider {
381
379
  createFunctionsService(): FunctionsService;
382
380
  }
383
381
 
384
- export { type BaseEntry, type CloudProvider, type Entry, type Entrypoint, ErrorCode, type EventBrokerService, type EventEntry, type EventFunctionContext, type EventMessage, type EventRequest, type EventResponse, type EventTrigger, type FunctionContext, type FunctionsService, type HTTPAuth, type HTTPRequest, type HTTPResponse, type HandlerType, type HttpEntry, type HttpFunctionContext, type HttpMethod, type HttpTrigger, type LocationService, type MessageFilter, type PeekOptions, type PlaceDetails, type PlaceSearchOptions, type PlaceSearchResult, type PublishOptions, type ReadOptions, type ScheduleEntry, type ScheduleFunctionContext, type ScheduleRequest, type ScheduleResponse, type ScheduleTrigger, type StorageService, type StorageWriteOptions, type StorageWriteResult };
382
+ export { type BaseEntry, type CloudProvider, type Coordinates, type Entry, type Entrypoint, ErrorCode, type EventBrokerService, type EventEntry, type EventFunctionContext, type EventMessage, type EventRequest, type EventResponse, type EventTrigger, type FunctionContext, type FunctionsService, type HTTPAuth, type HTTPRequest, type HTTPResponse, type HandlerType, type HttpEntry, type HttpFunctionContext, type HttpMethod, type HttpTrigger, type LocationAddress, type LocationProviderConfig, type LocationService, type LocationSuggestion, type MessageFilter, type PeekOptions, type PublishOptions, type ReadOptions, type ReverseGeocodeParams, type ScheduleEntry, type ScheduleFunctionContext, type ScheduleRequest, type ScheduleResponse, type ScheduleTrigger, type StorageService, type StorageWriteOptions, type StorageWriteResult, type SuggestionParams };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudnux/core-cloud-provider",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "CloudNux core interfaces and types for multi-cloud abstraction",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -37,8 +37,6 @@
37
37
  "lint": "eslint . --max-warnings 0",
38
38
  "lint:fix": "eslint . --fix",
39
39
  "type-check": "tsc --noEmit",
40
- "test": "vitest run",
41
- "test:watch": "vitest",
42
40
  "clean": "rm -rf dist"
43
41
  },
44
42
  "dependencies": {},