@x12i/keyrox-store-pg 0.0.0-stage → 0.1.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.
@@ -0,0 +1,155 @@
1
+ ALTER TABLE users ADD COLUMN last_org_id text;
2
+ ALTER TABLE orgs ADD COLUMN logo_url text;
3
+ ALTER TABLE memberships ADD COLUMN production_access boolean NOT NULL DEFAULT false;
4
+ UPDATE memberships SET production_access = true WHERE role = 'owner';
5
+ ALTER TABLE invites ADD COLUMN production_access boolean NOT NULL DEFAULT false;
6
+
7
+ ALTER TABLE applications
8
+ ADD COLUMN product_name text NOT NULL DEFAULT '',
9
+ ADD COLUMN logo_url text,
10
+ ADD COLUMN accent_color text,
11
+ ADD COLUMN signup_mode text NOT NULL DEFAULT 'open',
12
+ ADD COLUMN allow_without_personal_org boolean NOT NULL DEFAULT false;
13
+ UPDATE applications SET product_name = title WHERE product_name = '';
14
+
15
+ CREATE TABLE platform_settings (
16
+ id text PRIMARY KEY,
17
+ signup_mode text NOT NULL,
18
+ explicit boolean NOT NULL DEFAULT false,
19
+ operators text[] NOT NULL DEFAULT '{}'
20
+ );
21
+
22
+ INSERT INTO platform_settings (id, signup_mode, explicit, operators) VALUES ('platform', 'open', false, '{}');
23
+
24
+ CREATE TABLE platform_waitlist (
25
+ id text PRIMARY KEY,
26
+ email text NOT NULL UNIQUE,
27
+ status text NOT NULL,
28
+ token_hash text,
29
+ created_at timestamptz NOT NULL
30
+ );
31
+
32
+ CREATE TABLE app_identities (
33
+ id text PRIMARY KEY,
34
+ app_id text NOT NULL REFERENCES applications (id),
35
+ environment_id text NOT NULL REFERENCES app_environments (id),
36
+ org_id text NOT NULL,
37
+ kind text NOT NULL,
38
+ email text,
39
+ password_hash text,
40
+ display_name text NOT NULL,
41
+ status text NOT NULL,
42
+ email_verified_at timestamptz,
43
+ metadata jsonb NOT NULL DEFAULT '{}',
44
+ created_at timestamptz NOT NULL,
45
+ updated_at timestamptz NOT NULL
46
+ );
47
+
48
+ CREATE UNIQUE INDEX app_identities_email_idx ON app_identities (environment_id, lower(email)) WHERE email IS NOT NULL;
49
+ CREATE INDEX app_identities_environment_idx ON app_identities (environment_id, created_at, id);
50
+
51
+ CREATE TABLE app_identity_memberships (
52
+ id text PRIMARY KEY,
53
+ environment_id text NOT NULL,
54
+ identity_id text NOT NULL REFERENCES app_identities (id),
55
+ organization_id text NOT NULL,
56
+ relation text NOT NULL,
57
+ created_at timestamptz NOT NULL,
58
+ UNIQUE (identity_id, organization_id)
59
+ );
60
+
61
+ CREATE INDEX app_identity_memberships_environment_idx ON app_identity_memberships (environment_id);
62
+
63
+ CREATE TABLE app_permissions (
64
+ id text PRIMARY KEY,
65
+ environment_id text NOT NULL,
66
+ key text NOT NULL,
67
+ description text NOT NULL,
68
+ created_at timestamptz NOT NULL,
69
+ UNIQUE (environment_id, key)
70
+ );
71
+
72
+ CREATE TABLE app_product_roles (
73
+ id text PRIMARY KEY,
74
+ environment_id text NOT NULL,
75
+ name text NOT NULL,
76
+ permissions text[] NOT NULL,
77
+ inherits text[] NOT NULL,
78
+ created_at timestamptz NOT NULL
79
+ );
80
+
81
+ CREATE TABLE app_groups (
82
+ id text PRIMARY KEY,
83
+ environment_id text NOT NULL,
84
+ name text NOT NULL,
85
+ created_at timestamptz NOT NULL
86
+ );
87
+
88
+ CREATE TABLE app_group_members (
89
+ id text PRIMARY KEY,
90
+ environment_id text NOT NULL,
91
+ group_id text NOT NULL REFERENCES app_groups (id),
92
+ identity_id text NOT NULL,
93
+ created_at timestamptz NOT NULL,
94
+ UNIQUE (group_id, identity_id)
95
+ );
96
+
97
+ CREATE TABLE app_role_bindings (
98
+ id text PRIMARY KEY,
99
+ environment_id text NOT NULL,
100
+ role_id text NOT NULL,
101
+ subject_type text NOT NULL,
102
+ subject_id text NOT NULL,
103
+ organization_id text,
104
+ resource text,
105
+ created_at timestamptz NOT NULL
106
+ );
107
+
108
+ CREATE INDEX app_role_bindings_environment_idx ON app_role_bindings (environment_id);
109
+
110
+ CREATE TABLE app_features (
111
+ id text PRIMARY KEY,
112
+ environment_id text NOT NULL,
113
+ key text NOT NULL,
114
+ enabled boolean NOT NULL,
115
+ config jsonb NOT NULL DEFAULT '{}',
116
+ created_at timestamptz NOT NULL,
117
+ UNIQUE (environment_id, key)
118
+ );
119
+
120
+ CREATE TABLE app_feature_assignments (
121
+ id text PRIMARY KEY,
122
+ environment_id text NOT NULL,
123
+ feature_id text NOT NULL REFERENCES app_features (id),
124
+ target_type text NOT NULL,
125
+ target_id text,
126
+ enabled boolean NOT NULL,
127
+ feature_limit integer,
128
+ config jsonb NOT NULL DEFAULT '{}',
129
+ created_at timestamptz NOT NULL
130
+ );
131
+
132
+ CREATE INDEX app_feature_assignments_environment_idx ON app_feature_assignments (environment_id);
133
+
134
+ CREATE TABLE app_waitlist (
135
+ id text PRIMARY KEY,
136
+ app_id text NOT NULL,
137
+ environment_id text NOT NULL,
138
+ email text NOT NULL,
139
+ status text NOT NULL,
140
+ token_hash text,
141
+ created_at timestamptz NOT NULL,
142
+ UNIQUE (environment_id, email)
143
+ );
144
+
145
+ CREATE TABLE directory_challenges (
146
+ id text PRIMARY KEY,
147
+ environment_id text NOT NULL,
148
+ identity_id text NOT NULL,
149
+ purpose text NOT NULL,
150
+ email text NOT NULL,
151
+ token_hash text NOT NULL UNIQUE,
152
+ expires_at timestamptz NOT NULL,
153
+ used_at timestamptz,
154
+ created_at timestamptz NOT NULL
155
+ );
package/package.json CHANGED
@@ -1,6 +1,38 @@
1
1
  {
2
2
  "name": "@x12i/keyrox-store-pg",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "PostgreSQL repository for Keyrox accounts, grants, and tokens",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": ["dist", "migrations"],
15
+ "scripts": {
16
+ "build": "tsc -p tsconfig.json",
17
+ "test": "vitest run",
18
+ "typecheck": "tsc -p tsconfig.json --noEmit",
19
+ "lint": "echo ok"
20
+ },
21
+ "dependencies": {
22
+ "@x12i/keyrox-store": "0.1.0",
23
+ "@x12i/keyrox-types": "0.1.0",
24
+ "pg": "^8.16.3"
25
+ },
26
+ "devDependencies": {
27
+ "@electric-sql/pglite": "^0.3.14",
28
+ "@types/pg": "^8.15.5",
29
+ "typescript": "^5.8.3",
30
+ "vitest": "^3.2.1"
31
+ },
32
+ "publishConfig": { "access": "public" },
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git+https://github.com/x12i/keyrox.git",
36
+ "directory": "packages/store-pg"
37
+ }
38
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.