@lssm/lib.jobs 0.0.0-canary-20251217073102 → 0.0.0-canary-20251217083314

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 (142) hide show
  1. package/dist/_virtual/rolldown_runtime.js +42 -1
  2. package/dist/contracts/dist/capabilities/openbanking.js +88 -1
  3. package/dist/contracts/dist/client/index.js +5 -1
  4. package/dist/contracts/dist/client/react/feature-render.js +2 -1
  5. package/dist/contracts/dist/client/react/form-render.js +4 -1
  6. package/dist/contracts/dist/client/react/index.js +4 -1
  7. package/dist/contracts/dist/contract-registry/index.js +1 -1
  8. package/dist/contracts/dist/contract-registry/schemas.js +60 -1
  9. package/dist/contracts/dist/docs/PUBLISHING.docblock.js +16 -76
  10. package/dist/contracts/dist/docs/accessibility_wcag_compliance_specs.docblock.js +16 -350
  11. package/dist/contracts/dist/docs/index.js +29 -1
  12. package/dist/contracts/dist/docs/presentations.js +71 -1
  13. package/dist/contracts/dist/docs/registry.js +44 -1
  14. package/dist/contracts/dist/docs/tech/PHASE_1_QUICKSTART.docblock.js +16 -383
  15. package/dist/contracts/dist/docs/tech/PHASE_2_AI_NATIVE_OPERATIONS.docblock.js +16 -68
  16. package/dist/contracts/dist/docs/tech/PHASE_3_AUTO_EVOLUTION.docblock.js +16 -140
  17. package/dist/contracts/dist/docs/tech/PHASE_4_PERSONALIZATION_ENGINE.docblock.js +16 -86
  18. package/dist/contracts/dist/docs/tech/PHASE_5_ZERO_TOUCH_OPERATIONS.docblock.js +16 -1
  19. package/dist/contracts/dist/docs/tech/auth/better-auth-nextjs.docblock.js +24 -2
  20. package/dist/contracts/dist/docs/tech/contracts/openapi-export.docblock.js +21 -2
  21. package/dist/contracts/dist/docs/tech/lifecycle-stage-system.docblock.js +16 -213
  22. package/dist/contracts/dist/docs/tech/llm/llm-integration.docblock.js +73 -5
  23. package/dist/contracts/dist/docs/tech/mcp-endpoints.docblock.js +37 -1
  24. package/dist/contracts/dist/docs/tech/presentation-runtime.docblock.js +16 -1
  25. package/dist/contracts/dist/docs/tech/schema/README.docblock.js +20 -262
  26. package/dist/contracts/dist/docs/tech/studio/learning-events.docblock.js +48 -1
  27. package/dist/contracts/dist/docs/tech/studio/learning-journeys.docblock.js +24 -2
  28. package/dist/contracts/dist/docs/tech/studio/platform-admin-panel.docblock.js +23 -2
  29. package/dist/contracts/dist/docs/tech/studio/project-access-teams.docblock.js +25 -16
  30. package/dist/contracts/dist/docs/tech/studio/project-routing.docblock.js +67 -1
  31. package/dist/contracts/dist/docs/tech/studio/sandbox-unlogged.docblock.js +22 -2
  32. package/dist/contracts/dist/docs/tech/studio/team-invitations.docblock.js +40 -36
  33. package/dist/contracts/dist/docs/tech/studio/workspace-ops.docblock.js +47 -1
  34. package/dist/contracts/dist/docs/tech/studio/workspaces.docblock.js +23 -2
  35. package/dist/contracts/dist/docs/tech/telemetry-ingest.docblock.js +36 -3
  36. package/dist/contracts/dist/docs/tech/templates/runtime.docblock.js +20 -1
  37. package/dist/contracts/dist/docs/tech/vscode-extension.docblock.js +36 -3
  38. package/dist/contracts/dist/docs/tech/workflows/overview.docblock.js +20 -1
  39. package/dist/contracts/dist/events.js +10 -1
  40. package/dist/contracts/dist/experiments/evaluator.js +1 -1
  41. package/dist/contracts/dist/index.js +71 -1
  42. package/dist/contracts/dist/install.js +2 -1
  43. package/dist/contracts/dist/integrations/contracts.js +377 -1
  44. package/dist/contracts/dist/integrations/index.js +18 -1
  45. package/dist/contracts/dist/integrations/openbanking/contracts/accounts.js +228 -1
  46. package/dist/contracts/dist/integrations/openbanking/contracts/balances.js +159 -1
  47. package/dist/contracts/dist/integrations/openbanking/contracts/index.js +3 -1
  48. package/dist/contracts/dist/integrations/openbanking/contracts/transactions.js +210 -1
  49. package/dist/contracts/dist/integrations/openbanking/models.js +242 -1
  50. package/dist/contracts/dist/integrations/openbanking/telemetry.js +13 -1
  51. package/dist/contracts/dist/integrations/providers/elevenlabs.js +52 -1
  52. package/dist/contracts/dist/integrations/providers/gcs-storage.js +75 -1
  53. package/dist/contracts/dist/integrations/providers/gmail.js +87 -1
  54. package/dist/contracts/dist/integrations/providers/google-calendar.js +66 -1
  55. package/dist/contracts/dist/integrations/providers/index.js +11 -1
  56. package/dist/contracts/dist/integrations/providers/mistral.js +68 -1
  57. package/dist/contracts/dist/integrations/providers/postmark.js +68 -1
  58. package/dist/contracts/dist/integrations/providers/powens.js +116 -1
  59. package/dist/contracts/dist/integrations/providers/qdrant.js +73 -1
  60. package/dist/contracts/dist/integrations/providers/registry.js +10 -1
  61. package/dist/contracts/dist/integrations/providers/stripe.js +83 -1
  62. package/dist/contracts/dist/integrations/providers/twilio-sms.js +61 -1
  63. package/dist/contracts/dist/jobs/queue.js +33 -1
  64. package/dist/contracts/dist/jsonschema.js +1 -1
  65. package/dist/contracts/dist/knowledge/contracts.js +306 -1
  66. package/dist/contracts/dist/knowledge/index.js +7 -1
  67. package/dist/contracts/dist/knowledge/spaces/email-threads.js +34 -1
  68. package/dist/contracts/dist/knowledge/spaces/financial-docs.js +34 -1
  69. package/dist/contracts/dist/knowledge/spaces/financial-overview.js +38 -1
  70. package/dist/contracts/dist/knowledge/spaces/index.js +6 -1
  71. package/dist/contracts/dist/knowledge/spaces/product-canon.js +34 -1
  72. package/dist/contracts/dist/knowledge/spaces/support-faq.js +37 -1
  73. package/dist/contracts/dist/knowledge/spaces/uploaded-docs.js +34 -1
  74. package/dist/contracts/dist/llm/exporters.js +19 -1
  75. package/dist/contracts/dist/llm/index.js +2 -1
  76. package/dist/contracts/dist/llm/prompts.js +1 -1
  77. package/dist/contracts/dist/onboarding-base.js +196 -1
  78. package/dist/contracts/dist/openapi.js +1 -1
  79. package/dist/contracts/dist/ownership.js +21 -1
  80. package/dist/contracts/dist/presentations.js +1 -1
  81. package/dist/contracts/dist/presentations.v2.js +11 -1
  82. package/dist/contracts/dist/prompt.js +1 -1
  83. package/dist/contracts/dist/promptRegistry.js +1 -1
  84. package/dist/contracts/dist/regenerator/index.js +1 -1
  85. package/dist/contracts/dist/regenerator/service.js +6 -1
  86. package/dist/contracts/dist/registry.js +2 -1
  87. package/dist/contracts/dist/resources.js +1 -1
  88. package/dist/contracts/dist/schema/dist/EnumType.js +2 -1
  89. package/dist/contracts/dist/schema/dist/FieldType.js +49 -1
  90. package/dist/contracts/dist/schema/dist/ScalarTypeEnum.js +236 -1
  91. package/dist/contracts/dist/schema/dist/SchemaModel.js +34 -1
  92. package/dist/contracts/dist/schema/dist/entity/defineEntity.js +1 -1
  93. package/dist/contracts/dist/schema/dist/entity/index.js +2 -1
  94. package/dist/contracts/dist/schema/dist/entity/types.js +1 -1
  95. package/dist/contracts/dist/schema/dist/index.js +6 -1
  96. package/dist/contracts/dist/server/graphql-pothos.js +6 -1
  97. package/dist/contracts/dist/server/index.js +8 -1
  98. package/dist/contracts/dist/server/mcp/createMcpServer.js +4 -1
  99. package/dist/contracts/dist/server/mcp/registerPresentations.js +2 -1
  100. package/dist/contracts/dist/server/mcp/registerPrompts.js +1 -1
  101. package/dist/contracts/dist/server/mcp/registerResources.js +2 -1
  102. package/dist/contracts/dist/server/mcp/registerTools.js +1 -1
  103. package/dist/contracts/dist/server/provider-mcp.js +1 -1
  104. package/dist/contracts/dist/server/rest-elysia.js +1 -1
  105. package/dist/contracts/dist/server/rest-express.js +1 -1
  106. package/dist/contracts/dist/server/rest-generic.js +1 -1
  107. package/dist/contracts/dist/server/rest-next-app.js +1 -1
  108. package/dist/contracts/dist/server/rest-next-pages.js +1 -1
  109. package/dist/contracts/dist/spec.js +34 -1
  110. package/dist/contracts/dist/telemetry/index.js +1 -1
  111. package/dist/contracts/dist/telemetry/tracker.js +1 -1
  112. package/dist/contracts/dist/tests/index.js +1 -1
  113. package/dist/contracts/dist/tests/runner.js +2 -1
  114. package/dist/contracts/dist/workflow/index.js +1 -1
  115. package/dist/contracts/dist/workflow/runner.js +1 -1
  116. package/dist/contracts/index.js +484 -1
  117. package/dist/entities/index.js +198 -1
  118. package/dist/events.js +303 -1
  119. package/dist/handlers/gmail-sync-handler.js +9 -1
  120. package/dist/handlers/index.js +12 -1
  121. package/dist/handlers/ping-job.d.ts +3 -3
  122. package/dist/handlers/ping-job.js +13 -1
  123. package/dist/handlers/storage-document-handler.js +14 -1
  124. package/dist/index.js +18 -1
  125. package/dist/jobs.feature.js +101 -1
  126. package/dist/queue/gcp-cloud-tasks.js +61 -1
  127. package/dist/queue/gcp-pubsub.js +47 -1
  128. package/dist/queue/index.js +9 -1
  129. package/dist/queue/memory-queue.js +140 -1
  130. package/dist/queue/register-defined-job.js +15 -1
  131. package/dist/queue/scaleway-sqs-queue.js +175 -1
  132. package/dist/queue/types.js +3 -1
  133. package/dist/scheduler/index.js +145 -1
  134. package/dist/schema/dist/EnumType.js +2 -1
  135. package/dist/schema/dist/FieldType.js +49 -1
  136. package/dist/schema/dist/ScalarTypeEnum.js +236 -1
  137. package/dist/schema/dist/SchemaModel.js +39 -1
  138. package/dist/schema/dist/entity/defineEntity.js +236 -1
  139. package/dist/schema/dist/entity/index.js +2 -1
  140. package/dist/schema/dist/entity/types.js +1 -1
  141. package/dist/schema/dist/index.js +6 -1
  142. package/package.json +7 -7
@@ -1 +1,145 @@
1
- function e(e,t=new Date){try{let n=e.trim().split(/\s+/);if(n.length!==5)return console.warn(`Invalid cron expression: ${e}`),null;let r=n[0],i=n[1],a=n[2],o=n[3],s=new Date(t);if(s.setSeconds(0),s.setMilliseconds(0),r&&i&&r!==`*`&&i!==`*`&&a===`*`&&o===`*`){let e=Number.parseInt(r,10),n=Number.parseInt(i,10);return s.setHours(n,e,0,0),s<=t&&s.setDate(s.getDate()+1),s}return s.setMinutes(s.getMinutes()+1),s}catch{return null}}var t=class{schedules=new Map;timer;checkIntervalMs;constructor(e,t={}){this.queue=e,this.checkIntervalMs=t.checkIntervalMs??6e4}schedule(t){let n=t.enabled===!1?null:e(t.cronExpression);this.schedules.set(t.name,{...t,enabled:t.enabled??!0,nextRun:n,lastRun:null})}unschedule(e){return this.schedules.delete(e)}enable(t){let n=this.schedules.get(t);return n?(n.enabled=!0,n.nextRun=e(n.cronExpression),!0):!1}disable(e){let t=this.schedules.get(e);return t?(t.enabled=!1,t.nextRun=null,!0):!1}getSchedules(){return Array.from(this.schedules.values())}getSchedule(e){return this.schedules.get(e)}start(){this.timer||=(this.checkSchedules(),setInterval(()=>{this.checkSchedules()},this.checkIntervalMs))}stop(){this.timer&&=(clearInterval(this.timer),void 0)}async checkSchedules(){let t=new Date;for(let n of this.schedules.values())if(!(!n.enabled||!n.nextRun)&&n.nextRun<=t)try{let r=typeof n.payload==`function`?await n.payload():n.payload;await this.queue.enqueue(n.jobType,r,n.options),n.lastRun=t,n.nextRun=e(n.cronExpression,t)}catch(e){console.error(`Failed to enqueue scheduled job ${n.name}:`,e)}}};function n(e,n){return new t(e,n)}function r(e){return e}export{t as JobScheduler,n as createScheduler,r as defineSchedule};
1
+ //#region src/scheduler/index.ts
2
+ /**
3
+ * Parse a cron expression to get the next run time.
4
+ * Simple implementation supporting: minute hour day month weekday
5
+ */
6
+ function getNextCronRun(cronExpression, after = /* @__PURE__ */ new Date()) {
7
+ try {
8
+ const parts = cronExpression.trim().split(/\s+/);
9
+ if (parts.length !== 5) {
10
+ console.warn(`Invalid cron expression: ${cronExpression}`);
11
+ return null;
12
+ }
13
+ const minute = parts[0];
14
+ const hour = parts[1];
15
+ const dayOfMonth = parts[2];
16
+ const month = parts[3];
17
+ const next = new Date(after);
18
+ next.setSeconds(0);
19
+ next.setMilliseconds(0);
20
+ if (minute && hour && minute !== "*" && hour !== "*" && dayOfMonth === "*" && month === "*") {
21
+ const targetMinute = Number.parseInt(minute, 10);
22
+ const targetHour = Number.parseInt(hour, 10);
23
+ next.setHours(targetHour, targetMinute, 0, 0);
24
+ if (next <= after) next.setDate(next.getDate() + 1);
25
+ return next;
26
+ }
27
+ next.setMinutes(next.getMinutes() + 1);
28
+ return next;
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+ /**
34
+ * Job scheduler for recurring jobs.
35
+ */
36
+ var JobScheduler = class {
37
+ schedules = /* @__PURE__ */ new Map();
38
+ timer;
39
+ checkIntervalMs;
40
+ constructor(queue, options = {}) {
41
+ this.queue = queue;
42
+ this.checkIntervalMs = options.checkIntervalMs ?? 6e4;
43
+ }
44
+ /**
45
+ * Add a scheduled job.
46
+ */
47
+ schedule(config) {
48
+ const nextRun = config.enabled !== false ? getNextCronRun(config.cronExpression) : null;
49
+ this.schedules.set(config.name, {
50
+ ...config,
51
+ enabled: config.enabled ?? true,
52
+ nextRun,
53
+ lastRun: null
54
+ });
55
+ }
56
+ /**
57
+ * Remove a scheduled job.
58
+ */
59
+ unschedule(name) {
60
+ return this.schedules.delete(name);
61
+ }
62
+ /**
63
+ * Enable a scheduled job.
64
+ */
65
+ enable(name) {
66
+ const schedule = this.schedules.get(name);
67
+ if (!schedule) return false;
68
+ schedule.enabled = true;
69
+ schedule.nextRun = getNextCronRun(schedule.cronExpression);
70
+ return true;
71
+ }
72
+ /**
73
+ * Disable a scheduled job.
74
+ */
75
+ disable(name) {
76
+ const schedule = this.schedules.get(name);
77
+ if (!schedule) return false;
78
+ schedule.enabled = false;
79
+ schedule.nextRun = null;
80
+ return true;
81
+ }
82
+ /**
83
+ * Get all schedules.
84
+ */
85
+ getSchedules() {
86
+ return Array.from(this.schedules.values());
87
+ }
88
+ /**
89
+ * Get a specific schedule.
90
+ */
91
+ getSchedule(name) {
92
+ return this.schedules.get(name);
93
+ }
94
+ /**
95
+ * Start the scheduler.
96
+ */
97
+ start() {
98
+ if (this.timer) return;
99
+ this.checkSchedules();
100
+ this.timer = setInterval(() => {
101
+ this.checkSchedules();
102
+ }, this.checkIntervalMs);
103
+ }
104
+ /**
105
+ * Stop the scheduler.
106
+ */
107
+ stop() {
108
+ if (this.timer) {
109
+ clearInterval(this.timer);
110
+ this.timer = void 0;
111
+ }
112
+ }
113
+ /**
114
+ * Check and enqueue due schedules.
115
+ */
116
+ async checkSchedules() {
117
+ const now = /* @__PURE__ */ new Date();
118
+ for (const schedule of this.schedules.values()) {
119
+ if (!schedule.enabled || !schedule.nextRun) continue;
120
+ if (schedule.nextRun <= now) try {
121
+ const payload = typeof schedule.payload === "function" ? await schedule.payload() : schedule.payload;
122
+ await this.queue.enqueue(schedule.jobType, payload, schedule.options);
123
+ schedule.lastRun = now;
124
+ schedule.nextRun = getNextCronRun(schedule.cronExpression, now);
125
+ } catch (error) {
126
+ console.error(`Failed to enqueue scheduled job ${schedule.name}:`, error);
127
+ }
128
+ }
129
+ }
130
+ };
131
+ /**
132
+ * Create a job scheduler instance.
133
+ */
134
+ function createScheduler(queue, options) {
135
+ return new JobScheduler(queue, options);
136
+ }
137
+ /**
138
+ * Helper to define a scheduled job configuration.
139
+ */
140
+ function defineSchedule(config) {
141
+ return config;
142
+ }
143
+
144
+ //#endregion
145
+ export { JobScheduler, createScheduler, defineSchedule };
@@ -1 +1,2 @@
1
- import"zod";import"graphql";
1
+ import "zod";
2
+ import "graphql";
@@ -1 +1,49 @@
1
- import"zod";import{GraphQLScalarType as e}from"graphql";var t=class extends e{zodSchema;jsonSchemaDef;constructor(e){super(e),this.zodSchema=e.zod,this.jsonSchemaDef=e.jsonSchema}getZod(){return this.zodSchema}getPothos(){return this}getJson(){return typeof this.jsonSchemaDef==`function`?this.jsonSchemaDef():this.jsonSchemaDef}getJsonSchemaDef(){return this.jsonSchemaDef}getJsonSchema(){let e=t=>{let n=typeof t==`function`?t():t;if(Array.isArray(n))return n.map(t=>e(t));if(n&&typeof n==`object`){let t={};for(let[r,i]of Object.entries(n))t[r]=e(i);return t}return n};return e(this.getJson())}};export{t};
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 +1,236 @@
1
- import{t as e}from"./FieldType.js";import*as t from"zod";import{Kind as n}from"graphql";const r=/^[A-Za-z]{2}(?:-[A-Za-z0-9]{2,8})*$/,i=/^(?:UTC|[A-Za-z_]+\/[A-Za-z_]+)$/,a=/^[+]?\d[\d\s().-]{3,}$/,o=/^[A-Z]{3}$/,s=/^[A-Z]{2}$/,c=-180,l={String_unsecure:()=>new e({name:`String_unsecure`,description:`Unvalidated string scalar`,zod:t.string(),parseValue:e=>t.string().parse(e),serialize:e=>String(e),parseLiteral:e=>{if(e.kind!==n.STRING)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`string`}}),Int_unsecure:()=>new e({name:`Int_unsecure`,description:`Unvalidated integer scalar`,zod:t.number().int(),parseValue:e=>{let n=typeof e==`number`?e:Number(e);return t.number().int().parse(n)},serialize:e=>Math.trunc(typeof e==`number`?e:Number(e)),parseLiteral:e=>{if(e.kind!==n.INT)throw TypeError(`Invalid literal`);return Number(e.value)},jsonSchema:{type:`integer`}}),Float_unsecure:()=>new e({name:`Float_unsecure`,description:`Unvalidated float scalar`,zod:t.number(),parseValue:e=>{let n=typeof e==`number`?e:Number(e);return t.number().parse(n)},serialize:e=>Number(e),parseLiteral:e=>{if(e.kind!==n.FLOAT&&e.kind!==n.INT)throw TypeError(`Invalid literal`);return Number(e.value)},jsonSchema:{type:`number`}}),Boolean:()=>new e({name:`Boolean`,description:`Unvalidated boolean scalar`,zod:t.boolean(),parseValue:e=>t.coerce.boolean().parse(e),serialize:e=>!!e,parseLiteral:e=>{if(e.kind!==n.BOOLEAN)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`boolean`}}),ID:()=>new e({name:`ID`,description:`Unvalidated id scalar`,zod:t.string(),parseValue:e=>t.string().parse(e),serialize:e=>String(e),parseLiteral:e=>{if(e.kind!==n.STRING)throw TypeError(`Invalid literal`);return e.value},jsonSchema:{type:`string`}}),JSON:()=>new e({name:`JSON`,zod:t.any(),parseValue:e=>e,serialize:e=>e,jsonSchema:{}}),JSONObject:()=>new e({name:`JSONObject`,zod:t.record(t.string(),t.any()),parseValue:e=>t.record(t.string(),t.any()).parse(e),serialize:e=>e??{},jsonSchema:{type:`object`}}),Date:()=>new e({name:`Date`,zod:t.date(),parseValue:e=>e instanceof Date?e:new Date(String(e)),serialize:e=>e instanceof Date?e.toISOString().split(`T`)[0]:String(e),jsonSchema:{type:`string`,format:`date`}}),DateTime:()=>new e({name:`DateTime`,zod:t.date(),parseValue:e=>e instanceof Date?e:new Date(String(e)),serialize:e=>e instanceof Date?e.toISOString():String(e),jsonSchema:{type:`string`,format:`date-time`}}),Time:()=>new e({name:`Time`,zod:t.string().regex(/^\d{2}:\d{2}(:\d{2})?$/),parseValue:e=>t.string().regex(/^\d{2}:\d{2}(:\d{2})?$/).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:`^\\d{2}:\\d{2}(:\\d{2})?$`}}),EmailAddress:()=>new e({name:`EmailAddress`,zod:t.string().email(),parseValue:e=>t.string().email().parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,format:`email`}}),URL:()=>new e({name:`URL`,zod:t.string().url(),parseValue:e=>t.string().url().parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,format:`uri`}}),PhoneNumber:()=>new e({name:`PhoneNumber`,zod:t.string().regex(a),parseValue:e=>t.string().regex(a).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:a.source}}),NonEmptyString:()=>new e({name:`NonEmptyString`,zod:t.string().min(1),parseValue:e=>t.string().min(1).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,minLength:1}}),Locale:()=>new e({name:`Locale`,zod:t.string().regex(r),parseValue:e=>t.string().regex(r).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:r.source}}),TimeZone:()=>new e({name:`TimeZone`,zod:t.string().regex(i),parseValue:e=>t.string().regex(i).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:i.source}}),Latitude:()=>new e({name:`Latitude`,zod:t.number().min(-90).max(90),parseValue:e=>t.coerce.number().min(-90).max(90).parse(e),serialize:e=>Number(e),jsonSchema:{type:`number`,minimum:-90,maximum:90}}),Longitude:()=>new e({name:`Longitude`,zod:t.number().min(c).max(180),parseValue:e=>t.coerce.number().min(c).max(180).parse(e),serialize:e=>Number(e),jsonSchema:{type:`number`,minimum:c,maximum:180}}),Currency:()=>new e({name:`Currency`,zod:t.string().regex(o),parseValue:e=>t.string().regex(o).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:o.source}}),CountryCode:()=>new e({name:`CountryCode`,zod:t.string().regex(s),parseValue:e=>t.string().regex(s).parse(e),serialize:e=>String(e),jsonSchema:{type:`string`,pattern:s.source}})};export{l};
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 +1,39 @@
1
- import"./EnumType.js";import"./FieldType.js";import*as e from"zod";var t=class{constructor(e){this.config=e}getZod(){let t=Object.entries(this.config.fields).reduce((t,[n,r])=>{let i=r.type.getZod(),a=r.isArray?e.array(i):i;return t[n]=r.isOptional?a.optional():a,t},{});return e.object(t)}getPothosInput(){return this.config.name}};const n=e=>new t(e);export{n,t};
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 };