@intuitionrobotics/google-services 0.46.0 → 0.47.1
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/app-backend/modules/AuthModule.d.ts +3 -3
- package/app-backend/modules/AuthModule.js +4 -5
- package/app-backend/modules/AuthModule.js.map +1 -1
- package/app-backend/modules/DialogFlowApi.d.ts +1 -1
- package/app-backend/modules/DialogFlowApi.js +6 -16
- package/app-backend/modules/DialogFlowApi.js.map +1 -1
- package/app-backend/modules/GoogleCloudModule.d.ts +6 -6
- package/app-backend/modules/GoogleCloudModule.js +16 -20
- package/app-backend/modules/GoogleCloudModule.js.map +1 -1
- package/app-backend/modules/PubSubModule.d.ts +2 -2
- package/app-backend/modules/PubSubModule.js +2 -2
- package/app-backend/modules/PubSubModule.js.map +1 -1
- package/app-backend/modules/consts.js +20 -2
- package/app-backend/modules/consts.js.map +1 -1
- package/index.d.ts +4 -0
- package/index.js +37 -0
- package/index.js.map +1 -1
- package/package.json +8 -8
- package/types.d.ts +2 -1
- package/types.js +18 -0
- package/types.js.map +1 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { Module } from "@intuitionrobotics/ts-common
|
|
1
|
+
import { Module } from "@intuitionrobotics/ts-common";
|
|
2
2
|
import { GoogleAuth, JWTInput } from "google-auth-library";
|
|
3
3
|
import { JWTOptions } from "google-auth-library/build/src/auth/jwtclient";
|
|
4
4
|
import { OAuth2ClientOptions } from "google-auth-library/build/src/auth/oauth2client";
|
|
5
5
|
import { UserRefreshClientOptions } from "google-auth-library/build/src/auth/refreshclient";
|
|
6
|
-
|
|
6
|
+
type AuthModuleConfig = {
|
|
7
7
|
auth: {
|
|
8
8
|
[k: string]: JWTInput | string;
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
type Version = 'v1' | 'v2';
|
|
12
12
|
export declare class AuthModule_Class extends Module<AuthModuleConfig> {
|
|
13
13
|
constructor();
|
|
14
14
|
getAuth<T extends Version = "v2">(authKey: string, scopes: string[], version?: T, clientOptions?: JWTOptions | OAuth2ClientOptions | UserRefreshClientOptions): {
|
|
@@ -10,10 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AuthModule = exports.AuthModule_Class = void 0;
|
|
13
|
-
const
|
|
14
|
-
const module_1 = require("@intuitionrobotics/ts-common/core/module");
|
|
13
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
15
14
|
const google_auth_library_1 = require("google-auth-library");
|
|
16
|
-
class AuthModule_Class extends
|
|
15
|
+
class AuthModule_Class extends ts_common_1.Module {
|
|
17
16
|
constructor() {
|
|
18
17
|
super("AuthModule");
|
|
19
18
|
}
|
|
@@ -31,7 +30,7 @@ class AuthModule_Class extends module_1.Module {
|
|
|
31
30
|
getAuthConfig(authKey) {
|
|
32
31
|
const projectAuth = this.config.auth[authKey];
|
|
33
32
|
if (!projectAuth)
|
|
34
|
-
throw new
|
|
33
|
+
throw new ts_common_1.ImplementationMissingException(`Config of AuthModule_Class for authKey: ${authKey} was not found`);
|
|
35
34
|
return projectAuth;
|
|
36
35
|
}
|
|
37
36
|
getJWT(authKey, scopes) {
|
|
@@ -40,7 +39,7 @@ class AuthModule_Class extends module_1.Module {
|
|
|
40
39
|
if (typeof authConfig === 'string') {
|
|
41
40
|
return new google_auth_library_1.JWT({ keyFile: authConfig, scopes }).authorize();
|
|
42
41
|
}
|
|
43
|
-
throw new
|
|
42
|
+
throw new ts_common_1.NotImplementedYetException("cannot create a JWT from a raw credentials.. need path to file");
|
|
44
43
|
});
|
|
45
44
|
}
|
|
46
45
|
;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AuthModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/AuthModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"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CAA0B,CAAC,gEAAgE,CAAC,CAAA;QACvG,CAAC;KAAA;IAAA,CAAC;CACF;AArCD,4CAqCC;AAEY,QAAA,UAAU,GAAG,IAAI,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Logger } from "@intuitionrobotics/ts-common
|
|
1
|
+
import { Logger } from "@intuitionrobotics/ts-common";
|
|
2
2
|
import { dialogflow_v2 } from "googleapis";
|
|
3
3
|
import Schema$GoogleCloudDialogflowV2EntityTypeEntity = dialogflow_v2.Schema$GoogleCloudDialogflowV2EntityTypeEntity;
|
|
4
4
|
export declare class DialogFlowApi extends Logger {
|
|
@@ -10,12 +10,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.DialogFlowApi = void 0;
|
|
13
|
-
const
|
|
14
|
-
const Logger_1 = require("@intuitionrobotics/ts-common/core/logger/Logger");
|
|
13
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
15
14
|
const googleapis_1 = require("googleapis");
|
|
16
15
|
const AuthModule_1 = require("./AuthModule");
|
|
17
16
|
const consts_1 = require("./consts");
|
|
18
|
-
class DialogFlowApi extends
|
|
17
|
+
class DialogFlowApi extends ts_common_1.Logger {
|
|
19
18
|
constructor(authKey) {
|
|
20
19
|
super();
|
|
21
20
|
this.agent = {
|
|
@@ -32,10 +31,7 @@ class DialogFlowApi extends Logger_1.Logger {
|
|
|
32
31
|
"apiVersion": "API_VERSION_V2",
|
|
33
32
|
"tier": "TIER_STANDARD"
|
|
34
33
|
};
|
|
35
|
-
yield this.dialogFlowApi.projects.setAgent({
|
|
36
|
-
parent: `projects/${agentProjectId}`,
|
|
37
|
-
requestBody: newTestAgent
|
|
38
|
-
});
|
|
34
|
+
yield this.dialogFlowApi.projects.setAgent({ parent: `projects/${agentProjectId}`, requestBody: newTestAgent });
|
|
39
35
|
this.logInfo(`Created agent for project ${agentProjectId} with name: ${name}`);
|
|
40
36
|
}),
|
|
41
37
|
train: (agentProjectId) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -49,17 +45,11 @@ class DialogFlowApi extends Logger_1.Logger {
|
|
|
49
45
|
}),
|
|
50
46
|
restore: (agentProjectId, agentContent) => __awaiter(this, void 0, void 0, function* () {
|
|
51
47
|
this.logInfo(`Restoring ${agentProjectId}`);
|
|
52
|
-
return (yield this.dialogFlowApi.projects.agent.restore({
|
|
53
|
-
parent: `projects/${agentProjectId}`,
|
|
54
|
-
requestBody: { agentContent }
|
|
55
|
-
})).data;
|
|
48
|
+
return (yield this.dialogFlowApi.projects.agent.restore({ parent: `projects/${agentProjectId}`, requestBody: { agentContent } })).data;
|
|
56
49
|
}),
|
|
57
50
|
import: (agentProjectId, agentContent) => __awaiter(this, void 0, void 0, function* () {
|
|
58
51
|
this.logInfo(`Importing ${agentProjectId}`);
|
|
59
|
-
return (yield this.dialogFlowApi.projects.agent.import({
|
|
60
|
-
parent: `projects/${agentProjectId}`,
|
|
61
|
-
requestBody: { agentContent }
|
|
62
|
-
})).data;
|
|
52
|
+
return (yield this.dialogFlowApi.projects.agent.import({ parent: `projects/${agentProjectId}`, requestBody: { agentContent } })).data;
|
|
63
53
|
}),
|
|
64
54
|
copy: (fromAgent, toAgent) => __awaiter(this, void 0, void 0, function* () {
|
|
65
55
|
this.logInfo(`Merging agent ${fromAgent} => ${toAgent}`);
|
|
@@ -92,7 +82,7 @@ class DialogFlowApi extends Logger_1.Logger {
|
|
|
92
82
|
intentList.push(...response.data.intents);
|
|
93
83
|
counter++;
|
|
94
84
|
if (counter > 10)
|
|
95
|
-
throw new
|
|
85
|
+
throw new ts_common_1.ThisShouldNotHappenException('Too many calls to DialogFlow API');
|
|
96
86
|
} while (pageToken);
|
|
97
87
|
return intentList;
|
|
98
88
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogFlowApi.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/DialogFlowApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"DialogFlowApi.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/DialogFlowApi.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAGsC;AACtC,2CAAyC;AACzC,6CAAwC;AACxC,qCAAkC;AAKlC,MAAa,aACZ,SAAQ,kBAAM;IAId,YAAY,OAAe;QAC1B,KAAK,EAAE,CAAA;QAIR,UAAK,GAAG;YACP,MAAM,EAAE,CAAO,cAAsB,EAAE,IAAY,EAAE,EAAE;gBACtD,IAAI,CAAC,OAAO,CAAC,8BAA8B,cAAc,EAAE,CAAC,CAAA;gBAC5D,MAAM,YAAY,GAAG;oBACpB,QAAQ,EAAE,YAAY,cAAc,EAAE;oBACtC,aAAa,EAAE,IAAI;oBACnB,qBAAqB,EAAE,IAAI;oBAC3B,UAAU,EAAE,kBAAkB;oBAC9B,eAAe,EAAE,IAAI;oBACrB,WAAW,EAAE,mBAAmB;oBAChC,yBAAyB,EAAE,GAAG;oBAC9B,YAAY,EAAE,gBAAgB;oBAC9B,MAAM,EAAE,eAAe;iBACvB,CAAA;gBAED,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAC,MAAM,EAAE,YAAY,cAAc,EAAE,EAAE,WAAW,EAAE,YAAY,EAAC,CAAC,CAAC;gBAC9G,IAAI,CAAC,OAAO,CAAC,6BAA6B,cAAc,eAAe,IAAI,EAAE,CAAC,CAAC;YAChF,CAAC,CAAA;YACD,KAAK,EAAE,CAAO,cAAsB,EAAE,EAAE;gBACvC,IAAI,CAAC,OAAO,CAAC,SAAS,cAAc,EAAE,CAAC,CAAA;gBACvC,OAAO,CAAC,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC,MAAM,EAAE,YAAY,cAAc,EAAE,EAAC,CAAC,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C,CAAC,CAAC,IAAI,CAAC,IAAI,CAAA;YACvF,CAAC,CAAA;SACD,CAAA;QA9GA,IAAI,CAAC,aAAa,GAAG,IAAI,0BAAa,CAAC,UAAU,CAAC,uBAAU,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,iBAAQ,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAC1G,CAAC;CA8GD;AAtHD,sCAsHC"}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
+
import { Module } from "@intuitionrobotics/ts-common";
|
|
1
2
|
import { cloudresourcemanager_v1, cloudresourcemanager_v2, serviceusage_v1 } from "googleapis";
|
|
2
|
-
import { ServiceKey } from "./consts";
|
|
3
|
-
import { Module } from "@intuitionrobotics/ts-common/core/module";
|
|
4
3
|
import Schema$Folder = cloudresourcemanager_v2.Schema$Folder;
|
|
5
4
|
import Schema$Project = cloudresourcemanager_v1.Schema$Project;
|
|
6
|
-
|
|
5
|
+
import { ServiceKey } from "./consts";
|
|
6
|
+
type CreateFolder = {
|
|
7
7
|
parentId: string;
|
|
8
8
|
folderName: string;
|
|
9
9
|
};
|
|
10
|
-
|
|
10
|
+
type QueryFolder = {
|
|
11
11
|
parentId: string;
|
|
12
12
|
folderName: string;
|
|
13
13
|
};
|
|
14
|
-
|
|
14
|
+
type GoogleCloudManagerConfig = {
|
|
15
15
|
authKey: string;
|
|
16
16
|
scopes: string[];
|
|
17
17
|
};
|
|
@@ -32,7 +32,7 @@ export declare class GoogleCloudManager_Class extends Module<GoogleCloudManagerC
|
|
|
32
32
|
getOrCreateProjects(parentId: string, ...projects: {
|
|
33
33
|
projectId: string;
|
|
34
34
|
name: string;
|
|
35
|
-
}[]): Promise<({
|
|
35
|
+
}[]): Promise<(cloudresourcemanager_v1.Schema$Project | {
|
|
36
36
|
[key: string]: any;
|
|
37
37
|
} | undefined)[]>;
|
|
38
38
|
createProject(parentId: string, projectId: string, name?: string): Promise<{
|
|
@@ -10,21 +10,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.GoogleCloudManager = exports.GoogleCloudManager_Class = void 0;
|
|
13
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
13
14
|
const googleapis_1 = require("googleapis");
|
|
14
15
|
const AuthModule_1 = require("./AuthModule");
|
|
15
|
-
const consts_1 = require("./consts");
|
|
16
|
-
const module_1 = require("@intuitionrobotics/ts-common/core/module");
|
|
17
|
-
const exceptions_1 = require("@intuitionrobotics/ts-common/core/exceptions");
|
|
18
|
-
const date_time_tools_1 = require("@intuitionrobotics/ts-common/utils/date-time-tools");
|
|
19
|
-
const array_tools_1 = require("@intuitionrobotics/ts-common/utils/array-tools");
|
|
20
|
-
const tools_1 = require("@intuitionrobotics/ts-common/utils/tools");
|
|
21
16
|
var Serviceusage = googleapis_1.serviceusage_v1.Serviceusage;
|
|
22
17
|
var Cloudresourcemanager = googleapis_1.cloudresourcemanager_v2.Cloudresourcemanager;
|
|
23
18
|
var CloudresourcemanagerV1 = googleapis_1.cloudresourcemanager_v1.Cloudresourcemanager;
|
|
24
|
-
|
|
19
|
+
const consts_1 = require("./consts");
|
|
20
|
+
class GoogleCloudManager_Class extends ts_common_1.Module {
|
|
25
21
|
constructor() {
|
|
26
22
|
super("GoogleCloudManager");
|
|
27
|
-
this.
|
|
23
|
+
this.setDefaultConfig({ scopes: [consts_1.GCPScope.CloudPlatform] });
|
|
28
24
|
}
|
|
29
25
|
init() {
|
|
30
26
|
this.cloudServicesManagerAPI = new Serviceusage(AuthModule_1.AuthModule.getAuth(this.config.authKey, this.config.scopes, 'v1'));
|
|
@@ -35,19 +31,19 @@ class GoogleCloudManager_Class extends module_1.Module {
|
|
|
35
31
|
getOrCreateFolder(parentFolderId, folderName) {
|
|
36
32
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
33
|
if (parentFolderId === undefined)
|
|
38
|
-
throw new
|
|
34
|
+
throw new ts_common_1.BadImplementationException("MUST provide a parentFolderId");
|
|
39
35
|
if (folderName === undefined)
|
|
40
|
-
throw new
|
|
36
|
+
throw new ts_common_1.BadImplementationException("MUST provide a folderName");
|
|
41
37
|
const folders = yield this.queryFolders({ parentId: parentFolderId, folderName });
|
|
42
38
|
let parentFolder;
|
|
43
39
|
if (folders.length > 1)
|
|
44
|
-
throw new
|
|
40
|
+
throw new ts_common_1.ThisShouldNotHappenException("too many folders for query...");
|
|
45
41
|
else if (folders.length === 1)
|
|
46
42
|
parentFolder = folders[0];
|
|
47
43
|
else
|
|
48
44
|
parentFolder = yield this.createFolder({ parentId: parentFolderId, folderName });
|
|
49
45
|
if (!parentFolder)
|
|
50
|
-
throw new
|
|
46
|
+
throw new ts_common_1.BadImplementationException("MUST be parentFolder");
|
|
51
47
|
return this.getFolderId(parentFolder);
|
|
52
48
|
});
|
|
53
49
|
}
|
|
@@ -78,13 +74,13 @@ class GoogleCloudManager_Class extends module_1.Module {
|
|
|
78
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
79
75
|
let retry = 5;
|
|
80
76
|
while (retry >= 0) {
|
|
81
|
-
yield
|
|
77
|
+
yield (0, ts_common_1.timeout)(2000);
|
|
82
78
|
const res = yield this.cloudResourcesManagerAPI.operations.get({ name });
|
|
83
79
|
if (res.data.done)
|
|
84
80
|
return res.data.response;
|
|
85
81
|
retry--;
|
|
86
82
|
}
|
|
87
|
-
throw new
|
|
83
|
+
throw new ts_common_1.ImplementationMissingException("need better handling here..");
|
|
88
84
|
});
|
|
89
85
|
}
|
|
90
86
|
// PROJECTS
|
|
@@ -101,7 +97,7 @@ class GoogleCloudManager_Class extends module_1.Module {
|
|
|
101
97
|
const projectsToCreate = projects
|
|
102
98
|
.filter((project) => !existingProjects.find((gcproject) => gcproject.name === project.name));
|
|
103
99
|
const newProjects = yield Promise.all(projectsToCreate.map(project => this.createProject(parentId, project.projectId, project.name)));
|
|
104
|
-
const allProjects =
|
|
100
|
+
const allProjects = (0, ts_common_1.filterInstances)([...existingProjects, ...newProjects]);
|
|
105
101
|
return projects.map(project => allProjects.find(gcpProject => gcpProject.name === project.name));
|
|
106
102
|
});
|
|
107
103
|
}
|
|
@@ -124,13 +120,13 @@ class GoogleCloudManager_Class extends module_1.Module {
|
|
|
124
120
|
return __awaiter(this, void 0, void 0, function* () {
|
|
125
121
|
let retry = 5;
|
|
126
122
|
while (retry >= 0) {
|
|
127
|
-
yield
|
|
123
|
+
yield (0, ts_common_1.timeout)(2000);
|
|
128
124
|
const res = yield this.cloudResourcesManagerAPIv1.operations.get({ name });
|
|
129
125
|
if (res.data.done)
|
|
130
126
|
return res.data.response;
|
|
131
127
|
retry--;
|
|
132
128
|
}
|
|
133
|
-
throw new
|
|
129
|
+
throw new ts_common_1.ImplementationMissingException("need better handling here..");
|
|
134
130
|
});
|
|
135
131
|
}
|
|
136
132
|
// SERVICES
|
|
@@ -142,7 +138,7 @@ class GoogleCloudManager_Class extends module_1.Module {
|
|
|
142
138
|
}
|
|
143
139
|
enableService(serviceKey, enable, ...projectIds) {
|
|
144
140
|
return __awaiter(this, void 0, void 0, function* () {
|
|
145
|
-
this.logInfo(`Enabling Service "${serviceKey}" for projects: ${
|
|
141
|
+
this.logInfo(`Enabling Service "${serviceKey}" for projects: ${(0, ts_common_1.__stringify)(projectIds)}`);
|
|
146
142
|
return Promise.all(projectIds.map(projectId => this._enableService(serviceKey, projectId, enable)));
|
|
147
143
|
});
|
|
148
144
|
}
|
|
@@ -171,13 +167,13 @@ class GoogleCloudManager_Class extends module_1.Module {
|
|
|
171
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
172
168
|
let retry = 5;
|
|
173
169
|
while (retry >= 0) {
|
|
174
|
-
yield
|
|
170
|
+
yield (0, ts_common_1.timeout)(2000);
|
|
175
171
|
const res = yield this.cloudServicesManagerAPI.operations.get({ name });
|
|
176
172
|
if (res.data.done)
|
|
177
173
|
return (_a = res.data.response) === null || _a === void 0 ? void 0 : _a.service;
|
|
178
174
|
retry--;
|
|
179
175
|
}
|
|
180
|
-
throw new
|
|
176
|
+
throw new ts_common_1.ImplementationMissingException("need better handling here..");
|
|
181
177
|
});
|
|
182
178
|
}
|
|
183
179
|
isEnabled(serviceKey, projectId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoogleCloudModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/GoogleCloudModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"GoogleCloudModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/GoogleCloudModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAQsC;AACtC,2CAIoB;AACpB,6CAAwC;AACxC,IAAO,YAAY,GAAG,4BAAe,CAAC,YAAY,CAAC;AACnD,IAAO,oBAAoB,GAAG,oCAAuB,CAAC,oBAAoB,CAAC;AAC3E,IAAO,sBAAsB,GAAG,oCAAuB,CAAC,oBAAoB,CAAC;AAI7E,qCAGkB;AAWlB,MAAa,wBACZ,SAAQ,kBAAgC;IAKxC;QACC,KAAK,CAAC,oBAAoB,CAAC,CAAC;QAC5B,IAAI,CAAC,gBAAgB,CAAC,EAAC,MAAM,EAAE,CAAC,iBAAQ,CAAC,aAAa,CAAC,EAA6B,CAAC,CAAA;IACtF,CAAC;IAES,IAAI;QACb,IAAI,CAAC,uBAAuB,GAAG,IAAI,YAAY,CAAC,uBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;QACnH,IAAI,CAAC,wBAAwB,GAAG,IAAI,oBAAoB,CAAC,uBAAU,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QACtH,IAAI,CAAC,0BAA0B,GAAG,IAAI,sBAAsB,CAAC,uB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AAY;;;YAClD,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,OAAO,KAAK,IAAI,CAAC,EAAE,CAAC;gBACnB,MAAM,IAAA,mBAAO,EAAC,IAAI,CAAC,CAAC;gBACpB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,uBAAuB,CAAC,UAAU,CAAC,GAAG,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;gBACtE,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI;oBAChB,OAAO,MAAA,GAAG,CAAC,IAAI,CAAC,QAAQ,0CAAE,OAAgD,CAAC;gBAE5E,KAAK,EAAE,CAAC;YACT,CAAC;YAED,MAAM,IAAI,0CAA8B,CAAC,6BAA6B,CAAC,CAAC;;KACxE;IAEK,SAAS,CAAC,UAAsB,EAAE,SAAiB;;YACxD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;YAC7D,OAAO,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACjC,CAAC;KAAA;IAEO,UAAU,CAAC,OAA8C;QAChE,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC;IACpC,CAAC;CAED;AAvLD,4DAuLC;AAEY,QAAA,kBAAkB,GAAG,IAAI,wBAAwB,EAAE,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Module } from "@intuitionrobotics/ts-common
|
|
2
|
+
import { Module } from "@intuitionrobotics/ts-common";
|
|
3
3
|
import { PublishOptions } from "@google-cloud/pubsub/build/src/topic";
|
|
4
4
|
declare class PubSubModule_Class extends Module {
|
|
5
5
|
constructor();
|
|
6
6
|
project(projectId: string, authKey?: string): {
|
|
7
7
|
createTopic: (topicName: string) => Promise<import("@google-cloud/pubsub").Topic>;
|
|
8
|
-
topic: (topicName: string, options?: PublishOptions
|
|
8
|
+
topic: (topicName: string, options?: PublishOptions) => {
|
|
9
9
|
publishJson: (json: object) => Promise<string>;
|
|
10
10
|
publish: (buffer: Buffer) => Promise<string>;
|
|
11
11
|
};
|
|
@@ -10,10 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PubSubModule = void 0;
|
|
13
|
-
const
|
|
13
|
+
const ts_common_1 = require("@intuitionrobotics/ts-common");
|
|
14
14
|
const pubsub_1 = require("@google-cloud/pubsub");
|
|
15
15
|
const AuthModule_1 = require("./AuthModule");
|
|
16
|
-
class PubSubModule_Class extends
|
|
16
|
+
class PubSubModule_Class extends ts_common_1.Module {
|
|
17
17
|
constructor() {
|
|
18
18
|
super("PubSubModule");
|
|
19
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PubSubModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/PubSubModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"PubSubModule.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/PubSubModule.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,4DAAoD;AACpD,iDAA4C;AAE5C,6CAAwC;AAGxC,MAAM,kBACF,SAAQ,kBAAM;IAEd;QACI,KAAK,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;IAED,OAAO,CAAC,SAAiB,EAAE,OAAO,GAAG,SAAS;QAC1C,MAAM,UAAU,GAAG,uBAAU,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QACnD,MAAM,IAAI,GAAe,UAAU,CAAC,IAAI,CAAC;QAEzC,aAAa;QACb,MAAM,MAAM,GAAG,IAAI,eAAM,CAAC,EAAC,SAAS,EAAE,IAAI,EAAC,CAAC,CAAC;QAC7C,OAAO;YACH,WAAW,EAAE,CAAO,SAAiB,EAAE,EAAE;gBACrC,MAAM,CAAC,KAAK,CAAC,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;gBACpD,OAAO,KAAK,CAAC;YACjB,CAAC,CAAA;YACD,KAAK,EAAE,CAAC,SAAiB,EAAE,OAAwB,EAAE,EAAE;gBACnD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;gBAC/C,OAAO;oBACH,WAAW,EAAE,CAAO,IAAY,EAAE,EAAE,gDAAC,OAAA,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA,GAAA;oBAC/D,OAAO,EAAE,CAAO,MAAc,EAAE,EAAE,gDAAC,OAAA,KAAK,CAAC,cAAc,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA,GAAA;iBAC1E,CAAC;YACN,CAAC;SACJ,CAAC;IACN,CAAC;CACJ;AAEY,QAAA,YAAY,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Permissions management system, define access level for each of
|
|
4
|
+
* your server apis, and restrict users by giving them access levels
|
|
5
|
+
*
|
|
6
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
2
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
21
|
exports.GCPScope = exports.ServiceKey = void 0;
|
|
4
22
|
var ServiceKey;
|
|
5
23
|
(function (ServiceKey) {
|
|
6
24
|
ServiceKey["DialogFlow"] = "dialogflow.googleapis.com";
|
|
7
|
-
})(ServiceKey
|
|
25
|
+
})(ServiceKey || (exports.ServiceKey = ServiceKey = {}));
|
|
8
26
|
var GCPScope;
|
|
9
27
|
(function (GCPScope) {
|
|
10
28
|
GCPScope["CloudPlatform"] = "https://www.googleapis.com/auth/cloud-platform";
|
|
11
|
-
})(GCPScope
|
|
29
|
+
})(GCPScope || (exports.GCPScope = GCPScope = {}));
|
|
12
30
|
//# sourceMappingURL=consts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/consts.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"consts.js","sourceRoot":"","sources":["../../../src/main/app-backend/modules/consts.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,IAAY,UAEX;AAFD,WAAY,UAAU;IACrB,sDAAwC,CAAA;AACzC,CAAC,EAFW,UAAU,0BAAV,UAAU,QAErB;AAED,IAAY,QAEX;AAFD,WAAY,QAAQ;IACnB,4EAAgE,CAAA;AACjE,CAAC,EAFW,QAAQ,wBAAR,QAAQ,QAEnB"}
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
|
@@ -1,2 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Permissions management system, define access level for each of
|
|
4
|
+
* your server apis, and restrict users by giving them access levels
|
|
5
|
+
*
|
|
6
|
+
* Copyright (C) 2020 Yair bcm
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
23
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
24
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
25
|
+
}
|
|
26
|
+
Object.defineProperty(o, k2, desc);
|
|
27
|
+
}) : (function(o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
}));
|
|
31
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
32
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
__exportStar(require("./app-backend/modules/DialogFlowApi"), exports);
|
|
36
|
+
__exportStar(require("./app-backend/modules/GoogleCloudModule"), exports);
|
|
37
|
+
__exportStar(require("./app-backend/modules/AuthModule"), exports);
|
|
38
|
+
__exportStar(require("./app-backend/modules/PubSubModule"), exports);
|
|
2
39
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;;;;;;;;;;;;;;AAEH,sEAAoD;AACpD,0EAAwD;AACxD,mEAAiD;AACjD,qEAAmD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intuitionrobotics/google-services",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.47.1",
|
|
4
4
|
"description": "google-services",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"IR",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"main": "index.js",
|
|
28
28
|
"types": "index.d.ts",
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build": "tsc"
|
|
30
|
+
"build": "tsc -v && tsc -p src/main/tsconfig.json --rootDir ./src/main --outDir dist"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@google-cloud/pubsub": "^
|
|
34
|
-
"@intuitionrobotics/ts-common": "~0.
|
|
35
|
-
"google-auth-library": "^
|
|
36
|
-
"googleapis": "^
|
|
33
|
+
"@google-cloud/pubsub": "^4.0.7",
|
|
34
|
+
"@intuitionrobotics/ts-common": "~0.47.0",
|
|
35
|
+
"google-auth-library": "^9.0.0",
|
|
36
|
+
"googleapis": "^129.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^
|
|
39
|
+
"@types/node": "^18.0.0",
|
|
40
40
|
"ts-node": "^8.10.2",
|
|
41
41
|
"tslint": "^5.16.0",
|
|
42
|
-
"typescript": "
|
|
42
|
+
"typescript": "^5.3.0"
|
|
43
43
|
}
|
|
44
44
|
}
|
package/types.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { dialogflow_v2 } from "googleapis";
|
|
2
|
-
|
|
2
|
+
import Schema$GoogleCloudDialogflowV2Intent = dialogflow_v2.Schema$GoogleCloudDialogflowV2Intent;
|
|
3
|
+
export type TS_Intent = Schema$GoogleCloudDialogflowV2Intent;
|
package/types.js
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Permissions management system, define access level for each of
|
|
4
|
+
* your server apis, and restrict users by giving them access levels
|
|
5
|
+
*
|
|
6
|
+
* Copyright (C) 2020 Intuition Robotics
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
2
20
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
21
|
//# sourceMappingURL=types.js.map
|
package/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/main/types.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/main/types.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG"}
|