@lssm/lib.jobs 0.0.0-canary-20251217080011 → 1.41.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.
Files changed (158) hide show
  1. package/dist/_virtual/rolldown_runtime.js +1 -42
  2. package/dist/contracts/index.js +1 -484
  3. package/dist/entities/index.js +1 -198
  4. package/dist/events.js +1 -303
  5. package/dist/handlers/gmail-sync-handler.js +1 -9
  6. package/dist/handlers/index.js +1 -12
  7. package/dist/handlers/ping-job.js +1 -13
  8. package/dist/handlers/storage-document-handler.js +1 -14
  9. package/dist/index.js +1 -18
  10. package/dist/jobs.feature.js +1 -101
  11. package/dist/queue/gcp-cloud-tasks.js +1 -61
  12. package/dist/queue/gcp-pubsub.js +1 -47
  13. package/dist/queue/index.js +1 -9
  14. package/dist/queue/memory-queue.js +1 -140
  15. package/dist/queue/register-defined-job.js +1 -15
  16. package/dist/queue/scaleway-sqs-queue.js +1 -175
  17. package/dist/queue/types.js +1 -3
  18. package/dist/scheduler/index.js +1 -145
  19. package/package.json +23 -25
  20. package/dist/contracts/dist/capabilities/openbanking.js +0 -88
  21. package/dist/contracts/dist/client/index.js +0 -5
  22. package/dist/contracts/dist/client/react/feature-render.js +0 -2
  23. package/dist/contracts/dist/client/react/form-render.js +0 -4
  24. package/dist/contracts/dist/client/react/index.js +0 -4
  25. package/dist/contracts/dist/contract-registry/index.js +0 -1
  26. package/dist/contracts/dist/contract-registry/schemas.js +0 -60
  27. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +0 -16
  28. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +0 -16
  29. package/dist/contracts/dist/docs/index.js +0 -29
  30. package/dist/contracts/dist/docs/presentations.js +0 -71
  31. package/dist/contracts/dist/docs/registry.js +0 -44
  32. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +0 -16
  33. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +0 -16
  34. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +0 -16
  35. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +0 -16
  36. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +0 -16
  37. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +0 -80
  38. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +0 -57
  39. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +0 -16
  40. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +0 -357
  41. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +0 -37
  42. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +0 -16
  43. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +0 -20
  44. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +0 -48
  45. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +0 -79
  46. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +0 -84
  47. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +0 -45
  48. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +0 -67
  49. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +0 -40
  50. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +0 -69
  51. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +0 -47
  52. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +0 -62
  53. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +0 -155
  54. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +0 -20
  55. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +0 -101
  56. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +0 -20
  57. package/dist/contracts/dist/events.js +0 -10
  58. package/dist/contracts/dist/experiments/evaluator.js +0 -1
  59. package/dist/contracts/dist/index.js +0 -71
  60. package/dist/contracts/dist/install.js +0 -2
  61. package/dist/contracts/dist/integrations/contracts.js +0 -377
  62. package/dist/contracts/dist/integrations/index.js +0 -18
  63. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +0 -228
  64. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +0 -159
  65. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +0 -3
  66. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +0 -210
  67. package/dist/contracts/dist/integrations/openbanking/models.js +0 -242
  68. package/dist/contracts/dist/integrations/openbanking/telemetry.js +0 -13
  69. package/dist/contracts/dist/integrations/providers/elevenlabs.js +0 -52
  70. package/dist/contracts/dist/integrations/providers/gcs-storage.js +0 -75
  71. package/dist/contracts/dist/integrations/providers/gmail.js +0 -87
  72. package/dist/contracts/dist/integrations/providers/google-calendar.js +0 -66
  73. package/dist/contracts/dist/integrations/providers/index.js +0 -11
  74. package/dist/contracts/dist/integrations/providers/mistral.js +0 -68
  75. package/dist/contracts/dist/integrations/providers/postmark.js +0 -68
  76. package/dist/contracts/dist/integrations/providers/powens.js +0 -116
  77. package/dist/contracts/dist/integrations/providers/qdrant.js +0 -73
  78. package/dist/contracts/dist/integrations/providers/registry.js +0 -10
  79. package/dist/contracts/dist/integrations/providers/stripe.js +0 -83
  80. package/dist/contracts/dist/integrations/providers/twilio-sms.js +0 -61
  81. package/dist/contracts/dist/jobs/queue.js +0 -33
  82. package/dist/contracts/dist/jsonschema.js +0 -1
  83. package/dist/contracts/dist/knowledge/contracts.js +0 -306
  84. package/dist/contracts/dist/knowledge/index.js +0 -7
  85. package/dist/contracts/dist/knowledge/spaces/email-threads.js +0 -34
  86. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +0 -34
  87. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +0 -38
  88. package/dist/contracts/dist/knowledge/spaces/index.js +0 -6
  89. package/dist/contracts/dist/knowledge/spaces/product-canon.js +0 -34
  90. package/dist/contracts/dist/knowledge/spaces/support-faq.js +0 -37
  91. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +0 -34
  92. package/dist/contracts/dist/llm/exporters.js +0 -19
  93. package/dist/contracts/dist/llm/index.js +0 -2
  94. package/dist/contracts/dist/llm/prompts.js +0 -1
  95. package/dist/contracts/dist/onboarding-base.js +0 -196
  96. package/dist/contracts/dist/openapi.js +0 -1
  97. package/dist/contracts/dist/ownership.js +0 -21
  98. package/dist/contracts/dist/presentations.js +0 -1
  99. package/dist/contracts/dist/presentations.v2.js +0 -11
  100. package/dist/contracts/dist/prompt.js +0 -1
  101. package/dist/contracts/dist/promptRegistry.js +0 -1
  102. package/dist/contracts/dist/regenerator/index.js +0 -1
  103. package/dist/contracts/dist/regenerator/service.js +0 -6
  104. package/dist/contracts/dist/registry.js +0 -2
  105. package/dist/contracts/dist/resources.js +0 -1
  106. package/dist/contracts/dist/schema/dist/EnumType.js +0 -2
  107. package/dist/contracts/dist/schema/dist/FieldType.js +0 -49
  108. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +0 -236
  109. package/dist/contracts/dist/schema/dist/SchemaModel.js +0 -34
  110. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +0 -1
  111. package/dist/contracts/dist/schema/dist/entity/index.js +0 -2
  112. package/dist/contracts/dist/schema/dist/entity/types.js +0 -1
  113. package/dist/contracts/dist/schema/dist/index.js +0 -6
  114. package/dist/contracts/dist/server/graphql-pothos.js +0 -6
  115. package/dist/contracts/dist/server/index.js +0 -8
  116. package/dist/contracts/dist/server/mcp/createMcpServer.js +0 -4
  117. package/dist/contracts/dist/server/mcp/registerPresentations.js +0 -2
  118. package/dist/contracts/dist/server/mcp/registerPrompts.js +0 -1
  119. package/dist/contracts/dist/server/mcp/registerResources.js +0 -2
  120. package/dist/contracts/dist/server/mcp/registerTools.js +0 -1
  121. package/dist/contracts/dist/server/provider-mcp.js +0 -1
  122. package/dist/contracts/dist/server/rest-elysia.js +0 -1
  123. package/dist/contracts/dist/server/rest-express.js +0 -1
  124. package/dist/contracts/dist/server/rest-generic.js +0 -1
  125. package/dist/contracts/dist/server/rest-next-app.js +0 -1
  126. package/dist/contracts/dist/server/rest-next-pages.js +0 -1
  127. package/dist/contracts/dist/spec.js +0 -34
  128. package/dist/contracts/dist/telemetry/index.js +0 -1
  129. package/dist/contracts/dist/telemetry/tracker.js +0 -1
  130. package/dist/contracts/dist/tests/index.js +0 -1
  131. package/dist/contracts/dist/tests/runner.js +0 -2
  132. package/dist/contracts/dist/workflow/index.js +0 -1
  133. package/dist/contracts/dist/workflow/runner.js +0 -1
  134. package/dist/contracts/index.d.ts +0 -546
  135. package/dist/entities/index.d.ts +0 -144
  136. package/dist/events.d.ts +0 -387
  137. package/dist/handlers/gmail-sync-handler.d.ts +0 -9
  138. package/dist/handlers/index.d.ts +0 -9
  139. package/dist/handlers/ping-job.d.ts +0 -10
  140. package/dist/handlers/storage-document-handler.d.ts +0 -12
  141. package/dist/index.d.ts +0 -24
  142. package/dist/jobs.feature.d.ts +0 -11
  143. package/dist/queue/gcp-cloud-tasks.d.ts +0 -41
  144. package/dist/queue/gcp-pubsub.d.ts +0 -25
  145. package/dist/queue/index.d.ts +0 -15
  146. package/dist/queue/memory-queue.d.ts +0 -34
  147. package/dist/queue/register-defined-job.d.ts +0 -7
  148. package/dist/queue/scaleway-sqs-queue.d.ts +0 -38
  149. package/dist/queue/types.d.ts +0 -7
  150. package/dist/scheduler/index.d.ts +0 -92
  151. package/dist/schema/dist/EnumType.js +0 -2
  152. package/dist/schema/dist/FieldType.js +0 -49
  153. package/dist/schema/dist/ScalarTypeEnum.js +0 -236
  154. package/dist/schema/dist/SchemaModel.js +0 -39
  155. package/dist/schema/dist/entity/defineEntity.js +0 -236
  156. package/dist/schema/dist/entity/index.js +0 -2
  157. package/dist/schema/dist/entity/types.js +0 -1
  158. package/dist/schema/dist/index.js +0 -6
@@ -1,15 +0,0 @@
1
- import { __export, __reExport } from "../_virtual/rolldown_runtime.js";
2
- import { types_d_exports } from "./types.js";
3
- import { MemoryJobQueue, MemoryQueueOptions } from "./memory-queue.js";
4
- import { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials } from "./scaleway-sqs-queue.js";
5
- import { GcpCloudTasksQueue, GcpCloudTasksQueueOptions } from "./gcp-cloud-tasks.js";
6
- import { GcpPubSubQueue, GcpPubSubQueueOptions } from "./gcp-pubsub.js";
7
- import { registerDefinedJob } from "./register-defined-job.js";
8
- export * from "@lssm/lib.contracts/jobs/queue";
9
-
10
- //#region src/queue/index.d.ts
11
- declare namespace index_d_exports {
12
- export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, registerDefinedJob };
13
- }
14
- //#endregion
15
- export { GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, MemoryJobQueue, MemoryQueueOptions, ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials, index_d_exports, registerDefinedJob };
@@ -1,34 +0,0 @@
1
- import { types_d_exports } from "./types.js";
2
-
3
- //#region src/queue/memory-queue.d.ts
4
- interface MemoryQueueOptions {
5
- /** Poll interval in milliseconds */
6
- pollIntervalMs?: number;
7
- /** Maximum concurrent jobs */
8
- concurrency?: number;
9
- /** Default retry policy */
10
- retryPolicy?: types_d_exports.RetryPolicy;
11
- }
12
- /**
13
- * In-memory job queue for development and testing.
14
- */
15
- declare class MemoryJobQueue implements types_d_exports.JobQueue {
16
- private readonly jobs;
17
- private readonly handlers;
18
- private timer?;
19
- private activeCount;
20
- private readonly pollIntervalMs;
21
- private readonly concurrency;
22
- private readonly retryPolicy;
23
- constructor(options?: MemoryQueueOptions);
24
- enqueue<TPayload>(jobType: string, payload: TPayload, options?: types_d_exports.EnqueueOptions): Promise<types_d_exports.Job<TPayload>>;
25
- register<TPayload, TResult = void>(jobType: string, handler: types_d_exports.JobHandler<TPayload, TResult>): void;
26
- start(): void;
27
- stop(): Promise<void>;
28
- getJob(jobId: string): Promise<types_d_exports.Job | null>;
29
- cancelJob(jobId: string): Promise<boolean>;
30
- getStats(): Promise<types_d_exports.QueueStats>;
31
- private processNext;
32
- }
33
- //#endregion
34
- export { MemoryJobQueue, MemoryQueueOptions };
@@ -1,7 +0,0 @@
1
- import { JobQueue } from "@lssm/lib.contracts/jobs/queue";
2
- import { DefinedJob } from "@lssm/lib.contracts/jobs/define-job";
3
-
4
- //#region src/queue/register-defined-job.d.ts
5
- declare function registerDefinedJob<TPayload>(queue: JobQueue, def: DefinedJob<TPayload>): void;
6
- //#endregion
7
- export { registerDefinedJob };
@@ -1,38 +0,0 @@
1
- import { types_d_exports } from "./types.js";
2
- import { Logger } from "@lssm/lib.logger";
3
-
4
- //#region src/queue/scaleway-sqs-queue.d.ts
5
- interface ScalewaySqsQueueCredentials {
6
- accessKeyId: string;
7
- secretAccessKey: string;
8
- }
9
- interface ScalewaySqsQueueConfig {
10
- queueUrl: string;
11
- region?: string;
12
- endpoint?: string;
13
- waitTimeSeconds?: number;
14
- maxNumberOfMessages?: number;
15
- visibilityTimeoutSeconds?: number;
16
- credentials?: ScalewaySqsQueueCredentials;
17
- logger?: Logger;
18
- }
19
- declare class ScalewaySqsJobQueue implements types_d_exports.JobQueue {
20
- private readonly sqs;
21
- private readonly queueUrl;
22
- private readonly waitTimeSeconds;
23
- private readonly maxNumberOfMessages;
24
- private readonly visibilityTimeoutSeconds;
25
- private readonly handlers;
26
- private readonly logger?;
27
- private running;
28
- constructor(config: ScalewaySqsQueueConfig);
29
- enqueue<TPayload>(jobType: string, payload: TPayload, options?: types_d_exports.EnqueueOptions): Promise<types_d_exports.Job<TPayload>>;
30
- register<TPayload, TResult = void>(jobType: string, handler: types_d_exports.JobHandler<TPayload, TResult>): void;
31
- start(): void;
32
- stop(): Promise<void>;
33
- private pollLoop;
34
- private deleteMessage;
35
- private sleep;
36
- }
37
- //#endregion
38
- export { ScalewaySqsJobQueue, ScalewaySqsQueueConfig, ScalewaySqsQueueCredentials };
@@ -1,7 +0,0 @@
1
- export * from "@lssm/lib.contracts/jobs/queue";
2
-
3
- //#region src/queue/types.d.ts
4
-
5
- import * as import___lssm_lib_contracts_jobs_queue from "@lssm/lib.contracts/jobs/queue";
6
- //#endregion
7
- export { import___lssm_lib_contracts_jobs_queue as types_d_exports };
@@ -1,92 +0,0 @@
1
- import { types_d_exports } from "../queue/types.js";
2
-
3
- //#region src/scheduler/index.d.ts
4
-
5
- /**
6
- * Scheduled job configuration.
7
- */
8
- interface ScheduledJobConfig {
9
- /** Unique name for the schedule */
10
- name: string;
11
- /** Cron expression (e.g., '0 0 * * *' for daily at midnight) */
12
- cronExpression: string;
13
- /** Job type to enqueue */
14
- jobType: string;
15
- /** Job payload (can be a function for dynamic payloads) */
16
- payload?: unknown | (() => unknown | Promise<unknown>);
17
- /** Enqueue options */
18
- options?: types_d_exports.EnqueueOptions;
19
- /** Timezone for cron evaluation (default: UTC) */
20
- timezone?: string;
21
- /** Whether the schedule is enabled */
22
- enabled?: boolean;
23
- /** Description */
24
- description?: string;
25
- }
26
- /**
27
- * Active scheduled job with next run time.
28
- */
29
- interface ActiveSchedule extends ScheduledJobConfig {
30
- nextRun: Date | null;
31
- lastRun: Date | null;
32
- }
33
- /**
34
- * Job scheduler for recurring jobs.
35
- */
36
- declare class JobScheduler {
37
- private readonly queue;
38
- private readonly schedules;
39
- private timer?;
40
- private readonly checkIntervalMs;
41
- constructor(queue: types_d_exports.JobQueue, options?: {
42
- checkIntervalMs?: number;
43
- });
44
- /**
45
- * Add a scheduled job.
46
- */
47
- schedule(config: ScheduledJobConfig): void;
48
- /**
49
- * Remove a scheduled job.
50
- */
51
- unschedule(name: string): boolean;
52
- /**
53
- * Enable a scheduled job.
54
- */
55
- enable(name: string): boolean;
56
- /**
57
- * Disable a scheduled job.
58
- */
59
- disable(name: string): boolean;
60
- /**
61
- * Get all schedules.
62
- */
63
- getSchedules(): ActiveSchedule[];
64
- /**
65
- * Get a specific schedule.
66
- */
67
- getSchedule(name: string): ActiveSchedule | undefined;
68
- /**
69
- * Start the scheduler.
70
- */
71
- start(): void;
72
- /**
73
- * Stop the scheduler.
74
- */
75
- stop(): void;
76
- /**
77
- * Check and enqueue due schedules.
78
- */
79
- private checkSchedules;
80
- }
81
- /**
82
- * Create a job scheduler instance.
83
- */
84
- declare function createScheduler(queue: types_d_exports.JobQueue, options?: {
85
- checkIntervalMs?: number;
86
- }): JobScheduler;
87
- /**
88
- * Helper to define a scheduled job configuration.
89
- */
90
- declare function defineSchedule(config: ScheduledJobConfig): ScheduledJobConfig;
91
- //#endregion
92
- export { ActiveSchedule, JobScheduler, ScheduledJobConfig, createScheduler, defineSchedule };
@@ -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,39 +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
- * Helper to define a SchemaModel with type inference.
34
- * Equivalent to `new SchemaModel(config)` but with better ergonomics.
35
- */
36
- const defineSchemaModel = (config) => new SchemaModel(config);
37
-
38
- //#endregion
39
- export { SchemaModel, defineSchemaModel };