@lssm/lib.identity-rbac 0.0.0-canary-20251217083314 → 1.41.1

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 (148) hide show
  1. package/dist/contracts/index.js +1 -5
  2. package/dist/contracts/organization.js +1 -607
  3. package/dist/contracts/rbac.js +1 -487
  4. package/dist/contracts/user.js +1 -335
  5. package/dist/entities/index.js +1 -35
  6. package/dist/entities/organization.js +1 -151
  7. package/dist/entities/rbac.js +1 -138
  8. package/dist/entities/user.js +1 -194
  9. package/dist/events.js +1 -543
  10. package/dist/identity-rbac.feature.js +1 -186
  11. package/dist/index.js +1 -14
  12. package/dist/policies/engine.js +1 -167
  13. package/dist/policies/index.js +1 -3
  14. package/package.json +18 -18
  15. package/dist/contracts/dist/capabilities/openbanking.js +0 -88
  16. package/dist/contracts/dist/client/index.js +0 -5
  17. package/dist/contracts/dist/client/react/feature-render.js +0 -2
  18. package/dist/contracts/dist/client/react/form-render.js +0 -4
  19. package/dist/contracts/dist/client/react/index.js +0 -4
  20. package/dist/contracts/dist/contract-registry/index.js +0 -1
  21. package/dist/contracts/dist/contract-registry/schemas.js +0 -60
  22. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  23. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  24. package/dist/contracts/dist/docs/index.js +0 -29
  25. package/dist/contracts/dist/docs/presentations.js +0 -71
  26. package/dist/contracts/dist/docs/registry.js +0 -44
  27. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  28. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  29. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  30. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  31. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  32. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  33. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  34. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  35. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  36. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  37. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  38. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  39. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  40. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  41. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  42. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  43. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  44. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  45. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  46. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  47. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  48. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  49. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  50. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  51. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  52. package/dist/contracts/dist/events.js +0 -10
  53. package/dist/contracts/dist/experiments/evaluator.js +0 -1
  54. package/dist/contracts/dist/index.js +0 -71
  55. package/dist/contracts/dist/install.js +0 -2
  56. package/dist/contracts/dist/integrations/contracts.js +0 -377
  57. package/dist/contracts/dist/integrations/index.js +0 -18
  58. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  59. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  60. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  61. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  62. package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
  63. package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  64. package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  65. package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  66. package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
  67. package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
  68. package/dist/contracts/dist/integrations/providers/index.js +0 -11
  69. package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
  70. package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
  71. package/dist/contracts/dist/integrations/providers/powens.js +0 -116
  72. package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
  73. package/dist/contracts/dist/integrations/providers/registry.js +0 -10
  74. package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
  75. package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  76. package/dist/contracts/dist/jsonschema.js +0 -1
  77. package/dist/contracts/dist/knowledge/contracts.js +0 -306
  78. package/dist/contracts/dist/knowledge/index.js +0 -7
  79. package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  80. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  81. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  82. package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
  83. package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  84. package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  85. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  86. package/dist/contracts/dist/llm/exporters.js +0 -19
  87. package/dist/contracts/dist/llm/index.js +0 -2
  88. package/dist/contracts/dist/llm/prompts.js +0 -1
  89. package/dist/contracts/dist/onboarding-base.js +0 -196
  90. package/dist/contracts/dist/openapi.js +0 -1
  91. package/dist/contracts/dist/ownership.js +0 -21
  92. package/dist/contracts/dist/presentations.js +0 -1
  93. package/dist/contracts/dist/presentations.v2.js +0 -11
  94. package/dist/contracts/dist/prompt.js +0 -1
  95. package/dist/contracts/dist/promptRegistry.js +0 -1
  96. package/dist/contracts/dist/regenerator/index.js +0 -1
  97. package/dist/contracts/dist/regenerator/service.js +0 -6
  98. package/dist/contracts/dist/registry.js +0 -2
  99. package/dist/contracts/dist/resources.js +0 -1
  100. package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
  101. package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
  102. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  103. package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
  104. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  105. package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
  106. package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
  107. package/dist/contracts/dist/schema/dist/index.js +0 -6
  108. package/dist/contracts/dist/server/graphql-pothos.js +0 -6
  109. package/dist/contracts/dist/server/index.js +0 -8
  110. package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
  111. package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
  112. package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
  113. package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
  114. package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
  115. package/dist/contracts/dist/server/provider-mcp.js +0 -1
  116. package/dist/contracts/dist/server/rest-elysia.js +0 -1
  117. package/dist/contracts/dist/server/rest-express.js +0 -1
  118. package/dist/contracts/dist/server/rest-generic.js +0 -1
  119. package/dist/contracts/dist/server/rest-next-app.js +0 -1
  120. package/dist/contracts/dist/server/rest-next-pages.js +0 -1
  121. package/dist/contracts/dist/spec.js +0 -34
  122. package/dist/contracts/dist/telemetry/index.js +0 -1
  123. package/dist/contracts/dist/telemetry/tracker.js +0 -1
  124. package/dist/contracts/dist/tests/index.js +0 -1
  125. package/dist/contracts/dist/tests/runner.js +0 -2
  126. package/dist/contracts/dist/workflow/index.js +0 -1
  127. package/dist/contracts/dist/workflow/runner.js +0 -1
  128. package/dist/contracts/index.d.ts +0 -4
  129. package/dist/contracts/organization.d.ts +0 -895
  130. package/dist/contracts/rbac.d.ts +0 -611
  131. package/dist/contracts/user.d.ts +0 -610
  132. package/dist/entities/index.d.ts +0 -176
  133. package/dist/entities/organization.d.ts +0 -86
  134. package/dist/entities/rbac.d.ts +0 -87
  135. package/dist/entities/user.d.ts +0 -87
  136. package/dist/events.d.ts +0 -689
  137. package/dist/identity-rbac.feature.d.ts +0 -11
  138. package/dist/index.d.ts +0 -11
  139. package/dist/policies/engine.d.ts +0 -132
  140. package/dist/policies/index.d.ts +0 -2
  141. package/dist/schema/dist/EnumType.js +0 -2
  142. package/dist/schema/dist/FieldType.js +0 -49
  143. package/dist/schema/dist/ScalarTypeEnum.js +0 -236
  144. package/dist/schema/dist/SchemaModel.js +0 -34
  145. package/dist/schema/dist/entity/defineEntity.js +0 -236
  146. package/dist/schema/dist/entity/index.js +0 -2
  147. package/dist/schema/dist/entity/types.js +0 -1
  148. package/dist/schema/dist/index.js +0 -6
@@ -1,132 +0,0 @@
1
- //#region src/policies/engine.d.ts
2
- /**
3
- * Standard permissions for identity-rbac module.
4
- */
5
- declare const Permission: {
6
- readonly USER_CREATE: "user.create";
7
- readonly USER_READ: "user.read";
8
- readonly USER_UPDATE: "user.update";
9
- readonly USER_DELETE: "user.delete";
10
- readonly USER_LIST: "user.list";
11
- readonly USER_MANAGE: "user.manage";
12
- readonly ORG_CREATE: "org.create";
13
- readonly ORG_READ: "org.read";
14
- readonly ORG_UPDATE: "org.update";
15
- readonly ORG_DELETE: "org.delete";
16
- readonly ORG_LIST: "org.list";
17
- readonly MEMBER_INVITE: "member.invite";
18
- readonly MEMBER_REMOVE: "member.remove";
19
- readonly MEMBER_UPDATE_ROLE: "member.update_role";
20
- readonly MEMBER_LIST: "member.list";
21
- readonly MANAGE_MEMBERS: "org.manage_members";
22
- readonly TEAM_CREATE: "team.create";
23
- readonly TEAM_UPDATE: "team.update";
24
- readonly TEAM_DELETE: "team.delete";
25
- readonly TEAM_MANAGE: "team.manage";
26
- readonly ROLE_CREATE: "role.create";
27
- readonly ROLE_UPDATE: "role.update";
28
- readonly ROLE_DELETE: "role.delete";
29
- readonly ROLE_ASSIGN: "role.assign";
30
- readonly ROLE_REVOKE: "role.revoke";
31
- readonly BILLING_VIEW: "billing.view";
32
- readonly BILLING_MANAGE: "billing.manage";
33
- readonly PROJECT_CREATE: "project.create";
34
- readonly PROJECT_READ: "project.read";
35
- readonly PROJECT_UPDATE: "project.update";
36
- readonly PROJECT_DELETE: "project.delete";
37
- readonly PROJECT_MANAGE: "project.manage";
38
- readonly ADMIN_ACCESS: "admin.access";
39
- readonly ADMIN_IMPERSONATE: "admin.impersonate";
40
- };
41
- type PermissionKey = (typeof Permission)[keyof typeof Permission];
42
- /**
43
- * Standard role definitions.
44
- */
45
- declare const StandardRole: {
46
- readonly OWNER: {
47
- readonly name: "owner";
48
- readonly description: "Organization owner with full access";
49
- readonly permissions: ("user.create" | "user.read" | "user.update" | "user.delete" | "user.list" | "user.manage" | "org.create" | "org.read" | "org.update" | "org.delete" | "org.list" | "member.invite" | "member.remove" | "member.update_role" | "member.list" | "org.manage_members" | "team.create" | "team.update" | "team.delete" | "team.manage" | "role.create" | "role.update" | "role.delete" | "role.assign" | "role.revoke" | "billing.view" | "billing.manage" | "project.create" | "project.read" | "project.update" | "project.delete" | "project.manage" | "admin.access" | "admin.impersonate")[];
50
- };
51
- readonly ADMIN: {
52
- readonly name: "admin";
53
- readonly description: "Administrator with most permissions";
54
- readonly permissions: readonly ["user.read", "user.list", "org.read", "org.update", "member.invite", "member.remove", "member.update_role", "member.list", "org.manage_members", "team.create", "team.update", "team.delete", "team.manage", "project.create", "project.read", "project.update", "project.delete", "project.manage", "billing.view"];
55
- };
56
- readonly MEMBER: {
57
- readonly name: "member";
58
- readonly description: "Regular organization member";
59
- readonly permissions: readonly ["user.read", "org.read", "member.list", "project.read", "project.create"];
60
- };
61
- readonly VIEWER: {
62
- readonly name: "viewer";
63
- readonly description: "Read-only access";
64
- readonly permissions: readonly ["user.read", "org.read", "member.list", "project.read"];
65
- };
66
- };
67
- /**
68
- * Permission check input.
69
- */
70
- interface PermissionCheckInput {
71
- userId: string;
72
- orgId?: string;
73
- permission: PermissionKey | string;
74
- }
75
- /**
76
- * Permission check result.
77
- */
78
- interface PermissionCheckResult {
79
- allowed: boolean;
80
- reason?: string;
81
- matchedRole?: string;
82
- }
83
- /**
84
- * Role with permissions.
85
- */
86
- interface RoleWithPermissions {
87
- id: string;
88
- name: string;
89
- permissions: string[];
90
- }
91
- /**
92
- * Policy binding for permission evaluation.
93
- */
94
- interface PolicyBindingForEval {
95
- roleId: string;
96
- role: RoleWithPermissions;
97
- targetType: 'user' | 'organization';
98
- targetId: string;
99
- expiresAt?: Date | null;
100
- }
101
- /**
102
- * RBAC Policy Engine for permission checks.
103
- */
104
- declare class RBACPolicyEngine {
105
- private roleCache;
106
- private bindingCache;
107
- /**
108
- * Check if a user has a specific permission.
109
- */
110
- checkPermission(input: PermissionCheckInput, bindings: PolicyBindingForEval[]): Promise<PermissionCheckResult>;
111
- /**
112
- * Get all permissions for a user in a context.
113
- */
114
- getPermissions(userId: string, orgId: string | undefined, bindings: PolicyBindingForEval[]): Promise<{
115
- permissions: Set<string>;
116
- roles: RoleWithPermissions[];
117
- }>;
118
- /**
119
- * Check if user has any of the specified permissions.
120
- */
121
- hasAnyPermission(userId: string, orgId: string | undefined, permissions: string[], bindings: PolicyBindingForEval[]): Promise<boolean>;
122
- /**
123
- * Check if user has all of the specified permissions.
124
- */
125
- hasAllPermissions(userId: string, orgId: string | undefined, permissions: string[], bindings: PolicyBindingForEval[]): Promise<boolean>;
126
- }
127
- /**
128
- * Create a new RBAC policy engine instance.
129
- */
130
- declare function createRBACEngine(): RBACPolicyEngine;
131
- //#endregion
132
- export { Permission, PermissionCheckInput, PermissionCheckResult, PermissionKey, PolicyBindingForEval, RBACPolicyEngine, RoleWithPermissions, StandardRole, createRBACEngine };
@@ -1,2 +0,0 @@
1
- import { Permission, PermissionCheckInput, PermissionCheckResult, PermissionKey, PolicyBindingForEval, RBACPolicyEngine, RoleWithPermissions, StandardRole, createRBACEngine } from "./engine.js";
2
- export { Permission, type PermissionCheckInput, type PermissionCheckResult, type PermissionKey, type PolicyBindingForEval, RBACPolicyEngine, type RoleWithPermissions, StandardRole, createRBACEngine };
@@ -1,2 +0,0 @@
1
- import "zod";
2
- import "graphql";
@@ -1,49 +0,0 @@
1
- import "zod";
2
- import { GraphQLScalarType } from "graphql";
3
-
4
- //#region ../schema/dist/FieldType.js
5
- /**
6
- * GraphQL scalar wrapper that carries zod and JSON Schema metadata.
7
- *
8
- * TInternal is the runtime representation; TExternal is the GraphQL output.
9
- */
10
- var FieldType = class extends GraphQLScalarType {
11
- zodSchema;
12
- jsonSchemaDef;
13
- constructor(config) {
14
- super(config);
15
- this.zodSchema = config.zod;
16
- this.jsonSchemaDef = config.jsonSchema;
17
- }
18
- /** Return the attached zod schema for validation. */
19
- getZod() {
20
- return this.zodSchema;
21
- }
22
- /** GraphQL scalar instance usable by Pothos or vanilla GraphQL. */
23
- getPothos() {
24
- return this;
25
- }
26
- /** Return the JSON Schema (evaluates factory if provided). */
27
- getJson() {
28
- return typeof this.jsonSchemaDef === "function" ? this.jsonSchemaDef() : this.jsonSchemaDef;
29
- }
30
- getJsonSchemaDef() {
31
- return this.jsonSchemaDef;
32
- }
33
- getJsonSchema() {
34
- const deepResolve = (v) => {
35
- const value = typeof v === "function" ? v() : v;
36
- if (Array.isArray(value)) return value.map((item) => deepResolve(item));
37
- if (value && typeof value === "object") {
38
- const obj = {};
39
- for (const [k, val] of Object.entries(value)) obj[k] = deepResolve(val);
40
- return obj;
41
- }
42
- return value;
43
- };
44
- return deepResolve(this.getJson());
45
- }
46
- };
47
-
48
- //#endregion
49
- export { FieldType };
@@ -1,236 +0,0 @@
1
- import { FieldType } from "./FieldType.js";
2
- import * as z$1 from "zod";
3
- import { Kind } from "graphql";
4
-
5
- //#region ../schema/dist/ScalarTypeEnum.js
6
- const localeRegex = /^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/;
7
- const timezoneRegex = /^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/;
8
- const phoneRegex = /^[+]?\d[\d\s().-]{3,}$/;
9
- const currencyRegex = /^[A-Z]{3}$/;
10
- const countryRegex = /^[A-Z]{2}$/;
11
- const latMin = -90;
12
- const latMax = 90;
13
- const lonMin = -180;
14
- const lonMax = 180;
15
- /**
16
- * Factory functions for common scalar FieldTypes with zod/GraphQL/JSON Schema.
17
- */
18
- const ScalarTypeEnum = {
19
- String_unsecure: () => new FieldType({
20
- name: "String_unsecure",
21
- description: "Unvalidated string scalar",
22
- zod: z$1.string(),
23
- parseValue: (v) => z$1.string().parse(v),
24
- serialize: (v) => String(v),
25
- parseLiteral: (ast) => {
26
- if (ast.kind !== Kind.STRING) throw new TypeError("Invalid literal");
27
- return ast.value;
28
- },
29
- jsonSchema: { type: "string" }
30
- }),
31
- Int_unsecure: () => new FieldType({
32
- name: "Int_unsecure",
33
- description: "Unvalidated integer scalar",
34
- zod: z$1.number().int(),
35
- parseValue: (v) => {
36
- const num = typeof v === "number" ? v : Number(v);
37
- return z$1.number().int().parse(num);
38
- },
39
- serialize: (v) => Math.trunc(typeof v === "number" ? v : Number(v)),
40
- parseLiteral: (ast) => {
41
- if (ast.kind !== Kind.INT) throw new TypeError("Invalid literal");
42
- return Number(ast.value);
43
- },
44
- jsonSchema: { type: "integer" }
45
- }),
46
- Float_unsecure: () => new FieldType({
47
- name: "Float_unsecure",
48
- description: "Unvalidated float scalar",
49
- zod: z$1.number(),
50
- parseValue: (v) => {
51
- const num = typeof v === "number" ? v : Number(v);
52
- return z$1.number().parse(num);
53
- },
54
- serialize: (v) => Number(v),
55
- parseLiteral: (ast) => {
56
- if (ast.kind !== Kind.FLOAT && ast.kind !== Kind.INT) throw new TypeError("Invalid literal");
57
- return Number(ast.value);
58
- },
59
- jsonSchema: { type: "number" }
60
- }),
61
- Boolean: () => new FieldType({
62
- name: "Boolean",
63
- description: "Unvalidated boolean scalar",
64
- zod: z$1.boolean(),
65
- parseValue: (v) => z$1.coerce.boolean().parse(v),
66
- serialize: (v) => Boolean(v),
67
- parseLiteral: (ast) => {
68
- if (ast.kind !== Kind.BOOLEAN) throw new TypeError("Invalid literal");
69
- return ast.value;
70
- },
71
- jsonSchema: { type: "boolean" }
72
- }),
73
- ID: () => new FieldType({
74
- name: "ID",
75
- description: "Unvalidated id scalar",
76
- zod: z$1.string(),
77
- parseValue: (v) => z$1.string().parse(v),
78
- serialize: (v) => String(v),
79
- parseLiteral: (ast) => {
80
- if (ast.kind !== Kind.STRING) throw new TypeError("Invalid literal");
81
- return ast.value;
82
- },
83
- jsonSchema: { type: "string" }
84
- }),
85
- JSON: () => new FieldType({
86
- name: "JSON",
87
- zod: z$1.any(),
88
- parseValue: (v) => v,
89
- serialize: (v) => v,
90
- jsonSchema: {}
91
- }),
92
- JSONObject: () => new FieldType({
93
- name: "JSONObject",
94
- zod: z$1.record(z$1.string(), z$1.any()),
95
- parseValue: (v) => z$1.record(z$1.string(), z$1.any()).parse(v),
96
- serialize: (v) => v ?? {},
97
- jsonSchema: { type: "object" }
98
- }),
99
- Date: () => new FieldType({
100
- name: "Date",
101
- zod: z$1.date(),
102
- parseValue: (v) => v instanceof Date ? v : new Date(String(v)),
103
- serialize: (v) => v instanceof Date ? v.toISOString().split("T")[0] : String(v),
104
- jsonSchema: {
105
- type: "string",
106
- format: "date"
107
- }
108
- }),
109
- DateTime: () => new FieldType({
110
- name: "DateTime",
111
- zod: z$1.date(),
112
- parseValue: (v) => v instanceof Date ? v : new Date(String(v)),
113
- serialize: (v) => {
114
- return v instanceof Date ? v.toISOString() : String(v);
115
- },
116
- jsonSchema: {
117
- type: "string",
118
- format: "date-time"
119
- }
120
- }),
121
- Time: () => new FieldType({
122
- name: "Time",
123
- zod: z$1.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),
124
- parseValue: (v) => z$1.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(v),
125
- serialize: (v) => String(v),
126
- jsonSchema: {
127
- type: "string",
128
- pattern: "^\\d{2}:\\d{2}(:\\d{2})?$"
129
- }
130
- }),
131
- EmailAddress: () => new FieldType({
132
- name: "EmailAddress",
133
- zod: z$1.string().email(),
134
- parseValue: (v) => z$1.string().email().parse(v),
135
- serialize: (v) => String(v),
136
- jsonSchema: {
137
- type: "string",
138
- format: "email"
139
- }
140
- }),
141
- URL: () => new FieldType({
142
- name: "URL",
143
- zod: z$1.string().url(),
144
- parseValue: (v) => z$1.string().url().parse(v),
145
- serialize: (v) => String(v),
146
- jsonSchema: {
147
- type: "string",
148
- format: "uri"
149
- }
150
- }),
151
- PhoneNumber: () => new FieldType({
152
- name: "PhoneNumber",
153
- zod: z$1.string().regex(phoneRegex),
154
- parseValue: (v) => z$1.string().regex(phoneRegex).parse(v),
155
- serialize: (v) => String(v),
156
- jsonSchema: {
157
- type: "string",
158
- pattern: phoneRegex.source
159
- }
160
- }),
161
- NonEmptyString: () => new FieldType({
162
- name: "NonEmptyString",
163
- zod: z$1.string().min(1),
164
- parseValue: (v) => z$1.string().min(1).parse(v),
165
- serialize: (v) => String(v),
166
- jsonSchema: {
167
- type: "string",
168
- minLength: 1
169
- }
170
- }),
171
- Locale: () => new FieldType({
172
- name: "Locale",
173
- zod: z$1.string().regex(localeRegex),
174
- parseValue: (v) => z$1.string().regex(localeRegex).parse(v),
175
- serialize: (v) => String(v),
176
- jsonSchema: {
177
- type: "string",
178
- pattern: localeRegex.source
179
- }
180
- }),
181
- TimeZone: () => new FieldType({
182
- name: "TimeZone",
183
- zod: z$1.string().regex(timezoneRegex),
184
- parseValue: (v) => z$1.string().regex(timezoneRegex).parse(v),
185
- serialize: (v) => String(v),
186
- jsonSchema: {
187
- type: "string",
188
- pattern: timezoneRegex.source
189
- }
190
- }),
191
- Latitude: () => new FieldType({
192
- name: "Latitude",
193
- zod: z$1.number().min(latMin).max(latMax),
194
- parseValue: (v) => z$1.coerce.number().min(latMin).max(latMax).parse(v),
195
- serialize: (v) => Number(v),
196
- jsonSchema: {
197
- type: "number",
198
- minimum: latMin,
199
- maximum: latMax
200
- }
201
- }),
202
- Longitude: () => new FieldType({
203
- name: "Longitude",
204
- zod: z$1.number().min(lonMin).max(lonMax),
205
- parseValue: (v) => z$1.coerce.number().min(lonMin).max(lonMax).parse(v),
206
- serialize: (v) => Number(v),
207
- jsonSchema: {
208
- type: "number",
209
- minimum: lonMin,
210
- maximum: lonMax
211
- }
212
- }),
213
- Currency: () => new FieldType({
214
- name: "Currency",
215
- zod: z$1.string().regex(currencyRegex),
216
- parseValue: (v) => z$1.string().regex(currencyRegex).parse(v),
217
- serialize: (v) => String(v),
218
- jsonSchema: {
219
- type: "string",
220
- pattern: currencyRegex.source
221
- }
222
- }),
223
- CountryCode: () => new FieldType({
224
- name: "CountryCode",
225
- zod: z$1.string().regex(countryRegex),
226
- parseValue: (v) => z$1.string().regex(countryRegex).parse(v),
227
- serialize: (v) => String(v),
228
- jsonSchema: {
229
- type: "string",
230
- pattern: countryRegex.source
231
- }
232
- })
233
- };
234
-
235
- //#endregion
236
- export { ScalarTypeEnum };
@@ -1,34 +0,0 @@
1
- import "./EnumType.js";
2
- import "./FieldType.js";
3
- import * as z$1 from "zod";
4
-
5
- //#region ../schema/dist/SchemaModel.js
6
- /**
7
- * Named object model built from FieldType/EnumType/SchemaModel fields.
8
- * Provides zod and GraphQL input helpers, and supports arrays/optional fields.
9
- */
10
- var SchemaModel = class {
11
- constructor(config) {
12
- this.config = config;
13
- }
14
- /**
15
- * Build a typed ZodObject from the model fields, preserving each field's
16
- * Zod schema and optionality at the type level when possible.
17
- */
18
- getZod() {
19
- const shape = Object.entries(this.config.fields).reduce((acc, [key, def]) => {
20
- const base = def.type.getZod();
21
- const withArray = def.isArray ? z$1.array(base) : base;
22
- acc[key] = def.isOptional ? withArray.optional() : withArray;
23
- return acc;
24
- }, {});
25
- return z$1.object(shape);
26
- }
27
- /** Input object name for GraphQL builder adapters. */
28
- getPothosInput() {
29
- return this.config.name;
30
- }
31
- };
32
-
33
- //#endregion
34
- export { SchemaModel };
@@ -1,236 +0,0 @@
1
- import * as z$1 from "zod";
2
-
3
- //#region ../schema/dist/entity/defineEntity.js
4
- /**
5
- * Helper to define a database entity with full type safety.
6
- *
7
- * @example
8
- * ```typescript
9
- * const UserEntity = defineEntity({
10
- * name: 'User',
11
- * schema: 'lssm_sigil',
12
- * description: 'A user of the platform.',
13
- * fields: {
14
- * id: field.id(),
15
- * email: field.string({ isUnique: true, zod: z.string().email() }),
16
- * name: field.string({ isOptional: true }),
17
- * createdAt: field.createdAt(),
18
- * updatedAt: field.updatedAt(),
19
- * memberships: field.hasMany('Member'),
20
- * },
21
- * indexes: [{ fields: ['email'], unique: true }],
22
- * });
23
- * ```
24
- */
25
- function defineEntity(spec) {
26
- return spec;
27
- }
28
- /**
29
- * Helper to define an enum that can be shared across entities.
30
- */
31
- function defineEntityEnum(def) {
32
- return def;
33
- }
34
- /**
35
- * Field builder helpers for common field patterns.
36
- */
37
- const field = {
38
- string(opts) {
39
- return {
40
- kind: "scalar",
41
- type: "String",
42
- ...opts
43
- };
44
- },
45
- int(opts) {
46
- return {
47
- kind: "scalar",
48
- type: "Int",
49
- ...opts
50
- };
51
- },
52
- float(opts) {
53
- return {
54
- kind: "scalar",
55
- type: "Float",
56
- ...opts
57
- };
58
- },
59
- boolean(opts) {
60
- return {
61
- kind: "scalar",
62
- type: "Boolean",
63
- ...opts
64
- };
65
- },
66
- dateTime(opts) {
67
- return {
68
- kind: "scalar",
69
- type: "DateTime",
70
- ...opts
71
- };
72
- },
73
- json(opts) {
74
- return {
75
- kind: "scalar",
76
- type: "Json",
77
- ...opts
78
- };
79
- },
80
- bigInt(opts) {
81
- return {
82
- kind: "scalar",
83
- type: "BigInt",
84
- ...opts
85
- };
86
- },
87
- decimal(opts) {
88
- return {
89
- kind: "scalar",
90
- type: "Decimal",
91
- ...opts
92
- };
93
- },
94
- bytes(opts) {
95
- return {
96
- kind: "scalar",
97
- type: "Bytes",
98
- ...opts
99
- };
100
- },
101
- id(opts) {
102
- return {
103
- kind: "scalar",
104
- type: "String",
105
- isId: true,
106
- default: "cuid()",
107
- ...opts
108
- };
109
- },
110
- uuid(opts) {
111
- return {
112
- kind: "scalar",
113
- type: "String",
114
- isId: true,
115
- default: "uuid()",
116
- ...opts
117
- };
118
- },
119
- autoIncrement(opts) {
120
- return {
121
- kind: "scalar",
122
- type: "Int",
123
- isId: true,
124
- default: "autoincrement()",
125
- ...opts
126
- };
127
- },
128
- createdAt(opts) {
129
- return {
130
- kind: "scalar",
131
- type: "DateTime",
132
- default: "now()",
133
- ...opts
134
- };
135
- },
136
- updatedAt(opts) {
137
- return {
138
- kind: "scalar",
139
- type: "DateTime",
140
- updatedAt: true,
141
- ...opts
142
- };
143
- },
144
- email(opts) {
145
- return {
146
- kind: "scalar",
147
- type: "String",
148
- zod: z$1.email(),
149
- ...opts
150
- };
151
- },
152
- url(opts) {
153
- return {
154
- kind: "scalar",
155
- type: "String",
156
- zod: z$1.url(),
157
- ...opts
158
- };
159
- },
160
- enum(enumName, opts) {
161
- return {
162
- kind: "enum",
163
- enumName,
164
- ...opts
165
- };
166
- },
167
- inlineEnum(enumName, values, opts) {
168
- return {
169
- kind: "enum",
170
- enumName,
171
- values,
172
- ...opts
173
- };
174
- },
175
- hasOne(target, opts) {
176
- return {
177
- kind: "relation",
178
- type: "hasOne",
179
- target,
180
- ...opts
181
- };
182
- },
183
- hasMany(target, opts) {
184
- return {
185
- kind: "relation",
186
- type: "hasMany",
187
- target,
188
- ...opts
189
- };
190
- },
191
- belongsTo(target, fields, references, opts) {
192
- return {
193
- kind: "relation",
194
- type: "belongsTo",
195
- target,
196
- fields,
197
- references,
198
- ...opts
199
- };
200
- },
201
- foreignKey(opts) {
202
- return {
203
- kind: "scalar",
204
- type: "String",
205
- ...opts
206
- };
207
- }
208
- };
209
- /**
210
- * Index builder helpers.
211
- */
212
- const index = {
213
- on(fields, opts) {
214
- return {
215
- fields,
216
- ...opts
217
- };
218
- },
219
- unique(fields, opts) {
220
- return {
221
- fields,
222
- unique: true,
223
- ...opts
224
- };
225
- },
226
- compound(fields, sort, opts) {
227
- return {
228
- fields,
229
- sort,
230
- ...opts
231
- };
232
- }
233
- };
234
-
235
- //#endregion
236
- export { defineEntity, defineEntityEnum, field, index };
@@ -1,2 +0,0 @@
1
- import { defineEntity, defineEntityEnum, field, index } from "./defineEntity.js";
2
- import "./types.js";
@@ -1 +0,0 @@
1
- import "zod";
@@ -1,6 +0,0 @@
1
- import "./EnumType.js";
2
- import { FieldType } from "./FieldType.js";
3
- import { ScalarTypeEnum } from "./ScalarTypeEnum.js";
4
- import { SchemaModel } from "./SchemaModel.js";
5
- import { defineEntity, defineEntityEnum, field, index } from "./entity/defineEntity.js";
6
- import "./entity/index.js";