@naturalcycles/backend-lib 4.21.1 → 4.22.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.
|
@@ -55,6 +55,9 @@ async function createDeployInfo(backendCfg) {
|
|
|
55
55
|
].join('-');
|
|
56
56
|
}
|
|
57
57
|
const versionUrl = `https://${[gaeVersion, gaeService, gaeProject].join('-dot-')}.appspot.com`;
|
|
58
|
+
// Check the 63-char limit
|
|
59
|
+
const versionUrlString = [gaeVersion, gaeService, gaeProject].join('-dot-');
|
|
60
|
+
(0, js_lib_1._assert)(versionUrlString.length <= 63, `versionUrl length should be <= 63 characters, but it's ${versionUrlString.length} instead: ${versionUrlString}`);
|
|
58
61
|
const serviceUrl = `https://${[gaeService, gaeProject].join('-dot-')}.appspot.com`;
|
|
59
62
|
const deployInfo = {
|
|
60
63
|
gaeProject,
|
|
@@ -138,12 +141,10 @@ function redactedAppYaml(appYaml) {
|
|
|
138
141
|
}
|
|
139
142
|
function validateGAEServiceName(serviceName) {
|
|
140
143
|
// May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.
|
|
141
|
-
return
|
|
144
|
+
return serviceName
|
|
145
|
+
.replaceAll('_', '-')
|
|
142
146
|
.toLowerCase()
|
|
143
147
|
.replaceAll(/[^0-9a-z-]/gi, '')
|
|
144
148
|
.slice(0, 40);
|
|
145
149
|
}
|
|
146
150
|
exports.validateGAEServiceName = validateGAEServiceName;
|
|
147
|
-
function replaceAll(str, search, replacement) {
|
|
148
|
-
return str.split(search).join(replacement);
|
|
149
|
-
}
|
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
|
-
import { _mapValues, _merge, _truncate, localTimeNow } from '@naturalcycles/js-lib'
|
|
2
|
+
import { _assert, _mapValues, _merge, _truncate, localTimeNow } from '@naturalcycles/js-lib'
|
|
3
3
|
import { dimGrey, white } from '@naturalcycles/nodejs-lib'
|
|
4
4
|
import yaml from 'js-yaml'
|
|
5
5
|
import { BackendCfg } from './backend.cfg.util'
|
|
@@ -79,6 +79,13 @@ export async function createDeployInfo(backendCfg: BackendCfg): Promise<DeployIn
|
|
|
79
79
|
|
|
80
80
|
const versionUrl = `https://${[gaeVersion, gaeService, gaeProject].join('-dot-')}.appspot.com`
|
|
81
81
|
|
|
82
|
+
// Check the 63-char limit
|
|
83
|
+
const versionUrlString = [gaeVersion, gaeService, gaeProject].join('-dot-')
|
|
84
|
+
_assert(
|
|
85
|
+
versionUrlString.length <= 63,
|
|
86
|
+
`versionUrl length should be <= 63 characters, but it's ${versionUrlString.length} instead: ${versionUrlString}`,
|
|
87
|
+
)
|
|
88
|
+
|
|
82
89
|
const serviceUrl = `https://${[gaeService, gaeProject].join('-dot-')}.appspot.com`
|
|
83
90
|
|
|
84
91
|
const deployInfo: DeployInfo = {
|
|
@@ -198,12 +205,9 @@ function redactedAppYaml(appYaml: AppYaml): AppYaml {
|
|
|
198
205
|
|
|
199
206
|
export function validateGAEServiceName(serviceName: string): string {
|
|
200
207
|
// May only contain lowercase letters, digits, and hyphens. Must begin and end with a letter or digit. Must not exceed 63 characters.
|
|
201
|
-
return
|
|
208
|
+
return serviceName
|
|
209
|
+
.replaceAll('_', '-')
|
|
202
210
|
.toLowerCase()
|
|
203
211
|
.replaceAll(/[^0-9a-z-]/gi, '')
|
|
204
212
|
.slice(0, 40)
|
|
205
213
|
}
|
|
206
|
-
|
|
207
|
-
function replaceAll(str: string, search: string, replacement: string): string {
|
|
208
|
-
return str.split(search).join(replacement)
|
|
209
|
-
}
|