@nx-ddd/google 19.50.0 → 19.80.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.
@@ -13,9 +13,6 @@ function provideGooglePlacesConfig(useFactory) {
13
13
  ];
14
14
  }
15
15
 
16
- /**
17
- * Transform API response from snake_case to camelCase for search results
18
- */
19
16
  function transformPlaceSearchResult(result) {
20
17
  return {
21
18
  placeId: result.place_id,
@@ -32,9 +29,6 @@ function transformPlaceSearchResult(result) {
32
29
  userRatingsTotal: result.user_ratings_total
33
30
  };
34
31
  }
35
- /**
36
- * Transform API response from snake_case to camelCase for place details
37
- */
38
32
  function transformPlaceDetailsResult(result) {
39
33
  return {
40
34
  placeId: result.place_id,
@@ -54,9 +48,6 @@ function transformPlaceDetailsResult(result) {
54
48
  };
55
49
  }
56
50
 
57
- /**
58
- * Get a single place photo as Blob using Place Photos API
59
- */
60
51
  async function getPlacePhoto(http, apiKey, photoReference, maxWidth = 1600) {
61
52
  const url = 'https://maps.googleapis.com/maps/api/place/photo';
62
53
  const params = {
@@ -70,9 +61,6 @@ async function getPlacePhoto(http, apiKey, photoReference, maxWidth = 1600) {
70
61
  }));
71
62
  return response;
72
63
  }
73
- /**
74
- * Get multiple place photos as Blobs
75
- */
76
64
  async function getPlacePhotos(http, apiKey, photoReferences, maxWidth = 1600, limit = 5) {
77
65
  const results = [];
78
66
  const refs = photoReferences.slice(0, limit);
@@ -83,7 +71,6 @@ async function getPlacePhotos(http, apiKey, photoReferences, maxWidth = 1600, li
83
71
  }
84
72
  catch (error) {
85
73
  console.warn(`Failed to fetch photo ${photoRef}:`, error);
86
- // Continue with other photos even if one fails
87
74
  }
88
75
  }
89
76
  return results;
@@ -92,7 +79,6 @@ async function getPlacePhotos(http, apiKey, photoReferences, maxWidth = 1600, li
92
79
  class GooglePlacesService {
93
80
  http = inject(HttpClient);
94
81
  config = inject(GOOGLE_PLACES_CONFIG);
95
- /** Search for places using Google Places Text Search API */
96
82
  async searchPlaces(query, options = {}) {
97
83
  const { location, radius = 50000, limit = 20 } = options;
98
84
  try {
@@ -119,7 +105,6 @@ class GooglePlacesService {
119
105
  throw error;
120
106
  }
121
107
  }
122
- /** Get detailed information about a place using Place Details API */
123
108
  async getPlaceDetails(placeId, fields) {
124
109
  try {
125
110
  const url = 'https://maps.googleapis.com/maps/api/place/details/json';
@@ -144,7 +129,6 @@ class GooglePlacesService {
144
129
  throw error;
145
130
  }
146
131
  }
147
- /** Get place photo as Blob using Place Photos API */
148
132
  async getPlacePhoto(photoReference, maxWidth = 1600) {
149
133
  try {
150
134
  return await getPlacePhoto(this.http, this.config.apiKey, photoReference, maxWidth);
@@ -154,11 +138,9 @@ class GooglePlacesService {
154
138
  throw error;
155
139
  }
156
140
  }
157
- /** Get multiple place photos as Blobs */
158
141
  async getPlacePhotos(photoReferences, maxWidth = 1600, limit = 5) {
159
142
  return getPlacePhotos(this.http, this.config.apiKey, photoReferences, maxWidth, limit);
160
143
  }
161
- /** Search places and get their photos in one operation */
162
144
  async searchPlacesWithPhotos(query, options = {}) {
163
145
  const { location, radius = 50000, maxPlaces = 5, maxPhotosPerPlace = 3, photoMaxWidth = 1600 } = options;
164
146
  const places = await this.searchPlaces(query, { location, radius, limit: maxPlaces });
@@ -1 +1 @@
1
- {"version":3,"file":"nx-ddd-google-places.mjs","sources":["../../../../../packages/@nx-ddd/google/src/lib/places/places.config.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places-transformers.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places-photo.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places.service.ts","../../../../../packages/@nx-ddd/google/src/lib/places/nx-ddd-google-places.ts"],"sourcesContent":["import { InjectionToken, Provider } from '@angular/core';\nimport { GooglePlacesConfig } from './places.interface';\n\nexport const GOOGLE_PLACES_CONFIG = new InjectionToken<GooglePlacesConfig>('GOOGLE_PLACES_CONFIG');\n\nexport function provideGooglePlacesConfig(useFactory: () => GooglePlacesConfig): Provider[] {\n return [\n {\n provide: GOOGLE_PLACES_CONFIG,\n useFactory\n }\n ];\n}","/**\n * Transform functions for Google Places API responses\n */\nimport { PlaceSearchResult, PlaceDetailsResult } from './places.interface';\n\n/**\n * Transform API response from snake_case to camelCase for search results\n */\nexport function transformPlaceSearchResult(result: any): PlaceSearchResult {\n return {\n placeId: result.place_id,\n name: result.name,\n formattedAddress: result.formatted_address,\n geometry: result.geometry,\n photos: result.photos?.map((photo: any) => ({\n photoReference: photo.photo_reference,\n height: photo.height,\n width: photo.width,\n htmlAttributions: photo.html_attributions\n })),\n rating: result.rating,\n userRatingsTotal: result.user_ratings_total\n };\n}\n\n/**\n * Transform API response from snake_case to camelCase for place details\n */\nexport function transformPlaceDetailsResult(result: any): PlaceDetailsResult {\n return {\n placeId: result.place_id,\n name: result.name,\n formattedAddress: result.formatted_address,\n formattedPhoneNumber: result.formatted_phone_number,\n website: result.website,\n photos: result.photos?.map((photo: any) => ({\n photoReference: photo.photo_reference,\n height: photo.height,\n width: photo.width,\n htmlAttributions: photo.html_attributions\n })),\n rating: result.rating,\n userRatingsTotal: result.user_ratings_total,\n geometry: result.geometry\n };\n}\n","/**\n * Photo-related functions for Google Places API\n */\nimport { HttpClient } from '@angular/common/http';\nimport { lastValueFrom } from 'rxjs';\n\nexport interface PhotoResult {\n photoReference: string;\n blob: Blob;\n}\n\n/**\n * Get a single place photo as Blob using Place Photos API\n */\nexport async function getPlacePhoto(\n http: HttpClient,\n apiKey: string,\n photoReference: string,\n maxWidth = 1600\n): Promise<Blob> {\n const url = 'https://maps.googleapis.com/maps/api/place/photo';\n const params = {\n photoreference: photoReference,\n maxwidth: maxWidth.toString(),\n key: apiKey\n };\n\n const response = await lastValueFrom(\n http.get(url, {\n params,\n responseType: 'blob'\n })\n );\n\n return response;\n}\n\n/**\n * Get multiple place photos as Blobs\n */\nexport async function getPlacePhotos(\n http: HttpClient,\n apiKey: string,\n photoReferences: string[],\n maxWidth = 1600,\n limit = 5\n): Promise<PhotoResult[]> {\n const results: PhotoResult[] = [];\n const refs = photoReferences.slice(0, limit);\n\n for (const photoRef of refs) {\n try {\n const blob = await getPlacePhoto(http, apiKey, photoRef, maxWidth);\n results.push({ photoReference: photoRef, blob });\n } catch (error) {\n console.warn(`Failed to fetch photo ${photoRef}:`, error);\n // Continue with other photos even if one fails\n }\n }\n\n return results;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { lastValueFrom } from 'rxjs';\nimport { GOOGLE_PLACES_CONFIG } from './places.config';\nimport { PlaceSearchResult, PlaceDetailsResult } from './places.interface';\nimport { transformPlaceSearchResult, transformPlaceDetailsResult } from './places-transformers';\nimport { getPlacePhoto, getPlacePhotos, PhotoResult } from './places-photo';\n\n@Injectable({ providedIn: 'root' })\nexport class GooglePlacesService {\n private readonly http = inject(HttpClient);\n private readonly config = inject(GOOGLE_PLACES_CONFIG);\n\n /** Search for places using Google Places Text Search API */\n async searchPlaces(query: string, options: {\n location?: string;\n radius?: number;\n limit?: number;\n } = {}): Promise<PlaceSearchResult[]> {\n const { location, radius = 50000, limit = 20 } = options;\n\n try {\n const url = 'https://maps.googleapis.com/maps/api/place/textsearch/json';\n const params: any = {\n query: query,\n key: this.config.apiKey,\n language: this.config.language || 'ja'\n };\n\n if (location) {\n params.location = location;\n params.radius = radius;\n }\n\n const response = await lastValueFrom(\n this.http.get<any>(url, { params })\n );\n\n if (response.status !== 'OK') {\n throw new Error(`Places API error: ${response.status}`);\n }\n\n return response.results\n .slice(0, limit)\n .map((result: any) => transformPlaceSearchResult(result));\n } catch (error) {\n console.error('Error searching places:', error);\n throw error;\n }\n }\n\n /** Get detailed information about a place using Place Details API */\n async getPlaceDetails(placeId: string, fields?: string[]): Promise<PlaceDetailsResult> {\n try {\n const url = 'https://maps.googleapis.com/maps/api/place/details/json';\n const defaultFields = [\n 'place_id', 'name', 'formatted_address', 'formatted_phone_number',\n 'website', 'photos', 'rating', 'user_ratings_total', 'geometry'\n ];\n\n const params = {\n place_id: placeId,\n fields: (fields || defaultFields).join(','),\n key: this.config.apiKey,\n language: this.config.language || 'ja'\n };\n\n const response = await lastValueFrom(\n this.http.get<any>(url, { params })\n );\n\n if (response.status !== 'OK') {\n throw new Error(`Place Details API error: ${response.status}`);\n }\n\n return transformPlaceDetailsResult(response.result);\n } catch (error) {\n console.error('Error getting place details:', error);\n throw error;\n }\n }\n\n /** Get place photo as Blob using Place Photos API */\n async getPlacePhoto(photoReference: string, maxWidth = 1600): Promise<Blob> {\n try {\n return await getPlacePhoto(this.http, this.config.apiKey, photoReference, maxWidth);\n } catch (error) {\n console.error('Error getting place photo:', error);\n throw error;\n }\n }\n\n /** Get multiple place photos as Blobs */\n async getPlacePhotos(\n photoReferences: string[],\n maxWidth = 1600,\n limit = 5\n ): Promise<PhotoResult[]> {\n return getPlacePhotos(this.http, this.config.apiKey, photoReferences, maxWidth, limit);\n }\n\n /** Search places and get their photos in one operation */\n async searchPlacesWithPhotos(\n query: string,\n options: {\n location?: string;\n radius?: number;\n maxPlaces?: number;\n maxPhotosPerPlace?: number;\n photoMaxWidth?: number;\n } = {}\n ): Promise<Array<{ place: PlaceDetailsResult; photos: PhotoResult[] }>> {\n const {\n location,\n radius = 50000,\n maxPlaces = 5,\n maxPhotosPerPlace = 3,\n photoMaxWidth = 1600\n } = options;\n\n const places = await this.searchPlaces(query, { location, radius, limit: maxPlaces });\n const results = [];\n\n for (const place of places) {\n try {\n const details = await this.getPlaceDetails(place.placeId);\n let photos: PhotoResult[] = [];\n\n if (details.photos && details.photos.length > 0) {\n const photoRefs = details.photos\n .map(photo => photo.photoReference)\n .slice(0, maxPhotosPerPlace);\n photos = await this.getPlacePhotos(photoRefs, photoMaxWidth);\n }\n\n results.push({ place: details, photos });\n } catch (error) {\n console.warn(`Failed to process place ${place.placeId}:`, error);\n }\n }\n\n return results;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAGa,oBAAoB,GAAG,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G,EAAE,KAAK,CAAC;YAClE;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;uGArIW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA;;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACRlC;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-ddd-google-places.mjs","sources":["../../../../../packages/@nx-ddd/google/src/lib/places/places.config.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places-transformers.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places-photo.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places.service.ts","../../../../../packages/@nx-ddd/google/src/lib/places/nx-ddd-google-places.ts"],"sourcesContent":["import { InjectionToken, Provider } from '@angular/core';\nimport { GooglePlacesConfig } from './places.interface';\n\nexport const GOOGLE_PLACES_CONFIG = new InjectionToken<GooglePlacesConfig>('GOOGLE_PLACES_CONFIG');\n\nexport function provideGooglePlacesConfig(useFactory: () => GooglePlacesConfig): Provider[] {\n return [\n {\n provide: GOOGLE_PLACES_CONFIG,\n useFactory\n }\n ];\n}","\nimport { PlaceSearchResult, PlaceDetailsResult } from './places.interface';\n\n\nexport function transformPlaceSearchResult(result: any): PlaceSearchResult {\n return {\n placeId: result.place_id,\n name: result.name,\n formattedAddress: result.formatted_address,\n geometry: result.geometry,\n photos: result.photos?.map((photo: any) => ({\n photoReference: photo.photo_reference,\n height: photo.height,\n width: photo.width,\n htmlAttributions: photo.html_attributions\n })),\n rating: result.rating,\n userRatingsTotal: result.user_ratings_total\n };\n}\n\n\nexport function transformPlaceDetailsResult(result: any): PlaceDetailsResult {\n return {\n placeId: result.place_id,\n name: result.name,\n formattedAddress: result.formatted_address,\n formattedPhoneNumber: result.formatted_phone_number,\n website: result.website,\n photos: result.photos?.map((photo: any) => ({\n photoReference: photo.photo_reference,\n height: photo.height,\n width: photo.width,\n htmlAttributions: photo.html_attributions\n })),\n rating: result.rating,\n userRatingsTotal: result.user_ratings_total,\n geometry: result.geometry\n };\n}\n","\nimport { HttpClient } from '@angular/common/http';\nimport { lastValueFrom } from 'rxjs';\n\nexport interface PhotoResult {\n photoReference: string;\n blob: Blob;\n}\n\n\nexport async function getPlacePhoto(\n http: HttpClient,\n apiKey: string,\n photoReference: string,\n maxWidth = 1600\n): Promise<Blob> {\n const url = 'https://maps.googleapis.com/maps/api/place/photo';\n const params = {\n photoreference: photoReference,\n maxwidth: maxWidth.toString(),\n key: apiKey\n };\n\n const response = await lastValueFrom(\n http.get(url, {\n params,\n responseType: 'blob'\n })\n );\n\n return response;\n}\n\n\nexport async function getPlacePhotos(\n http: HttpClient,\n apiKey: string,\n photoReferences: string[],\n maxWidth = 1600,\n limit = 5\n): Promise<PhotoResult[]> {\n const results: PhotoResult[] = [];\n const refs = photoReferences.slice(0, limit);\n\n for (const photoRef of refs) {\n try {\n const blob = await getPlacePhoto(http, apiKey, photoRef, maxWidth);\n results.push({ photoReference: photoRef, blob });\n } catch (error) {\n console.warn(`Failed to fetch photo ${photoRef}:`, error);\n \n }\n }\n\n return results;\n}\n","import { HttpClient } from '@angular/common/http';\nimport { inject, Injectable } from '@angular/core';\nimport { lastValueFrom } from 'rxjs';\nimport { GOOGLE_PLACES_CONFIG } from './places.config';\nimport { PlaceSearchResult, PlaceDetailsResult } from './places.interface';\nimport { transformPlaceSearchResult, transformPlaceDetailsResult } from './places-transformers';\nimport { getPlacePhoto, getPlacePhotos, PhotoResult } from './places-photo';\n\n@Injectable({ providedIn: 'root' })\nexport class GooglePlacesService {\n private readonly http = inject(HttpClient);\n private readonly config = inject(GOOGLE_PLACES_CONFIG);\n\n \n async searchPlaces(query: string, options: {\n location?: string;\n radius?: number;\n limit?: number;\n } = {}): Promise<PlaceSearchResult[]> {\n const { location, radius = 50000, limit = 20 } = options;\n\n try {\n const url = 'https://maps.googleapis.com/maps/api/place/textsearch/json';\n const params: any = {\n query: query,\n key: this.config.apiKey,\n language: this.config.language || 'ja'\n };\n\n if (location) {\n params.location = location;\n params.radius = radius;\n }\n\n const response = await lastValueFrom(\n this.http.get<any>(url, { params })\n );\n\n if (response.status !== 'OK') {\n throw new Error(`Places API error: ${response.status}`);\n }\n\n return response.results\n .slice(0, limit)\n .map((result: any) => transformPlaceSearchResult(result));\n } catch (error) {\n console.error('Error searching places:', error);\n throw error;\n }\n }\n\n \n async getPlaceDetails(placeId: string, fields?: string[]): Promise<PlaceDetailsResult> {\n try {\n const url = 'https://maps.googleapis.com/maps/api/place/details/json';\n const defaultFields = [\n 'place_id', 'name', 'formatted_address', 'formatted_phone_number',\n 'website', 'photos', 'rating', 'user_ratings_total', 'geometry'\n ];\n\n const params = {\n place_id: placeId,\n fields: (fields || defaultFields).join(','),\n key: this.config.apiKey,\n language: this.config.language || 'ja'\n };\n\n const response = await lastValueFrom(\n this.http.get<any>(url, { params })\n );\n\n if (response.status !== 'OK') {\n throw new Error(`Place Details API error: ${response.status}`);\n }\n\n return transformPlaceDetailsResult(response.result);\n } catch (error) {\n console.error('Error getting place details:', error);\n throw error;\n }\n }\n\n \n async getPlacePhoto(photoReference: string, maxWidth = 1600): Promise<Blob> {\n try {\n return await getPlacePhoto(this.http, this.config.apiKey, photoReference, maxWidth);\n } catch (error) {\n console.error('Error getting place photo:', error);\n throw error;\n }\n }\n\n \n async getPlacePhotos(\n photoReferences: string[],\n maxWidth = 1600,\n limit = 5\n ): Promise<PhotoResult[]> {\n return getPlacePhotos(this.http, this.config.apiKey, photoReferences, maxWidth, limit);\n }\n\n \n async searchPlacesWithPhotos(\n query: string,\n options: {\n location?: string;\n radius?: number;\n maxPlaces?: number;\n maxPhotosPerPlace?: number;\n photoMaxWidth?: number;\n } = {}\n ): Promise<Array<{ place: PlaceDetailsResult; photos: PhotoResult[] }>> {\n const {\n location,\n radius = 50000,\n maxPlaces = 5,\n maxPhotosPerPlace = 3,\n photoMaxWidth = 1600\n } = options;\n\n const places = await this.searchPlaces(query, { location, radius, limit: maxPlaces });\n const results = [];\n\n for (const place of places) {\n try {\n const details = await this.getPlaceDetails(place.placeId);\n let photos: PhotoResult[] = [];\n\n if (details.photos && details.photos.length > 0) {\n const photoRefs = details.photos\n .map(photo => photo.photoReference)\n .slice(0, maxPhotosPerPlace);\n photos = await this.getPlacePhotos(photoRefs, photoMaxWidth);\n }\n\n results.push({ place: details, photos });\n } catch (error) {\n console.warn(`Failed to process place ${place.placeId}:`, error);\n }\n }\n\n return results;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;MAGa,oBAAoB,GAAG,IAAI,cAAc,CAAqB,sBAAsB;AAE3F,SAAU,yBAAyB,CAAC,UAAoC,EAAA;IAC5E,OAAO;AACL,QAAA;AACE,YAAA,OAAO,EAAE,oBAAoB;YAC7B;AACD;KACF;AACH;;ACRM,SAAU,0BAA0B,CAAC,MAAW,EAAA;IACpD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,QAAQ;QACxB,IAAI,EAAE,MAAM,CAAC,IAAI;QACjB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;QAC1C,QAAQ,EAAE,MAAM,CAAC,QAAQ;AACzB,QAAA,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,KAAU,MAAM;YAC1C,cAAc,EAAE,KAAK,CAAC,eAAe;YACrC,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,gBAAgB,EAAE,KAAK,CAAC;AACzB,SAAA,CAAC,CAAC;QACH,MAAM,EAAE,MAAM,CAAC,MAA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AC;gBACzD,IAAI,MAAM,GAAkB,EAAE;AAE9B,gBAAA,IAAI,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;AAC/C,oBAAA,MAAM,SAAS,GAAG,OAAO,CAAC;yBACvB,GAAG,CAAC,KAAK,IAAI,KAAK,CAAC,cAAc;AACjC,yBAAA,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC;oBAC9B,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC;gBAC9D;gBAEA,OAAO,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;YAC1C;YAAE,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,IAAI,CAAC,CAAA,wBAAA,EAA2B,KAAK,CAAC,OAAO,CAAA,CAAA,CAAG,EAAE,KAAK,CAAC;YAClE;QACF;AAEA,QAAA,OAAO,OAAO;IAChB;uGArIW,mBAAmB,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;AAAnB,IAAA,OAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mBAAmB,cADN,MAAM,EAAA,CAAA;;2FACnB,mBAAmB,EAAA,UAAA,EAAA,CAAA;kBAD/B,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;ACRlC;;AAEG;;;;"}
@@ -69,17 +69,7 @@ class GoogleServiceImpl extends GoogleService {
69
69
  const res = await calendar.calendarList.list({});
70
70
  return res.data.items ?? [];
71
71
  }
72
- /** @deprecated */
73
72
  async listEvents(client, { calendarId = 'primary' } = {}) {
74
- // const calendar = google.calendar({version: 'v3', auth: client});
75
- // const res = await calendar.events.list({
76
- // calendarId,
77
- // timeMin: (new Date()).toISOString(),
78
- // maxResults: 100,
79
- // singleEvents: true,
80
- // orderBy: 'startTime',
81
- // });
82
- // return res.data.items;
83
73
  }
84
74
  async deleteEvent(client, event) {
85
75
  const calendar = google.calendar({ version: 'v3', auth: client });
@@ -1 +1 @@
1
- {"version":3,"file":"nx-ddd-google.mjs","sources":["../../../../../packages/@nx-ddd/google/src/lib/google.config.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.impl.ts","../../../../../packages/@nx-ddd/google/src/lib/google.module.ts","../../../../../packages/@nx-ddd/google/src/lib/nx-ddd-google.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\n\nexport interface GoogleConfig {\n credential: {\n web: {\n client_id: string;\n project_id: string;\n auth_uri: string;\n token_uri: string;\n auth_provider_x509_cert_url: string;\n client_secret: string;\n redirect_uris?: string[];\n };\n }\n}\nexport const GOOGLE_CONFIG = new InjectionToken<GoogleConfig>('GOOGLE_CONFIG');\n","import { Injectable } from \"@angular/core\";\nimport type { drive_v3, calendar_v3, google } from \"googleapis\";\nimport type { GaxiosPromise } from \"googleapis/build/src/apis/abusiveexperiencereport\";\n\n@Injectable({ providedIn: 'root' })\nexport abstract class GoogleService {\n abstract client: (typeof google)['auth']['OAuth2']['prototype'];\n abstract getClient(credentials: any): Promise<any>;\n abstract getClientByAccessToken(cred: {accessToken: string, refreshToken: string}): (typeof google)['auth']['OAuth2']['prototype'];\n abstract generateAuthUrl(): string;\n abstract getToken(code: string): Promise<any>;\n abstract getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;\n abstract getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;\n abstract listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;\n abstract listEvents(client: typeof this.client, props: {calendarId: string}): Promise<any>;\n abstract createEvent(client: typeof this.client, event: { start: string, end: string, title: string, description: string }): Promise<any>;\n abstract deleteEvent(client: typeof this.client, event: { eventId: string }): Promise<any>;\n abstract getCalendar(client: typeof this.client): calendar_v3.Calendar;\n abstract refreshAccessToken(client: typeof this.client, refreshToken: string): Promise<any>;\n}","import { Inject, Injectable } from \"@angular/core\";\nimport { GoogleService } from \"./google.service\";\nimport { calendar_v3, drive_v3, google } from \"googleapis\";\nimport { GOOGLE_CONFIG, GoogleConfig } from \"./google.config\";\nimport { GaxiosPromise } from \"googleapis/build/src/apis/abusiveexperiencereport\";\nimport { OAuth2Client } from \"google-auth-library\";\nimport dayjs from 'dayjs';\n\n@Injectable()\nexport class GoogleServiceImpl extends GoogleService {\n constructor(\n @Inject(GOOGLE_CONFIG) private config: GoogleConfig,\n ) {\n super();\n }\n\n get client(): OAuth2Client {\n return new google.auth.OAuth2({\n clientId: this.config.credential.web.client_id,\n clientSecret: this.config.credential.web.client_secret,\n redirectUri: this.config.credential.web.redirect_uris?.[0],\n });\n }\n\n async getClient(credentials: any): Promise<any> {\n const client = new google.auth.OAuth2({\n clientId: this.config.credential.web.client_id,\n clientSecret: this.config.credential.web.client_secret,\n });\n client.setCredentials(credentials);\n return client;\n }\n\n getClientByAccessToken(cred: {accessToken: string, refreshToken: string}): any {\n const client = new google.auth.OAuth2();\n client.setCredentials({\n access_token: cred.accessToken,\n refresh_token: cred.refreshToken,\n });\n return client;\n }\n\n generateAuthUrl(client: OAuth2Client = this.client): string {\n const url = client.generateAuthUrl({\n access_type: 'offline',\n scope: [\n 'https://www.googleapis.com/auth/calendar.readonly',\n 'https://www.googleapis.com/auth/calendar.events',\n ],\n redirect_uris: this.config.credential.web.redirect_uris,\n });\n return url\n }\n\n getToken(code: string): Promise<any> {\n return this.client.getToken(code);\n }\n\n async getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File> {\n const drive = google.drive({version: 'v3', auth: client});\n return drive.files.get({fileId: id});\n }\n\n async getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File> {\n const drive = google.drive({version: 'v3', auth: client});\n return drive.files.get({fileId: id, alt: 'media'}, { responseType: 'arraybuffer' });\n }\n\n async listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]> {\n const calendar = google.calendar({version: 'v3', auth: client});\n const res = await calendar.calendarList.list({});\n return res.data.items ?? [];\n }\n\n /** @deprecated */\n async listEvents(client: typeof this.client, {calendarId = 'primary'}: { calendarId?: string } = {}): Promise<any> {\n // const calendar = google.calendar({version: 'v3', auth: client});\n // const res = await calendar.events.list({\n // calendarId,\n // timeMin: (new Date()).toISOString(),\n // maxResults: 100,\n // singleEvents: true,\n // orderBy: 'startTime',\n // });\n\n // return res.data.items;\n }\n\n async deleteEvent(client: typeof this.client, event: { eventId: string }) {\n const calendar = google.calendar({version: 'v3', auth: client});\n await calendar.events.delete({\n calendarId: 'primary',\n eventId: event.eventId,\n });\n }\n\n getCalendar(client: typeof this.client): calendar_v3.Calendar {\n return google.calendar({version: 'v3', auth: client});\n }\n\n async createEvent(client: typeof this.client, event: { start: string, end: string, title: string, description: string }) {\n const calendar = google.calendar({version: 'v3', auth: client});\n await calendar.events.insert({\n calendarId: 'primary',\n requestBody: {\n start: {\n dateTime: event.start,\n timeZone: 'Asia/Tokyo',\n },\n end: {\n dateTime: event.end,\n timeZone: 'Asia/Tokyo',\n },\n summary: event.title,\n description: event.description,\n }\n });\n }\n\n async refreshAccessToken(client: typeof this.client) {\n const res = await client.refreshAccessToken();\n return res.credentials.access_token;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { GOOGLE_CONFIG, GoogleConfig } from './google.config';\nimport { GoogleService } from './google.service';\nimport { GoogleServiceImpl } from './google.service.impl';\n\n@NgModule({})\nexport class GoogleModule {\n static forRoot(config: GoogleConfig) {\n return {\n ngModule: GoogleModule,\n providers: [\n { provide: GOOGLE_CONFIG, useValue: config },\n { provide: GoogleService, useClass: GoogleServiceImpl },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAea,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AA;wGAAZ,YAAY,EAAA,CAAA;wGAAZ,YAAY,EAAA,CAAA;;2FAAZ,YAAY,EAAA,UAAA,EAAA,CAAA;kBADxB,QAAQ;mBAAC,EAAE;;;ACLZ;;AAEG;;;;"}
1
+ {"version":3,"file":"nx-ddd-google.mjs","sources":["../../../../../packages/@nx-ddd/google/src/lib/google.config.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.impl.ts","../../../../../packages/@nx-ddd/google/src/lib/google.module.ts","../../../../../packages/@nx-ddd/google/src/lib/nx-ddd-google.ts"],"sourcesContent":["import { InjectionToken } from \"@angular/core\";\n\nexport interface GoogleConfig {\n credential: {\n web: {\n client_id: string;\n project_id: string;\n auth_uri: string;\n token_uri: string;\n auth_provider_x509_cert_url: string;\n client_secret: string;\n redirect_uris?: string[];\n };\n }\n}\nexport const GOOGLE_CONFIG = new InjectionToken<GoogleConfig>('GOOGLE_CONFIG');\n","import { Injectable } from \"@angular/core\";\nimport type { drive_v3, calendar_v3, google } from \"googleapis\";\nimport type { GaxiosPromise } from \"googleapis/build/src/apis/abusiveexperiencereport\";\n\n@Injectable({ providedIn: 'root' })\nexport abstract class GoogleService {\n abstract client: (typeof google)['auth']['OAuth2']['prototype'];\n abstract getClient(credentials: any): Promise<any>;\n abstract getClientByAccessToken(cred: {accessToken: string, refreshToken: string}): (typeof google)['auth']['OAuth2']['prototype'];\n abstract generateAuthUrl(): string;\n abstract getToken(code: string): Promise<any>;\n abstract getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;\n abstract getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;\n abstract listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;\n abstract listEvents(client: typeof this.client, props: {calendarId: string}): Promise<any>;\n abstract createEvent(client: typeof this.client, event: { start: string, end: string, title: string, description: string }): Promise<any>;\n abstract deleteEvent(client: typeof this.client, event: { eventId: string }): Promise<any>;\n abstract getCalendar(client: typeof this.client): calendar_v3.Calendar;\n abstract refreshAccessToken(client: typeof this.client, refreshToken: string): Promise<any>;\n}","import { Inject, Injectable } from \"@angular/core\";\nimport { GoogleService } from \"./google.service\";\nimport { calendar_v3, drive_v3, google } from \"googleapis\";\nimport { GOOGLE_CONFIG, GoogleConfig } from \"./google.config\";\nimport { GaxiosPromise } from \"googleapis/build/src/apis/abusiveexperiencereport\";\nimport { OAuth2Client } from \"google-auth-library\";\nimport dayjs from 'dayjs';\n\n@Injectable()\nexport class GoogleServiceImpl extends GoogleService {\n constructor(\n @Inject(GOOGLE_CONFIG) private config: GoogleConfig,\n ) {\n super();\n }\n\n get client(): OAuth2Client {\n return new google.auth.OAuth2({\n clientId: this.config.credential.web.client_id,\n clientSecret: this.config.credential.web.client_secret,\n redirectUri: this.config.credential.web.redirect_uris?.[0],\n });\n }\n\n async getClient(credentials: any): Promise<any> {\n const client = new google.auth.OAuth2({\n clientId: this.config.credential.web.client_id,\n clientSecret: this.config.credential.web.client_secret,\n });\n client.setCredentials(credentials);\n return client;\n }\n\n getClientByAccessToken(cred: {accessToken: string, refreshToken: string}): any {\n const client = new google.auth.OAuth2();\n client.setCredentials({\n access_token: cred.accessToken,\n refresh_token: cred.refreshToken,\n });\n return client;\n }\n\n generateAuthUrl(client: OAuth2Client = this.client): string {\n const url = client.generateAuthUrl({\n access_type: 'offline',\n scope: [\n 'https://www.googleapis.com/auth/calendar.readonly',\n 'https://www.googleapis.com/auth/calendar.events',\n ],\n redirect_uris: this.config.credential.web.redirect_uris,\n });\n return url\n }\n\n getToken(code: string): Promise<any> {\n return this.client.getToken(code);\n }\n\n async getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File> {\n const drive = google.drive({version: 'v3', auth: client});\n return drive.files.get({fileId: id});\n }\n\n async getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File> {\n const drive = google.drive({version: 'v3', auth: client});\n return drive.files.get({fileId: id, alt: 'media'}, { responseType: 'arraybuffer' });\n }\n\n async listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]> {\n const calendar = google.calendar({version: 'v3', auth: client});\n const res = await calendar.calendarList.list({});\n return res.data.items ?? [];\n }\n\n \n async listEvents(client: typeof this.client, {calendarId = 'primary'}: { calendarId?: string } = {}): Promise<any> {\n \n \n \n \n \n \n \n \n\n \n }\n\n async deleteEvent(client: typeof this.client, event: { eventId: string }) {\n const calendar = google.calendar({version: 'v3', auth: client});\n await calendar.events.delete({\n calendarId: 'primary',\n eventId: event.eventId,\n });\n }\n\n getCalendar(client: typeof this.client): calendar_v3.Calendar {\n return google.calendar({version: 'v3', auth: client});\n }\n\n async createEvent(client: typeof this.client, event: { start: string, end: string, title: string, description: string }) {\n const calendar = google.calendar({version: 'v3', auth: client});\n await calendar.events.insert({\n calendarId: 'primary',\n requestBody: {\n start: {\n dateTime: event.start,\n timeZone: 'Asia/Tokyo',\n },\n end: {\n dateTime: event.end,\n timeZone: 'Asia/Tokyo',\n },\n summary: event.title,\n description: event.description,\n }\n });\n }\n\n async refreshAccessToken(client: typeof this.client) {\n const res = await client.refreshAccessToken();\n return res.credentials.access_token;\n }\n}\n","import { NgModule } from '@angular/core';\nimport { GOOGLE_CONFIG, GoogleConfig } from './google.config';\nimport { GoogleService } from './google.service';\nimport { GoogleServiceImpl } from './google.service.impl';\n\n@NgModule({})\nexport class GoogleModule {\n static forRoot(config: GoogleConfig) {\n return {\n ngModule: GoogleModule,\n providers: [\n { provide: GOOGLE_CONFIG, useValue: config },\n { provide: GoogleService, useClass: GoogleServiceImpl },\n ],\n };\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;MAea,aAAa,GAAG,IAAI,cAAc,CAAe,eAAe;;MCVvD,aAAa,CAAA;uGAAb,aAAa,EAAA,IAAA,EAAA,EAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA;A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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx-ddd/google",
3
- "version": "19.50.0",
3
+ "version": "19.80.0",
4
4
  "peerDependencies": {
5
5
  "@angular/core": ">=17.0.0",
6
6
  "@angular/common": ">=17.0.0"
@@ -54,10 +54,6 @@ interface PlaceDetailsResponse {
54
54
  declare const GOOGLE_PLACES_CONFIG: InjectionToken<GooglePlacesConfig>;
55
55
  declare function provideGooglePlacesConfig(useFactory: () => GooglePlacesConfig): Provider[];
56
56
 
57
- /**
58
- * Photo-related functions for Google Places API
59
- */
60
-
61
57
  interface PhotoResult {
62
58
  photoReference: string;
63
59
  blob: Blob;
@@ -66,19 +62,14 @@ interface PhotoResult {
66
62
  declare class GooglePlacesService {
67
63
  private readonly http;
68
64
  private readonly config;
69
- /** Search for places using Google Places Text Search API */
70
65
  searchPlaces(query: string, options?: {
71
66
  location?: string;
72
67
  radius?: number;
73
68
  limit?: number;
74
69
  }): Promise<PlaceSearchResult[]>;
75
- /** Get detailed information about a place using Place Details API */
76
70
  getPlaceDetails(placeId: string, fields?: string[]): Promise<PlaceDetailsResult>;
77
- /** Get place photo as Blob using Place Photos API */
78
71
  getPlacePhoto(photoReference: string, maxWidth?: number): Promise<Blob>;
79
- /** Get multiple place photos as Blobs */
80
72
  getPlacePhotos(photoReferences: string[], maxWidth?: number, limit?: number): Promise<PhotoResult[]>;
81
- /** Search places and get their photos in one operation */
82
73
  searchPlacesWithPhotos(query: string, options?: {
83
74
  location?: string;
84
75
  radius?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"nx-ddd-google-places.d.ts","sources":["../../../../../packages/@nx-ddd/google/src/lib/places/places.interface.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places.config.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places-photo.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places.service.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;;;;AAGC;;;;;AAMC;AACE;;;;;AAKF;;;AAGD;;;;;;AAOA;;;;;;;AAQC;;;AAGA;AACE;;;;;AAKH;;;;;AAMA;;;;AAKA;;AClDD;AAEA;;ACLA;;AAEG;;;;;AAOF;;ACDD;AAEE;AACA;;AAGM;;;;AAIA;;AAkCA;;;;AAyCA;;AASA;;;;;;;;;AAS+D;;;AAgCtE;;;"}
1
+ {"version":3,"file":"nx-ddd-google-places.d.ts","sources":["../../../../../packages/@nx-ddd/google/src/lib/places/places.interface.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places.config.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places-photo.ts","../../../../../packages/@nx-ddd/google/src/lib/places/places.service.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;;;;AAGC;;;;;AAMC;AACE;;;;;AAKF;;;AAGD;;;;;;AAOA;;;;;;;AAQC;;;AAGA;AACE;;;;;AAKH;;;;;AAMA;;;;AAKA;;AClDD;AAEA;;;;;ACEC;;ACCD;AAEE;AACA;AAGM;;;;AAIA;AAkCA;;AAyCA;AASA;;;;;;;;;AAS+D;;;AAgCtE;;;"}
@@ -63,7 +63,6 @@ declare class GoogleServiceImpl extends GoogleService {
63
63
  getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
64
64
  getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
65
65
  listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;
66
- /** @deprecated */
67
66
  listEvents(client: typeof this.client, { calendarId }?: {
68
67
  calendarId?: string;
69
68
  }): Promise<any>;
@@ -1 +1 @@
1
- {"version":3,"file":"nx-ddd-google.d.ts","sources":["../../../../../packages/@nx-ddd/google/src/lib/google.config.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.impl.ts","../../../../../packages/@nx-ddd/google/src/lib/google.module.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;;;;;AAGE;AACE;;;;;;;AAOE;;;AAGL;AACD;;ACXA;AAEE;;AAEA;;;AAAiF;;;AAGjF;AACA;AACA;;;;;;;;;;;;;AAIA;AACA;;;AACD;;ACXD;AAG2B;AAAQ;;;;;;AAsBuC;AASxE;;AAgBM;AAKA;AAKA;;;;;;;AAoBkE;;;;;;;AAY+C;AAmBjH;;;AAIP;;ACtHD;AAEE;;;;;;;;;;;;;;;AASD;;;"}
1
+ {"version":3,"file":"nx-ddd-google.d.ts","sources":["../../../../../packages/@nx-ddd/google/src/lib/google.config.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.ts","../../../../../packages/@nx-ddd/google/src/lib/google.service.impl.ts","../../../../../packages/@nx-ddd/google/src/lib/google.module.ts"],"sourcesContent":[null,null,null,null],"names":[],"mappings":";;;;;;;AAGE;AACE;;;;;;;AAOE;;;AAGL;AACD;;ACXA;AAEE;;AAEA;;;AAAiF;;;AAGjF;AACA;AACA;;;;;;;;;;;;;AAIA;AACA;;;AACD;;ACXD;AAG2B;AAAQ;;;;;;AAsBuC;AASxE;;AAgBM;AAKA;AAKA;;;;;;AAoBkE;;;;;;;AAY+C;AAmBjH;;;AAIP;;ACtHD;AAEE;;;;;;;;;;;;;;;AASD;;;"}