@lark-apaas/fullstack-cli 1.1.40-alpha.5 → 1.1.40-alpha.6
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/dist/index.js +17 -28
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3241,13 +3241,14 @@ function isInPercentage(tenantId, percentage) {
|
|
|
3241
3241
|
}
|
|
3242
3242
|
function matchRule(rule, identity) {
|
|
3243
3243
|
switch (rule.type) {
|
|
3244
|
-
case "
|
|
3245
|
-
|
|
3246
|
-
const appMatch = rule.app_ids && rule.app_ids.length > 0 ? !!identity.appId && rule.app_ids.includes(identity.appId) : false;
|
|
3247
|
-
return tenantMatch || appMatch;
|
|
3244
|
+
case "tenant_id": {
|
|
3245
|
+
return !!identity.tenantId && rule.values.includes(identity.tenantId);
|
|
3248
3246
|
}
|
|
3249
|
-
case "
|
|
3250
|
-
return identity.
|
|
3247
|
+
case "app_id": {
|
|
3248
|
+
return !!identity.appId && rule.values.includes(identity.appId);
|
|
3249
|
+
}
|
|
3250
|
+
case "canary": {
|
|
3251
|
+
return identity.xTtEnv === rule.value;
|
|
3251
3252
|
}
|
|
3252
3253
|
case "percentage": {
|
|
3253
3254
|
if (rule.value >= 100) return true;
|
|
@@ -3259,45 +3260,33 @@ function matchRule(rule, identity) {
|
|
|
3259
3260
|
return false;
|
|
3260
3261
|
}
|
|
3261
3262
|
}
|
|
3262
|
-
function
|
|
3263
|
-
if (
|
|
3264
|
-
return channel.rules.some((rule) => matchRule(rule, identity));
|
|
3265
|
-
}
|
|
3266
|
-
function isBlocked(config, identity) {
|
|
3267
|
-
if (identity.tenantId && config.blocklist?.tenant_ids?.includes(identity.tenantId)) {
|
|
3263
|
+
function isBlocked(channel, identity) {
|
|
3264
|
+
if (identity.tenantId && channel.blocklist?.tenant_ids?.includes(identity.tenantId)) {
|
|
3268
3265
|
return true;
|
|
3269
3266
|
}
|
|
3270
|
-
if (identity.appId &&
|
|
3267
|
+
if (identity.appId && channel.blocklist?.app_ids?.includes(identity.appId)) {
|
|
3271
3268
|
return true;
|
|
3272
3269
|
}
|
|
3273
3270
|
return false;
|
|
3274
3271
|
}
|
|
3272
|
+
function matchChannel(channel, identity) {
|
|
3273
|
+
if (isBlocked(channel, identity)) return false;
|
|
3274
|
+
if (!channel.rules || channel.rules.length === 0) return false;
|
|
3275
|
+
return channel.rules.some((rule) => matchRule(rule, identity));
|
|
3276
|
+
}
|
|
3275
3277
|
function resolveTargetVersions(config, identity) {
|
|
3276
3278
|
const stableVersions = config.stable?.versions || {};
|
|
3277
|
-
|
|
3278
|
-
if (isBlocked(config, identity)) {
|
|
3279
|
-
console.log("[grayscale] Tenant/app is in blocklist, use stable");
|
|
3280
|
-
} else {
|
|
3281
|
-
matchedChannel = (config.channels || []).find((ch) => matchChannel(ch, identity));
|
|
3282
|
-
}
|
|
3279
|
+
const matchedChannel = (config.channels || []).find((ch) => matchChannel(ch, identity));
|
|
3283
3280
|
const merged = /* @__PURE__ */ new Map();
|
|
3284
3281
|
for (const [pkg2, version] of Object.entries(stableVersions)) {
|
|
3285
|
-
if (config.blocklist?.versions?.includes(version)) {
|
|
3286
|
-
console.warn(`[grayscale] stable version ${version} of ${pkg2} is blocked, skipping`);
|
|
3287
|
-
continue;
|
|
3288
|
-
}
|
|
3289
3282
|
merged.set(pkg2, version);
|
|
3290
3283
|
}
|
|
3291
3284
|
if (matchedChannel) {
|
|
3292
3285
|
console.log(`[grayscale] Matched channel: ${matchedChannel.name}`);
|
|
3293
3286
|
for (const [pkg2, version] of Object.entries(matchedChannel.versions || {})) {
|
|
3294
|
-
if (config.blocklist?.versions?.includes(version)) {
|
|
3295
|
-
console.warn(`[grayscale] channel version ${version} of ${pkg2} is blocked, skipping`);
|
|
3296
|
-
continue;
|
|
3297
|
-
}
|
|
3298
3287
|
merged.set(pkg2, version);
|
|
3299
3288
|
}
|
|
3300
|
-
} else
|
|
3289
|
+
} else {
|
|
3301
3290
|
console.log("[grayscale] No channel matched, use stable");
|
|
3302
3291
|
}
|
|
3303
3292
|
return merged.size > 0 ? merged : null;
|