@nx-ddd/google 19.2.0 → 19.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.
- package/fesm2022/nx-ddd-google-places.mjs +212 -0
- package/fesm2022/nx-ddd-google-places.mjs.map +1 -0
- package/fesm2022/nx-ddd-google-search.mjs +38 -0
- package/fesm2022/nx-ddd-google-search.mjs.map +1 -0
- package/fesm2022/nx-ddd-google.mjs +150 -0
- package/fesm2022/nx-ddd-google.mjs.map +1 -0
- package/index.d.ts +104 -0
- package/package.json +23 -13
- package/places/index.d.ts +112 -0
- package/search/index.d.ts +22 -0
- package/README.md +0 -11
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -5
- package/src/index.js.map +0 -1
- package/src/lib/google.config.d.ts +0 -15
- package/src/lib/google.config.js +0 -6
- package/src/lib/google.config.js.map +0 -1
- package/src/lib/google.module.d.ts +0 -17
- package/src/lib/google.module.js +0 -25
- package/src/lib/google.module.js.map +0 -1
- package/src/lib/google.service.d.ts +0 -29
- package/src/lib/google.service.impl.d.ts +0 -34
- package/src/lib/google.service.impl.js +0 -132
- package/src/lib/google.service.impl.js.map +0 -1
- package/src/lib/google.service.js +0 -12
- package/src/lib/google.service.js.map +0 -1
- package/src/lib/index.d.ts +0 -4
- package/src/lib/index.js +0 -8
- package/src/lib/index.js.map +0 -1
- package/src/lib/places/index.d.ts +0 -3
- package/src/lib/places/index.js +0 -7
- package/src/lib/places/index.js.map +0 -1
- package/src/lib/places/places.config.d.ts +0 -4
- package/src/lib/places/places.config.js +0 -15
- package/src/lib/places/places.config.js.map +0 -1
- package/src/lib/places/places.interface.d.ts +0 -49
- package/src/lib/places/places.interface.js +0 -3
- package/src/lib/places/places.interface.js.map +0 -1
- package/src/lib/places/places.service.d.ts +0 -52
- package/src/lib/places/places.service.js +0 -211
- package/src/lib/places/places.service.js.map +0 -1
- package/src/lib/search/index.d.ts +0 -1
- package/src/lib/search/index.js +0 -5
- package/src/lib/search/index.js.map +0 -1
- package/src/lib/search/search.service.d.ts +0 -17
- package/src/lib/search/search.service.js +0 -37
- package/src/lib/search/search.service.js.map +0 -1
- package/src/test-setup.d.ts +0 -0
- package/src/test-setup.js +0 -1
- package/src/test-setup.js.map +0 -1
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GOOGLE_PLACES_CONFIG = void 0;
|
|
4
|
-
exports.provideGooglePlacesConfig = provideGooglePlacesConfig;
|
|
5
|
-
const core_1 = require("@angular/core");
|
|
6
|
-
exports.GOOGLE_PLACES_CONFIG = new core_1.InjectionToken('GOOGLE_PLACES_CONFIG');
|
|
7
|
-
function provideGooglePlacesConfig(useFactory) {
|
|
8
|
-
return [
|
|
9
|
-
{
|
|
10
|
-
provide: exports.GOOGLE_PLACES_CONFIG,
|
|
11
|
-
useFactory
|
|
12
|
-
}
|
|
13
|
-
];
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=places.config.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"places.config.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/places/places.config.ts"],"names":[],"mappings":";;;AAKA,8DAOC;AAZD,wCAAyD;AAG5C,QAAA,oBAAoB,GAAG,IAAI,qBAAc,CAAqB,sBAAsB,CAAC,CAAC;AAEnG,SAAgB,yBAAyB,CAAC,UAAoC;IAC5E,OAAO;QACL;YACE,OAAO,EAAE,4BAAoB;YAC7B,UAAU;SACX;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export interface GooglePlacesConfig {
|
|
2
|
-
apiKey: string;
|
|
3
|
-
language?: string;
|
|
4
|
-
}
|
|
5
|
-
export interface PlaceSearchResult {
|
|
6
|
-
placeId: string;
|
|
7
|
-
name: string;
|
|
8
|
-
formattedAddress: string;
|
|
9
|
-
geometry: {
|
|
10
|
-
location: {
|
|
11
|
-
lat: number;
|
|
12
|
-
lng: number;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
photos?: PlacePhoto[];
|
|
16
|
-
rating?: number;
|
|
17
|
-
userRatingsTotal?: number;
|
|
18
|
-
}
|
|
19
|
-
export interface PlacePhoto {
|
|
20
|
-
photoReference: string;
|
|
21
|
-
height: number;
|
|
22
|
-
width: number;
|
|
23
|
-
htmlAttributions: string[];
|
|
24
|
-
}
|
|
25
|
-
export interface PlaceDetailsResult {
|
|
26
|
-
placeId: string;
|
|
27
|
-
name: string;
|
|
28
|
-
formattedAddress: string;
|
|
29
|
-
formattedPhoneNumber?: string;
|
|
30
|
-
website?: string;
|
|
31
|
-
photos?: PlacePhoto[];
|
|
32
|
-
rating?: number;
|
|
33
|
-
userRatingsTotal?: number;
|
|
34
|
-
geometry: {
|
|
35
|
-
location: {
|
|
36
|
-
lat: number;
|
|
37
|
-
lng: number;
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export interface PlaceSearchResponse {
|
|
42
|
-
results: PlaceSearchResult[];
|
|
43
|
-
status: string;
|
|
44
|
-
nextPageToken?: string;
|
|
45
|
-
}
|
|
46
|
-
export interface PlaceDetailsResponse {
|
|
47
|
-
result: PlaceDetailsResult;
|
|
48
|
-
status: string;
|
|
49
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"places.interface.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/places/places.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { PlaceSearchResult, PlaceDetailsResult } from './places.interface';
|
|
2
|
-
export declare class GooglePlacesService {
|
|
3
|
-
private readonly http;
|
|
4
|
-
private readonly config;
|
|
5
|
-
/**
|
|
6
|
-
* Transform API response from snake_case to camelCase
|
|
7
|
-
*/
|
|
8
|
-
private transformPlaceSearchResult;
|
|
9
|
-
/**
|
|
10
|
-
* Transform API response from snake_case to camelCase
|
|
11
|
-
*/
|
|
12
|
-
private transformPlaceDetailsResult;
|
|
13
|
-
/**
|
|
14
|
-
* Search for places using Google Places Text Search API
|
|
15
|
-
*/
|
|
16
|
-
searchPlaces(query: string, options?: {
|
|
17
|
-
location?: string;
|
|
18
|
-
radius?: number;
|
|
19
|
-
limit?: number;
|
|
20
|
-
}): Promise<PlaceSearchResult[]>;
|
|
21
|
-
/**
|
|
22
|
-
* Get detailed information about a place using Place Details API
|
|
23
|
-
*/
|
|
24
|
-
getPlaceDetails(placeId: string, fields?: string[]): Promise<PlaceDetailsResult>;
|
|
25
|
-
/**
|
|
26
|
-
* Get place photo as Blob using Place Photos API
|
|
27
|
-
*/
|
|
28
|
-
getPlacePhoto(photoReference: string, maxWidth?: number): Promise<Blob>;
|
|
29
|
-
/**
|
|
30
|
-
* Get multiple place photos as Blobs
|
|
31
|
-
*/
|
|
32
|
-
getPlacePhotos(photoReferences: string[], maxWidth?: number, limit?: number): Promise<{
|
|
33
|
-
photoReference: string;
|
|
34
|
-
blob: Blob;
|
|
35
|
-
}[]>;
|
|
36
|
-
/**
|
|
37
|
-
* Search places and get their photos in one operation
|
|
38
|
-
*/
|
|
39
|
-
searchPlacesWithPhotos(query: string, options?: {
|
|
40
|
-
location?: string;
|
|
41
|
-
radius?: number;
|
|
42
|
-
maxPlaces?: number;
|
|
43
|
-
maxPhotosPerPlace?: number;
|
|
44
|
-
photoMaxWidth?: number;
|
|
45
|
-
}): Promise<Array<{
|
|
46
|
-
place: PlaceDetailsResult;
|
|
47
|
-
photos: {
|
|
48
|
-
photoReference: string;
|
|
49
|
-
blob: Blob;
|
|
50
|
-
}[];
|
|
51
|
-
}>>;
|
|
52
|
-
}
|
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GooglePlacesService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const http_1 = require("@angular/common/http");
|
|
6
|
-
const core_1 = require("@angular/core");
|
|
7
|
-
const rxjs_1 = require("rxjs");
|
|
8
|
-
const places_config_1 = require("./places.config");
|
|
9
|
-
let GooglePlacesService = class GooglePlacesService {
|
|
10
|
-
constructor() {
|
|
11
|
-
this.http = (0, core_1.inject)(http_1.HttpClient);
|
|
12
|
-
this.config = (0, core_1.inject)(places_config_1.GOOGLE_PLACES_CONFIG);
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Transform API response from snake_case to camelCase
|
|
16
|
-
*/
|
|
17
|
-
transformPlaceSearchResult(result) {
|
|
18
|
-
var _a;
|
|
19
|
-
return {
|
|
20
|
-
placeId: result.place_id,
|
|
21
|
-
name: result.name,
|
|
22
|
-
formattedAddress: result.formatted_address,
|
|
23
|
-
geometry: result.geometry,
|
|
24
|
-
photos: (_a = result.photos) === null || _a === void 0 ? void 0 : _a.map((photo) => ({
|
|
25
|
-
photoReference: photo.photo_reference,
|
|
26
|
-
height: photo.height,
|
|
27
|
-
width: photo.width,
|
|
28
|
-
htmlAttributions: photo.html_attributions
|
|
29
|
-
})),
|
|
30
|
-
rating: result.rating,
|
|
31
|
-
userRatingsTotal: result.user_ratings_total
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Transform API response from snake_case to camelCase
|
|
36
|
-
*/
|
|
37
|
-
transformPlaceDetailsResult(result) {
|
|
38
|
-
var _a;
|
|
39
|
-
return {
|
|
40
|
-
placeId: result.place_id,
|
|
41
|
-
name: result.name,
|
|
42
|
-
formattedAddress: result.formatted_address,
|
|
43
|
-
formattedPhoneNumber: result.formatted_phone_number,
|
|
44
|
-
website: result.website,
|
|
45
|
-
photos: (_a = result.photos) === null || _a === void 0 ? void 0 : _a.map((photo) => ({
|
|
46
|
-
photoReference: photo.photo_reference,
|
|
47
|
-
height: photo.height,
|
|
48
|
-
width: photo.width,
|
|
49
|
-
htmlAttributions: photo.html_attributions
|
|
50
|
-
})),
|
|
51
|
-
rating: result.rating,
|
|
52
|
-
userRatingsTotal: result.user_ratings_total,
|
|
53
|
-
geometry: result.geometry
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Search for places using Google Places Text Search API
|
|
58
|
-
*/
|
|
59
|
-
searchPlaces(query_1) {
|
|
60
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* (query, options = {}) {
|
|
61
|
-
const { location, radius = 50000, limit = 20 } = options;
|
|
62
|
-
try {
|
|
63
|
-
const url = 'https://maps.googleapis.com/maps/api/place/textsearch/json';
|
|
64
|
-
const params = {
|
|
65
|
-
query: query,
|
|
66
|
-
key: this.config.apiKey,
|
|
67
|
-
language: this.config.language || 'ja'
|
|
68
|
-
};
|
|
69
|
-
if (location) {
|
|
70
|
-
params.location = location;
|
|
71
|
-
params.radius = radius;
|
|
72
|
-
}
|
|
73
|
-
const response = yield (0, rxjs_1.lastValueFrom)(this.http.get(url, { params }));
|
|
74
|
-
if (response.status !== 'OK') {
|
|
75
|
-
throw new Error(`Places API error: ${response.status}`);
|
|
76
|
-
}
|
|
77
|
-
return response.results
|
|
78
|
-
.slice(0, limit)
|
|
79
|
-
.map((result) => this.transformPlaceSearchResult(result));
|
|
80
|
-
}
|
|
81
|
-
catch (error) {
|
|
82
|
-
console.error('Error searching places:', error);
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Get detailed information about a place using Place Details API
|
|
89
|
-
*/
|
|
90
|
-
getPlaceDetails(placeId, fields) {
|
|
91
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
92
|
-
try {
|
|
93
|
-
const url = 'https://maps.googleapis.com/maps/api/place/details/json';
|
|
94
|
-
const defaultFields = [
|
|
95
|
-
'place_id',
|
|
96
|
-
'name',
|
|
97
|
-
'formatted_address',
|
|
98
|
-
'formatted_phone_number',
|
|
99
|
-
'website',
|
|
100
|
-
'photos',
|
|
101
|
-
'rating',
|
|
102
|
-
'user_ratings_total',
|
|
103
|
-
'geometry'
|
|
104
|
-
];
|
|
105
|
-
const params = {
|
|
106
|
-
place_id: placeId,
|
|
107
|
-
fields: (fields || defaultFields).join(','),
|
|
108
|
-
key: this.config.apiKey,
|
|
109
|
-
language: this.config.language || 'ja'
|
|
110
|
-
};
|
|
111
|
-
const response = yield (0, rxjs_1.lastValueFrom)(this.http.get(url, { params }));
|
|
112
|
-
if (response.status !== 'OK') {
|
|
113
|
-
throw new Error(`Place Details API error: ${response.status}`);
|
|
114
|
-
}
|
|
115
|
-
return this.transformPlaceDetailsResult(response.result);
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
console.error('Error getting place details:', error);
|
|
119
|
-
throw error;
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Get place photo as Blob using Place Photos API
|
|
125
|
-
*/
|
|
126
|
-
getPlacePhoto(photoReference_1) {
|
|
127
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* (photoReference, maxWidth = 1600) {
|
|
128
|
-
try {
|
|
129
|
-
const url = 'https://maps.googleapis.com/maps/api/place/photo';
|
|
130
|
-
const params = {
|
|
131
|
-
photoreference: photoReference,
|
|
132
|
-
maxwidth: maxWidth.toString(),
|
|
133
|
-
key: this.config.apiKey
|
|
134
|
-
};
|
|
135
|
-
const response = yield (0, rxjs_1.lastValueFrom)(this.http.get(url, {
|
|
136
|
-
params,
|
|
137
|
-
responseType: 'blob'
|
|
138
|
-
}));
|
|
139
|
-
return response;
|
|
140
|
-
}
|
|
141
|
-
catch (error) {
|
|
142
|
-
console.error('Error getting place photo:', error);
|
|
143
|
-
throw error;
|
|
144
|
-
}
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Get multiple place photos as Blobs
|
|
149
|
-
*/
|
|
150
|
-
getPlacePhotos(photoReferences_1) {
|
|
151
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* (photoReferences, maxWidth = 1600, limit = 5) {
|
|
152
|
-
const results = [];
|
|
153
|
-
const refs = photoReferences.slice(0, limit);
|
|
154
|
-
for (const photoRef of refs) {
|
|
155
|
-
try {
|
|
156
|
-
const blob = yield this.getPlacePhoto(photoRef, maxWidth);
|
|
157
|
-
results.push({ photoReference: photoRef, blob });
|
|
158
|
-
}
|
|
159
|
-
catch (error) {
|
|
160
|
-
console.warn(`Failed to fetch photo ${photoRef}:`, error);
|
|
161
|
-
// Continue with other photos even if one fails
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
return results;
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Search places and get their photos in one operation
|
|
169
|
-
*/
|
|
170
|
-
searchPlacesWithPhotos(query_1) {
|
|
171
|
-
return tslib_1.__awaiter(this, arguments, void 0, function* (query, options = {}) {
|
|
172
|
-
const { location, radius = 50000, maxPlaces = 5, maxPhotosPerPlace = 3, photoMaxWidth = 1600 } = options;
|
|
173
|
-
// Step 1: Search places
|
|
174
|
-
const places = yield this.searchPlaces(query, {
|
|
175
|
-
location,
|
|
176
|
-
radius,
|
|
177
|
-
limit: maxPlaces
|
|
178
|
-
});
|
|
179
|
-
const results = [];
|
|
180
|
-
// Step 2: Get details and photos for each place
|
|
181
|
-
for (const place of places) {
|
|
182
|
-
try {
|
|
183
|
-
// Get detailed information
|
|
184
|
-
const details = yield this.getPlaceDetails(place.placeId);
|
|
185
|
-
// Get photos if available
|
|
186
|
-
let photos = [];
|
|
187
|
-
if (details.photos && details.photos.length > 0) {
|
|
188
|
-
const photoRefs = details.photos
|
|
189
|
-
.map(photo => photo.photoReference)
|
|
190
|
-
.slice(0, maxPhotosPerPlace);
|
|
191
|
-
photos = yield this.getPlacePhotos(photoRefs, photoMaxWidth);
|
|
192
|
-
}
|
|
193
|
-
results.push({
|
|
194
|
-
place: details,
|
|
195
|
-
photos
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
catch (error) {
|
|
199
|
-
console.warn(`Failed to process place ${place.placeId}:`, error);
|
|
200
|
-
// Continue with other places
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return results;
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
exports.GooglePlacesService = GooglePlacesService;
|
|
208
|
-
exports.GooglePlacesService = GooglePlacesService = tslib_1.__decorate([
|
|
209
|
-
(0, core_1.Injectable)({ providedIn: 'root' })
|
|
210
|
-
], GooglePlacesService);
|
|
211
|
-
//# sourceMappingURL=places.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"places.service.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/places/places.service.ts"],"names":[],"mappings":";;;;AAAA,+CAAkD;AAClD,wCAAmD;AACnD,+BAAqC;AACrC,mDAAuD;AAShD,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAAzB;QACY,SAAI,GAAG,IAAA,aAAM,EAAC,iBAAU,CAAC,CAAC;QAC1B,WAAM,GAAG,IAAA,aAAM,EAAC,oCAAoB,CAAC,CAAC;IA+OzD,CAAC;IA7OC;;OAEG;IACK,0BAA0B,CAAC,MAAW;;QAC5C,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,QAAQ;YACxB,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,gBAAgB,EAAE,MAAM,CAAC,iBAAiB;YAC1C,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,MAAM,EAAE,MAAA,MAAM,CAAC,MAAM,0CAAE,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE,CAAC,CAAC;gBAC1C,cAAc,EAAE,KAAK,CAAC,eAAe;gBACrC,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,gBAAgB,EAAE,KAAK,CAAC,iBAAiB;aAC1C,CAAC,CAAC;YACH,MAAM,EAAE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,GAAG,OAAO,CAAC,MAAM;6BAC7B,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC;6BAClC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;wBAE/B,MAAM,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;oBAC/D,CAAC;oBAED,OAAO,CAAC,IAAI,CAAC;wBACX,KAAK,EAAE,OAAO;wBACd,MAAM;qBACP,CAAC,CAAC;gBACL,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO,CAAC,IAAI,CAAC,2BAA2B,KAAK,CAAC,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;oBACjE,6BAA6B;gBAC/B,CAAC;YACH,CAAC;YAED,OAAO,OAAO,CAAC;QACjB,CAAC;KAAA;CACF,CAAA;AAjPY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,iBAAU,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;GACtB,mBAAmB,CAiP/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './search.service';
|
package/src/lib/search/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/search/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { HttpClient } from "@angular/common/http";
|
|
2
|
-
import { InjectionToken } from "@angular/core";
|
|
3
|
-
interface GoogleSearchConfig {
|
|
4
|
-
apiKey: string;
|
|
5
|
-
engineId: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const GOOGLE_SEARCH_CONFIG: InjectionToken<GoogleSearchConfig>;
|
|
8
|
-
export declare function provideGoogleSearchConfig(useFactory: () => GoogleSearchConfig): {
|
|
9
|
-
provide: InjectionToken<GoogleSearchConfig>;
|
|
10
|
-
useFactory: () => GoogleSearchConfig;
|
|
11
|
-
};
|
|
12
|
-
export declare class GoogleSearchService {
|
|
13
|
-
readonly http: HttpClient;
|
|
14
|
-
readonly config: GoogleSearchConfig;
|
|
15
|
-
searchByGoogle(q: string): Promise<Object>;
|
|
16
|
-
}
|
|
17
|
-
export {};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GoogleSearchService = exports.GOOGLE_SEARCH_CONFIG = void 0;
|
|
4
|
-
exports.provideGoogleSearchConfig = provideGoogleSearchConfig;
|
|
5
|
-
const tslib_1 = require("tslib");
|
|
6
|
-
const http_1 = require("@angular/common/http");
|
|
7
|
-
const core_1 = require("@angular/core");
|
|
8
|
-
const rxjs_1 = require("rxjs");
|
|
9
|
-
exports.GOOGLE_SEARCH_CONFIG = new core_1.InjectionToken('GOOGLE_SEARCH_CONFIG');
|
|
10
|
-
function provideGoogleSearchConfig(useFactory) {
|
|
11
|
-
return { provide: exports.GOOGLE_SEARCH_CONFIG, useFactory };
|
|
12
|
-
}
|
|
13
|
-
let GoogleSearchService = class GoogleSearchService {
|
|
14
|
-
constructor() {
|
|
15
|
-
this.http = (0, core_1.inject)(http_1.HttpClient);
|
|
16
|
-
this.config = (0, core_1.inject)(exports.GOOGLE_SEARCH_CONFIG);
|
|
17
|
-
}
|
|
18
|
-
searchByGoogle(q) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const url = `https://www.googleapis.com/customsearch/v1`;
|
|
21
|
-
return (0, rxjs_1.lastValueFrom)(this.http.get(url, {
|
|
22
|
-
params: {
|
|
23
|
-
key: this.config.apiKey,
|
|
24
|
-
cx: this.config.engineId,
|
|
25
|
-
searchType: 'image',
|
|
26
|
-
q: q,
|
|
27
|
-
num: 3
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
exports.GoogleSearchService = GoogleSearchService;
|
|
34
|
-
exports.GoogleSearchService = GoogleSearchService = tslib_1.__decorate([
|
|
35
|
-
(0, core_1.Injectable)({ providedIn: 'root' })
|
|
36
|
-
], GoogleSearchService);
|
|
37
|
-
//# sourceMappingURL=search.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search.service.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/search/search.service.ts"],"names":[],"mappings":";;;AAUA,8DAEC;;AAZD,+CAAkD;AAClD,wCAAmE;AACnE,+BAAqC;AAOxB,QAAA,oBAAoB,GAAG,IAAI,qBAAc,CAAqB,sBAAsB,CAAC,CAAC;AACnG,SAAgB,yBAAyB,CAAC,UAAoC;IAC5E,OAAO,EAAE,OAAO,EAAE,4BAAoB,EAAE,UAAU,EAAE,CAAC;AACvD,CAAC;AAGM,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAAzB;QACI,SAAI,GAAG,IAAA,aAAM,EAAC,iBAAU,CAAC,CAAC;QAC1B,WAAM,GAAG,IAAA,aAAM,EAAC,4BAAoB,CAAC,CAAC;IAcjD,CAAC;IAZO,cAAc,CAAC,CAAS;;YAC5B,MAAM,GAAG,GAAG,4CAA4C,CAAC;YACzD,OAAO,IAAA,oBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE;gBACtC,MAAM,EAAE;oBACN,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM;oBACvB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;oBACxB,UAAU,EAAE,OAAO;oBACnB,CAAC,EAAE,CAAC;oBACJ,GAAG,EAAE,CAAC;iBACP;aACF,CAAC,CAAC,CAAC;QACN,CAAC;KAAA;CACF,CAAA;AAhBY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,iBAAU,EAAC,EAAC,UAAU,EAAE,MAAM,EAAC,CAAC;GACpB,mBAAmB,CAgB/B"}
|
package/src/test-setup.d.ts
DELETED
|
File without changes
|
package/src/test-setup.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=test-setup.js.map
|
package/src/test-setup.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/google/src/test-setup.ts"],"names":[],"mappings":""}
|