@toa.io/extensions.exposition 1.0.0-alpha.5 → 1.0.0-alpha.7
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/identity.basic/manifest.toa.yaml +2 -0
- package/components/identity.federation/manifest.toa.yaml +0 -6
- package/components/identity.roles/manifest.toa.yaml +1 -0
- package/documentation/io.md +56 -0
- package/documentation/query.md +9 -7
- package/documentation/tree.md +22 -4
- package/features/access.feature +11 -1
- package/features/annotation.feature +1 -0
- package/features/body.feature +1 -0
- package/features/cache.feature +3 -0
- package/features/directives.feature +2 -0
- package/features/dynamic.feature +14 -7
- package/features/errors.feature +3 -2
- package/features/etag.feature +1 -0
- package/features/identity.basic.feature +23 -0
- package/features/identity.federation.feature +3 -5
- package/features/identity.roles.feature +1 -0
- package/features/identity.tokens.feature +3 -0
- package/features/io.feature +167 -0
- package/features/octets.entries.feature +2 -0
- package/features/octets.feature +2 -0
- package/features/octets.meta.feature +4 -3
- package/features/octets.workflows.feature +1 -0
- package/features/queries.feature +9 -1
- package/features/response.feature +3 -0
- package/features/routes.feature +17 -10
- package/features/steps/components/pots/manifest.toa.yaml +2 -0
- package/features/steps/components/users/manifest.toa.yaml +1 -0
- package/features/steps/components/users.properties/manifest.toa.yaml +1 -0
- package/features/timing.feature +23 -0
- package/features/vary.feature +33 -3
- package/package.json +7 -7
- package/schemas/io/input.cos.yaml +3 -0
- package/schemas/io/message.cos.yaml +5 -0
- package/schemas/io/output.cos.yaml +5 -0
- package/source/Gateway.ts +4 -4
- package/source/HTTP/Server.ts +2 -2
- package/source/HTTP/messages.ts +1 -1
- package/source/directives/auth/Authorization.ts +3 -3
- package/source/directives/index.ts +4 -3
- package/source/directives/io/Directive.ts +11 -0
- package/source/directives/io/IO.ts +43 -0
- package/source/directives/io/Input.ts +50 -0
- package/source/directives/io/Message.ts +1 -0
- package/source/directives/io/Output.ts +69 -0
- package/source/directives/io/index.ts +3 -0
- package/source/directives/io/schemas.ts +12 -0
- package/source/directives/octets/Context.ts +4 -3
- package/source/directives/octets/Delete.ts +4 -2
- package/source/directives/octets/Directive.ts +10 -0
- package/source/directives/octets/Fetch.ts +4 -3
- package/source/directives/octets/List.ts +4 -2
- package/source/directives/octets/Octets.ts +3 -2
- package/source/directives/octets/Permute.ts +4 -3
- package/source/directives/octets/Store.ts +4 -2
- package/source/directives/octets/Workflow.ts +10 -3
- package/source/directives/octets/types.ts +0 -7
- package/source/directives/vary/embeddings/Header.ts +8 -6
- package/source/root.ts +5 -0
- package/transpiled/Gateway.js +4 -4
- package/transpiled/Gateway.js.map +1 -1
- package/transpiled/HTTP/Server.js +2 -2
- package/transpiled/HTTP/Server.js.map +1 -1
- package/transpiled/HTTP/messages.js +1 -1
- package/transpiled/HTTP/messages.js.map +1 -1
- package/transpiled/directives/auth/Authorization.js +3 -3
- package/transpiled/directives/auth/Authorization.js.map +1 -1
- package/transpiled/directives/index.js +4 -3
- package/transpiled/directives/index.js.map +1 -1
- package/transpiled/directives/io/Directive.d.ts +8 -0
- package/transpiled/directives/io/Directive.js +3 -0
- package/transpiled/directives/io/Directive.js.map +1 -0
- package/transpiled/directives/io/IO.d.ts +9 -0
- package/transpiled/directives/io/IO.js +33 -0
- package/transpiled/directives/io/IO.js.map +1 -0
- package/transpiled/directives/io/Input.d.ts +11 -0
- package/transpiled/directives/io/Input.js +63 -0
- package/transpiled/directives/io/Input.js.map +1 -0
- package/transpiled/directives/io/Message.d.ts +1 -0
- package/transpiled/directives/io/Message.js +3 -0
- package/transpiled/directives/io/Message.js.map +1 -0
- package/transpiled/directives/io/Output.d.ts +13 -0
- package/transpiled/directives/io/Output.js +76 -0
- package/transpiled/directives/io/Output.js.map +1 -0
- package/transpiled/directives/io/index.d.ts +2 -0
- package/transpiled/directives/io/index.js +6 -0
- package/transpiled/directives/io/index.js.map +1 -0
- package/transpiled/directives/io/schemas.d.ts +7 -0
- package/transpiled/directives/io/schemas.js +14 -0
- package/transpiled/directives/io/schemas.js.map +1 -0
- package/transpiled/directives/octets/Context.d.ts +3 -3
- package/transpiled/directives/octets/Context.js +4 -2
- package/transpiled/directives/octets/Context.js.map +1 -1
- package/transpiled/directives/octets/Delete.d.ts +3 -2
- package/transpiled/directives/octets/Delete.js +3 -1
- package/transpiled/directives/octets/Delete.js.map +1 -1
- package/transpiled/directives/octets/Directive.d.ts +8 -0
- package/transpiled/directives/octets/Directive.js +8 -0
- package/transpiled/directives/octets/Directive.js.map +1 -0
- package/transpiled/directives/octets/Fetch.d.ts +3 -2
- package/transpiled/directives/octets/Fetch.js +3 -1
- package/transpiled/directives/octets/Fetch.js.map +1 -1
- package/transpiled/directives/octets/List.d.ts +3 -2
- package/transpiled/directives/octets/List.js +3 -1
- package/transpiled/directives/octets/List.js.map +1 -1
- package/transpiled/directives/octets/Octets.d.ts +2 -1
- package/transpiled/directives/octets/Octets.js +1 -1
- package/transpiled/directives/octets/Octets.js.map +1 -1
- package/transpiled/directives/octets/Permute.d.ts +3 -2
- package/transpiled/directives/octets/Permute.js +3 -1
- package/transpiled/directives/octets/Permute.js.map +1 -1
- package/transpiled/directives/octets/Store.d.ts +3 -2
- package/transpiled/directives/octets/Store.js +3 -1
- package/transpiled/directives/octets/Store.js.map +1 -1
- package/transpiled/directives/octets/Workflow.d.ts +3 -2
- package/transpiled/directives/octets/Workflow.js +9 -2
- package/transpiled/directives/octets/Workflow.js.map +1 -1
- package/transpiled/directives/octets/types.d.ts +0 -5
- package/transpiled/directives/vary/embeddings/Header.js +8 -6
- package/transpiled/directives/vary/embeddings/Header.js.map +1 -1
- package/transpiled/root.js +5 -0
- package/transpiled/root.js.map +1 -1
- package/transpiled/tsconfig.tsbuildinfo +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.interceptors = exports.families = void 0;
|
|
4
|
-
const dev_1 = require("./dev");
|
|
5
4
|
const auth_1 = require("./auth");
|
|
6
5
|
const cache_1 = require("./cache");
|
|
7
|
-
const octets_1 = require("./octets");
|
|
8
6
|
const cors_1 = require("./cors");
|
|
7
|
+
const dev_1 = require("./dev");
|
|
8
|
+
const octets_1 = require("./octets");
|
|
9
|
+
const io_1 = require("./io");
|
|
9
10
|
const vary_1 = require("./vary");
|
|
10
|
-
exports.families = [auth_1.authorization,
|
|
11
|
+
exports.families = [auth_1.authorization, io_1.io, cache_1.cache, vary_1.vary, octets_1.octets, dev_1.dev];
|
|
11
12
|
exports.interceptors = [cors_1.cors];
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/directives/index.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/directives/index.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AACtC,mCAA+B;AAC/B,iCAA6B;AAC7B,+BAA2B;AAC3B,qCAAiC;AACjC,6BAAyB;AACzB,iCAA6B;AAIhB,QAAA,QAAQ,GAAsB,CAAC,oBAAa,EAAE,OAAE,EAAE,aAAK,EAAE,WAAI,EAAE,eAAM,EAAE,SAAG,CAAC,CAAA;AAC3E,QAAA,YAAY,GAAkB,CAAC,WAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../../../source/directives/io/Directive.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Directive } from './Directive';
|
|
2
|
+
import type { Input as Context } from '../../io';
|
|
3
|
+
import type { DirectiveFamily } from '../../RTD';
|
|
4
|
+
export declare class IO implements DirectiveFamily<Directive> {
|
|
5
|
+
readonly name = "io";
|
|
6
|
+
readonly mandatory = true;
|
|
7
|
+
create(name: string, value: unknown): Directive;
|
|
8
|
+
preflight(directives: Directive[], context: Context): null;
|
|
9
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IO = void 0;
|
|
4
|
+
const Output_1 = require("./Output");
|
|
5
|
+
const Input_1 = require("./Input");
|
|
6
|
+
class IO {
|
|
7
|
+
name = 'io';
|
|
8
|
+
mandatory = true;
|
|
9
|
+
create(name, value) {
|
|
10
|
+
if (!(name in constructors))
|
|
11
|
+
throw new Error(`Directive 'io:${name}' is not implemented.`);
|
|
12
|
+
const Directive = constructors[name];
|
|
13
|
+
Directive.validate(value);
|
|
14
|
+
return new Directive(value);
|
|
15
|
+
}
|
|
16
|
+
preflight(directives, context) {
|
|
17
|
+
let restricted = false;
|
|
18
|
+
for (const directive of directives) {
|
|
19
|
+
restricted ||= directive instanceof Output_1.Output;
|
|
20
|
+
directive.attach(context);
|
|
21
|
+
}
|
|
22
|
+
if (!restricted)
|
|
23
|
+
DENIAL.attach(context);
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.IO = IO;
|
|
28
|
+
const constructors = {
|
|
29
|
+
output: Output_1.Output,
|
|
30
|
+
input: Input_1.Input
|
|
31
|
+
};
|
|
32
|
+
const DENIAL = new Output_1.Output([]);
|
|
33
|
+
//# sourceMappingURL=IO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IO.js","sourceRoot":"","sources":["../../../source/directives/io/IO.ts"],"names":[],"mappings":";;;AAAA,qCAAiC;AACjC,mCAA+B;AAK/B,MAAa,EAAE;IACG,IAAI,GAAG,IAAI,CAAA;IACX,SAAS,GAAG,IAAI,CAAA;IAEzB,MAAM,CAAE,IAAY,EAAE,KAAc;QACzC,IAAI,CAAC,CAAC,IAAI,IAAI,YAAY,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,uBAAuB,CAAC,CAAA;QAE/D,MAAM,SAAS,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;QAEpC,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAEzB,OAAO,IAAI,SAAS,CAAC,KAAK,CAAC,CAAA;IAC7B,CAAC;IAEM,SAAS,CAAE,UAAuB,EAAE,OAAgB;QACzD,IAAI,UAAU,GAAG,KAAK,CAAA;QAEtB,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACnC,UAAU,KAAK,SAAS,YAAY,eAAM,CAAA;YAE1C,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAC3B,CAAC;QAED,IAAI,CAAC,UAAU;YACb,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;QAExB,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA7BD,gBA6BC;AAED,MAAM,YAAY,GAAgC;IAChD,MAAM,EAAE,eAAM;IACd,KAAK,EAAE,aAAK;CACb,CAAA;AAED,MAAM,MAAM,GAAW,IAAI,eAAM,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Directive } from './Directive';
|
|
2
|
+
import type { Input as Context } from '../../io';
|
|
3
|
+
export declare class Input implements Directive {
|
|
4
|
+
private readonly permissions;
|
|
5
|
+
constructor(permissions: Permissions);
|
|
6
|
+
static validate(permissions: unknown): asserts permissions is Permissions;
|
|
7
|
+
attach(context: Context): void;
|
|
8
|
+
private check;
|
|
9
|
+
private violation;
|
|
10
|
+
}
|
|
11
|
+
export type Permissions = string[];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Input = void 0;
|
|
27
|
+
const HTTP_1 = require("../../HTTP");
|
|
28
|
+
const schemas = __importStar(require("./schemas"));
|
|
29
|
+
class Input {
|
|
30
|
+
permissions;
|
|
31
|
+
constructor(permissions) {
|
|
32
|
+
this.permissions = permissions;
|
|
33
|
+
}
|
|
34
|
+
static validate(permissions) {
|
|
35
|
+
schemas.input.validate(permissions, 'Incorrect \'io:input\' format');
|
|
36
|
+
}
|
|
37
|
+
attach(context) {
|
|
38
|
+
context.pipelines.body.push((body) => this.check(body));
|
|
39
|
+
}
|
|
40
|
+
check(body) {
|
|
41
|
+
try {
|
|
42
|
+
schemas.message.validate(body);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
throw new HTTP_1.BadRequest('Invalid request body.');
|
|
46
|
+
}
|
|
47
|
+
const property = this.violation(body);
|
|
48
|
+
if (property !== undefined)
|
|
49
|
+
throw new HTTP_1.BadRequest(`Unexpected input: ${property}.`);
|
|
50
|
+
return body;
|
|
51
|
+
}
|
|
52
|
+
violation(value) {
|
|
53
|
+
if (!Array.isArray(value))
|
|
54
|
+
return Object.keys(value).find((key) => !this.permissions.includes(key));
|
|
55
|
+
for (const item of value) {
|
|
56
|
+
const property = this.violation(item);
|
|
57
|
+
if (property !== undefined)
|
|
58
|
+
return property;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.Input = Input;
|
|
63
|
+
//# sourceMappingURL=Input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Input.js","sourceRoot":"","sources":["../../../source/directives/io/Input.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAuC;AACvC,mDAAoC;AAKpC,MAAa,KAAK;IACC,WAAW,CAAa;IAEzC,YAAoB,WAAwB;QAC1C,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAChC,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAE,WAAoB;QAC1C,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,WAAW,EAAE,+BAA+B,CAAC,CAAA;IACtE,CAAC;IAEM,MAAM,CAAE,OAAgB;QAC7B,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;IACzD,CAAC;IAEO,KAAK,CAAE,IAAa;QAC1B,IAAI,CAAC;YACH,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;QAChC,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,IAAI,iBAAU,CAAC,uBAAuB,CAAC,CAAA;QAC/C,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;QAErC,IAAI,QAAQ,KAAK,SAAS;YACxB,MAAM,IAAI,iBAAU,CAAC,qBAAqB,QAAQ,GAAG,CAAC,CAAA;QAExD,OAAO,IAAI,CAAA;IACb,CAAC;IAEO,SAAS,CAAE,KAA0B;QAC3C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;YACvB,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAE1E,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAErC,IAAI,QAAQ,KAAK,SAAS;gBACxB,OAAO,QAAQ,CAAA;QACnB,CAAC;IACH,CAAC;CACF;AAzCD,sBAyCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Message = Record<string, unknown>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Message.js","sourceRoot":"","sources":["../../../source/directives/io/Message.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Directive } from './Directive';
|
|
2
|
+
import type { Input as Context } from '../../io';
|
|
3
|
+
export declare class Output implements Directive {
|
|
4
|
+
private readonly disabled;
|
|
5
|
+
private readonly omitted;
|
|
6
|
+
private readonly permissions;
|
|
7
|
+
constructor(permissions: Permissions);
|
|
8
|
+
static validate(permissions: unknown): asserts permissions is Permissions;
|
|
9
|
+
attach(context: Context): void;
|
|
10
|
+
private restriction;
|
|
11
|
+
private fit;
|
|
12
|
+
}
|
|
13
|
+
export type Permissions = string[] | boolean;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.Output = void 0;
|
|
27
|
+
const node_stream_1 = require("node:stream");
|
|
28
|
+
const schemas = __importStar(require("./schemas"));
|
|
29
|
+
class Output {
|
|
30
|
+
disabled = false;
|
|
31
|
+
omitted = true;
|
|
32
|
+
permissions = [];
|
|
33
|
+
constructor(permissions) {
|
|
34
|
+
if (typeof permissions === 'boolean')
|
|
35
|
+
if (permissions)
|
|
36
|
+
this.disabled = true;
|
|
37
|
+
else
|
|
38
|
+
this.omitted = false;
|
|
39
|
+
else
|
|
40
|
+
this.permissions = permissions;
|
|
41
|
+
}
|
|
42
|
+
static validate(permissions) {
|
|
43
|
+
schemas.output.validate(permissions, 'Incorrect \'io:output\' format');
|
|
44
|
+
}
|
|
45
|
+
attach(context) {
|
|
46
|
+
context.pipelines.response.push(this.restriction(context));
|
|
47
|
+
}
|
|
48
|
+
restriction(context) {
|
|
49
|
+
return (message) => {
|
|
50
|
+
const error = message.status !== undefined && message.status >= 300;
|
|
51
|
+
const stream = message.body instanceof node_stream_1.Stream;
|
|
52
|
+
const none = message.body === undefined || message.body === null;
|
|
53
|
+
if (this.disabled || error || stream || none)
|
|
54
|
+
return;
|
|
55
|
+
if (typeof message.body !== 'object' || this.permissions.length === 0) {
|
|
56
|
+
if (this.omitted)
|
|
57
|
+
console.warn('Permissions for \'io:output\' are not specified properly ' +
|
|
58
|
+
`(${context.request.url}). Response omitted.`);
|
|
59
|
+
delete message.body;
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
schemas.message.validate(message.body, '\'io:output\' expects response to be an object or array of objects');
|
|
63
|
+
if (Array.isArray(message.body))
|
|
64
|
+
message.body = message.body.map((entity) => this.fit(entity));
|
|
65
|
+
else
|
|
66
|
+
message.body = this.fit(message.body);
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
fit(message) {
|
|
70
|
+
const entries = Object.entries(message)
|
|
71
|
+
.filter(([key]) => this.permissions.includes(key));
|
|
72
|
+
return Object.fromEntries(entries);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Output = Output;
|
|
76
|
+
//# sourceMappingURL=Output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Output.js","sourceRoot":"","sources":["../../../source/directives/io/Output.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAoC;AACpC,mDAAoC;AAMpC,MAAa,MAAM;IACA,QAAQ,GAAY,KAAK,CAAA;IACzB,OAAO,GAAY,IAAI,CAAA;IACvB,WAAW,GAAa,EAAE,CAAA;IAE3C,YAAoB,WAAwB;QAC1C,IAAI,OAAO,WAAW,KAAK,SAAS;YAClC,IAAI,WAAW;gBACb,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAA;;gBAEpB,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;;YAGtB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAA;IAClC,CAAC;IAEM,MAAM,CAAC,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AM,CAAC,CAAC,CAAA;;gBAE7D,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;QACzC,CAAC,CAAA;IACH,CAAC;IAEO,GAAG,CAAE,OAAgB;QAC3B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;aACpC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAA;QAEpD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;IACpC,CAAC;CACF;AA3DD,wBA2DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/directives/io/index.ts"],"names":[],"mappings":";;;AAAA,6BAAyB;AAEZ,QAAA,EAAE,GAAG,IAAI,OAAE,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Schema } from '@toa.io/schemas';
|
|
2
|
+
import type { Permissions as InputPermissions } from './Input';
|
|
3
|
+
import type { Permissions as OutputPermissions } from './Output';
|
|
4
|
+
import type { Message } from './Message';
|
|
5
|
+
export declare const message: Schema<Message | Message[]>;
|
|
6
|
+
export declare const input: Schema<InputPermissions>;
|
|
7
|
+
export declare const output: Schema<OutputPermissions>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.output = exports.input = exports.message = void 0;
|
|
7
|
+
const node_path_1 = require("node:path");
|
|
8
|
+
const schemas_1 = __importDefault(require("@toa.io/schemas"));
|
|
9
|
+
const path = (0, node_path_1.resolve)(__dirname, '../../../schemas/io');
|
|
10
|
+
const namespace = schemas_1.default.namespace(path);
|
|
11
|
+
exports.message = namespace.schema('message');
|
|
12
|
+
exports.input = namespace.schema('input');
|
|
13
|
+
exports.output = namespace.schema('output');
|
|
14
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../source/directives/io/schemas.ts"],"names":[],"mappings":";;;;;;AAAA,yCAAmC;AACnC,8DAAsD;AAKtD,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,SAAS,EAAE,qBAAqB,CAAC,CAAA;AACtD,MAAM,SAAS,GAAG,iBAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;AAE5B,QAAA,OAAO,GAAgC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;AAClE,QAAA,KAAK,GAA6B,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3D,QAAA,MAAM,GAA8B,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Directive } from './Directive';
|
|
1
2
|
import type { Output } from '../../io';
|
|
2
|
-
|
|
3
|
-
export declare class Context implements Directive {
|
|
3
|
+
export declare class Context extends Directive {
|
|
4
4
|
readonly targeted = false;
|
|
5
5
|
readonly storage: string;
|
|
6
6
|
constructor(value: unknown);
|
|
7
|
-
apply(): Output
|
|
7
|
+
apply(): Promise<Output>;
|
|
8
8
|
}
|
|
@@ -25,14 +25,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.Context = void 0;
|
|
27
27
|
const schemas = __importStar(require("./schemas"));
|
|
28
|
-
|
|
28
|
+
const Directive_1 = require("./Directive");
|
|
29
|
+
class Context extends Directive_1.Directive {
|
|
29
30
|
targeted = false;
|
|
30
31
|
storage;
|
|
31
32
|
constructor(value) {
|
|
33
|
+
super();
|
|
32
34
|
schemas.context.validate(value);
|
|
33
35
|
this.storage = value;
|
|
34
36
|
}
|
|
35
|
-
apply() {
|
|
37
|
+
async apply() {
|
|
36
38
|
return null;
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../source/directives/octets/Context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../source/directives/octets/Context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AACpC,2CAAuC;AAGvC,MAAa,OAAQ,SAAQ,qBAAS;IACpB,QAAQ,GAAG,KAAK,CAAA;IAChB,OAAO,CAAQ;IAE/B,YAAoB,KAAc;QAChC,KAAK,EAAE,CAAA;QACP,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE/B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAEM,KAAK,CAAC,KAAK;QAChB,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAdD,0BAcC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Directive } from './Directive';
|
|
1
2
|
import type { Parameter } from '../../RTD';
|
|
2
3
|
import type { Unit } from './workflows';
|
|
3
4
|
import type { Component } from '@toa.io/core';
|
|
4
5
|
import type { Output } from '../../io';
|
|
5
|
-
import type {
|
|
6
|
+
import type { Input } from './types';
|
|
6
7
|
import type { Remotes } from '../../Remotes';
|
|
7
|
-
export declare class Delete
|
|
8
|
+
export declare class Delete extends Directive {
|
|
8
9
|
readonly targeted = true;
|
|
9
10
|
private readonly workflow?;
|
|
10
11
|
private readonly discovery;
|
|
@@ -28,12 +28,14 @@ const stream_1 = require("stream");
|
|
|
28
28
|
const HTTP_1 = require("../../HTTP");
|
|
29
29
|
const schemas = __importStar(require("./schemas"));
|
|
30
30
|
const workflows_1 = require("./workflows");
|
|
31
|
-
|
|
31
|
+
const Directive_1 = require("./Directive");
|
|
32
|
+
class Delete extends Directive_1.Directive {
|
|
32
33
|
targeted = true;
|
|
33
34
|
workflow;
|
|
34
35
|
discovery;
|
|
35
36
|
storage = null;
|
|
36
37
|
constructor(options, discovery, remotes) {
|
|
38
|
+
super();
|
|
37
39
|
schemas.remove.validate(options);
|
|
38
40
|
if (options?.workflow !== undefined)
|
|
39
41
|
this.workflow = new workflows_1.Workflow(options.workflow, remotes);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Delete.js","sourceRoot":"","sources":["../../../source/directives/octets/Delete.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiC;AACjC,qCAAqC;AACrC,mDAAoC;AACpC,2CAAsC;
|
|
1
|
+
{"version":3,"file":"Delete.js","sourceRoot":"","sources":["../../../source/directives/octets/Delete.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mCAAiC;AACjC,qCAAqC;AACrC,mDAAoC;AACpC,2CAAsC;AACtC,2CAAuC;AAUvC,MAAa,MAAO,SAAQ,qBAAS;IACnB,QAAQ,GAAG,IAAI,CAAA;IAEd,QAAQ,CAAW;IACnB,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,OAAuB,EAAE,SAA6B,EAAE,OAAgB;QAC1F,KAAK,EAAE,CAAA;QACP,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;QAEhC,IAAI,OAAO,EAAE,QAAQ,KAAK,SAAS;YACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,oBAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;QAEzD,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,KAAK,CAAE,OAAe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YAEX,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK;gBACjE,OAAM;QACV,CAAC;QAED,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACnC,CAAC;CACF;AAlED,wBAkEC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Input } from './types';
|
|
2
|
+
import type { Parameter } from '../../RTD';
|
|
3
|
+
import type * as io from '../../io';
|
|
4
|
+
export declare abstract class Directive {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
abstract readonly targeted: boolean;
|
|
7
|
+
abstract apply(storage: string, input: Input, parameters: Parameter[]): Promise<io.Output>;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Directive.js","sourceRoot":"","sources":["../../../source/directives/octets/Directive.ts"],"names":[],"mappings":";;;AAIA,MAAsB,SAAS;IACb,IAAI,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,EAAE,CAAA;CAIvE;AALD,8BAKC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Directive } from './Directive';
|
|
1
2
|
import type { Component } from '@toa.io/core';
|
|
2
3
|
import type { Output } from '../../io';
|
|
3
|
-
import type {
|
|
4
|
-
export declare class Fetch
|
|
4
|
+
import type { Input } from './types';
|
|
5
|
+
export declare class Fetch extends Directive {
|
|
5
6
|
readonly targeted = true;
|
|
6
7
|
private readonly permissions;
|
|
7
8
|
private readonly discovery;
|
|
@@ -27,7 +27,8 @@ exports.Fetch = void 0;
|
|
|
27
27
|
const node_path_1 = require("node:path");
|
|
28
28
|
const HTTP_1 = require("../../HTTP");
|
|
29
29
|
const schemas = __importStar(require("./schemas"));
|
|
30
|
-
|
|
30
|
+
const Directive_1 = require("./Directive");
|
|
31
|
+
class Fetch extends Directive_1.Directive {
|
|
31
32
|
targeted = true;
|
|
32
33
|
permissions = {
|
|
33
34
|
blob: true,
|
|
@@ -36,6 +37,7 @@ class Fetch {
|
|
|
36
37
|
discovery;
|
|
37
38
|
storage = null;
|
|
38
39
|
constructor(permissions, discovery) {
|
|
40
|
+
super();
|
|
39
41
|
schemas.fetch.validate(permissions);
|
|
40
42
|
Object.assign(this.permissions, permissions);
|
|
41
43
|
this.discovery = discovery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fetch.js","sourceRoot":"","sources":["../../../source/directives/octets/Fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,qCAAgD;AAChD,mDAAoC;
|
|
1
|
+
{"version":3,"file":"Fetch.js","sourceRoot":"","sources":["../../../source/directives/octets/Fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,qCAAgD;AAChD,mDAAoC;AACpC,2CAAuC;AAQvC,MAAa,KAAM,SAAQ,qBAAS;IAClB,QAAQ,GAAG,IAAI,CAAA;IAEd,WAAW,GAA0B;QACpD,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,KAAK;KACZ,CAAA;IAEgB,SAAS,CAAoB;IACtC,OAAO,GAAc,IAA4B,CAAA;IAEzD,YAAoB,WAA+B,EAAE,SAA6B;QAChF,KAAK,EAAE,CAAA;QACP,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,KAAY;QAC/C,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CAAC,SAAS,CAAA;QAErC,MAAM,OAAO,GAAG,iBAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAA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,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAe,KAAK,EAAE;YAC3D,KAAK,EAAE;gBACL,OAAO;gBACP,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG;aACxB;SACF,CAAC,CAAA;QAEF,IAAI,KAAK,YAAY,KAAK;YACxB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACxB,CAAC;CACF;AA5ED,sBA4EC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Directive } from './Directive';
|
|
1
2
|
import type { Component } from '@toa.io/core';
|
|
2
3
|
import type { Output } from '../../io';
|
|
3
|
-
import type {
|
|
4
|
-
export declare class List
|
|
4
|
+
import type { Input } from './types';
|
|
5
|
+
export declare class List extends Directive {
|
|
5
6
|
readonly targeted = false;
|
|
6
7
|
private readonly permissions;
|
|
7
8
|
private readonly discovery;
|
|
@@ -27,12 +27,14 @@ exports.List = void 0;
|
|
|
27
27
|
const node_path_1 = require("node:path");
|
|
28
28
|
const HTTP_1 = require("../../HTTP");
|
|
29
29
|
const schemas = __importStar(require("./schemas"));
|
|
30
|
-
|
|
30
|
+
const Directive_1 = require("./Directive");
|
|
31
|
+
class List extends Directive_1.Directive {
|
|
31
32
|
targeted = false;
|
|
32
33
|
permissions = { meta: false };
|
|
33
34
|
discovery;
|
|
34
35
|
storage = null;
|
|
35
36
|
constructor(permissions, discovery) {
|
|
37
|
+
super();
|
|
36
38
|
schemas.list.validate(permissions);
|
|
37
39
|
Object.assign(this.permissions, permissions);
|
|
38
40
|
this.discovery = discovery;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../source/directives/octets/List.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAAiC;AACjC,qCAAgD;AAChD,mDAAoC;
|
|
1
|
+
{"version":3,"file":"List.js","source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rD,CAAC,CAAC,IAAI,CAAA;QAER,OAAO,EAAE,IAAI,EAAE,CAAA;IACjB,CAAC;IAEO,KAAK,CAAC,MAAM,CAAE,OAAe,EAAE,MAAc,EAAE,IAAc;QAEnE,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YACrC,MAAM,IAAI,GAAG,iBAAK,CAAC,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;YAEnC,MAAM,KAAK,GAAG;gBACZ,OAAO;gBACP,IAAI;aACL,CAAA;YAED,0FAA0F;YAC1F,OAAO,IAAI,CAAC,OAAQ,CAAC,MAAM,CAAe,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAC7D,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IACpC,CAAC;CACF;AAxDD,oBAwDC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type { Directive } from './Directive';
|
|
1
2
|
import type { Output } from '../../io';
|
|
2
3
|
import type { Remotes } from '../../Remotes';
|
|
3
4
|
import type { Parameter, DirectiveFamily } from '../../RTD';
|
|
4
|
-
import type {
|
|
5
|
+
import type { Input } from './types';
|
|
5
6
|
export declare class Octets implements DirectiveFamily<Directive> {
|
|
6
7
|
readonly name: string;
|
|
7
8
|
readonly mandatory: boolean;
|
|
@@ -39,7 +39,7 @@ class Octets {
|
|
|
39
39
|
if (targeted !== action.targeted)
|
|
40
40
|
throw new HTTP_1.NotFound(`Trailing slash is ${action.targeted ? 'redundant' : 'required'}.`);
|
|
41
41
|
// noinspection JSObjectNullOrUndefined
|
|
42
|
-
return action.apply(context.storage, input, parameters);
|
|
42
|
+
return await input.timing.capture(action.name, action.apply(context.storage, input, parameters));
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
exports.Octets = Octets;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Octets.js","sourceRoot":"","sources":["../../../source/directives/octets/Octets.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,uCAAmC;AACnC,mCAA+B;AAC/B,mCAA+B;AAC/B,iCAA6B;AAC7B,qCAAiC;AACjC,uCAAmC;AACnC,yCAA8C;
|
|
1
|
+
{"version":3,"file":"Octets.js","sourceRoot":"","sources":["../../../source/directives/octets/Octets.ts"],"names":[],"mappings":";;;AAAA,qCAAqC;AACrC,uCAAmC;AACnC,mCAA+B;AAC/B,mCAA+B;AAC/B,iCAA6B;AAC7B,qCAAiC;AACjC,uCAAmC;AACnC,yCAA8C;AAQ9C,MAAa,MAAM;IACD,IAAI,GAAW,QAAQ,CAAA;IACvB,SAAS,GAAY,KAAK,CAAA;IAElC,SAAS,GAAG,IAAqC,CAAA;IAElD,MAAM,CAAE,IAAY,EAAE,KAAU,EAAE,OAAgB;QACvD,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAA;QAE9B,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,6BAA6B,IAAI,CAAC,IAAI,WAAW,CAAC,CAAA;QAEtF,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;QAExD,OAAO,IAAI,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;IAClD,CAAC;IAEM,KAAK,CAAC,SAAS,CACrB,UAAuB,EAAE,KAAY,EAAE,UAAuB;QAC7D,IAAI,OAAO,GAAmB,IAAI,CAAA;QAClC,IAAI,MAAM,GAAqB,IAAI,CAAA;QAEnC,KAAK,MAAM,SAAS,IAAI,UAAU;YAChC,IAAI,SAAS,YAAY,iBAAO;gBAC9B,OAAO,KAAK,SAAS,CAAA;iBAClB,IAAI,MAAM,KAAK,IAAI;gBACtB,MAAM,GAAG,SAAS,CAAA;;gBAElB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;QAElD,IAAI,MAAM,KAAK,IAAI;YACjB,OAAO,IAAI,CAAA;QAEb,4CAA4C;QAC5C,IAAI,OAAO,KAAK,IAAI;YAClB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAEnD,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAA;QAExE,IAAI,QAAQ,KAAK,MAAM,CAAC,QAAQ;YAC9B,MAAM,IAAI,eAAQ,CAAC,qBAAqB,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,UAAU,GAAG,CAAC,CAAA;QAExF,uCAAuC;QACvC,OAAO,MAAM,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAA;IAClG,CAAC;CACF;AA7CD,wBA6CC;AAED,MAAM,UAAU,GAAgC;IAC9C,OAAO,EAAE,iBAAO;IAChB,KAAK,EAAE,aAAK;IACZ,KAAK,EAAE,aAAK;IACZ,IAAI,EAAE,WAAI;IACV,MAAM,EAAE,eAAM;IACd,OAAO,EAAE,iBAAO;IAChB,QAAQ,EAAE,4BAAiB;CAC5B,CAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { Directive } from './Directive';
|
|
1
2
|
import type { Component } from '@toa.io/core';
|
|
2
3
|
import type { Output } from '../../io';
|
|
3
|
-
import type {
|
|
4
|
-
export declare class Permute
|
|
4
|
+
import type { Input } from './types';
|
|
5
|
+
export declare class Permute extends Directive {
|
|
5
6
|
readonly targeted = false;
|
|
6
7
|
private readonly discovery;
|
|
7
8
|
private storage;
|
|
@@ -26,11 +26,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
26
26
|
exports.Permute = void 0;
|
|
27
27
|
const HTTP_1 = require("../../HTTP");
|
|
28
28
|
const schemas = __importStar(require("./schemas"));
|
|
29
|
-
|
|
29
|
+
const Directive_1 = require("./Directive");
|
|
30
|
+
class Permute extends Directive_1.Directive {
|
|
30
31
|
targeted = false;
|
|
31
32
|
discovery;
|
|
32
33
|
storage = null;
|
|
33
34
|
constructor(value, discovery) {
|
|
35
|
+
super();
|
|
34
36
|
schemas.permute.validate(value);
|
|
35
37
|
this.discovery = discovery;
|
|
36
38
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Permute.js","sourceRoot":"","sources":["../../../source/directives/octets/Permute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,mDAAoC;
|
|
1
|
+
{"version":3,"file":"Permute.js","sourceRoot":"","sources":["../../../source/directives/octets/Permute.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAoD;AACpD,mDAAoC;AACpC,2CAAuC;AAMvC,MAAa,OAAQ,SAAQ,qBAAS;IACpB,QAAQ,GAAG,KAAK,CAAA;IAEf,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,KAAW,EAAE,SAA6B;QAC5D,KAAK,EAAE,CAAA;QACP,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,KAAY;QAC/C,IAAI,CAAC,OAAO,KAAK,MAAM,IAAI,CAAC,SAAS,CAAA;QAErC,IAAI,KAAK,CAAC,OAAO,KAAK,IAAI;YACxB,MAAM,IAAI,oBAAa,EAAE,CAAA;QAE3B,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAA;QAC9B,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,IAAI,EAAE,CAAA;QAE/B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAiB,SAAS,EAAE;YACjE,KAAK,EAAE;gBACL,OAAO;gBACP,IAAI;gBACJ,IAAI;aACL;SACF,CAAC,CAAA;QAEF,IAAI,KAAK,YAAY,KAAK;YACxB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAnCD,0BAmCC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Directive } from './Directive';
|
|
1
2
|
import type { Parameter } from '../../RTD';
|
|
2
3
|
import type { Unit } from './workflows';
|
|
3
4
|
import type { Remotes } from '../../Remotes';
|
|
4
5
|
import type { Component } from '@toa.io/core';
|
|
5
6
|
import type { Output } from '../../io';
|
|
6
|
-
import type {
|
|
7
|
-
export declare class Store
|
|
7
|
+
import type { Input } from './types';
|
|
8
|
+
export declare class Store extends Directive {
|
|
8
9
|
readonly targeted = false;
|
|
9
10
|
private readonly accept?;
|
|
10
11
|
private readonly workflow?;
|
|
@@ -30,13 +30,15 @@ const HTTP_1 = require("../../HTTP");
|
|
|
30
30
|
const cors_1 = require("../cors");
|
|
31
31
|
const schemas = __importStar(require("./schemas"));
|
|
32
32
|
const workflows_1 = require("./workflows");
|
|
33
|
-
|
|
33
|
+
const Directive_1 = require("./Directive");
|
|
34
|
+
class Store extends Directive_1.Directive {
|
|
34
35
|
targeted = false;
|
|
35
36
|
accept;
|
|
36
37
|
workflow;
|
|
37
38
|
discovery = {};
|
|
38
39
|
storage = null;
|
|
39
40
|
constructor(options, discovery, remotes) {
|
|
41
|
+
super();
|
|
40
42
|
schemas.store.validate(options);
|
|
41
43
|
this.accept = (0, matchacho_1.match)(options?.accept, String, (value) => value, Array, (types) => types.join(','), undefined);
|
|
42
44
|
if (options?.workflow !== undefined)
|