@cloudnux/core-cloud-provider 0.2.0 → 0.5.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 +94 -66
  2. package/package.json +1 -3
package/dist/index.d.ts CHANGED
@@ -131,77 +131,105 @@ 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 RoutePoint {
148
+ lat: number;
149
+ lng: number;
150
+ distanceFromStartKm: number;
151
+ }
152
+ interface SuggestionParams {
153
+ query: string;
158
154
  maxResults?: number;
159
- /** Filter results by category */
160
- categories?: string[];
161
- /** Language code for results */
162
155
  language?: string;
156
+ countries?: string[];
157
+ biasPosition?: Coordinates;
158
+ placeTypes?: string[];
163
159
  }
164
- interface PlaceSearchResult {
165
- /** Unique identifier for the place */
166
- placeId: string;
167
- /** Place name */
168
- text: string;
160
+ interface ReverseGeocodeParams {
161
+ coordinates: Coordinates;
162
+ language?: string;
163
+ maxResults?: number;
169
164
  }
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 */
165
+ interface LocationSuggestion {
166
+ title: string;
167
+ subtitle?: string;
168
+ coordinates?: Coordinates;
169
+ placeId?: string;
170
+ queryId?: string;
171
+ placeType?: string;
179
172
  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>;
173
+ provider: string;
174
+ rawData?: any;
175
+ }
176
+ interface LocationAddress {
177
+ fullAddress: string;
178
+ street?: string;
179
+ streetNumber?: string;
180
+ city?: string;
181
+ district?: string;
182
+ region?: string;
183
+ postalCode?: string;
184
+ country?: string;
185
+ countryCode?: string;
186
+ coordinates: Coordinates;
187
+ placeType?: string;
188
+ accuracy?: number;
189
+ provider: string;
190
+ rawData?: any;
191
+ }
192
+ interface RouteResult {
193
+ totalDistanceKm: number;
194
+ totalDurationMinutes: number;
195
+ /** Route coordinates as [lng, lat] pairs for GeoJSON */
196
+ /** TODO: convert array to coordinates */
197
+ coordinates: Coordinates[];
198
+ /** Sampled points along route for corridor search */
199
+ sampledPoints: RoutePoint[];
200
+ /** Bounding box [minLng, minLat, maxLng, maxLat] */
201
+ bbox: [number, number, number, number];
202
+ /** Individual leg data */
203
+ legs: Array<{
204
+ distanceKm: number;
205
+ durationMinutes: number;
206
+ /** TODO: convert array to coordinates */
207
+ coordinates: Coordinates[];
208
+ startPosition: Coordinates;
209
+ endPosition: Coordinates;
210
+ }>;
211
+ }
212
+ interface LocationService {
213
+ /**
214
+ * Get autocomplete suggestions for search box
215
+ * Use case: User types "Stock..." → Show ["Stockholm", "Stockton", ...]
216
+ */
217
+ getSuggestions(params: SuggestionParams): Promise<LocationSuggestion[]>;
218
+ /**
219
+ * Get address from coordinates (reverse geocoding)
220
+ * Use case: User clicks "Get my location" → Show "Drottninggatan 10, Stockholm"
221
+ */
222
+ reverseGeocode(params: ReverseGeocodeParams): Promise<LocationAddress>;
223
+ /**
224
+ * Calculate route between origin and destination with optional waypoints
225
+ * Use case: User plans trip → Show route on map + details
226
+ */
227
+ calculateRoute(origin: Coordinates, destination: Coordinates, waypoints?: Coordinates[], avoidTolls?: boolean): Promise<RouteResult>;
228
+ /**
229
+ * Optional: Get detailed location info if suggestion doesn't have coordinates
230
+ * Use case: User selects suggestion → Need full coordinates
231
+ */
232
+ getLocationDetails?(placeId: string): Promise<LocationAddress>;
205
233
  }
206
234
 
207
235
  interface StorageService {
@@ -381,4 +409,4 @@ interface CloudProvider {
381
409
  createFunctionsService(): FunctionsService;
382
410
  }
383
411
 
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 };
412
+ 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 RoutePoint, type RouteResult, 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.5.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": {},