@mastra/factory 0.1.0-alpha.3 → 0.1.0-alpha.4
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/CHANGELOG.md +33 -0
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +772 -206
- package/dist/factory.js.map +1 -1
- package/dist/index.js +772 -206
- package/dist/index.js.map +1 -1
- package/dist/integrations/github/integration.d.ts +2 -2
- package/dist/integrations/github/integration.js +43 -11
- package/dist/integrations/github/integration.js.map +1 -1
- package/dist/integrations/github/provenance.js.map +1 -1
- package/dist/integrations/github/routes.js +10 -9
- package/dist/integrations/github/routes.js.map +1 -1
- package/dist/integrations/github/sandbox.d.ts +1 -0
- package/dist/integrations/github/sandbox.d.ts.map +1 -1
- package/dist/integrations/github/sandbox.js +2 -2
- package/dist/integrations/github/sandbox.js.map +1 -1
- package/dist/integrations/github/session-subscriptions.d.ts +3 -0
- package/dist/integrations/github/session-subscriptions.d.ts.map +1 -1
- package/dist/integrations/github/session-subscriptions.js +30 -0
- package/dist/integrations/github/session-subscriptions.js.map +1 -1
- package/dist/integrations/github/token-refresh.d.ts +6 -0
- package/dist/integrations/github/token-refresh.d.ts.map +1 -0
- package/dist/integrations/github/token-refresh.js +17 -0
- package/dist/integrations/github/token-refresh.js.map +1 -0
- package/dist/integrations/platform/github/integration.js +41 -9
- package/dist/integrations/platform/github/integration.js.map +1 -1
- package/dist/routes/config.d.ts +16 -11
- package/dist/routes/config.d.ts.map +1 -1
- package/dist/routes/config.js +222 -109
- package/dist/routes/config.js.map +1 -1
- package/dist/routes/custom-provider-source.d.ts +52 -0
- package/dist/routes/custom-provider-source.d.ts.map +1 -0
- package/dist/routes/custom-provider-source.js +107 -0
- package/dist/routes/custom-provider-source.js.map +1 -0
- package/dist/routes/oauth.js +33 -1
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/surface.d.ts +4 -0
- package/dist/routes/surface.d.ts.map +1 -1
- package/dist/routes/surface.js +266 -110
- package/dist/routes/surface.js.map +1 -1
- package/dist/sandbox/fleet.d.ts +3 -0
- package/dist/sandbox/fleet.d.ts.map +1 -1
- package/dist/sandbox/fleet.js +10 -3
- package/dist/sandbox/fleet.js.map +1 -1
- package/dist/spa-static.d.ts +4 -5
- package/dist/spa-static.d.ts.map +1 -1
- package/dist/spa-static.js +5 -2
- package/dist/spa-static.js.map +1 -1
- package/dist/storage/domains/custom-providers/base.d.ts +57 -0
- package/dist/storage/domains/custom-providers/base.d.ts.map +1 -0
- package/dist/storage/domains/custom-providers/base.js +150 -0
- package/dist/storage/domains/custom-providers/base.js.map +1 -0
- package/dist/storage/domains/memory-settings/base.d.ts +62 -0
- package/dist/storage/domains/memory-settings/base.d.ts.map +1 -0
- package/dist/storage/domains/memory-settings/base.js +111 -0
- package/dist/storage/domains/memory-settings/base.js.map +1 -0
- package/dist/workspace.d.ts.map +1 -1
- package/dist/workspace.js +17 -0
- package/dist/workspace.js.map +1 -1
- package/package.json +7 -6
package/dist/routes/oauth.js
CHANGED
|
@@ -11163,8 +11163,10 @@ function assertIdentifier(kind, name) {
|
|
|
11163
11163
|
}
|
|
11164
11164
|
}
|
|
11165
11165
|
function isUniqueViolation(error) {
|
|
11166
|
+
const code = typeof error === "object" && error !== null ? error.code : void 0;
|
|
11167
|
+
if (code === "SQLITE_CONSTRAINT_UNIQUE" || code === "SQLITE_CONSTRAINT_PRIMARYKEY") return true;
|
|
11166
11168
|
const message = error instanceof Error ? error.message : String(error);
|
|
11167
|
-
return message.includes("UNIQUE constraint failed") || message.includes("
|
|
11169
|
+
return message.includes("UNIQUE constraint failed") || message.includes("SQLITE_CONSTRAINT_UNIQUE") || message.includes("SQLITE_CONSTRAINT_PRIMARYKEY");
|
|
11168
11170
|
}
|
|
11169
11171
|
function primaryKeyOf(schema) {
|
|
11170
11172
|
const pks = Object.entries(schema.columns).filter(([, spec]) => spec.type === "uuid-pk" || spec.primaryKey);
|
|
@@ -24103,6 +24105,35 @@ ${unreflectedContent}` : bufferedReflection;
|
|
|
24103
24105
|
if (spec.default !== void 0) ddl += ` DEFAULT ${serializeDefault(spec.default)}`;
|
|
24104
24106
|
return ddl;
|
|
24105
24107
|
}
|
|
24108
|
+
/**
|
|
24109
|
+
* A table created by an older schema may still say NOT NULL on a column the
|
|
24110
|
+
* current schema declares nullable — inserts of null then fail on databases
|
|
24111
|
+
* that predate the change. SQLite has no `ALTER COLUMN DROP NOT NULL`, so
|
|
24112
|
+
* relaxation swaps in a table rebuilt from the current schema (create shadow
|
|
24113
|
+
* → copy → drop → rename) atomically.
|
|
24114
|
+
*/
|
|
24115
|
+
async #relaxDriftedNotNulls(schema) {
|
|
24116
|
+
const info = await this.#client.execute(`PRAGMA table_info("${schema.name}")`);
|
|
24117
|
+
const hasDrift = info.rows.some((row) => {
|
|
24118
|
+
const spec = schema.columns[String(row.name)];
|
|
24119
|
+
if (!spec || spec.type === "uuid-pk" || spec.primaryKey) return false;
|
|
24120
|
+
return spec.nullable === true && Number(row.notnull) === 1;
|
|
24121
|
+
});
|
|
24122
|
+
if (!hasDrift) return;
|
|
24123
|
+
const ddl = Object.entries(schema.columns).map(([name, spec]) => this.#columnDdl(name, spec));
|
|
24124
|
+
const shadow = `${schema.name}__nullable_rebuild`;
|
|
24125
|
+
const cols = Object.keys(schema.columns).map((name) => `"${name}"`).join(", ");
|
|
24126
|
+
await this.#client.batch(
|
|
24127
|
+
[
|
|
24128
|
+
`DROP TABLE IF EXISTS "${shadow}"`,
|
|
24129
|
+
`CREATE TABLE "${shadow}" (${ddl.join(", ")})`,
|
|
24130
|
+
`INSERT INTO "${shadow}" (${cols}) SELECT ${cols} FROM "${schema.name}"`,
|
|
24131
|
+
`DROP TABLE "${schema.name}"`,
|
|
24132
|
+
`ALTER TABLE "${shadow}" RENAME TO "${schema.name}"`
|
|
24133
|
+
],
|
|
24134
|
+
"write"
|
|
24135
|
+
);
|
|
24136
|
+
}
|
|
24106
24137
|
async #ensureCollection(schema) {
|
|
24107
24138
|
assertIdentifier("collection", schema.name);
|
|
24108
24139
|
primaryKeyOf(schema);
|
|
@@ -24114,6 +24145,7 @@ ${unreflectedContent}` : bufferedReflection;
|
|
|
24114
24145
|
if (existing.has(name)) continue;
|
|
24115
24146
|
await this.#client.execute(`ALTER TABLE "${schema.name}" ADD COLUMN ${this.#columnDdl(name, spec)}`);
|
|
24116
24147
|
}
|
|
24148
|
+
await this.#relaxDriftedNotNulls(schema);
|
|
24117
24149
|
for (const index of schema.uniqueIndexes ?? []) {
|
|
24118
24150
|
assertIdentifier("index", index.name);
|
|
24119
24151
|
index.columns.forEach((column) => assertIdentifier("column", column));
|