| 64 | |
| 65 | // @effect-diagnostics-next-line missingEffectServiceDependency:off |
| 66 | class SomethingRepo extends Context.Service<SomethingRepo>()( |
| 67 | "SomethingRepo", |
| 68 | { |
| 69 | make: Effect.gen(function*() { |
| 70 | const partitionKey = "test-" + new Date().getTime() |
| 71 | return yield* makeRepo("Something", Something, { config: { partitionValue: () => partitionKey } }) |
| 72 | }) |
| 73 | } |
| 74 | ) { |
| 75 | static readonly layer = Layer |
| 76 | .effect( |
| 77 | SomethingRepo, |
| 78 | Effect.gen(function*() { |
| 79 | const partitionKey = "test-" + new Date().getTime() |
| 80 | const repo = SomethingRepo.of( |
| 81 | yield* makeRepo("Something", Something, { |
| 82 | config: { partitionValue: () => partitionKey } |
| 83 | }) |
| 84 | ) |
| 85 | // not using makeInitial, because it will prevent inserting the various partitionkeyed items |
| 86 | yield* repo.saveAndPublish(items).pipe(setupRequestContextFromCurrent("init")) |
| 87 | return repo |
| 88 | }) |
| 89 | ) |
| 90 | static readonly Test = this |
| 91 | .layer |
| 92 | .pipe( |
| 93 | Layer.provide(Layer.merge(MemoryStoreLive, RepositoryRegistryLive)) |
| 94 | ) |
| 95 | |
| 96 | static readonly TestCosmos = this |
| 97 | .layer |
| 98 | .pipe( |
| 99 | Layer.provide( |
| 100 | Effect |
| 101 | .gen(function*() { |
| 102 | const url = yield* Config.redacted("STORAGE_URL").pipe( |
| 103 | Config.withDefault( |
| 104 | Redacted.make( |
| 105 | // the emulator doesn't implement array projections :/ so you need an actual cloud instance! |
| 106 | "AccountEndpoint=http://localhost:8081/;AccountKey=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==" |
| 107 | ) |
| 108 | ) |
| 109 | ) |
| 110 | return CosmosStoreLayer({ |
| 111 | dbName: "test", |
| 112 | prefix: "", |
| 113 | url |
| 114 | }) |
| 115 | .pipe(Layer.merge(RepositoryRegistryLive)) |
| 116 | }) |
| 117 | .pipe(Layer.unwrap) |
| 118 | ) |
| 119 | ) |
| 120 | } |
| 121 | |
| 122 | describe("select first-level array fields", () => { |
| 123 | const test = Effect |
nothing calls this directly
no test coverage detected
searching dependent graphs…