@nx-ddd/hasura 19.0.0-preview.8 → 19.1.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.
- package/apollo/link/index.d.ts +31 -0
- package/browser/index.d.ts +8 -0
- package/fesm2022/nx-ddd-hasura-apollo-link.mjs +77 -0
- package/fesm2022/nx-ddd-hasura-apollo-link.mjs.map +1 -0
- package/fesm2022/nx-ddd-hasura-browser.mjs +19 -0
- package/fesm2022/nx-ddd-hasura-browser.mjs.map +1 -0
- package/fesm2022/nx-ddd-hasura-server.mjs +19 -0
- package/fesm2022/nx-ddd-hasura-server.mjs.map +1 -0
- package/fesm2022/nx-ddd-hasura.mjs +880 -0
- package/fesm2022/nx-ddd-hasura.mjs.map +1 -0
- package/index.d.ts +391 -0
- package/package.json +32 -6
- package/server/index.d.ts +8 -0
- package/README.md +0 -11
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -5
- package/src/index.js.map +0 -1
- package/src/lib/apollo-multi.service.d.ts +0 -23
- package/src/lib/apollo-multi.service.js +0 -52
- package/src/lib/apollo-multi.service.js.map +0 -1
- package/src/lib/decorators.d.ts +0 -35
- package/src/lib/decorators.js +0 -50
- package/src/lib/decorators.js.map +0 -1
- package/src/lib/hasura.config.d.ts +0 -8
- package/src/lib/hasura.config.js +0 -15
- package/src/lib/hasura.config.js.map +0 -1
- package/src/lib/hasura.converter.d.ts +0 -24
- package/src/lib/hasura.converter.js +0 -82
- package/src/lib/hasura.converter.js.map +0 -1
- package/src/lib/hasura.di.d.ts +0 -33
- package/src/lib/hasura.di.js +0 -79
- package/src/lib/hasura.di.js.map +0 -1
- package/src/lib/hasura.interceptor.d.ts +0 -6
- package/src/lib/hasura.interceptor.js +0 -24
- package/src/lib/hasura.interceptor.js.map +0 -1
- package/src/lib/hasura.repository.d.ts +0 -40
- package/src/lib/hasura.repository.js +0 -261
- package/src/lib/hasura.repository.js.map +0 -1
- package/src/lib/hasura.service.d.ts +0 -18
- package/src/lib/hasura.service.js +0 -49
- package/src/lib/hasura.service.js.map +0 -1
- package/src/lib/index.d.ts +0 -8
- package/src/lib/index.js +0 -12
- package/src/lib/index.js.map +0 -1
- package/src/lib/links.d.ts +0 -7
- package/src/lib/links.js +0 -23
- package/src/lib/links.js.map +0 -1
package/index.d.ts
ADDED
|
@@ -0,0 +1,391 @@
|
|
|
1
|
+
import * as _nx_ddd_core from '@nx-ddd/core';
|
|
2
|
+
import { ApolloClient, ApolloLink, InMemoryCache, OperationVariables, FetchPolicy, FetchResult, ApolloQueryResult } from '@apollo/client/core';
|
|
3
|
+
import { ApolloLinkService as ApolloLinkService$1, GetHeaders as GetHeaders$1 } from '@nx-ddd/hasura/apollo/link';
|
|
4
|
+
import * as apollo_angular from 'apollo-angular';
|
|
5
|
+
import { Apollo, ApolloBase } from 'apollo-angular';
|
|
6
|
+
import { Observable } from 'rxjs';
|
|
7
|
+
import * as i0 from '@angular/core';
|
|
8
|
+
import { InjectionToken, Provider, EnvironmentProviders } from '@angular/core';
|
|
9
|
+
import { HttpLink } from 'apollo-angular/http';
|
|
10
|
+
import { Type, Repository } from '@nx-ddd/common/domain';
|
|
11
|
+
export { DeepPartial, TransformToDayjs } from '@nx-ddd/common/domain';
|
|
12
|
+
import dayjs from 'dayjs';
|
|
13
|
+
import { HttpInterceptor, HttpRequest, HttpHandler, HttpEvent } from '@angular/common/http';
|
|
14
|
+
import * as _nx_ddd_hasura from '@nx-ddd/hasura';
|
|
15
|
+
import * as lodash from 'lodash';
|
|
16
|
+
export { IsDayjs } from 'class-validator-extended';
|
|
17
|
+
|
|
18
|
+
interface HasuraConfig {
|
|
19
|
+
adminSecret?: string;
|
|
20
|
+
url: string;
|
|
21
|
+
}
|
|
22
|
+
declare const HASURA_CONFIG: InjectionToken<HasuraConfig>;
|
|
23
|
+
declare function provideHasuraConfig(config: HasuraConfig): Provider[];
|
|
24
|
+
|
|
25
|
+
/** @deprecated use ApolloClientManagerService instead */
|
|
26
|
+
declare class ApolloMultiService {
|
|
27
|
+
readonly apollo: Apollo;
|
|
28
|
+
protected readonly linkService: ApolloLinkService$1;
|
|
29
|
+
protected createClient(name: string, baseUrl: string, getHeaders: GetHeaders$1): void;
|
|
30
|
+
getClient(endpoint: string, getHeaders: GetHeaders$1): ApolloBase;
|
|
31
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApolloMultiService, never>;
|
|
32
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ApolloMultiService>;
|
|
33
|
+
}
|
|
34
|
+
type GetApolloClient<E extends {
|
|
35
|
+
id: string;
|
|
36
|
+
}> = (config: HasuraConfig) => ApolloClient | Promise<ApolloClient> | Observable<ApolloClient>;
|
|
37
|
+
declare const GET_APOLLO_CLIENT: _nx_ddd_core.DiToken<GetApolloClient<any>>;
|
|
38
|
+
|
|
39
|
+
type PromiseOrObservable$1<T> = Promise<T> | Observable<T> | T;
|
|
40
|
+
type GetHeaders = () => PromiseOrObservable$1<Record<string, string>>;
|
|
41
|
+
declare function wrap<T>(obsOrPromiseOrValue: Promise<T> | Observable<T> | T): Observable<T>;
|
|
42
|
+
declare function resolve(getHeaders: GetHeaders): Promise<Record<string, string>>;
|
|
43
|
+
|
|
44
|
+
declare class ApolloLinkService {
|
|
45
|
+
readonly httpLink: HttpLink;
|
|
46
|
+
readonly WebSocketImpl: {
|
|
47
|
+
new (url: string | URL, protocols?: string | string[]): WebSocket;
|
|
48
|
+
prototype: WebSocket;
|
|
49
|
+
readonly CONNECTING: 0;
|
|
50
|
+
readonly OPEN: 1;
|
|
51
|
+
readonly CLOSING: 2;
|
|
52
|
+
readonly CLOSED: 3;
|
|
53
|
+
};
|
|
54
|
+
private createGraphQLWsClient;
|
|
55
|
+
createHttpLink(baseUrl: string, getHeaders: GetHeaders): ApolloLink;
|
|
56
|
+
createWebSocketLink(baseUrl: string, getHeaders: GetHeaders): ApolloLink;
|
|
57
|
+
createAutoSplitLink(baseUrl: string, getHeaders: GetHeaders): ApolloLink;
|
|
58
|
+
createLink(baseUrl: string, getHeaders: GetHeaders): ApolloLink;
|
|
59
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApolloLinkService, never>;
|
|
60
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ApolloLinkService>;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
declare class ApolloClientManagerService {
|
|
64
|
+
readonly apollo: Apollo;
|
|
65
|
+
protected readonly linkService: ApolloLinkService;
|
|
66
|
+
protected readonly crypto: webcrypto.Crypto;
|
|
67
|
+
protected buildClientName(endpoint: string, headers: Record<string, string>): Promise<string>;
|
|
68
|
+
getClient(endpoint: string, getHeaders: GetHeaders): Observable<ApolloBase<any>>;
|
|
69
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<ApolloClientManagerService, never>;
|
|
70
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<ApolloClientManagerService>;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
interface HasuraConverter<E> {
|
|
74
|
+
toHasura(entity: E): object;
|
|
75
|
+
toHasuraMany(entities: E[]): object[];
|
|
76
|
+
fromHasura(entity: object): E;
|
|
77
|
+
fromHasuraMany(entities: object[]): E[];
|
|
78
|
+
}
|
|
79
|
+
type CamelToSnakeCase<S extends string> = S extends `${infer T}${infer U}` ? U extends Uncapitalize<U> ? `${Lowercase<T>}${CamelToSnakeCase<U>}` : `${Lowercase<T>}_${CamelToSnakeCase<U>}` : S;
|
|
80
|
+
type DeepCamelToSnake<T> = T extends Date ? T : T extends Array<infer U> ? DeepCamelToSnake<U>[] : T extends object ? {
|
|
81
|
+
[K in keyof T as K extends string ? CamelToSnakeCase<K> : K]: DeepCamelToSnake<T[K]>;
|
|
82
|
+
} : T;
|
|
83
|
+
declare function deepCamelToSnakeCase<T>(obj: T): DeepCamelToSnake<T>;
|
|
84
|
+
type SnakeToCamelCase<S extends string> = S extends `${infer T}_${infer U}` ? `${T}${Capitalize<SnakeToCamelCase<U>>}` : S;
|
|
85
|
+
type DeepSnakeToCamel<T> = T extends Date ? T : T extends Array<infer U> ? DeepSnakeToCamel<U>[] : T extends object ? {
|
|
86
|
+
[K in keyof T as K extends string ? SnakeToCamelCase<K> : K]: DeepSnakeToCamel<T[K]>;
|
|
87
|
+
} : T;
|
|
88
|
+
declare function deepSnakeToCamelCase<T>(obj: T): DeepSnakeToCamel<T>;
|
|
89
|
+
declare function getConverter<T>(type: Type<T>): HasuraConverter<T>;
|
|
90
|
+
/** @deprecated use `getConverter` instead */
|
|
91
|
+
declare const makeConverter: typeof getConverter;
|
|
92
|
+
declare class HasuraUtils {
|
|
93
|
+
static toTimestamp(date: dayjs.Dayjs | Date | null): string | null;
|
|
94
|
+
static toDate(date: dayjs.Dayjs | Date | string | null | undefined): string | null | undefined;
|
|
95
|
+
static fromHasura<T>(_object: any, type: Type<T>): T;
|
|
96
|
+
static toNumber(value: any): number | null | undefined;
|
|
97
|
+
static toHasuraLocation(position: {
|
|
98
|
+
lat: number;
|
|
99
|
+
lng: number;
|
|
100
|
+
} | null | undefined): {
|
|
101
|
+
type: string;
|
|
102
|
+
crs: {
|
|
103
|
+
type: string;
|
|
104
|
+
properties: {
|
|
105
|
+
name: string;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
coordinates: number[];
|
|
109
|
+
};
|
|
110
|
+
static fromHasuraLocation(location: {
|
|
111
|
+
type: 'Point';
|
|
112
|
+
crs: {
|
|
113
|
+
type: 'name';
|
|
114
|
+
properties: {
|
|
115
|
+
name: 'urn:ogc:def:crs:EPSG::4326';
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
coordinates: [number, number];
|
|
119
|
+
}): {
|
|
120
|
+
lat: number;
|
|
121
|
+
lng: number;
|
|
122
|
+
};
|
|
123
|
+
static toHasura<E>(object: E, type: Type<E>, { extraFunc }?: {
|
|
124
|
+
extraFunc?: (obj: any) => any;
|
|
125
|
+
}): any;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
declare function getFieldAnnotationMap<Annotation>(T: any, prefix?: string): Record<string, Annotation>;
|
|
129
|
+
declare function getFlattenFieldAnnotations<Annotation>(T: any, prefix?: string): Record<string, Annotation>;
|
|
130
|
+
declare function getFields(T: any, options?: {
|
|
131
|
+
prefix?: string;
|
|
132
|
+
case?: 'snake' | 'camel';
|
|
133
|
+
}): string[];
|
|
134
|
+
declare function getTableName(target: any): string;
|
|
135
|
+
declare const Hasura: {
|
|
136
|
+
Table: (nameOrProps: {
|
|
137
|
+
name: string;
|
|
138
|
+
} | string) => (target: any) => void;
|
|
139
|
+
Text: (nameOrProps?: {
|
|
140
|
+
name?: string;
|
|
141
|
+
} | string) => (target: any, propName: string) => void;
|
|
142
|
+
Timestamp: (nameOrProps?: {
|
|
143
|
+
name?: string;
|
|
144
|
+
} | string) => (target: any, propName: string) => void;
|
|
145
|
+
Date: (nameOrProps?: {
|
|
146
|
+
name?: string;
|
|
147
|
+
} | string) => (target: any, propName: string) => void;
|
|
148
|
+
Integer: (nameOrProps?: {
|
|
149
|
+
name?: string;
|
|
150
|
+
} | string) => (target: any, propName: string) => void;
|
|
151
|
+
Numeric: (nameOrProps?: {
|
|
152
|
+
name?: string;
|
|
153
|
+
} | string) => (target: any, propName: string) => void;
|
|
154
|
+
Boolean: (nameOrProps?: {
|
|
155
|
+
name?: string;
|
|
156
|
+
} | string) => (target: any, propName: string) => void;
|
|
157
|
+
Map: (childType: () => any) => (target: any, propName: string) => void;
|
|
158
|
+
JSON: (nameOrProps?: {
|
|
159
|
+
name?: string;
|
|
160
|
+
} | string) => (target: any, propName: string) => void;
|
|
161
|
+
Location: (nameOrProps?: {
|
|
162
|
+
name?: string;
|
|
163
|
+
} | string) => (target: any, propName: string) => void;
|
|
164
|
+
getAnnotations: (target: any) => {
|
|
165
|
+
type: string;
|
|
166
|
+
fieldName: string;
|
|
167
|
+
propName: string;
|
|
168
|
+
childType: any;
|
|
169
|
+
}[];
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
type PromiseOrObservable<T> = Promise<T> | Observable<T> | T;
|
|
173
|
+
declare const GRAPHQL_HEADERS: InjectionToken<GetHeaders>;
|
|
174
|
+
declare function provideHasuraGetHeaders(useFactory: () => () => PromiseOrObservable<Record<string, string>>): Provider;
|
|
175
|
+
/**
|
|
176
|
+
* @deprecated use provideHasuraGetHeaders instead
|
|
177
|
+
*/
|
|
178
|
+
declare const provideGraphqlHeaders: typeof provideHasuraGetHeaders;
|
|
179
|
+
declare function provideApolloOptions(): {
|
|
180
|
+
provide: InjectionToken<any>;
|
|
181
|
+
useFactory: (link: ApolloLink) => {
|
|
182
|
+
cache: InMemoryCache;
|
|
183
|
+
link: ApolloLink;
|
|
184
|
+
};
|
|
185
|
+
deps: (typeof ApolloLink)[];
|
|
186
|
+
};
|
|
187
|
+
declare function provideHasura(config: HasuraConfig): (Provider | EnvironmentProviders)[];
|
|
188
|
+
declare function provideHasuraWithWebSocket(config: HasuraConfig): (Provider | EnvironmentProviders)[];
|
|
189
|
+
|
|
190
|
+
declare class HasuraInterceptor implements HttpInterceptor {
|
|
191
|
+
private config;
|
|
192
|
+
intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>>;
|
|
193
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HasuraInterceptor, never>;
|
|
194
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HasuraInterceptor>;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
interface TransactionQueryPart {
|
|
198
|
+
queryPart: string;
|
|
199
|
+
variableDefinitions: string[];
|
|
200
|
+
variables: Record<string, any>;
|
|
201
|
+
operationName: string;
|
|
202
|
+
alias?: string;
|
|
203
|
+
}
|
|
204
|
+
interface TableConfig {
|
|
205
|
+
tableName: string;
|
|
206
|
+
columns: string[];
|
|
207
|
+
pk: string;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
type CreateData<E> = Omit<E, 'id' | 'createdAt' | 'updatedAt'>;
|
|
211
|
+
declare class CreateMutationBuilder<E extends {
|
|
212
|
+
id: string;
|
|
213
|
+
}> {
|
|
214
|
+
protected readonly config: TableConfig;
|
|
215
|
+
constructor(config: TableConfig);
|
|
216
|
+
build(data: CreateData<E>, alias?: string): TransactionQueryPart;
|
|
217
|
+
buildMany(data: CreateData<E>[], alias?: string): TransactionQueryPart;
|
|
218
|
+
protected convertToObject(item: CreateData<E>): lodash.Dictionary<unknown>;
|
|
219
|
+
protected convertToObjects(items: CreateData<E>[]): lodash.Dictionary<unknown>[];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
declare class DeleteMutationBuilder {
|
|
223
|
+
protected readonly config: TableConfig;
|
|
224
|
+
constructor(config: TableConfig);
|
|
225
|
+
build({ id }: {
|
|
226
|
+
id: any;
|
|
227
|
+
}): TransactionQueryPart;
|
|
228
|
+
buildMany(params: {
|
|
229
|
+
id: string;
|
|
230
|
+
}[], alias?: string): TransactionQueryPart;
|
|
231
|
+
buildAll(alias?: string): TransactionQueryPart;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
interface Options {
|
|
235
|
+
operationName?: string;
|
|
236
|
+
constraint?: string;
|
|
237
|
+
columns?: string[];
|
|
238
|
+
returningColumns?: string[];
|
|
239
|
+
alias?: string;
|
|
240
|
+
}
|
|
241
|
+
declare class SaveMutationBuilder<E = any> {
|
|
242
|
+
protected readonly config: TableConfig;
|
|
243
|
+
constructor(config: TableConfig);
|
|
244
|
+
build(data: Omit<E, 'createdAt' | 'updatedAt'>, { operationName, constraint, columns, returningColumns, alias, }?: Options): TransactionQueryPart;
|
|
245
|
+
buildMany(entities: E[], { operationName, constraint, columns, returningColumns, alias }?: Options): TransactionQueryPart;
|
|
246
|
+
protected buildObject(item: Omit<E, 'createdAt' | 'updatedAt'>): lodash.Dictionary<unknown>;
|
|
247
|
+
protected buildObjects(items: Omit<E, 'createdAt' | 'updatedAt'>[]): lodash.Dictionary<unknown>[];
|
|
248
|
+
protected buildOnConflict(data: Omit<E, 'createdAt' | 'updatedAt'>, constraint: string, columns: string[]): {
|
|
249
|
+
constraint: string;
|
|
250
|
+
update_columns: string[];
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare class UpdateMutationBuilder<E extends {
|
|
255
|
+
id: string;
|
|
256
|
+
} = any> {
|
|
257
|
+
protected readonly config: TableConfig;
|
|
258
|
+
constructor(config: TableConfig);
|
|
259
|
+
build(data: Partial<E> & {
|
|
260
|
+
id: string;
|
|
261
|
+
}, alias?: string): TransactionQueryPart;
|
|
262
|
+
buildMany(data: Partial<E>[], alias?: string): TransactionQueryPart;
|
|
263
|
+
protected buildObject(item: Partial<E>): any;
|
|
264
|
+
protected buildObjects(items: Partial<E>[]): any[];
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
declare class HasuraMutationBuilder<E extends {
|
|
268
|
+
id: string;
|
|
269
|
+
}> {
|
|
270
|
+
readonly create: CreateMutationBuilder<E>;
|
|
271
|
+
readonly update: UpdateMutationBuilder<E>;
|
|
272
|
+
readonly save: SaveMutationBuilder<E>;
|
|
273
|
+
readonly delete_: DeleteMutationBuilder;
|
|
274
|
+
constructor(config: TableConfig);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
declare class GetQueryPartBuilder {
|
|
278
|
+
protected config: TableConfig;
|
|
279
|
+
constructor(config: TableConfig);
|
|
280
|
+
build(params: {
|
|
281
|
+
id: string;
|
|
282
|
+
}): TransactionQueryPart;
|
|
283
|
+
buildMany(): TransactionQueryPart;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
declare class QueriesBuilder<E extends {
|
|
287
|
+
id: string;
|
|
288
|
+
}> {
|
|
289
|
+
readonly get: GetQueryPartBuilder;
|
|
290
|
+
constructor(config: TableConfig);
|
|
291
|
+
makeSubscription(query: any): {
|
|
292
|
+
kind: any;
|
|
293
|
+
definitions: any;
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
declare class HasuraQueryPartsBuilder<E extends {
|
|
298
|
+
id: string;
|
|
299
|
+
}> {
|
|
300
|
+
readonly mutations: HasuraMutationBuilder<E>;
|
|
301
|
+
readonly queries: QueriesBuilder<E>;
|
|
302
|
+
constructor(config: TableConfig);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
declare class HasuraQueryBuilder<E extends {
|
|
306
|
+
id: string;
|
|
307
|
+
}> {
|
|
308
|
+
readonly parts: HasuraQueryPartsBuilder<E>;
|
|
309
|
+
constructor(config: TableConfig);
|
|
310
|
+
buildQuery(part: TransactionQueryPart): string;
|
|
311
|
+
static buildMutation(part: TransactionQueryPart): string;
|
|
312
|
+
buildMutation(part: TransactionQueryPart): string;
|
|
313
|
+
buildTransactionQuery(parts: TransactionQueryPart[]): {
|
|
314
|
+
query: string;
|
|
315
|
+
variables: Record<string, any>;
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
declare class HasuraService {
|
|
320
|
+
protected readonly getHeaders: _nx_ddd_hasura.GetHeaders;
|
|
321
|
+
protected readonly apolloClientManager: ApolloClientManagerService;
|
|
322
|
+
protected readonly config: HasuraConfig;
|
|
323
|
+
getApolloClient(): Observable<ApolloBase<any>>;
|
|
324
|
+
subscribe<T = any, TVariables extends OperationVariables = OperationVariables>({ query, variables, fetchPolicy, context }: {
|
|
325
|
+
query: any;
|
|
326
|
+
variables: TVariables;
|
|
327
|
+
fetchPolicy?: FetchPolicy;
|
|
328
|
+
context?: Record<string, unknown>;
|
|
329
|
+
}): Observable<FetchResult<T>>;
|
|
330
|
+
mutate<T = any>(...args: Parameters<ApolloBase['mutate']>): Promise<apollo_angular.MutationResult<unknown>>;
|
|
331
|
+
mutateByQueryPart<T = any>(part: TransactionQueryPart): Promise<T>;
|
|
332
|
+
query<T = any>(...args: Parameters<ApolloBase['query']>): Promise<ApolloQueryResult<T>>;
|
|
333
|
+
watchQuery<T = any, TVariables extends OperationVariables = OperationVariables>(options: {
|
|
334
|
+
query: any;
|
|
335
|
+
variables?: TVariables;
|
|
336
|
+
fetchPolicy?: FetchPolicy;
|
|
337
|
+
}): Observable<any>;
|
|
338
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HasuraService, never>;
|
|
339
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HasuraService>;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
declare abstract class _HasuraRepository<E extends {
|
|
343
|
+
id: string;
|
|
344
|
+
}> extends Repository<E> {
|
|
345
|
+
protected abstract hasura: HasuraService;
|
|
346
|
+
protected abstract converter: HasuraConverter<E>;
|
|
347
|
+
readonly abstract updateColumns: string[];
|
|
348
|
+
readonly abstract tableName: string;
|
|
349
|
+
get pkey(): string;
|
|
350
|
+
getQueryBuilder(): HasuraQueryBuilder<{
|
|
351
|
+
id: string;
|
|
352
|
+
}>;
|
|
353
|
+
get(params: {
|
|
354
|
+
id: string;
|
|
355
|
+
}): Promise<E>;
|
|
356
|
+
list(): Promise<E[]>;
|
|
357
|
+
listChanges(): Observable<E[]>;
|
|
358
|
+
create(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'> & Partial<Pick<E, 'id'>>): Promise<E>;
|
|
359
|
+
createMany(data: Omit<E, 'id' | 'createdAt' | 'updatedAt'>[]): Promise<E[]>;
|
|
360
|
+
update(data: Partial<E> & {
|
|
361
|
+
id: string;
|
|
362
|
+
}): Promise<void>;
|
|
363
|
+
updateMany(data: Partial<E>[]): Promise<void>;
|
|
364
|
+
delete(params: {
|
|
365
|
+
id: string;
|
|
366
|
+
}): Promise<void>;
|
|
367
|
+
deleteMany(params: {
|
|
368
|
+
id: string;
|
|
369
|
+
}[]): Promise<number>;
|
|
370
|
+
deleteAll(): Promise<void>;
|
|
371
|
+
save(data: Partial<E>): Promise<any>;
|
|
372
|
+
saveMany(entities: E[]): Promise<void>;
|
|
373
|
+
}
|
|
374
|
+
declare abstract class HasuraRepository<E extends {
|
|
375
|
+
id: string;
|
|
376
|
+
}> extends _HasuraRepository<E> {
|
|
377
|
+
protected hasura: HasuraService;
|
|
378
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<HasuraRepository<any>, never>;
|
|
379
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<HasuraRepository<any>>;
|
|
380
|
+
}
|
|
381
|
+
declare function getHasuraRepository<E extends {
|
|
382
|
+
id: string;
|
|
383
|
+
}>(Entity: Type<E>, deps: {
|
|
384
|
+
hasura: HasuraService;
|
|
385
|
+
}): _HasuraRepository<E>;
|
|
386
|
+
declare function injectHasuraRepository<E extends {
|
|
387
|
+
id: string;
|
|
388
|
+
}>(Entity: Type<E>): _HasuraRepository<E>;
|
|
389
|
+
|
|
390
|
+
export { ApolloClientManagerService, ApolloMultiService, GET_APOLLO_CLIENT, GRAPHQL_HEADERS, HASURA_CONFIG, Hasura, HasuraInterceptor, HasuraQueryBuilder, HasuraRepository, HasuraService, HasuraUtils, _HasuraRepository, deepCamelToSnakeCase, deepSnakeToCamelCase, getConverter, getFieldAnnotationMap, getFields, getFlattenFieldAnnotations, getHasuraRepository, getTableName, injectHasuraRepository, makeConverter, provideApolloOptions, provideGraphqlHeaders, provideHasura, provideHasuraConfig, provideHasuraGetHeaders, provideHasuraWithWebSocket, resolve, wrap };
|
|
391
|
+
export type { GetApolloClient, GetHeaders, HasuraConfig, HasuraConverter, TableConfig, TransactionQueryPart };
|
package/package.json
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx-ddd/hasura",
|
|
3
|
-
"version": "19.
|
|
4
|
-
"
|
|
5
|
-
"peerDependencies": {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
3
|
+
"version": "19.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"peerDependencies": {
|
|
6
|
+
"@nx-ddd/core": "19.1.0"
|
|
7
|
+
},
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"tslib": "^2.3.0"
|
|
10
|
+
},
|
|
11
|
+
"module": "fesm2022/nx-ddd-hasura.mjs",
|
|
12
|
+
"typings": "index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
"./package.json": {
|
|
15
|
+
"default": "./package.json"
|
|
16
|
+
},
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./index.d.ts",
|
|
19
|
+
"default": "./fesm2022/nx-ddd-hasura.mjs"
|
|
20
|
+
},
|
|
21
|
+
"./browser": {
|
|
22
|
+
"types": "./browser/index.d.ts",
|
|
23
|
+
"default": "./fesm2022/nx-ddd-hasura-browser.mjs"
|
|
24
|
+
},
|
|
25
|
+
"./server": {
|
|
26
|
+
"types": "./server/index.d.ts",
|
|
27
|
+
"default": "./fesm2022/nx-ddd-hasura-server.mjs"
|
|
28
|
+
},
|
|
29
|
+
"./apollo/link": {
|
|
30
|
+
"types": "./apollo/link/index.d.ts",
|
|
31
|
+
"default": "./fesm2022/nx-ddd-hasura-apollo-link.mjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": false
|
|
9
35
|
}
|
package/README.md
DELETED
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './lib';
|
package/src/index.js
DELETED
package/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/@nx-ddd/hasura/src/index.ts"],"names":[],"mappings":";;;AAAA,gDAAsB"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Apollo, ApolloBase } from "apollo-angular";
|
|
2
|
-
import { HasuraConfig } from "./hasura.config";
|
|
3
|
-
import { HttpLink } from 'apollo-angular/http';
|
|
4
|
-
import { ApolloClient } from "@apollo/client/core";
|
|
5
|
-
import { Observable } from "rxjs";
|
|
6
|
-
import { GetHeaders } from "./links";
|
|
7
|
-
export declare class ApolloMultiService {
|
|
8
|
-
readonly apollo: Apollo;
|
|
9
|
-
readonly httpLink: HttpLink;
|
|
10
|
-
protected createClient(name: string, baseUrl: string, getHeaders: GetHeaders): void;
|
|
11
|
-
getClient(endpoint: string, getHeaders: GetHeaders): ApolloBase;
|
|
12
|
-
}
|
|
13
|
-
export type GetApolloClient<E extends {
|
|
14
|
-
id: string;
|
|
15
|
-
}> = (config: HasuraConfig) => ApolloClient<E> | Promise<ApolloClient<E>> | Observable<ApolloClient<E>>;
|
|
16
|
-
export declare const GET_APOLLO_CLIENT: {
|
|
17
|
-
token: import("@angular/core").InjectionToken<GetApolloClient<any>>;
|
|
18
|
-
inject: () => GetApolloClient<any>;
|
|
19
|
-
provide: (useFactory: () => GetApolloClient<any>) => {
|
|
20
|
-
provide: import("@angular/core").InjectionToken<GetApolloClient<any>>;
|
|
21
|
-
useFactory: () => GetApolloClient<any>;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GET_APOLLO_CLIENT = exports.ApolloMultiService = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const core_1 = require("@angular/core");
|
|
6
|
-
const apollo_angular_1 = require("apollo-angular");
|
|
7
|
-
const http_1 = require("apollo-angular/http");
|
|
8
|
-
const cache_1 = require("@apollo/client/cache");
|
|
9
|
-
const context_1 = require("@apollo/client/link/context");
|
|
10
|
-
const core_2 = require("@apollo/client/core");
|
|
11
|
-
const utilities_1 = require("@apollo/client/utilities");
|
|
12
|
-
const core_3 = require("@nx-ddd/core");
|
|
13
|
-
const links_1 = require("./links");
|
|
14
|
-
function isSubscription(query) {
|
|
15
|
-
const definition = (0, utilities_1.getMainDefinition)(query);
|
|
16
|
-
return (definition.kind === 'OperationDefinition' &&
|
|
17
|
-
definition.operation === 'subscription');
|
|
18
|
-
}
|
|
19
|
-
let ApolloMultiService = class ApolloMultiService {
|
|
20
|
-
constructor() {
|
|
21
|
-
this.apollo = (0, core_1.inject)(apollo_angular_1.Apollo);
|
|
22
|
-
this.httpLink = (0, core_1.inject)(http_1.HttpLink);
|
|
23
|
-
}
|
|
24
|
-
createClient(name, baseUrl, getHeaders) {
|
|
25
|
-
const wsLink = (0, links_1.buildWebsocketLink)(baseUrl, getHeaders);
|
|
26
|
-
const link = (0, core_2.split)(({ query }) => isSubscription(query), wsLink, core_2.ApolloLink.from([
|
|
27
|
-
(0, context_1.setContext)(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
28
|
-
const headers = yield (0, links_1.resolve)(() => getHeaders());
|
|
29
|
-
return { headers };
|
|
30
|
-
})),
|
|
31
|
-
this.httpLink.create({ uri: baseUrl, }),
|
|
32
|
-
]));
|
|
33
|
-
this.apollo.removeClient(name);
|
|
34
|
-
this.apollo.createNamed(name, { link, cache: new cache_1.InMemoryCache() });
|
|
35
|
-
}
|
|
36
|
-
getClient(endpoint, getHeaders) {
|
|
37
|
-
const name = endpoint;
|
|
38
|
-
let client = this.apollo.use(name);
|
|
39
|
-
console.debug('[ApolloMultiService] getClient:', name);
|
|
40
|
-
if (!client) {
|
|
41
|
-
this.createClient(name, endpoint, getHeaders);
|
|
42
|
-
client = this.apollo.use(name);
|
|
43
|
-
}
|
|
44
|
-
return client;
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
exports.ApolloMultiService = ApolloMultiService;
|
|
48
|
-
exports.ApolloMultiService = ApolloMultiService = tslib_1.__decorate([
|
|
49
|
-
(0, core_1.Injectable)({ providedIn: 'root' })
|
|
50
|
-
], ApolloMultiService);
|
|
51
|
-
exports.GET_APOLLO_CLIENT = (0, core_3.makeDI)('GET_APOLLO_CLIENT');
|
|
52
|
-
//# sourceMappingURL=apollo-multi.service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"apollo-multi.service.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/hasura/src/lib/apollo-multi.service.ts"],"names":[],"mappings":";;;;AAAA,wCAAmD;AACnD,mDAAoD;AAEpD,8CAA+C;AAC/C,gDAAqD;AACrD,yDAAyD;AACzD,8CAAoF;AACpF,wDAA6D;AAC7D,uCAAsC;AAEtC,mCAAkE;AAElE,SAAS,cAAc,CAAC,KAAmB;IACzC,MAAM,UAAU,GAAG,IAAA,6BAAiB,EAAC,KAAK,CAAC,CAAC;IAC5C,OAAO,CACL,UAAU,CAAC,IAAI,KAAK,qBAAqB;QACzC,UAAU,CAAC,SAAS,KAAK,cAAc,CACxC,CAAC;AACJ,CAAC;AAGM,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QACI,WAAM,GAAG,IAAA,aAAM,EAAC,uBAAM,CAAC,CAAC;QACxB,aAAQ,GAAG,IAAA,aAAM,EAAC,eAAQ,CAAC,CAAC;IA8BvC,CAAC;IA5BW,YAAY,CAAC,IAAY,EAAE,OAAe,EAAE,UAAsB;QAC1E,MAAM,MAAM,GAAG,IAAA,0BAAkB,EAAC,OAAO,EAAE,UAAU,CAAC,CAAC;QACvD,MAAM,IAAI,GAAG,IAAA,YAAK,EAChB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,EACpC,MAAM,EACN,iBAAU,CAAC,IAAI,CAAC;YACd,IAAA,oBAAU,EAAC,GAAS,EAAE;gBACpB,MAAM,OAAO,GAAG,MAAM,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,CAAC;gBAClD,OAAO,EAAE,OAAO,EAAE,CAAA;YACpB,CAAC,CAAA,CAAC;YACF,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,CAAC;SACxC,CAAC,CACH,CAAC;QAEF,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,qBAAa,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,SAAS,CAAC,QAAgB,EAAE,UAAsB;QAChD,MAAM,IAAI,GAAG,QAAQ,CAAC;QACtB,IAAI,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;QACvD,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;YAC9C,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAA;AAhCY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,iBAAU,EAAC,EAAC,UAAU,EAAE,MAAM,EAAC,CAAC;GACpB,kBAAkB,CAgC9B;AAIY,QAAA,iBAAiB,GAAG,IAAA,aAAM,EAAuB,mBAAmB,CAAC,CAAC"}
|
package/src/lib/decorators.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
export declare function getFlattenFieldAnnotations<Annotation>(T: any, prefix?: string): Record<string, Annotation>;
|
|
2
|
-
export declare function getFields(T: any, options?: {
|
|
3
|
-
prefix?: string;
|
|
4
|
-
case?: 'snake' | 'camel';
|
|
5
|
-
}): string[];
|
|
6
|
-
export declare const Hasura: {
|
|
7
|
-
Text: (nameOrProps?: {
|
|
8
|
-
name?: string;
|
|
9
|
-
} | string) => (target: any, propName: string) => void;
|
|
10
|
-
Timestamp: (nameOrProps?: {
|
|
11
|
-
name?: string;
|
|
12
|
-
} | string) => (target: any, propName: string) => void;
|
|
13
|
-
Date: (nameOrProps?: {
|
|
14
|
-
name?: string;
|
|
15
|
-
} | string) => (target: any, propName: string) => void;
|
|
16
|
-
Integer: (nameOrProps?: {
|
|
17
|
-
name?: string;
|
|
18
|
-
} | string) => (target: any, propName: string) => void;
|
|
19
|
-
Numeric: (nameOrProps?: {
|
|
20
|
-
name?: string;
|
|
21
|
-
} | string) => (target: any, propName: string) => void;
|
|
22
|
-
Boolean: (nameOrProps?: {
|
|
23
|
-
name?: string;
|
|
24
|
-
} | string) => (target: any, propName: string) => void;
|
|
25
|
-
Map: (childType: () => any) => (target: any, propName: string) => void;
|
|
26
|
-
JSON: (nameOrProps?: {
|
|
27
|
-
name?: string;
|
|
28
|
-
} | string) => (target: any, propName: string) => void;
|
|
29
|
-
getAnnotations: (target: any) => {
|
|
30
|
-
type: string;
|
|
31
|
-
fieldName: string;
|
|
32
|
-
propName: string;
|
|
33
|
-
childType: any;
|
|
34
|
-
}[];
|
|
35
|
-
};
|
package/src/lib/decorators.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Hasura = void 0;
|
|
4
|
-
exports.getFlattenFieldAnnotations = getFlattenFieldAnnotations;
|
|
5
|
-
exports.getFields = getFields;
|
|
6
|
-
const create_decorator_1 = require("@nx-ddd/core/create-decorator");
|
|
7
|
-
const lodash_es_1 = require("lodash-es");
|
|
8
|
-
const { createDecorator, getAnnotations, } = (0, create_decorator_1.makeDecoratorFactories)((type, fieldName, propName, options) => ({ type, fieldName, propName, childType: options.childType }), '[@nx-ddd/hasura] annotations');
|
|
9
|
-
function getFlattenFieldAnnotations(T, prefix = '') {
|
|
10
|
-
const annotations = exports.Hasura.getAnnotations(T);
|
|
11
|
-
return (annotations !== null && annotations !== void 0 ? annotations : []).reduce((acc, annotation) => {
|
|
12
|
-
const currentKey = prefix ? (0, lodash_es_1.camelCase)(`${prefix}_${annotation.fieldName}`) : annotation.fieldName;
|
|
13
|
-
if (annotation.childType) {
|
|
14
|
-
return Object.assign(Object.assign({}, acc), getFlattenFieldAnnotations(annotation.childType(), currentKey));
|
|
15
|
-
}
|
|
16
|
-
return Object.assign(Object.assign({}, acc), { [currentKey]: annotation });
|
|
17
|
-
}, {});
|
|
18
|
-
}
|
|
19
|
-
function getFields(T, options = {
|
|
20
|
-
prefix: '',
|
|
21
|
-
case: 'snake'
|
|
22
|
-
}) {
|
|
23
|
-
const annotations = exports.Hasura.getAnnotations(T);
|
|
24
|
-
const changeCase = (options === null || options === void 0 ? void 0 : options.case) === 'snake' ? lodash_es_1.snakeCase : lodash_es_1.camelCase;
|
|
25
|
-
const fields = (annotations !== null && annotations !== void 0 ? annotations : []).flatMap((annotation) => {
|
|
26
|
-
const currentKey = changeCase((options === null || options === void 0 ? void 0 : options.prefix) ? `${options === null || options === void 0 ? void 0 : options.prefix}_${annotation.fieldName}` : annotation.fieldName);
|
|
27
|
-
if (annotation.childType) {
|
|
28
|
-
return [
|
|
29
|
-
...getFields(annotation.childType(), {
|
|
30
|
-
prefix: currentKey,
|
|
31
|
-
case: options === null || options === void 0 ? void 0 : options.case,
|
|
32
|
-
})
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
return [currentKey];
|
|
36
|
-
});
|
|
37
|
-
return fields;
|
|
38
|
-
}
|
|
39
|
-
exports.Hasura = {
|
|
40
|
-
Text: createDecorator('text'),
|
|
41
|
-
Timestamp: createDecorator('timestamp'),
|
|
42
|
-
Date: createDecorator('date'),
|
|
43
|
-
Integer: createDecorator('integer'),
|
|
44
|
-
Numeric: createDecorator('numeric'),
|
|
45
|
-
Boolean: createDecorator('boolean'),
|
|
46
|
-
Map: (childType) => createDecorator('map', { childType })(),
|
|
47
|
-
JSON: createDecorator('json'),
|
|
48
|
-
getAnnotations,
|
|
49
|
-
};
|
|
50
|
-
//# sourceMappingURL=decorators.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.js","sourceRoot":"","sources":["../../../../../../packages/@nx-ddd/hasura/src/lib/decorators.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from "@angular/core";
|
|
2
|
-
import { Provider } from "@angular/core";
|
|
3
|
-
export interface HasuraConfig {
|
|
4
|
-
adminSecret?: string;
|
|
5
|
-
url: string;
|
|
6
|
-
}
|
|
7
|
-
export declare const HASURA_CONFIG: InjectionToken<HasuraConfig>;
|
|
8
|
-
export declare function provideHasuraConfig(config: HasuraConfig): Provider[];
|
package/src/lib/hasura.config.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HASURA_CONFIG = void 0;
|
|
4
|
-
exports.provideHasuraConfig = provideHasuraConfig;
|
|
5
|
-
const http_1 = require("@angular/common/http");
|
|
6
|
-
const core_1 = require("@angular/core");
|
|
7
|
-
const hasura_interceptor_1 = require("./hasura.interceptor");
|
|
8
|
-
exports.HASURA_CONFIG = new core_1.InjectionToken('HASURA_CONFIG');
|
|
9
|
-
function provideHasuraConfig(config) {
|
|
10
|
-
return [
|
|
11
|
-
{ provide: exports.HASURA_CONFIG, useValue: config },
|
|
12
|
-
config.adminSecret ? { provide: http_1.HTTP_INTERCEPTORS, useClass: hasura_interceptor_1.HasuraInterceptor, multi: true } : [],
|
|
13
|
-
];
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=hasura.config.js.map
|