@qelos/plugin-play 3.7.1 → 3.7.3

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 (52) hide show
  1. package/package.json +10 -10
  2. package/dist/app.d.ts +0 -16
  3. package/dist/app.js +0 -170
  4. package/dist/app.js.map +0 -1
  5. package/dist/authentication.d.ts +0 -10
  6. package/dist/authentication.js +0 -380
  7. package/dist/authentication.js.map +0 -1
  8. package/dist/cache-manager.d.ts +0 -2
  9. package/dist/cache-manager.js +0 -7
  10. package/dist/cache-manager.js.map +0 -1
  11. package/dist/config.d.ts +0 -24
  12. package/dist/config.js +0 -28
  13. package/dist/config.js.map +0 -1
  14. package/dist/crud.d.ts +0 -9
  15. package/dist/crud.js +0 -339
  16. package/dist/crud.js.map +0 -1
  17. package/dist/crud.types.d.ts +0 -68
  18. package/dist/crud.types.js +0 -2
  19. package/dist/crud.types.js.map +0 -1
  20. package/dist/endpoints.d.ts +0 -10
  21. package/dist/endpoints.js +0 -35
  22. package/dist/endpoints.js.map +0 -1
  23. package/dist/handlers.d.ts +0 -47
  24. package/dist/handlers.js +0 -32
  25. package/dist/handlers.js.map +0 -1
  26. package/dist/index.d.ts +0 -14
  27. package/dist/index.js +0 -15
  28. package/dist/index.js.map +0 -1
  29. package/dist/injectables.d.ts +0 -6
  30. package/dist/injectables.js +0 -5
  31. package/dist/injectables.js.map +0 -1
  32. package/dist/lifecycle.d.ts +0 -70
  33. package/dist/lifecycle.js +0 -31
  34. package/dist/lifecycle.js.map +0 -1
  35. package/dist/logger.d.ts +0 -5
  36. package/dist/logger.js +0 -12
  37. package/dist/logger.js.map +0 -1
  38. package/dist/manifest.d.ts +0 -37
  39. package/dist/manifest.js +0 -26
  40. package/dist/manifest.js.map +0 -1
  41. package/dist/micro-frontends.d.ts +0 -50
  42. package/dist/micro-frontends.js +0 -19
  43. package/dist/micro-frontends.js.map +0 -1
  44. package/dist/request.types.d.ts +0 -20
  45. package/dist/request.types.js +0 -2
  46. package/dist/request.types.js.map +0 -1
  47. package/dist/response-error.d.ts +0 -8
  48. package/dist/response-error.js +0 -18
  49. package/dist/response-error.js.map +0 -1
  50. package/dist/sdk.d.ts +0 -13
  51. package/dist/sdk.js +0 -63
  52. package/dist/sdk.js.map +0 -1
package/dist/config.d.ts DELETED
@@ -1,24 +0,0 @@
1
- import { QelosSDKOptions } from '@qelos/sdk/dist/types';
2
- declare const config: {
3
- port: number;
4
- internalPort: number;
5
- host: string;
6
- internalHost: string;
7
- dev: boolean;
8
- allowedTenants: string[];
9
- refreshTokenSecret: string;
10
- accessTokenSecret: string;
11
- userPayloadSecret: string;
12
- qelosUrl: string;
13
- qelosUsername: string;
14
- qelosPassword: string;
15
- redisUrl: string;
16
- staticFrontend: {
17
- root: string;
18
- prefix: string;
19
- };
20
- sdkOptions: Partial<QelosSDKOptions>;
21
- };
22
- export type ConfigOptions = Partial<typeof config>;
23
- export declare function setConfig(appConfig: ConfigOptions): void;
24
- export default config;
package/dist/config.js DELETED
@@ -1,28 +0,0 @@
1
- import { join } from 'path';
2
- const port = Number(process.env.PORT || 1086);
3
- const host = process.env.HOST || '0.0.0.0';
4
- const config = {
5
- port: port,
6
- internalPort: Number(process.env.INTERNAL_PORT || port + 1),
7
- host: host,
8
- internalHost: process.env.INTERNAL_HOST || host,
9
- dev: process.env.NODE_ENV !== 'production',
10
- allowedTenants: process.env.ALLOWED_TENANTS?.split(',') || [],
11
- refreshTokenSecret: process.env.REFRESH_TOKEN_SECRET,
12
- accessTokenSecret: process.env.ACCESS_TOKEN_SECRET,
13
- userPayloadSecret: process.env.USER_PAYLOAD_SECRET,
14
- qelosUrl: process.env.QELOS_URL,
15
- qelosUsername: process.env.QELOS_USERNAME,
16
- qelosPassword: process.env.QELOS_PASSWORD,
17
- redisUrl: process.env.REDIS_URL,
18
- staticFrontend: {
19
- root: join(process.cwd(), process.env.STATIC_ROOT || 'public'),
20
- prefix: process.env.STATIC_PREFIX || '/',
21
- },
22
- sdkOptions: {}
23
- };
24
- export function setConfig(appConfig) {
25
- Object.assign(config, appConfig);
26
- }
27
- export default config;
28
- //# sourceMappingURL=config.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAG5B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAC9C,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,SAAS,CAAC;AAC3C,MAAM,MAAM,GAAG;IACb,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI,GAAG,CAAC,CAAC;IAC3D,IAAI,EAAE,IAAI;IACV,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,IAAI;IAC/C,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;IAC1C,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE;IAC7D,kBAAkB,EAAE,OAAO,CAAC,GAAG,CAAC,oBAAoB;IACpD,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;IAClD,iBAAiB,EAAE,OAAO,CAAC,GAAG,CAAC,mBAAmB;IAClD,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;IAC/B,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IACzC,aAAa,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IACzC,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;IAC/B,cAAc,EAAE;QACd,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,QAAQ,CAAC;QAC9D,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,GAAG;KACzC;IACD,UAAU,EAAE,EAA8B;CAC3C,CAAC;AAIF,MAAM,UAAU,SAAS,CAAC,SAAwB;IAChD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACnC,CAAC;AAED,eAAe,MAAM,CAAC"}
package/dist/crud.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import { ICrudOptions } from './crud.types';
2
- export declare function getPlural(word: string): string;
3
- export declare function getDisplayNames(name: string): {
4
- name: string;
5
- plural: string;
6
- capitalized: string;
7
- capitalizedPlural: string;
8
- };
9
- export declare function createCrud<ResourcePublicData = any, ResourceInsertData = any>(options: ICrudOptions<ResourcePublicData, ResourceInsertData>): void;
package/dist/crud.js DELETED
@@ -1,339 +0,0 @@
1
- import { addProxyEndpoint } from './endpoints';
2
- import { ResponseError } from './response-error';
3
- import logger from './logger';
4
- import manifest from './manifest';
5
- import { addGroupedMicroFrontends, NavBarPosition } from './micro-frontends';
6
- import { getSdkForTenant } from './sdk';
7
- export function getPlural(word) {
8
- const lastChar = word[word.length - 1].toLowerCase();
9
- if (['x', 'h', 's'].includes(lastChar)) {
10
- return word + 'es';
11
- }
12
- if (lastChar === 'y') {
13
- return word.substring(0, word.length - 1) + 'ies';
14
- }
15
- return word + 's';
16
- }
17
- export function getDisplayNames(name) {
18
- const plural = getPlural(name.toLowerCase());
19
- const capitalized = name.split(' ').map(word => word[0].toUpperCase() + word.slice(1).toLowerCase()).join(' ');
20
- const capitalizedPlural = getPlural(capitalized);
21
- return {
22
- name,
23
- plural,
24
- capitalized,
25
- capitalizedPlural
26
- };
27
- }
28
- function getMfeScreenOptions(name, crud, screen) {
29
- return {
30
- name,
31
- crud,
32
- use: screen.use,
33
- structure: screen.structure,
34
- roles: screen.roles,
35
- workspaceRoles: screen.workspaceRoles,
36
- searchQuery: screen.searchQuery,
37
- searchPlaceholder: screen.searchPlaceholder,
38
- navigateAfterSubmit: screen.navigateAfterSubmit,
39
- clearAfterSubmit: screen.clearAfterSubmit,
40
- };
41
- }
42
- function isPropValidToDisplay(value, propSchema, dest) {
43
- return (propSchema?.public &&
44
- !(propSchema.hideInList && dest === 'list') &&
45
- (typeof propSchema.type === 'undefined' ||
46
- (propSchema.type === null && value === null) ||
47
- value?.constructor === propSchema.type));
48
- }
49
- function fillFromSchema(exposed, item, schema, dest = 'single') {
50
- for (const key in schema) {
51
- const prop = schema[key];
52
- const value = item[key];
53
- if (isPropValidToDisplay(value, prop, dest)) {
54
- if (prop.schema && prop.type === Object) {
55
- exposed[key] = {};
56
- fillFromSchema(exposed[key], value, prop.schema);
57
- }
58
- else if (prop.schema && prop.type === Array && value instanceof Array) {
59
- exposed[key] = [];
60
- value.forEach(row => {
61
- if (prop.schema.type) {
62
- // consider to be a direct property;
63
- if (isPropValidToDisplay(row, prop.schema, dest)) {
64
- exposed[key].push(row);
65
- }
66
- }
67
- else {
68
- // consider to be an object schema
69
- const item = {};
70
- fillFromSchema(item, row, prop.schema);
71
- exposed[key].push(item);
72
- }
73
- });
74
- }
75
- else {
76
- exposed[key] = value;
77
- }
78
- }
79
- }
80
- }
81
- function getJsonSchema(schema) {
82
- const json = {};
83
- for (const key in schema) {
84
- json[key] = {
85
- ...schema[key],
86
- // @ts-ignore
87
- type: schema[key].type?.name
88
- };
89
- if (schema[key].schema) {
90
- schema[key].schema = getJsonSchema({ data: schema[key].schema }).data;
91
- }
92
- }
93
- return json;
94
- }
95
- function getValidatedItem(item = {}, schema) {
96
- if (!schema) {
97
- return item;
98
- }
99
- const valid = {};
100
- for (const key in schema) {
101
- const prop = schema[key];
102
- const value = item[key];
103
- if (typeof prop.type === 'undefined' ||
104
- (prop.type === null && value === null) ||
105
- value?.constructor === prop.type) {
106
- if (prop.schema && prop.type === Object) {
107
- valid[key] = getValidatedItem(value, prop.schema);
108
- }
109
- else {
110
- valid[key] = item[key];
111
- }
112
- }
113
- }
114
- return valid;
115
- }
116
- export function createCrud(options) {
117
- const display = getDisplayNames(options.display.name);
118
- const screens = {
119
- list: {},
120
- create: {},
121
- edit: {},
122
- view: {},
123
- ...options.screens,
124
- };
125
- const crudOptions = {
126
- name: display.plural.replaceAll(' ', '-'),
127
- identifierKey: '_id',
128
- dispatchPrefix: options.dispatchPrefix === false ? options.dispatchPrefix : options.dispatchPrefix || manifest.name,
129
- verify: async () => null,
130
- ...options,
131
- display: {
132
- ...display,
133
- ...options.display
134
- },
135
- screens: {
136
- list: screens.list === false ? screens.list : {
137
- ...screens.list,
138
- use: screens.list.use || 'rows-list',
139
- structure: screens.list.structure,
140
- },
141
- create: screens.create === false ? screens.create : {
142
- ...screens.create,
143
- use: screens.create.use || 'basic-form',
144
- structure: screens.create.structure
145
- },
146
- edit: screens.edit === false ? screens.edit : {
147
- ...screens.edit,
148
- use: screens.edit.use || 'basic-form',
149
- structure: screens.edit.structure,
150
- },
151
- view: screens.view === false ? screens.view : {
152
- ...screens.view,
153
- use: screens.view.use || 'basic-form',
154
- structure: screens.view.structure,
155
- },
156
- },
157
- nav: options.nav || {}
158
- };
159
- function getPublicData(item = {}) {
160
- const exposed = { [crudOptions.identifierKey]: item[crudOptions.identifierKey] };
161
- fillFromSchema(exposed, item, crudOptions.schema);
162
- return exposed;
163
- }
164
- function getPublicDataForList(item = {}) {
165
- const exposed = { [crudOptions.identifierKey]: item[crudOptions.identifierKey] };
166
- fillFromSchema(exposed, item, crudOptions.schema, 'list');
167
- return exposed;
168
- }
169
- function handleError(err, reply) {
170
- if (err instanceof ResponseError) {
171
- logger.error(err);
172
- reply.statusCode = err.status;
173
- return { message: err.responseMessage };
174
- }
175
- throw err;
176
- }
177
- const itemPath = crudOptions.name + '/:id';
178
- const singlePath = crudOptions.display.name.toLowerCase().replaceAll(' ', '-');
179
- async function triggerOperation(req, kind, metadata) {
180
- if (crudOptions.dispatchPrefix) {
181
- const sdk = await getSdkForTenant(req.tenantPayload);
182
- sdk?.events.dispatch({
183
- source: `${crudOptions.dispatchPrefix}:${crudOptions.name}`,
184
- kind,
185
- eventName: `${kind}-${singlePath}`,
186
- user: req.user._id,
187
- metadata,
188
- });
189
- }
190
- }
191
- // get one
192
- addProxyEndpoint(itemPath, {
193
- verifyToken: true,
194
- method: 'GET',
195
- handler: async (req, reply) => {
196
- try {
197
- await crudOptions.verify(req, reply);
198
- const id = req.params.id || '';
199
- const item = await crudOptions.readOne(id, req, reply);
200
- if (!crudOptions.schema) {
201
- return item;
202
- }
203
- return getPublicData(item);
204
- }
205
- catch (err) {
206
- return handleError(err, reply);
207
- }
208
- }
209
- });
210
- // update one
211
- addProxyEndpoint(itemPath, {
212
- verifyToken: true,
213
- method: 'PUT',
214
- handler: async (req, reply) => {
215
- try {
216
- await crudOptions.verify(req, reply);
217
- const id = req.params.id || '';
218
- const item = await crudOptions.updateOne(id, getValidatedItem(req.body, crudOptions.schema), req, reply);
219
- triggerOperation(req, 'update', item).catch();
220
- if (!crudOptions.schema) {
221
- return item;
222
- }
223
- return getPublicData(item);
224
- }
225
- catch (err) {
226
- return handleError(err, reply);
227
- }
228
- }
229
- });
230
- // delete one
231
- addProxyEndpoint(itemPath, {
232
- verifyToken: true,
233
- method: 'DELETE',
234
- handler: async (req, reply) => {
235
- try {
236
- await crudOptions.verify(req, reply);
237
- const id = req.params.id || '';
238
- const item = await crudOptions.deleteOne(id, req, reply);
239
- triggerOperation(req, 'delete', item).catch();
240
- if (!crudOptions.schema) {
241
- return item;
242
- }
243
- return getPublicData(item);
244
- }
245
- catch (err) {
246
- return handleError(err, reply);
247
- }
248
- }
249
- });
250
- // create one
251
- addProxyEndpoint(crudOptions.name, {
252
- verifyToken: true,
253
- method: 'POST',
254
- handler: async (req, reply) => {
255
- try {
256
- await crudOptions.verify(req, reply);
257
- const item = await crudOptions.createOne(getValidatedItem(req.body, crudOptions.schema), req, reply);
258
- triggerOperation(req, 'create', item).catch();
259
- if (!crudOptions.schema) {
260
- return item;
261
- }
262
- return getPublicData(item);
263
- }
264
- catch (err) {
265
- return handleError(err, reply);
266
- }
267
- }
268
- });
269
- // get many
270
- addProxyEndpoint(crudOptions.name, {
271
- verifyToken: true,
272
- method: 'GET',
273
- handler: async (req, reply) => {
274
- try {
275
- await crudOptions.verify(req, reply);
276
- const list = await crudOptions.readMany((req.query || {}), req, reply);
277
- if (!crudOptions.schema) {
278
- return list;
279
- }
280
- return list.map(getPublicDataForList);
281
- }
282
- catch (err) {
283
- return handleError(err, reply);
284
- }
285
- }
286
- });
287
- manifest.cruds.push({
288
- name: crudOptions.name,
289
- display: crudOptions.display,
290
- identifierKey: crudOptions.identifierKey,
291
- schema: getJsonSchema(crudOptions.schema),
292
- });
293
- addGroupedMicroFrontends({ name: crudOptions.display.capitalizedPlural, key: crudOptions.name, ...crudOptions.nav }, [
294
- crudOptions.screens.list && {
295
- ...getMfeScreenOptions('List', crudOptions.name, crudOptions.screens.list),
296
- description: 'List of ' + crudOptions.display.capitalizedPlural,
297
- route: {
298
- name: crudOptions.name + '-list',
299
- path: crudOptions.name,
300
- navBarPosition: NavBarPosition.TOP
301
- }
302
- },
303
- crudOptions.screens.create && {
304
- ...getMfeScreenOptions('Create', crudOptions.name, crudOptions.screens.create),
305
- description: 'Create a new ' + crudOptions.display.capitalized,
306
- route: {
307
- name: 'add-' + singlePath,
308
- path: 'add-' + singlePath,
309
- navBarPosition: NavBarPosition.TOP
310
- },
311
- navigateAfterSubmit: crudOptions.screens.edit && {
312
- name: 'edit-' + singlePath,
313
- params: {
314
- id: '{IDENTIFIER}'
315
- }
316
- },
317
- clearAfterSubmit: !crudOptions.screens.edit,
318
- },
319
- crudOptions.screens.edit && {
320
- ...getMfeScreenOptions('Edit', crudOptions.name, crudOptions.screens.edit),
321
- description: 'Edit existing ' + crudOptions.display.capitalized,
322
- route: {
323
- name: 'edit-' + singlePath,
324
- path: `edit-${singlePath}/:id`,
325
- navBarPosition: false
326
- },
327
- },
328
- crudOptions.screens.view && {
329
- ...getMfeScreenOptions('View', crudOptions.name, crudOptions.screens.view),
330
- description: 'View existing ' + crudOptions.display.capitalized,
331
- route: {
332
- name: 'view-' + singlePath,
333
- path: `view-${singlePath}/:id`,
334
- navBarPosition: false
335
- }
336
- }
337
- ]);
338
- }
339
- //# sourceMappingURL=crud.js.map
package/dist/crud.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"crud.js","sourceRoot":"","sources":["../src/crud.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,MAAM,MAAM,UAAU,CAAC;AAC9B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACrD,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE;QACtC,OAAO,IAAI,GAAG,IAAI,CAAC;KACpB;IACD,IAAI,QAAQ,KAAK,GAAG,EAAE;QACpB,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;KACnD;IACD,OAAO,IAAI,GAAG,GAAG,CAAC;AACpB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,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@@
1
- import { FastifyRequest } from 'fastify/types/request';
2
- import { FastifyReply } from 'fastify/types/reply';
3
- export type Crud = {
4
- name: string;
5
- display: {
6
- name: string;
7
- plural: string;
8
- capitalized: string;
9
- capitalizedPlural: string;
10
- };
11
- identifierKey: string;
12
- schema?: any;
13
- searchQuery?: boolean;
14
- searchPlaceholder?: string;
15
- };
16
- export interface Screen {
17
- roles?: string[];
18
- workspaceRoles?: string[];
19
- use?: string;
20
- structure?: string;
21
- searchQuery?: boolean;
22
- searchPlaceholder?: string;
23
- navigateAfterSubmit?: {
24
- name: string;
25
- params: Record<string, string>;
26
- query: Record<string, string>;
27
- };
28
- clearAfterSubmit?: boolean;
29
- }
30
- export interface ResourceProperty<T = any> {
31
- public?: boolean;
32
- hideInList?: boolean;
33
- type?: String | Number | Boolean | Object | null | Array<T>;
34
- schema?: ResourceSchema | ResourceProperty<T>;
35
- validate?: (value: any) => boolean | Promise<boolean>;
36
- options?: Array<any>;
37
- ref?: string;
38
- }
39
- export type ResourceSchema = Record<string, ResourceProperty>;
40
- export interface ICrudOptions<ResourcePublicData, ResourceInsertData> {
41
- name?: string;
42
- identifierKey?: string;
43
- display: {
44
- name: string;
45
- plural?: string;
46
- capitalized?: string;
47
- capitalizedPlural?: string;
48
- };
49
- nav?: {
50
- iconName?: string;
51
- iconSvg?: string;
52
- priority?: number;
53
- };
54
- screens?: {
55
- list: false | Screen;
56
- create: false | Screen;
57
- edit: false | Screen;
58
- view: false | Screen;
59
- };
60
- schema?: ResourceSchema;
61
- dispatchPrefix?: string | false;
62
- verify?: (request: FastifyRequest, reply: FastifyReply) => Promise<any>;
63
- createOne: (body: Partial<ResourceInsertData>, request: FastifyRequest, reply: FastifyReply) => (any | Promise<ResourcePublicData>);
64
- readOne: (id: string, request: FastifyRequest, reply: FastifyReply) => (Promise<ResourcePublicData>);
65
- readMany: (query: Record<string, string | string[]>, request: FastifyRequest, reply: FastifyReply) => (Promise<ResourcePublicData[]>);
66
- updateOne: (id: string, body: Partial<ResourceInsertData>, request: FastifyRequest, reply: FastifyReply) => (Promise<ResourcePublicData>);
67
- deleteOne: (id: string, request: FastifyRequest, reply: FastifyReply) => (Promise<ResourcePublicData>);
68
- }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=crud.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crud.types.js","sourceRoot":"","sources":["../src/crud.types.ts"],"names":[],"mappings":""}
@@ -1,10 +0,0 @@
1
- /// <reference types="node" />
2
- import { RouteOptions } from 'fastify/types/route';
3
- export interface QelosRouteParams extends RouteOptions {
4
- verifyToken: boolean;
5
- }
6
- export declare const endpoints: Map<string, QelosRouteParams>;
7
- export declare const internalEndpoints: Map<string, RouteOptions<import("fastify").RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, import("fastify/types/route").RouteGenericInterface, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, import("fastify").FastifyBaseLogger>>;
8
- export declare function addProxyEndpoint(path: string, options: Partial<QelosRouteParams>): void;
9
- export declare function addEndpoint(path: string, options: Partial<QelosRouteParams>): void;
10
- export declare function addInternalEndpoint(path: string, options: Partial<RouteOptions>): void;
package/dist/endpoints.js DELETED
@@ -1,35 +0,0 @@
1
- import { join } from 'path';
2
- import manifest from './manifest';
3
- export const endpoints = new Map();
4
- export const internalEndpoints = new Map();
5
- export function addProxyEndpoint(path, options) {
6
- const endpointUrl = join(manifest.proxyPath, path);
7
- const method = options.method || 'GET';
8
- endpoints.set(method + '::' + endpointUrl, {
9
- ...options,
10
- url: endpointUrl,
11
- method,
12
- handler: options.handler,
13
- verifyToken: true,
14
- });
15
- }
16
- export function addEndpoint(path, options) {
17
- const method = options.method || 'GET';
18
- endpoints.set(method + '::' + path, {
19
- ...options,
20
- url: path,
21
- method,
22
- handler: options.handler,
23
- verifyToken: 'verifyToken' in options ? options.verifyToken : true,
24
- });
25
- }
26
- export function addInternalEndpoint(path, options) {
27
- const method = options.method || 'GET';
28
- internalEndpoints.set(method + '::' + path, {
29
- ...options,
30
- url: path,
31
- method,
32
- handler: options.handler,
33
- });
34
- }
35
- //# sourceMappingURL=endpoints.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAMlC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,GAAG,EAA4B,CAAA;AAC5D,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAwB,CAAA;AAEhE,MAAM,UAAU,gBAAgB,CAAC,IAAY,EAAE,OAAkC;IAC/E,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;IACvC,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,WAAW,EAAE;QACzC,GAAG,OAAO;QACV,GAAG,EAAE,WAAW;QAChB,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,IAAI;KAClB,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,OAAkC;IAC1E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;IACvC,SAAS,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE;QAClC,GAAG,OAAO;QACV,GAAG,EAAE,IAAI;QACT,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,WAAW,EAAE,aAAa,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;KACnE,CAAC,CAAA;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAY,EAAE,OAA8B;IAC9E,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,KAAK,CAAC;IACvC,iBAAiB,CAAC,GAAG,CAAC,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE;QAC1C,GAAG,OAAO;QACV,GAAG,EAAE,IAAI;QACT,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;KACzB,CAAC,CAAA;AACJ,CAAC"}
@@ -1,47 +0,0 @@
1
- import { FastifyRequest } from 'fastify/types/request';
2
- export declare const handlers: {
3
- refreshToken: any[];
4
- newTenant: any[];
5
- manifest: any[];
6
- storeUser: any[];
7
- callback: any[];
8
- frontendAuth: any[];
9
- frontendUnAuth: any[];
10
- };
11
- export type StandardPayload = {
12
- sub: string;
13
- identifier: string;
14
- };
15
- export type DataWithPayload<T> = {
16
- payload: T & StandardPayload;
17
- };
18
- export type FrontendAuthorizationPayload = {
19
- code: string | number;
20
- token: string;
21
- };
22
- export type RefreshTokenHandler<T> = (tokenPayload: T & StandardPayload, request: FastifyRequest) => void | DataWithPayload<T> | Promise<void | DataWithPayload<T>>;
23
- export type NewTenantHandler<T> = ({ username, password, appUrl }: {
24
- username: any;
25
- password: any;
26
- appUrl: any;
27
- }, request: FastifyRequest) => void | DataWithPayload<T> | Promise<void | DataWithPayload<T>>;
28
- export type FrontendAuthorizationHandler = ({ returnUrl, user, tenant }: {
29
- returnUrl: any;
30
- user: any;
31
- tenant: any;
32
- }, request: FastifyRequest) => void | FrontendAuthorizationPayload | Promise<void | FrontendAuthorizationPayload>;
33
- export type FrontendUnAuthorizationHandler = ({ user, tenant }: {
34
- user: any;
35
- tenant: any;
36
- }) => any;
37
- export declare function onRefreshToken<T = any>(handler: RefreshTokenHandler<T>): void;
38
- export declare function onNewTenant<T = any>(handler: NewTenantHandler<T>): void;
39
- export declare function onManifest(handler: (request: FastifyRequest) => any): void;
40
- export declare function onStoreUser(handler: any): void;
41
- export declare function onCallback(handler: ({ user, returnUrl }: {
42
- user: any;
43
- returnUrl: any;
44
- }, request: FastifyRequest) => void | string | Promise<void | string>): void;
45
- export declare function onFrontendAuthorization(handler: FrontendAuthorizationHandler): void;
46
- export declare function onFrontendUnAuthorization(handler: FrontendUnAuthorizationHandler): void;
47
- export default handlers;
package/dist/handlers.js DELETED
@@ -1,32 +0,0 @@
1
- export const handlers = {
2
- refreshToken: [],
3
- newTenant: [],
4
- manifest: [],
5
- storeUser: [],
6
- callback: [],
7
- frontendAuth: [],
8
- frontendUnAuth: [],
9
- };
10
- export function onRefreshToken(handler) {
11
- handlers.refreshToken.push(handler);
12
- }
13
- export function onNewTenant(handler) {
14
- handlers.newTenant.push(handler);
15
- }
16
- export function onManifest(handler) {
17
- handlers.manifest.push(handler);
18
- }
19
- export function onStoreUser(handler) {
20
- handlers.storeUser.push(handler);
21
- }
22
- export function onCallback(handler) {
23
- handlers.callback.push(handler);
24
- }
25
- export function onFrontendAuthorization(handler) {
26
- handlers.frontendAuth.push(handler);
27
- }
28
- export function onFrontendUnAuthorization(handler) {
29
- handlers.frontendUnAuth.push(handler);
30
- }
31
- export default handlers;
32
- //# sourceMappingURL=handlers.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handlers.js","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,YAAY,EAAE,EAAE;IAChB,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE;IACZ,SAAS,EAAE,EAAE;IACb,QAAQ,EAAE,EAAE;IACZ,YAAY,EAAE,EAAE;IAChB,cAAc,EAAE,EAAE;CACnB,CAAA;AAqBD,MAAM,UAAU,cAAc,CAAU,OAA+B;IACrE,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,WAAW,CAAU,OAA4B;IAC/D,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAAyC;IAClE,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAO;IACjC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,OAG+E;IACxG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,uBAAuB,CAAC,OAAqC;IAC3E,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,OAAuC;IAC/E,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC;AAED,eAAe,QAAQ,CAAC"}
package/dist/index.d.ts DELETED
@@ -1,14 +0,0 @@
1
- import './request.types';
2
- import logger from './logger';
3
- export { ResponseError } from './response-error';
4
- export { start, configure, registerToHook } from './app';
5
- export { on, LifecycleEvent, BeforeConfigurePayload, BeforeMountPayload, ConfiguredPayload, MountedPayload, BeforeCreatePayload } from './lifecycle';
6
- export { cacheManager } from './cache-manager';
7
- export { onRefreshToken, onManifest, onStoreUser, onNewTenant, onCallback } from './handlers';
8
- export { addEndpoint, addProxyEndpoint, addInternalEndpoint } from './endpoints';
9
- export { getSdkForTenant, getSdk, getSdkForUrl } from './sdk';
10
- export { addGroupedMicroFrontends, addMicroFrontend, MicroFrontend } from './micro-frontends';
11
- export { addInjectable, Injectable } from './injectables';
12
- export { createCrud } from './crud';
13
- export * from './crud.types';
14
- export { logger };