@toa.io/definitions 1.0.0-alpha.292 → 1.0.0-alpha.293
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/digest/extensions.exposition.json +1 -1
- package/package.json +24 -7
- package/readme.md +1 -0
- package/transpiled/bridges.node/exports.js +25 -2
- package/transpiled/bridges.node/exports.js.map +1 -1
- package/transpiled/digest/generate.js +23 -3
- package/transpiled/digest/generate.js.map +1 -1
- package/transpiled/digest/read.d.ts +8 -0
- package/transpiled/digest/read.js +11 -0
- package/transpiled/digest/read.js.map +1 -1
- package/transpiled/extensions.exposition/index.d.ts +1 -0
- package/transpiled/extensions.exposition/index.js +1 -0
- package/transpiled/extensions.exposition/index.js.map +1 -1
- package/transpiled/extensions.exposition/packages.d.ts +11 -0
- package/transpiled/extensions.exposition/packages.js +17 -0
- package/transpiled/extensions.exposition/packages.js.map +1 -0
- package/transpiled/extensions.storages/index.d.ts +1 -0
- package/transpiled/extensions.storages/index.js +1 -0
- package/transpiled/extensions.storages/index.js.map +1 -1
- package/transpiled/extensions.storages/packages.d.ts +19 -0
- package/transpiled/extensions.storages/packages.js +41 -0
- package/transpiled/extensions.storages/packages.js.map +1 -0
- package/CHANGELOG.md +0 -13
- package/source/bindings.amqp/annotation.ts +0 -26
- package/source/bindings.amqp/context.ts +0 -68
- package/source/bindings.amqp/deployment.ts +0 -14
- package/source/bindings.amqp/index.ts +0 -9
- package/source/bindings.amqp/instance.ts +0 -3
- package/source/bindings.amqp/sources.ts +0 -39
- package/source/bindings.loop/index.ts +0 -3
- package/source/bridges.bash/const.ts +0 -2
- package/source/bridges.bash/define.ts +0 -38
- package/source/bridges.bash/index.ts +0 -2
- package/source/bridges.node/define.ts +0 -69
- package/source/bridges.node/exports.ts +0 -175
- package/source/bridges.node/index.ts +0 -6
- package/source/bridges.node/operations.ts +0 -127
- package/source/bridges.node/sources.ts +0 -44
- package/source/definition.ts +0 -38
- package/source/digest/generate.ts +0 -77
- package/source/digest/read.ts +0 -39
- package/source/extensions.cadence/components.ts +0 -6
- package/source/extensions.cadence/const.ts +0 -31
- package/source/extensions.cadence/context.ts +0 -10
- package/source/extensions.cadence/deployment.ts +0 -37
- package/source/extensions.cadence/index.ts +0 -8
- package/source/extensions.cadence/manifest.ts +0 -64
- package/source/extensions.cadence/schemas.ts +0 -10
- package/source/extensions.cadence/types.ts +0 -41
- package/source/extensions.configuration/components.ts +0 -6
- package/source/extensions.configuration/const.ts +0 -30
- package/source/extensions.configuration/context.ts +0 -13
- package/source/extensions.configuration/deployment.ts +0 -159
- package/source/extensions.configuration/epoch.ts +0 -22
- package/source/extensions.configuration/index.ts +0 -10
- package/source/extensions.configuration/manifest.ts +0 -12
- package/source/extensions.configuration/schemas.ts +0 -9
- package/source/extensions.exposition/Annotation.ts +0 -91
- package/source/extensions.exposition/components.ts +0 -6
- package/source/extensions.exposition/const.ts +0 -45
- package/source/extensions.exposition/deployment.ts +0 -95
- package/source/extensions.exposition/index.ts +0 -16
- package/source/extensions.exposition/manifest.ts +0 -56
- package/source/extensions.exposition/schemas.ts +0 -16
- package/source/extensions.exposition/shortcuts.ts +0 -14
- package/source/extensions.exposition/syntax/index.ts +0 -2
- package/source/extensions.exposition/syntax/parse.ts +0 -171
- package/source/extensions.exposition/syntax/types.ts +0 -69
- package/source/extensions.fetch/context.ts +0 -10
- package/source/extensions.fetch/index.ts +0 -1
- package/source/extensions.introspection/annotation.ts +0 -87
- package/source/extensions.introspection/components.ts +0 -13
- package/source/extensions.introspection/const.ts +0 -46
- package/source/extensions.introspection/deployment.ts +0 -48
- package/source/extensions.introspection/index.ts +0 -6
- package/source/extensions.introspection/manifest.ts +0 -18
- package/source/extensions.introspection/schemas.ts +0 -12
- package/source/extensions.realtime/components.ts +0 -5
- package/source/extensions.realtime/deployment.ts +0 -89
- package/source/extensions.realtime/index.ts +0 -4
- package/source/extensions.stash/context.ts +0 -10
- package/source/extensions.stash/deployment.ts +0 -22
- package/source/extensions.stash/index.ts +0 -2
- package/source/extensions.state/context.ts +0 -9
- package/source/extensions.state/index.ts +0 -1
- package/source/extensions.storages/Annotation.ts +0 -57
- package/source/extensions.storages/context.ts +0 -14
- package/source/extensions.storages/deployment.ts +0 -91
- package/source/extensions.storages/index.ts +0 -9
- package/source/extensions.storages/manifest.ts +0 -7
- package/source/extensions.storages/schemas.ts +0 -15
- package/source/extensions.storages/secrets.ts +0 -22
- package/source/extensions.telemetry/const.ts +0 -6
- package/source/extensions.telemetry/context.ts +0 -11
- package/source/extensions.telemetry/deployment.ts +0 -91
- package/source/extensions.telemetry/index.ts +0 -5
- package/source/extensions.telemetry/ready.ts +0 -33
- package/source/index.ts +0 -2
- package/source/storages.mongodb/deployment.ts +0 -22
- package/source/storages.mongodb/index.ts +0 -1
- package/source/version.ts +0 -10
- package/transpiled/bindings.amqp/annotation.test.d.ts +0 -1
- package/transpiled/bindings.amqp/annotation.test.js +0 -36
- package/transpiled/bindings.amqp/annotation.test.js.map +0 -1
- package/transpiled/bindings.amqp/properties.test.d.ts +0 -1
- package/transpiled/bindings.amqp/properties.test.js +0 -7
- package/transpiled/bindings.amqp/properties.test.js.map +0 -1
- package/transpiled/bindings.loop/properties.test.d.ts +0 -1
- package/transpiled/bindings.loop/properties.test.js +0 -7
- package/transpiled/bindings.loop/properties.test.js.map +0 -1
- package/transpiled/bridges.node/exports.test.d.ts +0 -1
- package/transpiled/bridges.node/exports.test.js +0 -88
- package/transpiled/bridges.node/exports.test.js.map +0 -1
- package/transpiled/bridges.node/operations.test.d.ts +0 -1
- package/transpiled/bridges.node/operations.test.js +0 -108
- package/transpiled/bridges.node/operations.test.js.map +0 -1
- package/transpiled/extensions.cadence/manifest.test.d.ts +0 -1
- package/transpiled/extensions.cadence/manifest.test.js +0 -41
- package/transpiled/extensions.cadence/manifest.test.js.map +0 -1
- package/transpiled/extensions.configuration/deployment.test.d.ts +0 -1
- package/transpiled/extensions.configuration/deployment.test.js +0 -74
- package/transpiled/extensions.configuration/deployment.test.js.map +0 -1
- package/transpiled/extensions.configuration/manifest.test.d.ts +0 -1
- package/transpiled/extensions.configuration/manifest.test.js +0 -14
- package/transpiled/extensions.configuration/manifest.test.js.map +0 -1
- package/transpiled/extensions.exposition/manifest.test.d.ts +0 -1
- package/transpiled/extensions.exposition/manifest.test.js +0 -38
- package/transpiled/extensions.exposition/manifest.test.js.map +0 -1
- package/transpiled/extensions.exposition/schemas.test.d.ts +0 -1
- package/transpiled/extensions.exposition/schemas.test.js +0 -22
- package/transpiled/extensions.exposition/schemas.test.js.map +0 -1
- package/transpiled/extensions.exposition/syntax/parse.test.d.ts +0 -1
- package/transpiled/extensions.exposition/syntax/parse.test.js +0 -156
- package/transpiled/extensions.exposition/syntax/parse.test.js.map +0 -1
- package/transpiled/extensions.storages/schemas.test.d.ts +0 -1
- package/transpiled/extensions.storages/schemas.test.js +0 -59
- package/transpiled/extensions.storages/schemas.test.js.map +0 -1
- package/tsconfig.json +0 -10
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { exports } from './exports.js';
|
|
4
|
-
import { algorithm } from './operations.js';
|
|
5
|
-
const define = (text) => algorithm(exports('module.js', text), 'module.js');
|
|
6
|
-
it('returns null where no function is exported', () => {
|
|
7
|
-
assert.equal(define('export const foo = "bar"'), null);
|
|
8
|
-
});
|
|
9
|
-
it('refuses a function that does not match conventions', () => {
|
|
10
|
-
assert.throws(() => define('export const append = () => null'), /does not match conventions/);
|
|
11
|
-
});
|
|
12
|
-
it('refuses a class that does not match conventions', () => {
|
|
13
|
-
assert.throws(() => define('export class Foo {}'), /does not match conventions/);
|
|
14
|
-
});
|
|
15
|
-
it('refuses two algorithms', () => {
|
|
16
|
-
assert.throws(() => define('export function transition() {}\nexport function observation() {}'), /exports 'transition', 'observation'/);
|
|
17
|
-
});
|
|
18
|
-
describe('function', () => {
|
|
19
|
-
const cases = [
|
|
20
|
-
['function transition(input, object) {}', { type: 'transition', scope: 'object' }],
|
|
21
|
-
['function observation(input, object) {}', { type: 'observation', scope: 'object' }],
|
|
22
|
-
['function assignment(input, changeset) {}', { type: 'assignment', scope: 'changeset' }],
|
|
23
|
-
['function computation(input, context) {}', { type: 'computation', scope: 'none' }],
|
|
24
|
-
['function effect(input, context) {}', { type: 'effect', scope: 'none' }],
|
|
25
|
-
['const observation = (input, objects) => null', { type: 'observation', scope: 'objects' }],
|
|
26
|
-
['const effect = (_, stream) => stream', { type: 'effect', scope: 'stream' }]
|
|
27
|
-
];
|
|
28
|
-
for (const [source, expected] of cases)
|
|
29
|
-
it(`defines '${source}'`, () => {
|
|
30
|
-
assert.deepStrictEqual(define('export ' + source), expected);
|
|
31
|
-
});
|
|
32
|
-
it('does not define an unknown scope', () => {
|
|
33
|
-
assert.equal(define('export const assignment = (input, message) => null')?.scope, undefined);
|
|
34
|
-
});
|
|
35
|
-
it('defines null input', () => {
|
|
36
|
-
assert.deepStrictEqual(define('export const observation = () => null'), {
|
|
37
|
-
type: 'observation',
|
|
38
|
-
scope: 'none',
|
|
39
|
-
input: null
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
it('defines a default export by its declared name', () => {
|
|
43
|
-
assert.deepStrictEqual(define('export default function transition(input, object) {}'), {
|
|
44
|
-
type: 'transition',
|
|
45
|
-
scope: 'object'
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
it('defines an alias by the exported name', () => {
|
|
49
|
-
assert.deepStrictEqual(define('const meter = (input) => 1\nexport { meter as computation }'), {
|
|
50
|
-
type: 'computation',
|
|
51
|
-
scope: 'none'
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
it('leaves the scope of a computed export to the manifest', () => {
|
|
55
|
-
assert.deepStrictEqual(define('export const transition = wrap(fn)'), { type: 'transition' });
|
|
56
|
-
});
|
|
57
|
-
it('ignores an export that is neither a function nor named as an algorithm', () => {
|
|
58
|
-
assert.deepStrictEqual(define('export const NAME = "x"\nexport function effect() {}'), {
|
|
59
|
-
type: 'effect',
|
|
60
|
-
scope: 'none',
|
|
61
|
-
input: null
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
65
|
-
describe('class', () => {
|
|
66
|
-
it('defines type and scope by the execute method', () => {
|
|
67
|
-
assert.deepStrictEqual(define('export class Transition { execute(input, object) {} }'), {
|
|
68
|
-
type: 'transition',
|
|
69
|
-
scope: 'object'
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
it('finds execute among other methods', () => {
|
|
73
|
-
assert.deepStrictEqual(define('export class Assignment { execute(input, object) {}\n run(input, objects) {} }'), { type: 'assignment', scope: 'object' });
|
|
74
|
-
});
|
|
75
|
-
it('refuses a class without execute', () => {
|
|
76
|
-
assert.throws(() => define('export class Observation {}'), /Method 'execute' not found/);
|
|
77
|
-
});
|
|
78
|
-
it('refuses a function named as a class', () => {
|
|
79
|
-
assert.throws(() => define('export function Transition() {}'), /does not match conventions/);
|
|
80
|
-
});
|
|
81
|
-
it('defines none scope and null input', () => {
|
|
82
|
-
assert.deepStrictEqual(define('export class Observation { execute() {} }'), {
|
|
83
|
-
type: 'observation',
|
|
84
|
-
scope: 'none',
|
|
85
|
-
input: null
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
it('defines Computation and Effect', () => {
|
|
89
|
-
assert.equal(define('export class Computation { execute() {} }')?.type, 'computation');
|
|
90
|
-
assert.equal(define('export class Effect { execute() {} }')?.type, 'effect');
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
describe('factory', () => {
|
|
94
|
-
it('defines type and scope by the name', () => {
|
|
95
|
-
assert.deepStrictEqual(define('export class ObjectTransitionFactory { create() {} }'), {
|
|
96
|
-
type: 'transition',
|
|
97
|
-
scope: 'object'
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
it('refuses a scope outside the convention', () => {
|
|
101
|
-
assert.throws(() => define('export class NoneObservationFactory { create() {} }'), /does not match conventions/);
|
|
102
|
-
});
|
|
103
|
-
it('defines ComputationFactory and EffectFactory', () => {
|
|
104
|
-
assert.deepStrictEqual(define('export class ComputationFactory {}'), { type: 'computation' });
|
|
105
|
-
assert.deepStrictEqual(define('export class EffectFactory {}'), { type: 'effect' });
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
//# sourceMappingURL=operations.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations.test.js","sourceRoot":"","sources":["../../source/bridges.node/operations.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,MAAM,GAAG,CAAC,IAAY,EAAgC,EAAE,CAC5D,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,EAAE,WAAW,CAAC,CAAA;AAEpD,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;IACpD,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,IAAI,CAAC,CAAA;AACxD,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,oDAAoD,EAAE,GAAG,EAAE;IAC5D,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,kCAAkC,CAAC,EAAE,4BAA4B,CAAC,CAAA;AAC/F,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;IACzD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,qBAAqB,CAAC,EAAE,4BAA4B,CAAC,CAAA;AAClF,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,wBAAwB,EAAE,GAAG,EAAE;IAChC,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,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Q;SAChB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wCAAwC,EAAE,GAAG,EAAE;QAChD,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,MAAM,CAAC,qDAAqD,CAAC,EACnE,4BAA4B,CAC7B,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,8CAA8C,EAAE,GAAG,EAAE;QACtD,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,oCAAoC,CAAC,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;QAC7F,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,+BAA+B,CAAC,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;IACrF,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { manifest } from './manifest.js';
|
|
4
|
-
const component = {
|
|
5
|
-
operations: {
|
|
6
|
-
sweep: { type: 'effect' },
|
|
7
|
-
gather: { type: 'transition' },
|
|
8
|
-
peek: { type: 'observation' }
|
|
9
|
-
}
|
|
10
|
-
};
|
|
11
|
-
it('should normalize a declaration', () => {
|
|
12
|
-
const declaration = manifest({ sweep: { cycle: 86400, intervals: 24 } }, component);
|
|
13
|
-
assert.deepStrictEqual(declaration, { sweep: { cycle: 86400, intervals: 24 } });
|
|
14
|
-
});
|
|
15
|
-
it('should split a cycle into one interval by default', () => {
|
|
16
|
-
const declaration = manifest({ sweep: { cycle: 3600 } }, component);
|
|
17
|
-
assert.deepStrictEqual(declaration, { sweep: { cycle: 3600, intervals: 1 } });
|
|
18
|
-
});
|
|
19
|
-
it('should expand the shorthand', () => {
|
|
20
|
-
const declaration = manifest({ sweep: 3600 }, component);
|
|
21
|
-
assert.deepStrictEqual(declaration, { sweep: { cycle: 3600, intervals: 1 } });
|
|
22
|
-
});
|
|
23
|
-
it('should answer a component that only delays calls', () => {
|
|
24
|
-
assert.deepStrictEqual(manifest(null, component), {});
|
|
25
|
-
});
|
|
26
|
-
it('should refuse an undefined operation', () => {
|
|
27
|
-
assert.throws(() => manifest({ nothing: 3600 }, component), /refers to undefined operation 'nothing'/);
|
|
28
|
-
});
|
|
29
|
-
it('should refuse an operation that produces no side effects', () => {
|
|
30
|
-
assert.throws(() => manifest({ peek: 3600 }, component), /of the allowed types/);
|
|
31
|
-
});
|
|
32
|
-
it('should refuse an interval shorter than a second', () => {
|
|
33
|
-
assert.throws(() => manifest({ sweep: { cycle: 60, intervals: 61 } }, component), /less than a second/);
|
|
34
|
-
});
|
|
35
|
-
it('should refuse a cycle of no time at all', () => {
|
|
36
|
-
assert.throws(() => manifest({ sweep: { cycle: 0, intervals: 1 } }, component));
|
|
37
|
-
});
|
|
38
|
-
it('should refuse what the declaration does not describe', () => {
|
|
39
|
-
assert.throws(() => manifest({ sweep: { cycle: 60, every: 3 } }, component));
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=manifest.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.test.js","sourceRoot":"","sources":["../../source/extensions.cadence/manifest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAGxC,MAAM,SAAS,GAAG;IAChB,UAAU,EAAE;QACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QACzB,MAAM,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;QAC9B,IAAI,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE;KAC9B;CACqB,CAAA;AAExB,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;IACx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AAyC,CAC1C,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;IAClE,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,EAAS,EAAE,SAAS,CAAC,EAAE,sBAAsB,CAAC,CAAA;AACzF,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;IACzD,MAAM,CAAC,MAAM,CACX,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,EAClE,oBAAoB,CACrB,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,yCAAyC,EAAE,GAAG,EAAE;IACjD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC,CAAA;AACjF,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,sDAAsD,EAAE,GAAG,EAAE;IAC9D,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,EAAS,EAAE,SAAS,CAAC,CAAC,CAAA;AACrF,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { Locator } from '@toa.io/core';
|
|
4
|
-
import { deployment, describe as map } from './deployment.js';
|
|
5
|
-
import { epoch } from './epoch.js';
|
|
6
|
-
import { EVENT, VALUES } from './const.js';
|
|
7
|
-
const schema = {
|
|
8
|
-
type: 'object',
|
|
9
|
-
properties: { foo: { type: 'string' }, key: { type: 'string' } }
|
|
10
|
-
};
|
|
11
|
-
function instance(name, defaults) {
|
|
12
|
-
return {
|
|
13
|
-
locator: new Locator(name, 'configuration'),
|
|
14
|
-
manifest: { schema, defaults },
|
|
15
|
-
component: {}
|
|
16
|
-
};
|
|
17
|
-
}
|
|
18
|
-
it('should validate annotation', async () => {
|
|
19
|
-
const wrongType = 'not ok';
|
|
20
|
-
assert.throws(() => deployment([], wrongType), (error) => /object/.test(error.message));
|
|
21
|
-
});
|
|
22
|
-
it('should reject unknown components', async () => {
|
|
23
|
-
assert.throws(() => deployment([instance('base')], { 'configuration.nope': {} }), (error) => /Component 'configuration\.nope' does not request configuration/.test(error.message));
|
|
24
|
-
});
|
|
25
|
-
it('should deploy the values service with the map', async () => {
|
|
26
|
-
const instances = [instance('base', { foo: 'hello' }), instance('other')];
|
|
27
|
-
const annotation = { 'configuration.other': { foo: 'set' } };
|
|
28
|
-
const dependency = deployment(instances, annotation);
|
|
29
|
-
assert.deepStrictEqual(dependency.events, [EVENT]);
|
|
30
|
-
assert.strictEqual(dependency.services?.length, 1);
|
|
31
|
-
const service = dependency.services[0];
|
|
32
|
-
assert.deepStrictEqual(service.group, 'configuration');
|
|
33
|
-
assert.deepStrictEqual(service.name, 'values');
|
|
34
|
-
assert.deepStrictEqual(service.components, ['configuration-values']);
|
|
35
|
-
const variable = service.variables.find((variable) => variable.name === VALUES);
|
|
36
|
-
assert.notStrictEqual(variable, undefined);
|
|
37
|
-
assert.deepStrictEqual(JSON.parse(variable.value), map(instances, annotation));
|
|
38
|
-
});
|
|
39
|
-
it('should describe every component', async () => {
|
|
40
|
-
const instances = [instance('base', { foo: 'hello' }), instance('other')];
|
|
41
|
-
const values = map(instances, { 'configuration.other': { foo: 'set' } });
|
|
42
|
-
assert.deepStrictEqual(values, {
|
|
43
|
-
'configuration.base': { epoch: epoch(schema), schema, defaults: { foo: 'hello' } },
|
|
44
|
-
'configuration.other': { epoch: epoch(schema), schema, defaults: { foo: 'set' } }
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
it('should prefer the context over the manifest defaults', async () => {
|
|
48
|
-
const values = map([instance('base', { foo: 'hello' })], {
|
|
49
|
-
'configuration.base': { foo: 'bye' }
|
|
50
|
-
});
|
|
51
|
-
assert.deepStrictEqual(values['configuration.base'].defaults, { foo: 'bye' });
|
|
52
|
-
});
|
|
53
|
-
it('should not map values to the component', async () => {
|
|
54
|
-
const dependency = deployment([instance('base')], {
|
|
55
|
-
'configuration.base': { foo: 'set' }
|
|
56
|
-
});
|
|
57
|
-
assert.deepStrictEqual(dependency.variables, {});
|
|
58
|
-
});
|
|
59
|
-
it('should map secrets to the component', async () => {
|
|
60
|
-
const dependency = deployment([instance('base')], {
|
|
61
|
-
'configuration.base': { key: '$KEY' }
|
|
62
|
-
});
|
|
63
|
-
assert.deepStrictEqual(dependency.variables, {
|
|
64
|
-
'configuration-base': [
|
|
65
|
-
{
|
|
66
|
-
name: 'TOA_CONFIGURATION__KEY',
|
|
67
|
-
secret: { name: 'toa-configuration', key: 'KEY' }
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
});
|
|
71
|
-
// the service holds the reference, not the secret
|
|
72
|
-
assert.deepStrictEqual(map([instance('base')], { 'configuration.base': { key: '$KEY' } })['configuration.base'].defaults, { key: '$KEY' });
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=deployment.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deployment.test.js","sourceRoot":"","sources":["../../source/extensions.configuration/deployment.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAGL,UAAU,EACV,QAAQ,IAAI,GAA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AU,GAAG,UAAU,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE;QAChD,oBAAoB,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE;KACtC,CAAC,CAAA;IAEF,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,SAAS,EAAE;QAC3C,oBAAoB,EAAE;YACpB;gBACE,IAAI,EAAE,wBAAwB;gBAC9B,MAAM,EAAE,EAAE,IAAI,EAAE,mBAAmB,EAAE,GAAG,EAAE,KAAK,EAAE;aAClD;SACF;KACF,CAAC,CAAA;IAEF,kDAAkD;IAClD,MAAM,CAAC,eAAe,CACpB,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,oBAAoB,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAChE,oBAAoB,CACrB,CAAC,QAAQ,EACV,EAAE,GAAG,EAAE,MAAM,EAAE,CAChB,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { manifest } from './manifest.js';
|
|
4
|
-
it('should validate', async () => {
|
|
5
|
-
const additional = { schema: {}, foo: 'bar' };
|
|
6
|
-
assert.throws(() => {
|
|
7
|
-
manifest(additional);
|
|
8
|
-
}, (error) => /not expected/.test(error.message));
|
|
9
|
-
const wrongType = { schema: 'not ok' };
|
|
10
|
-
assert.throws(() => {
|
|
11
|
-
manifest(wrongType);
|
|
12
|
-
}, (error) => /object/.test(error.message));
|
|
13
|
-
});
|
|
14
|
-
//# sourceMappingURL=manifest.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.test.js","sourceRoot":"","sources":["../../source/extensions.configuration/manifest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAiB,QAAQ,EAAE,MAAM,eAAe,CAAA;AAEvD,EAAE,CAAC,iBAAiB,EAAE,KAAK,IAAI,EAAE;IAC/B,MAAM,UAAU,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,EAAyB,CAAA;IAEpE,MAAM,CAAC,MAAM,CACX,GAAG,EAAE;QACH,QAAQ,CAAC,UAAU,CAAC,CAAA;IACtB,CAAC,EACD,CAAC,KAAU,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CACnD,CAAA;IAED,MAAM,SAAS,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAyB,CAAA;IAE7D,MAAM,CAAC,MAAM,CACX,GAAG,EAAE;QACH,QAAQ,CAAC,SAAS,CAAC,CAAA;IACrB,CAAC,EACD,CAAC,KAAU,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAC7C,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { it, beforeEach } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { generate } from 'randomstring';
|
|
4
|
-
import { manifest } from './manifest.js';
|
|
5
|
-
const name = 'cm-' + generate();
|
|
6
|
-
const namespace = 'ns' + generate();
|
|
7
|
-
let mf;
|
|
8
|
-
const operations = { observe: {} };
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
mf = { namespace, name, operations };
|
|
11
|
-
});
|
|
12
|
-
const declaration = {
|
|
13
|
-
'/': { GET: 'observe' }
|
|
14
|
-
};
|
|
15
|
-
it('should create branch', async () => {
|
|
16
|
-
const node = manifest(declaration, mf);
|
|
17
|
-
assert.notStrictEqual(node, undefined);
|
|
18
|
-
assert.strictEqual(node.routes.length, 1);
|
|
19
|
-
assert.strictEqual(node.routes[0].path, '/' + namespace + '/' + name);
|
|
20
|
-
});
|
|
21
|
-
it('should not create node for default namespace', async () => {
|
|
22
|
-
mf.namespace = 'default';
|
|
23
|
-
const node = manifest(declaration, mf);
|
|
24
|
-
assert.strictEqual(node.routes.length, 1);
|
|
25
|
-
assert.strictEqual(node.routes[0].path, '/' + name);
|
|
26
|
-
});
|
|
27
|
-
it('should throw on invalid declaration type', async () => {
|
|
28
|
-
assert.throws(() => manifest('hello', mf), (error) => /Exposition declaration must be an object/.test(error.message));
|
|
29
|
-
});
|
|
30
|
-
it('should set namespace and component', async () => {
|
|
31
|
-
const node = manifest(declaration, mf);
|
|
32
|
-
const root = node.routes[0].node;
|
|
33
|
-
const intemediate = root.routes[0].node;
|
|
34
|
-
const GET = intemediate.methods[0];
|
|
35
|
-
assert.strictEqual(GET.mapping?.namespace, namespace);
|
|
36
|
-
assert.strictEqual(GET.mapping?.component, name);
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=manifest.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.test.js","sourceRoot":"","sources":["../../source/extensions.exposition/manifest.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAGvC,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,MAAM,IAAI,GAAG,KAAK,GAAG,QAAQ,EAAE,CAAA;AAC/B,MAAM,SAAS,GAAG,IAAI,GAAG,QAAQ,EAAE,CAAA;AAEnC,IAAI,EAAY,CAAA;AAEhB,MAAM,UAAU,GAAG,EAAE,OAAO,EAAE,EAAE,EAAE,CAAA;AAElC,UAAU,CAAC,GAAG,EAAE;IACd,EAAE,GAAG,EAAE,SAAS,EA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CAAoC,EAAE,KAAK,IAAI,EAAE;IAClD,MAAM,IAAI,GAAG,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IAChC,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACvC,MAAM,GAAG,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;IAElC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC,CAAA;IACrD,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import * as schemas from './schemas.js';
|
|
4
|
-
const authorities = { nex: 'nex.toa.io' };
|
|
5
|
-
it('should require ip with bouncer', () => {
|
|
6
|
-
assert.throws(() => schemas.annotation.validate({ authorities, bouncer: {} }));
|
|
7
|
-
assert.doesNotThrow(() => schemas.annotation.validate({ authorities, bouncer: {}, ip: 'x-real-ip' }));
|
|
8
|
-
assert.doesNotThrow(() => schemas.annotation.validate({ authorities, ip: 'x-real-ip' }));
|
|
9
|
-
});
|
|
10
|
-
it('should default nothing in bouncer', () => {
|
|
11
|
-
assert.doesNotThrow(() => schemas.annotation.validate({
|
|
12
|
-
authorities,
|
|
13
|
-
ip: 'x-real-ip',
|
|
14
|
-
bouncer: { attempts: 5 }
|
|
15
|
-
}));
|
|
16
|
-
assert.throws(() => schemas.annotation.validate({
|
|
17
|
-
authorities,
|
|
18
|
-
ip: 'x-real-ip',
|
|
19
|
-
bouncer: { attempts: 0 }
|
|
20
|
-
}));
|
|
21
|
-
});
|
|
22
|
-
//# sourceMappingURL=schemas.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.test.js","sourceRoot":"","sources":["../../source/extensions.exposition/schemas.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,WAAW,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,CAAA;AAEzC,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;IACxC,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,CAAC,CAAA;IAC9E,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CACvB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAC3E,CAAA;IACD,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC,CAAA;AAC1F,CAAC,CAAC,CAAA;AAEF,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;IAC3C,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CACvB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1B,WAAW;QACX,EAAE,EAAE,WAAW;QACf,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;KACzB,CAAC,CACH,CAAA;IACD,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CACjB,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC;QAC1B,WAAW;QACX,EAAE,EAAE,WAAW;QACf,OAAO,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE;KACzB,CAAC,CACH,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { describe, it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import { parse } from './parse.js';
|
|
4
|
-
describe('routes', () => {
|
|
5
|
-
it('should parse route', async () => {
|
|
6
|
-
const declaration = {
|
|
7
|
-
'/': {},
|
|
8
|
-
'/foo': {}
|
|
9
|
-
};
|
|
10
|
-
const node = parse(declaration);
|
|
11
|
-
assert.strictEqual(node.routes.length, 2);
|
|
12
|
-
assert.strictEqual(node.routes[0].path, '/');
|
|
13
|
-
assert.strictEqual(node.routes[1].path, '/foo');
|
|
14
|
-
});
|
|
15
|
-
it('should parse nested routes', async () => {
|
|
16
|
-
const declaration = {
|
|
17
|
-
'/': {
|
|
18
|
-
'/foo': {},
|
|
19
|
-
'/bar': {}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
const node = parse(declaration);
|
|
23
|
-
const root = node.routes[0].node;
|
|
24
|
-
assert.strictEqual(root.routes.length, 2);
|
|
25
|
-
assert.strictEqual(root.routes[0].path, '/foo');
|
|
26
|
-
assert.strictEqual(root.routes[1].path, '/bar');
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
describe('methods', () => {
|
|
30
|
-
it('should parse methods', () => {
|
|
31
|
-
const declaration = {
|
|
32
|
-
'/': {
|
|
33
|
-
GET: {
|
|
34
|
-
endpoint: 'observe'
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
const node = parse(declaration);
|
|
39
|
-
const root = node.routes[0].node;
|
|
40
|
-
assert.strictEqual(root.methods.length, 1);
|
|
41
|
-
assert.strictEqual(root.methods[0].verb, 'GET');
|
|
42
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, { endpoint: 'observe' });
|
|
43
|
-
});
|
|
44
|
-
it('should parse endpoint shortcut', async () => {
|
|
45
|
-
const declaration = {
|
|
46
|
-
'/': {
|
|
47
|
-
GET: 'observe'
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
const node = parse(declaration);
|
|
51
|
-
const root = node.routes[0].node;
|
|
52
|
-
assert.strictEqual(root.methods.length, 1);
|
|
53
|
-
assert.strictEqual(root.methods[0].verb, 'GET');
|
|
54
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, { endpoint: 'observe' });
|
|
55
|
-
});
|
|
56
|
-
it('should parse fq endpoint', async () => {
|
|
57
|
-
const declaration = {
|
|
58
|
-
'/': {
|
|
59
|
-
GET: 'dummies.dummy.observe'
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
const node = parse(declaration);
|
|
63
|
-
const root = node.routes[0].node;
|
|
64
|
-
assert.strictEqual(root.methods.length, 1);
|
|
65
|
-
assert.strictEqual(root.methods[0].verb, 'GET');
|
|
66
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, {
|
|
67
|
-
namespace: 'dummies',
|
|
68
|
-
component: 'dummy',
|
|
69
|
-
endpoint: 'observe'
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
it('should parse fq endpoint within default namespace', async () => {
|
|
73
|
-
const declaration = {
|
|
74
|
-
'/': {
|
|
75
|
-
GET: 'dummy.observe'
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
const node = parse(declaration);
|
|
79
|
-
const root = node.routes[0].node;
|
|
80
|
-
assert.strictEqual(root.methods.length, 1);
|
|
81
|
-
assert.strictEqual(root.methods[0].verb, 'GET');
|
|
82
|
-
assert.partialDeepStrictEqual(root.methods[0].mapping, {
|
|
83
|
-
namespace: 'default',
|
|
84
|
-
component: 'dummy',
|
|
85
|
-
endpoint: 'observe'
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
it('should parse directives', async () => {
|
|
89
|
-
const declaration = {
|
|
90
|
-
'/': {
|
|
91
|
-
GET: {
|
|
92
|
-
'auth:incept': 'id',
|
|
93
|
-
endpoint: 'observe'
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const node = parse(declaration);
|
|
98
|
-
const root = node.routes[0].node;
|
|
99
|
-
assert.deepStrictEqual(root.methods[0].directives, [
|
|
100
|
-
{ family: 'auth', name: 'incept', value: 'id' }
|
|
101
|
-
]);
|
|
102
|
-
});
|
|
103
|
-
});
|
|
104
|
-
describe('directives', () => {
|
|
105
|
-
it('should parse shortcuts', async () => {
|
|
106
|
-
const declaration = {
|
|
107
|
-
'/': {
|
|
108
|
-
foo: 'baz'
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
const shortcuts = new Map([['foo', 'dev:foo']]);
|
|
112
|
-
const node = parse(declaration, shortcuts);
|
|
113
|
-
const root = node.routes[0].node;
|
|
114
|
-
assert.strictEqual(root.directives.length, 1);
|
|
115
|
-
assert.strictEqual(root.directives[0].family, 'dev');
|
|
116
|
-
assert.strictEqual(root.directives[0].name, 'foo');
|
|
117
|
-
assert.strictEqual(root.directives[0].value, 'baz');
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
describe('validation', () => {
|
|
121
|
-
it('should throw on unknown key', async () => {
|
|
122
|
-
const declaration = { hello: 'world' };
|
|
123
|
-
assert.throws(() => parse(declaration), (error) => /RTD parse error: unknown key 'hello'/.test(error.message));
|
|
124
|
-
});
|
|
125
|
-
it('should throw on invalid mapping', async () => {
|
|
126
|
-
const declaration = {
|
|
127
|
-
'/': {
|
|
128
|
-
GET: {
|
|
129
|
-
endpoint: 'observe',
|
|
130
|
-
hello: 'world'
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
assert.throws(() => parse(declaration), (error) => /\/methods\/0\/mapping/.test(error.message));
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
it('should expand ranges', async () => {
|
|
138
|
-
const declaration = {
|
|
139
|
-
'/': {
|
|
140
|
-
GET: {
|
|
141
|
-
endpoint: 'enumerate',
|
|
142
|
-
query: {
|
|
143
|
-
omit: 3,
|
|
144
|
-
limit: 2
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const node = parse(declaration);
|
|
150
|
-
const query = node.routes[0].node.methods[0].mapping?.query;
|
|
151
|
-
assert.partialDeepStrictEqual(query, {
|
|
152
|
-
omit: { value: 3, range: [3, 3] },
|
|
153
|
-
limit: { value: 2, range: [2, 2] }
|
|
154
|
-
});
|
|
155
|
-
});
|
|
156
|
-
//# sourceMappingURL=parse.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.test.js","sourceRoot":"","sources":["../../../source/extensions.exposition/syntax/parse.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,oBAAoB,EAAE,KAAK,IAAI,EAAE;QAClC,MAAM,WAAW,GAAG;YAClB,GAAG,EAAE,EAAE;YACP,MAAM,EAAE,EAAE;SACX,CAAA;QAED,MAAM,IAAI,GAAG,KAAK,CAAC,WAAW,CAAC,CAAA;QAE/B,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAA;QACzC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAC5C,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;IACjD,CAAC,CA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59 +0,0 @@
|
|
|
1
|
-
import { it } from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
import * as schemas from './schemas.js';
|
|
4
|
-
const ok = {
|
|
5
|
-
a: {
|
|
6
|
-
provider: 'tmp',
|
|
7
|
-
directory: 'ok'
|
|
8
|
-
},
|
|
9
|
-
b: {
|
|
10
|
-
provider: 'fs',
|
|
11
|
-
path: 'ok'
|
|
12
|
-
},
|
|
13
|
-
c: {
|
|
14
|
-
provider: 's3',
|
|
15
|
-
bucket: 'my-bucket'
|
|
16
|
-
},
|
|
17
|
-
e: {
|
|
18
|
-
provider: 'spaces',
|
|
19
|
-
space: 'my-space',
|
|
20
|
-
region: 'nyc3'
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
const oh = [
|
|
24
|
-
{
|
|
25
|
-
whatever: {
|
|
26
|
-
provider: 'non-existent'
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
whatever: {
|
|
31
|
-
provider: 'fs'
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
whatever: {
|
|
36
|
-
provider: 'tmp',
|
|
37
|
-
extra: true
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
whatever: {
|
|
42
|
-
provider: 's3'
|
|
43
|
-
}
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
whatever: {
|
|
47
|
-
provider: 'spaces',
|
|
48
|
-
space: 'my-space'
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
];
|
|
52
|
-
it('should pass', () => {
|
|
53
|
-
assert.doesNotThrow(() => schemas.annotation.validate(ok));
|
|
54
|
-
});
|
|
55
|
-
for (const value of oh)
|
|
56
|
-
it('should fail', () => {
|
|
57
|
-
assert.throws(() => schemas.annotation.validate(value));
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=schemas.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.test.js","sourceRoot":"","sources":["../../source/extensions.storages/schemas.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,WAAW,CAAA;AAC9B,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAA;AAEvC,MAAM,EAAE,GAAG;IACT,CAAC,EAAE;QACD,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,IAAI;KAChB;IACD,CAAC,EAAE;QACD,QAAQ,EAAE,IAAI;QACd,IAAI,EAAE,IAAI;KACX;IACD,CAAC,EAAE;QACD,QAAQ,EAAE,IAAI;QACd,MAAM,EAAE,WAAW;KACpB;IACD,CAAC,EAAE;QACD,QAAQ,EAAE,QAAQ;QAClB,KAAK,EAAE,UAAU;QACjB,MAAM,EAAE,MAAM;KACf;CACF,CAAA;AAED,MAAM,EAAE,GAAG;IACT;QACE,QAAQ,EAAE;YACR,QAAQ,EAAE,cAAc;SACzB;KACF;IACD;QACE,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;SACf;KACF;IACD;QACE,QAAQ,EAAE;YACR,QAAQ,EAAE,KAAK;YACf,KAAK,EAAE,IAAI;SACZ;KACF;IACD;QACE,QAAQ,EAAE;YACR,QAAQ,EAAE,IAAI;SACf;KACF;IACD;QACE,QAAQ,EAAE;YACR,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,UAAU;SAClB;KACF;CACF,CAAA;AAED,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;IACrB,MAAM,CAAC,YAAY,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5D,CAAC,CAAC,CAAA;AAEF,KAAK,MAAM,KAAK,IAAI,EAAE;IACpB,EAAE,CAAC,aAAa,EAAE,GAAG,EAAE;QACrB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,U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