@toa.io/extensions.exposition 0.24.0-alpha.21 → 0.24.0-alpha.23
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/components/context.toa.yaml +1 -1
- package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
- package/components/identity.federation/operations/tsconfig.tsbuildinfo +1 -1
- package/components/octets.storage/manifest.toa.yaml +1 -0
- package/components/octets.storage/operations/store.js +2 -2
- package/documentation/octets.md +89 -37
- package/features/cors.feature +33 -0
- package/features/octets.entries.feature +121 -0
- package/features/octets.feature +1 -27
- package/features/octets.meta.feature +65 -0
- package/features/octets.workflows.feature +105 -4
- package/features/routes.feature +37 -0
- package/features/steps/Captures.ts +3 -2
- package/features/steps/Components.ts +15 -8
- package/features/steps/HTTP.ts +1 -1
- package/features/steps/Parameters.ts +1 -1
- package/features/steps/components/octets.tester/manifest.toa.yaml +1 -0
- package/features/steps/components/octets.tester/operations/echo.js +7 -0
- package/features/steps/components/users/manifest.toa.yaml +3 -0
- package/features/steps/components/users.properties/manifest.toa.yaml +13 -0
- package/features/steps/tsconfig.json +1 -1
- package/features/vary.feature +1 -1
- package/package.json +8 -8
- package/schemas/octets/delete.cos.yaml +2 -1
- package/schemas/octets/list.cos.yaml +2 -1
- package/source/HTTP/Server.ts +32 -23
- package/source/HTTP/messages.ts +7 -1
- package/source/directives/cors/CORS.ts +25 -23
- package/source/directives/index.ts +1 -1
- package/source/directives/octets/Delete.ts +45 -6
- package/source/directives/octets/Fetch.ts +17 -18
- package/source/directives/octets/List.ts +36 -6
- package/source/directives/octets/Permute.ts +2 -2
- package/source/directives/octets/Store.ts +36 -94
- package/source/directives/octets/schemas.ts +11 -6
- package/source/directives/octets/workflow/Execution.ts +77 -0
- package/source/directives/octets/workflow/Workflow.ts +28 -0
- package/source/directives/octets/workflow/index.ts +1 -0
- package/source/manifest.test.ts +6 -14
- package/source/manifest.ts +9 -6
- package/source/schemas.ts +7 -3
- package/transpiled/HTTP/Server.d.ts +1 -1
- package/transpiled/HTTP/Server.js +22 -21
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/messages.d.ts +1 -0
- package/transpiled/HTTP/messages.js +4 -1
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/directives/cors/CORS.d.ts +2 -5
- package/transpiled/directives/cors/CORS.js +18 -16
- package/transpiled/directives/cors/CORS.js.map +1 -1
- package/transpiled/directives/index.js +1 -1
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/octets/Delete.d.ts +9 -1
- package/transpiled/directives/octets/Delete.js +30 -6
- package/transpiled/directives/octets/Delete.js.map +1 -1
- package/transpiled/directives/octets/Fetch.d.ts +4 -5
- package/transpiled/directives/octets/Fetch.js +11 -12
- package/transpiled/directives/octets/Fetch.js.map +1 -1
- package/transpiled/directives/octets/List.d.ts +6 -1
- package/transpiled/directives/octets/List.js +22 -4
- package/transpiled/directives/octets/List.js.map +1 -1
- package/transpiled/directives/octets/Permute.js +2 -2
- package/transpiled/directives/octets/Permute.js.map +1 -1
- package/transpiled/directives/octets/Store.d.ts +7 -19
- package/transpiled/directives/octets/Store.js +21 -66
- package/transpiled/directives/octets/Store.js.map +1 -1
- package/transpiled/directives/octets/schemas.d.ts +11 -6
- package/transpiled/directives/octets/schemas.js.map +1 -1
- package/transpiled/directives/octets/workflow/Execution.d.ts +24 -0
- package/transpiled/directives/octets/workflow/Execution.js +55 -0
- package/transpiled/directives/octets/workflow/Execution.js.map +1 -0
- package/transpiled/directives/octets/workflow/Workflow.d.ts +11 -0
- package/transpiled/directives/octets/workflow/Workflow.js +21 -0
- package/transpiled/directives/octets/workflow/Workflow.js.map +1 -0
- package/transpiled/directives/octets/workflow/index.d.ts +1 -0
- package/transpiled/directives/octets/workflow/index.js +6 -0
- package/transpiled/directives/octets/workflow/index.js.map +1 -0
- package/transpiled/manifest.js +10 -5
- package/transpiled/manifest.js.map +1 -1
- package/transpiled/schemas.d.ts +7 -3
- package/transpiled/schemas.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fetch.js","sourceRoot":"","sources":["../../../source/directives/octets/Fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,qCAAgD;AAChD,mDAAoC;AASpC,MAAa,KAAK;IACA,QAAQ,GAAG,IAAI,CAAA;IAEd,WAAW,
|
|
1
|
+
{"version":3,"file":"Fetch.js","sourceRoot":"","sources":["../../../source/directives/octets/Fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,qCAAgD;AAChD,mDAAoC;AASpC,MAAa,KAAK;IACA,QAAQ,GAAG,IAAI,CAAA;IAEd,WAAW,GAA0B,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IAChE,SAAS,CAAoB;IACtC,OAAO,GAAc,IAA4B,CAAA;IAEzD,YAAoB,WAA+B,EAAE,SAA6B;QAChF,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QAEnC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;QAC5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,KAAK,CAAE,OAAe,EAAE,OAAc;QACjD,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CAAC,SAAS,CAAA;QAErC,MAAM,OAAO,GAAG,iBAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;QACzD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,KAAK,cAAc,CAAA;QAEnD,IAAI,CAAC,OAAO,IAAI,QAAQ;YACtB,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI;gBACvB,OAA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,CAAA;QAEvE,IAAI,KAAK,YAAY,KAAK;YACxB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACxB,CAAC;CACF;AA5DD,sBA4DC"}
|
|
@@ -3,8 +3,13 @@ import type { Output } from '../../io';
|
|
|
3
3
|
import type { Directive, Input } from './types';
|
|
4
4
|
export declare class List implements Directive {
|
|
5
5
|
readonly targeted = false;
|
|
6
|
+
private readonly permissions;
|
|
6
7
|
private readonly discovery;
|
|
7
8
|
private storage;
|
|
8
|
-
constructor(
|
|
9
|
+
constructor(permissions: Permissions | null, discovery: Promise<Component>);
|
|
9
10
|
apply(storage: string, request: Input): Promise<Output>;
|
|
11
|
+
private expand;
|
|
12
|
+
}
|
|
13
|
+
export interface Permissions {
|
|
14
|
+
meta?: boolean;
|
|
10
15
|
}
|
|
@@ -24,23 +24,41 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.List = void 0;
|
|
27
|
+
const node_path_1 = require("node:path");
|
|
27
28
|
const HTTP_1 = require("../../HTTP");
|
|
28
29
|
const schemas = __importStar(require("./schemas"));
|
|
29
30
|
class List {
|
|
30
31
|
targeted = false;
|
|
32
|
+
permissions = { meta: false };
|
|
31
33
|
discovery;
|
|
32
34
|
storage = null;
|
|
33
|
-
constructor(
|
|
34
|
-
schemas.
|
|
35
|
+
constructor(permissions, discovery) {
|
|
36
|
+
schemas.list.validate(permissions);
|
|
37
|
+
Object.assign(this.permissions, permissions);
|
|
35
38
|
this.discovery = discovery;
|
|
36
39
|
}
|
|
37
40
|
async apply(storage, request) {
|
|
38
41
|
this.storage ??= await this.discovery;
|
|
39
|
-
const
|
|
42
|
+
const metadata = request.subtype === 'octets.entries';
|
|
43
|
+
if (metadata && !this.permissions.meta)
|
|
44
|
+
throw new HTTP_1.Forbidden('Metadata is not accessible.');
|
|
45
|
+
const input = { storage, path: request.url };
|
|
40
46
|
const list = await this.storage.invoke('list', { input });
|
|
41
47
|
if (list instanceof Error)
|
|
42
48
|
throw new HTTP_1.NotFound();
|
|
43
|
-
|
|
49
|
+
const body = metadata
|
|
50
|
+
? await this.expand(storage, request.url, list)
|
|
51
|
+
: list;
|
|
52
|
+
return { body };
|
|
53
|
+
}
|
|
54
|
+
async expand(storage, prefix, list) {
|
|
55
|
+
const promises = list.map(async (id) => {
|
|
56
|
+
const path = node_path_1.posix.join(prefix, id);
|
|
57
|
+
const input = { storage, path };
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- ensured in `apply`
|
|
59
|
+
return this.storage.invoke('get', { input });
|
|
60
|
+
});
|
|
61
|
+
return await Promise.all(promises);
|
|
44
62
|
}
|
|
45
63
|
}
|
|
46
64
|
exports.List = List;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../source/directives/octets/List.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../source/directives/octets/List.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,qCAAgD;AAChD,mDAAoC;AAQpC,MAAa,IAAI;IACC,QAAQ,GAAG,KAAK,CAAA;IAEf,WAAW,GAA0B,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACpD,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,WAA+B,EAAE,SAA6B;QAChF,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAA;QAElC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC,CAAA;QAC5C,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,KAAK,CAAE,O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"}
|
|
@@ -31,14 +31,14 @@ class Permute {
|
|
|
31
31
|
discovery;
|
|
32
32
|
storage = null;
|
|
33
33
|
constructor(value, discovery) {
|
|
34
|
-
schemas.
|
|
34
|
+
schemas.permute.validate(value);
|
|
35
35
|
this.discovery = discovery;
|
|
36
36
|
}
|
|
37
37
|
async apply(storage, request) {
|
|
38
38
|
this.storage ??= await this.discovery;
|
|
39
39
|
if (request.encoder === null)
|
|
40
40
|
throw new HTTP_1.NotAcceptable();
|
|
41
|
-
const path = request.
|
|
41
|
+
const path = request.url;
|
|
42
42
|
const list = await request.parse();
|
|
43
43
|
const input = { storage, path, list };
|
|
44
44
|
const error = await this.storage.invoke('permute', { input });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Permute.js","sourceRoot":"","sources":["../../../source/directives/octets/Permute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,mDAAoC;AAOpC,MAAa,OAAO;IACF,QAAQ,GAAG,KAAK,CAAA;IAEf,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,KAAW,EAAE,SAA6B;QAC5D,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"Permute.js","sourceRoot":"","sources":["../../../source/directives/octets/Permute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,mDAAoC;AAOpC,MAAa,OAAO;IACF,QAAQ,GAAG,KAAK,CAAA;IAEf,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,KAAW,EAAE,SAA6B;QAC5D,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE/B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,KAAK,CAAE,OAAe,EAAE,OAAc;QACjD,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CAAC,SAAS,CAAA;QAErC,IAAI,OAAO,CAAC,OAAO,KAAK,IAAI;YAC1B,MAAM,IAAI,oBAAa,EAAE,CAAA;QAE3B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAA;QACxB,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QAClC,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;QACrC,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAiB,SAAS,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAE7E,IAAI,KAAK,YAAY,KAAK;YACxB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AA5BD,0BA4BC"}
|
|
@@ -1,33 +1,21 @@
|
|
|
1
|
+
import type { Unit } from './workflow';
|
|
1
2
|
import type { Remotes } from '../../Remotes';
|
|
2
3
|
import type { Component } from '@toa.io/core';
|
|
3
4
|
import type { Output } from '../../io';
|
|
4
5
|
import type { Directive, Input } from './types';
|
|
5
6
|
export declare class Store implements Directive {
|
|
6
7
|
readonly targeted = false;
|
|
7
|
-
private readonly accept
|
|
8
|
-
private readonly workflow
|
|
8
|
+
private readonly accept?;
|
|
9
|
+
private readonly workflow?;
|
|
9
10
|
private readonly discovery;
|
|
10
|
-
private readonly remotes;
|
|
11
|
-
private readonly components;
|
|
12
11
|
private storage;
|
|
13
12
|
constructor(options: Options | null, discovery: Promise<Component>, remotes: Remotes);
|
|
14
13
|
apply(storage: string, request: Input): Promise<Output>;
|
|
15
14
|
private reply;
|
|
16
15
|
private throw;
|
|
17
|
-
|
|
18
|
-
* Execute workflow units sequentially, steps within a unit in parallel.
|
|
19
|
-
* Yield results as soon as they come.
|
|
20
|
-
*
|
|
21
|
-
* If you need to change this, it may take a while.
|
|
22
|
-
*/
|
|
23
|
-
private execute;
|
|
24
|
-
private call;
|
|
25
|
-
private discover;
|
|
16
|
+
private parseMeta;
|
|
26
17
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
accept: string | string[];
|
|
31
|
-
workflow: Workflow | Unit;
|
|
18
|
+
export interface Options {
|
|
19
|
+
accept?: string | string[];
|
|
20
|
+
workflow?: Unit[] | Unit;
|
|
32
21
|
}
|
|
33
|
-
export {};
|
|
@@ -24,100 +24,55 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Store = void 0;
|
|
27
|
-
const node_stream_1 = require("node:stream");
|
|
28
|
-
const node_path_1 = require("node:path");
|
|
29
27
|
const matchacho_1 = require("matchacho");
|
|
30
|
-
const generic_1 = require("@toa.io/generic");
|
|
31
28
|
const HTTP_1 = require("../../HTTP");
|
|
29
|
+
const cors_1 = require("../cors");
|
|
32
30
|
const schemas = __importStar(require("./schemas"));
|
|
31
|
+
const workflow_1 = require("./workflow");
|
|
33
32
|
class Store {
|
|
34
33
|
targeted = false;
|
|
35
34
|
accept;
|
|
36
35
|
workflow;
|
|
37
36
|
discovery = {};
|
|
38
|
-
remotes;
|
|
39
|
-
components = {};
|
|
40
37
|
storage = null;
|
|
41
38
|
constructor(options, discovery, remotes) {
|
|
42
39
|
schemas.store.validate(options);
|
|
43
40
|
this.accept = (0, matchacho_1.match)(options?.accept, String, (value) => value, Array, (types) => types.join(','), undefined);
|
|
44
|
-
|
|
41
|
+
if (options?.workflow !== undefined)
|
|
42
|
+
this.workflow = new workflow_1.Workflow(options.workflow, remotes);
|
|
45
43
|
this.discovery.storage = discovery;
|
|
46
|
-
|
|
44
|
+
cors_1.cors.allowHeader('content-meta');
|
|
47
45
|
}
|
|
48
46
|
async apply(storage, request) {
|
|
49
47
|
this.storage ??= await this.discovery.storage;
|
|
50
|
-
const input = { storage, request
|
|
48
|
+
const input = { storage, request };
|
|
49
|
+
const meta = request.headers['content-meta'];
|
|
50
|
+
if (this.accept !== undefined)
|
|
51
|
+
input.accept = this.accept;
|
|
52
|
+
if (meta !== undefined)
|
|
53
|
+
input.meta = this.parseMeta(meta);
|
|
51
54
|
const entry = await this.storage.invoke('store', { input });
|
|
52
55
|
return (0, matchacho_1.match)(entry, Error, (error) => this.throw(error), () => this.reply(request, storage, entry));
|
|
53
56
|
}
|
|
54
57
|
reply(request, storage, entry) {
|
|
55
58
|
const body = this.workflow === undefined
|
|
56
59
|
? entry
|
|
57
|
-
:
|
|
60
|
+
: this.workflow.execute(request, storage, entry);
|
|
58
61
|
return { body };
|
|
59
62
|
}
|
|
60
63
|
throw(error) {
|
|
61
64
|
throw (0, matchacho_1.match)(error.code, 'NOT_ACCEPTABLE', () => new HTTP_1.UnsupportedMediaType(), 'TYPE_MISMATCH', () => new HTTP_1.BadRequest(), error);
|
|
62
65
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
yield entry;
|
|
72
|
-
const path = node_path_1.posix.join(request.path, entry.id);
|
|
73
|
-
let interrupted = false;
|
|
74
|
-
for (const unit of this.workflow) {
|
|
75
|
-
if (interrupted)
|
|
76
|
-
break;
|
|
77
|
-
const steps = Object.keys(unit);
|
|
78
|
-
// unit result promises queue
|
|
79
|
-
const results = Array.from(steps, (generic_1.promex));
|
|
80
|
-
let next = 0;
|
|
81
|
-
// execute steps in parallel
|
|
82
|
-
for (const step of steps)
|
|
83
|
-
// these promises are indirectly awaited in the yield loop
|
|
84
|
-
void (async () => {
|
|
85
|
-
const endpoint = unit[step];
|
|
86
|
-
const context = { storage, path, entry };
|
|
87
|
-
const result = await this.call(endpoint, context);
|
|
88
|
-
if (interrupted)
|
|
89
|
-
return;
|
|
90
|
-
// as a result is received, resolve the next promise from the queue
|
|
91
|
-
const promise = results[next++];
|
|
92
|
-
if (result instanceof Error) {
|
|
93
|
-
interrupted = true;
|
|
94
|
-
promise.resolve({ error: { step, ...result } });
|
|
95
|
-
// cancel pending promises
|
|
96
|
-
results[next].resolve(null);
|
|
97
|
-
}
|
|
98
|
-
else
|
|
99
|
-
promise.resolve({ [step]: result ?? null });
|
|
100
|
-
})().catch((e) => results[next].reject(e));
|
|
101
|
-
// yield results from the queue as they come
|
|
102
|
-
for (const promise of results) {
|
|
103
|
-
const result = await promise;
|
|
104
|
-
if (result === null) // canceled promise
|
|
105
|
-
break;
|
|
106
|
-
else
|
|
107
|
-
yield result;
|
|
108
|
-
}
|
|
66
|
+
parseMeta(value) {
|
|
67
|
+
if (Array.isArray(value))
|
|
68
|
+
value = value.join(',');
|
|
69
|
+
const meta = {};
|
|
70
|
+
for (const pair of value.split(',')) {
|
|
71
|
+
const eq = pair.indexOf('=');
|
|
72
|
+
const key = (eq === -1 ? pair : pair.slice(0, eq)).trim();
|
|
73
|
+
meta[key] = eq === -1 ? 'true' : pair.slice(eq + 1).trim();
|
|
109
74
|
}
|
|
110
|
-
|
|
111
|
-
async call(endpoint, context) {
|
|
112
|
-
const [operation, component, namespace = 'default'] = endpoint.split('.').reverse();
|
|
113
|
-
const key = `${namespace}.${component}`;
|
|
114
|
-
this.components[key] ??= await this.discover(key, namespace, component);
|
|
115
|
-
return await this.components[key].invoke(operation, { input: context });
|
|
116
|
-
}
|
|
117
|
-
async discover(key, namespace, component) {
|
|
118
|
-
if (this.discovery[key] === undefined)
|
|
119
|
-
this.discovery[key] = this.remotes.discover(namespace, component);
|
|
120
|
-
return await this.discovery[key];
|
|
75
|
+
return meta;
|
|
121
76
|
}
|
|
122
77
|
}
|
|
123
78
|
exports.Store = Store;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Store.js","sourceRoot":"","sources":["../../../source/directives/octets/Store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"Store.js","sourceRoot":"","sources":["../../../source/directives/octets/Store.ts"],"names":[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;YAC5B,MAAM,GAAG,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;YAEzD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;QAC5D,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA1ED,sBA0EC"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export declare const
|
|
1
|
+
import type { Permissions as FetchPermissions } from './Fetch';
|
|
2
|
+
import type { Permissions as ListPermissions } from './List';
|
|
3
|
+
import type { Options as StoreOptions } from './Store';
|
|
4
|
+
import type { Options as DeleteOptions } from './Delete';
|
|
5
|
+
import type { Schema } from '@toa.io/schemas';
|
|
6
|
+
export declare const context: Schema<string>;
|
|
7
|
+
export declare const store: Schema<StoreOptions | null>;
|
|
8
|
+
export declare const fetch: Schema<FetchPermissions | null>;
|
|
9
|
+
export declare const remove: Schema<DeleteOptions | null>;
|
|
10
|
+
export declare const list: Schema<ListPermissions | null>;
|
|
11
|
+
export declare const permute: Schema<null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../source/directives/octets/schemas.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,8DAAqC;
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../source/directives/octets/schemas.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,8DAAqC;AAOrC,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,yBAAyB,CAAC,CAAA;AAC1D,MAAM,SAAS,GAAG,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAE5B,QAAA,OAAO,GAAmB,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AACrD,QAAA,KAAK,GAAgC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC9D,QAAA,KAAK,GAAoC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAClE,QAAA,MAAM,GAAiC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;AACjE,QAAA,IAAI,GAAmC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;AAC/D,QAAA,OAAO,GAAiB,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable } from 'stream';
|
|
3
|
+
import type { Unit } from './Workflow';
|
|
4
|
+
import type { Remotes } from '../../../Remotes';
|
|
5
|
+
import type { Entry } from '@toa.io/extensions.storages';
|
|
6
|
+
export declare class Execution extends Readable {
|
|
7
|
+
private readonly units;
|
|
8
|
+
private readonly remotes;
|
|
9
|
+
private readonly context;
|
|
10
|
+
private readonly components;
|
|
11
|
+
private readonly discovery;
|
|
12
|
+
private interrupted;
|
|
13
|
+
constructor(context: Context, units: Unit[], remotes: Remotes);
|
|
14
|
+
_read(): void;
|
|
15
|
+
private run;
|
|
16
|
+
private execute;
|
|
17
|
+
private call;
|
|
18
|
+
private discover;
|
|
19
|
+
}
|
|
20
|
+
export interface Context {
|
|
21
|
+
storage: string;
|
|
22
|
+
path: string;
|
|
23
|
+
entry: Entry;
|
|
24
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Execution = void 0;
|
|
4
|
+
const stream_1 = require("stream");
|
|
5
|
+
class Execution extends stream_1.Readable {
|
|
6
|
+
units;
|
|
7
|
+
remotes;
|
|
8
|
+
context;
|
|
9
|
+
components = {};
|
|
10
|
+
discovery = {};
|
|
11
|
+
interrupted = false;
|
|
12
|
+
constructor(context, units, remotes) {
|
|
13
|
+
super({ objectMode: true });
|
|
14
|
+
this.context = context;
|
|
15
|
+
this.units = units;
|
|
16
|
+
this.remotes = remotes;
|
|
17
|
+
void this.run();
|
|
18
|
+
}
|
|
19
|
+
_read() {
|
|
20
|
+
}
|
|
21
|
+
async run() {
|
|
22
|
+
this.push(this.context.entry);
|
|
23
|
+
for (const unit of this.units) {
|
|
24
|
+
await this.execute(unit);
|
|
25
|
+
if (this.interrupted)
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
this.push(null);
|
|
29
|
+
}
|
|
30
|
+
async execute(unit) {
|
|
31
|
+
const promises = Object.entries(unit).map(async ([step, endpoint]) => {
|
|
32
|
+
const result = await this.call(endpoint);
|
|
33
|
+
if (result instanceof Error) {
|
|
34
|
+
this.push({ error: { step, ...result } });
|
|
35
|
+
this.interrupted = true;
|
|
36
|
+
}
|
|
37
|
+
else
|
|
38
|
+
this.push({ [step]: result ?? null });
|
|
39
|
+
});
|
|
40
|
+
await Promise.all(promises);
|
|
41
|
+
}
|
|
42
|
+
async call(endpoint) {
|
|
43
|
+
const [operation, component, namespace = 'default'] = endpoint.split('.').reverse();
|
|
44
|
+
const key = `${namespace}.${component}`;
|
|
45
|
+
this.components[key] ??= await this.discover(key, namespace, component);
|
|
46
|
+
return await this.components[key].invoke(operation, { input: this.context });
|
|
47
|
+
}
|
|
48
|
+
async discover(key, namespace, component) {
|
|
49
|
+
if (this.discovery[key] === undefined)
|
|
50
|
+
this.discovery[key] = this.remotes.discover(namespace, component);
|
|
51
|
+
return await this.discovery[key];
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.Execution = Execution;
|
|
55
|
+
//# sourceMappingURL=Execution.js.map
|
|
@@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import { Execution } from './Execution';
|
|
2
|
+
import type { Input } from '../types';
|
|
3
|
+
import type { Entry } from '@toa.io/extensions.storages';
|
|
4
|
+
import type { Remotes } from '../../../Remotes';
|
|
5
|
+
export declare class Workflow {
|
|
6
|
+
private readonly units;
|
|
7
|
+
private readonly remotes;
|
|
8
|
+
constructor(units: Unit[] | Unit, remotes: Remotes);
|
|
9
|
+
execute(request: Input, storage: string, entry: Entry): Execution;
|
|
10
|
+
}
|
|
11
|
+
export type Unit = Record<string, string>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Workflow = void 0;
|
|
4
|
+
const node_path_1 = require("node:path");
|
|
5
|
+
const matchacho_1 = require("matchacho");
|
|
6
|
+
const Execution_1 = require("./Execution");
|
|
7
|
+
class Workflow {
|
|
8
|
+
units;
|
|
9
|
+
remotes;
|
|
10
|
+
constructor(units, remotes) {
|
|
11
|
+
this.units = (0, matchacho_1.match)(units, Array, (units) => units, Object, (unit) => [unit]);
|
|
12
|
+
this.remotes = remotes;
|
|
13
|
+
}
|
|
14
|
+
execute(request, storage, entry) {
|
|
15
|
+
const path = node_path_1.posix.join(request.path, entry.id);
|
|
16
|
+
const context = { storage, path, entry };
|
|
17
|
+
return new Execution_1.Execution(context, this.units, this.remotes);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Workflow = Workflow;
|
|
21
|
+
//# sourceMappingURL=Workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Workflow.js","sourceRoot":"","sources":["../../../../source/directives/octets/workflow/Workflow.ts"],"names":[],"mappings":";;;AAAA,yCAAiC;AACjC,yCAAiC;AACjC,2CAAuC;AAKvC,MAAa,QAAQ;IACF,KAAK,CAAQ;IACb,OAAO,CAAS;IAEjC,YAAoB,KAAoB,EAAE,OAAgB;QACxD,IAAI,CAAC,KAAK,GAAG,IAAA,iBAAK,EAAS,KAAK,EAC9B,KAAK,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,KAAK,EAC/B,MAAM,EAAE,CAAC,IAAU,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAA;QAEjC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAEM,OAAO,CAAE,OAAc,EAAE,OAAe,EAAE,KAAY;QAC3D,MAAM,IAAI,GAAG,iBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;QAC/C,MAAM,OAAO,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;QAExC,OAAO,IAAI,qBAAS,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IACzD,CAAC;CACF;AAlBD,4BAkBC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Workflow, type Unit } from './Workflow';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Workflow = void 0;
|
|
4
|
+
var Workflow_1 = require("./Workflow");
|
|
5
|
+
Object.defineProperty(exports, "Workflow", { enumerable: true, get: function () { return Workflow_1.Workflow; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../source/directives/octets/workflow/index.ts"],"names":[],"mappings":";;;AAAA,uCAAgD;AAAvC,oGAAA,QAAQ,OAAA"}
|
package/transpiled/manifest.js
CHANGED
|
@@ -22,23 +22,28 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.manifest = void 0;
|
|
30
|
+
const node_assert_1 = __importDefault(require("node:assert"));
|
|
27
31
|
const syntax_1 = require("./RTD/syntax");
|
|
28
32
|
const Directive_1 = require("./Directive");
|
|
29
33
|
const schemas = __importStar(require("./schemas"));
|
|
30
34
|
function manifest(declaration, manifest) {
|
|
31
|
-
declaration
|
|
32
|
-
|
|
33
|
-
declaration = wrap(manifest.namespace, declaration);
|
|
35
|
+
node_assert_1.default.ok(typeof declaration === 'object' && declaration !== null, 'Exposition declaration must be an object');
|
|
36
|
+
declaration = wrap(declaration, manifest.namespace, manifest.name);
|
|
34
37
|
const node = (0, syntax_1.parse)(declaration, Directive_1.shortcuts);
|
|
35
38
|
concretize(node, manifest);
|
|
36
39
|
schemas.node.validate(node);
|
|
37
40
|
return node;
|
|
38
41
|
}
|
|
39
42
|
exports.manifest = manifest;
|
|
40
|
-
function wrap(
|
|
41
|
-
|
|
43
|
+
function wrap(declaration, namespace, name) {
|
|
44
|
+
const path = (namespace === undefined || namespace === 'default' ? '' : '/' + namespace) +
|
|
45
|
+
'/' + name;
|
|
46
|
+
return { [path]: { protected: true, ...declaration } };
|
|
42
47
|
}
|
|
43
48
|
function concretize(node, manifest) {
|
|
44
49
|
for (const route of node.routes) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../source/manifest.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../source/manifest.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8DAAgC;AAChC,yCAAwE;AACxE,2CAAuC;AACvC,mDAAoC;AAGpC,SAAgB,QAAQ,CAAE,WAAmB,EAAE,QAAkB;IAC/D,qBAAM,CAAC,EAAE,CAAC,OAAO,WAAW,KAAK,QAAQ,IAAI,WA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AK,SAAS;QACzB,MAAM,IAAI,KAAK,CAAC,cAAc,MAAM,CAAC,OAAO,CAAC,QAAQ,aAAa,CAAC,CAAA;IAErE,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,SAAS,CAAC,KAAK,KAAK,KAAK;QACjE,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,EAAsB,CAAA,CAAC,wCAAwC;IAExF,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC,SAAS,CAAA;IAC7C,MAAM,CAAC,OAAO,CAAC,SAAS,GAAG,QAAQ,CAAC,IAAI,CAAA;AAC1C,CAAC"}
|
package/transpiled/schemas.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Query } from './HTTP';
|
|
2
|
+
import type { Node } from './RTD';
|
|
3
|
+
import type { Schema } from '@toa.io/schemas';
|
|
4
|
+
import type { Annotation } from './Annotation';
|
|
5
|
+
export declare const querystring: Schema<Query>;
|
|
6
|
+
export declare const annotaion: Schema<Annotation>;
|
|
7
|
+
export declare const node: Schema<Node>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,8DAAqC;
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../source/schemas.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,8DAAqC;AAMrC,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,YAAY,CAAC,CAAA;AAC7C,MAAM,SAAS,GAAG,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAE5B,QAAA,WAAW,GAAkB,SAAS,CAAC,MAAM,CAAC,aAAa,CAAC,CAAA;AAC5D,QAAA,SAAS,GAAuB,SAAS,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;AAC9D,QAAA,IAAI,GAAiB,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA"}
|