@reactionary/core 0.0.38 → 0.0.39

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
@@ -4,7 +4,6 @@ export * from "./cache/redis-cache";
4
4
  export * from "./cache/noop-cache";
5
5
  export * from "./client/client";
6
6
  export * from "./client/client-builder";
7
- export * from "./decorators/trpc.decorators";
8
7
  export * from "./providers/analytics.provider";
9
8
  export * from "./providers/base.provider";
10
9
  export * from "./providers/cart.provider";
package/package.json CHANGED
@@ -1,11 +1,10 @@
1
1
  {
2
2
  "name": "@reactionary/core",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "main": "index.js",
5
5
  "types": "src/index.d.ts",
6
6
  "dependencies": {
7
7
  "zod": "4.0.0-beta.20250430T185432",
8
- "@upstash/redis": "^1.34.9",
9
- "reflect-metadata": "0.2.2"
8
+ "@upstash/redis": "^1.34.9"
10
9
  }
11
10
  }
package/src/index.d.ts CHANGED
@@ -4,7 +4,6 @@ export * from './cache/redis-cache';
4
4
  export * from './cache/noop-cache';
5
5
  export * from './client/client';
6
6
  export * from './client/client-builder';
7
- export * from './decorators/trpc.decorators';
8
7
  export * from './providers/analytics.provider';
9
8
  export * from './providers/base.provider';
10
9
  export * from './providers/cart.provider';
@@ -1,66 +0,0 @@
1
- import "reflect-metadata";
2
- const TRPC_QUERY_METADATA_KEY = Symbol("trpc:query");
3
- const TRPC_MUTATION_METADATA_KEY = Symbol("trpc:mutation");
4
- function trpcQuery(options = {}) {
5
- return function(target, propertyKey, descriptor) {
6
- const metadata = {
7
- methodName: String(propertyKey),
8
- isQuery: true,
9
- isMutation: false,
10
- options
11
- };
12
- Reflect.defineMetadata(TRPC_QUERY_METADATA_KEY, metadata, target, propertyKey);
13
- const existingMethods = Reflect.getMetadata(TRPC_QUERY_METADATA_KEY, target.constructor) || [];
14
- existingMethods.push({ propertyKey, metadata });
15
- Reflect.defineMetadata(TRPC_QUERY_METADATA_KEY, existingMethods, target.constructor);
16
- };
17
- }
18
- function trpcMutation(options = {}) {
19
- return function(target, propertyKey, descriptor) {
20
- const metadata = {
21
- methodName: String(propertyKey),
22
- isQuery: false,
23
- isMutation: true,
24
- options
25
- };
26
- Reflect.defineMetadata(TRPC_MUTATION_METADATA_KEY, metadata, target, propertyKey);
27
- const existingMethods = Reflect.getMetadata(TRPC_MUTATION_METADATA_KEY, target.constructor) || [];
28
- existingMethods.push({ propertyKey, metadata });
29
- Reflect.defineMetadata(TRPC_MUTATION_METADATA_KEY, existingMethods, target.constructor);
30
- };
31
- }
32
- function getTRPCQueryMethods(target) {
33
- const constructor = typeof target === "function" ? target : target.constructor;
34
- return Reflect.getMetadata(TRPC_QUERY_METADATA_KEY, constructor) || [];
35
- }
36
- function getTRPCMutationMethods(target) {
37
- const constructor = typeof target === "function" ? target : target.constructor;
38
- return Reflect.getMetadata(TRPC_MUTATION_METADATA_KEY, constructor) || [];
39
- }
40
- function getAllTRPCMethods(target) {
41
- return [
42
- ...getTRPCQueryMethods(target),
43
- ...getTRPCMutationMethods(target)
44
- ];
45
- }
46
- function isTRPCQuery(target, methodName) {
47
- return !!Reflect.getMetadata(TRPC_QUERY_METADATA_KEY, target, methodName);
48
- }
49
- function isTRPCMutation(target, methodName) {
50
- return !!Reflect.getMetadata(TRPC_MUTATION_METADATA_KEY, target, methodName);
51
- }
52
- function isTRPCMethod(target, methodName) {
53
- return isTRPCQuery(target, methodName) || isTRPCMutation(target, methodName);
54
- }
55
- export {
56
- TRPC_MUTATION_METADATA_KEY,
57
- TRPC_QUERY_METADATA_KEY,
58
- getAllTRPCMethods,
59
- getTRPCMutationMethods,
60
- getTRPCQueryMethods,
61
- isTRPCMethod,
62
- isTRPCMutation,
63
- isTRPCQuery,
64
- trpcMutation,
65
- trpcQuery
66
- };
@@ -1,88 +0,0 @@
1
- import 'reflect-metadata';
2
- /**
3
- * Metadata keys for TRPC method decorators
4
- */
5
- export declare const TRPC_QUERY_METADATA_KEY: unique symbol;
6
- export declare const TRPC_MUTATION_METADATA_KEY: unique symbol;
7
- /**
8
- * Options for TRPC method decorators
9
- */
10
- export interface TRPCMethodOptions {
11
- /** Custom name for the TRPC procedure (defaults to method name) */
12
- name?: string;
13
- /** Description for documentation purposes */
14
- description?: string;
15
- }
16
- /**
17
- * Decorator to mark a provider method as a TRPC query procedure
18
- * Query procedures are read-only operations (GET-like)
19
- *
20
- * @example
21
- * ```typescript
22
- * class ProductProvider extends BaseProvider {
23
- * @trpcQuery()
24
- * async getById(payload: ProductQueryById, session: Session): Promise<Product> {
25
- * // implementation
26
- * }
27
- *
28
- * @trpcQuery({ name: 'findBySlug', description: 'Find product by URL slug' })
29
- * async getBySlug(payload: ProductQueryBySlug, session: Session): Promise<Product> {
30
- * // implementation
31
- * }
32
- * }
33
- * ```
34
- */
35
- export declare function trpcQuery(options?: TRPCMethodOptions): MethodDecorator;
36
- /**
37
- * Decorator to mark a provider method as a TRPC mutation procedure
38
- * Mutation procedures are write operations that modify state (POST/PUT/DELETE-like)
39
- *
40
- * @example
41
- * ```typescript
42
- * class CartProvider extends BaseProvider {
43
- * @trpcMutation()
44
- * async add(payload: CartAddMutation, session: Session): Promise<Cart> {
45
- * // implementation
46
- * }
47
- *
48
- * @trpcMutation({ name: 'removeItem' })
49
- * async remove(payload: CartRemoveMutation, session: Session): Promise<Cart> {
50
- * // implementation
51
- * }
52
- * }
53
- * ```
54
- */
55
- export declare function trpcMutation(options?: TRPCMethodOptions): MethodDecorator;
56
- /**
57
- * Get all TRPC query methods from a class or instance
58
- */
59
- export declare function getTRPCQueryMethods(target: any): Array<{
60
- propertyKey: string | symbol;
61
- metadata: any;
62
- }>;
63
- /**
64
- * Get all TRPC mutation methods from a class or instance
65
- */
66
- export declare function getTRPCMutationMethods(target: any): Array<{
67
- propertyKey: string | symbol;
68
- metadata: any;
69
- }>;
70
- /**
71
- * Get all TRPC methods (both queries and mutations) from a class or instance
72
- */
73
- export declare function getAllTRPCMethods(target: any): Array<{
74
- propertyKey: string | symbol;
75
- metadata: any;
76
- }>;
77
- /**
78
- * Check if a method is marked as a TRPC query
79
- */
80
- export declare function isTRPCQuery(target: any, methodName: string | symbol): boolean;
81
- /**
82
- * Check if a method is marked as a TRPC mutation
83
- */
84
- export declare function isTRPCMutation(target: any, methodName: string | symbol): boolean;
85
- /**
86
- * Check if a method is marked for TRPC exposure (query or mutation)
87
- */
88
- export declare function isTRPCMethod(target: any, methodName: string | symbol): boolean;