@axinom/mosaic-testing 0.7.16-rc.3 → 0.7.16-rc.4
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/dist/index.d.ts +2 -0
- package/dist/{cjs/index.d.ts.map → index.d.ts.map} +1 -1
- package/dist/{cjs/index.js → index.js} +1 -1
- package/dist/index.js.map +1 -0
- package/dist/performance/index.d.ts +3 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/index.js +2 -2
- package/dist/performance/index.js.map +1 -0
- package/dist/{cjs/performance → performance}/plugins/inbox-outbox-report-endpoint-plugin.d.ts +2 -2
- package/dist/performance/plugins/inbox-outbox-report-endpoint-plugin.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/plugins/inbox-outbox-report-endpoint-plugin.js +8 -9
- package/dist/performance/plugins/inbox-outbox-report-endpoint-plugin.js.map +1 -0
- package/dist/{cjs/performance → performance}/plugins/inbox-outbox-state-endpoint-plugin.d.ts +2 -2
- package/dist/performance/plugins/inbox-outbox-state-endpoint-plugin.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/plugins/inbox-outbox-state-endpoint-plugin.js +3 -4
- package/dist/performance/plugins/inbox-outbox-state-endpoint-plugin.js.map +1 -0
- package/dist/{esm/performance/plugins/index.js → performance/plugins/index.d.ts} +3 -3
- package/dist/performance/plugins/index.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/plugins/index.js +4 -4
- package/dist/performance/plugins/index.js.map +1 -0
- package/dist/performance/scripts/index.d.ts +4 -0
- package/dist/performance/scripts/index.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/scripts/index.js +3 -3
- package/dist/performance/scripts/index.js.map +1 -0
- package/dist/{esm/performance → performance}/scripts/make-graphql-request.d.ts +2 -2
- package/dist/performance/scripts/make-graphql-request.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/scripts/make-graphql-request.js +2 -2
- package/dist/performance/scripts/make-graphql-request.js.map +1 -0
- package/dist/{esm/performance → performance}/scripts/run-inbox-outbox-scenario.d.ts +3 -3
- package/dist/performance/scripts/run-inbox-outbox-scenario.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/scripts/run-inbox-outbox-scenario.js +30 -9
- package/dist/performance/scripts/run-inbox-outbox-scenario.js.map +1 -0
- package/dist/performance/scripts/run-scenario.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/scripts/run-scenario.js +3 -3
- package/dist/performance/scripts/run-scenario.js.map +1 -0
- package/dist/performance/utils/colorize-text.d.ts.map +1 -0
- package/dist/performance/utils/colorize-text.js.map +1 -0
- package/dist/performance/utils/index.d.ts +3 -0
- package/dist/performance/utils/index.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/utils/index.js +2 -2
- package/dist/performance/utils/index.js.map +1 -0
- package/dist/{cjs/performance → performance}/utils/report-generation.d.ts +1 -1
- package/dist/performance/utils/report-generation.d.ts.map +1 -0
- package/dist/{cjs/performance → performance}/utils/report-generation.js +15 -12
- package/dist/performance/utils/report-generation.js.map +1 -0
- package/package.json +11 -21
- package/src/index.ts +1 -1
- package/src/performance/index.ts +2 -2
- package/src/performance/plugins/inbox-outbox-report-endpoint-plugin.spec.ts +3 -6
- package/src/performance/plugins/inbox-outbox-report-endpoint-plugin.ts +3 -3
- package/src/performance/plugins/inbox-outbox-state-endpoint-plugin.spec.ts +3 -6
- package/src/performance/plugins/inbox-outbox-state-endpoint-plugin.ts +2 -2
- package/src/performance/plugins/index.ts +2 -2
- package/src/performance/scripts/index.ts +3 -3
- package/src/performance/scripts/make-graphql-request.ts +3 -4
- package/src/performance/scripts/run-inbox-outbox-scenario.ts +8 -8
- package/src/performance/scripts/run-scenario.ts +1 -1
- package/src/performance/utils/index.ts +2 -2
- package/src/performance/utils/report-generation.ts +2 -2
- package/src/tests/utils/index.ts +1 -1
- package/src/tests/utils/stub-helpers.ts +2 -2
- package/dist/cjs/index.d.ts +0 -2
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/performance/index.d.ts +0 -3
- package/dist/cjs/performance/index.d.ts.map +0 -1
- package/dist/cjs/performance/index.js.map +0 -1
- package/dist/cjs/performance/plugins/inbox-outbox-report-endpoint-plugin.d.ts.map +0 -1
- package/dist/cjs/performance/plugins/inbox-outbox-report-endpoint-plugin.js.map +0 -1
- package/dist/cjs/performance/plugins/inbox-outbox-state-endpoint-plugin.d.ts.map +0 -1
- package/dist/cjs/performance/plugins/inbox-outbox-state-endpoint-plugin.js.map +0 -1
- package/dist/cjs/performance/plugins/index.d.ts +0 -3
- package/dist/cjs/performance/plugins/index.d.ts.map +0 -1
- package/dist/cjs/performance/plugins/index.js.map +0 -1
- package/dist/cjs/performance/scripts/index.d.ts +0 -4
- package/dist/cjs/performance/scripts/index.d.ts.map +0 -1
- package/dist/cjs/performance/scripts/index.js.map +0 -1
- package/dist/cjs/performance/scripts/make-graphql-request.d.ts +0 -29
- package/dist/cjs/performance/scripts/make-graphql-request.d.ts.map +0 -1
- package/dist/cjs/performance/scripts/make-graphql-request.js.map +0 -1
- package/dist/cjs/performance/scripts/run-inbox-outbox-scenario.d.ts +0 -97
- package/dist/cjs/performance/scripts/run-inbox-outbox-scenario.d.ts.map +0 -1
- package/dist/cjs/performance/scripts/run-inbox-outbox-scenario.js.map +0 -1
- package/dist/cjs/performance/scripts/run-scenario.d.ts.map +0 -1
- package/dist/cjs/performance/scripts/run-scenario.js.map +0 -1
- package/dist/cjs/performance/utils/colorize-text.d.ts.map +0 -1
- package/dist/cjs/performance/utils/colorize-text.js.map +0 -1
- package/dist/cjs/performance/utils/index.d.ts +0 -3
- package/dist/cjs/performance/utils/index.d.ts.map +0 -1
- package/dist/cjs/performance/utils/index.js.map +0 -1
- package/dist/cjs/performance/utils/report-generation.d.ts.map +0 -1
- package/dist/cjs/performance/utils/report-generation.js.map +0 -1
- package/dist/esm/index.d.ts +0 -2
- package/dist/esm/index.d.ts.map +0 -1
- package/dist/esm/index.js +0 -2
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/package.json +0 -1
- package/dist/esm/performance/index.d.ts +0 -3
- package/dist/esm/performance/index.d.ts.map +0 -1
- package/dist/esm/performance/index.js +0 -3
- package/dist/esm/performance/index.js.map +0 -1
- package/dist/esm/performance/plugins/inbox-outbox-report-endpoint-plugin.d.ts +0 -22
- package/dist/esm/performance/plugins/inbox-outbox-report-endpoint-plugin.d.ts.map +0 -1
- package/dist/esm/performance/plugins/inbox-outbox-report-endpoint-plugin.js +0 -68
- package/dist/esm/performance/plugins/inbox-outbox-report-endpoint-plugin.js.map +0 -1
- package/dist/esm/performance/plugins/inbox-outbox-state-endpoint-plugin.d.ts +0 -23
- package/dist/esm/performance/plugins/inbox-outbox-state-endpoint-plugin.d.ts.map +0 -1
- package/dist/esm/performance/plugins/inbox-outbox-state-endpoint-plugin.js +0 -78
- package/dist/esm/performance/plugins/inbox-outbox-state-endpoint-plugin.js.map +0 -1
- package/dist/esm/performance/plugins/index.d.ts +0 -3
- package/dist/esm/performance/plugins/index.d.ts.map +0 -1
- package/dist/esm/performance/plugins/index.js.map +0 -1
- package/dist/esm/performance/scripts/index.d.ts +0 -4
- package/dist/esm/performance/scripts/index.d.ts.map +0 -1
- package/dist/esm/performance/scripts/index.js +0 -4
- package/dist/esm/performance/scripts/index.js.map +0 -1
- package/dist/esm/performance/scripts/make-graphql-request.d.ts.map +0 -1
- package/dist/esm/performance/scripts/make-graphql-request.js +0 -16
- package/dist/esm/performance/scripts/make-graphql-request.js.map +0 -1
- package/dist/esm/performance/scripts/run-inbox-outbox-scenario.d.ts.map +0 -1
- package/dist/esm/performance/scripts/run-inbox-outbox-scenario.js +0 -141
- package/dist/esm/performance/scripts/run-inbox-outbox-scenario.js.map +0 -1
- package/dist/esm/performance/scripts/run-scenario.d.ts +0 -54
- package/dist/esm/performance/scripts/run-scenario.d.ts.map +0 -1
- package/dist/esm/performance/scripts/run-scenario.js +0 -33
- package/dist/esm/performance/scripts/run-scenario.js.map +0 -1
- package/dist/esm/performance/utils/colorize-text.d.ts +0 -3
- package/dist/esm/performance/utils/colorize-text.d.ts.map +0 -1
- package/dist/esm/performance/utils/colorize-text.js +0 -3
- package/dist/esm/performance/utils/colorize-text.js.map +0 -1
- package/dist/esm/performance/utils/index.d.ts +0 -3
- package/dist/esm/performance/utils/index.d.ts.map +0 -1
- package/dist/esm/performance/utils/index.js +0 -3
- package/dist/esm/performance/utils/index.js.map +0 -1
- package/dist/esm/performance/utils/report-generation.d.ts +0 -14
- package/dist/esm/performance/utils/report-generation.d.ts.map +0 -1
- package/dist/esm/performance/utils/report-generation.js +0 -235
- package/dist/esm/performance/utils/report-generation.js.map +0 -1
- /package/dist/{cjs/performance → performance}/scripts/run-scenario.d.ts +0 -0
- /package/dist/{cjs/performance → performance}/utils/colorize-text.d.ts +0 -0
- /package/dist/{cjs/performance → performance}/utils/colorize-text.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-outbox-state-endpoint-plugin.d.ts","sourceRoot":"","sources":["../../../../src/performance/plugins/inbox-outbox-state-endpoint-plugin.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAa,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAmC/B;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,WAAW,IAAI,MAEvD,QAAQ,OAAO,EACf,uBAAuB;IAAE,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,EACpD,UAAU,OAAO,EACjB,gBAAgB,kBAAkB,KACjC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAmBnC,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,iCAsB1C,CAAC"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { gql, makeExtendSchemaPlugin } from 'graphile-utils';
|
|
2
|
-
const inboxActiveCount = 'inboxActiveCount';
|
|
3
|
-
const outboxActiveCount = 'outboxActiveCount';
|
|
4
|
-
const inboxOutboxState = 'inboxOutboxState';
|
|
5
|
-
/**
|
|
6
|
-
* Queries for the count of rows of either inbox or outbox table for not
|
|
7
|
-
* processed and not abandoned rows for a specified testId.
|
|
8
|
-
*/
|
|
9
|
-
const getRowsCount = async (table, testId, ownerPool) => {
|
|
10
|
-
const client = await ownerPool.connect();
|
|
11
|
-
try {
|
|
12
|
-
const testIdPath = table === 'inbox'
|
|
13
|
-
? `metadata->'messageContext'->>'testId'`
|
|
14
|
-
: `metadata->'envelopeOverrides'->'message_context'->>'testId'`;
|
|
15
|
-
const result = await client.query(`SELECT COUNT(id) FROM app_hidden.${table}
|
|
16
|
-
WHERE ${testIdPath} = $1 AND
|
|
17
|
-
processed_at is NULL AND
|
|
18
|
-
abandoned_at is NULL;`, [testId]);
|
|
19
|
-
return result.rows[0].count;
|
|
20
|
-
}
|
|
21
|
-
finally {
|
|
22
|
-
client.release();
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Returns a postgraphile plugin function that returns the counts of inbox
|
|
27
|
-
* and/or outbox entries that are still not completed and not abandoned for a
|
|
28
|
-
* specified testId. Undefined will be returned for a count value that is not
|
|
29
|
-
* explicitly requested.
|
|
30
|
-
*/
|
|
31
|
-
export const getInboxOutboxStateFunction = (ownerPool) => {
|
|
32
|
-
return async (_query, { input: { testId } }, _context, { fieldNodes }) => {
|
|
33
|
-
const selectedProperties = fieldNodes
|
|
34
|
-
.find((node) => node.name.value === inboxOutboxState)
|
|
35
|
-
?.selectionSet?.selections.map((s) => s.name.value) ??
|
|
36
|
-
[];
|
|
37
|
-
const inboxResult = selectedProperties.includes(inboxActiveCount)
|
|
38
|
-
? await getRowsCount('inbox', testId, ownerPool)
|
|
39
|
-
: undefined;
|
|
40
|
-
const outboxResult = selectedProperties.includes(outboxActiveCount)
|
|
41
|
-
? await getRowsCount('outbox', testId, ownerPool)
|
|
42
|
-
: undefined;
|
|
43
|
-
return {
|
|
44
|
-
[inboxActiveCount]: inboxResult,
|
|
45
|
-
[outboxActiveCount]: outboxResult,
|
|
46
|
-
};
|
|
47
|
-
};
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Plugin that adds a custom graphql endpoint `inboxOutboxState` which checks if
|
|
51
|
-
* inbox and/or outbox entries with the specific test ID are still being
|
|
52
|
-
* processed and returns the count of such entries. Test ID is expected to be
|
|
53
|
-
* passed as `message_context: { testId: "test ID value"}` with the message and
|
|
54
|
-
* is a expected to be string. `ownerPool` must be available as part of the
|
|
55
|
-
* postgraphile `graphileBuildOptions`.
|
|
56
|
-
*/
|
|
57
|
-
export const InboxOutboxStateEndpointPlugin = makeExtendSchemaPlugin((_, { ownerPool }) => {
|
|
58
|
-
return {
|
|
59
|
-
typeDefs: gql `
|
|
60
|
-
input InboxOutboxStateInput {
|
|
61
|
-
testId: String!
|
|
62
|
-
}
|
|
63
|
-
type InboxOutboxStatePayload {
|
|
64
|
-
${inboxActiveCount}: Int!
|
|
65
|
-
${outboxActiveCount}: Int!
|
|
66
|
-
}
|
|
67
|
-
extend type Query {
|
|
68
|
-
${inboxOutboxState}(input: InboxOutboxStateInput!): InboxOutboxStatePayload
|
|
69
|
-
}
|
|
70
|
-
`,
|
|
71
|
-
resolvers: {
|
|
72
|
-
Query: {
|
|
73
|
-
[inboxOutboxState]: getInboxOutboxStateFunction(ownerPool),
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
77
|
-
});
|
|
78
|
-
//# sourceMappingURL=inbox-outbox-state-endpoint-plugin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inbox-outbox-state-endpoint-plugin.js","sourceRoot":"","sources":["../../../../src/performance/plugins/inbox-outbox-state-endpoint-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,C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MAAM,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC;YAChD,CAAC,CAAC,SAAS,CAAC;QACd,MAAM,YAAY,GAAG,kBAAkB,CAAC,QAAQ,CAAC,iBAAiB,CAAC;YACjE,CAAC,CAAC,MAAM,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC;YACjD,CAAC,CAAC,SAAS,CAAC;QAEd,OAAO;YACL,CAAC,gBAAgB,CAAC,EAAE,WAAW;YAC/B,CAAC,iBAAiB,CAAC,EAAE,YAAY;SAClC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,sBAAsB,CAClE,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;IACnB,OAAO;QACL,QAAQ,EAAE,GAAG,CAAA;;;;;UAKT,gBAAgB;UAChB,iBAAiB;;;UAGjB,gBAAgB;;KAErB;QACC,SAAS,EAAE;YACT,KAAK,EAAE;gBACL,CAAC,gBAAgB,CAAC,EAAE,2BAA2B,CAAC,SAAS,CAAC;aAC3D;SACF;KACF,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/performance/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/performance/plugins/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,0CAA0C,CAAC;AAC3F,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/performance/scripts/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/performance/scripts/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mBAAmB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"make-graphql-request.d.ts","sourceRoot":"","sources":["../../../../src/performance/scripts/make-graphql-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,YAAY,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAU,2CAMzC,yBAAyB,KAAG,OAAO,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,CAAC,CAa1D,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
import { print } from 'graphql/language/printer.js';
|
|
3
|
-
/**
|
|
4
|
-
* Wrapper to make a GraphQL request with minimal input parameters
|
|
5
|
-
*/
|
|
6
|
-
export const makeGraphQLRequest = async ({ baseUrl, operation, variables, token, }) => {
|
|
7
|
-
return axios.post(new URL('graphql', baseUrl).href, {
|
|
8
|
-
query: print(operation),
|
|
9
|
-
variables,
|
|
10
|
-
}, {
|
|
11
|
-
headers: {
|
|
12
|
-
Authorization: `Bearer ${token}`,
|
|
13
|
-
},
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=make-graphql-request.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"make-graphql-request.js","sourceRoot":"","sources":["../../../../src/performance/scripts/make-graphql-request.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,KAAK,EAAE,MAAM,6BAA6B,CAAC;AAyBpD;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EAAE,EACvC,OAAO,EACP,SAAS,EACT,SAAS,EACT,KAAK,GAEkB,EAAoC,EAAE;IAC7D,OAAO,KAAK,CAAC,IAAI,CACf,IAAI,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,IAAI,EAChC;QACE,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;QACvB,SAAS;KACV,EACD;QACE,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;SACjC;KACF,CACF,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-inbox-outbox-scenario.d.ts","sourceRoot":"","sources":["../../../../src/performance/scripts/run-inbox-outbox-scenario.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EAGP,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AACjF,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,cAAc,EAEnB,KAAK,cAAc,EAEpB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAE,KAAK,YAAY,EAAe,MAAM,mBAAmB,CAAC;AAEnE;;GAEG;AACH,KAAK,0BAA0B,GAAG,IAAI,CAC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AEnC,gBAAgB,MAAM,KACrB,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAsC9B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,CAAC,SAAS,yBAAyB,EAEnC,gBAAgB,MAAM,MAER,mBAAmB,CAAC,KAAG,OAAO,CAAC,MAAM,CAgBpD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAAU,CAAC,SAAS,yBAAyB,EAAE,sBAE5E,CAAC,KAAG,OAAO,CAAC,IAAI,CAIlB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,CAAC,SAAS,yBAAyB,EACnC,oFAOC,4BAA4B,KAAG,OAAO,CAAC,IAAI,CAc7C,CAAC"}
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { getManagedServiceAccountToken } from '@axinom/mosaic-id-link-be';
|
|
3
|
-
import { Broker, RascalConfigBuilder, setupMessagingBroker, } from '@axinom/mosaic-message-bus';
|
|
4
|
-
import {} from '@axinom/mosaic-message-bus-abstractions';
|
|
5
|
-
import { Logger, ShutdownActionsMiddleware, } from '@axinom/mosaic-service-common';
|
|
6
|
-
import gql from 'graphql-tag';
|
|
7
|
-
import { randomUUID } from 'node:crypto';
|
|
8
|
-
import { makeGraphQLRequest } from './make-graphql-request.js';
|
|
9
|
-
import { runScenario } from './run-scenario.js';
|
|
10
|
-
/**
|
|
11
|
-
* Generic setup function to produce all required components to run messaging
|
|
12
|
-
* tests for services using transactional inbox-outbox pattern.
|
|
13
|
-
*/
|
|
14
|
-
export const getInboxOutboxSetup = (messagingSettings, config) => {
|
|
15
|
-
return async () => {
|
|
16
|
-
const shutdownActions = [];
|
|
17
|
-
const builder = new RascalConfigBuilder(messagingSettings, config);
|
|
18
|
-
const broker = await setupMessagingBroker({
|
|
19
|
-
config,
|
|
20
|
-
builders: [
|
|
21
|
-
messagingSettings.action === 'command'
|
|
22
|
-
? builder.sendCommand()
|
|
23
|
-
: builder.publishEvent(),
|
|
24
|
-
],
|
|
25
|
-
logger: new Logger({ config }),
|
|
26
|
-
// we just want setupMessagingBroker to push shutdown actions to an array
|
|
27
|
-
// and call it manually
|
|
28
|
-
shutdownActions: shutdownActions,
|
|
29
|
-
});
|
|
30
|
-
const token = (await getManagedServiceAccountToken(config.idServiceAuthBaseUrl, config.managedServiceAccountClientId, config.managedServiceAccountClientSecret, config.tenantId, config.environmentId)).accessToken;
|
|
31
|
-
return {
|
|
32
|
-
testId: randomUUID(),
|
|
33
|
-
config,
|
|
34
|
-
broker,
|
|
35
|
-
token,
|
|
36
|
-
shutdownActions,
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Generic iteration function to send RabbitMQ messages.
|
|
42
|
-
*/
|
|
43
|
-
export const getInboxOutboxIteration = (payload, messagingSettings) => {
|
|
44
|
-
return async ({ broker, token, testId, config }) => {
|
|
45
|
-
await broker.publish(config.environmentId, messagingSettings, payload, {
|
|
46
|
-
auth_token: token,
|
|
47
|
-
message_context: { testId },
|
|
48
|
-
});
|
|
49
|
-
};
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Generic hasScenarioCompleted function to check if all inbox and outbox
|
|
53
|
-
* messages have been processed.
|
|
54
|
-
*/
|
|
55
|
-
export const getInboxOutboxHasScenarioCompleted = (serviceBaseUrl) => {
|
|
56
|
-
let checks = 1;
|
|
57
|
-
let isFirstLog = true;
|
|
58
|
-
return async ({ token, testId }) => {
|
|
59
|
-
const response = await makeGraphQLRequest({
|
|
60
|
-
baseUrl: serviceBaseUrl,
|
|
61
|
-
token,
|
|
62
|
-
variables: { testId },
|
|
63
|
-
operation: gql `
|
|
64
|
-
query GetState($testId: String!) {
|
|
65
|
-
inboxOutboxState(input: { testId: $testId }) {
|
|
66
|
-
inboxActiveCount
|
|
67
|
-
outboxActiveCount
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`,
|
|
71
|
-
});
|
|
72
|
-
const inbox = response.data.data.inboxOutboxState.inboxActiveCount;
|
|
73
|
-
const outbox = response.data.data.inboxOutboxState.outboxActiveCount;
|
|
74
|
-
const clearLine = ' '.repeat(10); // Empty line to clear leftover characters
|
|
75
|
-
process.stdout.write(`${isFirstLog ? '' : '\r' // erase previous log in the terminal to preserve space for multiple reports
|
|
76
|
-
}Waiting for all messages to be processed: inbox - ${inbox}; outbox - ${outbox}${clearLine}`);
|
|
77
|
-
if (isFirstLog) {
|
|
78
|
-
isFirstLog = false;
|
|
79
|
-
}
|
|
80
|
-
if (inbox === 0 && outbox === 0 && checks > 1) {
|
|
81
|
-
process.stdout.write('\n'); // make sure next log is not written on the same line as the log above
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
else if (inbox === 0 && outbox === 0) {
|
|
85
|
-
// Make sure it does not bounce back, so doing 2 checks
|
|
86
|
-
checks++;
|
|
87
|
-
}
|
|
88
|
-
return false;
|
|
89
|
-
};
|
|
90
|
-
};
|
|
91
|
-
/**
|
|
92
|
-
* Generic function to request a report from the target service that scenario is
|
|
93
|
-
* running against.
|
|
94
|
-
*/
|
|
95
|
-
export const getInboxOutboxGenerateReport = (serviceBaseUrl) => {
|
|
96
|
-
return async ({ token, testId }) => {
|
|
97
|
-
const response = await makeGraphQLRequest({
|
|
98
|
-
baseUrl: serviceBaseUrl,
|
|
99
|
-
token,
|
|
100
|
-
variables: { testId },
|
|
101
|
-
operation: gql `
|
|
102
|
-
query GetInboxOutboxReport($testId: String!) {
|
|
103
|
-
inboxOutboxReport(input: { testId: $testId }) {
|
|
104
|
-
inboxReport
|
|
105
|
-
outboxReport
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
`,
|
|
109
|
-
});
|
|
110
|
-
return `[INBOX]\n${response.data.data.inboxOutboxReport.inboxReport}\n\n[OUTBOX]\n${response.data.data.inboxOutboxReport.outboxReport}`;
|
|
111
|
-
};
|
|
112
|
-
};
|
|
113
|
-
/**
|
|
114
|
-
* Generic function to run all shutdown actions, e.g. dispose the broker.
|
|
115
|
-
*/
|
|
116
|
-
export const inboxOutboxTeardown = async ({ shutdownActions, }) => {
|
|
117
|
-
for await (const shutdown of shutdownActions) {
|
|
118
|
-
await shutdown();
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
/**
|
|
122
|
-
* A wrapper function for the `runScenario` to send RabbitMQ messages for the
|
|
123
|
-
* service using transactional inbox-outbox pattern. Has limited configuration
|
|
124
|
-
* fitting for simple cases where sending a message with the same payload is
|
|
125
|
-
* acceptable. For more complex scenarios - consider using `runScenario` explicitly.
|
|
126
|
-
*/
|
|
127
|
-
export const runInboxOutboxScenario = async ({ runnerConfig, messagingSettings, config, payload, serviceBaseUrl, description, }) => {
|
|
128
|
-
await runScenario({
|
|
129
|
-
description,
|
|
130
|
-
runnerConfig: {
|
|
131
|
-
iterations: runnerConfig?.iterations ?? 50,
|
|
132
|
-
awaitCompletionIntervalInSec: runnerConfig?.awaitCompletionIntervalInSec ?? 5,
|
|
133
|
-
},
|
|
134
|
-
setup: getInboxOutboxSetup(messagingSettings, config),
|
|
135
|
-
iteration: getInboxOutboxIteration(payload, messagingSettings),
|
|
136
|
-
hasScenarioCompleted: getInboxOutboxHasScenarioCompleted(serviceBaseUrl),
|
|
137
|
-
generateReport: getInboxOutboxGenerateReport(serviceBaseUrl),
|
|
138
|
-
teardown: inboxOutboxTeardown,
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
//# sourceMappingURL=run-inbox-outbox-scenario.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-inbox-outbox-scenario.js","sourceRoot":"","sources":["../../../../src/performance/scripts/run-inbox-outbox-scenario.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,6BAA6B,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EACL,MAAM,EACN,mBAA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AK,EAEzC,EACA,YAAY,EACZ,iBAAiB,EACjB,MAAM,EACN,OAAO,EACP,cAAc,EACd,WAAW,GACkB,EAAiB,EAAE;IAChD,MAAM,WAAW,CAAI;QACnB,WAAW;QACX,YAAY,EAAE;YACZ,UAAU,EAAE,YAAY,EAAE,UAAU,IAAI,EAAE;YAC1C,4BAA4B,EAC1B,YAAY,EAAE,4BAA4B,IAAI,CAAC;SAClD;QACD,KAAK,EAAE,mBAAmB,CAAC,iBAAiB,EAAE,MAAM,CAAC;QACrD,SAAS,EAAE,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,CAAC;QAC9D,oBAAoB,EAAE,kCAAkC,CAAC,cAAc,CAAC;QACxE,cAAc,EAAE,4BAA4B,CAAC,cAAc,CAAC;QAC5D,QAAQ,EAAE,mBAAmB;KAC9B,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration to fine-tune how scenario is executed.
|
|
3
|
-
*/
|
|
4
|
-
export interface RunnerConfig {
|
|
5
|
-
/**
|
|
6
|
-
* Defines how many times the `iteration` function will be executed.
|
|
7
|
-
*/
|
|
8
|
-
iterations: number;
|
|
9
|
-
/**
|
|
10
|
-
* Defines how long will the scenario wait to call the `hasScenarioCompleted`
|
|
11
|
-
* function to check if scenario is ready for report generation.
|
|
12
|
-
*/
|
|
13
|
-
awaitCompletionIntervalInSec: number;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Configuration for the `runScenario` function.
|
|
17
|
-
*/
|
|
18
|
-
export interface RunScenarioConfig<TC> {
|
|
19
|
-
/**
|
|
20
|
-
* Description of the scenario. Printed together with the report.
|
|
21
|
-
*/
|
|
22
|
-
description?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Configuration to fine-tune how scenario is executed.
|
|
25
|
-
*/
|
|
26
|
-
runnerConfig: RunnerConfig;
|
|
27
|
-
/**
|
|
28
|
-
* Function to set up initial data that can be reused by other scenario functions.
|
|
29
|
-
*/
|
|
30
|
-
setup: () => Promise<TC>;
|
|
31
|
-
/**
|
|
32
|
-
* Function that will be repeatedly executed as many times as defined in `runnerConfig.iterations`.
|
|
33
|
-
*/
|
|
34
|
-
iteration: (tc: TC) => Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Function to check if scenario is completed, e.g. call a service API and
|
|
37
|
-
* return true or false based on response.
|
|
38
|
-
*/
|
|
39
|
-
hasScenarioCompleted: (tc: TC) => Promise<boolean>;
|
|
40
|
-
/**
|
|
41
|
-
* Function to generate a report for the scenario. Printed as is.
|
|
42
|
-
*/
|
|
43
|
-
generateReport: (tc: TC) => Promise<string>;
|
|
44
|
-
/**
|
|
45
|
-
* Function to cleanup after scenario is completed.
|
|
46
|
-
*/
|
|
47
|
-
teardown: (tc: TC) => Promise<void>;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Generic function to execute a custom piece of code multiple times, await for
|
|
51
|
-
* the completion of processing caused by previous execution, and print a report.
|
|
52
|
-
*/
|
|
53
|
-
export declare const runScenario: <TC>({ description, runnerConfig: { iterations, awaitCompletionIntervalInSec }, setup, iteration, hasScenarioCompleted, generateReport, teardown, }: RunScenarioConfig<TC>) => Promise<void>;
|
|
54
|
-
//# sourceMappingURL=run-scenario.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-scenario.d.ts","sourceRoot":"","sources":["../../../../src/performance/scripts/run-scenario.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,EAAE;IACnC;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,KAAK,EAAE,MAAM,OAAO,CAAC,EAAE,CAAC,CAAC;IACzB;;OAEG;IACH,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC;;;OAGG;IACH,oBAAoB,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnD;;OAEG;IACH,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C;;OAEG;IACH,QAAQ,EAAE,CAAC,EAAE,EAAE,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACrC;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,GAAU,EAAE,EAAE,gJAQnC,iBAAiB,CAAC,EAAE,CAAC,KAAG,OAAO,CAAC,IAAI,CA6BtC,CAAC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { sleep } from '@axinom/mosaic-service-common';
|
|
3
|
-
import { blue } from '../utils/index.js';
|
|
4
|
-
/**
|
|
5
|
-
* Generic function to execute a custom piece of code multiple times, await for
|
|
6
|
-
* the completion of processing caused by previous execution, and print a report.
|
|
7
|
-
*/
|
|
8
|
-
export const runScenario = async ({ description, runnerConfig: { iterations, awaitCompletionIntervalInSec }, setup, iteration, hasScenarioCompleted, generateReport, teardown, }) => {
|
|
9
|
-
console.log(blue(`Scenario has started:\n\t${description}`));
|
|
10
|
-
console.log('Performing setup...');
|
|
11
|
-
const tc = await setup();
|
|
12
|
-
console.log('Running iterations...');
|
|
13
|
-
Array.from({ length: iterations }).map(async () => {
|
|
14
|
-
await iteration(tc);
|
|
15
|
-
});
|
|
16
|
-
console.log('Checking if scenario is completed...');
|
|
17
|
-
while (!(await hasScenarioCompleted(tc))) {
|
|
18
|
-
await sleep(awaitCompletionIntervalInSec * 1000);
|
|
19
|
-
}
|
|
20
|
-
console.log(`Generating report...`);
|
|
21
|
-
const report = await generateReport(tc);
|
|
22
|
-
console.log('Performing teardown...');
|
|
23
|
-
await teardown(tc);
|
|
24
|
-
console.log(`Scenario has finished! See report below:`);
|
|
25
|
-
console.log('\n--------------------------------------------');
|
|
26
|
-
if (description) {
|
|
27
|
-
console.log(`- Scenario Description: ${blue(description)}\n`);
|
|
28
|
-
}
|
|
29
|
-
console.log(report);
|
|
30
|
-
console.log('--------------------------------------------\n');
|
|
31
|
-
process.exit(0);
|
|
32
|
-
};
|
|
33
|
-
//# sourceMappingURL=run-scenario.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-scenario.js","sourceRoot":"","sources":["../../../../src/performance/scripts/run-scenario.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAoDzC;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,KAAK,EAAM,EACpC,WAAW,EACX,YAAY,EAAE,EAAE,UAAU,EAAE,4BAA4B,EAAE,EAC1D,KAAK,EACL,SAAS,EACT,oBAAoB,EACpB,cAAc,EACd,QAAQ,GACc,EAAiB,EAAE;IACzC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,4BAA4B,WAAW,EAAE,CAAC,CAAC,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,MAAM,KAAK,EAAE,CAAC;IAEzB,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC;IACrC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE;QAChD,MAAM,SAAS,CAAC,EAAE,CAAC,CAAC;IACtB,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACpD,OAAO,CAAC,CAAC,MAAM,oBAAoB,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACzC,MAAM,KAAK,CAAC,4BAA4B,GAAG,IAAI,CAAC,CAAC;IACnD,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;IAExC,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACtC,MAAM,QAAQ,CAAC,EAAE,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAC9D,IAAI,WAAW,EAAE,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,2BAA2B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpB,OAAO,CAAC,GAAG,CAAC,gDAAgD,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colorize-text.d.ts","sourceRoot":"","sources":["../../../../src/performance/utils/colorize-text.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,IAAI,GAAI,MAAM,MAAM,GAAG,MAAM,KAAG,MACd,CAAC;AAChC,eAAO,MAAM,GAAG,GAAI,MAAM,MAAM,GAAG,MAAM,KAAG,MACb,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colorize-text.js","sourceRoot":"","sources":["../../../../src/performance/utils/colorize-text.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAqB,EAAU,EAAE,CACpD,aAAa,IAAI,YAAY,CAAC;AAChC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAqB,EAAU,EAAE,CACnD,aAAa,IAAI,YAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/performance/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/performance/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Pool } from 'pg';
|
|
2
|
-
interface InboxOutboxRow {
|
|
3
|
-
created_at: string;
|
|
4
|
-
processed_at: string | null;
|
|
5
|
-
abandoned_at: string | null;
|
|
6
|
-
sent_at: string | null;
|
|
7
|
-
started_attempts: number;
|
|
8
|
-
}
|
|
9
|
-
export declare const getGeneralReport: (entries: InboxOutboxRow[], testId: string) => string;
|
|
10
|
-
export declare const getStoredReport: (entries: InboxOutboxRow[], table: "inbox" | "outbox") => string;
|
|
11
|
-
export declare const getProcessedReport: (entries: InboxOutboxRow[], table: "inbox" | "outbox") => string;
|
|
12
|
-
export declare const getReportRows: (table: "inbox" | "outbox", testId: string, ownerPool: Pool) => Promise<InboxOutboxRow[]>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=report-generation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"report-generation.d.ts","sourceRoot":"","sources":["../../../../src/performance/utils/report-generation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAK/B,UAAU,cAAc;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAgQD,eAAO,MAAM,gBAAgB,GAC3B,SAAS,cAAc,EAAE,EACzB,QAAQ,MAAM,KACb,MAeF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,SAAS,cAAc,EAAE,EACzB,OAAO,OAAO,GAAG,QAAQ,KACxB,MAqCF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,SAAS,cAAc,EAAE,EACzB,OAAO,OAAO,GAAG,QAAQ,KACxB,MAmDF,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,OAAO,OAAO,GAAG,QAAQ,EACzB,QAAQ,MAAM,EACd,WAAW,IAAI,KACd,OAAO,CAAC,cAAc,EAAE,CAiB1B,CAAC"}
|