@toa.io/extensions.exposition 1.0.0-alpha.85 → 1.0.0-alpha.88

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/components/identity.basic/operations/transit.js +3 -3
  2. package/components/identity.basic/operations/transit.js.map +1 -1
  3. package/components/identity.basic/operations/tsconfig.tsbuildinfo +1 -1
  4. package/components/identity.basic/source/transit.ts +3 -3
  5. package/components/octets.storage/manifest.toa.yaml +3 -5
  6. package/components/octets.storage/operations/get.js +1 -1
  7. package/components/octets.storage/operations/head.js +7 -0
  8. package/components/octets.storage/operations/{store.js → put.js} +9 -9
  9. package/documentation/components.md +14 -0
  10. package/documentation/octets.md +17 -47
  11. package/features/identity.feature +11 -4
  12. package/features/{octets.meta.feature → octets.attributes.feature} +13 -12
  13. package/features/octets.cloudinary.feature +68 -0
  14. package/features/octets.download.feature +6 -6
  15. package/features/octets.entries.feature +8 -57
  16. package/features/octets.feature +8 -60
  17. package/features/octets.workflows.feature +0 -36
  18. package/features/steps/.env.example +3 -0
  19. package/features/steps/Parameters.ts +10 -0
  20. package/features/steps/components/octets.tester/manifest.toa.yaml +0 -1
  21. package/features/steps/components/octets.tester/operations/bar.js +0 -1
  22. package/features/steps/components/octets.tester/operations/baz.js +0 -1
  23. package/features/steps/components/octets.tester/operations/foo.js +0 -1
  24. package/package.json +5 -5
  25. package/source/Endpoint.ts +3 -3
  26. package/source/HTTP/Server.ts +4 -0
  27. package/source/RTD/syntax/parse.test.ts +1 -1
  28. package/source/directives/auth/Authorization.ts +9 -9
  29. package/source/directives/auth/Echo.ts +19 -5
  30. package/source/directives/auth/Scheme.ts +1 -1
  31. package/source/directives/auth/types.ts +1 -1
  32. package/source/directives/io/Output.ts +2 -2
  33. package/source/directives/octets/Delete.ts +11 -11
  34. package/source/directives/octets/{Fetch.ts → Get.ts} +17 -34
  35. package/source/directives/octets/Octets.ts +6 -8
  36. package/source/directives/octets/{Store.ts → Put.ts} +9 -14
  37. package/source/directives/octets/Workflow.ts +1 -1
  38. package/source/directives/octets/schemas.ts +4 -6
  39. package/source/directives/octets/workflows/Workflow.ts +2 -3
  40. package/source/directives/vary/embeddings/Language.ts +2 -2
  41. package/source/root.ts +5 -5
  42. package/transpiled/Endpoint.js +3 -3
  43. package/transpiled/Endpoint.js.map +1 -1
  44. package/transpiled/HTTP/Server.js +2 -0
  45. package/transpiled/HTTP/Server.js.map +1 -1
  46. package/transpiled/directives/auth/Authorization.d.ts +1 -1
  47. package/transpiled/directives/auth/Authorization.js +8 -10
  48. package/transpiled/directives/auth/Authorization.js.map +1 -1
  49. package/transpiled/directives/auth/Echo.d.ts +4 -3
  50. package/transpiled/directives/auth/Echo.js +13 -3
  51. package/transpiled/directives/auth/Echo.js.map +1 -1
  52. package/transpiled/directives/auth/Scheme.js +1 -1
  53. package/transpiled/directives/auth/Scheme.js.map +1 -1
  54. package/transpiled/directives/auth/types.d.ts +1 -1
  55. package/transpiled/directives/io/Output.js +1 -1
  56. package/transpiled/directives/io/Output.js.map +1 -1
  57. package/transpiled/directives/octets/Delete.js +8 -8
  58. package/transpiled/directives/octets/Delete.js.map +1 -1
  59. package/transpiled/directives/octets/{Fetch.d.ts → Get.d.ts} +2 -3
  60. package/transpiled/directives/octets/{Fetch.js → Get.js} +19 -24
  61. package/transpiled/directives/octets/Get.js.map +1 -0
  62. package/transpiled/directives/octets/Octets.js +6 -8
  63. package/transpiled/directives/octets/Octets.js.map +1 -1
  64. package/transpiled/directives/octets/{Store.d.ts → Put.d.ts} +2 -2
  65. package/transpiled/directives/octets/{Store.js → Put.js} +11 -14
  66. package/transpiled/directives/octets/Put.js.map +1 -0
  67. package/transpiled/directives/octets/Workflow.js +1 -1
  68. package/transpiled/directives/octets/Workflow.js.map +1 -1
  69. package/transpiled/directives/octets/schemas.d.ts +4 -6
  70. package/transpiled/directives/octets/schemas.js +3 -4
  71. package/transpiled/directives/octets/schemas.js.map +1 -1
  72. package/transpiled/directives/octets/workflows/Workflow.d.ts +1 -1
  73. package/transpiled/directives/octets/workflows/Workflow.js.map +1 -1
  74. package/transpiled/directives/vary/embeddings/Language.js +2 -2
  75. package/transpiled/directives/vary/embeddings/Language.js.map +1 -1
  76. package/transpiled/root.js +5 -5
  77. package/transpiled/root.js.map +1 -1
  78. package/transpiled/tsconfig.tsbuildinfo +1 -1
  79. package/components/octets.storage/operations/fetch.js +0 -46
  80. package/components/octets.storage/operations/list.js +0 -7
  81. package/features/steps/components/octets.tester/operations/diversify.js +0 -16
  82. package/schemas/octets/fetch.cos.yaml +0 -3
  83. package/schemas/octets/permute.cos.yaml +0 -1
  84. package/source/directives/octets/List.ts +0 -72
  85. package/transpiled/directives/octets/Fetch.js.map +0 -1
  86. package/transpiled/directives/octets/List.d.ts +0 -16
  87. package/transpiled/directives/octets/List.js +0 -74
  88. package/transpiled/directives/octets/List.js.map +0 -1
  89. package/transpiled/directives/octets/Store.js.map +0 -1
  90. /package/schemas/octets/{list.cos.yaml → get.cos.yaml} +0 -0
  91. /package/schemas/octets/{store.cos.yaml → put.cos.yaml} +0 -0
@@ -17,7 +17,6 @@ operations:
17
17
  err: *operation
18
18
  echo: *operation
19
19
  concat: *operation
20
- diversify: *operation
21
20
  yield: *operation
22
21
  yex: *operation
23
22
  authority: *operation
@@ -4,7 +4,6 @@ import { setTimeout } from 'node:timers/promises'
4
4
 
5
5
  async function bar (input, context) {
6
6
  await setTimeout(10)
7
- await context.storages.octets.annotate(input.path, 'bar', 'baz')
8
7
 
9
8
  return { bar: 'baz' }
10
9
  }
@@ -4,7 +4,6 @@ import { setTimeout } from 'node:timers/promises'
4
4
 
5
5
  async function baz (input, context) {
6
6
  await setTimeout(30)
7
- await context.storages.octets.annotate(input.path, 'baz', 'qux')
8
7
  }
9
8
 
10
9
  exports.effect = baz
@@ -1,7 +1,6 @@
1
1
  'use strict'
2
2
 
3
3
  async function foo (input, context) {
4
- await context.storages.octets.annotate(input.path, 'foo', 'bar')
5
4
  }
6
5
 
7
6
  exports.effect = foo
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toa.io/extensions.exposition",
3
- "version": "1.0.0-alpha.85",
3
+ "version": "1.0.0-alpha.88",
4
4
  "description": "Toa Exposition",
5
5
  "author": "temich <tema.gurtovoy@gmail.com>",
6
6
  "homepage": "https://github.com/toa-io/toa#readme",
@@ -17,7 +17,7 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@toa.io/core": "1.0.0-alpha.81",
20
+ "@toa.io/core": "1.0.0-alpha.86",
21
21
  "@toa.io/generic": "1.0.0-alpha.63",
22
22
  "@toa.io/schemas": "1.0.0-alpha.63",
23
23
  "bcryptjs": "2.4.3",
@@ -26,7 +26,7 @@
26
26
  "matchacho": "0.3.5",
27
27
  "msgpackr": "1.10.1",
28
28
  "negotiator": "0.6.3",
29
- "openspan": "1.0.0-alpha.79",
29
+ "openspan": "1.0.0-alpha.86",
30
30
  "paseto": "3.1.4",
31
31
  "ultrafetch": "0.4.0"
32
32
  },
@@ -52,11 +52,11 @@
52
52
  "@swc/core": "1.6.6",
53
53
  "@swc/helpers": "0.5.11",
54
54
  "@toa.io/agent": "1.0.0-alpha.79",
55
- "@toa.io/extensions.storages": "1.0.0-alpha.79",
55
+ "@toa.io/extensions.storages": "1.0.0-alpha.88",
56
56
  "@types/bcryptjs": "2.4.3",
57
57
  "@types/cors": "2.8.13",
58
58
  "@types/negotiator": "0.6.1",
59
59
  "jest-esbuild": "0.3.0"
60
60
  },
61
- "gitHead": "6a0ca377bd59218c337985f23b0919cc7ecb208d"
61
+ "gitHead": "85feb27d2aaef381fb9d8282abab0c738cbce585"
62
62
  }
@@ -113,7 +113,7 @@ export class Endpoint implements RTD.Endpoint {
113
113
  const match = etag.match(ETAG)
114
114
 
115
115
  if (match === null)
116
- throw new http.BadRequest('Invalid ETag.')
116
+ throw new http.BadRequest('Invalid ETag')
117
117
 
118
118
  return Number.parseInt(match.groups!.version)
119
119
  }
@@ -128,14 +128,14 @@ export class EndpointsFactory implements RTD.EndpointsFactory {
128
128
 
129
129
  public create (method: RTD.syntax.Method, context: Context): Endpoint {
130
130
  if (method.mapping === undefined)
131
- throw new Error('Cannot create Endpoint without mapping.')
131
+ throw new Error('Cannot create Endpoint without mapping')
132
132
 
133
133
  const mapping = Mapping.create(method.mapping.query)
134
134
  const namespace = method.mapping.namespace ?? context.extension.namespace
135
135
  const component = method.mapping.component ?? context.extension.component
136
136
 
137
137
  if (namespace === undefined || component === undefined)
138
- throw new Error('Annotation endpoints must be fully qualified.')
138
+ throw new Error('Annotation endpoints must be fully qualified')
139
139
 
140
140
  const discovery = this.remotes.discover(namespace, component, context.extension.version)
141
141
 
@@ -25,6 +25,10 @@ export class Server extends Connector {
25
25
  this.authorities = Object.fromEntries(Object.entries(properties.authorities).map(([key, value]) => [value, key]))
26
26
 
27
27
  this.server.on('request', (req, res) => this.listener(req, res))
28
+
29
+ if (this.properties.debug)
30
+ this.server.on('connection', (socket) =>
31
+ console.debug('Connected', { address: socket.remoteAddress }))
28
32
  }
29
33
 
30
34
  public static create (options: Options): Server {
@@ -148,7 +148,7 @@ describe('validation', () => {
148
148
  it('should throw on unknown key', async () => {
149
149
  const declaration = { hello: 'world' }
150
150
 
151
- expect(() => parse(declaration)).toThrow('RTD parse error: unknown key \'hello\'.')
151
+ expect(() => parse(declaration)).toThrow('RTD parse error: unknown key \'hello\'')
152
152
  })
153
153
 
154
154
  it('should throw on invalid mapping', async () => {
@@ -66,29 +66,29 @@ export class Authorization implements DirectiveFamily<Directive, Extension> {
66
66
  * the inception will cause a unique constraint violation on the settle stage.
67
67
  */
68
68
  const inception = directives.reduce((yes, directive) => yes || directive instanceof Incept, false)
69
- const identity = inception ? null : await this.resolve(input.authority, input.request.headers.authorization)
70
69
 
71
- input.identity = identity
70
+ input.identity = inception ? null : await this.resolve(input.authority, input.request.headers.authorization)
72
71
 
73
72
  for (const directive of directives) {
74
- const allow = await directive.authorize(identity, input, parameters)
73
+ const allow = await directive.authorize(input.identity, input, parameters)
75
74
 
76
75
  if (allow)
77
- return directive.reply?.(identity) ?? null
76
+ return directive.reply?.(input.identity) ?? null
78
77
  }
79
78
 
80
- if (identity === null)
79
+ if (input.identity === null)
81
80
  throw new http.Unauthorized()
82
81
  else
83
82
  throw new http.Forbidden()
84
83
  }
85
84
 
86
85
  public async settle (directives: Directive[],
87
- request: Input,
86
+ input: Input,
88
87
  response: http.OutgoingMessage): Promise<void> {
89
- for (const directive of directives) await directive.settle?.(request, response)
88
+ await Promise.all(directives.map(async (directive) =>
89
+ directive.settle?.(input, response)))
90
90
 
91
- const identity = request.identity
91
+ const identity = input.identity
92
92
 
93
93
  if (identity === null)
94
94
  return
@@ -103,7 +103,7 @@ export class Authorization implements DirectiveFamily<Directive, Extension> {
103
103
  this.tokens ??= await this.discovery.tokens
104
104
 
105
105
  const token = await this.tokens.invoke<string>('encrypt', {
106
- input: { authority: request.authority, identity }
106
+ input: { authority: input.authority, identity }
107
107
  })
108
108
 
109
109
  const authorization = `Token ${token}`
@@ -1,12 +1,26 @@
1
- import { type OutgoingMessage } from '../../HTTP'
2
- import { type Directive, type Identity } from './types'
1
+ import { newid } from '@toa.io/generic'
2
+ import type { OutgoingMessage } from '../../HTTP'
3
+ import type { Directive, Identity, Input } from './types'
3
4
 
4
5
  export class Echo implements Directive {
5
- public authorize (identity: Identity | null): boolean {
6
- return identity !== null
6
+ public authorize (identity: Identity | null, input: Input): boolean {
7
+ if (identity === null && 'authorization' in input.request.headers)
8
+ return false
9
+
10
+ input.identity ??= this.create()
11
+
12
+ return true
7
13
  }
8
14
 
9
15
  public reply (identity: Identity | null): OutgoingMessage {
10
- return { body: identity }
16
+ const body = identity!
17
+
18
+ return body.scheme === null
19
+ ? { status: 201, body }
20
+ : { body }
21
+ }
22
+
23
+ private create (): Identity {
24
+ return { id: newid(), scheme: null, refresh: false, roles: [] }
11
25
  }
12
26
  }
@@ -19,7 +19,7 @@ export class Scheme implements Directive {
19
19
 
20
20
  if (scheme !== this.scheme)
21
21
  throw new http.Forbidden(this.Scheme +
22
- ' authentication scheme is required to access this resource.')
22
+ ' authentication scheme is required to access this resource')
23
23
 
24
24
  return false
25
25
  }
@@ -18,7 +18,7 @@ export interface Directive {
18
18
 
19
19
  export interface Identity {
20
20
  readonly id: string
21
- scheme: string
21
+ scheme: string | null // null for transient identities
22
22
  roles?: string[]
23
23
  refresh: boolean
24
24
  }
@@ -41,7 +41,7 @@ export class Output implements Directive {
41
41
 
42
42
  if (typeof message.body !== 'object' || this.permissions.length === 0) {
43
43
  if (this.omitted)
44
- console.warn('Permissions for \'io:output\' are not specified properly. Response omitted.',
44
+ console.warn('Permissions for \'io:output\' are not specified properly, response omitted',
45
45
  { path: context.url.pathname })
46
46
 
47
47
  delete message.body
@@ -53,7 +53,7 @@ export class Output implements Directive {
53
53
  '\'io:output\' expects response to be an object or array of objects')
54
54
 
55
55
  if (Array.isArray(message.body))
56
- message.body = message.body.map((entity) => this.fit(entity))
56
+ message.body = message.body.map((entity) => this.fit(entity as Message))
57
57
  else
58
58
  message.body = this.fit(message.body)
59
59
  }
@@ -32,20 +32,20 @@ export class Delete extends Directive {
32
32
  public async apply (storage: string, input: Input, parameters: Parameter[]): Promise<Output> {
33
33
  this.storage ??= await this.discovery
34
34
 
35
- const entry = await this.storage.invoke<Maybe<Entry>>('get',
36
- {
37
- input: {
38
- storage,
39
- path: input.request.url
40
- }
41
- })
42
-
43
- if (entry instanceof Error)
44
- throw new NotFound()
45
-
46
35
  const output: Output = {}
47
36
 
48
37
  if (this.workflow !== undefined) {
38
+ const entry = await this.storage.invoke<Maybe<Entry>>('head',
39
+ {
40
+ input: {
41
+ storage,
42
+ path: input.request.url
43
+ }
44
+ })
45
+
46
+ if (entry instanceof Error)
47
+ throw new NotFound()
48
+
49
49
  output.status = 202
50
50
  output.body = Readable.from(this.execute(input, storage, entry, parameters))
51
51
  } else
@@ -1,19 +1,16 @@
1
- import { posix } from 'node:path'
2
1
  import { Forbidden, NotFound } from '../../HTTP'
3
2
  import * as schemas from './schemas'
4
3
  import { Directive } from './Directive'
5
- import type { Readable } from 'node:stream'
6
4
  import type { Maybe } from '@toa.io/types'
7
- import type { Entry } from '@toa.io/extensions.storages'
5
+ import type { Entry, Stream } from '@toa.io/extensions.storages'
8
6
  import type { Component } from '@toa.io/core'
9
7
  import type { Output } from '../../io'
10
8
  import type { Input } from './types'
11
9
 
12
- export class Fetch extends Directive {
10
+ export class Get extends Directive {
13
11
  public readonly targeted = true
14
12
 
15
13
  private readonly options: Required<Options> = {
16
- blob: true,
17
14
  meta: false
18
15
  }
19
16
 
@@ -23,7 +20,7 @@ export class Fetch extends Directive {
23
20
  public constructor (options: Options | null, discovery: Promise<Component>) {
24
21
  super()
25
22
 
26
- schemas.fetch.validate(options)
23
+ schemas.get.validate(options)
27
24
  Object.assign(this.options, options)
28
25
 
29
26
  this.discovery = discovery
@@ -32,49 +29,43 @@ export class Fetch extends Directive {
32
29
  public async apply (storage: string, input: Input): Promise<Output> {
33
30
  this.storage ??= await this.discovery
34
31
 
35
- const variant = posix.basename(input.request.url).includes('.')
36
- const metadata = input.subtype === 'octets.entry'
37
-
38
- if (!variant && metadata)
32
+ if (input.subtype === 'octets.entry')
39
33
  if (this.options.meta)
40
- return this.get(storage, input)
34
+ return this.head(storage, input)
41
35
  else
42
- throw new Forbidden('Metadata is not accessible.')
43
-
44
- if (!variant && !this.options.blob)
45
- throw new Forbidden('BLOB variant must be specified.')
46
-
47
- return await this.fetch(storage, input)
36
+ throw new Forbidden('Metadata is not accessible')
37
+ else
38
+ return await this.get(storage, input)
48
39
  }
49
40
 
50
- private async fetch (storage: string, input: Input): Promise<Output> {
41
+ private async get (storage: string, input: Input): Promise<Output> {
51
42
  if ('if-none-match' in input.request.headers)
52
43
  return { status: 304 }
53
44
 
54
- const result = await this.storage.invoke<Maybe<FetchResult>>('fetch', {
45
+ const entry = await this.storage.invoke<Maybe<Stream>>('get', {
55
46
  input: {
56
47
  storage,
57
48
  path: input.request.url
58
49
  }
59
50
  })
60
51
 
61
- if (result instanceof Error)
52
+ if (entry instanceof Error)
62
53
  throw new NotFound()
63
54
 
64
55
  const headers = new Headers({
65
- 'content-type': result.type,
66
- 'content-length': result.size.toString(),
67
- etag: `"${result.checksum}"`
56
+ 'content-type': entry.type,
57
+ 'content-length': entry.size.toString(),
58
+ etag: `"${entry.checksum}"`
68
59
  })
69
60
 
70
61
  return {
71
62
  headers,
72
- body: result.stream
63
+ body: entry.stream
73
64
  }
74
65
  }
75
66
 
76
- private async get (storage: string, input: Input): Promise<Output> {
77
- const entry = await this.storage.invoke<Maybe<Entry>>('get', {
67
+ private async head (storage: string, input: Input): Promise<Output> {
68
+ const entry = await this.storage.invoke<Maybe<Entry>>('head', {
78
69
  input: {
79
70
  storage,
80
71
  path: input.request.url
@@ -89,13 +80,5 @@ export class Fetch extends Directive {
89
80
  }
90
81
 
91
82
  export interface Options {
92
- blob?: boolean
93
83
  meta?: boolean
94
84
  }
95
-
96
- interface FetchResult {
97
- stream: Readable
98
- checksum: string
99
- size: number
100
- type: string
101
- }
@@ -1,8 +1,7 @@
1
1
  import { NotFound } from '../../HTTP'
2
2
  import { Context } from './Context'
3
- import { Store } from './Store'
4
- import { Fetch } from './Fetch'
5
- import { List } from './List'
3
+ import { Put } from './Put'
4
+ import { Get } from './Get'
6
5
  import { Delete } from './Delete'
7
6
  import { WorkflowDirective } from './Workflow'
8
7
  import type { Directive } from './Directive'
@@ -40,14 +39,14 @@ export class Octets implements DirectiveFamily<Directive> {
40
39
  else if (action === null)
41
40
  action = directive
42
41
  else
43
- throw new Error('Octets action is umbiguous.')
42
+ throw new Error('Octets action is ambiguous')
44
43
 
45
44
  if (action === null)
46
45
  return null
47
46
 
48
47
  // noinspection PointlessBooleanExpressionJS
49
48
  if (context === null)
50
- throw new Error('Octets context is not defined.')
49
+ throw new Error('Octets context is not defined')
51
50
 
52
51
  const targeted = input.request.url[input.request.url.length - 1] !== '/'
53
52
 
@@ -61,9 +60,8 @@ export class Octets implements DirectiveFamily<Directive> {
61
60
 
62
61
  const DIRECTIVES: Record<string, Constructor> = {
63
62
  context: Context,
64
- store: Store,
65
- fetch: Fetch,
66
- list: List,
63
+ put: Put,
64
+ get: Get,
67
65
  delete: Delete,
68
66
  workflow: WorkflowDirective
69
67
  }
@@ -16,7 +16,7 @@ import type { Component } from '@toa.io/core'
16
16
  import type { Output } from '../../io'
17
17
  import type { Input } from './types'
18
18
 
19
- export class Store extends Directive {
19
+ export class Put extends Directive {
20
20
  public readonly targeted = false
21
21
 
22
22
  private readonly accept?: string
@@ -31,7 +31,7 @@ export class Store extends Directive {
31
31
  (options: Options | null, discovery: Promise<Component>, remotes: Remotes) {
32
32
  super()
33
33
 
34
- schemas.store.validate<Options>(options)
34
+ schemas.put.validate<Options>(options)
35
35
 
36
36
  this.accept = match(options?.accept,
37
37
  String, (value: string) => value,
@@ -49,7 +49,7 @@ export class Store extends Directive {
49
49
  this.limit = toBytes(this.limitString)
50
50
  this.discovery.storage = discovery
51
51
 
52
- cors.allow('content-meta')
52
+ cors.allow('content-attributes')
53
53
  cors.allow('content-location')
54
54
  }
55
55
 
@@ -66,12 +66,7 @@ export class Store extends Directive {
66
66
  }
67
67
  }
68
68
 
69
- const meta = input.request.headers['content-meta']
70
-
71
- if (meta !== undefined)
72
- request.input.meta = this.meta(meta)
73
-
74
- const entry = await this.storage.invoke<Entry>('store', request)
69
+ const entry = await this.storage.invoke<Entry>('put', request)
75
70
 
76
71
  return match<Output>(entry,
77
72
  Error, (error: ErrorType) => this.throw(error),
@@ -110,20 +105,20 @@ export class Store extends Directive {
110
105
  error)
111
106
  }
112
107
 
113
- private meta (value: string | string[]): Record<string, string> {
108
+ private attributes (value: string | string[]): Record<string, string> {
114
109
  if (Array.isArray(value))
115
110
  value = value.join(',')
116
111
 
117
- const meta: Record<string, string> = {}
112
+ const attributes: Record<string, string> = {}
118
113
 
119
114
  for (const pair of value.split(',')) {
120
115
  const eq = pair.indexOf('=')
121
116
  const key = (eq === -1 ? pair : pair.slice(0, eq)).trim()
122
117
 
123
- meta[key] = eq === -1 ? 'true' : pair.slice(eq + 1).trim()
118
+ attributes[key] = eq === -1 ? 'true' : pair.slice(eq + 1).trim()
124
119
  }
125
120
 
126
- return meta
121
+ return attributes
127
122
  }
128
123
  }
129
124
 
@@ -141,6 +136,6 @@ interface StoreRequest {
141
136
  accept?: string
142
137
  limit?: number
143
138
  trust?: Array<string | RegExp>
144
- meta?: Record<string, string>
139
+ attributes?: Record<string, string>
145
140
  }
146
141
  }
@@ -29,7 +29,7 @@ export class WorkflowDirective extends Directive {
29
29
  public async apply (storage: string, input: Input, parameters: Parameter[]): Promise<Output> {
30
30
  this.storage ??= await this.discovery
31
31
 
32
- const entry = await this.storage.invoke<Maybe<Entry>>('get',
32
+ const entry = await this.storage.invoke<Maybe<Entry>>('head',
33
33
  {
34
34
  input: {
35
35
  storage,
@@ -1,8 +1,7 @@
1
1
  import { resolve } from 'node:path'
2
2
  import schemas from '@toa.io/schemas'
3
- import type { Options as FetchOptions } from './Fetch'
4
- import type { Options as ListOptions } from './List'
5
- import type { Options as StoreOptions } from './Store'
3
+ import type { Options as GetOptions } from './Get'
4
+ import type { Options as PutOptions } from './Put'
6
5
  import type { Options as DeleteOptions } from './Delete'
7
6
  import type { Schema } from '@toa.io/schemas'
8
7
  import type { Unit } from './workflows'
@@ -10,8 +9,7 @@ import type { Unit } from './workflows'
10
9
  const path = resolve(__dirname, '../../../schemas/octets')
11
10
  const namespace = schemas.namespace(path)
12
11
 
13
- export const store: Schema<StoreOptions | null> = namespace.schema('store')
14
- export const fetch: Schema<FetchOptions | null> = namespace.schema('fetch')
12
+ export const put: Schema<PutOptions | null> = namespace.schema('put')
13
+ export const get: Schema<GetOptions | null> = namespace.schema('get')
15
14
  export const remove: Schema<DeleteOptions | null> = namespace.schema('delete')
16
- export const list: Schema<ListOptions | null> = namespace.schema('list')
17
15
  export const workflow: Schema<Unit[] | Unit> = namespace.schema('workflow')
@@ -1,10 +1,10 @@
1
1
  import { posix } from 'node:path'
2
2
  import { match } from 'matchacho'
3
3
  import { Execution } from './Execution'
4
+ import type { Entry } from '@toa.io/extensions.storages'
4
5
  import type { Context } from './Execution'
5
6
  import type { Parameter } from '../../../RTD'
6
7
  import type { Input } from '../types'
7
- import type { Entry } from '@toa.io/extensions.storages'
8
8
  import type { Remotes } from '../../../Remotes'
9
9
 
10
10
  export class Workflow {
@@ -20,8 +20,7 @@ export class Workflow {
20
20
  }
21
21
 
22
22
  // eslint-disable-next-line max-params
23
- public execute
24
- (input: Input, storage: string, entry: Entry, params: Parameter[]): Execution {
23
+ public execute (input: Input, storage: string, entry: Entry, params: Parameter[]): Execution {
25
24
  const path = posix.join(input.request.url, entry.id)
26
25
  const authority = input.authority
27
26
  const parameters: Record<string, string> = {}
@@ -12,10 +12,10 @@ export class Language implements Embedding {
12
12
 
13
13
  public resolve (input: Input, properties: Properties): string | undefined {
14
14
  assert.ok(properties.languages !== undefined,
15
- 'Supported languages are not defined. Use `vary:languages` directive.')
15
+ 'Supported languages are not defined. Use `vary:languages` directive')
16
16
 
17
17
  assert.ok(properties.languages.length > 0,
18
- 'List of supported languages is empty.')
18
+ 'List of supported languages is empty')
19
19
 
20
20
  const negotiator = new Negotiator(input.request)
21
21
  const language = negotiator.language(properties.languages) ?? properties.languages[0]
package/source/root.ts CHANGED
@@ -21,15 +21,15 @@ const PREDEFINED: syntax.Node = {
21
21
  {
22
22
  verb: 'GET',
23
23
  directives: [
24
- {
25
- family: 'auth',
26
- name: 'echo',
27
- value: null
28
- },
29
24
  {
30
25
  family: 'io',
31
26
  name: 'output',
32
27
  value: ['id', 'roles']
28
+ },
29
+ {
30
+ family: 'auth',
31
+ name: 'echo',
32
+ value: null
33
33
  }
34
34
  ]
35
35
  }
@@ -103,7 +103,7 @@ class Endpoint {
103
103
  version(etag) {
104
104
  const match = etag.match(ETAG);
105
105
  if (match === null)
106
- throw new http.BadRequest('Invalid ETag.');
106
+ throw new http.BadRequest('Invalid ETag');
107
107
  return Number.parseInt(match.groups.version);
108
108
  }
109
109
  }
@@ -115,12 +115,12 @@ class EndpointsFactory {
115
115
  }
116
116
  create(method, context) {
117
117
  if (method.mapping === undefined)
118
- throw new Error('Cannot create Endpoint without mapping.');
118
+ throw new Error('Cannot create Endpoint without mapping');
119
119
  const mapping = Mapping_1.Mapping.create(method.mapping.query);
120
120
  const namespace = method.mapping.namespace ?? context.extension.namespace;
121
121
  const component = method.mapping.component ?? context.extension.component;
122
122
  if (namespace === undefined || component === undefined)
123
- throw new Error('Annotation endpoints must be fully qualified.');
123
+ throw new Error('Annotation endpoints must be fully qualified');
124
124
  const discovery = this.remotes.discover(namespace, component, context.extension.version);
125
125
  return new Endpoint(method.mapping.endpoint, mapping, discovery);
126
126
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Endpoint.js","sourceRoot":"","sources":["../source/Endpoint.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAkC;AAClC,uCAAmC;AACnC,6CAA8B;AAO9B,MAAa,QAAQ;IACF,QAAQ,CAAQ;IAChB,OAAO,CAAS;IAChB,SAAS,CAAiB;IACnC,MAAM,GAAkB,IAAI,CAAA;IAEpC,YAAoB,QAAgB,EAAE,OAAgB,EAAE,SAA0B;QAChF,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;IAC5B,CAAC;IAEM,KAAK,CAAC,IAAI,CAAE,OAAqB,EAAE,UAA2B;QACnE,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAA;QACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;QACjC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,CAAC,CAAA;QAEzD,IAAI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AE,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAA;QAExF,OAAO,IAAI,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC,CAAA;IAClE,CAAC;CACF;AAtBD,4CAsBC;AAED,MAAM,IAAI,GAAG,gCAAgC,CAAA;AAE7C,MAAM,SAAS,GAAG,IAAI,CAAA"}
@@ -49,6 +49,8 @@ class Server extends core_1.Connector {
49
49
  this.properties = properties;
50
50
  this.authorities = Object.fromEntries(Object.entries(properties.authorities).map(([key, value]) => [value, key]));
51
51
  this.server.on('request', (req, res) => this.listener(req, res));
52
+ if (this.properties.debug)
53
+ this.server.on('connection', (socket) => openspan_1.console.debug('Connected', { address: socket.remoteAddress }));
52
54
  }
53
55
  static create(options) {
54
56
  const properties = Object.assign({}, DEFAULTS, options);