@things-factory/webhook 10.1.150 → 10.1.155

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/webhook",
3
- "version": "10.1.150",
3
+ "version": "10.1.155",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "dist-client/index.js",
6
6
  "exports": {
@@ -46,10 +46,10 @@
46
46
  "@operato/graphql": "^10.0.0",
47
47
  "@operato/i18n": "^10.0.0",
48
48
  "@operato/ops-contract": "^0.9.38",
49
- "@things-factory/auth-base": "^10.1.150",
49
+ "@things-factory/auth-base": "^10.1.155",
50
50
  "@things-factory/env": "^10.1.149",
51
- "@things-factory/shell": "^10.1.150",
52
- "@things-factory/task-lease": "^10.1.150"
51
+ "@things-factory/shell": "^10.1.155",
52
+ "@things-factory/task-lease": "^10.1.155"
53
53
  },
54
- "gitHead": "39c135863f5f7455dcd80b8907550a1c91a86118"
54
+ "gitHead": "0211c9c0764a26c10151fdc7d60094fc334905ff"
55
55
  }
@@ -1,65 +0,0 @@
1
- /**
2
- * Whether this installation can sign, and whose key a domain gets.
3
- *
4
- * This is the judgement that decides whether anything is delivered at all, so it takes the
5
- * environment as an argument - read from the process it would be out of a test's reach, and the way
6
- * it fails is silence: rows pile up and nothing errors.
7
- *
8
- * Moved from operato-plant with the names lifted out (ADR-0078 decision 2 ②, decision 5 as amended):
9
- * the module owns the shape of a per-domain variable, the product owns the stems.
10
- */
11
-
12
- import { domainSecretName, outboxCanSign, outboxSecretFor } from '../server/service/outbox/pump-gate.js'
13
-
14
- const names = { common: 'MES_OUTBOX_SECRET', domainPrefix: 'MES_OUTBOX_SECRET__' }
15
-
16
- describe('a domain becomes a variable name', () => {
17
- it('upper case, and anything else becomes an underscore', () => {
18
- expect(domainSecretName('MES_OUTBOX_SECRET__', 'miratek-gunsan')).toBe('MES_OUTBOX_SECRET__MIRATEK_GUNSAN')
19
- expect(domainSecretName('MES_OUTBOX_SECRET__', 'miratek.gunsan')).toBe('MES_OUTBOX_SECRET__MIRATEK_GUNSAN')
20
- })
21
- })
22
-
23
- describe('can this installation sign', () => {
24
- it('no - nothing named holds a value', () => {
25
- expect(outboxCanSign({}, names)).toBe(false)
26
- expect(outboxCanSign({ SOMETHING_ELSE: 'x' }, names)).toBe(false)
27
- })
28
-
29
- it('★ no - a key that is only whitespace signs, so it does not count as a key', () => {
30
- expect(outboxCanSign({ MES_OUTBOX_SECRET: ' ' }, names)).toBe(false)
31
- expect(outboxCanSign({ MES_OUTBOX_SECRET__MIRATEK_GUNSAN: '\t' }, names)).toBe(false)
32
- })
33
-
34
- it('yes - the common key, a domain key, or one declared in configuration', () => {
35
- expect(outboxCanSign({ MES_OUTBOX_SECRET: 'k' }, names)).toBe(true)
36
- expect(outboxCanSign({ MES_OUTBOX_SECRET__MIRATEK_GUNSAN: 'k' }, names)).toBe(true)
37
- expect(outboxCanSign({}, names, 'k')).toBe(true)
38
- })
39
-
40
- it('★ counts only the names this product declared - another product\'s keys are not ours', () => {
41
- const warehouse = { WMS_OUTBOX_SECRET: 'k', WMS_OUTBOX_SECRET__MIRATEK_GUNSAN: 'k' }
42
-
43
- expect(outboxCanSign(warehouse, names)).toBe(false)
44
- expect(outboxCanSign(warehouse, { common: 'WMS_OUTBOX_SECRET', domainPrefix: 'WMS_OUTBOX_SECRET__' })).toBe(true)
45
- })
46
- })
47
-
48
- describe('whose key this domain signs with', () => {
49
- it('★ its own comes before the common one', () => {
50
- const env = { MES_OUTBOX_SECRET: 'common', MES_OUTBOX_SECRET__MIRATEK_GUNSAN: 'mine' }
51
-
52
- expect(outboxSecretFor(env, names, 'miratek-gunsan')).toBe('mine')
53
- expect(outboxSecretFor(env, names, 'somewhere-else')).toBe('common')
54
- })
55
-
56
- it('★ absent is undefined, never an empty string - an empty key signs', () => {
57
- expect(outboxSecretFor({}, names, 'miratek-gunsan')).toBeUndefined()
58
- expect(outboxSecretFor({ MES_OUTBOX_SECRET: ' ' }, names, 'miratek-gunsan')).toBeUndefined()
59
- })
60
-
61
- it('a key declared in configuration is the last resort', () => {
62
- expect(outboxSecretFor({}, names, 'miratek-gunsan', 'declared')).toBe('declared')
63
- expect(outboxSecretFor({ MES_OUTBOX_SECRET: 'common' }, names, 'miratek-gunsan', 'declared')).toBe('common')
64
- })
65
- })