MCPcopy Create free account
hub / github.com/zenstackhq/zenstack / isModelIncluded

Function isModelIncluded

packages/orm/src/client/client-impl.ts:547–571  ·  view source on GitHub ↗

* Checks if a model should be included based on slicing configuration.

(options: ClientOptions<SchemaDef>, model: string)

Source from the content-addressed store, hash-verified

545 * Checks if a model should be included based on slicing configuration.
546 */
547function isModelIncluded(options: ClientOptions<SchemaDef>, model: string): boolean {
548 const slicing = options.slicing;
549 if (!slicing) {
550 // No slicing config, include all models
551 return true;
552 }
553
554 const { includedModels, excludedModels } = slicing;
555
556 // If includedModels is specified (even if empty), only include those models
557 if (includedModels !== undefined) {
558 if (!includedModels.includes(model as any)) {
559 return false;
560 }
561 }
562
563 // Then check if model is excluded
564 if (excludedModels && excludedModels.length > 0) {
565 if (excludedModels.includes(model as any)) {
566 return false;
567 }
568 }
569
570 return true;
571}
572
573/**
574 * Checks if a procedure should be included based on slicing configuration.

Callers 1

createClientProxyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected