@nx-ddd/google 19.2.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 (41) hide show
  1. package/README.md +11 -0
  2. package/package.json +21 -0
  3. package/src/index.d.ts +1 -0
  4. package/src/index.js +5 -0
  5. package/src/index.js.map +1 -0
  6. package/src/lib/google.config.d.ts +15 -0
  7. package/src/lib/google.config.js +6 -0
  8. package/src/lib/google.config.js.map +1 -0
  9. package/src/lib/google.module.d.ts +17 -0
  10. package/src/lib/google.module.js +25 -0
  11. package/src/lib/google.module.js.map +1 -0
  12. package/src/lib/google.service.d.ts +29 -0
  13. package/src/lib/google.service.impl.d.ts +34 -0
  14. package/src/lib/google.service.impl.js +132 -0
  15. package/src/lib/google.service.impl.js.map +1 -0
  16. package/src/lib/google.service.js +12 -0
  17. package/src/lib/google.service.js.map +1 -0
  18. package/src/lib/index.d.ts +4 -0
  19. package/src/lib/index.js +8 -0
  20. package/src/lib/index.js.map +1 -0
  21. package/src/lib/places/index.d.ts +3 -0
  22. package/src/lib/places/index.js +7 -0
  23. package/src/lib/places/index.js.map +1 -0
  24. package/src/lib/places/places.config.d.ts +4 -0
  25. package/src/lib/places/places.config.js +15 -0
  26. package/src/lib/places/places.config.js.map +1 -0
  27. package/src/lib/places/places.interface.d.ts +49 -0
  28. package/src/lib/places/places.interface.js +3 -0
  29. package/src/lib/places/places.interface.js.map +1 -0
  30. package/src/lib/places/places.service.d.ts +52 -0
  31. package/src/lib/places/places.service.js +211 -0
  32. package/src/lib/places/places.service.js.map +1 -0
  33. package/src/lib/search/index.d.ts +1 -0
  34. package/src/lib/search/index.js +5 -0
  35. package/src/lib/search/index.js.map +1 -0
  36. package/src/lib/search/search.service.d.ts +17 -0
  37. package/src/lib/search/search.service.js +37 -0
  38. package/src/lib/search/search.service.js.map +1 -0
  39. package/src/test-setup.d.ts +0 -0
  40. package/src/test-setup.js +1 -0
  41. package/src/test-setup.js.map +1 -0
package/README.md ADDED
@@ -0,0 +1,11 @@
1
+ # packages/@nx-ddd/google
2
+
3
+ This library was generated with [Nx](https://nx.dev).
4
+
5
+ ## Building
6
+
7
+ Run `nx build packages/@nx-ddd/google` to build the library.
8
+
9
+ ## Running unit tests
10
+
11
+ Run `nx test packages/@nx-ddd/google` to execute the unit tests via [Jest](https://jestjs.io).
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@nx-ddd/google",
3
+ "version": "19.2.0",
4
+ "homepage": "https://github.com/xx-machina/plaform/tree/main/packages/@nx-ddd/google",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/xx-machina/plaform.git"
8
+ },
9
+ "main": "src/index.js",
10
+ "types": "src/index.d.ts",
11
+ "type": "commonjs",
12
+ "dependencies": {},
13
+ "peerDependencies": {},
14
+ "exports": {
15
+ "./package.json": "./package.json",
16
+ ".": {
17
+ "types": "./src/index.d.ts",
18
+ "default": "./src/index.js"
19
+ }
20
+ }
21
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from './lib';
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./lib"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/google/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
@@ -0,0 +1,15 @@
1
+ import { InjectionToken } from "@angular/core";
2
+ export interface GoogleConfig {
3
+ credential: {
4
+ web: {
5
+ client_id: string;
6
+ project_id: string;
7
+ auth_uri: string;
8
+ token_uri: string;
9
+ auth_provider_x509_cert_url: string;
10
+ client_secret: string;
11
+ redirect_uris?: string[];
12
+ };
13
+ };
14
+ }
15
+ export declare const GOOGLE_CONFIG: InjectionToken<GoogleConfig>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GOOGLE_CONFIG = void 0;
4
+ const core_1 = require("@angular/core");
5
+ exports.GOOGLE_CONFIG = new core_1.InjectionToken('GOOGLE_CONFIG');
6
+ //# sourceMappingURL=google.config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.config.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/google/src/lib/google.config.ts"],"names":[],"mappings":";;;AAAA,wCAA+C;AAelC,QAAA,aAAa,GAAG,IAAI,qBAAc,CAAe,eAAe,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { GoogleConfig } from './google.config';
2
+ import { GoogleService } from './google.service';
3
+ import { GoogleServiceImpl } from './google.service.impl';
4
+ export declare class GoogleModule {
5
+ static forRoot(config: GoogleConfig): {
6
+ ngModule: typeof GoogleModule;
7
+ providers: ({
8
+ provide: import("@angular/core").InjectionToken<GoogleConfig>;
9
+ useValue: GoogleConfig;
10
+ useClass?: undefined;
11
+ } | {
12
+ provide: typeof GoogleService;
13
+ useClass: typeof GoogleServiceImpl;
14
+ useValue?: undefined;
15
+ })[];
16
+ };
17
+ }
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var GoogleModule_1;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.GoogleModule = void 0;
5
+ const tslib_1 = require("tslib");
6
+ const core_1 = require("@angular/core");
7
+ const google_config_1 = require("./google.config");
8
+ const google_service_1 = require("./google.service");
9
+ const google_service_impl_1 = require("./google.service.impl");
10
+ let GoogleModule = GoogleModule_1 = class GoogleModule {
11
+ static forRoot(config) {
12
+ return {
13
+ ngModule: GoogleModule_1,
14
+ providers: [
15
+ { provide: google_config_1.GOOGLE_CONFIG, useValue: config },
16
+ { provide: google_service_1.GoogleService, useClass: google_service_impl_1.GoogleServiceImpl },
17
+ ],
18
+ };
19
+ }
20
+ };
21
+ exports.GoogleModule = GoogleModule;
22
+ exports.GoogleModule = GoogleModule = GoogleModule_1 = tslib_1.__decorate([
23
+ (0, core_1.NgModule)({})
24
+ ], GoogleModule);
25
+ //# sourceMappingURL=google.module.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.module.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/google/src/lib/google.module.ts"],"names":[],"mappings":";;;;;AAAA,wCAAyC;AACzC,mDAA8D;AAC9D,qDAAiD;AACjD,+DAA0D;AAGnD,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,OAAO,CAAC,MAAoB;QACjC,OAAO;YACL,QAAQ,EAAE,cAAY;YACtB,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,6BAAa,EAAE,QAAQ,EAAE,MAAM,EAAE;gBAC5C,EAAE,OAAO,EAAE,8BAAa,EAAE,QAAQ,EAAE,uCAAiB,EAAE;aACxD;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAVY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,eAAQ,EAAC,EAAE,CAAC;GACA,YAAY,CAUxB"}
@@ -0,0 +1,29 @@
1
+ import type { drive_v3, calendar_v3, google } from "googleapis";
2
+ import type { GaxiosPromise } from "googleapis/build/src/apis/abusiveexperiencereport";
3
+ export declare abstract class GoogleService {
4
+ abstract client: (typeof google)['auth']['OAuth2']['prototype'];
5
+ abstract getClient(credentials: any): Promise<any>;
6
+ abstract getClientByAccessToken(cred: {
7
+ accessToken: string;
8
+ refreshToken: string;
9
+ }): (typeof google)['auth']['OAuth2']['prototype'];
10
+ abstract generateAuthUrl(): string;
11
+ abstract getToken(code: string): Promise<any>;
12
+ abstract getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
13
+ abstract getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
14
+ abstract listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;
15
+ abstract listEvents(client: typeof this.client, props: {
16
+ calendarId: string;
17
+ }): Promise<any>;
18
+ abstract createEvent(client: typeof this.client, event: {
19
+ start: string;
20
+ end: string;
21
+ title: string;
22
+ description: string;
23
+ }): Promise<any>;
24
+ abstract deleteEvent(client: typeof this.client, event: {
25
+ eventId: string;
26
+ }): Promise<any>;
27
+ abstract getCalendar(client: typeof this.client): calendar_v3.Calendar;
28
+ abstract refreshAccessToken(client: typeof this.client, refreshToken: string): Promise<any>;
29
+ }
@@ -0,0 +1,34 @@
1
+ import { GoogleService } from "./google.service";
2
+ import { calendar_v3, drive_v3 } from "googleapis";
3
+ import { GoogleConfig } from "./google.config";
4
+ import { GaxiosPromise } from "googleapis/build/src/apis/abusiveexperiencereport";
5
+ export declare class GoogleServiceImpl extends GoogleService {
6
+ private config;
7
+ constructor(config: GoogleConfig);
8
+ get client(): import("google-auth-library").OAuth2Client;
9
+ getClient(credentials: any): Promise<any>;
10
+ getClientByAccessToken(cred: {
11
+ accessToken: string;
12
+ refreshToken: string;
13
+ }): any;
14
+ generateAuthUrl(client?: import("google-auth-library").OAuth2Client): string;
15
+ getToken(code: string): Promise<any>;
16
+ getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
17
+ getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
18
+ listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;
19
+ /** @deprecated */
20
+ listEvents(client: typeof this.client, { calendarId }?: {
21
+ calendarId?: string;
22
+ }): Promise<any>;
23
+ deleteEvent(client: typeof this.client, event: {
24
+ eventId: string;
25
+ }): Promise<void>;
26
+ getCalendar(client: typeof this.client): calendar_v3.Calendar;
27
+ createEvent(client: typeof this.client, event: {
28
+ start: string;
29
+ end: string;
30
+ title: string;
31
+ description: string;
32
+ }): Promise<void>;
33
+ refreshAccessToken(client: typeof this.client): Promise<string>;
34
+ }
@@ -0,0 +1,132 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoogleServiceImpl = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ const google_service_1 = require("./google.service");
7
+ const googleapis_1 = require("googleapis");
8
+ const google_config_1 = require("./google.config");
9
+ let GoogleServiceImpl = class GoogleServiceImpl extends google_service_1.GoogleService {
10
+ constructor(config) {
11
+ super();
12
+ this.config = config;
13
+ }
14
+ get client() {
15
+ var _a;
16
+ return new googleapis_1.google.auth.OAuth2({
17
+ clientId: this.config.credential.web.client_id,
18
+ clientSecret: this.config.credential.web.client_secret,
19
+ redirectUri: (_a = this.config.credential.web.redirect_uris) === null || _a === void 0 ? void 0 : _a[0],
20
+ });
21
+ }
22
+ getClient(credentials) {
23
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
24
+ const client = new googleapis_1.google.auth.OAuth2({
25
+ clientId: this.config.credential.web.client_id,
26
+ clientSecret: this.config.credential.web.client_secret,
27
+ });
28
+ client.setCredentials(credentials);
29
+ return client;
30
+ });
31
+ }
32
+ getClientByAccessToken(cred) {
33
+ const client = new googleapis_1.google.auth.OAuth2();
34
+ client.setCredentials({
35
+ access_token: cred.accessToken,
36
+ refresh_token: cred.refreshToken,
37
+ });
38
+ return client;
39
+ }
40
+ generateAuthUrl(client = this.client) {
41
+ const url = client.generateAuthUrl({
42
+ access_type: 'offline',
43
+ scope: [
44
+ 'https://www.googleapis.com/auth/calendar.readonly',
45
+ 'https://www.googleapis.com/auth/calendar.events',
46
+ ],
47
+ redirect_uris: this.config.credential.web.redirect_uris,
48
+ });
49
+ return url;
50
+ }
51
+ getToken(code) {
52
+ return this.client.getToken(code);
53
+ }
54
+ getFileMetadata(client, id) {
55
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
56
+ const drive = googleapis_1.google.drive({ version: 'v3', auth: client });
57
+ return drive.files.get({ fileId: id });
58
+ });
59
+ }
60
+ getFileBuffer(client, id) {
61
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
62
+ const drive = googleapis_1.google.drive({ version: 'v3', auth: client });
63
+ return drive.files.get({ fileId: id, alt: 'media' }, { responseType: 'arraybuffer' });
64
+ });
65
+ }
66
+ listCalendars(client) {
67
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
68
+ const calendar = googleapis_1.google.calendar({ version: 'v3', auth: client });
69
+ const res = yield calendar.calendarList.list({});
70
+ return res.data.items;
71
+ });
72
+ }
73
+ /** @deprecated */
74
+ listEvents(client_1) {
75
+ return tslib_1.__awaiter(this, arguments, void 0, function* (client, { calendarId = 'primary' } = {}) {
76
+ // const calendar = google.calendar({version: 'v3', auth: client});
77
+ // const res = await calendar.events.list({
78
+ // calendarId,
79
+ // timeMin: (new Date()).toISOString(),
80
+ // maxResults: 100,
81
+ // singleEvents: true,
82
+ // orderBy: 'startTime',
83
+ // });
84
+ // return res.data.items;
85
+ });
86
+ }
87
+ deleteEvent(client, event) {
88
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
89
+ const calendar = googleapis_1.google.calendar({ version: 'v3', auth: client });
90
+ yield calendar.events.delete({
91
+ calendarId: 'primary',
92
+ eventId: event.eventId,
93
+ });
94
+ });
95
+ }
96
+ getCalendar(client) {
97
+ return googleapis_1.google.calendar({ version: 'v3', auth: client });
98
+ }
99
+ createEvent(client, event) {
100
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
101
+ const calendar = googleapis_1.google.calendar({ version: 'v3', auth: client });
102
+ yield calendar.events.insert({
103
+ calendarId: 'primary',
104
+ requestBody: {
105
+ start: {
106
+ dateTime: event.start,
107
+ timeZone: 'Asia/Tokyo',
108
+ },
109
+ end: {
110
+ dateTime: event.end,
111
+ timeZone: 'Asia/Tokyo',
112
+ },
113
+ summary: event.title,
114
+ description: event.description,
115
+ }
116
+ });
117
+ });
118
+ }
119
+ refreshAccessToken(client) {
120
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
121
+ const res = yield client.refreshAccessToken();
122
+ return res.credentials.access_token;
123
+ });
124
+ }
125
+ };
126
+ exports.GoogleServiceImpl = GoogleServiceImpl;
127
+ exports.GoogleServiceImpl = GoogleServiceImpl = tslib_1.__decorate([
128
+ (0, core_1.Injectable)(),
129
+ tslib_1.__param(0, (0, core_1.Inject)(google_config_1.GOOGLE_CONFIG)),
130
+ tslib_1.__metadata("design:paramtypes", [Object])
131
+ ], GoogleServiceImpl);
132
+ //# sourceMappingURL=google.service.impl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.service.impl.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/google/src/lib/google.service.impl.ts"],"names":[],"mappings":";;;;AAAA,wCAAmD;AACnD,qDAAiD;AACjD,2CAA2D;AAC3D,mDAA8D;AAKvD,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,8BAAa;IAClD,YACiC,MAAoB;QAEnD,KAAK,EAAE,CAAC;QAFuB,WAAM,GAAN,MAAM,CAAc;IAGrD,CAAC;IAED,IAAI,MAAM;;QACR,OAAO,IAAI,mBAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YAC5B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS;YAC9C,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa;YACtD,WAAW,EAAE,MAAA,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,0CAAG,CAAC,CAAC;SAC3D,CAAC,CAAC;IACL,CAAC;IAEK,SAAS,CAAC,WAAgB;;YAC9B,MAAM,MAAM,GAAG,IAAI,mBAAM,CAAC,IAAI,CAAC,MAAM,CAAC;gBACpC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,SAAS;gBAC9C,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa;aACvD,CAAC,CAAC;YACH,MAAM,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;YACnC,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;IAED,sBAAsB,CAAC,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EAAE;wBACL,QAAQ,EAAE,KAAK,CAAC,KAAK;wBACrB,QAAQ,EAAE,YAAY;qBACvB;oBACD,GAAG,EAAE;wBACH,QAAQ,EAAE,KAAK,CAAC,GAAG;wBACnB,QAAQ,EAAE,YAAY;qBACvB;oBACD,OAAO,EAAE,KAAK,CAAC,KAAK;oBACpB,WAAW,EAAE,KAAK,CAAC,WAAW;iBAC/B;aACF,CAAC,CAAC;QACL,CAAC;KAAA;IAEK,kBAAkB,CAAC,MAA0B;;YACjD,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;YAC9C,OAAO,GAAG,CAAC,WAAW,CAAC,YAAY,CAAC;QACtC,CAAC;KAAA;CACF,CAAA;AAlHY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,iBAAU,GAAE;IAGR,mBAAA,IAAA,aAAM,EAAC,6BAAa,CAAC,CAAA;;GAFb,iBAAiB,CAkH7B"}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GoogleService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const core_1 = require("@angular/core");
6
+ let GoogleService = class GoogleService {
7
+ };
8
+ exports.GoogleService = GoogleService;
9
+ exports.GoogleService = GoogleService = tslib_1.__decorate([
10
+ (0, core_1.Injectable)({ providedIn: 'root' })
11
+ ], GoogleService);
12
+ //# sourceMappingURL=google.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"google.service.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/google/src/lib/google.service.ts"],"names":[],"mappings":";;;;AAAA,wCAA2C;AAKpC,IAAe,aAAa,GAA5B,MAAe,aAAa;CAclC,CAAA;AAdqB,sCAAa;wBAAb,aAAa;IADlC,IAAA,iBAAU,EAAC,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC;GACb,aAAa,CAclC"}
@@ -0,0 +1,4 @@
1
+ export * from './google.config';
2
+ export * from './google.service';
3
+ export * from './places';
4
+ export * from './search';
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./google.config"), exports);
5
+ tslib_1.__exportStar(require("./google.service"), exports);
6
+ tslib_1.__exportStar(require("./places"), exports);
7
+ tslib_1.__exportStar(require("./search"), exports);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/google/src/lib/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,2DAAiC;AACjC,mDAAyB;AACzB,mDAAyB"}
@@ -0,0 +1,3 @@
1
+ export * from './places.config';
2
+ export * from './places.interface';
3
+ export * from './places.service';
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./places.config"), exports);
5
+ tslib_1.__exportStar(require("./places.interface"), exports);
6
+ tslib_1.__exportStar(require("./places.service"), exports);
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/places/index.ts"],"names":[],"mappings":";;;AAAA,0DAAgC;AAChC,6DAAmC;AACnC,2DAAiC"}
@@ -0,0 +1,4 @@
1
+ import { InjectionToken, Provider } from '@angular/core';
2
+ import { GooglePlacesConfig } from './places.interface';
3
+ export declare const GOOGLE_PLACES_CONFIG: InjectionToken<GooglePlacesConfig>;
4
+ export declare function provideGooglePlacesConfig(useFactory: () => GooglePlacesConfig): Provider[];
@@ -0,0 +1,15 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,49 @@
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
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=places.interface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"places.interface.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/places/places.interface.ts"],"names":[],"mappings":""}
@@ -0,0 +1,52 @@
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
+ }
@@ -0,0 +1,211 @@
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
@@ -0,0 +1 @@
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,MAAM,CAAC,MAAM;YACrB,gBAAgB,EAAE,MAAM,CAAC,kBAAkB;SAC5C,CAAC;IACJ,CAAC;IAED;;OAEG;IACK,2BAA2B,CAAC,MAAW;;QAC7C,OAAO;YACL,OAAO,EAAE,MAAM,CAAC,QAAQ;YACxB,IAAI,EAAE,MAAM,CAAC,IAAI;Y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Aa,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"}
@@ -0,0 +1 @@
1
+ export * from './search.service';
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./search.service"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/@nx-ddd/google/src/lib/search/index.ts"],"names":[],"mappings":";;;AAAA,2DAAiC"}
@@ -0,0 +1,17 @@
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 {};
@@ -0,0 +1,37 @@
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
@@ -0,0 +1 @@
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"}
File without changes
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=test-setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-setup.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/google/src/test-setup.ts"],"names":[],"mappings":""}