@toa.io/extensions.exposition 0.22.1 → 0.24.0-alpha.0
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/source/authenticate.ts +3 -2
- package/components/identity.basic/source/transit.ts +4 -3
- package/components/octets.storage/manifest.toa.yaml +26 -0
- package/components/octets.storage/operations/delete.js +7 -0
- package/components/octets.storage/operations/fetch.js +46 -0
- package/components/octets.storage/operations/get.js +7 -0
- package/components/octets.storage/operations/list.js +7 -0
- package/components/octets.storage/operations/permute.js +7 -0
- package/components/octets.storage/operations/store.js +11 -0
- package/cucumber.js +0 -1
- package/documentation/access.md +2 -3
- package/documentation/cache.md +42 -0
- package/documentation/octets.md +196 -0
- package/documentation/protocol.md +49 -5
- package/documentation/tree.md +1 -5
- package/features/access.feature +1 -0
- package/features/cache.feature +160 -0
- package/features/errors.feature +18 -0
- package/features/identity.basic.feature +2 -0
- package/features/octets.feature +295 -0
- package/features/octets.workflows.feature +114 -0
- package/features/routes.feature +40 -0
- package/features/steps/HTTP.ts +54 -6
- package/features/steps/Parameters.ts +5 -2
- package/features/steps/Workspace.ts +8 -5
- package/features/steps/components/octets.tester/manifest.toa.yaml +15 -0
- package/features/steps/components/octets.tester/operations/bar.js +12 -0
- package/features/steps/components/octets.tester/operations/baz.js +11 -0
- package/features/steps/components/octets.tester/operations/diversify.js +14 -0
- package/features/steps/components/octets.tester/operations/err.js +16 -0
- package/features/steps/components/octets.tester/operations/foo.js +7 -0
- package/features/steps/components/octets.tester/operations/lenna.png +0 -0
- package/features/steps/components/pots/manifest.toa.yaml +1 -1
- package/features/streams.feature +5 -1
- package/package.json +16 -9
- package/readme.md +8 -5
- package/schemas/octets/context.cos.yaml +1 -0
- package/schemas/octets/delete.cos.yaml +1 -0
- package/schemas/octets/fetch.cos.yaml +3 -0
- package/schemas/octets/list.cos.yaml +1 -0
- package/schemas/octets/permute.cos.yaml +1 -0
- package/schemas/octets/store.cos.yaml +3 -0
- package/source/Gateway.ts +9 -4
- package/source/HTTP/Server.fixtures.ts +2 -6
- package/source/HTTP/Server.test.ts +9 -31
- package/source/HTTP/Server.ts +55 -28
- package/source/HTTP/exceptions.ts +2 -12
- package/source/HTTP/formats/index.ts +7 -4
- package/source/HTTP/formats/json.ts +3 -0
- package/source/HTTP/formats/msgpack.ts +3 -0
- package/source/HTTP/formats/text.ts +3 -0
- package/source/HTTP/formats/yaml.ts +3 -0
- package/source/HTTP/messages.test.ts +3 -49
- package/source/HTTP/messages.ts +60 -35
- package/source/RTD/Route.ts +1 -1
- package/source/RTD/segment.ts +2 -1
- package/source/RTD/syntax/parse.ts +2 -1
- package/source/Remotes.ts +8 -0
- package/source/Tenant.ts +5 -0
- package/source/directives/auth/Family.ts +26 -22
- package/source/directives/auth/Rule.ts +1 -1
- package/source/directives/cache/Control.ts +59 -0
- package/source/directives/cache/Exact.ts +7 -0
- package/source/directives/cache/Family.ts +36 -0
- package/source/directives/cache/index.ts +3 -0
- package/source/directives/cache/types.ts +9 -0
- package/source/directives/index.ts +3 -1
- package/source/directives/octets/Context.ts +18 -0
- package/source/directives/octets/Delete.ts +32 -0
- package/source/directives/octets/Family.ts +68 -0
- package/source/directives/octets/Fetch.ts +85 -0
- package/source/directives/octets/List.ts +32 -0
- package/source/directives/octets/Permute.ts +37 -0
- package/source/directives/octets/Store.ts +158 -0
- package/source/directives/octets/index.ts +3 -0
- package/source/directives/octets/schemas.ts +12 -0
- package/source/directives/octets/types.ts +13 -0
- package/transpiled/Annotation.d.ts +7 -0
- package/transpiled/Annotation.js +3 -0
- package/transpiled/Annotation.js.map +1 -0
- package/transpiled/Branch.d.ts +7 -0
- package/transpiled/Branch.js +3 -0
- package/transpiled/Branch.js.map +1 -0
- package/transpiled/Composition.d.ts +14 -0
- package/transpiled/Composition.js +43 -0
- package/transpiled/Composition.js.map +1 -0
- package/transpiled/Context.d.ts +5 -0
- package/transpiled/Context.js +3 -0
- package/transpiled/Context.js.map +1 -0
- package/transpiled/Directive.d.ts +32 -0
- package/transpiled/Directive.js +76 -0
- package/transpiled/Directive.js.map +1 -0
- package/transpiled/Endpoint.d.ts +20 -0
- package/transpiled/Endpoint.js +45 -0
- package/transpiled/Endpoint.js.map +1 -0
- package/transpiled/Factory.d.ts +10 -0
- package/transpiled/Factory.js +66 -0
- package/transpiled/Factory.js.map +1 -0
- package/transpiled/Gateway.d.ts +19 -0
- package/transpiled/Gateway.js +92 -0
- package/transpiled/Gateway.js.map +1 -0
- package/transpiled/HTTP/Server.d.ts +22 -0
- package/transpiled/HTTP/Server.fixtures.d.ts +11 -0
- package/transpiled/HTTP/Server.fixtures.js +32 -0
- package/transpiled/HTTP/Server.fixtures.js.map +1 -0
- package/transpiled/HTTP/Server.js +131 -0
- package/transpiled/HTTP/Server.js.map +1 -0
- package/transpiled/HTTP/exceptions.d.ts +34 -0
- package/transpiled/HTTP/exceptions.js +71 -0
- package/transpiled/HTTP/exceptions.js.map +1 -0
- package/transpiled/HTTP/formats/index.d.ts +10 -0
- package/transpiled/HTTP/formats/index.js +38 -0
- package/transpiled/HTTP/formats/index.js.map +1 -0
- package/transpiled/HTTP/formats/json.d.ts +6 -0
- package/transpiled/HTTP/formats/json.js +17 -0
- package/transpiled/HTTP/formats/json.js.map +1 -0
- package/transpiled/HTTP/formats/msgpack.d.ts +6 -0
- package/transpiled/HTTP/formats/msgpack.js +38 -0
- package/transpiled/HTTP/formats/msgpack.js.map +1 -0
- package/transpiled/HTTP/formats/text.d.ts +6 -0
- package/transpiled/HTTP/formats/text.js +15 -0
- package/transpiled/HTTP/formats/text.js.map +1 -0
- package/transpiled/HTTP/formats/yaml.d.ts +6 -0
- package/transpiled/HTTP/formats/yaml.js +41 -0
- package/transpiled/HTTP/formats/yaml.js.map +1 -0
- package/transpiled/HTTP/index.d.ts +3 -0
- package/transpiled/HTTP/index.js +20 -0
- package/transpiled/HTTP/index.js.map +1 -0
- package/transpiled/HTTP/messages.d.ts +28 -0
- package/transpiled/HTTP/messages.js +70 -0
- package/transpiled/HTTP/messages.js.map +1 -0
- package/transpiled/Mapping.d.ts +8 -0
- package/transpiled/Mapping.js +38 -0
- package/transpiled/Mapping.js.map +1 -0
- package/transpiled/Query.d.ts +13 -0
- package/transpiled/Query.js +107 -0
- package/transpiled/Query.js.map +1 -0
- package/transpiled/RTD/Context.d.ts +11 -0
- package/transpiled/RTD/Context.js +3 -0
- package/transpiled/RTD/Context.js.map +1 -0
- package/transpiled/RTD/Directives.d.ts +7 -0
- package/transpiled/RTD/Directives.js +3 -0
- package/transpiled/RTD/Directives.js.map +1 -0
- package/transpiled/RTD/Endpoint.d.ts +9 -0
- package/transpiled/RTD/Endpoint.js +3 -0
- package/transpiled/RTD/Endpoint.js.map +1 -0
- package/transpiled/RTD/Match.d.ts +11 -0
- package/transpiled/RTD/Match.js +3 -0
- package/transpiled/RTD/Match.js.map +1 -0
- package/transpiled/RTD/Method.d.ts +9 -0
- package/transpiled/RTD/Method.js +16 -0
- package/transpiled/RTD/Method.js.map +1 -0
- package/transpiled/RTD/Node.d.ts +21 -0
- package/transpiled/RTD/Node.js +61 -0
- package/transpiled/RTD/Node.js.map +1 -0
- package/transpiled/RTD/Route.d.ts +14 -0
- package/transpiled/RTD/Route.js +49 -0
- package/transpiled/RTD/Route.js.map +1 -0
- package/transpiled/RTD/Tree.d.ts +14 -0
- package/transpiled/RTD/Tree.js +40 -0
- package/transpiled/RTD/Tree.js.map +1 -0
- package/transpiled/RTD/factory.d.ts +6 -0
- package/transpiled/RTD/factory.js +36 -0
- package/transpiled/RTD/factory.js.map +1 -0
- package/transpiled/RTD/index.d.ts +8 -0
- package/transpiled/RTD/index.js +38 -0
- package/transpiled/RTD/index.js.map +1 -0
- package/transpiled/RTD/segment.d.ts +8 -0
- package/transpiled/RTD/segment.js +25 -0
- package/transpiled/RTD/segment.js.map +1 -0
- package/transpiled/RTD/syntax/index.d.ts +2 -0
- package/transpiled/RTD/syntax/index.js +19 -0
- package/transpiled/RTD/syntax/index.js.map +1 -0
- package/transpiled/RTD/syntax/parse.d.ts +4 -0
- package/transpiled/RTD/syntax/parse.js +128 -0
- package/transpiled/RTD/syntax/parse.js.map +1 -0
- package/transpiled/RTD/syntax/types.d.ts +41 -0
- package/transpiled/RTD/syntax/types.js +5 -0
- package/transpiled/RTD/syntax/types.js.map +1 -0
- package/transpiled/Remotes.d.ts +9 -0
- package/transpiled/Remotes.js +25 -0
- package/transpiled/Remotes.js.map +1 -0
- package/transpiled/Tenant.d.ts +13 -0
- package/transpiled/Tenant.js +34 -0
- package/transpiled/Tenant.js.map +1 -0
- package/transpiled/deployment.d.ts +3 -0
- package/transpiled/deployment.js +67 -0
- package/transpiled/deployment.js.map +1 -0
- package/transpiled/directives/auth/Anonymous.d.ts +6 -0
- package/transpiled/directives/auth/Anonymous.js +17 -0
- package/transpiled/directives/auth/Anonymous.js.map +1 -0
- package/transpiled/directives/auth/Echo.d.ts +6 -0
- package/transpiled/directives/auth/Echo.js +13 -0
- package/transpiled/directives/auth/Echo.js.map +1 -0
- package/transpiled/directives/auth/Family.d.ts +20 -0
- package/transpiled/directives/auth/Family.js +118 -0
- package/transpiled/directives/auth/Family.js.map +1 -0
- package/transpiled/directives/auth/Id.d.ts +7 -0
- package/transpiled/directives/auth/Id.js +17 -0
- package/transpiled/directives/auth/Id.js.map +1 -0
- package/transpiled/directives/auth/Incept.d.ts +10 -0
- package/transpiled/directives/auth/Incept.js +58 -0
- package/transpiled/directives/auth/Incept.js.map +1 -0
- package/transpiled/directives/auth/Role.d.ts +11 -0
- package/transpiled/directives/auth/Role.js +44 -0
- package/transpiled/directives/auth/Role.js.map +1 -0
- package/transpiled/directives/auth/Rule.d.ts +9 -0
- package/transpiled/directives/auth/Rule.js +22 -0
- package/transpiled/directives/auth/Rule.js.map +1 -0
- package/transpiled/directives/auth/Scheme.d.ts +7 -0
- package/transpiled/directives/auth/Scheme.js +47 -0
- package/transpiled/directives/auth/Scheme.js.map +1 -0
- package/transpiled/directives/auth/index.d.ts +2 -0
- package/transpiled/directives/auth/index.js +7 -0
- package/transpiled/directives/auth/index.js.map +1 -0
- package/transpiled/directives/auth/schemes.d.ts +3 -0
- package/transpiled/directives/auth/schemes.js +9 -0
- package/transpiled/directives/auth/schemes.js.map +1 -0
- package/transpiled/directives/auth/split.d.ts +2 -0
- package/transpiled/directives/auth/split.js +38 -0
- package/transpiled/directives/auth/split.js.map +1 -0
- package/transpiled/directives/auth/types.d.ts +31 -0
- package/transpiled/directives/auth/types.js +3 -0
- package/transpiled/directives/auth/types.js.map +1 -0
- package/transpiled/directives/cache/Control.d.ts +9 -0
- package/transpiled/directives/cache/Control.js +42 -0
- package/transpiled/directives/cache/Control.js.map +1 -0
- package/transpiled/directives/cache/Exact.d.ts +4 -0
- package/transpiled/directives/cache/Exact.js +11 -0
- package/transpiled/directives/cache/Exact.js.map +1 -0
- package/transpiled/directives/cache/Family.d.ts +12 -0
- package/transpiled/directives/cache/Family.js +26 -0
- package/transpiled/directives/cache/Family.js.map +1 -0
- package/transpiled/directives/cache/index.d.ts +2 -0
- package/transpiled/directives/cache/index.js +7 -0
- package/transpiled/directives/cache/index.js.map +1 -0
- package/transpiled/directives/cache/types.d.ts +7 -0
- package/transpiled/directives/cache/types.js +3 -0
- package/transpiled/directives/cache/types.js.map +1 -0
- package/transpiled/directives/dev/Family.d.ts +10 -0
- package/transpiled/directives/dev/Family.js +27 -0
- package/transpiled/directives/dev/Family.js.map +1 -0
- package/transpiled/directives/dev/Stub.d.ts +7 -0
- package/transpiled/directives/dev/Stub.js +14 -0
- package/transpiled/directives/dev/Stub.js.map +1 -0
- package/transpiled/directives/dev/Throw.d.ts +7 -0
- package/transpiled/directives/dev/Throw.js +14 -0
- package/transpiled/directives/dev/Throw.js.map +1 -0
- package/transpiled/directives/dev/index.d.ts +2 -0
- package/transpiled/directives/dev/index.js +7 -0
- package/transpiled/directives/dev/index.js.map +1 -0
- package/transpiled/directives/dev/types.d.ts +4 -0
- package/transpiled/directives/dev/types.js +3 -0
- package/transpiled/directives/dev/types.js.map +1 -0
- package/transpiled/directives/index.d.ts +2 -0
- package/transpiled/directives/index.js +12 -0
- package/transpiled/directives/index.js.map +1 -0
- package/transpiled/directives/octets/Context.d.ts +8 -0
- package/transpiled/directives/octets/Context.js +40 -0
- package/transpiled/directives/octets/Context.js.map +1 -0
- package/transpiled/directives/octets/Delete.d.ts +10 -0
- package/transpiled/directives/octets/Delete.js +47 -0
- package/transpiled/directives/octets/Delete.js.map +1 -0
- package/transpiled/directives/octets/Family.d.ts +12 -0
- package/transpiled/directives/octets/Family.js +49 -0
- package/transpiled/directives/octets/Family.js.map +1 -0
- package/transpiled/directives/octets/Fetch.d.ts +18 -0
- package/transpiled/directives/octets/Fetch.js +77 -0
- package/transpiled/directives/octets/Fetch.js.map +1 -0
- package/transpiled/directives/octets/List.d.ts +10 -0
- package/transpiled/directives/octets/List.js +47 -0
- package/transpiled/directives/octets/List.js.map +1 -0
- package/transpiled/directives/octets/Permute.d.ts +10 -0
- package/transpiled/directives/octets/Permute.js +51 -0
- package/transpiled/directives/octets/Permute.js.map +1 -0
- package/transpiled/directives/octets/Store.d.ts +33 -0
- package/transpiled/directives/octets/Store.js +124 -0
- package/transpiled/directives/octets/Store.js.map +1 -0
- package/transpiled/directives/octets/index.d.ts +2 -0
- package/transpiled/directives/octets/index.js +7 -0
- package/transpiled/directives/octets/index.js.map +1 -0
- package/transpiled/directives/octets/schemas.d.ts +6 -0
- package/transpiled/directives/octets/schemas.js +17 -0
- package/transpiled/directives/octets/schemas.js.map +1 -0
- package/transpiled/directives/octets/types.d.ts +9 -0
- package/transpiled/directives/octets/types.js +3 -0
- package/transpiled/directives/octets/types.js.map +1 -0
- package/transpiled/discovery.d.ts +1 -0
- package/transpiled/discovery.js +3 -0
- package/transpiled/discovery.js.map +1 -0
- package/transpiled/exceptions.d.ts +2 -0
- package/transpiled/exceptions.js +39 -0
- package/transpiled/exceptions.js.map +1 -0
- package/transpiled/index.d.ts +5 -0
- package/transpiled/index.js +12 -0
- package/transpiled/index.js.map +1 -0
- package/transpiled/manifest.d.ts +3 -0
- package/transpiled/manifest.js +61 -0
- package/transpiled/manifest.js.map +1 -0
- package/transpiled/root.d.ts +2 -0
- package/transpiled/root.js +39 -0
- package/transpiled/root.js.map +1 -0
- package/transpiled/schemas.d.ts +3 -0
- package/transpiled/schemas.js +14 -0
- package/transpiled/schemas.js.map +1 -0
- package/transpiled/tsconfig.tsbuildinfo +1 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Family.js","sourceRoot":"","sources":["../../../source/directives/cache/Family.ts"],"names":[],"mappings":";AACA,uCAAmC;AAEnC,mCAA+B;AAG/B,MAAM,KAAK;IACO,IAAI,GAAW,OAAO,CAAA;IACtB,SAAS,GAAY,KAAK,CAAA;IAEnC,MAAM,CAAE,IAAY,EAAE,KAAU;QACrC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;QAEhC,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,6BAA6B,IAAI,CAAC,IAAI,WAAW,CAAC,CAAA;QAEtF,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAEM,SAAS;QACd,OAAO,IAAI,CAAA;IACb,CAAC;IAEM,KAAK,CAAC,MAAM,CAClB,UAAuB,EAAE,OAAc,EAAE,QAA8B;QACtE,QAAQ,CAAC,OAAO,KAAK,IAAI,OAAO,EAAE,CAAA;QAClC,UAAU,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;CACF;AAED,MAAM,YAAY,GAAkD;IAClE,OAAO,EAAE,iBAAO;IAChB,KAAK,EAAE,aAAK;CACb,CAAA;AAED,iBAAS,IAAI,KAAK,EAAE,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const Family_1 = __importDefault(require("./Family"));
|
|
6
|
+
module.exports = Family_1.default;
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/directives/cache/index.ts"],"names":[],"mappings":";;;;AAAA,sDAA6B;AAE7B,iBAAS,gBAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../source/directives/cache/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Input, type Output, type Family } from '../../Directive';
|
|
2
|
+
import { type Directive } from './types';
|
|
3
|
+
declare class Development implements Family<Directive> {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly mandatory: boolean;
|
|
6
|
+
create(name: string, value: any): Directive;
|
|
7
|
+
preflight(directives: Directive[], input: Input): Output;
|
|
8
|
+
}
|
|
9
|
+
declare const _default: Development;
|
|
10
|
+
export = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const Stub_1 = require("./Stub");
|
|
3
|
+
const Throw_1 = require("./Throw");
|
|
4
|
+
class Development {
|
|
5
|
+
name = 'dev';
|
|
6
|
+
mandatory = false;
|
|
7
|
+
create(name, value) {
|
|
8
|
+
const Class = constructors[name];
|
|
9
|
+
if (Class === undefined)
|
|
10
|
+
throw new Error(`Directive '${name}' is not provided by the '${this.name}' family.`);
|
|
11
|
+
return new Class(value);
|
|
12
|
+
}
|
|
13
|
+
preflight(directives, input) {
|
|
14
|
+
for (const directive of directives) {
|
|
15
|
+
const output = directive.apply(input);
|
|
16
|
+
if (output !== null)
|
|
17
|
+
return output;
|
|
18
|
+
}
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const constructors = {
|
|
23
|
+
stub: Stub_1.Stub,
|
|
24
|
+
throw: Throw_1.Throw
|
|
25
|
+
};
|
|
26
|
+
module.exports = new Development();
|
|
27
|
+
//# sourceMappingURL=Family.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Family.js","sourceRoot":"","sources":["../../../source/directives/dev/Family.ts"],"names":[],"mappings":";AACA,iCAA6B;AAC7B,mCAA+B;AAG/B,MAAM,WAAW;IACC,IAAI,GAAW,KAAK,CAAA;IACpB,SAAS,GAAY,KAAK,CAAA;IAEnC,MAAM,CAAE,IAAY,EAAE,KAAU;QACrC,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,CAAC,CAAA;QAEhC,IAAI,KAAK,KAAK,SAAS;YACrB,MAAM,IAAI,KAAK,CAAC,cAAc,IAAI,6BAA6B,IAAI,CAAC,IAAI,WAAW,CAAC,CAAA;QAEtF,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAEM,SAAS,CAAE,UAAuB,EAAE,KAAY;QACrD,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE;YAClC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAErC,IAAI,MAAM,KAAK,IAAI;gBACjB,OAAO,MAAM,CAAA;SAChB;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAED,MAAM,YAAY,GAAkD;IAClE,IAAI,EAAE,WAAI;IACV,KAAK,EAAE,aAAK;CACb,CAAA;AAED,iBAAS,IAAI,WAAW,EAAE,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Stub = void 0;
|
|
4
|
+
class Stub {
|
|
5
|
+
value;
|
|
6
|
+
constructor(value) {
|
|
7
|
+
this.value = value;
|
|
8
|
+
}
|
|
9
|
+
apply() {
|
|
10
|
+
return { body: this.value };
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Stub = Stub;
|
|
14
|
+
//# sourceMappingURL=Stub.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stub.js","sourceRoot":"","sources":["../../../source/directives/dev/Stub.ts"],"names":[],"mappings":";;;AAGA,MAAa,IAAI;IACE,KAAK,CAAK;IAE3B,YAAoB,KAAU;QAC5B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAEM,KAAK;QACV,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,CAAA;IAC7B,CAAC;CACF;AAVD,oBAUC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Throw = void 0;
|
|
4
|
+
class Throw {
|
|
5
|
+
message;
|
|
6
|
+
constructor(message) {
|
|
7
|
+
this.message = message;
|
|
8
|
+
}
|
|
9
|
+
apply() {
|
|
10
|
+
throw new Error(this.message);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.Throw = Throw;
|
|
14
|
+
//# sourceMappingURL=Throw.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Throw.js","sourceRoot":"","sources":["../../../source/directives/dev/Throw.ts"],"names":[],"mappings":";;;AAGA,MAAa,KAAK;IACC,OAAO,CAAK;IAE7B,YAAoB,OAAY;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAEM,KAAK;QACV,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC/B,CAAC;CACF;AAVD,sBAUC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
const Family_1 = __importDefault(require("./Family"));
|
|
6
|
+
module.exports = Family_1.default;
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/directives/dev/index.ts"],"names":[],"mappings":";;;;AAAA,sDAA6B;AAE7B,iBAAS,gBAAM,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../source/directives/dev/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
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.families = void 0;
|
|
7
|
+
const dev_1 = __importDefault(require("./dev"));
|
|
8
|
+
const auth_1 = __importDefault(require("./auth"));
|
|
9
|
+
const cache_1 = __importDefault(require("./cache"));
|
|
10
|
+
const octets_1 = __importDefault(require("./octets"));
|
|
11
|
+
exports.families = [auth_1.default, octets_1.default, dev_1.default, cache_1.default];
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/directives/index.ts"],"names":[],"mappings":";;;;;;AACA,gDAAuB;AACvB,kDAAyB;AACzB,oDAA2B;AAC3B,sDAA6B;AAEhB,QAAA,QAAQ,GAAa,CAAC,cAAI,EAAE,gBAAM,EAAE,aAAG,EAAE,eAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
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.Context = void 0;
|
|
27
|
+
const schemas = __importStar(require("./schemas"));
|
|
28
|
+
class Context {
|
|
29
|
+
targeted = false;
|
|
30
|
+
storage;
|
|
31
|
+
constructor(value) {
|
|
32
|
+
schemas.context.validate(value);
|
|
33
|
+
this.storage = value;
|
|
34
|
+
}
|
|
35
|
+
apply() {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.Context = Context;
|
|
40
|
+
//# sourceMappingURL=Context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Context.js","sourceRoot":"","sources":["../../../source/directives/octets/Context.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AAIpC,MAAa,OAAO;IACF,QAAQ,GAAG,KAAK,CAAA;IAChB,OAAO,CAAQ;IAE/B,YAAoB,KAAU;QAC5B,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE/B,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACtB,CAAC;IAEM,KAAK;QACV,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAbD,0BAaC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from '@toa.io/core';
|
|
2
|
+
import type { Output } from '../../Directive';
|
|
3
|
+
import type { Directive, Input } from './types';
|
|
4
|
+
export declare class Delete implements Directive {
|
|
5
|
+
readonly targeted = true;
|
|
6
|
+
private readonly discovery;
|
|
7
|
+
private storage;
|
|
8
|
+
constructor(value: null, discovery: Promise<Component>);
|
|
9
|
+
apply(storage: string, request: Input): Promise<Output>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.Delete = void 0;
|
|
27
|
+
const HTTP_1 = require("../../HTTP");
|
|
28
|
+
const schemas = __importStar(require("./schemas"));
|
|
29
|
+
class Delete {
|
|
30
|
+
targeted = true;
|
|
31
|
+
discovery;
|
|
32
|
+
storage = null;
|
|
33
|
+
constructor(value, discovery) {
|
|
34
|
+
schemas.remove.validate(value);
|
|
35
|
+
this.discovery = discovery;
|
|
36
|
+
}
|
|
37
|
+
async apply(storage, request) {
|
|
38
|
+
this.storage ??= await this.discovery;
|
|
39
|
+
const input = { storage, path: request.path };
|
|
40
|
+
const error = await this.storage.invoke('delete', { input });
|
|
41
|
+
if (error instanceof Error)
|
|
42
|
+
throw new HTTP_1.NotFound();
|
|
43
|
+
return {};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.Delete = Delete;
|
|
47
|
+
//# sourceMappingURL=Delete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Delete.js","sourceRoot":"","sources":["../../../source/directives/octets/Delete.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,mDAAoC;AAOpC,MAAa,MAAM;IACD,QAAQ,GAAG,IAAI,CAAA;IAEd,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,KAAW,EAAE,SAA6B;QAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE9B,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,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAA;QAC7C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAiB,QAAQ,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAE5E,IAAI,KAAK,YAAY,KAAK;YACxB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,CAAA;IACX,CAAC;CACF;AAvBD,wBAuBC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Remotes } from '../../Remotes';
|
|
2
|
+
import type { Output, Family } from '../../Directive';
|
|
3
|
+
import type { Directive, Input } from './types';
|
|
4
|
+
declare class Octets implements Family<Directive> {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly mandatory: boolean;
|
|
7
|
+
private discovery;
|
|
8
|
+
create(name: string, value: any, remotes: Remotes): Directive;
|
|
9
|
+
preflight(directives: Directive[], input: Input): Promise<Output>;
|
|
10
|
+
}
|
|
11
|
+
declare const _default: Octets;
|
|
12
|
+
export = _default;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const HTTP_1 = require("../../HTTP");
|
|
3
|
+
const Context_1 = require("./Context");
|
|
4
|
+
const Store_1 = require("./Store");
|
|
5
|
+
const Fetch_1 = require("./Fetch");
|
|
6
|
+
const List_1 = require("./List");
|
|
7
|
+
const Delete_1 = require("./Delete");
|
|
8
|
+
const Permute_1 = require("./Permute");
|
|
9
|
+
class Octets {
|
|
10
|
+
name = 'octets';
|
|
11
|
+
mandatory = false;
|
|
12
|
+
discovery = null;
|
|
13
|
+
create(name, value, remotes) {
|
|
14
|
+
const Class = DIRECTIVES[name];
|
|
15
|
+
if (Class === undefined)
|
|
16
|
+
throw new Error(`Directive '${name}' is not provided by the '${this.name}' family.`);
|
|
17
|
+
this.discovery ??= remotes.discover('octets', 'storage');
|
|
18
|
+
return new Class(value, this.discovery, remotes);
|
|
19
|
+
}
|
|
20
|
+
async preflight(directives, input) {
|
|
21
|
+
let context = null;
|
|
22
|
+
let action = null;
|
|
23
|
+
for (const directive of directives)
|
|
24
|
+
if (directive instanceof Context_1.Context)
|
|
25
|
+
context ??= directive;
|
|
26
|
+
else if (action === null)
|
|
27
|
+
action = directive;
|
|
28
|
+
else
|
|
29
|
+
throw new Error('Octets action is umbiguous.');
|
|
30
|
+
if (action === null)
|
|
31
|
+
return null;
|
|
32
|
+
if (context === null)
|
|
33
|
+
throw new Error('Octets context is not defined.');
|
|
34
|
+
const targeted = input.path[input.path.length - 1] !== '/';
|
|
35
|
+
if (targeted !== action.targeted)
|
|
36
|
+
throw new HTTP_1.NotFound(`Trailing slash is ${action.targeted ? 'redundant' : 'required'}.`);
|
|
37
|
+
return await action.apply(context.storage, input);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
const DIRECTIVES = {
|
|
41
|
+
context: Context_1.Context,
|
|
42
|
+
store: Store_1.Store,
|
|
43
|
+
fetch: Fetch_1.Fetch,
|
|
44
|
+
list: List_1.List,
|
|
45
|
+
delete: Delete_1.Delete,
|
|
46
|
+
permute: Permute_1.Permute
|
|
47
|
+
};
|
|
48
|
+
module.exports = new Octets();
|
|
49
|
+
//# sourceMappingURL=Family.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Family.js","sourceRoot":"","sources":["../../../source/directives/octets/Family.ts"],"names":[],"mappings":";AAAA,qCAAqC;AACrC,uCAAmC;AACnC,mCAA+B;AAC/B,mCAA+B;AAC/B,iCAA6B;AAC7B,qCAAiC;AACjC,uCAAmC;AAMnC,MAAM,MAAM;IACM,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,CAAE,UAAuB,EAAE,KAAY;QAC3D,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,IAAI,OAAO,KAAK,IAAI;YAClB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAA;QAEnD,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG,CAAA;QAE1D,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,OAAO,MAAM,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;IACnD,CAAC;CACF;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;CACjB,CAAA;AAID,iBAAS,IAAI,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Component } from '@toa.io/core';
|
|
2
|
+
import type { Output } from '../../Directive';
|
|
3
|
+
import type { Directive, Input } from './types';
|
|
4
|
+
export declare class Fetch implements Directive {
|
|
5
|
+
readonly targeted = true;
|
|
6
|
+
private readonly permissions;
|
|
7
|
+
private readonly discovery;
|
|
8
|
+
private storage;
|
|
9
|
+
constructor(permissions: Partial<Permissions> | null, discovery: Promise<Component>);
|
|
10
|
+
apply(storage: string, request: Input): Promise<Output>;
|
|
11
|
+
private fetch;
|
|
12
|
+
private get;
|
|
13
|
+
}
|
|
14
|
+
interface Permissions {
|
|
15
|
+
blob: boolean;
|
|
16
|
+
meta: boolean;
|
|
17
|
+
}
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
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.Fetch = void 0;
|
|
27
|
+
const node_path_1 = require("node:path");
|
|
28
|
+
const HTTP_1 = require("../../HTTP");
|
|
29
|
+
const schemas = __importStar(require("./schemas"));
|
|
30
|
+
class Fetch {
|
|
31
|
+
targeted = true;
|
|
32
|
+
permissions = { blob: true, meta: false };
|
|
33
|
+
discovery;
|
|
34
|
+
storage = null;
|
|
35
|
+
constructor(permissions, discovery) {
|
|
36
|
+
schemas.fetch.validate(permissions);
|
|
37
|
+
Object.assign(this.permissions, permissions);
|
|
38
|
+
this.discovery = discovery;
|
|
39
|
+
}
|
|
40
|
+
async apply(storage, request) {
|
|
41
|
+
this.storage ??= await this.discovery;
|
|
42
|
+
if (request.url.slice(-5) === ':meta')
|
|
43
|
+
return await this.get(storage, request);
|
|
44
|
+
else
|
|
45
|
+
return await this.fetch(storage, request);
|
|
46
|
+
}
|
|
47
|
+
async fetch(storage, request) {
|
|
48
|
+
const filename = node_path_1.posix.basename(request.url);
|
|
49
|
+
const variant = filename.includes('.');
|
|
50
|
+
if (!variant && !this.permissions.blob)
|
|
51
|
+
throw new HTTP_1.Forbidden('BLOB variant must be specified.');
|
|
52
|
+
if ('if-none-match' in request.headers)
|
|
53
|
+
return { status: 304 };
|
|
54
|
+
const input = { storage, path: request.url };
|
|
55
|
+
const result = await this.storage.invoke('fetch', { input });
|
|
56
|
+
if (result instanceof Error)
|
|
57
|
+
throw new HTTP_1.NotFound();
|
|
58
|
+
const headers = new Headers({
|
|
59
|
+
'content-type': result.type,
|
|
60
|
+
'content-length': result.size.toString(),
|
|
61
|
+
etag: result.checksum
|
|
62
|
+
});
|
|
63
|
+
return { headers, body: result.stream };
|
|
64
|
+
}
|
|
65
|
+
async get(storage, request) {
|
|
66
|
+
if (!this.permissions.meta)
|
|
67
|
+
throw new HTTP_1.Forbidden('Metadata is not accessible.');
|
|
68
|
+
const path = request.url.slice(0, -5);
|
|
69
|
+
const input = { storage, path };
|
|
70
|
+
const entry = await this.storage.invoke('get', { input });
|
|
71
|
+
if (entry instanceof Error)
|
|
72
|
+
throw new HTTP_1.NotFound();
|
|
73
|
+
return { body: entry };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
exports.Fetch = Fetch;
|
|
77
|
+
//# sourceMappingURL=Fetch.js.map
|
|
@@ -0,0 +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,GAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACtD,SAAS,CAAoB;IACtC,OAAO,GAAc,IAA4B,CAAA;IAEzD,YAAoB,WAAwC,EAAE,SAA6B;QACzF,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,IAAI,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,OAAO;YACnC,OAAO,MAAM,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;;YAEvC,OAAO,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;IAEO,KAAK,CAAC,KAAK,CAAE,OAAe,EAAE,OAAc;QAClD,MAAM,QAAQ,GAAG,iBAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;QAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;QAEtC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI;YACpC,MAAM,IAAI,gBAAS,CAAC,iCAAiC,CAAC,CAAA;QAExD,IAAI,eAAe,IAAI,OAAO,CAAC,OAAO;YACpC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAA;QAExB,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,EAAE,CAAA;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAqB,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAEhF,IAAI,MAAM,YAAY,KAAK;YACzB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,MAAM,OAAO,GAAG,IAAI,OAAO,CAAC;YAC1B,cAAc,EAAE,MAAM,CAAC,IAAI;YAC3B,gBAAgB,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE;YACxC,IAAI,EAAE,MAAM,CAAC,QAAQ;SACtB,CAAC,CAAA;QAEF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAA;IACzC,CAAC;IAEO,KAAK,CAAC,GAAG,CAAE,OAAe,EAAE,OAAc;QAChD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI;YACxB,MAAM,IAAI,gBAAS,CAAC,6BAA6B,CAAC,CAAA;QAEpD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QACrC,MAAM,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,CAAA;QAC/B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAe,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAEvE,IAAI,KAAK,YAAY,KAAK;YACxB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAA;IACxB,CAAC;CACF;AA7DD,sBA6DC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from '@toa.io/core';
|
|
2
|
+
import type { Output } from '../../Directive';
|
|
3
|
+
import type { Directive, Input } from './types';
|
|
4
|
+
export declare class List implements Directive {
|
|
5
|
+
readonly targeted = false;
|
|
6
|
+
private readonly discovery;
|
|
7
|
+
private storage;
|
|
8
|
+
constructor(value: null, discovery: Promise<Component>);
|
|
9
|
+
apply(storage: string, request: Input): Promise<Output>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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.List = void 0;
|
|
27
|
+
const HTTP_1 = require("../../HTTP");
|
|
28
|
+
const schemas = __importStar(require("./schemas"));
|
|
29
|
+
class List {
|
|
30
|
+
targeted = false;
|
|
31
|
+
discovery;
|
|
32
|
+
storage = null;
|
|
33
|
+
constructor(value, discovery) {
|
|
34
|
+
schemas.remove.validate(value);
|
|
35
|
+
this.discovery = discovery;
|
|
36
|
+
}
|
|
37
|
+
async apply(storage, request) {
|
|
38
|
+
this.storage ??= await this.discovery;
|
|
39
|
+
const input = { storage, path: request.path };
|
|
40
|
+
const list = await this.storage.invoke('list', { input });
|
|
41
|
+
if (list instanceof Error)
|
|
42
|
+
throw new HTTP_1.NotFound();
|
|
43
|
+
return { body: list };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.List = List;
|
|
47
|
+
//# sourceMappingURL=List.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"List.js","sourceRoot":"","sources":["../../../source/directives/octets/List.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAqC;AACrC,mDAAoC;AAOpC,MAAa,IAAI;IACC,QAAQ,GAAG,KAAK,CAAA;IAEf,SAAS,CAAoB;IACtC,OAAO,GAAqB,IAAI,CAAA;IAExC,YAAoB,KAAW,EAAE,SAA6B;QAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE9B,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,KAAK,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAA;QAC7C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,MAAM,CAAiB,MAAM,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;QAEzE,IAAI,IAAI,YAAY,KAAK;YACvB,MAAM,IAAI,eAAQ,EAAE,CAAA;QAEtB,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAA;IACvB,CAAC;CACF;AAvBD,oBAuBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Component } from '@toa.io/core';
|
|
2
|
+
import type { Output } from '../../Directive';
|
|
3
|
+
import type { Directive, Input } from './types';
|
|
4
|
+
export declare class Permute implements Directive {
|
|
5
|
+
readonly targeted = false;
|
|
6
|
+
private readonly discovery;
|
|
7
|
+
private storage;
|
|
8
|
+
constructor(value: null, discovery: Promise<Component>);
|
|
9
|
+
apply(storage: string, request: Input): Promise<Output>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
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.Permute = void 0;
|
|
27
|
+
const HTTP_1 = require("../../HTTP");
|
|
28
|
+
const schemas = __importStar(require("./schemas"));
|
|
29
|
+
class Permute {
|
|
30
|
+
targeted = false;
|
|
31
|
+
discovery;
|
|
32
|
+
storage = null;
|
|
33
|
+
constructor(value, discovery) {
|
|
34
|
+
schemas.remove.validate(value);
|
|
35
|
+
this.discovery = discovery;
|
|
36
|
+
}
|
|
37
|
+
async apply(storage, request) {
|
|
38
|
+
this.storage ??= await this.discovery;
|
|
39
|
+
if (request.encoder === null)
|
|
40
|
+
throw new HTTP_1.NotAcceptable();
|
|
41
|
+
const path = request.path;
|
|
42
|
+
const list = await request.parse();
|
|
43
|
+
const input = { storage, path, list };
|
|
44
|
+
const error = await this.storage.invoke('permute', { input });
|
|
45
|
+
if (error instanceof Error)
|
|
46
|
+
throw new HTTP_1.NotFound();
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.Permute = Permute;
|
|
51
|
+
//# sourceMappingURL=Permute.js.map
|
|
@@ -0,0 +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,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;QAE9B,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,IAAI,CAAA;QACzB,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"}
|