@nx-ddd/google 19.2.1 → 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
package/index.d.ts
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken } from '@angular/core';
|
|
3
|
+
import { google, drive_v3, calendar_v3 } from 'googleapis';
|
|
4
|
+
import { GaxiosPromise } from 'googleapis/build/src/apis/abusiveexperiencereport';
|
|
5
|
+
import * as google_auth_library from 'google-auth-library';
|
|
6
|
+
|
|
7
|
+
interface GoogleConfig {
|
|
8
|
+
credential: {
|
|
9
|
+
web: {
|
|
10
|
+
client_id: string;
|
|
11
|
+
project_id: string;
|
|
12
|
+
auth_uri: string;
|
|
13
|
+
token_uri: string;
|
|
14
|
+
auth_provider_x509_cert_url: string;
|
|
15
|
+
client_secret: string;
|
|
16
|
+
redirect_uris?: string[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
declare const GOOGLE_CONFIG: InjectionToken<GoogleConfig>;
|
|
21
|
+
|
|
22
|
+
declare abstract class GoogleService {
|
|
23
|
+
abstract client: (typeof google)['auth']['OAuth2']['prototype'];
|
|
24
|
+
abstract getClient(credentials: any): Promise<any>;
|
|
25
|
+
abstract getClientByAccessToken(cred: {
|
|
26
|
+
accessToken: string;
|
|
27
|
+
refreshToken: string;
|
|
28
|
+
}): (typeof google)['auth']['OAuth2']['prototype'];
|
|
29
|
+
abstract generateAuthUrl(): string;
|
|
30
|
+
abstract getToken(code: string): Promise<any>;
|
|
31
|
+
abstract getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
|
|
32
|
+
abstract getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
|
|
33
|
+
abstract listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;
|
|
34
|
+
abstract listEvents(client: typeof this.client, props: {
|
|
35
|
+
calendarId: string;
|
|
36
|
+
}): Promise<any>;
|
|
37
|
+
abstract createEvent(client: typeof this.client, event: {
|
|
38
|
+
start: string;
|
|
39
|
+
end: string;
|
|
40
|
+
title: string;
|
|
41
|
+
description: string;
|
|
42
|
+
}): Promise<any>;
|
|
43
|
+
abstract deleteEvent(client: typeof this.client, event: {
|
|
44
|
+
eventId: string;
|
|
45
|
+
}): Promise<any>;
|
|
46
|
+
abstract getCalendar(client: typeof this.client): calendar_v3.Calendar;
|
|
47
|
+
abstract refreshAccessToken(client: typeof this.client, refreshToken: string): Promise<any>;
|
|
48
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GoogleService, never>;
|
|
49
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GoogleService>;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare class GoogleServiceImpl extends GoogleService {
|
|
53
|
+
private config;
|
|
54
|
+
constructor(config: GoogleConfig);
|
|
55
|
+
get client(): google_auth_library.OAuth2Client;
|
|
56
|
+
getClient(credentials: any): Promise<any>;
|
|
57
|
+
getClientByAccessToken(cred: {
|
|
58
|
+
accessToken: string;
|
|
59
|
+
refreshToken: string;
|
|
60
|
+
}): any;
|
|
61
|
+
generateAuthUrl(client?: google_auth_library.OAuth2Client): string;
|
|
62
|
+
getToken(code: string): Promise<any>;
|
|
63
|
+
getFileMetadata(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
|
|
64
|
+
getFileBuffer(client: any, id: string): GaxiosPromise<drive_v3.Schema$File>;
|
|
65
|
+
listCalendars(client: typeof this.client): Promise<calendar_v3.Schema$CalendarListEntry[]>;
|
|
66
|
+
/** @deprecated */
|
|
67
|
+
listEvents(client: typeof this.client, { calendarId }?: {
|
|
68
|
+
calendarId?: string;
|
|
69
|
+
}): Promise<any>;
|
|
70
|
+
deleteEvent(client: typeof this.client, event: {
|
|
71
|
+
eventId: string;
|
|
72
|
+
}): Promise<void>;
|
|
73
|
+
getCalendar(client: typeof this.client): calendar_v3.Calendar;
|
|
74
|
+
createEvent(client: typeof this.client, event: {
|
|
75
|
+
start: string;
|
|
76
|
+
end: string;
|
|
77
|
+
title: string;
|
|
78
|
+
description: string;
|
|
79
|
+
}): Promise<void>;
|
|
80
|
+
refreshAccessToken(client: typeof this.client): Promise<string>;
|
|
81
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GoogleServiceImpl, never>;
|
|
82
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GoogleServiceImpl>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
declare class GoogleModule {
|
|
86
|
+
static forRoot(config: GoogleConfig): {
|
|
87
|
+
ngModule: typeof GoogleModule;
|
|
88
|
+
providers: ({
|
|
89
|
+
provide: i0.InjectionToken<GoogleConfig>;
|
|
90
|
+
useValue: GoogleConfig;
|
|
91
|
+
useClass?: undefined;
|
|
92
|
+
} | {
|
|
93
|
+
provide: typeof GoogleService;
|
|
94
|
+
useClass: typeof GoogleServiceImpl;
|
|
95
|
+
useValue?: undefined;
|
|
96
|
+
})[];
|
|
97
|
+
};
|
|
98
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GoogleModule, never>;
|
|
99
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<GoogleModule, never, never, never>;
|
|
100
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<GoogleModule>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export { GOOGLE_CONFIG, GoogleModule, GoogleService };
|
|
104
|
+
export type { GoogleConfig };
|
package/package.json
CHANGED
|
@@ -1,21 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/google",
|
|
3
|
-
"version": "19.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
"url": "https://github.com/xx-machina/plaform.git"
|
|
3
|
+
"version": "19.3.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/core": ">=17.0.0",
|
|
6
|
+
"@angular/common": ">=17.0.0"
|
|
8
7
|
},
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"type": "commonjs",
|
|
12
|
-
"dependencies": {},
|
|
13
|
-
"peerDependencies": {},
|
|
8
|
+
"module": "fesm2022/nx-ddd-google.mjs",
|
|
9
|
+
"typings": "index.d.ts",
|
|
14
10
|
"exports": {
|
|
15
|
-
"./package.json":
|
|
11
|
+
"./package.json": {
|
|
12
|
+
"default": "./package.json"
|
|
13
|
+
},
|
|
16
14
|
".": {
|
|
17
|
-
"types": "./
|
|
18
|
-
"default": "./
|
|
15
|
+
"types": "./index.d.ts",
|
|
16
|
+
"default": "./fesm2022/nx-ddd-google.mjs"
|
|
17
|
+
},
|
|
18
|
+
"./places": {
|
|
19
|
+
"types": "./places/index.d.ts",
|
|
20
|
+
"default": "./fesm2022/nx-ddd-google-places.mjs"
|
|
21
|
+
},
|
|
22
|
+
"./search": {
|
|
23
|
+
"types": "./search/index.d.ts",
|
|
24
|
+
"default": "./fesm2022/nx-ddd-google-search.mjs"
|
|
19
25
|
}
|
|
26
|
+
},
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"tslib": "^2.3.0"
|
|
20
30
|
}
|
|
21
31
|
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Provider } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
interface GooglePlacesConfig {
|
|
5
|
+
apiKey: string;
|
|
6
|
+
language?: string;
|
|
7
|
+
}
|
|
8
|
+
interface PlaceSearchResult {
|
|
9
|
+
placeId: string;
|
|
10
|
+
name: string;
|
|
11
|
+
formattedAddress: string;
|
|
12
|
+
geometry: {
|
|
13
|
+
location: {
|
|
14
|
+
lat: number;
|
|
15
|
+
lng: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
photos?: PlacePhoto[];
|
|
19
|
+
rating?: number;
|
|
20
|
+
userRatingsTotal?: number;
|
|
21
|
+
}
|
|
22
|
+
interface PlacePhoto {
|
|
23
|
+
photoReference: string;
|
|
24
|
+
height: number;
|
|
25
|
+
width: number;
|
|
26
|
+
htmlAttributions: string[];
|
|
27
|
+
}
|
|
28
|
+
interface PlaceDetailsResult {
|
|
29
|
+
placeId: string;
|
|
30
|
+
name: string;
|
|
31
|
+
formattedAddress: string;
|
|
32
|
+
formattedPhoneNumber?: string;
|
|
33
|
+
website?: string;
|
|
34
|
+
photos?: PlacePhoto[];
|
|
35
|
+
rating?: number;
|
|
36
|
+
userRatingsTotal?: number;
|
|
37
|
+
geometry: {
|
|
38
|
+
location: {
|
|
39
|
+
lat: number;
|
|
40
|
+
lng: number;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
interface PlaceSearchResponse {
|
|
45
|
+
results: PlaceSearchResult[];
|
|
46
|
+
status: string;
|
|
47
|
+
nextPageToken?: string;
|
|
48
|
+
}
|
|
49
|
+
interface PlaceDetailsResponse {
|
|
50
|
+
result: PlaceDetailsResult;
|
|
51
|
+
status: string;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
declare const GOOGLE_PLACES_CONFIG: InjectionToken<GooglePlacesConfig>;
|
|
55
|
+
declare function provideGooglePlacesConfig(useFactory: () => GooglePlacesConfig): Provider[];
|
|
56
|
+
|
|
57
|
+
declare class GooglePlacesService {
|
|
58
|
+
private readonly http;
|
|
59
|
+
private readonly config;
|
|
60
|
+
/**
|
|
61
|
+
* Transform API response from snake_case to camelCase
|
|
62
|
+
*/
|
|
63
|
+
private transformPlaceSearchResult;
|
|
64
|
+
/**
|
|
65
|
+
* Transform API response from snake_case to camelCase
|
|
66
|
+
*/
|
|
67
|
+
private transformPlaceDetailsResult;
|
|
68
|
+
/**
|
|
69
|
+
* Search for places using Google Places Text Search API
|
|
70
|
+
*/
|
|
71
|
+
searchPlaces(query: string, options?: {
|
|
72
|
+
location?: string;
|
|
73
|
+
radius?: number;
|
|
74
|
+
limit?: number;
|
|
75
|
+
}): Promise<PlaceSearchResult[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Get detailed information about a place using Place Details API
|
|
78
|
+
*/
|
|
79
|
+
getPlaceDetails(placeId: string, fields?: string[]): Promise<PlaceDetailsResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Get place photo as Blob using Place Photos API
|
|
82
|
+
*/
|
|
83
|
+
getPlacePhoto(photoReference: string, maxWidth?: number): Promise<Blob>;
|
|
84
|
+
/**
|
|
85
|
+
* Get multiple place photos as Blobs
|
|
86
|
+
*/
|
|
87
|
+
getPlacePhotos(photoReferences: string[], maxWidth?: number, limit?: number): Promise<{
|
|
88
|
+
photoReference: string;
|
|
89
|
+
blob: Blob;
|
|
90
|
+
}[]>;
|
|
91
|
+
/**
|
|
92
|
+
* Search places and get their photos in one operation
|
|
93
|
+
*/
|
|
94
|
+
searchPlacesWithPhotos(query: string, options?: {
|
|
95
|
+
location?: string;
|
|
96
|
+
radius?: number;
|
|
97
|
+
maxPlaces?: number;
|
|
98
|
+
maxPhotosPerPlace?: number;
|
|
99
|
+
photoMaxWidth?: number;
|
|
100
|
+
}): Promise<Array<{
|
|
101
|
+
place: PlaceDetailsResult;
|
|
102
|
+
photos: {
|
|
103
|
+
photoReference: string;
|
|
104
|
+
blob: Blob;
|
|
105
|
+
}[];
|
|
106
|
+
}>>;
|
|
107
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GooglePlacesService, never>;
|
|
108
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GooglePlacesService>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export { GOOGLE_PLACES_CONFIG, GooglePlacesService, provideGooglePlacesConfig };
|
|
112
|
+
export type { GooglePlacesConfig, PlaceDetailsResponse, PlaceDetailsResult, PlacePhoto, PlaceSearchResponse, PlaceSearchResult };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { HttpClient } from '@angular/common/http';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { InjectionToken } from '@angular/core';
|
|
4
|
+
|
|
5
|
+
interface GoogleSearchConfig {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
engineId: string;
|
|
8
|
+
}
|
|
9
|
+
declare const GOOGLE_SEARCH_CONFIG: InjectionToken<GoogleSearchConfig>;
|
|
10
|
+
declare function provideGoogleSearchConfig(useFactory: () => GoogleSearchConfig): {
|
|
11
|
+
provide: InjectionToken<GoogleSearchConfig>;
|
|
12
|
+
useFactory: () => GoogleSearchConfig;
|
|
13
|
+
};
|
|
14
|
+
declare class GoogleSearchService {
|
|
15
|
+
readonly http: HttpClient;
|
|
16
|
+
readonly config: GoogleSearchConfig;
|
|
17
|
+
searchByGoogle(q: string): Promise<Object>;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<GoogleSearchService, never>;
|
|
19
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<GoogleSearchService>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { GOOGLE_SEARCH_CONFIG, GoogleSearchService, provideGoogleSearchConfig };
|
package/README.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib';
|
package/src/index.js
DELETED
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/google/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
|
|
@@ -1,15 +0,0 @@
|
|
|
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>;
|
package/src/lib/google.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,17 +0,0 @@
|
|
|
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
|
-
}
|
package/src/lib/google.module.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,132 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,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AAC;QACtC,CAAC;KAAA;CACF,CAAA;AAlHY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,iBAAU,GAAE;IAGR,mBAAA,IAAA,aAAM,EAAC,6BAAa,CAAC,CAAA;;GAFb,iBAAiB,CAkH7B"}
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/src/lib/index.d.ts
DELETED
package/src/lib/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
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
|
package/src/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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"}
|
package/src/lib/places/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,4 +0,0 @@
|
|
|
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[];
|