@toa.io/extensions.realtime 1.0.0-alpha.291 → 1.0.0-alpha.292
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/CHANGELOG.md +7 -0
- package/components/realtime.streams/tsconfig.tsbuildinfo +1 -1
- package/features/steps/Components.ts +4 -1
- package/features/steps/Realtime.ts +1 -1
- package/package.json +5 -4
- package/source/Routes.ts +1 -1
- package/source/index.ts +1 -1
- package/transpiled/Routes.d.ts +1 -1
- package/transpiled/index.d.ts +1 -1
- package/transpiled/index.js +1 -1
- package/transpiled/index.js.map +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/source/extension.ts +0 -92
- package/transpiled/extension.d.ts +0 -22
- package/transpiled/extension.js +0 -55
- package/transpiled/extension.js.map +0 -1
package/source/extension.ts
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs'
|
|
2
|
-
import { components } from './Composition.js'
|
|
3
|
-
import type { Dependency, Instances, Resources, Service } from '@toa.io/operations'
|
|
4
|
-
|
|
5
|
-
/** Where Toa's release publishes this service's image. An application takes it
|
|
6
|
-
* instead of building one when its context says `registry.services: published`. */
|
|
7
|
-
export const image = 'ghcr.io/toa-io/extension-realtime-streams'
|
|
8
|
-
|
|
9
|
-
export const standalone = true
|
|
10
|
-
export { components } from './Composition.js'
|
|
11
|
-
|
|
12
|
-
export function deployment(
|
|
13
|
-
instances: Instances<Declaration>,
|
|
14
|
-
annotation?: Declaration & Annotation
|
|
15
|
-
): Dependency {
|
|
16
|
-
const routes = []
|
|
17
|
-
const { resources, ...annotatedRoutes } = annotation ?? {}
|
|
18
|
-
const labels = components().labels
|
|
19
|
-
|
|
20
|
-
if (annotatedRoutes !== undefined) routes.push(...parse(annotatedRoutes))
|
|
21
|
-
|
|
22
|
-
for (const instance of instances) {
|
|
23
|
-
const completed: Declaration = {}
|
|
24
|
-
|
|
25
|
-
for (const [key, value] of Object.entries(instance.manifest)) {
|
|
26
|
-
const event = instance.locator.id + '.' + key
|
|
27
|
-
|
|
28
|
-
completed[event] = value
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
routes.push(...parse(completed))
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const service: Service = {
|
|
35
|
-
group: 'realtime',
|
|
36
|
-
name: 'streams',
|
|
37
|
-
image,
|
|
38
|
-
|
|
39
|
-
version: JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
|
|
40
|
-
.version,
|
|
41
|
-
components: labels,
|
|
42
|
-
resources,
|
|
43
|
-
variables: [
|
|
44
|
-
{
|
|
45
|
-
name: 'TOA_REALTIME',
|
|
46
|
-
value: JSON.stringify(routes)
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return { services: [service], events: routes.map((route) => route.event) }
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export function parse(declaration: Declaration): Route[] {
|
|
55
|
-
const routes: Route[] = []
|
|
56
|
-
|
|
57
|
-
for (const [event, value] of Object.entries(declaration))
|
|
58
|
-
if (isObject(value)) {
|
|
59
|
-
const properties = Array.isArray(value.key) ? value.key : [value.key]
|
|
60
|
-
|
|
61
|
-
routes.push({ event, properties, expose: value.expose })
|
|
62
|
-
} else {
|
|
63
|
-
const properties = Array.isArray(value) ? value : [value]
|
|
64
|
-
|
|
65
|
-
routes.push({ event, properties })
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
return routes
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
function isObject(value: Entry): value is RouteDeclaration {
|
|
72
|
-
return typeof value === 'object' && !Array.isArray(value)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export type Entry = string | string[] | RouteDeclaration
|
|
76
|
-
|
|
77
|
-
export type Declaration = Record<string, Entry>
|
|
78
|
-
|
|
79
|
-
export interface RouteDeclaration {
|
|
80
|
-
key: string | string[]
|
|
81
|
-
expose?: string[]
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface Route {
|
|
85
|
-
event: string
|
|
86
|
-
properties: string[]
|
|
87
|
-
expose?: string[]
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
interface Annotation {
|
|
91
|
-
resources?: Resources
|
|
92
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Dependency, Instances, Resources } from '@toa.io/operations';
|
|
2
|
-
/** Where Toa's release publishes this service's image. An application takes it
|
|
3
|
-
* instead of building one when its context says `registry.services: published`. */
|
|
4
|
-
export declare const image = "ghcr.io/toa-io/extension-realtime-streams";
|
|
5
|
-
export declare const standalone = true;
|
|
6
|
-
export { components } from './Composition.js';
|
|
7
|
-
export declare function deployment(instances: Instances<Declaration>, annotation?: Declaration & Annotation): Dependency;
|
|
8
|
-
export declare function parse(declaration: Declaration): Route[];
|
|
9
|
-
export type Entry = string | string[] | RouteDeclaration;
|
|
10
|
-
export type Declaration = Record<string, Entry>;
|
|
11
|
-
export interface RouteDeclaration {
|
|
12
|
-
key: string | string[];
|
|
13
|
-
expose?: string[];
|
|
14
|
-
}
|
|
15
|
-
export interface Route {
|
|
16
|
-
event: string;
|
|
17
|
-
properties: string[];
|
|
18
|
-
expose?: string[];
|
|
19
|
-
}
|
|
20
|
-
interface Annotation {
|
|
21
|
-
resources?: Resources;
|
|
22
|
-
}
|
package/transpiled/extension.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { components } from './Composition.js';
|
|
3
|
-
/** Where Toa's release publishes this service's image. An application takes it
|
|
4
|
-
* instead of building one when its context says `registry.services: published`. */
|
|
5
|
-
export const image = 'ghcr.io/toa-io/extension-realtime-streams';
|
|
6
|
-
export const standalone = true;
|
|
7
|
-
export { components } from './Composition.js';
|
|
8
|
-
export function deployment(instances, annotation) {
|
|
9
|
-
const routes = [];
|
|
10
|
-
const { resources, ...annotatedRoutes } = annotation ?? {};
|
|
11
|
-
const labels = components().labels;
|
|
12
|
-
if (annotatedRoutes !== undefined)
|
|
13
|
-
routes.push(...parse(annotatedRoutes));
|
|
14
|
-
for (const instance of instances) {
|
|
15
|
-
const completed = {};
|
|
16
|
-
for (const [key, value] of Object.entries(instance.manifest)) {
|
|
17
|
-
const event = instance.locator.id + '.' + key;
|
|
18
|
-
completed[event] = value;
|
|
19
|
-
}
|
|
20
|
-
routes.push(...parse(completed));
|
|
21
|
-
}
|
|
22
|
-
const service = {
|
|
23
|
-
group: 'realtime',
|
|
24
|
-
name: 'streams',
|
|
25
|
-
image,
|
|
26
|
-
version: JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
|
|
27
|
-
.version,
|
|
28
|
-
components: labels,
|
|
29
|
-
resources,
|
|
30
|
-
variables: [
|
|
31
|
-
{
|
|
32
|
-
name: 'TOA_REALTIME',
|
|
33
|
-
value: JSON.stringify(routes)
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
};
|
|
37
|
-
return { services: [service], events: routes.map((route) => route.event) };
|
|
38
|
-
}
|
|
39
|
-
export function parse(declaration) {
|
|
40
|
-
const routes = [];
|
|
41
|
-
for (const [event, value] of Object.entries(declaration))
|
|
42
|
-
if (isObject(value)) {
|
|
43
|
-
const properties = Array.isArray(value.key) ? value.key : [value.key];
|
|
44
|
-
routes.push({ event, properties, expose: value.expose });
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
const properties = Array.isArray(value) ? value : [value];
|
|
48
|
-
routes.push({ event, properties });
|
|
49
|
-
}
|
|
50
|
-
return routes;
|
|
51
|
-
}
|
|
52
|
-
function isObject(value) {
|
|
53
|
-
return typeof value === 'object' && !Array.isArray(value);
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=extension.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extension.js","sourceRoot":"","sources":["../source/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,S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