@effect/language-service 0.73.1 → 0.75.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 CHANGED
@@ -88,7 +88,7 @@ And you're done! You'll now be able to use a set of refactors and diagnostics th
88
88
 
89
89
  ### Completions
90
90
 
91
- - Autocomplete 'Self' in `Effect.Service`, `Context.Tag`, `Schema.TaggedClass`, `Schema.TaggedRequest`, `Model.Class` and family
91
+ - Autocomplete 'Self' in `Effect.Service`, `Context.Tag`, `Schema.TaggedClass`, `Schema.TaggedRequest`, `ServiceMap.Service`, `Model.Class` and family
92
92
  - Autocomplete `Effect.gen` with `function*(){}`
93
93
  - Autocomplete `Effect.fn` with the span name given by the exported member
94
94
  - Completions for DurationInput string millis/seconds/etc...
package/cli.js CHANGED
@@ -30214,7 +30214,7 @@ var runMain3 = runMain2;
30214
30214
  // package.json
30215
30215
  var package_default = {
30216
30216
  name: "@effect/language-service",
30217
- version: "0.73.1",
30217
+ version: "0.75.0",
30218
30218
  publishConfig: {
30219
30219
  access: "public",
30220
30220
  directory: "dist"
@@ -33603,6 +33603,28 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
33603
33603
  `TypeParser.isNodeReferenceToEffectParseResultModuleApi(${memberName})`,
33604
33604
  (node) => node
33605
33605
  );
33606
+ const isEffectSchemaParserSourceFile = cachedBy(
33607
+ fn2("TypeParser.isEffectSchemaParserSourceFile")(function* (sourceFile) {
33608
+ const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
33609
+ if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
33610
+ const parseIssueSymbol = typeChecker.tryGetMemberInModuleExports("Parser", moduleSymbol);
33611
+ if (!parseIssueSymbol) return yield* typeParserIssue("ParseIssue type not found", void 0, sourceFile);
33612
+ const decodeSyncSymbol = typeChecker.tryGetMemberInModuleExports("decodeEffect", moduleSymbol);
33613
+ if (!decodeSyncSymbol) return yield* typeParserIssue("decodeSync not found", void 0, sourceFile);
33614
+ const encodeSyncSymbol = typeChecker.tryGetMemberInModuleExports("encodeEffect", moduleSymbol);
33615
+ if (!encodeSyncSymbol) return yield* typeParserIssue("encodeSync not found", void 0, sourceFile);
33616
+ return sourceFile;
33617
+ }),
33618
+ "TypeParser.isEffectSchemaParserSourceFile",
33619
+ (sourceFile) => sourceFile
33620
+ );
33621
+ const isNodeReferenceToEffectSchemaParserModuleApi = (memberName) => cachedBy(
33622
+ fn2("TypeParser.isNodeReferenceToEffectSchemaParserModuleApi")(function* (node) {
33623
+ return yield* isNodeReferenceToExportOfPackageModule(node, "effect", isEffectSchemaParserSourceFile, memberName);
33624
+ }),
33625
+ `TypeParser.isNodeReferenceToEffectSchemaParserModuleApi(${memberName})`,
33626
+ (node) => node
33627
+ );
33606
33628
  const contextTagVarianceStruct = (type2, atLocation) => map34(
33607
33629
  all9(
33608
33630
  varianceStructInvariantType(type2, atLocation, "_Identifier"),
@@ -33610,6 +33632,31 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
33610
33632
  ),
33611
33633
  ([Identifier, Service]) => ({ Identifier, Service })
33612
33634
  );
33635
+ const serviceVarianceStruct = (type2, atLocation) => map34(
33636
+ all9(
33637
+ varianceStructInvariantType(type2, atLocation, "_Identifier"),
33638
+ varianceStructInvariantType(type2, atLocation, "_Service")
33639
+ ),
33640
+ ([Identifier, Service]) => ({ Identifier, Service })
33641
+ );
33642
+ const serviceType = cachedBy(
33643
+ fn2("TypeParser.serviceType")(function* (type2, atLocation) {
33644
+ yield* pipeableType(type2, atLocation);
33645
+ const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
33646
+ (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
33647
+ );
33648
+ if (propertiesSymbols.length === 0) {
33649
+ return yield* typeParserIssue("Type has no tag variance struct", type2, atLocation);
33650
+ }
33651
+ propertiesSymbols.sort((a, b) => ts.symbolName(b).indexOf("TypeId") - ts.symbolName(a).indexOf("TypeId"));
33652
+ return yield* firstSuccessOf2(propertiesSymbols.map((propertySymbol) => {
33653
+ const propertyType = typeChecker.getTypeOfSymbolAtLocation(propertySymbol, atLocation);
33654
+ return serviceVarianceStruct(propertyType, atLocation);
33655
+ }));
33656
+ }),
33657
+ "TypeParser.serviceType",
33658
+ (type2) => type2
33659
+ );
33613
33660
  const contextTag = cachedBy(
33614
33661
  fn2("TypeParser.contextTag")(function* (type2, atLocation) {
33615
33662
  yield* pipeableType(type2, atLocation);
@@ -33691,14 +33738,22 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
33691
33738
  );
33692
33739
  const scopeType = cachedBy(
33693
33740
  fn2("TypeParser.scopeType")(function* (type2, atLocation) {
33694
- yield* pipeableType(type2, atLocation);
33695
- const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
33696
- (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
33697
- );
33698
- if (propertiesSymbols.some((s) => ts.symbolName(s).indexOf("ScopeTypeId") !== -1)) {
33699
- return type2;
33741
+ if (supportedEffect() === "v4") {
33742
+ const typeIdSymbol = typeChecker.getPropertyOfType(type2, "~effect/Scope");
33743
+ if (typeIdSymbol) {
33744
+ return type2;
33745
+ }
33746
+ return yield* typeParserIssue("Type is not an effect", type2, atLocation);
33747
+ } else {
33748
+ yield* pipeableType(type2, atLocation);
33749
+ const propertiesSymbols = typeChecker.getPropertiesOfType(type2).filter(
33750
+ (_) => _.flags & ts.SymbolFlags.Property && !(_.flags & ts.SymbolFlags.Optional) && _.valueDeclaration
33751
+ );
33752
+ if (propertiesSymbols.some((s) => ts.symbolName(s).indexOf("ScopeTypeId") !== -1)) {
33753
+ return type2;
33754
+ }
33755
+ return yield* typeParserIssue("Type has no scope type id", type2, atLocation);
33700
33756
  }
33701
- return yield* typeParserIssue("Type has no scope type id", type2, atLocation);
33702
33757
  }),
33703
33758
  "TypeParser.scopeType",
33704
33759
  (type2) => type2
@@ -34180,6 +34235,55 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
34180
34235
  "TypeParser.extendsEffectService",
34181
34236
  (atLocation) => atLocation
34182
34237
  );
34238
+ const extendsServiceMapService = cachedBy(
34239
+ fn2("TypeParser.extendsServiceMapService")(function* (atLocation) {
34240
+ if (!atLocation.name) {
34241
+ return yield* typeParserIssue("Class has no name", void 0, atLocation);
34242
+ }
34243
+ const heritageClauses = atLocation.heritageClauses;
34244
+ if (!heritageClauses) {
34245
+ return yield* typeParserIssue("Class has no heritage clauses", void 0, atLocation);
34246
+ }
34247
+ for (const heritageClause of heritageClauses) {
34248
+ for (const typeX of heritageClause.types) {
34249
+ if (ts.isExpressionWithTypeArguments(typeX)) {
34250
+ const wholeCall = typeX.expression;
34251
+ if (ts.isCallExpression(wholeCall)) {
34252
+ const serviceMapServiceCall = wholeCall.expression;
34253
+ if (ts.isCallExpression(serviceMapServiceCall) && serviceMapServiceCall.typeArguments && serviceMapServiceCall.typeArguments.length > 0) {
34254
+ const serviceMapServiceIdentifier = serviceMapServiceCall.expression;
34255
+ const selfTypeNode = serviceMapServiceCall.typeArguments[0];
34256
+ const isServiceMapService = yield* pipe(
34257
+ isNodeReferenceToServiceMapModuleApi("Service")(serviceMapServiceIdentifier),
34258
+ orUndefined2
34259
+ );
34260
+ if (isServiceMapService) {
34261
+ const classSym = typeChecker.getSymbolAtLocation(atLocation.name);
34262
+ if (!classSym) return yield* typeParserIssue("Class has no symbol", void 0, atLocation);
34263
+ const type2 = typeChecker.getTypeOfSymbol(classSym);
34264
+ const parsedServiceType = yield* pipe(
34265
+ serviceType(type2, atLocation),
34266
+ orUndefined2
34267
+ );
34268
+ if (parsedServiceType) {
34269
+ return {
34270
+ ...parsedServiceType,
34271
+ className: atLocation.name,
34272
+ selfTypeNode,
34273
+ keyStringLiteral: wholeCall.arguments.length > 0 && ts.isStringLiteral(wholeCall.arguments[0]) ? wholeCall.arguments[0] : void 0
34274
+ };
34275
+ }
34276
+ }
34277
+ }
34278
+ }
34279
+ }
34280
+ }
34281
+ }
34282
+ return yield* typeParserIssue("Class does not extend ServiceMap.Service", void 0, atLocation);
34283
+ }),
34284
+ "TypeParser.extendsServiceMapService",
34285
+ (atLocation) => atLocation
34286
+ );
34183
34287
  const isEffectSqlModelTypeSourceFile = cachedBy(
34184
34288
  fn2("TypeParser.isEffectSqlModelTypeSourceFile")(function* (sourceFile) {
34185
34289
  const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
@@ -34272,6 +34376,24 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
34272
34376
  `TypeParser.isNodeReferenceToEffectLayerModuleApi(${memberName})`,
34273
34377
  (node) => node
34274
34378
  );
34379
+ const isServiceMapTypeSourceFile = cachedBy(
34380
+ fn2("TypeParser.isServiceMapTypeSourceFile")(function* (sourceFile) {
34381
+ const moduleSymbol = typeChecker.getSymbolAtLocation(sourceFile);
34382
+ if (!moduleSymbol) return yield* typeParserIssue("Node has no symbol", void 0, sourceFile);
34383
+ const serviceMapSymbol = typeChecker.tryGetMemberInModuleExports("ServiceMap", moduleSymbol);
34384
+ if (!serviceMapSymbol) return yield* typeParserIssue("ServiceMap not found", void 0, sourceFile);
34385
+ return sourceFile;
34386
+ }),
34387
+ "TypeParser.isServiceMapTypeSourceFile",
34388
+ (sourceFile) => sourceFile
34389
+ );
34390
+ const isNodeReferenceToServiceMapModuleApi = (memberName) => cachedBy(
34391
+ fn2("TypeParser.isNodeReferenceToServiceMapModuleApi")(function* (node) {
34392
+ return yield* isNodeReferenceToExportOfPackageModule(node, "effect", isServiceMapTypeSourceFile, memberName);
34393
+ }),
34394
+ `TypeParser.isNodeReferenceToServiceMapModuleApi(${memberName})`,
34395
+ (node) => node
34396
+ );
34275
34397
  const lazyExpression = cachedBy(
34276
34398
  function(node) {
34277
34399
  if (!ts.isArrowFunction(node) && !ts.isFunctionExpression(node)) {
@@ -34602,6 +34724,9 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
34602
34724
  isNodeReferenceToEffectContextModuleApi,
34603
34725
  isNodeReferenceToEffectSqlModelModuleApi,
34604
34726
  isNodeReferenceToEffectLayerModuleApi,
34727
+ isNodeReferenceToEffectSchemaParserModuleApi,
34728
+ isServiceMapTypeSourceFile,
34729
+ isNodeReferenceToServiceMapModuleApi,
34605
34730
  effectType,
34606
34731
  strictEffectType,
34607
34732
  layerType,
@@ -34617,6 +34742,7 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
34617
34742
  unnecessaryEffectGen: unnecessaryEffectGen2,
34618
34743
  effectSchemaType,
34619
34744
  contextTag,
34745
+ serviceType,
34620
34746
  pipeableType,
34621
34747
  pipeCall,
34622
34748
  singleArgCall,
@@ -34624,6 +34750,7 @@ function make64(ts, tsUtils, typeChecker, typeCheckerUtils, program) {
34624
34750
  promiseLike,
34625
34751
  extendsEffectTag,
34626
34752
  extendsEffectService,
34753
+ extendsServiceMapService,
34627
34754
  extendsContextTag,
34628
34755
  extendsSchemaClass,
34629
34756
  extendsSchemaTaggedClass,
@@ -34844,6 +34971,7 @@ var parse5 = fn2("writeTagClassAccessors.parse")(function* (node) {
34844
34971
  const typeChecker = yield* service2(TypeCheckerApi);
34845
34972
  const typeParser = yield* service2(TypeParser);
34846
34973
  const typeCheckerUtils = yield* service2(TypeCheckerUtils);
34974
+ if (typeParser.supportedEffect() === "v4") return yield* fail18("not applicable to Effect v4");
34847
34975
  if (!ts.isClassDeclaration(node)) return yield* fail18("not a class declaration");
34848
34976
  const { Service, accessors: accessors2, className, kind } = yield* pipe(
34849
34977
  map34(typeParser.extendsEffectService(node), (_) => ({ kind: "effectService", ..._ })),
@@ -35086,16 +35214,16 @@ var pushHoistedVariableStatement = fn2("StructuralSchemaGen.pushHoistedVariableS
35086
35214
  );
35087
35215
  }
35088
35216
  );
35089
- var createProcessingContext = (maxDepth = 200) => ({
35217
+ var createProcessingContext = (supportedEffect, maxDepth = 200) => ({
35090
35218
  depth: 0,
35091
35219
  maxDepth,
35092
- hoistName: void 0
35220
+ hoistName: void 0,
35221
+ supportedEffect
35093
35222
  });
35094
35223
  var processType = fn2(
35095
35224
  "StructuralSchemaGen.processType"
35096
35225
  )(
35097
- function* (type2, context7) {
35098
- const processingContext = context7 || createProcessingContext();
35226
+ function* (type2, processingContext) {
35099
35227
  const { hoistedSchemas, nameToType, ts, typeChecker, usedGlobalIdentifiers } = yield* service2(
35100
35228
  StructuralSchemaGenContext
35101
35229
  );
@@ -35230,7 +35358,7 @@ var processUnionType = fn2(
35230
35358
  const allLiterals = types.every(
35231
35359
  (t) => t.flags & ts.TypeFlags.StringLiteral || t.flags & ts.TypeFlags.NumberLiteral || t.flags & ts.TypeFlags.BooleanLiteral
35232
35360
  );
35233
- if (allLiterals) {
35361
+ if (allLiterals && context7.supportedEffect !== "v4") {
35234
35362
  const literals = yield* all9(
35235
35363
  ...types.map((t) => processType(t, context7))
35236
35364
  );
@@ -35240,7 +35368,13 @@ var processUnionType = fn2(
35240
35368
  }
35241
35369
  return expr;
35242
35370
  }).filter((arg) => arg !== void 0);
35243
- return [createApiCall("Literal", literalValues), false];
35371
+ return [
35372
+ createApiCall(
35373
+ "Literal",
35374
+ literalValues
35375
+ ),
35376
+ false
35377
+ ];
35244
35378
  }
35245
35379
  const members = yield* all9(
35246
35380
  ...types.map((t) => processType(t, context7))
@@ -35248,7 +35382,13 @@ var processUnionType = fn2(
35248
35382
  if (members.length === 1) {
35249
35383
  return [members[0], false];
35250
35384
  }
35251
- return [createApiCall("Union", members), false];
35385
+ return [
35386
+ createApiCall(
35387
+ "Union",
35388
+ context7.supportedEffect === "v4" ? [ts.factory.createArrayLiteralExpression(members)] : members
35389
+ ),
35390
+ false
35391
+ ];
35252
35392
  }
35253
35393
  );
35254
35394
  var processIntersectionType = fn2(
@@ -35294,12 +35434,18 @@ var processTupleType = fn2(
35294
35434
  "StructuralSchemaGen.processTupleType"
35295
35435
  )(
35296
35436
  function* (type2, context7) {
35297
- const { createApiCall, typeChecker } = yield* service2(StructuralSchemaGenContext);
35437
+ const { createApiCall, ts, typeChecker } = yield* service2(StructuralSchemaGenContext);
35298
35438
  const typeArgs = typeChecker.getTypeArguments(type2);
35299
35439
  const elementSchemas = yield* all9(
35300
35440
  ...typeArgs.map((t) => processType(t, context7))
35301
35441
  );
35302
- return [createApiCall("Tuple", elementSchemas), false];
35442
+ return [
35443
+ createApiCall(
35444
+ "Tuple",
35445
+ context7.supportedEffect === "v4" ? [ts.factory.createArrayLiteralExpression(elementSchemas)] : elementSchemas
35446
+ ),
35447
+ false
35448
+ ];
35303
35449
  }
35304
35450
  );
35305
35451
  var processObjectType = fn2(
@@ -35316,7 +35462,6 @@ var processObjectType = fn2(
35316
35462
  } = yield* service2(
35317
35463
  StructuralSchemaGenContext
35318
35464
  );
35319
- let hasRecords = false;
35320
35465
  const properties = typeChecker.getPropertiesOfType(type2);
35321
35466
  const propertyAssignments = [];
35322
35467
  for (const property of properties) {
@@ -35356,20 +35501,28 @@ var processObjectType = fn2(
35356
35501
  const args3 = [
35357
35502
  ts.factory.createObjectLiteralExpression(propertyAssignments, propertyAssignments.length > 0)
35358
35503
  ];
35504
+ const records = [];
35359
35505
  for (const indexInfo of indexInfos) {
35360
- hasRecords = true;
35361
35506
  const keyType = indexInfo.keyType;
35362
35507
  const valueType = indexInfo.type;
35363
35508
  const keySchema = yield* processType(keyType, context7);
35364
35509
  const valueSchema = yield* processType(valueType, context7);
35365
- args3.push(
35366
- ts.factory.createObjectLiteralExpression([
35367
- ts.factory.createPropertyAssignment("key", keySchema),
35368
- ts.factory.createPropertyAssignment("value", valueSchema)
35369
- ])
35370
- );
35510
+ records.push({ key: keySchema, value: valueSchema });
35511
+ }
35512
+ if (context7.supportedEffect === "v4") {
35513
+ if (records.length > 0) {
35514
+ return [
35515
+ createApiCall("StructWithRest", [
35516
+ createApiCall("Struct", args3),
35517
+ ts.factory.createArrayLiteralExpression(
35518
+ records.map(({ key, value: value5 }) => createApiCall("Record", [key, value5]))
35519
+ )
35520
+ ]),
35521
+ propertyAssignments.length === 0
35522
+ ];
35523
+ }
35371
35524
  }
35372
- if (!hasRecords && context7.hoistName) {
35525
+ if (records.length === 0 && context7.hoistName) {
35373
35526
  const ctx = yield* service2(StructuralSchemaGenContext);
35374
35527
  yield* pushHoistedStatement(
35375
35528
  ctx,
@@ -35404,6 +35557,14 @@ var processObjectType = fn2(
35404
35557
  );
35405
35558
  return [ctx.hoistedSchemas.get(type2)(), true];
35406
35559
  }
35560
+ for (const { key, value: value5 } of records) {
35561
+ args3.push(
35562
+ ts.factory.createObjectLiteralExpression([
35563
+ ts.factory.createPropertyAssignment("key", key),
35564
+ ts.factory.createPropertyAssignment("value", value5)
35565
+ ])
35566
+ );
35567
+ }
35407
35568
  return [createApiCall("Struct", args3), propertyAssignments.length === 0];
35408
35569
  }
35409
35570
  );
@@ -35489,7 +35650,7 @@ var process2 = fn2("StructuralSchemaGen.process")(
35489
35650
  all9(
35490
35651
  ...fromIterable(ctx.nameToType.entries()).map(
35491
35652
  ([name, type2]) => pipe(
35492
- processType(type2),
35653
+ processType(type2, createProcessingContext(typeParser.supportedEffect())),
35493
35654
  orElse15(
35494
35655
  (error4) => succeed17(ts.addSyntheticLeadingComment(
35495
35656
  ts.factory.createIdentifier(""),
@@ -36289,6 +36450,7 @@ var deterministicKeys = createDiagnostic({
36289
36450
  typeParser.extendsEffectService(node),
36290
36451
  orElse15(() => typeParser.extendsContextTag(node)),
36291
36452
  orElse15(() => typeParser.extendsEffectTag(node)),
36453
+ orElse15(() => typeParser.extendsServiceMapService(node)),
36292
36454
  map34(({ className, keyStringLiteral }) => ({ keyStringLiteral, className, target: "service" }))
36293
36455
  ),
36294
36456
  orElse15(
@@ -37684,6 +37846,9 @@ More info and examples at https://effect.website/docs/requirements-management/la
37684
37846
  if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "GenericTag") {
37685
37847
  const nodeType = typeCheckerUtils.getTypeAtLocation(node);
37686
37848
  if (nodeType) typesToCheck.push([nodeType, node]);
37849
+ } else if (ts.isCallExpression(node) && ts.isPropertyAccessExpression(node.expression) && ts.isIdentifier(node.expression.name) && ts.idText(node.expression.name) === "Service") {
37850
+ const nodeType = typeCheckerUtils.getTypeAtLocation(node);
37851
+ if (nodeType) typesToCheck.push([nodeType, node]);
37687
37852
  } else if (ts.isClassDeclaration(node) && node.name && node.heritageClauses) {
37688
37853
  const classSym = typeChecker.getSymbolAtLocation(node.name);
37689
37854
  if (classSym) {
@@ -37697,6 +37862,7 @@ More info and examples at https://effect.website/docs/requirements-management/la
37697
37862
  for (const [type2, reportAt] of typesToCheck) {
37698
37863
  yield* pipe(
37699
37864
  typeParser.contextTag(type2, node),
37865
+ orElse15(() => typeParser.serviceType(type2, node)),
37700
37866
  flatMap18(
37701
37867
  ({ Service }) => pipe(
37702
37868
  parseLeakedRequirements(Service, node),
@@ -38471,6 +38637,7 @@ var nonObjectEffectServiceType = createDiagnostic({
38471
38637
  const typeChecker = yield* service2(TypeCheckerApi);
38472
38638
  const typeCheckerUtils = yield* service2(TypeCheckerUtils);
38473
38639
  const typeParser = yield* service2(TypeParser);
38640
+ if (typeParser.supportedEffect() === "v4") return;
38474
38641
  function isPrimitiveType(type2) {
38475
38642
  return typeCheckerUtils.unrollUnionMembers(type2).some(
38476
38643
  (type3) => !!(type3.flags & ts.TypeFlags.String || type3.flags & ts.TypeFlags.Number || type3.flags & ts.TypeFlags.Boolean || type3.flags & ts.TypeFlags.StringLiteral || type3.flags & ts.TypeFlags.NumberLiteral || type3.flags & ts.TypeFlags.BooleanLiteral || type3.flags & ts.TypeFlags.Undefined || type3.flags & ts.TypeFlags.Null)
@@ -38949,6 +39116,7 @@ var runEffectInsideEffect = createDiagnostic({
38949
39116
  const ts = yield* service2(TypeScriptApi);
38950
39117
  const typeParser = yield* service2(TypeParser);
38951
39118
  const tsUtils = yield* service2(TypeScriptUtils);
39119
+ if (typeParser.supportedEffect() === "v4") return;
38952
39120
  const parseEffectMethod = (node, methodName) => pipe(
38953
39121
  typeParser.isNodeReferenceToEffectModuleApi(methodName)(node),
38954
39122
  map34(() => ({ node, methodName }))
@@ -39143,12 +39311,18 @@ var schemaStructWithTag = createDiagnostic({
39143
39311
  });
39144
39312
 
39145
39313
  // src/diagnostics/schemaSyncInEffect.ts
39146
- var syncToEffectMethod = {
39314
+ var syncToEffectMethodV3 = {
39147
39315
  decodeSync: "decode",
39148
39316
  decodeUnknownSync: "decodeUnknown",
39149
39317
  encodeSync: "encode",
39150
39318
  encodeUnknownSync: "encodeUnknown"
39151
39319
  };
39320
+ var syncToEffectMethodV4 = {
39321
+ decodeSync: "decodeEffect",
39322
+ decodeUnknownSync: "decodeUnknownEffect",
39323
+ encodeSync: "encodeEffect",
39324
+ encodeUnknownSync: "encodeUnknownEffect"
39325
+ };
39152
39326
  var schemaSyncInEffect = createDiagnostic({
39153
39327
  name: "schemaSyncInEffect",
39154
39328
  code: 43,
@@ -39157,8 +39331,10 @@ var schemaSyncInEffect = createDiagnostic({
39157
39331
  apply: fn2("schemaSyncInEffect.apply")(function* (sourceFile, report) {
39158
39332
  const ts = yield* service2(TypeScriptApi);
39159
39333
  const typeParser = yield* service2(TypeParser);
39334
+ const syncToEffectMethod = typeParser.supportedEffect() === "v3" ? syncToEffectMethodV3 : syncToEffectMethodV4;
39160
39335
  const parseSchemaSyncMethod = (node, methodName) => pipe(
39161
39336
  typeParser.isNodeReferenceToEffectParseResultModuleApi(methodName)(node),
39337
+ orElse15(() => typeParser.isNodeReferenceToEffectSchemaParserModuleApi(methodName)(node)),
39162
39338
  map34(() => ({ node, methodName }))
39163
39339
  );
39164
39340
  const nodeToVisit = [];
@@ -39188,7 +39364,7 @@ var schemaSyncInEffect = createDiagnostic({
39188
39364
  const effectMethodName = syncToEffectMethod[isSchemaSyncCall.value.methodName];
39189
39365
  report({
39190
39366
  location: node.expression,
39191
- messageText: `Using ${nodeText} inside an Effect generator is not recommended. Use Schema.${effectMethodName} instead to get properly typed ParseError in the error channel.`,
39367
+ messageText: `Using ${nodeText} inside an Effect generator is not recommended. Use Schema.${effectMethodName} instead to get properly typed error channel.`,
39192
39368
  fixes: []
39193
39369
  });
39194
39370
  }
@@ -39204,6 +39380,7 @@ var schemaUnionOfLiterals = createDiagnostic({
39204
39380
  apply: fn2("schemaUnionOfLiterals.apply")(function* (sourceFile, report) {
39205
39381
  const ts = yield* service2(TypeScriptApi);
39206
39382
  const typeParser = yield* service2(TypeParser);
39383
+ if (typeParser.supportedEffect() === "v4") return;
39207
39384
  const nodeToVisit = [];
39208
39385
  const appendNodeToVisit = (node) => {
39209
39386
  nodeToVisit.push(node);