@playcademy/vite-plugin 1.1.3-beta.7 → 1.1.3-beta.8
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/dist/index.js +127 -62
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -24314,7 +24314,7 @@ import path2 from "node:path";
|
|
|
24314
24314
|
// package.json
|
|
24315
24315
|
var package_default = {
|
|
24316
24316
|
name: "@playcademy/vite-plugin",
|
|
24317
|
-
version: "1.1.3-beta.
|
|
24317
|
+
version: "1.1.3-beta.8",
|
|
24318
24318
|
type: "module",
|
|
24319
24319
|
exports: {
|
|
24320
24320
|
".": {
|
|
@@ -25846,7 +25846,7 @@ var package_default2;
|
|
|
25846
25846
|
var init_package = __esm(() => {
|
|
25847
25847
|
package_default2 = {
|
|
25848
25848
|
name: "@playcademy/sandbox",
|
|
25849
|
-
version: "0.6.1-beta.
|
|
25849
|
+
version: "0.6.1-beta.8",
|
|
25850
25850
|
description: "Local development server for Playcademy game development",
|
|
25851
25851
|
type: "module",
|
|
25852
25852
|
exports: {
|
|
@@ -52783,14 +52783,16 @@ function assertBaselineClaimValid(args2) {
|
|
|
52783
52783
|
function validateBaselineClaim(args2) {
|
|
52784
52784
|
const { claimedTag, evidence, tables, indexes: indexes2, views, lastDeployAt } = args2;
|
|
52785
52785
|
const claimedIndex = evidence.findIndex((entry2) => entry2.tag === claimedTag);
|
|
52786
|
+
const expected = replayEvidence(evidence, claimedIndex);
|
|
52787
|
+
const live = { tables, indexes: indexes2, views };
|
|
52786
52788
|
const verdicts = [];
|
|
52787
52789
|
const unverified = [];
|
|
52788
52790
|
evidence.forEach((entry2, index2) => {
|
|
52789
52791
|
if (claimedIndex === -1 || index2 > claimedIndex) {
|
|
52790
|
-
verdicts.push(judgeBeyond(entry2,
|
|
52792
|
+
verdicts.push(judgeBeyond(entry2, expected, live));
|
|
52791
52793
|
return;
|
|
52792
52794
|
}
|
|
52793
|
-
const judged = judgeClaimed(entry2,
|
|
52795
|
+
const judged = judgeClaimed(entry2, expected, live, lastDeployAt);
|
|
52794
52796
|
verdicts.push(judged.verdict);
|
|
52795
52797
|
if (judged.unverifiable) {
|
|
52796
52798
|
unverified.push(judged.verdict);
|
|
@@ -52803,8 +52805,99 @@ function validateBaselineClaim(args2) {
|
|
|
52803
52805
|
suggestedTag: suggestTag(evidence, tables)
|
|
52804
52806
|
};
|
|
52805
52807
|
}
|
|
52806
|
-
function
|
|
52807
|
-
|
|
52808
|
+
function replayEvidence(evidence, claimedIndex) {
|
|
52809
|
+
const state = { tables: new Map, indexes: new Map, views: new Map };
|
|
52810
|
+
for (let index2 = 0;index2 <= claimedIndex; index2++) {
|
|
52811
|
+
applyEvidenceEntry(state, evidence[index2]);
|
|
52812
|
+
}
|
|
52813
|
+
return state;
|
|
52814
|
+
}
|
|
52815
|
+
function applyEvidenceEntry(state, entry2) {
|
|
52816
|
+
for (const table8 of entry2.dropsTables) {
|
|
52817
|
+
state.tables.delete(table8);
|
|
52818
|
+
}
|
|
52819
|
+
for (const dropped of entry2.dropsColumns) {
|
|
52820
|
+
state.tables.get(dropped.table)?.columns.delete(dropped.column);
|
|
52821
|
+
}
|
|
52822
|
+
for (const droppedIndex of entry2.dropsIndexes) {
|
|
52823
|
+
state.indexes.delete(droppedIndex);
|
|
52824
|
+
}
|
|
52825
|
+
for (const view2 of entry2.dropsViews) {
|
|
52826
|
+
state.views.delete(view2);
|
|
52827
|
+
}
|
|
52828
|
+
for (const table8 of entry2.createsTables) {
|
|
52829
|
+
state.tables.set(table8.name, {
|
|
52830
|
+
creator: entry2.tag,
|
|
52831
|
+
columns: new Map(table8.columns.map((column2) => [column2, entry2.tag]))
|
|
52832
|
+
});
|
|
52833
|
+
}
|
|
52834
|
+
for (const added of entry2.addsColumns) {
|
|
52835
|
+
state.tables.get(added.table)?.columns.set(added.column, entry2.tag);
|
|
52836
|
+
}
|
|
52837
|
+
for (const createdIndex of entry2.createsIndexes) {
|
|
52838
|
+
state.indexes.set(createdIndex, entry2.tag);
|
|
52839
|
+
}
|
|
52840
|
+
for (const view2 of entry2.createsViews) {
|
|
52841
|
+
state.views.set(view2, entry2.tag);
|
|
52842
|
+
}
|
|
52843
|
+
}
|
|
52844
|
+
function judgeClaimed(entry2, expected, live, lastDeployAt) {
|
|
52845
|
+
let surviving = 0;
|
|
52846
|
+
for (const table8 of entry2.createsTables) {
|
|
52847
|
+
const expectation = expected.tables.get(table8.name);
|
|
52848
|
+
if (expectation?.creator === entry2.tag) {
|
|
52849
|
+
surviving++;
|
|
52850
|
+
const columns2 = live.tables.get(table8.name);
|
|
52851
|
+
if (!columns2) {
|
|
52852
|
+
return {
|
|
52853
|
+
verdict: {
|
|
52854
|
+
tag: entry2.tag,
|
|
52855
|
+
verdict: "contradicted",
|
|
52856
|
+
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
52857
|
+
},
|
|
52858
|
+
unverifiable: false
|
|
52859
|
+
};
|
|
52860
|
+
}
|
|
52861
|
+
const missing = [...expectation.columns.entries()].filter(([, creator]) => creator === entry2.tag).map(([column2]) => column2).filter((column2) => !columns2.includes(column2));
|
|
52862
|
+
if (missing.length > 0) {
|
|
52863
|
+
return {
|
|
52864
|
+
verdict: {
|
|
52865
|
+
tag: entry2.tag,
|
|
52866
|
+
verdict: "contradicted",
|
|
52867
|
+
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
52868
|
+
},
|
|
52869
|
+
unverifiable: false
|
|
52870
|
+
};
|
|
52871
|
+
}
|
|
52872
|
+
}
|
|
52873
|
+
}
|
|
52874
|
+
for (const added of entry2.addsColumns) {
|
|
52875
|
+
if (expected.tables.get(added.table)?.columns.get(added.column) === entry2.tag) {
|
|
52876
|
+
surviving++;
|
|
52877
|
+
const columns2 = live.tables.get(added.table);
|
|
52878
|
+
if (columns2 && !columns2.includes(added.column)) {
|
|
52879
|
+
return {
|
|
52880
|
+
verdict: {
|
|
52881
|
+
tag: entry2.tag,
|
|
52882
|
+
verdict: "contradicted",
|
|
52883
|
+
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
52884
|
+
},
|
|
52885
|
+
unverifiable: false
|
|
52886
|
+
};
|
|
52887
|
+
}
|
|
52888
|
+
}
|
|
52889
|
+
}
|
|
52890
|
+
for (const name2 of entry2.createsIndexes) {
|
|
52891
|
+
if (expected.indexes.get(name2) === entry2.tag && live.indexes.has(name2)) {
|
|
52892
|
+
surviving++;
|
|
52893
|
+
}
|
|
52894
|
+
}
|
|
52895
|
+
for (const name2 of entry2.createsViews) {
|
|
52896
|
+
if (expected.views.get(name2) === entry2.tag && live.views.has(name2)) {
|
|
52897
|
+
surviving++;
|
|
52898
|
+
}
|
|
52899
|
+
}
|
|
52900
|
+
if (surviving === 0) {
|
|
52808
52901
|
const generated = new Date(entry2.generatedAt);
|
|
52809
52902
|
if (lastDeployAt && generated > lastDeployAt) {
|
|
52810
52903
|
return {
|
|
@@ -52818,48 +52911,11 @@ function judgeClaimed(entry2, tables, lastDeployAt) {
|
|
|
52818
52911
|
}
|
|
52819
52912
|
return { verdict: { tag: entry2.tag, verdict: "no-signal" }, unverifiable: false };
|
|
52820
52913
|
}
|
|
52821
|
-
for (const table8 of entry2.createsTables) {
|
|
52822
|
-
const columns2 = tables.get(table8.name);
|
|
52823
|
-
if (!columns2) {
|
|
52824
|
-
return {
|
|
52825
|
-
verdict: {
|
|
52826
|
-
tag: entry2.tag,
|
|
52827
|
-
verdict: "contradicted",
|
|
52828
|
-
detail: `creates table \`${table8.name}\`, which is not in the live database`
|
|
52829
|
-
},
|
|
52830
|
-
unverifiable: false
|
|
52831
|
-
};
|
|
52832
|
-
}
|
|
52833
|
-
const missing = table8.columns.filter((column2) => !columns2.includes(column2));
|
|
52834
|
-
if (missing.length > 0) {
|
|
52835
|
-
return {
|
|
52836
|
-
verdict: {
|
|
52837
|
-
tag: entry2.tag,
|
|
52838
|
-
verdict: "contradicted",
|
|
52839
|
-
detail: `table \`${table8.name}\` exists but is missing column(s) ${missing.map((column2) => `\`${column2}\``).join(", ")} this migration defines`
|
|
52840
|
-
},
|
|
52841
|
-
unverifiable: false
|
|
52842
|
-
};
|
|
52843
|
-
}
|
|
52844
|
-
}
|
|
52845
|
-
for (const added of entry2.addsColumns) {
|
|
52846
|
-
const columns2 = tables.get(added.table);
|
|
52847
|
-
if (columns2 && !columns2.includes(added.column)) {
|
|
52848
|
-
return {
|
|
52849
|
-
verdict: {
|
|
52850
|
-
tag: entry2.tag,
|
|
52851
|
-
verdict: "contradicted",
|
|
52852
|
-
detail: `adds column \`${added.column}\` to \`${added.table}\`, which the live table does not have`
|
|
52853
|
-
},
|
|
52854
|
-
unverifiable: false
|
|
52855
|
-
};
|
|
52856
|
-
}
|
|
52857
|
-
}
|
|
52858
52914
|
return { verdict: { tag: entry2.tag, verdict: "verified" }, unverifiable: false };
|
|
52859
52915
|
}
|
|
52860
|
-
function judgeBeyond(entry2,
|
|
52916
|
+
function judgeBeyond(entry2, expected, live) {
|
|
52861
52917
|
for (const table8 of entry2.createsTables) {
|
|
52862
|
-
if (tables.has(table8.name)) {
|
|
52918
|
+
if (live.tables.has(table8.name) && !expected.tables.has(table8.name)) {
|
|
52863
52919
|
return {
|
|
52864
52920
|
tag: entry2.tag,
|
|
52865
52921
|
verdict: "contradicted",
|
|
@@ -52868,8 +52924,9 @@ function judgeBeyond(entry2, tables, indexes2, views) {
|
|
|
52868
52924
|
}
|
|
52869
52925
|
}
|
|
52870
52926
|
for (const added of entry2.addsColumns) {
|
|
52871
|
-
const columns2 = tables.get(added.table);
|
|
52872
|
-
|
|
52927
|
+
const columns2 = live.tables.get(added.table);
|
|
52928
|
+
const explained = expected.tables.get(added.table)?.columns.has(added.column);
|
|
52929
|
+
if (columns2?.includes(added.column) && !explained) {
|
|
52873
52930
|
return {
|
|
52874
52931
|
tag: entry2.tag,
|
|
52875
52932
|
verdict: "contradicted",
|
|
@@ -52878,7 +52935,7 @@ function judgeBeyond(entry2, tables, indexes2, views) {
|
|
|
52878
52935
|
}
|
|
52879
52936
|
}
|
|
52880
52937
|
for (const index2 of entry2.createsIndexes) {
|
|
52881
|
-
if (
|
|
52938
|
+
if (live.indexes.has(index2) && !expected.indexes.has(index2)) {
|
|
52882
52939
|
return {
|
|
52883
52940
|
tag: entry2.tag,
|
|
52884
52941
|
verdict: "contradicted",
|
|
@@ -52887,7 +52944,7 @@ function judgeBeyond(entry2, tables, indexes2, views) {
|
|
|
52887
52944
|
}
|
|
52888
52945
|
}
|
|
52889
52946
|
for (const view2 of entry2.createsViews) {
|
|
52890
|
-
if (views.has(view2)) {
|
|
52947
|
+
if (live.views.has(view2) && !expected.views.has(view2)) {
|
|
52891
52948
|
return {
|
|
52892
52949
|
tag: entry2.tag,
|
|
52893
52950
|
verdict: "contradicted",
|
|
@@ -52898,19 +52955,20 @@ function judgeBeyond(entry2, tables, indexes2, views) {
|
|
|
52898
52955
|
return { tag: entry2.tag, verdict: "verified" };
|
|
52899
52956
|
}
|
|
52900
52957
|
function suggestTag(evidence, tables) {
|
|
52901
|
-
|
|
52902
|
-
|
|
52903
|
-
|
|
52904
|
-
}
|
|
52905
|
-
let
|
|
52906
|
-
|
|
52907
|
-
|
|
52958
|
+
const liveCreated = [
|
|
52959
|
+
...new Set(evidence.flatMap((entry2) => entry2.createsTables.map((table8) => table8.name)))
|
|
52960
|
+
].filter((name2) => tables.has(name2));
|
|
52961
|
+
const state = { tables: new Map, indexes: new Map, views: new Map };
|
|
52962
|
+
let best = null;
|
|
52963
|
+
for (const entry2 of evidence) {
|
|
52964
|
+
applyEvidenceEntry(state, entry2);
|
|
52965
|
+
const allPresent = [...state.tables.keys()].every((name2) => tables.has(name2));
|
|
52966
|
+
const noStray = liveCreated.every((name2) => state.tables.has(name2));
|
|
52967
|
+
if (allPresent && noStray) {
|
|
52968
|
+
best = entry2.tag;
|
|
52969
|
+
}
|
|
52908
52970
|
}
|
|
52909
|
-
|
|
52910
|
-
return candidate >= 0 && candidate >= absentFrom - 1 ? evidence[candidate].tag : null;
|
|
52911
|
-
}
|
|
52912
|
-
function hasSignal(entry2) {
|
|
52913
|
-
return entry2.createsTables.length > 0 || entry2.addsColumns.length > 0 || entry2.createsIndexes.length > 0 || entry2.createsViews.length > 0;
|
|
52971
|
+
return best;
|
|
52914
52972
|
}
|
|
52915
52973
|
var init_baseline_validation_util = __esm(() => {
|
|
52916
52974
|
init_spans();
|
|
@@ -58466,7 +58524,14 @@ var init_schemas2 = __esm(() => {
|
|
|
58466
58524
|
column: exports_external.string().min(1)
|
|
58467
58525
|
})),
|
|
58468
58526
|
createsIndexes: exports_external.array(exports_external.string()),
|
|
58469
|
-
createsViews: exports_external.array(exports_external.string())
|
|
58527
|
+
createsViews: exports_external.array(exports_external.string()),
|
|
58528
|
+
dropsTables: exports_external.array(exports_external.string()),
|
|
58529
|
+
dropsColumns: exports_external.array(exports_external.object({
|
|
58530
|
+
table: exports_external.string().min(1),
|
|
58531
|
+
column: exports_external.string().min(1)
|
|
58532
|
+
})),
|
|
58533
|
+
dropsIndexes: exports_external.array(exports_external.string()),
|
|
58534
|
+
dropsViews: exports_external.array(exports_external.string())
|
|
58470
58535
|
})).optional();
|
|
58471
58536
|
DeployBaselineSchema = exports_external.object({
|
|
58472
58537
|
lastAppliedMigrationTag: exports_external.string().min(1).optional(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playcademy/vite-plugin",
|
|
3
|
-
"version": "1.1.3-beta.
|
|
3
|
+
"version": "1.1.3-beta.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"archiver": "^7.0.1",
|
|
21
21
|
"picocolors": "^1.1.1",
|
|
22
|
-
"playcademy": "0.27.1-beta.
|
|
22
|
+
"playcademy": "0.27.1-beta.8"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@electric-sql/pglite": "^0.3.16",
|
|
26
26
|
"@inquirer/prompts": "^7.8.6",
|
|
27
27
|
"@playcademy/constants": "0.0.1",
|
|
28
|
-
"@playcademy/sandbox": "0.6.1-beta.
|
|
29
|
-
"@playcademy/sdk": "0.15.1-beta.
|
|
28
|
+
"@playcademy/sandbox": "0.6.1-beta.8",
|
|
29
|
+
"@playcademy/sdk": "0.15.1-beta.6",
|
|
30
30
|
"@playcademy/types": "0.0.1",
|
|
31
31
|
"@playcademy/utils": "0.0.1",
|
|
32
32
|
"@types/archiver": "^6.0.3",
|