@toa.io/definitions 1.0.0-alpha.313 → 1.0.0-alpha.314

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 (46) hide show
  1. package/digest/extensions.configuration.json +1 -1
  2. package/digest/extensions.exposition.json +1 -1
  3. package/package.json +20 -5
  4. package/schemas/extensions.exposition/realtime.cos.yaml +19 -0
  5. package/schemas/extensions.exposition/routes.cos.yaml +27 -0
  6. package/transpiled/definition.js +9 -3
  7. package/transpiled/definition.js.map +1 -1
  8. package/transpiled/digest/generate.js +1 -2
  9. package/transpiled/digest/generate.js.map +1 -1
  10. package/transpiled/extensions.exposition/index.d.ts +1 -0
  11. package/transpiled/extensions.exposition/index.js +1 -0
  12. package/transpiled/extensions.exposition/index.js.map +1 -1
  13. package/transpiled/extensions.exposition/keys.d.ts +2 -0
  14. package/transpiled/extensions.exposition/keys.js +3 -0
  15. package/transpiled/extensions.exposition/keys.js.map +1 -0
  16. package/transpiled/extensions.exposition/realtime/const.d.ts +4 -0
  17. package/transpiled/extensions.exposition/realtime/const.js +5 -0
  18. package/transpiled/extensions.exposition/realtime/const.js.map +1 -0
  19. package/transpiled/extensions.exposition/realtime/deployment.d.ts +11 -0
  20. package/transpiled/extensions.exposition/realtime/deployment.js +17 -0
  21. package/transpiled/extensions.exposition/realtime/deployment.js.map +1 -0
  22. package/transpiled/extensions.exposition/realtime/index.d.ts +6 -0
  23. package/transpiled/extensions.exposition/realtime/index.js +5 -0
  24. package/transpiled/extensions.exposition/realtime/index.js.map +1 -0
  25. package/transpiled/extensions.exposition/realtime/manifest.d.ts +7 -0
  26. package/transpiled/extensions.exposition/realtime/manifest.js +10 -0
  27. package/transpiled/extensions.exposition/realtime/manifest.js.map +1 -0
  28. package/transpiled/extensions.exposition/realtime/routes.d.ts +18 -0
  29. package/transpiled/extensions.exposition/realtime/routes.js +8 -0
  30. package/transpiled/extensions.exposition/realtime/routes.js.map +1 -0
  31. package/transpiled/extensions.exposition/schemas.d.ts +2 -0
  32. package/transpiled/extensions.exposition/schemas.js +2 -0
  33. package/transpiled/extensions.exposition/schemas.js.map +1 -1
  34. package/transpiled/extensions.storages/packages.d.ts +2 -1
  35. package/transpiled/extensions.storages/packages.js +14 -4
  36. package/transpiled/extensions.storages/packages.js.map +1 -1
  37. package/digest/extensions.realtime.json +0 -1
  38. package/transpiled/extensions.realtime/components.d.ts +0 -2
  39. package/transpiled/extensions.realtime/components.js +0 -5
  40. package/transpiled/extensions.realtime/components.js.map +0 -1
  41. package/transpiled/extensions.realtime/deployment.d.ts +0 -22
  42. package/transpiled/extensions.realtime/deployment.js +0 -53
  43. package/transpiled/extensions.realtime/deployment.js.map +0 -1
  44. package/transpiled/extensions.realtime/index.d.ts +0 -3
  45. package/transpiled/extensions.realtime/index.js +0 -3
  46. package/transpiled/extensions.realtime/index.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/definitions",
3
- "version": "1.0.0-alpha.313",
3
+ "version": "1.0.0-alpha.314",
4
4
  "type": "module",
5
5
  "description": "What Toa packages declare, read without running them",
6
6
  "author": "temich <tema.gurtovoy@gmail.com>",
@@ -44,17 +44,32 @@
44
44
  "./*": "./transpiled/*/index.js"
45
45
  },
46
46
  "devDependencies": {
47
- "@toa.io/core": "1.0.0-alpha.312",
47
+ "@aws-sdk/client-s3": "3.1133.0",
48
+ "@aws-sdk/lib-storage": "3.1133.0",
49
+ "@toa.io/core": "1.0.0-alpha.314",
50
+ "cloudinary": "2.11.0",
48
51
  "openspan": "1.0.0-alpha.305",
49
- "oxc-parser": "0.149.0"
52
+ "oxc-parser": "0.150.0"
50
53
  },
51
54
  "peerDependencies": {
52
- "oxc-parser": "0.149.0"
55
+ "@aws-sdk/client-s3": "3.1133.0",
56
+ "@aws-sdk/lib-storage": "3.1133.0",
57
+ "cloudinary": "2.11.0",
58
+ "oxc-parser": "0.150.0"
53
59
  },
54
60
  "peerDependenciesMeta": {
61
+ "@aws-sdk/client-s3": {
62
+ "optional": true
63
+ },
64
+ "@aws-sdk/lib-storage": {
65
+ "optional": true
66
+ },
67
+ "cloudinary": {
68
+ "optional": true
69
+ },
55
70
  "oxc-parser": {
56
71
  "optional": true
57
72
  }
58
73
  },
59
- "gitHead": "7da3b2627ceeefd1fa19d5c8851be88d928523b6"
74
+ "gitHead": "4b7c0f4468e6fa89f95a69f43fed85c648fb033d"
60
75
  }
@@ -0,0 +1,19 @@
1
+ type: object
2
+ properties:
3
+ streams:
4
+ description: The Redis the streams are kept in; several are shards, a key kept by one of them
5
+ oneOf:
6
+ - type: string
7
+ minLength: 1
8
+ - type: array
9
+ items:
10
+ type: string
11
+ minLength: 1
12
+ minItems: 1
13
+ expire:
14
+ description: Seconds a stream outlives its last reader, the window a client reconnects in
15
+ type: integer
16
+ minimum: 1
17
+ required:
18
+ - streams
19
+ additionalProperties: false
@@ -0,0 +1,27 @@
1
+ # a component's `realtime` declaration: its routes, by the label of the event
2
+ type: object
3
+ minProperties: 1
4
+ additionalProperties:
5
+ type: object
6
+ properties:
7
+ key:
8
+ description: The properties of the event that are the keys of the streams it goes to
9
+ oneOf:
10
+ - type: string
11
+ minLength: 1
12
+ - type: array
13
+ items:
14
+ type: string
15
+ minLength: 1
16
+ minItems: 1
17
+ expose:
18
+ description: What of the event its streams are given; nothing is given that is not named
19
+ type: array
20
+ items:
21
+ type: string
22
+ minLength: 1
23
+ minItems: 1
24
+ required:
25
+ - key
26
+ - expose
27
+ additionalProperties: false
@@ -13,11 +13,18 @@ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExte
13
13
  export async function definition(reference) {
14
14
  if (!reference.startsWith(SCOPE))
15
15
  return undefined;
16
- const suffix = reference.slice(SCOPE.length);
16
+ // `package#key` is a declaration of its own that a package claims beside its main one
17
+ const [suffix, key] = reference.slice(SCOPE.length).split('#');
17
18
  if (!DEFINED.has(suffix))
18
19
  return undefined;
19
20
  cache[suffix] ??= import(__rewriteRelativeImportExtension(`./${suffix}/index.ts`));
20
- return cache[suffix];
21
+ const module = await cache[suffix];
22
+ if (key === undefined)
23
+ return module;
24
+ const keyed = module.keys?.[key];
25
+ if (keyed === undefined)
26
+ throw new Error(`'${reference}' names a key that '${SCOPE}${suffix}' does not claim`);
27
+ return keyed;
21
28
  }
22
29
  const cache = {};
23
30
  const SCOPE = '@toa.io/';
@@ -34,7 +41,6 @@ export const DEFINED = new Set([
34
41
  'extensions.exposition',
35
42
  'extensions.fetch',
36
43
  'extensions.introspection',
37
- 'extensions.realtime',
38
44
  'extensions.stash',
39
45
  'extensions.state',
40
46
  'extensions.storages',
@@ -1 +1 @@
1
- {"version":3,"file":"definition.js","sourceRoot":"","sources":["../source/definition.ts"],"names":[],"mappings":";;;;;;;;AAAA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,SAAiB;IAChD,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC;QAAE,OAAO,SAAS,CAAA;IAElD,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAE5C,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IAE1C,KAAK,CAAC,MAAM,CAAC,KAAK,MAAM,kCAAC,KAAK,MAAM,WAAW,EAAC,CAAA;IAEhD,OAAO,KAAK,CAAC,MAAM,CAAC,CAAA;AACtB,CAAC;AAED,MAAM,KAAK,GAAoC,EAAE,CAAA;AAEjD,MAAM,KAAK,GAAG,UAAU,CAAA;AAExB,wFAAwF;AACxF,MAAM,CAAC,MAAM,OAAO,GAAwB,IAAI,GAAG,CAAC;IAClD,eAAe;IACf,eAAe;IACf,eAAe;IACf,cAAc;IACd,cAAc;IACd,oBAAoB;IACpB,0BAA0B;IAC1B,wBAAwB;IACxB,uBAAuB;IACvB,kBAAkB;IAClB,0BAA0B;IAC1B,qBAAqB;IACrB,kBAAkB;IAClB,kB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AkB;IAClB,kBAAkB;IAClB,qBAAqB;IACrB,sBAAsB;IACtB,kBAAkB;CACnB,CAAC,CAAA"}
@@ -15,8 +15,7 @@ const DIGESTED = [
15
15
  'extensions.cadence',
16
16
  'extensions.configuration',
17
17
  'extensions.exposition',
18
- 'extensions.introspection',
19
- 'extensions.realtime'
18
+ 'extensions.introspection'
20
19
  ];
21
20
  const OUT = resolve(import.meta.dirname, '../../digest');
22
21
  mkdirSync(OUT, { recursive: true });
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sourceRoot":"","sources":["../../source/digest/generate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAA;AACjE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGzF;;;;;;GAMG;AACH,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAA;AAE9C,8CAA8C;AAC9C,MAAM,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,MAAM,CAAC,cAAc,CAAC,CAElD,CAAA;AAED,MAAM,QAAQ,GAAG;IACf,oBAAoB;IACpB,0BAA0B;IAC1B,uBAAuB;IACvB,0BAA0B;IAC1B,qBAAqB;CACtB,CAAA;AAED,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAA;AAExD,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAA;AAEnC,MAAM,QAAQ,GAAG,CAAC,mBAAmB,EAAE,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,CAAA;AACxF,MAAM,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,CAAC,IAAY;IACxB,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,GAAG,eAAe,CAAC,CAAC,CAAA;AACzD,CAAC;AAED,yFAAyF;AACzF,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC,KAAK,CAAC,CAAA;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;IAEtD,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,MAAM,MAAM,GAA4B,EAAE,CAAA;QAE1C,KAAK,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;YAC7C,IAAI,GAAG,KAAK,SAAS;gBAAE,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;QAEvD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,KAAK,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,IAAI,KAAK;QACnC,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,GAAG,GAAG,CAAC;YAC1D,OAAO,CAAC,IAAI,EAAE,GAAG,QAAQ,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;IAErF,OAAO,KAAK,CAAA;AACd,CAAC"}
@@ -3,6 +3,7 @@ export { components } from './components.ts';
3
3
  export { installs } from './packages.ts';
4
4
  export { deployment, image } from './deployment.ts';
5
5
  export { shortcuts } from './shortcuts.ts';
6
+ export * as keys from './keys.ts';
6
7
  export * from './const.ts';
7
8
  export * as schemas from './schemas.ts';
8
9
  export * as syntax from './syntax/index.ts';
@@ -3,6 +3,7 @@ export { components } from './components.js';
3
3
  export { installs } from './packages.js';
4
4
  export { deployment, image } from './deployment.js';
5
5
  export { shortcuts } from './shortcuts.js';
6
+ export * as keys from './keys.js';
6
7
  export * from './const.js';
7
8
  export * as schemas from './schemas.js';
8
9
  export * as syntax from './syntax/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/extensions.exposition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/extensions.exposition/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AACjC,cAAc,YAAY,CAAA;AAC1B,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAA"}
@@ -0,0 +1,2 @@
1
+ /** What `realtime` declares beside `exposition`: `@toa.io/extensions.exposition#realtime`. */
2
+ export * as realtime from './realtime/index.ts';
@@ -0,0 +1,3 @@
1
+ /** What `realtime` declares beside `exposition`: `@toa.io/extensions.exposition#realtime`. */
2
+ export * as realtime from './realtime/index.js';
3
+ //# sourceMappingURL=keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../source/extensions.exposition/keys.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,4 @@
1
+ /** The addresses of the Redis the streams are kept in, space-separated. */
2
+ export declare const STREAMS = "TOA_REALTIME_STREAMS";
3
+ /** Seconds a stream outlives its last reader. */
4
+ export declare const EXPIRE = "TOA_REALTIME_EXPIRE";
@@ -0,0 +1,5 @@
1
+ /** The addresses of the Redis the streams are kept in, space-separated. */
2
+ export const STREAMS = 'TOA_REALTIME_STREAMS';
3
+ /** Seconds a stream outlives its last reader. */
4
+ export const EXPIRE = 'TOA_REALTIME_EXPIRE';
5
+ //# sourceMappingURL=const.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"const.js","sourceRoot":"","sources":["../../../source/extensions.exposition/realtime/const.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,CAAC,MAAM,OAAO,GAAG,sBAAsB,CAAA;AAE7C,iDAAiD;AACjD,MAAM,CAAC,MAAM,MAAM,GAAG,qBAAqB,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { Dependency } from '@toa.io/operations';
2
+ /**
3
+ * Where the streams are kept, given to every process: the components that route events write them,
4
+ * and the gateway reads them. Asked for where a component declares routes, as any annotation is
5
+ * where its extension is declared.
6
+ */
7
+ export declare function deployment(_: unknown, annotation?: Annotation): Dependency;
8
+ export interface Annotation {
9
+ streams: string | string[];
10
+ expire?: number;
11
+ }
@@ -0,0 +1,17 @@
1
+ import * as schemas from '../schemas.js';
2
+ import { EXPIRE, STREAMS } from './const.js';
3
+ /**
4
+ * Where the streams are kept, given to every process: the components that route events write them,
5
+ * and the gateway reads them. Asked for where a component declares routes, as any annotation is
6
+ * where its extension is declared.
7
+ */
8
+ export function deployment(_, annotation) {
9
+ schemas.realtime.validate(annotation ?? null, 'Invalid realtime annotation');
10
+ const { streams, expire } = annotation;
11
+ const addresses = Array.isArray(streams) ? streams : [streams];
12
+ const global = [{ name: STREAMS, value: addresses.join(' ') }];
13
+ if (expire !== undefined)
14
+ global.push({ name: EXPIRE, value: String(expire) });
15
+ return { variables: { global } };
16
+ }
17
+ //# sourceMappingURL=deployment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../../source/extensions.exposition/realtime/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAG5C;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,CAAU,EAAE,UAAuB;IAC5D,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,IAAI,IAAI,EAAE,6BAA6B,CAAC,CAAA;IAE5E,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,UAAW,CAAA;IACvC,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9D,MAAM,MAAM,GAAG,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IAE9D,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAA;IAE9E,OAAO,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,CAAA;AAClC,CAAC"}
@@ -0,0 +1,6 @@
1
+ export { deployment } from './deployment.ts';
2
+ export { manifest } from './manifest.ts';
3
+ export { parse } from './routes.ts';
4
+ export { EXPIRE, STREAMS } from './const.ts';
5
+ export type { Annotation } from './deployment.ts';
6
+ export type { Declaration, Route, RouteDeclaration } from './routes.ts';
@@ -0,0 +1,5 @@
1
+ export { deployment } from './deployment.js';
2
+ export { manifest } from './manifest.js';
3
+ export { parse } from './routes.js';
4
+ export { EXPIRE, STREAMS } from './const.js';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/extensions.exposition/realtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
@@ -0,0 +1,7 @@
1
+ import type { Declaration } from './routes.ts';
2
+ import type { Manifest } from '@toa.io/norm';
3
+ /**
4
+ * A component's routes, refused where one does not say what it exposes: an event is given to its
5
+ * streams only as far as its route names.
6
+ */
7
+ export declare function manifest(declaration: unknown, manifest: Manifest): Declaration;
@@ -0,0 +1,10 @@
1
+ import * as schemas from '../schemas.js';
2
+ /**
3
+ * A component's routes, refused where one does not say what it exposes: an event is given to its
4
+ * streams only as far as its route names.
5
+ */
6
+ export function manifest(declaration, manifest) {
7
+ schemas.routes.validate(declaration, `Realtime routes of '${manifest.namespace}.${manifest.name}' are invalid`);
8
+ return declaration;
9
+ }
10
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../source/extensions.exposition/realtime/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,eAAe,CAAA;AAIxC;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,WAAoB,EAAE,QAAkB;IAC/D,OAAO,CAAC,MAAM,CAAC,QAAQ,CACrB,WAAW,EACX,uBAAuB,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,IAAI,eAAe,CAC1E,CAAA;IAED,OAAO,WAA0B,CAAA;AACnC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * A realtime route: an event of a component, the properties of its payload that are the keys of
3
+ * the streams it goes to, and what of it they are given.
4
+ */
5
+ export interface Route {
6
+ /** the event's label within its component */
7
+ event: string;
8
+ properties: string[];
9
+ expose: string[];
10
+ }
11
+ /** A component's `realtime` declaration, by event label. */
12
+ export type Declaration = Record<string, RouteDeclaration>;
13
+ export interface RouteDeclaration {
14
+ key: string | string[];
15
+ /** What the streams are given of the event. Required: nothing is given that is not named. */
16
+ expose: string[];
17
+ }
18
+ export declare function parse(declaration: Declaration): Route[];
@@ -0,0 +1,8 @@
1
+ export function parse(declaration) {
2
+ return Object.entries(declaration).map(([event, { key, expose }]) => ({
3
+ event,
4
+ properties: Array.isArray(key) ? key : [key],
5
+ expose
6
+ }));
7
+ }
8
+ //# sourceMappingURL=routes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../source/extensions.exposition/realtime/routes.ts"],"names":[],"mappings":"AAqBA,MAAM,UAAU,KAAK,CAAC,WAAwB;IAC5C,OAAO,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;QACpE,KAAK;QACL,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;QAC5C,MAAM;KACP,CAAC,CAAC,CAAA;AACL,CAAC"}
@@ -5,3 +5,5 @@ export declare const querystring: Schema<Record<string, unknown>>;
5
5
  export declare const call: Schema<Record<string, unknown>>;
6
6
  export declare const annotation: Schema<Annotation>;
7
7
  export declare const node: Schema<Node>;
8
+ export declare const realtime: Schema<unknown>;
9
+ export declare const routes: Schema<unknown>;
@@ -7,4 +7,6 @@ export const querystring = namespace.schema('querystring');
7
7
  export const call = namespace.schema('call');
8
8
  export const annotation = namespace.schema('annotation');
9
9
  export const node = namespace.schema('node');
10
+ export const realtime = namespace.schema('realtime');
11
+ export const routes = namespace.schema('routes');
10
12
  //# sourceMappingURL=schemas.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../source/extensions.exposition/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAK1C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,qCAAqC,CAAC,CAAA;AAChF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAEzC,uFAAuF;AACvF,MAAM,CAAC,MAAM,WAAW,GACtB,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AACjC,MAAM,CAAC,MAAM,IAAI,GAAoC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAE7E,MAAM,CAAC,MAAM,UAAU,GAAuB,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;AAC5E,MAAM,CAAC,MAAM,IAAI,GAAiB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../source/extensions.exposition/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAK1C,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,IAAI,CAAC,OAAO,EAAE,qCAAqC,CAAC,CAAA;AAChF,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAEzC,uFAAuF;AACvF,MAAM,CAAC,MAAM,WAAW,GACtB,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AACjC,MAAM,CAAC,MAAM,IAAI,GAAoC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAE7E,MAAM,CAAC,MAAM,UAAU,GAAuB,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;AAC5E,MAAM,CAAC,MAAM,IAAI,GAAiB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC1D,MAAM,CAAC,MAAM,QAAQ,GAAoB,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,CAAA;AACrE,MAAM,CAAC,MAAM,MAAM,GAAoB,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA"}
@@ -3,7 +3,8 @@ import type { Instance } from './deployment.ts';
3
3
  /**
4
4
  * What each provider is written against, stated apart from the provider for the reason its
5
5
  * secrets are: so that a deploy installs the SDK without loading it, and an image carries no
6
- * SDK a declaration does not name. These are the extension's optional peers at the versions it
6
+ * SDK a declaration does not name. The versions are this package's optional peers, so a bump
7
+ * is a change to its manifest alone. They are the extension's optional peers at the versions it
7
8
  * declares them — `packages.test.ts` is what keeps the two the same.
8
9
  */
9
10
  export declare const packages: Record<Provider, Readonly<Record<string, string>>>;
@@ -1,13 +1,17 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ const peers = JSON.parse(readFileSync(join(import.meta.dirname, '../../package.json'), 'utf8')).peerDependencies;
1
4
  /**
2
5
  * What each provider is written against, stated apart from the provider for the reason its
3
6
  * secrets are: so that a deploy installs the SDK without loading it, and an image carries no
4
- * SDK a declaration does not name. These are the extension's optional peers at the versions it
7
+ * SDK a declaration does not name. The versions are this package's optional peers, so a bump
8
+ * is a change to its manifest alone. They are the extension's optional peers at the versions it
5
9
  * declares them — `packages.test.ts` is what keeps the two the same.
6
10
  */
7
11
  export const packages = {
8
- s3: { '@aws-sdk/client-s3': '3.1131.0', '@aws-sdk/lib-storage': '3.1131.0' },
9
- spaces: { '@aws-sdk/client-s3': '3.1131.0', '@aws-sdk/lib-storage': '3.1131.0' },
10
- cloudinary: { cloudinary: '2.11.0' },
12
+ s3: pin('@aws-sdk/client-s3', '@aws-sdk/lib-storage'),
13
+ spaces: pin('@aws-sdk/client-s3', '@aws-sdk/lib-storage'),
14
+ cloudinary: pin('cloudinary'),
11
15
  fs: {},
12
16
  tmp: {},
13
17
  test: {}
@@ -38,4 +42,10 @@ export function installs(instance, annotation) {
38
42
  function isAnnotation(value) {
39
43
  return typeof value === 'object' && value !== null;
40
44
  }
45
+ function pin(...names) {
46
+ const pinned = {};
47
+ for (const name of names)
48
+ pinned[name] = peers[name];
49
+ return pinned;
50
+ }
41
51
  //# sourceMappingURL=packages.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"packages.js","sourceRoot":"","sources":["../../source/extensions.storages/packages.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAuD;IAC1E,EAAE,EAAE,EAAE,oBAAoB,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,EAAE;IAC5E,MAAM,EAAE,EAAE,oBAAoB,EAAE,UAAU,EAAE,sBAAsB,EAAE,UAAU,EAAE;IAChF,UAAU,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;IACpC,EAAE,EAAE,EAAE;IACN,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,EAAE;CACT,CAAA;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,QAAQ,CACtB,QAA8B,EAC9B,UAAmB;IAEnB,IAAI,QAAQ,KAAK,SAAS,IAAI,CAA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type":"string"},"token":{"type":"string"}},"type":"object"},"type":"effect","scope":"none","bridge":"@toa.io/bridges.node","query":false,"output":{},"bindings":["@toa.io/bindings.amqp"]},"push":{"output":{"type":"null"},"bindings":[],"input":{"properties":{"data":{},"key":{"type":"string"},"event":{"type":"string"}},"type":"object","required":["key","event"]},"type":"effect","scope":"none","bridge":"@toa.io/bridges.node","query":false}},"path":"@toa.io/extensions.realtime/components/realtime.streams","bindings":["@toa.io/bindings.amqp"],"bridge":"@toa.io/bridges.node","prototype":null,"extensions":{"@toa.io/extensions.telemetry":{},"@toa.io/extensions.fetch":null,"@toa.io/extensions.introspection":{},"@toa.io/extensions.exposition":{"routes":[{"path":"/realtime/streams","node":{"routes":[{"path":"/:key","node":{"routes":[],"methods":[{"verb":"GET","mapping":{"endpoint":"create","query":null,"paged":false,"namespace":"realtime","component":"streams"},"directives":[{"family":"io","name":"readonly","value":false}]}],"directives":[{"family":"auth","name":"id","value":"key"}]}}],"methods":[],"directives":[]}}],"methods":[],"directives":[]},"@toa.io/extensions.configuration":{"schema":{"properties":{"maxlen":{"type":"number"},"expire":{"type":"number"}},"type":"object","required":["maxlen","expire"]},"defaults":{"maxlen":1000,"expire":300}},"@toa.io/extensions.state":null,"@toa.io/extensions.stash":null},"version":"b6dd4c5d"}}]
@@ -1,2 +0,0 @@
1
- import { type Components } from '../digest/read.ts';
2
- export declare function components(): Components;
@@ -1,5 +0,0 @@
1
- import { components as digest } from '../digest/read.js';
2
- export function components() {
3
- return digest('extensions.realtime');
4
- }
5
- //# sourceMappingURL=components.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../../source/extensions.realtime/components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,IAAI,MAAM,EAAmB,MAAM,mBAAmB,CAAA;AAEzE,MAAM,UAAU,UAAU;IACxB,OAAO,MAAM,CAAC,qBAAqB,CAAC,CAAA;AACtC,CAAC"}
@@ -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 declare function deployment(instances: Instances<Declaration>, annotation?: Declaration & Annotation): Dependency;
7
- export declare function parse(declaration: Declaration): Route[];
8
- export type Entry = string | string[] | RouteDeclaration;
9
- export type Declaration = Record<string, Entry>;
10
- export interface RouteDeclaration {
11
- key: string | string[];
12
- expose?: string[];
13
- }
14
- export interface Route {
15
- event: string;
16
- properties: string[];
17
- expose?: string[];
18
- }
19
- interface Annotation {
20
- resources?: Resources;
21
- }
22
- export {};
@@ -1,53 +0,0 @@
1
- import { components } from './components.js';
2
- import { version } from '../version.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 function deployment(instances, annotation) {
8
- const routes = [];
9
- const { resources, ...annotatedRoutes } = annotation ?? {};
10
- const labels = components().labels;
11
- if (annotatedRoutes !== undefined)
12
- routes.push(...parse(annotatedRoutes));
13
- for (const instance of instances) {
14
- const completed = {};
15
- for (const [key, value] of Object.entries(instance.manifest)) {
16
- const event = instance.locator.id + '.' + key;
17
- completed[event] = value;
18
- }
19
- routes.push(...parse(completed));
20
- }
21
- const service = {
22
- group: 'realtime',
23
- name: 'streams',
24
- image,
25
- version,
26
- components: labels,
27
- resources,
28
- variables: [
29
- {
30
- name: 'TOA_REALTIME',
31
- value: JSON.stringify(routes)
32
- }
33
- ]
34
- };
35
- return { services: [service], events: routes.map((route) => route.event) };
36
- }
37
- export function parse(declaration) {
38
- const routes = [];
39
- for (const [event, value] of Object.entries(declaration))
40
- if (isObject(value)) {
41
- const properties = Array.isArray(value.key) ? value.key : [value.key];
42
- routes.push({ event, properties, expose: value.expose });
43
- }
44
- else {
45
- const properties = Array.isArray(value) ? value : [value];
46
- routes.push({ event, properties });
47
- }
48
- return routes;
49
- }
50
- function isObject(value) {
51
- return typeof value === 'object' && !Array.isArray(value);
52
- }
53
- //# sourceMappingURL=deployment.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"deployment.js","sourceRoot":"","sources":["../../source/extensions.realtime/deployment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAGvC;oFACoF;AACpF,MAAM,CAAC,MAAM,KAAK,GAAG,2CAA2C,CAAA;AAEhE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,CAAA;AAE9B,MAAM,UAAU,UAAU,CACxB,SAAiC,EACjC,UAAqC;IAErC,MAAM,MAAM,GAAG,EAAE,CAAA;IACjB,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GAAG,UAAU,IAAI,EAAE,CAAA;IAC1D,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC,MAAM,CAAA;IAElC,IAAI,eAAe,KAAK,SAAS;QAAE,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC,CAAA;IAEzE,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,SAAS,GAAgB,EAAE,CAAA;QAEjC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC7D,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,CAAA;YAE7C,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,CAAA;QAC1B,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAA;IAClC,CAAC;IAED,MAAM,OAAO,GAAY;QACvB,KAAK,EAAE,UAAU;QACjB,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K,CAAC,CAAA;AAC3D,CAAC"}
@@ -1,3 +0,0 @@
1
- export { deployment, image, standalone, parse } from './deployment.ts';
2
- export { components } from './components.ts';
3
- export type { Declaration, Entry, Route, RouteDeclaration } from './deployment.ts';
@@ -1,3 +0,0 @@
1
- export { deployment, image, standalone, parse } from './deployment.js';
2
- export { components } from './components.js';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/extensions.realtime/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA"}