@whook/gcp-functions 8.5.1 → 10.0.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/README.md +51 -40
- package/dist/commands/testHTTPFunction.d.ts +1 -1
- package/dist/commands/testHTTPFunction.js +119 -150
- package/dist/commands/testHTTPFunction.js.map +1 -1
- package/dist/index.d.ts +3 -6
- package/dist/index.js +182 -269
- package/dist/index.js.map +1 -1
- package/dist/libs/utils.js +16 -35
- package/dist/libs/utils.js.map +1 -1
- package/dist/services/_autoload.d.ts +14 -2
- package/dist/services/_autoload.js +85 -105
- package/dist/services/_autoload.js.map +1 -1
- package/dist/services/log.d.ts +4 -1
- package/dist/services/log.js +2 -12
- package/dist/services/log.js.map +1 -1
- package/dist/services/log.test.js +4 -9
- package/dist/services/log.test.js.map +1 -1
- package/dist/wrappers/googleHTTPFunction.js +246 -292
- package/dist/wrappers/googleHTTPFunction.js.map +1 -1
- package/package.json +55 -98
- package/src/commands/testHTTPFunction.ts +12 -19
- package/src/index.ts +48 -62
- package/src/libs/utils.ts +4 -5
- package/src/services/_autoload.ts +127 -122
- package/src/services/log.test.ts +2 -2
- package/src/wrappers/googleHTTPFunction.ts +34 -32
- package/dist/commands/testHTTPFunction.mjs +0 -136
- package/dist/commands/testHTTPFunction.mjs.map +0 -1
- package/dist/index.mjs +0 -265
- package/dist/index.mjs.map +0 -1
- package/dist/libs/utils.mjs +0 -27
- package/dist/libs/utils.mjs.map +0 -1
- package/dist/services/_autoload.mjs +0 -107
- package/dist/services/_autoload.mjs.map +0 -1
- package/dist/services/log.mjs +0 -4
- package/dist/services/log.mjs.map +0 -1
- package/dist/services/log.test.mjs +0 -7
- package/dist/services/log.test.mjs.map +0 -1
- package/dist/wrappers/googleHTTPFunction.mjs +0 -288
- package/dist/wrappers/googleHTTPFunction.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
> Build and deploy to GCP Cloud Functions with Whook.
|
|
9
9
|
|
|
10
10
|
[](https://github.com/nfroidure/whook/blob/master/packages/whook-gcp-functions/LICENSE)
|
|
11
|
-
[](https://npmjs.org/package/@whook/gcp-functions)
|
|
12
11
|
|
|
13
12
|
|
|
14
13
|
[//]: # (::contents:start)
|
|
@@ -22,18 +21,21 @@ You can find a complete setup with a Terraform deployment example in
|
|
|
22
21
|
|
|
23
22
|
## Quick setup
|
|
24
23
|
|
|
25
|
-
Install this module
|
|
24
|
+
Install this module:
|
|
26
25
|
|
|
27
26
|
```sh
|
|
28
27
|
npm i @whook/gcp-functions;
|
|
29
|
-
npm i --save-dev @whook/http-transaction esbuild
|
|
30
28
|
```
|
|
31
29
|
|
|
32
30
|
Add this module to your Whook plugins and tweak the 2 build functions in your
|
|
33
|
-
`build.ts` main file:
|
|
31
|
+
`src/build.ts` main file:
|
|
34
32
|
|
|
35
33
|
```diff
|
|
36
|
-
|
|
34
|
+
import {
|
|
35
|
+
// (...)
|
|
36
|
+
- runBuild as runBaseBuild,
|
|
37
|
+
// (...)
|
|
38
|
+
} from '@whook/whook';
|
|
37
39
|
+import {
|
|
38
40
|
+ runBuild as runBaseBuild,
|
|
39
41
|
+ prepareBuildEnvironment as prepareBaseBuildEnvironment,
|
|
@@ -61,20 +63,6 @@ export async function prepareEnvironment(
|
|
|
61
63
|
|
|
62
64
|
// (...)
|
|
63
65
|
|
|
64
|
-
// The `runBuild` function is intended to build the
|
|
65
|
-
// project
|
|
66
|
-
export async function runBuild(
|
|
67
|
-
innerPrepareEnvironment = prepareBuildEnvironment,
|
|
68
|
-
): Promise<void> {
|
|
69
|
-
- throw new YError('E_NO_BUILD_IMPLEMENTED');
|
|
70
|
-
|
|
71
|
-
// Usually, here you call the installed build
|
|
72
|
-
- // return runBaseBuild(innerPrepareEnvironment);
|
|
73
|
-
+ return runBaseBuild(innerPrepareEnvironment);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// (...)
|
|
77
|
-
|
|
78
66
|
// The `prepareBuildEnvironment` create the build
|
|
79
67
|
// environment
|
|
80
68
|
export async function prepareBuildEnvironment(
|
|
@@ -109,48 +97,71 @@ export async function prepareBuildEnvironment(
|
|
|
109
97
|
}
|
|
110
98
|
```
|
|
111
99
|
|
|
112
|
-
|
|
113
|
-
|
|
100
|
+
Declare this module types in your `src/whook.d.ts` type
|
|
101
|
+
definitions:
|
|
114
102
|
```diff
|
|
115
103
|
+ import type { WhookCompilerConfig } from '@whook/whook';
|
|
116
104
|
+ import type {
|
|
117
|
-
+
|
|
105
|
+
+ WhookGCPBuildConfig,
|
|
106
|
+
+ WhookAPIOperationGCPFunctionConfig
|
|
118
107
|
+ } from '@whook/gcp-functions';
|
|
119
108
|
|
|
120
|
-
|
|
109
|
+
declare module '@whook/whook' {
|
|
110
|
+
|
|
111
|
+
// ...
|
|
121
112
|
|
|
122
|
-
export
|
|
123
|
-
|
|
124
|
-
|
|
113
|
+
export interface WhookConfigs
|
|
114
|
+
- extends WhookBaseConfigs {}
|
|
115
|
+
+ extends WhookBaseConfigs,
|
|
116
|
+
+ WhookGCPBuildConfig,
|
|
117
|
+
+ WhookCompilerConfig {}
|
|
125
118
|
|
|
126
|
-
|
|
119
|
+
// ...
|
|
120
|
+
|
|
121
|
+
export interface WhookAPIHandlerDefinition<
|
|
122
|
+
T extends Record<string, unknown> = Record<string, unknown>,
|
|
123
|
+
U extends {
|
|
124
|
+
[K in keyof U]: K extends `x-${string}` ? Record<string, unknown> : never;
|
|
125
|
+
} = unknown,
|
|
126
|
+
V extends Record<string, unknown> = Record<string, unknown>,
|
|
127
|
+
> extends WhookBaseAPIHandlerDefinition<T, U> {
|
|
128
|
+
operation: U & WhookAPIOperation<
|
|
129
|
+
T &
|
|
130
|
+
+ WhookAPIOperationGCPFunctionConfig &
|
|
131
|
+
WhookAPIOperationCORSConfig
|
|
132
|
+
>;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
And add the GCP Functions config (usually in `src/config/common/config.js`):
|
|
138
|
+
|
|
139
|
+
```diff
|
|
140
|
+
import type { WhookConfigs } from '@whook/whook';
|
|
141
|
+
|
|
142
|
+
// ...
|
|
143
|
+
|
|
144
|
+
const CONFIG: WhookConfigs = {
|
|
127
145
|
// ...
|
|
128
146
|
+ COMPILER_OPTIONS: {
|
|
129
147
|
+ externalModules: [],
|
|
130
|
-
+
|
|
131
|
-
+ target: '12', // Node 14 is in public review
|
|
148
|
+
+ target: '16',
|
|
132
149
|
+ },
|
|
133
150
|
};
|
|
134
151
|
|
|
135
|
-
// Export custom handlers definitions
|
|
136
|
-
export type APIHandlerDefinition = WhookAPIHandlerDefinition<
|
|
137
|
-
+ WhookAPIOperationGCPFunctionConfig &
|
|
138
|
-
WhookAPIOperationSwaggerConfig
|
|
139
|
-
>;
|
|
140
|
-
|
|
141
152
|
export default CONFIG;
|
|
142
153
|
```
|
|
143
154
|
|
|
144
155
|
# Build
|
|
145
156
|
|
|
146
|
-
To build your functions
|
|
157
|
+
To build your functions:
|
|
147
158
|
|
|
148
159
|
```sh
|
|
149
160
|
# Build all functions
|
|
150
|
-
npm run
|
|
161
|
+
npm run build
|
|
151
162
|
|
|
152
163
|
# Build only one function
|
|
153
|
-
npm run
|
|
164
|
+
npm run build -- getPing
|
|
154
165
|
```
|
|
155
166
|
|
|
156
167
|
# Debug
|
|
@@ -163,10 +174,10 @@ your `WHOOK_PLUGINS` list. It provides you some commands like the
|
|
|
163
174
|
npx whook testHTTPFunction --name getPing
|
|
164
175
|
```
|
|
165
176
|
|
|
166
|
-
To get more insights when errors happens:
|
|
177
|
+
To get more insights when some errors happens:
|
|
167
178
|
|
|
168
179
|
```sh
|
|
169
|
-
npm run whook-dev -- testHTTPFunction --name getPing
|
|
180
|
+
DEBUG=whook npm run whook-dev -- testHTTPFunction --name getPing
|
|
170
181
|
```
|
|
171
182
|
|
|
172
183
|
## Deployment
|
|
@@ -7,6 +7,6 @@ declare const _default: import("knifecycle").ServiceInitializer<{
|
|
|
7
7
|
PROJECT_DIR: string;
|
|
8
8
|
API: OpenAPIV3.Document<{}>;
|
|
9
9
|
log: LogService;
|
|
10
|
-
args: WhookCommandArgs
|
|
10
|
+
args: WhookCommandArgs<Record<string, import("@whook/cli").WhookArgsTypes>>;
|
|
11
11
|
}, () => Promise<void>>;
|
|
12
12
|
export default _default;
|
|
@@ -1,156 +1,125 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _utils = require("../libs/utils");
|
|
9
|
-
|
|
10
|
-
var _knifecycle = require("knifecycle");
|
|
11
|
-
|
|
12
|
-
var _cli = require("@whook/cli");
|
|
13
|
-
|
|
14
|
-
var _yerror = _interopRequireDefault(require("yerror"));
|
|
15
|
-
|
|
16
|
-
var _httpRouter = require("@whook/http-router");
|
|
17
|
-
|
|
18
|
-
var _stream = _interopRequireDefault(require("stream"));
|
|
19
|
-
|
|
20
|
-
var _camelcase = _interopRequireDefault(require("camelcase"));
|
|
21
|
-
|
|
22
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
23
|
-
|
|
1
|
+
import { loadLambda } from '../libs/utils.js';
|
|
2
|
+
import { extra, autoService } from 'knifecycle';
|
|
3
|
+
import { readArgs } from '@whook/cli';
|
|
4
|
+
import { YError } from 'yerror';
|
|
5
|
+
import { dereferenceOpenAPIOperations, getOpenAPIOperations, } from '@whook/http-router';
|
|
6
|
+
import stream from 'stream';
|
|
7
|
+
import camelCase from 'camelcase';
|
|
24
8
|
const SEARCH_SEPARATOR = '?';
|
|
25
9
|
const PATH_SEPARATOR = '/';
|
|
26
|
-
const definition = {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
10
|
+
export const definition = {
|
|
11
|
+
description: 'A command for testing AWS HTTP lambda',
|
|
12
|
+
example: `whook testHTTPLambda --name getPing`,
|
|
13
|
+
arguments: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
additionalProperties: false,
|
|
16
|
+
required: ['name'],
|
|
17
|
+
properties: {
|
|
18
|
+
name: {
|
|
19
|
+
description: 'Name of the lamda to run',
|
|
20
|
+
type: 'string',
|
|
21
|
+
},
|
|
22
|
+
type: {
|
|
23
|
+
description: 'Type of lambda to test',
|
|
24
|
+
type: 'string',
|
|
25
|
+
enum: ['main', 'index'],
|
|
26
|
+
default: 'index',
|
|
27
|
+
},
|
|
28
|
+
contentType: {
|
|
29
|
+
description: 'Content type of the payload',
|
|
30
|
+
type: 'string',
|
|
31
|
+
default: 'application/json',
|
|
32
|
+
},
|
|
33
|
+
parameters: {
|
|
34
|
+
description: 'The HTTP call parameters',
|
|
35
|
+
type: 'string',
|
|
36
|
+
default: '{}',
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
56
40
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
PROJECT_DIR,
|
|
66
|
-
API,
|
|
67
|
-
log,
|
|
68
|
-
args
|
|
69
|
-
}) {
|
|
70
|
-
return async () => {
|
|
71
|
-
const {
|
|
72
|
-
name,
|
|
73
|
-
type,
|
|
74
|
-
contentType,
|
|
75
|
-
parameters: rawParameters
|
|
76
|
-
} = (0, _cli.readArgs)(definition.arguments, args);
|
|
77
|
-
const handler = await (0, _utils.loadLambda)({
|
|
78
|
-
PROJECT_DIR,
|
|
79
|
-
log
|
|
80
|
-
}, NODE_ENV, name, type);
|
|
81
|
-
const OPERATION = (await (0, _httpRouter.dereferenceOpenAPIOperations)(API, (0, _httpRouter.getOpenAPIOperations)(API))).find(({
|
|
82
|
-
operationId
|
|
83
|
-
}) => operationId === name);
|
|
84
|
-
|
|
85
|
-
if (!OPERATION) {
|
|
86
|
-
throw new _yerror.default('E_OPERATION_NOT_FOUND');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const hasBody = !!OPERATION.requestBody;
|
|
90
|
-
const parameters = JSON.parse(rawParameters);
|
|
91
|
-
const search = (OPERATION.parameters || []).filter(p => p.in === 'query').reduce((accSearch, p) => {
|
|
92
|
-
if (null != parameters[p.name]) {
|
|
93
|
-
return accSearch + (accSearch ? '&' : '') + p.name + '=' + parameters[p.name];
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return accSearch;
|
|
97
|
-
}, '');
|
|
98
|
-
const path = OPERATION.path.split(PATH_SEPARATOR).map(part => {
|
|
99
|
-
const matches = /^\{([\d\w]+)\}$/i.exec(part);
|
|
100
|
-
|
|
101
|
-
if (matches) {
|
|
102
|
-
return parameters[matches[1]];
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
return part;
|
|
106
|
-
}).join(PATH_SEPARATOR);
|
|
107
|
-
const gcpfRequest = {
|
|
108
|
-
method: OPERATION.method,
|
|
109
|
-
originalUrl: path + (search ? SEARCH_SEPARATOR + search : ''),
|
|
110
|
-
headers: (OPERATION.parameters || []).filter(p => p.in === 'header').reduce((headerParameters, p) => {
|
|
111
|
-
headerParameters[p.name] = parameters[(0, _camelcase.default)(p.name)];
|
|
112
|
-
return headerParameters;
|
|
113
|
-
}, {}),
|
|
114
|
-
rawBody: Buffer.from(hasBody ? contentType === 'application/json' ? parameters.body ? JSON.stringify(parameters.body) : '' : parameters.body || '' : '')
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
if (hasBody) {
|
|
118
|
-
gcpfRequest.headers['content-type'] = `${contentType};charset=UTF-8`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
log('info', 'GCPF_REQUEST:', gcpfRequest);
|
|
122
|
-
const response = {
|
|
123
|
-
status: 0,
|
|
124
|
-
headers: {},
|
|
125
|
-
data: ''
|
|
126
|
-
};
|
|
127
|
-
await new Promise((resolve, reject) => {
|
|
128
|
-
const gcpfResponse = new _stream.default.PassThrough();
|
|
129
|
-
|
|
130
|
-
gcpfResponse.set = (name, value) => {
|
|
131
|
-
response.headers[name] = value;
|
|
132
|
-
};
|
|
133
|
-
|
|
134
|
-
gcpfResponse.status = code => {
|
|
135
|
-
response.status = code;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
handler(gcpfRequest, gcpfResponse).catch(reject);
|
|
139
|
-
const chunks = [];
|
|
140
|
-
gcpfResponse.once('end', () => {
|
|
141
|
-
response.data = Buffer.concat(chunks).toString();
|
|
142
|
-
resolve();
|
|
143
|
-
});
|
|
144
|
-
gcpfResponse.once('error', reject);
|
|
145
|
-
gcpfResponse.on('readable', () => {
|
|
146
|
-
let data;
|
|
147
|
-
|
|
148
|
-
while (data = gcpfResponse.read()) {
|
|
149
|
-
chunks.push(data);
|
|
41
|
+
export default extra(definition, autoService(initTestHTTPLambdaCommand));
|
|
42
|
+
async function initTestHTTPLambdaCommand({ NODE_ENV, PROJECT_DIR, API, log, args, }) {
|
|
43
|
+
return async () => {
|
|
44
|
+
const { namedArguments: { name, type, contentType, parameters: rawParameters }, } = readArgs(definition.arguments, args);
|
|
45
|
+
const handler = await loadLambda({ PROJECT_DIR, log }, NODE_ENV, name, type);
|
|
46
|
+
const OPERATION = (await dereferenceOpenAPIOperations(API, getOpenAPIOperations(API))).find(({ operationId }) => operationId === name);
|
|
47
|
+
if (!OPERATION) {
|
|
48
|
+
throw new YError('E_OPERATION_NOT_FOUND');
|
|
150
49
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
50
|
+
const hasBody = !!OPERATION.requestBody;
|
|
51
|
+
const parameters = JSON.parse(rawParameters);
|
|
52
|
+
const search = (OPERATION.parameters || [])
|
|
53
|
+
.filter((p) => p.in === 'query')
|
|
54
|
+
.reduce((accSearch, p) => {
|
|
55
|
+
if (null != parameters[p.name]) {
|
|
56
|
+
return (accSearch +
|
|
57
|
+
(accSearch ? '&' : '') +
|
|
58
|
+
p.name +
|
|
59
|
+
'=' +
|
|
60
|
+
parameters[p.name]);
|
|
61
|
+
}
|
|
62
|
+
return accSearch;
|
|
63
|
+
}, '');
|
|
64
|
+
const path = OPERATION.path
|
|
65
|
+
.split(PATH_SEPARATOR)
|
|
66
|
+
.map((part) => {
|
|
67
|
+
const matches = /^\{([\d\w]+)\}$/i.exec(part);
|
|
68
|
+
if (matches) {
|
|
69
|
+
return parameters[matches[1]];
|
|
70
|
+
}
|
|
71
|
+
return part;
|
|
72
|
+
})
|
|
73
|
+
.join(PATH_SEPARATOR);
|
|
74
|
+
const gcpfRequest = {
|
|
75
|
+
method: OPERATION.method,
|
|
76
|
+
originalUrl: path + (search ? SEARCH_SEPARATOR + search : ''),
|
|
77
|
+
headers: (OPERATION.parameters || [])
|
|
78
|
+
.filter((p) => p.in === 'header')
|
|
79
|
+
.reduce((headerParameters, p) => {
|
|
80
|
+
headerParameters[p.name] = parameters[camelCase(p.name)];
|
|
81
|
+
return headerParameters;
|
|
82
|
+
}, {}),
|
|
83
|
+
rawBody: Buffer.from(hasBody
|
|
84
|
+
? contentType === 'application/json'
|
|
85
|
+
? parameters.body
|
|
86
|
+
? JSON.stringify(parameters.body)
|
|
87
|
+
: ''
|
|
88
|
+
: parameters.body || ''
|
|
89
|
+
: ''),
|
|
90
|
+
};
|
|
91
|
+
if (hasBody) {
|
|
92
|
+
gcpfRequest.headers['content-type'] = `${contentType};charset=UTF-8`;
|
|
93
|
+
}
|
|
94
|
+
log('info', 'GCPF_REQUEST:', gcpfRequest);
|
|
95
|
+
const response = {
|
|
96
|
+
status: 0,
|
|
97
|
+
headers: {},
|
|
98
|
+
data: '',
|
|
99
|
+
};
|
|
100
|
+
await new Promise((resolve, reject) => {
|
|
101
|
+
const gcpfResponse = new stream.PassThrough();
|
|
102
|
+
gcpfResponse.set = (name, value) => {
|
|
103
|
+
response.headers[name] = value;
|
|
104
|
+
};
|
|
105
|
+
gcpfResponse.status = (code) => {
|
|
106
|
+
response.status = code;
|
|
107
|
+
};
|
|
108
|
+
handler(gcpfRequest, gcpfResponse).catch(reject);
|
|
109
|
+
const chunks = [];
|
|
110
|
+
gcpfResponse.once('end', () => {
|
|
111
|
+
response.data = Buffer.concat(chunks).toString();
|
|
112
|
+
resolve();
|
|
113
|
+
});
|
|
114
|
+
gcpfResponse.once('error', reject);
|
|
115
|
+
gcpfResponse.on('readable', () => {
|
|
116
|
+
let data;
|
|
117
|
+
while ((data = gcpfResponse.read())) {
|
|
118
|
+
chunks.push(data);
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
log('info', 'SUCCESS:', response);
|
|
123
|
+
};
|
|
155
124
|
}
|
|
156
125
|
//# sourceMappingURL=testHTTPFunction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/testHTTPFunction.ts"],"names":[
|
|
1
|
+
{"version":3,"file":"testHTTPFunction.js","sourceRoot":"","sources":["../../src/commands/testHTTPFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EACL,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,SAAS,MAAM,WAAW,CAAC;AAKlC,MAAM,gB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GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YAE7C,YAAoB,CAAC,GAAG,GAAG,CAAC,IAAY,EAAE,KAAa,EAAQ,EAAE;gBAChE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACjC,CAAC,CAAC;YACD,YAAoB,CAAC,MAAM,GAAG,CAAC,IAAY,EAAQ,EAAE;gBACpD,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC;YACzB,CAAC,CAAC;YAEF,OAAO,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAEjD,MAAM,MAAM,GAAG,EAAc,CAAC;YAE9B,YAAY,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;gBAC5B,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACjD,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;YACH,YAAY,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACnC,YAAY,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,EAAE;gBAC/B,IAAI,IAAY,CAAC;gBACjB,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE;oBACnC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACnB;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import Knifecycle from 'knifecycle';
|
|
2
|
-
import type { Dependencies } from 'knifecycle';
|
|
1
|
+
import { Knifecycle } from 'knifecycle';
|
|
3
2
|
import type { WhookCompilerOptions } from '@whook/whook';
|
|
4
|
-
import type { BuildOptions } from 'knifecycle/dist/build';
|
|
5
3
|
export declare const DEFAULT_BUILD_PARALLELISM = 10;
|
|
6
|
-
export declare type
|
|
7
|
-
BUILD_OPTIONS?: BuildOptions;
|
|
4
|
+
export declare type WhookGCPBuildConfig = {
|
|
8
5
|
BUILD_PARALLELISM?: number;
|
|
9
6
|
};
|
|
10
7
|
export declare type WhookAPIOperationGCPFunctionConfig = {
|
|
@@ -14,5 +11,5 @@ export declare type WhookAPIOperationGCPFunctionConfig = {
|
|
|
14
11
|
compilerOptions?: WhookCompilerOptions;
|
|
15
12
|
suffix?: string;
|
|
16
13
|
};
|
|
17
|
-
export declare function prepareBuildEnvironment<T extends Knifecycle
|
|
14
|
+
export declare function prepareBuildEnvironment<T extends Knifecycle>($?: T): Promise<T>;
|
|
18
15
|
export declare function runBuild(aPrepareBuildEnvironment: typeof prepareBuildEnvironment): Promise<void>;
|