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

Function seedV1Db

apps/local/src/db/v1-v2-migration.test.ts:76–701  ·  view source on GitHub ↗
(
  dbPath: string,
  scopeId: string,
  options: {
    readonly includeSecretBackedOauth?: boolean;
    readonly includeGraphqlTool?: boolean;
    readonly includeMcpToolBinding?: boolean;
    readonly includeMcpOauth?: boolean;
    readonly jsonBlobs?: boolean;
    readonly oauthConnectionProvider?: string;
    readonly oauthProviderStateOverrides?: Record<string, unknown>;
  } = {},
)

Source from the content-addressed store, hash-verified

74});
75
76const seedV1Db = async (
77 dbPath: string,
78 scopeId: string,
79 options: {
80 readonly includeSecretBackedOauth?: boolean;
81 readonly includeGraphqlTool?: boolean;
82 readonly includeMcpToolBinding?: boolean;
83 readonly includeMcpOauth?: boolean;
84 readonly jsonBlobs?: boolean;
85 readonly oauthConnectionProvider?: string;
86 readonly oauthProviderStateOverrides?: Record<string, unknown>;
87 } = {},
88) => {
89 const client = await openLocalLibsql(dbPath);
90 await client.execute("PRAGMA foreign_keys = OFF");
91 await client.execute(`
92 CREATE TABLE source (
93 id text NOT NULL,
94 scope_id text NOT NULL,
95 plugin_id text NOT NULL,
96 kind text NOT NULL,
97 name text NOT NULL,
98 PRIMARY KEY(scope_id, id)
99 )
100 `);
101 await client.execute(`
102 CREATE TABLE plugin_storage (
103 id text NOT NULL,
104 scope_id text NOT NULL,
105 plugin_id text NOT NULL,
106 collection text NOT NULL,
107 key text NOT NULL,
108 data text NOT NULL,
109 created_at integer NOT NULL,
110 updated_at integer NOT NULL,
111 PRIMARY KEY(scope_id, id)
112 )
113 `);
114 await client.execute(`
115 CREATE TABLE credential_binding (
116 id text NOT NULL,
117 scope_id text NOT NULL,
118 plugin_id text NOT NULL,
119 source_id text NOT NULL,
120 source_scope_id text NOT NULL,
121 slot_key text NOT NULL,
122 kind text NOT NULL,
123 text_value text,
124 secret_id text,
125 connection_id text,
126 created_at integer NOT NULL,
127 updated_at integer NOT NULL,
128 PRIMARY KEY(scope_id, id)
129 )
130 `);
131 await client.execute(`
132 CREATE TABLE secret (
133 id text NOT NULL,

Callers 1

Calls 5

openLocalLibsqlFunction · 0.90
executeSqlFunction · 0.90
jsonFunction · 0.70
executeMethod · 0.65
closeMethod · 0.65

Tested by

no test coverage detected