(db: SqliteTestFumaDb)
| 163 | * connections go in raw, because no single bound executor could have written |
| 164 | * another subject's rows. */ |
| 165 | const seed = (db: SqliteTestFumaDb): Effect.Effect<void> => |
| 166 | Effect.gen(function* () { |
| 167 | // `touchSubject` keeps a process-local memory of principals it already |
| 168 | // filed, so a second seed against a FRESH database would be skipped as a |
| 169 | // repeat sighting and leave the table empty. Each seed is a new world. |
| 170 | resetSubjectTouchCache(); |
| 171 | |
| 172 | yield* touchSubject(db.db, { tenant: TENANT, externalId: SUBJECT_A }); |
| 173 | yield* touchSubject(db.db, { tenant: TENANT, externalId: SUBJECT_B }); |
| 174 | yield* touchSubject(db.db, { tenant: OTHER_TENANT, externalId: "user_elsewhere" }); |
| 175 | |
| 176 | yield* insertConnection(db, { |
| 177 | rowId: "c-a1", |
| 178 | tenant: TENANT, |
| 179 | owner: "user", |
| 180 | subject: SUBJECT_A, |
| 181 | integration: "github", |
| 182 | name: "personal", |
| 183 | oauthScope: "repo read:user", |
| 184 | }); |
| 185 | yield* insertConnection(db, { |
| 186 | rowId: "c-a2", |
| 187 | tenant: TENANT, |
| 188 | owner: "user", |
| 189 | subject: SUBJECT_A, |
| 190 | integration: "linear", |
| 191 | name: "work", |
| 192 | }); |
| 193 | yield* insertConnection(db, { |
| 194 | rowId: "c-b1", |
| 195 | tenant: TENANT, |
| 196 | owner: "user", |
| 197 | subject: SUBJECT_B, |
| 198 | integration: "github", |
| 199 | name: "b-personal", |
| 200 | oauthScope: "repo", |
| 201 | }); |
| 202 | yield* insertConnection(db, { |
| 203 | rowId: "c-org", |
| 204 | tenant: TENANT, |
| 205 | owner: "org", |
| 206 | subject: "", |
| 207 | integration: "stripe", |
| 208 | name: "shared", |
| 209 | }); |
| 210 | yield* insertConnection(db, { |
| 211 | rowId: "c-other", |
| 212 | tenant: OTHER_TENANT, |
| 213 | owner: "user", |
| 214 | subject: SUBJECT_A, |
| 215 | integration: "github", |
| 216 | name: "other-tenant", |
| 217 | }); |
| 218 | }); |
| 219 | |
| 220 | /** |
| 221 | * A plugin contributing one writable credential provider. |
no test coverage detected