@toa.io/definitions 1.0.0-alpha.336 → 1.0.0-alpha.338
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/package.json +2 -2
- package/schemas/extensions.chronicles/annotation.cos.yaml +4 -2
- package/transpiled/extensions.chronicles/components.d.ts +1 -1
- package/transpiled/extensions.chronicles/components.js +9 -3
- package/transpiled/extensions.chronicles/components.js.map +1 -1
- package/transpiled/extensions.chronicles/const.d.ts +5 -1
- package/transpiled/extensions.chronicles/const.js +6 -7
- package/transpiled/extensions.chronicles/const.js.map +1 -1
- package/transpiled/extensions.chronicles/deployment.d.ts +2 -1
- package/transpiled/extensions.chronicles/deployment.js +12 -7
- package/transpiled/extensions.chronicles/deployment.js.map +1 -1
- package/transpiled/extensions.chronicles/types.d.ts +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@toa.io/definitions",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.338",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "What Toa packages declare, read without running them",
|
|
6
6
|
"author": "temich <tema.gurtovoy@gmail.com>",
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"optional": true
|
|
73
73
|
}
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "6555b48ce1102ac67a0b99128e03f1e10196b4d8"
|
|
76
76
|
}
|
|
@@ -6,7 +6,9 @@ properties:
|
|
|
6
6
|
type: string
|
|
7
7
|
pattern: ^amqps?://
|
|
8
8
|
store:
|
|
9
|
-
description:
|
|
9
|
+
description: >
|
|
10
|
+
Where the log is read, by the provider that keeps it; absent, the context writes the log and
|
|
11
|
+
does not read it
|
|
10
12
|
oneOf:
|
|
11
13
|
- type: object
|
|
12
14
|
properties:
|
|
@@ -48,5 +50,5 @@ properties:
|
|
|
48
50
|
type: string
|
|
49
51
|
minItems: 2
|
|
50
52
|
maxItems: 2
|
|
51
|
-
required: [broker
|
|
53
|
+
required: [broker]
|
|
52
54
|
additionalProperties: false
|
|
@@ -2,6 +2,6 @@ import { type Components } from '../digest/read.ts';
|
|
|
2
2
|
import type { Annotation } from './types.ts';
|
|
3
3
|
/**
|
|
4
4
|
* The components this extension ships, which run inside its own service: the encounters only
|
|
5
|
-
* where the annotation serves them.
|
|
5
|
+
* where the annotation serves them, and the queries unless it names no store to read.
|
|
6
6
|
*/
|
|
7
7
|
export declare function components(annotation?: Partial<Annotation>): Components;
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import { components as digest } from '../digest/read.js';
|
|
2
|
-
import { ENCOUNTERS, NAMESPACE } from './const.js';
|
|
2
|
+
import { ENCOUNTERS, NAMESPACE, QUERIES } from './const.js';
|
|
3
3
|
/**
|
|
4
4
|
* The components this extension ships, which run inside its own service: the encounters only
|
|
5
|
-
* where the annotation serves them.
|
|
5
|
+
* where the annotation serves them, and the queries unless it names no store to read.
|
|
6
6
|
*/
|
|
7
7
|
export function components(annotation) {
|
|
8
|
-
return digest('extensions.chronicles', (label) =>
|
|
8
|
+
return digest('extensions.chronicles', (label) => {
|
|
9
|
+
if (label === `${NAMESPACE}-${ENCOUNTERS}`)
|
|
10
|
+
return annotation?.encounters === true;
|
|
11
|
+
if (label === `${NAMESPACE}-${QUERIES}`)
|
|
12
|
+
return annotation === undefined || annotation.store !== undefined;
|
|
13
|
+
return true;
|
|
14
|
+
});
|
|
9
15
|
}
|
|
10
16
|
//# sourceMappingURL=components.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../source/extensions.chronicles/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,MAAM,EAAmB,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../source/extensions.chronicles/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,MAAM,EAAmB,MAAM,mBAAmB,CAAA;AACzE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAG3D;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,UAAgC;IACzD,OAAO,MAAM,CAAC,uBAAuB,EAAE,CAAC,KAAK,EAAE,EAAE;QAC/C,IAAI,KAAK,KAAK,GAAG,SAAS,IAAI,UAAU,EAAE;YAAE,OAAO,UAAU,EAAE,UAAU,KAAK,IAAI,CAAA;QAClF,IAAI,KAAK,KAAK,GAAG,SAAS,IAAI,OAAO,EAAE;YACrC,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,KAAK,KAAK,SAAS,CAAA;QAEnE,OAAO,IAAI,CAAA;IACb,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
export declare const SETTINGS = "TOA_CHRONICLES";
|
|
3
3
|
/** The secret of the broker the rows are published to, and of the store they are read from. */
|
|
4
4
|
export declare const SECRET = "toa-chronicles";
|
|
5
|
-
/** Its keys: the
|
|
5
|
+
/** Its keys: the user of the broker, which every context that keeps the log has. */
|
|
6
|
+
export declare const BROKER_KEYS: string[];
|
|
7
|
+
/** And the user of the store, which only a context that reads the log has. */
|
|
8
|
+
export declare const STORE_KEYS: string[];
|
|
9
|
+
/** All of them. */
|
|
6
10
|
export declare const KEYS: string[];
|
|
7
11
|
/** The namespace of the components this extension ships. */
|
|
8
12
|
export declare const NAMESPACE = "chronicles";
|
|
@@ -2,13 +2,12 @@
|
|
|
2
2
|
export const SETTINGS = 'TOA_CHRONICLES';
|
|
3
3
|
/** The secret of the broker the rows are published to, and of the store they are read from. */
|
|
4
4
|
export const SECRET = 'toa-chronicles';
|
|
5
|
-
/** Its keys: the
|
|
6
|
-
export const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
];
|
|
5
|
+
/** Its keys: the user of the broker, which every context that keeps the log has. */
|
|
6
|
+
export const BROKER_KEYS = ['broker_username', 'broker_password'];
|
|
7
|
+
/** And the user of the store, which only a context that reads the log has. */
|
|
8
|
+
export const STORE_KEYS = ['store_username', 'store_password'];
|
|
9
|
+
/** All of them. */
|
|
10
|
+
export const KEYS = [...BROKER_KEYS, ...STORE_KEYS];
|
|
12
11
|
/** The namespace of the components this extension ships. */
|
|
13
12
|
export const NAMESPACE = 'chronicles';
|
|
14
13
|
/** The service they run in, which is also the one consumer of the events the log is kept of. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../source/extensions.chronicles/const.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAA;AAExC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAA;AAEtC,
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"","sources":["../../source/extensions.chronicles/const.ts"],"names":[],"mappings":"AAAA,kGAAkG;AAClG,MAAM,CAAC,MAAM,QAAQ,GAAG,gBAAgB,CAAA;AAExC,+FAA+F;AAC/F,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAA;AAEtC,oFAAoF;AACpF,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,CAAA;AAEjE,8EAA8E;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,CAAA;AAE9D,mBAAmB;AACnB,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,GAAG,WAAW,EAAE,GAAG,UAAU,CAAC,CAAA;AAEnD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAA;AAErC,gGAAgG;AAChG,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAA;AAE9B,sGAAsG;AACtG,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAA;AAE5B,0FAA0F;AAC1F,MAAM,CAAC,MAAM,QAAQ,GAAG,YAAY,CAAA;AAEpC,2EAA2E;AAC3E,MAAM,CAAC,MAAM,UAAU,GAAG,YAAY,CAAA;AAEtC,6CAA6C;AAC7C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAA;AAEhC,+BAA+B;AAC/B,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,YAAY,CAAU,CAAA"}
|
|
@@ -4,7 +4,8 @@ import type { Dependency } from '@toa.io/operations';
|
|
|
4
4
|
/**
|
|
5
5
|
* The events the components declare are consumed, so they are published, and the service consumes
|
|
6
6
|
* them: it is given which they are and their contracts, the contracts of the facts, the store, and
|
|
7
|
-
* the store
|
|
7
|
+
* the credentials of the broker and of the store, which nothing else is. A context that names no
|
|
8
|
+
* store writes the log and does not read it: it has no queries, and no user of a store.
|
|
8
9
|
* Where the events travel is the context's `amqp`, as it is for any receiver.
|
|
9
10
|
*/
|
|
10
11
|
export declare function deployment(instances: context.Dependency[], annotation: Annotation | undefined): Dependency;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { components } from './components.js';
|
|
2
2
|
import { version } from '../version.js';
|
|
3
|
-
import { KEYS, NAMESPACE, SECRET, SERVICE, SETTINGS } from './const.js';
|
|
3
|
+
import { BROKER_KEYS, KEYS, NAMESPACE, SECRET, SERVICE, SETTINGS } from './const.js';
|
|
4
4
|
import * as schemas from './schemas.js';
|
|
5
5
|
/**
|
|
6
6
|
* The events the components declare are consumed, so they are published, and the service consumes
|
|
7
7
|
* them: it is given which they are and their contracts, the contracts of the facts, the store, and
|
|
8
|
-
* the store
|
|
8
|
+
* the credentials of the broker and of the store, which nothing else is. A context that names no
|
|
9
|
+
* store writes the log and does not read it: it has no queries, and no user of a store.
|
|
9
10
|
* Where the events travel is the context's `amqp`, as it is for any receiver.
|
|
10
11
|
*/
|
|
11
12
|
export function deployment(instances, annotation) {
|
|
@@ -49,7 +50,10 @@ export function deployment(instances, annotation) {
|
|
|
49
50
|
name: SERVICE,
|
|
50
51
|
version,
|
|
51
52
|
components: labels,
|
|
52
|
-
variables: [
|
|
53
|
+
variables: [
|
|
54
|
+
{ name: SETTINGS, value: JSON.stringify(settings) },
|
|
55
|
+
...credentials(annotation.store === undefined ? BROKER_KEYS : KEYS)
|
|
56
|
+
]
|
|
53
57
|
};
|
|
54
58
|
if (annotation.resources !== undefined)
|
|
55
59
|
service.resources = annotation.resources;
|
|
@@ -63,7 +67,8 @@ export function deployment(instances, annotation) {
|
|
|
63
67
|
export const standalone = true;
|
|
64
68
|
function read(annotation) {
|
|
65
69
|
// what is read is the user's own: the address names a server, and no database of it
|
|
66
|
-
if (
|
|
70
|
+
if (annotation.store !== undefined &&
|
|
71
|
+
new URL(annotation.store.url).pathname.replace(/\//g, '') !== '')
|
|
67
72
|
throw new Error("The store of chronicles is the address of a server: what is read is its user's.");
|
|
68
73
|
return {
|
|
69
74
|
broker: annotation.broker,
|
|
@@ -73,9 +78,9 @@ function read(annotation) {
|
|
|
73
78
|
ip: annotation.ip ?? 'truncated'
|
|
74
79
|
};
|
|
75
80
|
}
|
|
76
|
-
/** The
|
|
77
|
-
function credentials() {
|
|
78
|
-
return
|
|
81
|
+
/** The users of the broker and, where the log is read, of the store, from the secret. */
|
|
82
|
+
function credentials(keys) {
|
|
83
|
+
return keys.map((key) => ({
|
|
79
84
|
name: `${SETTINGS}_${key.toUpperCase()}`,
|
|
80
85
|
secret: { name: SECRET, key }
|
|
81
86
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../source/extensions.chronicles/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACv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EAAE;QACxC,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE;KAC9B,CAAC,CAAC,CAAA;AACL,CAAC;AAED,MAAM,IAAI,GAAgB,EAAE,MAAM,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAA"}
|
|
@@ -3,8 +3,8 @@ import type { Resources } from '@toa.io/operations';
|
|
|
3
3
|
export interface Annotation {
|
|
4
4
|
/** the AMQP address of the broker the rows are published to */
|
|
5
5
|
broker: string;
|
|
6
|
-
/** where the log is read, by the provider that keeps it */
|
|
7
|
-
store
|
|
6
|
+
/** where the log is read, by the provider that keeps it; absent, it is written and not read */
|
|
7
|
+
store?: Store;
|
|
8
8
|
/** days a row of `events` and of `encounters` is kept; absent, kept */
|
|
9
9
|
retention?: number;
|
|
10
10
|
/** whether the routes clients send encounters to are served */
|
|
@@ -23,7 +23,7 @@ export interface Store {
|
|
|
23
23
|
/** What the service is given of the annotation, its credentials aside. */
|
|
24
24
|
export interface Settings {
|
|
25
25
|
broker: string;
|
|
26
|
-
store
|
|
26
|
+
store?: Store;
|
|
27
27
|
retention?: number;
|
|
28
28
|
encounters: boolean;
|
|
29
29
|
ip: Address;
|