@devxcrew/platform 0.1.2

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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +82 -0
  3. package/dist/index.d.ts +5 -0
  4. package/dist/index.js +2 -0
  5. package/dist/modules/identity/identity.administration-migration.d.ts +2 -0
  6. package/dist/modules/identity/identity.administration-migration.js +75 -0
  7. package/dist/modules/identity/identity.administration-repository.d.ts +19 -0
  8. package/dist/modules/identity/identity.administration-repository.js +102 -0
  9. package/dist/modules/identity/identity.administration-schema.d.ts +113 -0
  10. package/dist/modules/identity/identity.administration-schema.js +121 -0
  11. package/dist/modules/identity/identity.administration-service.d.ts +97 -0
  12. package/dist/modules/identity/identity.administration-service.js +517 -0
  13. package/dist/modules/identity/identity.controller.d.ts +22 -0
  14. package/dist/modules/identity/identity.controller.js +278 -0
  15. package/dist/modules/identity/identity.error.d.ts +6 -0
  16. package/dist/modules/identity/identity.error.js +15 -0
  17. package/dist/modules/identity/identity.lifecycle-schema.d.ts +19 -0
  18. package/dist/modules/identity/identity.lifecycle-schema.js +29 -0
  19. package/dist/modules/identity/identity.lifecycle-service.d.ts +64 -0
  20. package/dist/modules/identity/identity.lifecycle-service.js +395 -0
  21. package/dist/modules/identity/identity.membership-policy.d.ts +3 -0
  22. package/dist/modules/identity/identity.membership-policy.js +27 -0
  23. package/dist/modules/identity/identity.migration.d.ts +2 -0
  24. package/dist/modules/identity/identity.migration.js +79 -0
  25. package/dist/modules/identity/identity.password.d.ts +3 -0
  26. package/dist/modules/identity/identity.password.js +21 -0
  27. package/dist/modules/identity/identity.permission-declarations-migration.d.ts +5 -0
  28. package/dist/modules/identity/identity.permission-declarations-migration.js +15 -0
  29. package/dist/modules/identity/identity.permission-declarations.d.ts +23 -0
  30. package/dist/modules/identity/identity.permission-declarations.js +57 -0
  31. package/dist/modules/identity/identity.permission-labels-migration.d.ts +5 -0
  32. package/dist/modules/identity/identity.permission-labels-migration.js +9 -0
  33. package/dist/modules/identity/identity.presentation-service.d.ts +23 -0
  34. package/dist/modules/identity/identity.presentation-service.js +51 -0
  35. package/dist/modules/identity/identity.provider.d.ts +78 -0
  36. package/dist/modules/identity/identity.provider.js +119 -0
  37. package/dist/modules/identity/identity.public-schemas.d.ts +4 -0
  38. package/dist/modules/identity/identity.public-schemas.js +3 -0
  39. package/dist/modules/identity/identity.repository.d.ts +40 -0
  40. package/dist/modules/identity/identity.repository.js +196 -0
  41. package/dist/modules/identity/identity.request-context.d.ts +2 -0
  42. package/dist/modules/identity/identity.request-context.js +10 -0
  43. package/dist/modules/identity/identity.roles-migration.d.ts +2 -0
  44. package/dist/modules/identity/identity.roles-migration.js +64 -0
  45. package/dist/modules/identity/identity.roles-service.d.ts +49 -0
  46. package/dist/modules/identity/identity.roles-service.js +327 -0
  47. package/dist/modules/identity/identity.routes.d.ts +22 -0
  48. package/dist/modules/identity/identity.routes.js +11 -0
  49. package/dist/modules/identity/identity.schema.d.ts +27 -0
  50. package/dist/modules/identity/identity.schema.js +34 -0
  51. package/dist/modules/identity/identity.seed.d.ts +3 -0
  52. package/dist/modules/identity/identity.seed.js +81 -0
  53. package/dist/modules/identity/identity.service.d.ts +32 -0
  54. package/dist/modules/identity/identity.service.js +83 -0
  55. package/dist/modules/identity/identity.types.d.ts +150 -0
  56. package/dist/modules/identity/identity.types.js +1 -0
  57. package/dist/modules/identity/index.d.ts +12 -0
  58. package/dist/modules/identity/index.js +9 -0
  59. package/package.json +62 -0
@@ -0,0 +1,150 @@
1
+ import type { Generated } from "kysely";
2
+ import type { IdentityPermissionDeclaration } from "./identity.permission-declarations.js";
3
+ export type Portal = "user" | "admin" | "super-admin";
4
+ export interface IdentityPermissionCatalogEntry {
5
+ id: string;
6
+ label: string;
7
+ owner: string;
8
+ appId: string | null;
9
+ portals: Portal[];
10
+ }
11
+ export interface IdentityConfig {
12
+ appId: string;
13
+ origin: string;
14
+ mode: "single-client" | "multi-tenant";
15
+ tenantId: string;
16
+ sessionSeconds: number;
17
+ }
18
+ export interface Principal {
19
+ user: {
20
+ id: string;
21
+ name: string;
22
+ email: string;
23
+ };
24
+ appId: string;
25
+ portal: Portal;
26
+ tenant: {
27
+ id: string;
28
+ name: string;
29
+ };
30
+ permissions: string[];
31
+ }
32
+ export interface IdentitySchema {
33
+ identity_permission_declarations: {
34
+ permission_id: string;
35
+ app_id: string;
36
+ owner: string;
37
+ portals: string;
38
+ label: Generated<string | null>;
39
+ };
40
+ identity_app_settings: {
41
+ app_id: string;
42
+ display_name: string;
43
+ locale: string;
44
+ time_zone: string;
45
+ session_seconds: number;
46
+ version: Generated<number>;
47
+ };
48
+ identity_tokens: {
49
+ id: string;
50
+ token_hash: string;
51
+ app_id: string;
52
+ tenant_id: string;
53
+ kind: "invitation" | "recovery";
54
+ email: string;
55
+ name: string;
56
+ role_id: Portal;
57
+ user_id: string | null;
58
+ expires_at: string;
59
+ consumed_at: string | null;
60
+ delivered: number;
61
+ };
62
+ identity_users: {
63
+ id: string;
64
+ email: string;
65
+ name: string;
66
+ password_hash: string;
67
+ active: number;
68
+ version: Generated<number>;
69
+ };
70
+ identity_tenants: {
71
+ id: string;
72
+ name: string;
73
+ active: number;
74
+ version: Generated<number>;
75
+ };
76
+ identity_roles: {
77
+ id: string;
78
+ version: Generated<number>;
79
+ };
80
+ identity_permissions: {
81
+ id: string;
82
+ };
83
+ identity_role_permissions: {
84
+ role_id: string;
85
+ permission_id: string;
86
+ };
87
+ identity_memberships: {
88
+ user_id: string;
89
+ tenant_id: string;
90
+ role_id: string;
91
+ custom_role_id: Generated<string | null>;
92
+ active: Generated<number>;
93
+ version: Generated<number>;
94
+ };
95
+ identity_custom_roles: {
96
+ id: string;
97
+ app_id: string;
98
+ tenant_id: string;
99
+ name: string;
100
+ active: Generated<number>;
101
+ version: Generated<number>;
102
+ };
103
+ identity_custom_role_permissions: {
104
+ role_id: string;
105
+ permission_id: string;
106
+ };
107
+ identity_sessions: {
108
+ token_hash: string;
109
+ user_id: string;
110
+ tenant_id: string;
111
+ app_id: string;
112
+ portal: Portal;
113
+ expires_at: string;
114
+ };
115
+ identity_throttles: {
116
+ key: string;
117
+ attempts: number;
118
+ expires_at: string;
119
+ };
120
+ identity_settings: {
121
+ tenant_id: string;
122
+ display_name: string;
123
+ locale: string;
124
+ time_zone: string;
125
+ version: Generated<number>;
126
+ };
127
+ identity_audit_events: {
128
+ id: string;
129
+ app_id: string;
130
+ actor_id: string;
131
+ tenant_id: string;
132
+ action: string;
133
+ resource_id: string;
134
+ created_at: string;
135
+ };
136
+ }
137
+ export interface IdentityDeliveryProvider {
138
+ send(input: {
139
+ to: string;
140
+ subject: string;
141
+ text: string;
142
+ html?: string;
143
+ }): Promise<{
144
+ messageId: string;
145
+ }>;
146
+ }
147
+ export interface IdentityProviderOptions {
148
+ delivery?: IdentityDeliveryProvider;
149
+ permissions?: readonly IdentityPermissionDeclaration[];
150
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export { createIdentityProvider } from "./identity.provider.js";
2
+ export { IdentityError } from "./identity.error.js";
3
+ export { identityMigration } from "./identity.migration.js";
4
+ export { identityAdministrationMigration } from "./identity.administration-migration.js";
5
+ export { identityRolesMigration } from "./identity.roles-migration.js";
6
+ export { identityPermissionDeclarationsMigration } from "./identity.permission-declarations-migration.js";
7
+ export { identityPermissionLabelsMigration } from "./identity.permission-labels-migration.js";
8
+ export type { IdentityPermissionDeclaration } from "./identity.permission-declarations.js";
9
+ export { listSchema, userCreateSchema, userUpdateSchema, organizationCreateSchema, organizationUpdateSchema, membershipSchema, roleUpdateSchema, profileSchema, settingsSchema, } from "./identity.administration-schema.js";
10
+ export type { IdentityListQuery, IdentityResource, } from "./identity.administration-schema.js";
11
+ export { seedIdentity } from "./identity.seed.js";
12
+ export type { IdentitySchema, IdentityConfig, Principal, Portal, IdentityDeliveryProvider, IdentityProviderOptions, IdentityPermissionCatalogEntry, } from "./identity.types.js";
@@ -0,0 +1,9 @@
1
+ export { createIdentityProvider } from "./identity.provider.js";
2
+ export { IdentityError } from "./identity.error.js";
3
+ export { identityMigration } from "./identity.migration.js";
4
+ export { identityAdministrationMigration } from "./identity.administration-migration.js";
5
+ export { identityRolesMigration } from "./identity.roles-migration.js";
6
+ export { identityPermissionDeclarationsMigration } from "./identity.permission-declarations-migration.js";
7
+ export { identityPermissionLabelsMigration } from "./identity.permission-labels-migration.js";
8
+ export { listSchema, userCreateSchema, userUpdateSchema, organizationCreateSchema, organizationUpdateSchema, membershipSchema, roleUpdateSchema, profileSchema, settingsSchema, } from "./identity.administration-schema.js";
9
+ export { seedIdentity } from "./identity.seed.js";
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "@devxcrew/platform",
3
+ "version": "0.1.2",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/devxcrew/platform.git"
7
+ },
8
+ "type": "module",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "default": "./dist/index.js"
13
+ },
14
+ "./identity/schemas": {
15
+ "types": "./dist/modules/identity/identity.public-schemas.d.ts",
16
+ "default": "./dist/modules/identity/identity.public-schemas.js"
17
+ }
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "engines": {
24
+ "node": ">=26.10.0"
25
+ },
26
+ "scripts": {
27
+ "build": "tsc -p tsconfig.json",
28
+ "prepack": "npm run build",
29
+ "test": "tsx --test src/modules/identity/*.test.ts",
30
+ "mcp:connect": "node agent/connect.mjs",
31
+ "mcp:verify": "node agent/connect.mjs --strict",
32
+ "version-bump": "devxcrew-tools version:bump",
33
+ "version:bump": "devxcrew-tools version:bump",
34
+ "version:show": "devxcrew-tools version:show",
35
+ "changelog:append": "devxcrew-tools changelog:append",
36
+ "changelog:show": "devxcrew-tools changelog:show",
37
+ "fix:line-endings": "devxcrew-tools lines:fix",
38
+ "lines:check": "devxcrew-tools lines:check",
39
+ "check:versions": "devxcrew-tools check:versions",
40
+ "github:now": "devxcrew-tools github:now",
41
+ "tools:check": "devxcrew-tools dependencies:order && devxcrew-tools check:versions && devxcrew-tools lines:check",
42
+ "check": "npm run tools:check && npm test",
43
+ "release:check": "npm run check && npm run build && npm pack --dry-run --ignore-scripts",
44
+ "prepublishOnly": "npm run release:check",
45
+ "verify": "npm run release:check"
46
+ },
47
+ "dependencies": {
48
+ "kysely": "^0.29.5",
49
+ "zod": "^4.0.0"
50
+ },
51
+ "devDependencies": {
52
+ "@devxcrew/tools": "0.1.7",
53
+ "@types/node": "^26.0.0",
54
+ "tsx": "^4.23.12",
55
+ "typescript": "7.0.2"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "license": "MIT"
62
+ }