@kernhq/module-billing 0.3.4 → 0.3.6

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.
@@ -1,6 +1,6 @@
1
1
  CREATE SCHEMA IF NOT EXISTS "mod_billing";
2
2
  --> statement-breakpoint
3
- CREATE TABLE "mod_billing"."invoices" (
3
+ CREATE TABLE IF NOT EXISTS "mod_billing"."invoices" (
4
4
  "id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
5
5
  "workspace_id" uuid NOT NULL,
6
6
  "stripe_invoice_id" text,
@@ -15,7 +15,7 @@ CREATE TABLE "mod_billing"."invoices" (
15
15
  "created_at" timestamp with time zone DEFAULT now() NOT NULL
16
16
  );
17
17
  --> statement-breakpoint
18
- CREATE TABLE "mod_billing"."overrides" (
18
+ CREATE TABLE IF NOT EXISTS "mod_billing"."overrides" (
19
19
  "workspace_id" uuid PRIMARY KEY NOT NULL,
20
20
  "limits" jsonb DEFAULT '{}'::jsonb NOT NULL,
21
21
  "note" text DEFAULT '' NOT NULL,
@@ -24,7 +24,7 @@ CREATE TABLE "mod_billing"."overrides" (
24
24
  "updated_at" timestamp with time zone DEFAULT now() NOT NULL
25
25
  );
26
26
  --> statement-breakpoint
27
- CREATE TABLE "mod_billing"."plans" (
27
+ CREATE TABLE IF NOT EXISTS "mod_billing"."plans" (
28
28
  "id" uuid PRIMARY KEY DEFAULT uuidv7() NOT NULL,
29
29
  "slug" text NOT NULL,
30
30
  "name" text NOT NULL,
@@ -44,7 +44,7 @@ CREATE TABLE "mod_billing"."plans" (
44
44
  "updated_at" timestamp with time zone DEFAULT now() NOT NULL
45
45
  );
46
46
  --> statement-breakpoint
47
- CREATE TABLE "mod_billing"."subscriptions" (
47
+ CREATE TABLE IF NOT EXISTS "mod_billing"."subscriptions" (
48
48
  "workspace_id" uuid PRIMARY KEY NOT NULL,
49
49
  "plan_id" uuid,
50
50
  "status" text DEFAULT 'trialing' NOT NULL,
@@ -59,13 +59,13 @@ CREATE TABLE "mod_billing"."subscriptions" (
59
59
  "updated_at" timestamp with time zone DEFAULT now() NOT NULL
60
60
  );
61
61
  --> statement-breakpoint
62
- CREATE TABLE "mod_billing"."webhook_events" (
62
+ CREATE TABLE IF NOT EXISTS "mod_billing"."webhook_events" (
63
63
  "id" text PRIMARY KEY NOT NULL,
64
64
  "type" text NOT NULL,
65
65
  "received_at" timestamp with time zone DEFAULT now() NOT NULL
66
66
  );
67
67
  --> statement-breakpoint
68
- CREATE TABLE "mod_billing"."workspace_usage" (
68
+ CREATE TABLE IF NOT EXISTS "mod_billing"."workspace_usage" (
69
69
  "workspace_id" uuid PRIMARY KEY NOT NULL,
70
70
  "seats" integer DEFAULT 0 NOT NULL,
71
71
  "storage_bytes" bigint DEFAULT 0 NOT NULL,
@@ -73,10 +73,10 @@ CREATE TABLE "mod_billing"."workspace_usage" (
73
73
  "updated_at" timestamp with time zone DEFAULT now() NOT NULL
74
74
  );
75
75
  --> statement-breakpoint
76
- CREATE INDEX "invoices_ws_idx" ON "mod_billing"."invoices" USING btree ("workspace_id","created_at");--> statement-breakpoint
77
- CREATE UNIQUE INDEX "invoices_stripe_idx" ON "mod_billing"."invoices" USING btree ("stripe_invoice_id");--> statement-breakpoint
78
- CREATE UNIQUE INDEX "plans_slug_idx" ON "mod_billing"."plans" USING btree ("slug");--> statement-breakpoint
79
- CREATE INDEX "plans_published_idx" ON "mod_billing"."plans" USING btree ("published","order");--> statement-breakpoint
80
- CREATE INDEX "subscriptions_status_idx" ON "mod_billing"."subscriptions" USING btree ("status");--> statement-breakpoint
81
- CREATE UNIQUE INDEX "subscriptions_stripe_sub_idx" ON "mod_billing"."subscriptions" USING btree ("stripe_subscription_id");--> statement-breakpoint
82
- CREATE INDEX "webhook_events_received_idx" ON "mod_billing"."webhook_events" USING btree ("received_at");
76
+ CREATE INDEX IF NOT EXISTS "invoices_ws_idx" ON "mod_billing"."invoices" USING btree ("workspace_id","created_at");--> statement-breakpoint
77
+ CREATE UNIQUE INDEX IF NOT EXISTS "invoices_stripe_idx" ON "mod_billing"."invoices" USING btree ("stripe_invoice_id");--> statement-breakpoint
78
+ CREATE UNIQUE INDEX IF NOT EXISTS "plans_slug_idx" ON "mod_billing"."plans" USING btree ("slug");--> statement-breakpoint
79
+ CREATE INDEX IF NOT EXISTS "plans_published_idx" ON "mod_billing"."plans" USING btree ("published","order");--> statement-breakpoint
80
+ CREATE INDEX IF NOT EXISTS "subscriptions_status_idx" ON "mod_billing"."subscriptions" USING btree ("status");--> statement-breakpoint
81
+ CREATE UNIQUE INDEX IF NOT EXISTS "subscriptions_stripe_sub_idx" ON "mod_billing"."subscriptions" USING btree ("stripe_subscription_id");--> statement-breakpoint
82
+ CREATE INDEX IF NOT EXISTS "webhook_events_received_idx" ON "mod_billing"."webhook_events" USING btree ("received_at");
@@ -13,6 +13,8 @@ alter table "mod_billing"."invoices" enable row level security;
13
13
  --> statement-breakpoint
14
14
  alter table "mod_billing"."invoices" force row level security;
15
15
  --> statement-breakpoint
16
+ drop policy if exists "invoices_ws_isolation" on "mod_billing"."invoices";
17
+ --> statement-breakpoint
16
18
  create policy "invoices_ws_isolation" on "mod_billing"."invoices"
17
19
  using (workspace_id::text = current_setting('app.workspace_id', true))
18
20
  with check (workspace_id::text = current_setting('app.workspace_id', true));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kernhq/module-billing",
3
- "version": "0.3.4",
3
+ "version": "0.3.6",
4
4
  "description": "Kern billing module: plans, entitlements, subscriptions and Stripe — the mechanism that lets any Kern instance sell seats on itself",
5
5
  "homepage": "https://github.com/KernAIO/module-billing#readme",
6
6
  "license": "AGPL-3.0-only",
@@ -52,7 +52,7 @@
52
52
  "devDependencies": {
53
53
  "@biomejs/biome": "^2.0.0",
54
54
  "@changesets/cli": "^2.27.0",
55
- "@kernhq/contracts": "^0.6.1",
55
+ "@kernhq/contracts": "^0.7.0",
56
56
  "@kernhq/kernel": "^0.7.0",
57
57
  "@kernhq/tsconfig": "^0.1.0",
58
58
  "@kernhq/ui": "^0.10.0",
@@ -67,7 +67,7 @@
67
67
  "vitest": "^4.0.0"
68
68
  },
69
69
  "peerDependencies": {
70
- "@kernhq/contracts": "^0.6.1",
70
+ "@kernhq/contracts": "^0.7.0",
71
71
  "@kernhq/kernel": "^0.7.0",
72
72
  "@kernhq/ui": "^0.10.0",
73
73
  "@tanstack/svelte-query": "^6.1.0",