@reactionary/core 0.0.31 → 0.0.32

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.
package/index.js CHANGED
@@ -109,245 +109,108 @@ function createCache() {
109
109
  return new RedisCache();
110
110
  }
111
111
 
112
- // otel/src/trpc-middleware.ts
113
- import { TRPCError } from "@trpc/server";
114
- import {
115
- SpanKind as SpanKind2,
116
- SpanStatusCode as SpanStatusCode3
117
- } from "@opentelemetry/api";
118
-
119
- // otel/src/tracer.ts
120
- import {
121
- trace,
122
- SpanStatusCode,
123
- context as otelContext
124
- } from "@opentelemetry/api";
125
-
126
- // otel/src/sdk.ts
127
- import { NodeSDK } from "@opentelemetry/sdk-node";
128
- var sdk = null;
129
- var isInitialized = false;
130
- var initializationPromise = null;
131
- function isBrowser() {
132
- return typeof window !== "undefined" && typeof process === "undefined";
133
- }
134
- function ensureInitialized() {
135
- if (isInitialized || initializationPromise) {
136
- return;
137
- }
138
- if (isBrowser()) {
139
- isInitialized = true;
140
- return;
141
- }
142
- initializationPromise = Promise.resolve().then(() => {
143
- sdk = new NodeSDK();
144
- sdk.start();
145
- isInitialized = true;
146
- process.on("SIGTERM", async () => {
147
- try {
148
- await shutdownOtel();
149
- if (process.env["OTEL_LOG_LEVEL"] === "debug") {
150
- console.log("OpenTelemetry terminated successfully");
151
- }
152
- } catch (error) {
153
- console.error("Error terminating OpenTelemetry", error);
112
+ // core/src/client/client-builder.ts
113
+ var ClientBuilder = class _ClientBuilder {
114
+ constructor() {
115
+ this.factories = [];
116
+ }
117
+ withCapability(factory) {
118
+ const newBuilder = new _ClientBuilder();
119
+ newBuilder.factories = [...this.factories, factory];
120
+ newBuilder.cache = this.cache;
121
+ return newBuilder;
122
+ }
123
+ withCache(cache) {
124
+ const newBuilder = new _ClientBuilder();
125
+ newBuilder.factories = [...this.factories];
126
+ newBuilder.cache = cache;
127
+ return newBuilder;
128
+ }
129
+ build() {
130
+ let client = {};
131
+ const sharedCache = this.cache || new NoOpCache();
132
+ const mergedAnalytics = [];
133
+ for (const factory of this.factories) {
134
+ const provider = factory(sharedCache);
135
+ client = {
136
+ ...client,
137
+ ...provider
138
+ };
139
+ if (provider.analytics) {
140
+ mergedAnalytics.push(...provider.analytics);
154
141
  }
155
- });
156
- });
157
- }
158
- async function shutdownOtel() {
159
- if (sdk) {
160
- await sdk.shutdown();
161
- sdk = null;
162
- isInitialized = false;
142
+ }
143
+ if (mergedAnalytics.length > 0) {
144
+ client["analytics"] = mergedAnalytics;
145
+ }
146
+ const completeClient = {
147
+ ...client,
148
+ cache: sharedCache
149
+ };
150
+ return completeClient;
163
151
  }
164
- }
165
- function isOtelInitialized() {
166
- ensureInitialized();
167
- return isInitialized;
168
- }
152
+ };
169
153
 
170
- // otel/src/tracer.ts
171
- import { SpanKind, SpanStatusCode as SpanStatusCode2 } from "@opentelemetry/api";
172
- var TRACER_NAME = "@reactionary/otel";
173
- var TRACER_VERSION = "0.0.1";
174
- var globalTracer = null;
175
- function getTracer() {
176
- if (!globalTracer) {
177
- isOtelInitialized();
178
- globalTracer = trace.getTracer(TRACER_NAME, TRACER_VERSION);
179
- }
180
- return globalTracer;
154
+ // core/src/decorators/trpc.decorators.ts
155
+ import "reflect-metadata";
156
+ var TRPC_QUERY_METADATA_KEY = Symbol("trpc:query");
157
+ var TRPC_MUTATION_METADATA_KEY = Symbol("trpc:mutation");
158
+ function trpcQuery(options = {}) {
159
+ return function(target, propertyKey, descriptor) {
160
+ const metadata = {
161
+ methodName: String(propertyKey),
162
+ isQuery: true,
163
+ isMutation: false,
164
+ options
165
+ };
166
+ Reflect.defineMetadata(TRPC_QUERY_METADATA_KEY, metadata, target, propertyKey);
167
+ const existingMethods = Reflect.getMetadata(TRPC_QUERY_METADATA_KEY, target.constructor) || [];
168
+ existingMethods.push({ propertyKey, metadata });
169
+ Reflect.defineMetadata(TRPC_QUERY_METADATA_KEY, existingMethods, target.constructor);
170
+ };
181
171
  }
182
- function withSpan(name, fn, options) {
183
- const tracer = getTracer();
184
- return tracer.startActiveSpan(name, options || {}, async (span) => {
185
- try {
186
- const result = await fn(span);
187
- span.setStatus({ code: SpanStatusCode.OK });
188
- return result;
189
- } catch (error) {
190
- span.setStatus({
191
- code: SpanStatusCode.ERROR,
192
- message: error instanceof Error ? error.message : String(error)
193
- });
194
- if (error instanceof Error) {
195
- span.recordException(error);
196
- }
197
- throw error;
198
- } finally {
199
- span.end();
200
- }
201
- });
172
+ function trpcMutation(options = {}) {
173
+ return function(target, propertyKey, descriptor) {
174
+ const metadata = {
175
+ methodName: String(propertyKey),
176
+ isQuery: false,
177
+ isMutation: true,
178
+ options
179
+ };
180
+ Reflect.defineMetadata(TRPC_MUTATION_METADATA_KEY, metadata, target, propertyKey);
181
+ const existingMethods = Reflect.getMetadata(TRPC_MUTATION_METADATA_KEY, target.constructor) || [];
182
+ existingMethods.push({ propertyKey, metadata });
183
+ Reflect.defineMetadata(TRPC_MUTATION_METADATA_KEY, existingMethods, target.constructor);
184
+ };
202
185
  }
203
- function setSpanAttributes(span, attributes) {
204
- Object.entries(attributes).forEach(([key, value]) => {
205
- if (value !== void 0 && value !== null) {
206
- span.setAttribute(key, value);
207
- }
208
- });
186
+ function getTRPCQueryMethods(target) {
187
+ const constructor = typeof target === "function" ? target : target.constructor;
188
+ return Reflect.getMetadata(TRPC_QUERY_METADATA_KEY, constructor) || [];
209
189
  }
210
-
211
- // otel/src/metrics.ts
212
- import { metrics } from "@opentelemetry/api";
213
- var METER_NAME = "@reactionary/otel";
214
- var METER_VERSION = "0.0.1";
215
- var globalMeter = null;
216
- function getMeter() {
217
- if (!globalMeter) {
218
- isOtelInitialized();
219
- globalMeter = metrics.getMeter(METER_NAME, METER_VERSION);
220
- }
221
- return globalMeter;
190
+ function getTRPCMutationMethods(target) {
191
+ const constructor = typeof target === "function" ? target : target.constructor;
192
+ return Reflect.getMetadata(TRPC_MUTATION_METADATA_KEY, constructor) || [];
222
193
  }
223
- var metricsInstance = null;
224
- function initializeMetrics() {
225
- if (metricsInstance) {
226
- return metricsInstance;
227
- }
228
- const meter = getMeter();
229
- metricsInstance = {
230
- requestCounter: meter.createCounter("reactionary.requests", {
231
- description: "Total number of requests"
232
- }),
233
- requestDuration: meter.createHistogram("reactionary.request.duration", {
234
- description: "Request duration in milliseconds",
235
- unit: "ms"
236
- }),
237
- activeRequests: meter.createUpDownCounter("reactionary.requests.active", {
238
- description: "Number of active requests"
239
- }),
240
- errorCounter: meter.createCounter("reactionary.errors", {
241
- description: "Total number of errors"
242
- }),
243
- providerCallCounter: meter.createCounter("reactionary.provider.calls", {
244
- description: "Total number of provider calls"
245
- }),
246
- providerCallDuration: meter.createHistogram("reactionary.provider.duration", {
247
- description: "Provider call duration in milliseconds",
248
- unit: "ms"
249
- }),
250
- cacheHitCounter: meter.createCounter("reactionary.cache.hits", {
251
- description: "Total number of cache hits"
252
- }),
253
- cacheMissCounter: meter.createCounter("reactionary.cache.misses", {
254
- description: "Total number of cache misses"
255
- })
256
- };
257
- return metricsInstance;
194
+ function getAllTRPCMethods(target) {
195
+ return [
196
+ ...getTRPCQueryMethods(target),
197
+ ...getTRPCMutationMethods(target)
198
+ ];
258
199
  }
259
- function getMetrics() {
260
- if (!metricsInstance) {
261
- return initializeMetrics();
262
- }
263
- return metricsInstance;
200
+ function isTRPCQuery(target, methodName) {
201
+ return !!Reflect.getMetadata(TRPC_QUERY_METADATA_KEY, target, methodName);
264
202
  }
265
-
266
- // otel/src/provider-instrumentation.ts
267
- import { SpanKind as SpanKind3 } from "@opentelemetry/api";
268
- async function withProviderSpan(options, fn) {
269
- const { providerName, operationType, operationName, attributes = {} } = options;
270
- const metrics2 = getMetrics();
271
- const spanName = `provider.${providerName}.${operationType}${operationName ? `.${operationName}` : ""}`;
272
- const startTime = Date.now();
273
- metrics2.providerCallCounter.add(1, {
274
- "provider.name": providerName,
275
- "provider.operation.type": operationType,
276
- "provider.operation.name": operationName || "unknown"
277
- });
278
- return withSpan(
279
- spanName,
280
- async (span) => {
281
- setSpanAttributes(span, {
282
- "provider.name": providerName,
283
- "provider.operation.type": operationType,
284
- "provider.operation.name": operationName,
285
- ...attributes
286
- });
287
- try {
288
- const result = await fn(span);
289
- const duration = Date.now() - startTime;
290
- metrics2.providerCallDuration.record(duration, {
291
- "provider.name": providerName,
292
- "provider.operation.type": operationType,
293
- "provider.operation.name": operationName || "unknown",
294
- "status": "success"
295
- });
296
- return result;
297
- } catch (error) {
298
- const duration = Date.now() - startTime;
299
- metrics2.providerCallDuration.record(duration, {
300
- "provider.name": providerName,
301
- "provider.operation.type": operationType,
302
- "provider.operation.name": operationName || "unknown",
303
- "status": "error"
304
- });
305
- metrics2.errorCounter.add(1, {
306
- "provider.name": providerName,
307
- "provider.operation.type": operationType,
308
- "provider.operation.name": operationName || "unknown"
309
- });
310
- throw error;
311
- }
312
- },
313
- { kind: SpanKind3.CLIENT }
314
- );
203
+ function isTRPCMutation(target, methodName) {
204
+ return !!Reflect.getMetadata(TRPC_MUTATION_METADATA_KEY, target, methodName);
315
205
  }
316
- function createProviderInstrumentation(providerName) {
317
- return {
318
- traceQuery: (operationName, fn, attributes) => {
319
- return withProviderSpan(
320
- {
321
- providerName,
322
- operationType: "query",
323
- operationName,
324
- attributes
325
- },
326
- fn
327
- );
328
- },
329
- traceMutation: (operationName, fn, attributes) => {
330
- return withProviderSpan(
331
- {
332
- providerName,
333
- operationType: "mutation",
334
- operationName,
335
- attributes
336
- },
337
- fn
338
- );
339
- }
340
- };
206
+ function isTRPCMethod(target, methodName) {
207
+ return isTRPCQuery(target, methodName) || isTRPCMutation(target, methodName);
341
208
  }
342
209
 
343
210
  // core/src/providers/base.provider.ts
344
- import * as crypto from "crypto";
345
211
  var BaseProvider = class {
346
- constructor(schema, querySchema, mutationSchema, cache) {
212
+ constructor(schema, cache) {
347
213
  this.schema = schema;
348
- this.querySchema = querySchema;
349
- this.mutationSchema = mutationSchema;
350
- this.instrumentation = createProviderInstrumentation(this.constructor.name);
351
214
  this.cache = cache;
352
215
  }
353
216
  /**
@@ -364,208 +227,41 @@ var BaseProvider = class {
364
227
  return this.schema.parse({});
365
228
  }
366
229
  /**
367
- * Retrieves a set of entities matching the list of queries. The size of
368
- * the resulting list WILL always match the size of the query list. The
369
- * result list will never contain nulls or undefined. The order
370
- * of the results will match the order of the queries.
371
- */
372
- async query(queries, session) {
373
- return this.instrumentation.traceQuery(
374
- "query",
375
- async (span) => {
376
- span.setAttribute("provider.query.count", queries.length);
377
- let cacheHits = 0;
378
- let cacheMisses = 0;
379
- const results = [];
380
- for (const query of queries) {
381
- let result = null;
382
- const cacheInfo = this.getCacheEvaluation(query, session);
383
- if (cacheInfo.canCache && cacheInfo.key) {
384
- try {
385
- result = await this.cache.get(cacheInfo.key, this.schema);
386
- if (result) {
387
- cacheHits++;
388
- span.setAttribute("provider.cache.hit", true);
389
- }
390
- } catch (error) {
391
- console.warn(`Cache get error for ${this.constructor.name}:`, error);
392
- }
393
- }
394
- if (!result) {
395
- const singleResult = await this.fetch([query], session);
396
- result = singleResult[0];
397
- cacheMisses++;
398
- if (result && cacheInfo.canCache && cacheInfo.key) {
399
- try {
400
- await this.cache.put(cacheInfo.key, result, cacheInfo.cacheDurationInSeconds);
401
- } catch (error) {
402
- console.warn(`Cache put error for ${this.constructor.name}:`, error);
403
- }
404
- }
405
- }
406
- if (result) {
407
- this.assert(result);
408
- results.push(result);
409
- }
410
- }
411
- span.setAttribute("provider.result.count", results.length);
412
- span.setAttribute("provider.cache.hits", cacheHits);
413
- span.setAttribute("provider.cache.misses", cacheMisses);
414
- span.setAttribute("provider.cache.hit_ratio", cacheHits / (cacheHits + cacheMisses));
415
- return results;
416
- },
417
- { queryCount: queries.length }
418
- );
419
- }
420
- /**
421
- * Executes the listed mutations in order and returns the final state
422
- * resulting from that set of operations.
230
+ * Handler for parsing a response from a remote provider and converting it
231
+ * into the typed domain model.
423
232
  */
424
- async mutate(mutations, session) {
425
- return this.instrumentation.traceMutation(
426
- "mutate",
427
- async (span) => {
428
- span.setAttribute("provider.mutation.count", mutations.length);
429
- const result = await this.process(mutations, session);
430
- this.assert(result);
431
- return result;
432
- },
433
- { mutationCount: mutations.length }
434
- );
435
- }
436
- /**
437
- * Provider-specific cache evaluation logic.
438
- * Returns information about how this query should be cached.
439
- * Override this method to enable caching with custom keys and TTL.
440
- * Default implementation returns no caching.
441
- */
442
- getCacheEvaluation(query, session) {
443
- const providerName = this.constructor.name.toLowerCase();
444
- const userId = session.identity?.id || "anonymous";
445
- const queryHash = crypto.createHash("md5").update(JSON.stringify(query)).digest("hex").substring(0, 12);
446
- const key = `${providerName}:${userId}:${queryHash}`;
447
- return {
448
- key,
449
- cacheDurationInSeconds: 0,
450
- canCache: false
451
- };
233
+ parseSingle(_body) {
234
+ const model = this.newModel();
235
+ return this.assert(model);
452
236
  }
453
237
  };
454
238
 
455
239
  // core/src/providers/analytics.provider.ts
456
- import * as crypto2 from "crypto";
457
240
  var AnalyticsProvider = class extends BaseProvider {
458
- getCacheEvaluation(query, _session) {
459
- const providerName = this.constructor.name.toLowerCase();
460
- const relevantFields = {
461
- type: typeof query === "object" && query !== null && "type" in query ? query.type : void 0,
462
- dateRange: typeof query === "object" && query !== null && "dateRange" in query ? query.dateRange : void 0,
463
- filters: typeof query === "object" && query !== null && "filters" in query ? query.filters : void 0
464
- };
465
- const analyticsHash = crypto2.createHash("md5").update(JSON.stringify(relevantFields)).digest("hex").substring(0, 12);
466
- const key = `${providerName}:analytics:${analyticsHash}`;
467
- return {
468
- key,
469
- cacheDurationInSeconds: 0,
470
- canCache: false
471
- };
472
- }
473
241
  };
474
242
 
475
243
  // core/src/providers/cart.provider.ts
476
- import * as crypto3 from "crypto";
477
244
  var CartProvider = class extends BaseProvider {
478
- getCacheEvaluation(query, session) {
479
- const providerName = this.constructor.name.toLowerCase();
480
- const userId = session.identity?.id || "anonymous";
481
- const queryHash = crypto3.createHash("md5").update(JSON.stringify(query)).digest("hex").substring(0, 12);
482
- const key = `${providerName}:cart:${userId}:${queryHash}`;
483
- return {
484
- key,
485
- cacheDurationInSeconds: 0,
486
- canCache: false
487
- };
488
- }
489
245
  };
490
246
 
491
247
  // core/src/providers/identity.provider.ts
492
248
  var IdentityProvider = class extends BaseProvider {
493
- getCacheEvaluation(_query, session) {
494
- const providerName = this.constructor.name.toLowerCase();
495
- const userId = session.identity?.id;
496
- const key = userId ? `${providerName}:identity:${userId}` : `${providerName}:identity:anonymous`;
497
- return {
498
- key,
499
- cacheDurationInSeconds: 0,
500
- canCache: false
501
- };
502
- }
503
249
  };
504
250
 
505
251
  // core/src/providers/inventory.provider.ts
506
252
  var InventoryProvider = class extends BaseProvider {
507
- getCacheEvaluation(query, _session) {
508
- const providerName = this.constructor.name.toLowerCase();
509
- const key = `${providerName}:inventory:${query.sku}`;
510
- return {
511
- key,
512
- cacheDurationInSeconds: 0,
513
- canCache: false
514
- };
515
- }
516
253
  };
517
254
 
518
255
  // core/src/providers/price.provider.ts
519
- import * as crypto4 from "crypto";
520
256
  var PriceProvider = class extends BaseProvider {
521
- getCacheEvaluation(query, _session) {
522
- const providerName = this.constructor.name.toLowerCase();
523
- const skuHash = crypto4.createHash("md5").update(JSON.stringify(query.sku)).digest("hex").substring(0, 12);
524
- const key = `${providerName}:price:${skuHash}`;
525
- return {
526
- key,
527
- cacheDurationInSeconds: 0,
528
- canCache: false
529
- };
530
- }
531
257
  };
532
258
 
533
259
  // core/src/providers/product.provider.ts
534
- import * as crypto5 from "crypto";
535
260
  var ProductProvider = class extends BaseProvider {
536
- getCacheEvaluation(query, _session) {
537
- const providerName = this.constructor.name.toLowerCase();
538
- let key;
539
- if (query.query === "slug") {
540
- key = `${providerName}:product:slug:${query.slug}`;
541
- } else if (query.query === "id") {
542
- key = `${providerName}:product:id:${query.id}`;
543
- } else {
544
- const queryHash = crypto5.createHash("md5").update(JSON.stringify(query)).digest("hex").substring(0, 12);
545
- key = `${providerName}:product:${queryHash}`;
546
- }
547
- return {
548
- key,
549
- cacheDurationInSeconds: 300,
550
- // Products are moderately stable - 5 minutes
551
- canCache: true
552
- };
553
- }
554
261
  };
555
262
 
556
263
  // core/src/providers/search.provider.ts
557
- import * as crypto6 from "crypto";
558
264
  var SearchProvider = class extends BaseProvider {
559
- getCacheEvaluation(query, _session) {
560
- const providerName = this.constructor.name.toLowerCase();
561
- const searchHash = crypto6.createHash("md5").update(JSON.stringify(query.search)).digest("hex").substring(0, 12);
562
- const key = `${providerName}:search:${searchHash}`;
563
- return {
564
- key,
565
- cacheDurationInSeconds: 0,
566
- canCache: false
567
- };
568
- }
569
265
  };
570
266
 
571
267
  // core/src/schemas/capabilities.schema.ts
@@ -913,42 +609,32 @@ var SearchResultSchema = BaseModelSchema.extend({
913
609
 
914
610
  // core/src/schemas/mutations/base.mutation.ts
915
611
  import { z as z12 } from "zod";
916
- var BaseMutationSchema = z12.looseInterface({
917
- mutation: z12.ZodLiteral
918
- });
612
+ var BaseMutationSchema = z12.looseInterface({});
919
613
 
920
614
  // core/src/schemas/mutations/cart.mutation.ts
921
615
  import { z as z13 } from "zod";
922
616
  var CartMutationItemAddSchema = BaseMutationSchema.extend({
923
- mutation: z13.literal("add"),
924
617
  cart: CartIdentifierSchema.required(),
925
618
  product: ProductIdentifierSchema.required(),
926
619
  quantity: z13.number()
927
620
  });
928
621
  var CartMutationItemRemoveSchema = BaseMutationSchema.extend({
929
- mutation: z13.literal("remove"),
930
622
  cart: CartIdentifierSchema.required(),
931
623
  item: CartItemIdentifierSchema.required()
932
624
  });
933
625
  var CartMutationItemQuantityChangeSchema = BaseMutationSchema.extend({
934
- mutation: z13.literal("adjustQuantity"),
935
626
  cart: CartIdentifierSchema.required(),
936
627
  item: CartItemIdentifierSchema.required(),
937
628
  quantity: z13.number()
938
629
  });
939
- var CartMutationSchema = z13.union([CartMutationItemAddSchema, CartMutationItemRemoveSchema, CartMutationItemQuantityChangeSchema]);
940
630
 
941
631
  // core/src/schemas/mutations/identity.mutation.ts
942
632
  import { z as z14 } from "zod";
943
633
  var IdentityMutationLoginSchema = BaseMutationSchema.extend({
944
- mutation: z14.literal("login"),
945
634
  username: z14.string(),
946
635
  password: z14.string()
947
636
  });
948
- var IdentityMutationLogoutSchema = BaseMutationSchema.extend({
949
- mutation: z14.literal("logout")
950
- });
951
- var IdentityMutationSchema = z14.union([IdentityMutationLoginSchema, IdentityMutationLogoutSchema]);
637
+ var IdentityMutationLogoutSchema = BaseMutationSchema.extend({});
952
638
 
953
639
  // core/src/schemas/mutations/inventory.mutation.ts
954
640
  import { z as z15 } from "zod";
@@ -968,59 +654,42 @@ var SearchMutationSchema = z18.union([]);
968
654
 
969
655
  // core/src/schemas/queries/base.query.ts
970
656
  import { z as z19 } from "zod";
971
- var BaseQuerySchema = z19.looseInterface({
972
- query: z19.ZodLiteral
973
- });
657
+ var BaseQuerySchema = z19.looseInterface({});
974
658
 
975
659
  // core/src/schemas/queries/cart.query.ts
976
660
  import { z as z20 } from "zod";
977
661
  var CartQueryByIdSchema = BaseQuerySchema.extend({
978
- query: z20.literal("id"),
979
662
  cart: CartIdentifierSchema.required()
980
663
  });
981
664
  var CartQuerySchema = z20.union([CartQueryByIdSchema]);
982
665
 
983
666
  // core/src/schemas/queries/identity.query.ts
984
- import { z as z21 } from "zod";
985
- var IdentityQuerySelfSchema = BaseQuerySchema.extend({
986
- query: z21.literal("self")
987
- });
988
- var IdentityQuerySchema = z21.union([IdentityQuerySelfSchema]);
667
+ var IdentityQuerySelfSchema = BaseQuerySchema.extend({});
989
668
 
990
669
  // core/src/schemas/queries/inventory.query.ts
991
- import { z as z22 } from "zod";
670
+ import { z as z21 } from "zod";
992
671
  var InventoryQuerySchema = BaseQuerySchema.extend({
993
- query: z22.literal("sku"),
994
- sku: z22.string()
672
+ sku: z21.string()
995
673
  });
996
674
 
997
675
  // core/src/schemas/queries/price.query.ts
998
- import { z as z23 } from "zod";
999
676
  var PriceQueryBySkuSchema = BaseQuerySchema.extend({
1000
- query: z23.literal("sku"),
1001
677
  sku: SKUIdentifierSchema.required()
1002
678
  });
1003
- var PriceQuerySchema = z23.union([PriceQueryBySkuSchema]);
1004
679
 
1005
680
  // core/src/schemas/queries/product.query.ts
1006
- import { z as z24 } from "zod";
681
+ import { z as z22 } from "zod";
1007
682
  var ProductQueryBySlugSchema = BaseQuerySchema.extend({
1008
- query: z24.literal("slug"),
1009
- slug: z24.string()
683
+ slug: z22.string()
1010
684
  });
1011
685
  var ProductQueryByIdSchema = BaseQuerySchema.extend({
1012
- query: z24.literal("id"),
1013
- id: z24.string()
686
+ id: z22.string()
1014
687
  });
1015
- var ProductQuerySchema = z24.union([ProductQueryBySlugSchema, ProductQueryByIdSchema]);
1016
688
 
1017
689
  // core/src/schemas/queries/search.query.ts
1018
- import { z as z25 } from "zod";
1019
690
  var SearchQueryByTermSchema = BaseQuerySchema.extend({
1020
- query: z25.literal("term"),
1021
691
  search: SearchIdentifierSchema.required()
1022
692
  });
1023
- var SearchQuerySchema = z25.union([SearchQueryByTermSchema]);
1024
693
  export {
1025
694
  AnalyticsProvider,
1026
695
  BaseModelSchema,
@@ -1035,19 +704,17 @@ export {
1035
704
  CartMutationItemAddSchema,
1036
705
  CartMutationItemQuantityChangeSchema,
1037
706
  CartMutationItemRemoveSchema,
1038
- CartMutationSchema,
1039
707
  CartProvider,
1040
708
  CartQueryByIdSchema,
1041
709
  CartQuerySchema,
1042
710
  CartSchema,
711
+ ClientBuilder,
1043
712
  CurrencySchema,
1044
713
  FacetIdentifierSchema,
1045
714
  FacetValueIdentifierSchema,
1046
715
  IdentityMutationLoginSchema,
1047
716
  IdentityMutationLogoutSchema,
1048
- IdentityMutationSchema,
1049
717
  IdentityProvider,
1050
- IdentityQuerySchema,
1051
718
  IdentityQuerySelfSchema,
1052
719
  IdentitySchema,
1053
720
  IdentityTypeSchema,
@@ -1062,7 +729,6 @@ export {
1062
729
  PriceMutationSchema,
1063
730
  PriceProvider,
1064
731
  PriceQueryBySkuSchema,
1065
- PriceQuerySchema,
1066
732
  PriceSchema,
1067
733
  ProductAttributeSchema,
1068
734
  ProductIdentifierSchema,
@@ -1070,7 +736,6 @@ export {
1070
736
  ProductProvider,
1071
737
  ProductQueryByIdSchema,
1072
738
  ProductQueryBySlugSchema,
1073
- ProductQuerySchema,
1074
739
  ProductSchema,
1075
740
  RedisCache,
1076
741
  SKUIdentifierSchema,
@@ -1079,12 +744,21 @@ export {
1079
744
  SearchMutationSchema,
1080
745
  SearchProvider,
1081
746
  SearchQueryByTermSchema,
1082
- SearchQuerySchema,
1083
747
  SearchResultFacetSchema,
1084
748
  SearchResultFacetValueSchema,
1085
749
  SearchResultProductSchema,
1086
750
  SearchResultSchema,
1087
751
  SessionSchema,
752
+ TRPC_MUTATION_METADATA_KEY,
753
+ TRPC_QUERY_METADATA_KEY,
1088
754
  buildClient,
1089
- createCache
755
+ createCache,
756
+ getAllTRPCMethods,
757
+ getTRPCMutationMethods,
758
+ getTRPCQueryMethods,
759
+ isTRPCMethod,
760
+ isTRPCMutation,
761
+ isTRPCQuery,
762
+ trpcMutation,
763
+ trpcQuery
1090
764
  };