MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / seed

Function seed

packages/core/sdk/src/platform-view.test.ts:166–219  ·  view source on GitHub ↗
(db: SqliteTestFumaDb)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 3

resetSubjectTouchCacheFunction · 0.90
touchSubjectFunction · 0.90
insertConnectionFunction · 0.70

Tested by

no test coverage detected