@supawatch/target-schema-lock 0.12.0 → 0.14.0

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.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import type { Snapshot, SnapshotFile, Target, TargetCapabilities, TargetOptions } from "@supawatch/core";
2
2
  export type SchemaLockTargetOptions = TargetOptions;
3
+ export declare const FORMAT = 2;
3
4
  export declare class SchemaLockTarget implements Target<SchemaLockTargetOptions> {
4
5
  readonly name = "schema-lock";
5
6
  readonly fileExtension = ".json";
package/dist/index.js CHANGED
@@ -1,4 +1,8 @@
1
- const FORMAT = 1;
1
+ // Bumped when the recorded shape changes, so an older committed
2
+ // lockfile is recognised as one rather than reported as schema drift.
3
+ // 2 added table kind, rlsEnabled and policies, and domain
4
+ // hasConstraints.
5
+ export const FORMAT = 2;
2
6
  // Canonicalize: sort every object's keys and every named collection, so
3
7
  // the file is byte-stable for an unchanged schema regardless of catalog
4
8
  // ordering.
@@ -15,7 +19,16 @@ function canonical(value) {
15
19
  return value;
16
20
  }
17
21
  function sortByName(xs) {
18
- return [...xs].sort((a, b) => `${a.schema ?? ""}.${a.name}`.localeCompare(`${b.schema ?? ""}.${b.name}`));
22
+ // Code point order, never localeCompare: this file is committed and
23
+ // byte-compared, and ICU collation differs by locale and by build.
24
+ // Measured: en-US sorts "a A_b a-b ab z Z", sv-SE sorts "A_b a-b ab z
25
+ // Z a", so two developers would see spurious drift on an identical
26
+ // schema.
27
+ return [...xs].sort((a, b) => {
28
+ const ka = `${a.schema ?? ""}.${a.name}`;
29
+ const kb = `${b.schema ?? ""}.${b.name}`;
30
+ return ka < kb ? -1 : ka > kb ? 1 : 0;
31
+ });
19
32
  }
20
33
  export class SchemaLockTarget {
21
34
  name = "schema-lock";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supawatch/target-schema-lock",
3
- "version": "0.12.0",
3
+ "version": "0.14.0",
4
4
  "description": "A canonical committed schema lockfile from supawatch, turning pull-request diffs into schema changelogs.",
5
5
  "keywords": [
6
6
  "supabase",
@@ -33,7 +33,7 @@
33
33
  "dist"
34
34
  ],
35
35
  "dependencies": {
36
- "@supawatch/core": "0.12.0"
36
+ "@supawatch/core": "0.14.0"
37
37
  },
38
38
  "devDependencies": {
39
39
  "@types/node": "^22.20.1",