@quickql/vue 1.0.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.
@@ -0,0 +1,57 @@
1
+ /**
2
+ * QuickQL Core Client
3
+ *
4
+ * Standard HTTP client for interacting with QuickQL servers across
5
+ * all JavaScript environments. Handles batching, caching, and plugins.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ import { Query, Mutation, QuickQLRequest, QuickQLResponse, QuickQLError } from './types';
12
+ export interface ClientOptions {
13
+ endpoint: string;
14
+ headers?: Record<string, string>;
15
+ timeout?: number;
16
+ retry?: number;
17
+ cacheTTL?: number;
18
+ plugins?: QuickQLPlugin[];
19
+ }
20
+ export type LifecycleHook = 'beforeRequest' | 'afterResponse' | 'onError';
21
+ export interface QuickQLPlugin {
22
+ name: string;
23
+ onBeforeRequest?: (request: QuickQLRequest, context: any) => QuickQLRequest | Promise<QuickQLRequest>;
24
+ onAfterResponse?: (response: QuickQLResponse, context: any) => QuickQLResponse | Promise<QuickQLResponse>;
25
+ onError?: (error: QuickQLError, context: any) => void | Promise<void>;
26
+ }
27
+ /**
28
+ * Universal QuickQL Client for Browser and Node.js
29
+ */
30
+ export declare class QuickQLClient {
31
+ private cache;
32
+ private options;
33
+ constructor(options: ClientOptions);
34
+ /**
35
+ * Main Query operation.
36
+ */
37
+ query<T = any>(query: Query, alias?: string): Promise<QuickQLResponse<T>>;
38
+ /**
39
+ * Main Mutation operation.
40
+ */
41
+ mutation<T = any>(mutation: Mutation, alias?: string): Promise<QuickQLResponse<T>>;
42
+ /**
43
+ * Batch multiple queries and mutations.
44
+ */
45
+ batch(items: (Query | Mutation)[], transaction?: boolean): Promise<QuickQLResponse<any>>;
46
+ /**
47
+ * Low-level execution logic with plugin support.
48
+ */
49
+ private execute;
50
+ private handleError;
51
+ private getCacheKey;
52
+ private getFromCache;
53
+ private setInCache;
54
+ clearCache(): void;
55
+ setHeaders(headers: Record<string, string>): void;
56
+ }
57
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../core/src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,eAAe,EAAE,YAAY,EAC/D,MAAM,SAAS,CAAC;AAEjB,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,aAAa,EAAE,CAAC;CAC3B;AAED,MAAM,MAAM,aAAa,GAAG,eAAe,GAAG,eAAe,GAAG,SAAS,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,KAAK,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACtG,eAAe,CAAC,EAAE,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,KAAK,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAC1G,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAqD;IAClE,OAAO,CAAC,OAAO,CAA0B;gBAE7B,OAAO,EAAE,aAAa;IAelC;;OAEG;IACG,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,GAAE,MAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAoBvF;;OAEG;IACG,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,GAAE,MAAe,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;IAWhG;;OAEG;IACG,KAAK,CAAC,KAAK,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC,EAAE,EAAE,WAAW,UAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;IAS5F;;OAEG;YACW,OAAO;IAgDrB,OAAO,CAAC,WAAW;IAqBnB,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,YAAY;IASpB,OAAO,CAAC,UAAU;IASX,UAAU;IAIV,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAGlD"}
@@ -0,0 +1,164 @@
1
+ /**
2
+ * QuickQL Core Client
3
+ *
4
+ * Standard HTTP client for interacting with QuickQL servers across
5
+ * all JavaScript environments. Handles batching, caching, and plugins.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ /**
12
+ * Universal QuickQL Client for Browser and Node.js
13
+ */
14
+ export class QuickQLClient {
15
+ cache = new Map();
16
+ options;
17
+ constructor(options) {
18
+ this.options = {
19
+ endpoint: options.endpoint,
20
+ headers: {
21
+ 'Content-Type': 'application/json',
22
+ 'X-QuickQL-Version': '1.0.0',
23
+ ...(options.headers || {})
24
+ },
25
+ timeout: options.timeout || 15000,
26
+ retry: options.retry || 1,
27
+ cacheTTL: options.cacheTTL || 0,
28
+ plugins: options.plugins || []
29
+ };
30
+ }
31
+ /**
32
+ * Main Query operation.
33
+ */
34
+ async query(query, alias = 'data') {
35
+ const key = this.getCacheKey({ query, alias });
36
+ const cached = this.getFromCache(key);
37
+ if (cached)
38
+ return cached;
39
+ try {
40
+ const response = await this.execute({
41
+ queries: { [alias]: query }
42
+ });
43
+ const res = response;
44
+ if (res.data && !res.errors) {
45
+ this.setInCache(key, res);
46
+ }
47
+ return res;
48
+ }
49
+ catch (error) {
50
+ return this.handleError(error);
51
+ }
52
+ }
53
+ /**
54
+ * Main Mutation operation.
55
+ */
56
+ async mutation(mutation, alias = 'data') {
57
+ try {
58
+ const response = await this.execute({
59
+ mutations: { [alias]: mutation }
60
+ });
61
+ return response;
62
+ }
63
+ catch (error) {
64
+ return this.handleError(error);
65
+ }
66
+ }
67
+ /**
68
+ * Batch multiple queries and mutations.
69
+ */
70
+ async batch(items, transaction = false) {
71
+ try {
72
+ const response = await this.execute({ batch: items, transaction });
73
+ return response;
74
+ }
75
+ catch (error) {
76
+ return this.handleError(error);
77
+ }
78
+ }
79
+ /**
80
+ * Low-level execution logic with plugin support.
81
+ */
82
+ async execute(request, retries = this.options.retry) {
83
+ let currentRequest = request;
84
+ // Trigger onBeforeRequest hooks
85
+ for (const plugin of this.options.plugins) {
86
+ if (plugin.onBeforeRequest) {
87
+ currentRequest = await plugin.onBeforeRequest(currentRequest, this);
88
+ }
89
+ }
90
+ const controller = new AbortController();
91
+ const timeoutId = setTimeout(() => controller.abort(), this.options.timeout);
92
+ try {
93
+ const response = await fetch(this.options.endpoint, {
94
+ method: 'POST',
95
+ headers: this.options.headers,
96
+ body: JSON.stringify(currentRequest),
97
+ signal: controller.signal
98
+ });
99
+ clearTimeout(timeoutId);
100
+ if (!response.ok) {
101
+ throw new Error(`QuickQL Client Error: ${response.status} ${response.statusText}`);
102
+ }
103
+ let data = await response.json();
104
+ // Trigger onAfterResponse hooks
105
+ for (const plugin of this.options.plugins) {
106
+ if (plugin.onAfterResponse) {
107
+ data = await plugin.onAfterResponse(data, this);
108
+ }
109
+ }
110
+ return data;
111
+ }
112
+ catch (error) {
113
+ clearTimeout(timeoutId);
114
+ if (retries > 0 && error.name !== 'AbortError') {
115
+ return this.execute(request, retries - 1);
116
+ }
117
+ throw error;
118
+ }
119
+ }
120
+ handleError(error) {
121
+ const isTimeout = error.name === 'AbortError';
122
+ const quickError = {
123
+ type: isTimeout ? 'NETWORK' : 'INTERNAL',
124
+ message: error.message || 'Unknown QuickQL Client error',
125
+ code: isTimeout ? 'TIMEOUT' : 'CLIENT_EXCEPTION'
126
+ };
127
+ // Trigger plugins
128
+ for (const plugin of this.options.plugins) {
129
+ if (plugin.onError) {
130
+ plugin.onError(quickError, this);
131
+ }
132
+ }
133
+ return {
134
+ data: null,
135
+ errors: [quickError]
136
+ };
137
+ }
138
+ getCacheKey(request) {
139
+ return JSON.stringify(request);
140
+ }
141
+ getFromCache(key) {
142
+ const cached = this.cache.get(key);
143
+ if (cached && cached.expiry > Date.now()) {
144
+ return cached.value;
145
+ }
146
+ this.cache.delete(key);
147
+ return null;
148
+ }
149
+ setInCache(key, value) {
150
+ if (this.options.cacheTTL > 0) {
151
+ this.cache.set(key, {
152
+ value,
153
+ expiry: Date.now() + this.options.cacheTTL
154
+ });
155
+ }
156
+ }
157
+ clearCache() {
158
+ this.cache.clear();
159
+ }
160
+ setHeaders(headers) {
161
+ this.options.headers = { ...this.options.headers, ...headers };
162
+ }
163
+ }
164
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../core/src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAwBH;;GAEG;AACH,MAAM,OAAO,aAAa;IAChB,KAAK,GAAG,IAAI,GAAG,EAA0C,CAAC;IAC1D,OAAO,CAA0B;IAEzC,YAAY,OAAsB;QAChC,IAAI,CAAC,OAAO,GAAG;YACb,QAAQ,EAAE,OAAO,CAAC,QAAQ;YAC1B,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,mBAAmB,EAAE,OAAO;gBAC5B,GAAG,CAAC,OAAO,CAAC,OAAO,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
1
+ /**
2
+ * QuickQL Core SDK
3
+ *
4
+ * Shared logic and client for the QuickQL ecosystem.
5
+ * Managed by Udinmo Inc.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ export * from './types';
12
+ export * from './client';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../core/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * QuickQL Core SDK
3
+ *
4
+ * Shared logic and client for the QuickQL ecosystem.
5
+ * Managed by Udinmo Inc.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ export * from './types';
12
+ export * from './client';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../core/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * QuickQL Core Types
3
+ *
4
+ * Shared type definitions for queries, mutations, and responses.
5
+ * Ensured parity between server and client expectations.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ /**
12
+ * QuickQL Core Types - Refined for Production
13
+ */
14
+ export type Operator = 'eq' | 'ne' | 'gt' | 'lt' | 'in' | 'contains' | 'startsWith' | 'endsWith';
15
+ export type WhereValue = string | number | boolean | Array<string | number | boolean> | null;
16
+ export type WhereCondition = {
17
+ [operator in Operator]?: WhereValue;
18
+ } | WhereValue;
19
+ export type LogicalCondition = {
20
+ AND?: (WhereClause | LogicalCondition)[];
21
+ OR?: (WhereClause | LogicalCondition)[];
22
+ };
23
+ export type WhereClause = {
24
+ [field: string]: WhereCondition | LogicalCondition;
25
+ };
26
+ export type IncludeClause = {
27
+ [relation: string]: Partial<Query>;
28
+ };
29
+ export type OrderDirection = 'asc' | 'desc';
30
+ export type OrderBy = {
31
+ [field: string]: OrderDirection;
32
+ };
33
+ export interface Query {
34
+ from: string;
35
+ select?: string[];
36
+ alias?: string;
37
+ where?: WhereClause | LogicalCondition;
38
+ include?: IncludeClause;
39
+ limit?: number;
40
+ offset?: number;
41
+ orderBy?: OrderBy;
42
+ aggregate?: {
43
+ count?: boolean;
44
+ sum?: string;
45
+ avg?: string;
46
+ max?: string;
47
+ min?: string;
48
+ };
49
+ directives?: Record<string, any>;
50
+ }
51
+ export type MutationType = 'create' | 'update' | 'delete';
52
+ export interface Mutation {
53
+ type: MutationType;
54
+ collection: string;
55
+ data?: Record<string, unknown>;
56
+ where?: WhereClause | LogicalCondition;
57
+ select?: string[];
58
+ }
59
+ export interface QuickQLRequest {
60
+ queries?: Record<string, Query>;
61
+ mutations?: Record<string, Mutation>;
62
+ batch?: (Query | Mutation)[];
63
+ transaction?: boolean;
64
+ }
65
+ export interface QuickQLError {
66
+ type: 'VALIDATION' | 'NETWORK' | 'AUTH' | 'INTERNAL' | 'NOT_FOUND' | 'SECURITY';
67
+ message: string;
68
+ code?: string;
69
+ path?: string[];
70
+ stack?: string;
71
+ }
72
+ export interface QuickQLResponse<T = unknown> {
73
+ data: T | null;
74
+ errors?: QuickQLError[];
75
+ meta?: {
76
+ count?: number;
77
+ total?: number;
78
+ executionTime?: number;
79
+ hints?: string[];
80
+ };
81
+ }
82
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../core/src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GAS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IAAI,CAAC;IACf,MAAM,CAAC,EAAE,YAAY,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;KAClB,CAAC;CACH"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * QuickQL Core Types
3
+ *
4
+ * Shared type definitions for queries, mutations, and responses.
5
+ * Ensured parity between server and client expectations.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ export {};
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../core/src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * QuickQL Vue Bindings
3
+ *
4
+ * Provides Vue 3 Composition API utilities (useQuickQL) and Plugin
5
+ * integration (createQuickQL) for reactive data fetching in Vue applications.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ import { QuickQLClient, ClientOptions, QuickQLError } from '@quickql/core';
12
+ /**
13
+ * Universal QuickQL Plugin for Vue Apps
14
+ */
15
+ export declare const createQuickQL: (options: ClientOptions | QuickQLClient) => {
16
+ install(app: any): void;
17
+ client: QuickQLClient;
18
+ };
19
+ export declare const useQuickQLClient: () => QuickQLClient;
20
+ /**
21
+ * Hook to fetch data in Vue Components using Composition API.
22
+ */
23
+ export declare const useQuickQL: <T = any>(query: any, config?: {
24
+ enabled?: boolean;
25
+ }) => {
26
+ data: [T | null] extends [import("vue").Ref<any, any>] ? import("@vue/shared").IfAny<import("vue").Ref<any, any> & T, import("vue").Ref<import("vue").Ref<any, any> & T, import("vue").Ref<any, any> & T>, import("vue").Ref<any, any> & T> : import("vue").Ref<import("vue").UnwrapRef<T> | null, T | import("vue").UnwrapRef<T> | null>;
27
+ loading: import("vue").Ref<boolean, boolean>;
28
+ error: import("vue").Ref<{
29
+ type: "VALIDATION" | "NETWORK" | "AUTH" | "INTERNAL" | "NOT_FOUND" | "SECURITY";
30
+ message: string;
31
+ code?: string | undefined;
32
+ path?: string[] | undefined;
33
+ stack?: string | undefined;
34
+ }[] | null, QuickQLError[] | {
35
+ type: "VALIDATION" | "NETWORK" | "AUTH" | "INTERNAL" | "NOT_FOUND" | "SECURITY";
36
+ message: string;
37
+ code?: string | undefined;
38
+ path?: string[] | undefined;
39
+ stack?: string | undefined;
40
+ }[] | null>;
41
+ refetch: () => Promise<void>;
42
+ };
43
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,aAAa,EAAE,aAAa,EAA0B,YAAY,EAAE,MAAM,eAAe,CAAC;AAInG;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,aAAa,GAAG,aAAa;iBAInD,GAAG;;CAKnB,CAAC;AAEF,eAAO,MAAM,gBAAgB,qBAM5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,CAAC,GAAG,GAAG,EAAE,OAAO,GAAG,EAAE,SAAQ;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAO;;;;;;;;;;;;;;;;;CAoCjF,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * QuickQL Vue Bindings
3
+ *
4
+ * Provides Vue 3 Composition API utilities (useQuickQL) and Plugin
5
+ * integration (createQuickQL) for reactive data fetching in Vue applications.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+ import { ref, watch, inject, isRef } from 'vue';
12
+ import { QuickQLClient } from '@quickql/core';
13
+ const QUICKQL_CLIENT_KEY = Symbol('quickql-client');
14
+ /**
15
+ * Universal QuickQL Plugin for Vue Apps
16
+ */
17
+ export const createQuickQL = (options) => {
18
+ const client = options instanceof QuickQLClient ? options : new QuickQLClient(options);
19
+ return {
20
+ install(app) {
21
+ app.provide(QUICKQL_CLIENT_KEY, client);
22
+ },
23
+ client
24
+ };
25
+ };
26
+ export const useQuickQLClient = () => {
27
+ const client = inject(QUICKQL_CLIENT_KEY);
28
+ if (!client) {
29
+ throw new Error('useQuickQL must be used with a QuickQL instance installed via app.use().');
30
+ }
31
+ return client;
32
+ };
33
+ /**
34
+ * Hook to fetch data in Vue Components using Composition API.
35
+ */
36
+ export const useQuickQL = (query, config = {}) => {
37
+ const client = useQuickQLClient();
38
+ const data = ref(null);
39
+ const loading = ref(false);
40
+ const error = ref(null);
41
+ const fetchData = async () => {
42
+ // Resolve query value if it's a function or a Ref
43
+ const q = isRef(query) ? query.value : (typeof query === 'function' ? query() : query);
44
+ if (!q)
45
+ return;
46
+ loading.value = true;
47
+ error.value = null;
48
+ try {
49
+ const response = await client.query(q);
50
+ if (response.errors) {
51
+ error.value = response.errors;
52
+ }
53
+ else {
54
+ data.value = response.data;
55
+ }
56
+ }
57
+ catch (e) {
58
+ error.value = [{ type: 'INTERNAL', message: e.message || 'Vue Hook Error' }];
59
+ }
60
+ finally {
61
+ loading.value = false;
62
+ }
63
+ };
64
+ // Watch for changes in the query or enabled status
65
+ watch([() => (isRef(query) ? query.value : (typeof query === 'function' ? query() : query)), () => config.enabled], () => {
66
+ if (config.enabled !== false) {
67
+ fetchData();
68
+ }
69
+ }, { immediate: true, deep: true });
70
+ return { data, loading, error, refetch: fetchData };
71
+ };
72
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.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,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IAEpC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AACtD,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@quickql/vue",
3
+ "version": "1.0.0",
4
+ "description": "Vue 3 Composition API for QuickQL by Udinmo Inc.",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "author": "Udinmo Inc. <engineering@udinmo.com>",
8
+ "license": "MIT",
9
+ "scripts": {
10
+ "build": "tsc"
11
+ },
12
+ "dependencies": {
13
+ "@quickql/core": "^1.0.0"
14
+ },
15
+ "peerDependencies": {
16
+ "vue": "^3.x"
17
+ }
18
+ }
package/src/index.ts ADDED
@@ -0,0 +1,78 @@
1
+ /**
2
+ * QuickQL Vue Bindings
3
+ *
4
+ * Provides Vue 3 Composition API utilities (useQuickQL) and Plugin
5
+ * integration (createQuickQL) for reactive data fetching in Vue applications.
6
+ *
7
+ * (c) 2024-2026 Udinmo Inc. All rights reserved.
8
+ * Author: Udinmo Inc. <engineering@udinmo.com>
9
+ * License: MIT
10
+ */
11
+
12
+ import { ref, watch, onUnmounted, InjectionKey, inject, provide, onMounted, computed, isRef } from 'vue';
13
+ import { QuickQLClient, ClientOptions, Query, QuickQLResponse, QuickQLError } from '@quickql/core';
14
+
15
+ const QUICKQL_CLIENT_KEY = Symbol('quickql-client') as InjectionKey<QuickQLClient>;
16
+
17
+ /**
18
+ * Universal QuickQL Plugin for Vue Apps
19
+ */
20
+ export const createQuickQL = (options: ClientOptions | QuickQLClient) => {
21
+ const client = options instanceof QuickQLClient ? options : new QuickQLClient(options);
22
+
23
+ return {
24
+ install(app: any) {
25
+ app.provide(QUICKQL_CLIENT_KEY, client);
26
+ },
27
+ client
28
+ };
29
+ };
30
+
31
+ export const useQuickQLClient = () => {
32
+ const client = inject(QUICKQL_CLIENT_KEY);
33
+ if (!client) {
34
+ throw new Error('useQuickQL must be used with a QuickQL instance installed via app.use().');
35
+ }
36
+ return client;
37
+ };
38
+
39
+ /**
40
+ * Hook to fetch data in Vue Components using Composition API.
41
+ */
42
+ export const useQuickQL = <T = any>(query: any, config: { enabled?: boolean } = {}) => {
43
+ const client = useQuickQLClient();
44
+
45
+ const data = ref<T | null>(null);
46
+ const loading = ref(false);
47
+ const error = ref<QuickQLError[] | null>(null);
48
+
49
+ const fetchData = async () => {
50
+ // Resolve query value if it's a function or a Ref
51
+ const q = isRef(query) ? query.value : (typeof query === 'function' ? query() : query);
52
+ if (!q) return;
53
+
54
+ loading.value = true;
55
+ error.value = null;
56
+ try {
57
+ const response = await client.query<T>(q);
58
+ if (response.errors) {
59
+ error.value = response.errors;
60
+ } else {
61
+ data.value = response.data;
62
+ }
63
+ } catch (e: any) {
64
+ error.value = [{ type: 'INTERNAL', message: e.message || 'Vue Hook Error' }];
65
+ } finally {
66
+ loading.value = false;
67
+ }
68
+ };
69
+
70
+ // Watch for changes in the query or enabled status
71
+ watch([() => (isRef(query) ? query.value : (typeof query === 'function' ? query() : query)), () => config.enabled], () => {
72
+ if (config.enabled !== false) {
73
+ fetchData();
74
+ }
75
+ }, { immediate: true, deep: true });
76
+
77
+ return { data, loading, error, refetch: fetchData };
78
+ };
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.json",
3
+ "compilerOptions": {
4
+ "outDir": "./dist"
5
+ },
6
+ "include": ["src"]
7
+ }