@nymbalhq/platform 1.3.0 → 1.5.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/{chunk-QN56IB4G.js → chunk-NNDIAIT6.js} +187 -5
- package/dist/chunk-NNDIAIT6.js.map +1 -0
- package/dist/{chunk-2PLYK5RU.js → chunk-TRLERRUI.js} +3559 -509
- package/dist/chunk-TRLERRUI.js.map +1 -0
- package/dist/db/schema/index.d.ts +5276 -3224
- package/dist/db/schema/index.js +1 -1
- package/dist/index.d.ts +428 -81
- package/dist/index.js +1200 -2254
- package/dist/index.js.map +1 -1
- package/dist/register-SBGUI2L5.js +8 -0
- package/migrations/postgres/0013_order_access_keys.sql +11 -0
- package/migrations/postgres/0014_alert_subscriptions.sql +22 -0
- package/migrations/postgres/0015_events_retry_at.sql +1 -0
- package/migrations/postgres/0016_email_suppressions.sql +7 -0
- package/migrations/postgres/0017_order_shipments.sql +14 -0
- package/migrations/postgres/0018_order_key_expiry.sql +8 -0
- package/migrations/postgres/meta/0013_snapshot.json +2000 -0
- package/migrations/postgres/meta/0014_snapshot.json +2185 -0
- package/migrations/postgres/meta/0015_snapshot.json +2191 -0
- package/migrations/postgres/meta/0016_snapshot.json +2233 -0
- package/migrations/postgres/meta/0017_snapshot.json +2300 -0
- package/migrations/postgres/meta/0018_snapshot.json +2306 -0
- package/migrations/postgres/meta/_journal.json +42 -0
- package/migrations/sqlite/0013_order_access_keys.sql +11 -0
- package/migrations/sqlite/0014_alert_subscriptions.sql +22 -0
- package/migrations/sqlite/0015_events_retry_at.sql +1 -0
- package/migrations/sqlite/0016_email_suppressions.sql +7 -0
- package/migrations/sqlite/0017_order_shipments.sql +9 -0
- package/migrations/sqlite/0018_order_key_expiry.sql +25 -0
- package/migrations/sqlite/meta/0013_snapshot.json +1788 -0
- package/migrations/sqlite/meta/0014_snapshot.json +1931 -0
- package/migrations/sqlite/meta/0015_snapshot.json +1938 -0
- package/migrations/sqlite/meta/0016_snapshot.json +1981 -0
- package/migrations/sqlite/meta/0017_snapshot.json +2041 -0
- package/migrations/sqlite/meta/0018_snapshot.json +2048 -0
- package/migrations/sqlite/meta/_journal.json +42 -0
- package/package.json +17 -47
- package/dist/chunk-2PLYK5RU.js.map +0 -1
- package/dist/chunk-QN56IB4G.js.map +0 -1
- package/dist/register-UUQ64HZP.js +0 -8
- /package/dist/{register-UUQ64HZP.js.map → register-SBGUI2L5.js.map} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- What opens an order to a shopper with no session: the sha256 hex of each key a checkout or an email served.
|
|
2
|
+
CREATE TABLE IF NOT EXISTS "order_access_keys" (
|
|
3
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
4
|
+
"order_id" text NOT NULL,
|
|
5
|
+
"key_hash" text NOT NULL,
|
|
6
|
+
"purpose" text NOT NULL,
|
|
7
|
+
"created_at" timestamp with time zone NOT NULL
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "order_access_keys_key_hash_idx" ON "order_access_keys" USING btree ("key_hash");--> statement-breakpoint
|
|
11
|
+
CREATE INDEX IF NOT EXISTS "order_access_keys_order_idx" ON "order_access_keys" USING btree ("order_id");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "alert_subscriptions" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"email" text NOT NULL,
|
|
4
|
+
"kind" text NOT NULL,
|
|
5
|
+
"variant_id" text NOT NULL,
|
|
6
|
+
"product_id" text NOT NULL,
|
|
7
|
+
"status" text NOT NULL,
|
|
8
|
+
"confirm_token" text NOT NULL,
|
|
9
|
+
"unsubscribe_token" text NOT NULL,
|
|
10
|
+
"origin" text NOT NULL,
|
|
11
|
+
"baseline_price_minor" integer,
|
|
12
|
+
"created_at" timestamp with time zone NOT NULL,
|
|
13
|
+
"updated_at" timestamp with time zone NOT NULL,
|
|
14
|
+
"confirmed_at" timestamp with time zone,
|
|
15
|
+
CONSTRAINT "alert_subscriptions_kind" CHECK ("alert_subscriptions"."kind" IN ('back_in_stock', 'price_drop')),
|
|
16
|
+
CONSTRAINT "alert_subscriptions_status" CHECK ("alert_subscriptions"."status" IN ('pending', 'active', 'fired', 'unsubscribed'))
|
|
17
|
+
);
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "alert_subscriptions_address_unique" ON "alert_subscriptions" USING btree ("email","variant_id","kind");--> statement-breakpoint
|
|
20
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "alert_subscriptions_confirm_token_unique" ON "alert_subscriptions" USING btree ("confirm_token");--> statement-breakpoint
|
|
21
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "alert_subscriptions_unsubscribe_token_unique" ON "alert_subscriptions" USING btree ("unsubscribe_token");--> statement-breakpoint
|
|
22
|
+
CREATE INDEX IF NOT EXISTS "alert_subscriptions_fan_out_idx" ON "alert_subscriptions" USING btree ("variant_id","kind","status");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE "events" ADD COLUMN "retry_at" timestamp with time zone;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "email_suppressions" (
|
|
2
|
+
"email" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"reason" text NOT NULL,
|
|
4
|
+
"event_id" text NOT NULL,
|
|
5
|
+
"created_at" timestamp with time zone NOT NULL,
|
|
6
|
+
CONSTRAINT "email_suppressions_reason" CHECK ("email_suppressions"."reason" IN ('hard_bounce', 'complaint'))
|
|
7
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
CREATE TABLE IF NOT EXISTS "order_shipments" (
|
|
2
|
+
"order_id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"carrier" text NOT NULL,
|
|
4
|
+
"tracking_number" text NOT NULL,
|
|
5
|
+
"created_at" timestamp with time zone NOT NULL
|
|
6
|
+
);
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
DO $$ BEGIN
|
|
9
|
+
ALTER TABLE "order_shipments" ADD CONSTRAINT "order_shipments_order_id_orders_id_fk" FOREIGN KEY ("order_id") REFERENCES "orders"("id") ON DELETE no action ON UPDATE no action;
|
|
10
|
+
EXCEPTION
|
|
11
|
+
WHEN duplicate_object THEN null;
|
|
12
|
+
END $$;
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE INDEX IF NOT EXISTS "order_shipments_tracking_number_idx" ON "order_shipments" USING btree ("tracking_number");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Every key gets an expiry. A migration reads no config, so existing rows get the default lifetimes: 48 hours for a
|
|
2
|
+
-- checkout key, 30 days for an email key, written in hours so the session's time zone cannot move a day across DST.
|
|
3
|
+
ALTER TABLE "order_access_keys" ADD COLUMN "expires_at" timestamp with time zone;
|
|
4
|
+
--> statement-breakpoint
|
|
5
|
+
UPDATE "order_access_keys"
|
|
6
|
+
SET "expires_at" = "created_at" + CASE "purpose" WHEN 'email' THEN interval '720 hours' ELSE interval '48 hours' END;
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
ALTER TABLE "order_access_keys" ALTER COLUMN "expires_at" SET NOT NULL;
|