@lark-apaas/fullstack-cli 1.1.40-alpha.5 → 1.1.40-alpha.7
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 +14 -30
- 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,28 @@ function matchRule(rule, identity) {
|
|
|
3259
3260
|
return false;
|
|
3260
3261
|
}
|
|
3261
3262
|
}
|
|
3263
|
+
function isBlocked(channel, identity) {
|
|
3264
|
+
if (!channel.block_rules || channel.block_rules.length === 0) return false;
|
|
3265
|
+
return channel.block_rules.some((rule) => matchRule(rule, identity));
|
|
3266
|
+
}
|
|
3262
3267
|
function matchChannel(channel, identity) {
|
|
3268
|
+
if (isBlocked(channel, identity)) return false;
|
|
3263
3269
|
if (!channel.rules || channel.rules.length === 0) return false;
|
|
3264
3270
|
return channel.rules.some((rule) => matchRule(rule, identity));
|
|
3265
3271
|
}
|
|
3266
|
-
function isBlocked(config, identity) {
|
|
3267
|
-
if (identity.tenantId && config.blocklist?.tenant_ids?.includes(identity.tenantId)) {
|
|
3268
|
-
return true;
|
|
3269
|
-
}
|
|
3270
|
-
if (identity.appId && config.blocklist?.app_ids?.includes(identity.appId)) {
|
|
3271
|
-
return true;
|
|
3272
|
-
}
|
|
3273
|
-
return false;
|
|
3274
|
-
}
|
|
3275
3272
|
function resolveTargetVersions(config, identity) {
|
|
3276
3273
|
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
|
-
}
|
|
3274
|
+
const matchedChannel = (config.channels || []).find((ch) => matchChannel(ch, identity));
|
|
3283
3275
|
const merged = /* @__PURE__ */ new Map();
|
|
3284
3276
|
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
3277
|
merged.set(pkg2, version);
|
|
3290
3278
|
}
|
|
3291
3279
|
if (matchedChannel) {
|
|
3292
3280
|
console.log(`[grayscale] Matched channel: ${matchedChannel.name}`);
|
|
3293
3281
|
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
3282
|
merged.set(pkg2, version);
|
|
3299
3283
|
}
|
|
3300
|
-
} else
|
|
3284
|
+
} else {
|
|
3301
3285
|
console.log("[grayscale] No channel matched, use stable");
|
|
3302
3286
|
}
|
|
3303
3287
|
return merged.size > 0 ? merged : null;
|