@smartindustriesllc/ecosystem-client 0.1.0 → 0.1.1
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 +7 -2
- package/schemas/capability-manifest.v1.schema.json +117 -0
- package/schemas/command-envelope.v1.schema.json +133 -0
- package/schemas/event-envelope.v2.schema.json +63 -0
- package/schemas/notification-envelope.v1.schema.json +106 -0
- package/schemas/policy-state.v1.schema.json +163 -0
- package/src/_auth.js +18 -0
- package/src/ai_profile.js +1 -1
- package/src/contracts.js +398 -0
- package/src/discovery.js +2 -2
- package/src/events.js +100 -39
- package/src/hub.js +322 -0
- package/src/index.js +70 -4
- package/src/peer.js +1 -1
- package/src/ulid.js +119 -0
package/package.json
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartindustriesllc/ecosystem-client",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Service registration, peer discovery and event bus client for the appEcosystem service mesh",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
".": "./src/index.js"
|
|
7
|
+
".": "./src/index.js",
|
|
8
|
+
"./contracts": "./src/contracts.js",
|
|
9
|
+
"./hub": "./src/hub.js",
|
|
10
|
+
"./ulid": "./src/ulid.js",
|
|
11
|
+
"./schemas/*": "./schemas/*"
|
|
8
12
|
},
|
|
9
13
|
"files": [
|
|
10
14
|
"src",
|
|
15
|
+
"schemas",
|
|
11
16
|
"README.md",
|
|
12
17
|
"LICENSE"
|
|
13
18
|
],
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://smartindustries.dev/schemas/appecosystem/capability-manifest.v1.schema.json",
|
|
4
|
+
"title": "EcosystemCapabilityManifestV1",
|
|
5
|
+
"description": "Project-contributed capability contract advertised to the ecosystem hub or evaluated standalone.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"capability",
|
|
10
|
+
"version",
|
|
11
|
+
"provider",
|
|
12
|
+
"action_class",
|
|
13
|
+
"required_grant",
|
|
14
|
+
"idempotent",
|
|
15
|
+
"cancellable",
|
|
16
|
+
"timeout_seconds",
|
|
17
|
+
"offline_behavior"
|
|
18
|
+
],
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"properties": {
|
|
21
|
+
"schema_version": {
|
|
22
|
+
"type": "integer",
|
|
23
|
+
"const": 1
|
|
24
|
+
},
|
|
25
|
+
"capability": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
28
|
+
},
|
|
29
|
+
"version": {
|
|
30
|
+
"type": "integer",
|
|
31
|
+
"minimum": 1
|
|
32
|
+
},
|
|
33
|
+
"description": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"provider": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"required": ["app", "device_id"],
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"properties": {
|
|
41
|
+
"app": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
},
|
|
45
|
+
"device_id": {
|
|
46
|
+
"type": "string",
|
|
47
|
+
"minLength": 1
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"action_class": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"enum": [
|
|
54
|
+
"observe",
|
|
55
|
+
"investigate",
|
|
56
|
+
"contain",
|
|
57
|
+
"remediate",
|
|
58
|
+
"data_release",
|
|
59
|
+
"system_change"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
"required_grant": {
|
|
63
|
+
"type": "string",
|
|
64
|
+
"minLength": 1
|
|
65
|
+
},
|
|
66
|
+
"inputs_schema": {
|
|
67
|
+
"type": "object"
|
|
68
|
+
},
|
|
69
|
+
"result_schema": {
|
|
70
|
+
"type": "object"
|
|
71
|
+
},
|
|
72
|
+
"requirements": {
|
|
73
|
+
"type": "object",
|
|
74
|
+
"additionalProperties": false,
|
|
75
|
+
"properties": {
|
|
76
|
+
"os": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"items": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"min_tier": {
|
|
83
|
+
"type": "integer",
|
|
84
|
+
"minimum": 0
|
|
85
|
+
},
|
|
86
|
+
"needs_gpu": {
|
|
87
|
+
"type": "boolean"
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
"side_effects": {
|
|
92
|
+
"type": "array",
|
|
93
|
+
"items": {
|
|
94
|
+
"type": "string"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"timeout_seconds": {
|
|
98
|
+
"type": "number",
|
|
99
|
+
"minimum": 1
|
|
100
|
+
},
|
|
101
|
+
"cancellable": {
|
|
102
|
+
"type": "boolean"
|
|
103
|
+
},
|
|
104
|
+
"idempotent": {
|
|
105
|
+
"type": "boolean"
|
|
106
|
+
},
|
|
107
|
+
"offline_behavior": {
|
|
108
|
+
"type": "string",
|
|
109
|
+
"enum": [
|
|
110
|
+
"run_local",
|
|
111
|
+
"freeze_local_and_queue_notice",
|
|
112
|
+
"queue_until_online",
|
|
113
|
+
"unavailable"
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://smartindustries.dev/schemas/appecosystem/command-envelope.v1.schema.json",
|
|
4
|
+
"title": "EcosystemCommandEnvelopeV1",
|
|
5
|
+
"description": "Authenticated, replay-resistant command envelope with actor identity, target scope, expiry, idempotency, and authorization reference.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"id",
|
|
10
|
+
"command",
|
|
11
|
+
"action_class",
|
|
12
|
+
"actor",
|
|
13
|
+
"target",
|
|
14
|
+
"parameters",
|
|
15
|
+
"issued_at",
|
|
16
|
+
"expires_at",
|
|
17
|
+
"correlation_id",
|
|
18
|
+
"idempotency_key",
|
|
19
|
+
"ack_required",
|
|
20
|
+
"signature"
|
|
21
|
+
],
|
|
22
|
+
"additionalProperties": false,
|
|
23
|
+
"properties": {
|
|
24
|
+
"schema_version": {
|
|
25
|
+
"type": "integer",
|
|
26
|
+
"const": 1
|
|
27
|
+
},
|
|
28
|
+
"id": {
|
|
29
|
+
"type": "string",
|
|
30
|
+
"pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
|
|
31
|
+
},
|
|
32
|
+
"command": {
|
|
33
|
+
"type": "string",
|
|
34
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$"
|
|
35
|
+
},
|
|
36
|
+
"action_class": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": [
|
|
39
|
+
"observe",
|
|
40
|
+
"investigate",
|
|
41
|
+
"contain",
|
|
42
|
+
"remediate",
|
|
43
|
+
"data_release",
|
|
44
|
+
"system_change"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"actor": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"required": ["id", "type", "app", "device_id"],
|
|
50
|
+
"additionalProperties": false,
|
|
51
|
+
"properties": {
|
|
52
|
+
"id": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"minLength": 1
|
|
55
|
+
},
|
|
56
|
+
"type": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"enum": [
|
|
59
|
+
"operator",
|
|
60
|
+
"service",
|
|
61
|
+
"automation",
|
|
62
|
+
"voice_intent",
|
|
63
|
+
"ai_proposal"
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
"app": {
|
|
67
|
+
"type": "string",
|
|
68
|
+
"minLength": 1
|
|
69
|
+
},
|
|
70
|
+
"device_id": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"minLength": 1
|
|
73
|
+
},
|
|
74
|
+
"auth_method": {
|
|
75
|
+
"type": ["string", "null"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"target": {
|
|
80
|
+
"type": "object",
|
|
81
|
+
"required": ["scope"],
|
|
82
|
+
"additionalProperties": false,
|
|
83
|
+
"properties": {
|
|
84
|
+
"scope": {
|
|
85
|
+
"type": "string",
|
|
86
|
+
"enum": ["local", "device", "group", "ecosystem", "external"]
|
|
87
|
+
},
|
|
88
|
+
"device_id": {
|
|
89
|
+
"type": ["string", "null"]
|
|
90
|
+
},
|
|
91
|
+
"service": {
|
|
92
|
+
"type": ["string", "null"]
|
|
93
|
+
},
|
|
94
|
+
"identifier": {
|
|
95
|
+
"type": ["string", "null"]
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"parameters": {
|
|
100
|
+
"type": "object"
|
|
101
|
+
},
|
|
102
|
+
"issued_at": {
|
|
103
|
+
"type": "number",
|
|
104
|
+
"minimum": 0
|
|
105
|
+
},
|
|
106
|
+
"expires_at": {
|
|
107
|
+
"type": "number",
|
|
108
|
+
"minimum": 0
|
|
109
|
+
},
|
|
110
|
+
"correlation_id": {
|
|
111
|
+
"type": "string",
|
|
112
|
+
"minLength": 1
|
|
113
|
+
},
|
|
114
|
+
"idempotency_key": {
|
|
115
|
+
"type": "string",
|
|
116
|
+
"minLength": 1
|
|
117
|
+
},
|
|
118
|
+
"authorization_ref": {
|
|
119
|
+
"type": ["string", "null"],
|
|
120
|
+
"description": "Signed policy override, approval ID, or device grant reference (never a notification ID)."
|
|
121
|
+
},
|
|
122
|
+
"rationale": {
|
|
123
|
+
"type": ["string", "null"]
|
|
124
|
+
},
|
|
125
|
+
"ack_required": {
|
|
126
|
+
"type": "boolean"
|
|
127
|
+
},
|
|
128
|
+
"signature": {
|
|
129
|
+
"type": "string",
|
|
130
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://smartindustries.dev/schemas/appecosystem/event-envelope.v2.schema.json",
|
|
4
|
+
"title": "EcosystemEventEnvelopeV2",
|
|
5
|
+
"description": "Signed v2 event envelope for the appEcosystem event bus.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"id",
|
|
10
|
+
"type",
|
|
11
|
+
"source",
|
|
12
|
+
"timestamp",
|
|
13
|
+
"data",
|
|
14
|
+
"signature"
|
|
15
|
+
],
|
|
16
|
+
"additionalProperties": false,
|
|
17
|
+
"properties": {
|
|
18
|
+
"schema_version": {
|
|
19
|
+
"type": "integer",
|
|
20
|
+
"const": 2
|
|
21
|
+
},
|
|
22
|
+
"id": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"pattern": "^[0-9A-HJKMNP-TV-Z]{26}$",
|
|
25
|
+
"description": "26-character Crockford Base32 ULID."
|
|
26
|
+
},
|
|
27
|
+
"type": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^[a-z][a-z0-9_]*(\\.[a-z][a-z0-9_]*)+$",
|
|
30
|
+
"description": "Dot-delimited canonical event type (e.g. 'scan.completed', 'notify.security')."
|
|
31
|
+
},
|
|
32
|
+
"source": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"required": ["app", "device_id"],
|
|
35
|
+
"additionalProperties": false,
|
|
36
|
+
"properties": {
|
|
37
|
+
"app": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
41
|
+
"device_id": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"timestamp": {
|
|
48
|
+
"type": "number",
|
|
49
|
+
"minimum": 0
|
|
50
|
+
},
|
|
51
|
+
"data": {
|
|
52
|
+
"type": "object"
|
|
53
|
+
},
|
|
54
|
+
"correlation_id": {
|
|
55
|
+
"type": ["string", "null"]
|
|
56
|
+
},
|
|
57
|
+
"signature": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"pattern": "^[0-9a-f]{64}$",
|
|
60
|
+
"description": "Hex-encoded HMAC-SHA256 signature over the canonical signable envelope."
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://smartindustries.dev/schemas/appecosystem/notification-envelope.v1.schema.json",
|
|
4
|
+
"title": "EcosystemNotificationEnvelopeV1",
|
|
5
|
+
"description": "Deduplicated, privacy-redacted cross-device notification envelope.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"type",
|
|
10
|
+
"id",
|
|
11
|
+
"dedupe_key",
|
|
12
|
+
"source",
|
|
13
|
+
"severity",
|
|
14
|
+
"title",
|
|
15
|
+
"body",
|
|
16
|
+
"actions",
|
|
17
|
+
"privacy",
|
|
18
|
+
"ttl",
|
|
19
|
+
"created_at"
|
|
20
|
+
],
|
|
21
|
+
"additionalProperties": false,
|
|
22
|
+
"properties": {
|
|
23
|
+
"schema_version": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"const": 1
|
|
26
|
+
},
|
|
27
|
+
"type": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"pattern": "^notify\\.[a-z][a-z0-9_]*$"
|
|
30
|
+
},
|
|
31
|
+
"id": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"pattern": "^[0-9A-HJKMNP-TV-Z]{26}$"
|
|
34
|
+
},
|
|
35
|
+
"dedupe_key": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"minLength": 1
|
|
38
|
+
},
|
|
39
|
+
"source": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": ["app", "device_id"],
|
|
42
|
+
"additionalProperties": false,
|
|
43
|
+
"properties": {
|
|
44
|
+
"app": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"minLength": 1
|
|
47
|
+
},
|
|
48
|
+
"device_id": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"minLength": 1
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"severity": {
|
|
55
|
+
"type": "string",
|
|
56
|
+
"enum": ["low", "medium", "high", "critical"]
|
|
57
|
+
},
|
|
58
|
+
"title": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"minLength": 1
|
|
61
|
+
},
|
|
62
|
+
"body": {
|
|
63
|
+
"type": "string"
|
|
64
|
+
},
|
|
65
|
+
"actions": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"required": ["id"],
|
|
70
|
+
"additionalProperties": false,
|
|
71
|
+
"properties": {
|
|
72
|
+
"id": {
|
|
73
|
+
"type": "string",
|
|
74
|
+
"minLength": 1
|
|
75
|
+
},
|
|
76
|
+
"label": {
|
|
77
|
+
"type": ["string", "null"]
|
|
78
|
+
},
|
|
79
|
+
"requires": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"enum": ["none", "freeze_grant", "approver_auth", "policy_admin"]
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
"privacy": {
|
|
87
|
+
"type": "string",
|
|
88
|
+
"enum": ["redacted", "public", "local_only"]
|
|
89
|
+
},
|
|
90
|
+
"ttl": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"pattern": "^[0-9]+(s|m|h|d)$"
|
|
93
|
+
},
|
|
94
|
+
"deep_link": {
|
|
95
|
+
"type": ["string", "null"]
|
|
96
|
+
},
|
|
97
|
+
"created_at": {
|
|
98
|
+
"type": "string",
|
|
99
|
+
"minLength": 10
|
|
100
|
+
},
|
|
101
|
+
"signature": {
|
|
102
|
+
"type": ["string", "null"],
|
|
103
|
+
"pattern": "^[0-9a-f]{64}$"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://smartindustries.dev/schemas/appecosystem/policy-state.v1.schema.json",
|
|
4
|
+
"title": "EcosystemPolicyStateV1",
|
|
5
|
+
"description": "Effective policy, restriction override, and freeze state rendered by <ecosystem-policy-bar> across all dashboards.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"schema_version",
|
|
9
|
+
"policy_version",
|
|
10
|
+
"mode",
|
|
11
|
+
"restrictions",
|
|
12
|
+
"frozen",
|
|
13
|
+
"always_enforced",
|
|
14
|
+
"authority",
|
|
15
|
+
"updated_at"
|
|
16
|
+
],
|
|
17
|
+
"additionalProperties": false,
|
|
18
|
+
"properties": {
|
|
19
|
+
"schema_version": {
|
|
20
|
+
"type": "integer",
|
|
21
|
+
"const": 1
|
|
22
|
+
},
|
|
23
|
+
"policy_version": {
|
|
24
|
+
"type": "integer",
|
|
25
|
+
"minimum": 1
|
|
26
|
+
},
|
|
27
|
+
"mode": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"enum": ["normal", "incident", "survival", "freeze", "maintenance"]
|
|
30
|
+
},
|
|
31
|
+
"restrictions": {
|
|
32
|
+
"type": "string",
|
|
33
|
+
"enum": ["on", "off_scoped"]
|
|
34
|
+
},
|
|
35
|
+
"frozen": {
|
|
36
|
+
"type": "boolean"
|
|
37
|
+
},
|
|
38
|
+
"freeze_confirmed": {
|
|
39
|
+
"type": "boolean",
|
|
40
|
+
"description": "Optional. Emitted as false only by a surface that froze itself locally and could not confirm delivery to the mesh; hub-originated state omits it. Renderers show such a freeze as local-only and keep Freeze available as a retry."
|
|
41
|
+
},
|
|
42
|
+
"freeze_durable": {
|
|
43
|
+
"type": "boolean",
|
|
44
|
+
"description": "Optional. Emitted as false only by a surface whose local freeze could not be written to disk and would be lost on restart."
|
|
45
|
+
},
|
|
46
|
+
"freeze_info": {
|
|
47
|
+
"type": ["object", "null"],
|
|
48
|
+
"required": ["initiated_by", "reason", "since"],
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"properties": {
|
|
51
|
+
"initiated_by": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1
|
|
54
|
+
},
|
|
55
|
+
"channel": {
|
|
56
|
+
"type": ["string", "null"]
|
|
57
|
+
},
|
|
58
|
+
"reason": {
|
|
59
|
+
"type": "string"
|
|
60
|
+
},
|
|
61
|
+
"since": {
|
|
62
|
+
"type": "string",
|
|
63
|
+
"minLength": 10
|
|
64
|
+
},
|
|
65
|
+
"acknowledged_devices": {
|
|
66
|
+
"type": "array",
|
|
67
|
+
"items": { "type": "string" }
|
|
68
|
+
},
|
|
69
|
+
"pending_devices": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"items": { "type": "string" }
|
|
72
|
+
},
|
|
73
|
+
"unreachable_devices": {
|
|
74
|
+
"type": "array",
|
|
75
|
+
"items": { "type": "string" }
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"active_override": {
|
|
80
|
+
"type": ["object", "null"],
|
|
81
|
+
"required": [
|
|
82
|
+
"grant_id",
|
|
83
|
+
"issued_by",
|
|
84
|
+
"reason",
|
|
85
|
+
"scope",
|
|
86
|
+
"bypassed",
|
|
87
|
+
"issued_at"
|
|
88
|
+
],
|
|
89
|
+
"additionalProperties": false,
|
|
90
|
+
"properties": {
|
|
91
|
+
"grant_id": {
|
|
92
|
+
"type": "string",
|
|
93
|
+
"minLength": 1
|
|
94
|
+
},
|
|
95
|
+
"issued_by": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"minLength": 1
|
|
98
|
+
},
|
|
99
|
+
"reason": {
|
|
100
|
+
"type": "string",
|
|
101
|
+
"minLength": 1
|
|
102
|
+
},
|
|
103
|
+
"scope": {
|
|
104
|
+
"type": "object",
|
|
105
|
+
"required": ["apps", "devices", "action_classes"],
|
|
106
|
+
"additionalProperties": false,
|
|
107
|
+
"properties": {
|
|
108
|
+
"apps": {
|
|
109
|
+
"type": "array",
|
|
110
|
+
"items": { "type": "string" }
|
|
111
|
+
},
|
|
112
|
+
"devices": {
|
|
113
|
+
"type": "array",
|
|
114
|
+
"items": { "type": "string" }
|
|
115
|
+
},
|
|
116
|
+
"action_classes": {
|
|
117
|
+
"type": "array",
|
|
118
|
+
"items": { "type": "string" }
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"bypassed": {
|
|
123
|
+
"type": "array",
|
|
124
|
+
"items": { "type": "string" }
|
|
125
|
+
},
|
|
126
|
+
"issued_at": {
|
|
127
|
+
"type": "string",
|
|
128
|
+
"minLength": 10
|
|
129
|
+
},
|
|
130
|
+
"expires_at": {
|
|
131
|
+
"type": ["string", "null"]
|
|
132
|
+
},
|
|
133
|
+
"applied_devices": {
|
|
134
|
+
"type": "array",
|
|
135
|
+
"items": { "type": "string" }
|
|
136
|
+
},
|
|
137
|
+
"pending_devices": {
|
|
138
|
+
"type": "array",
|
|
139
|
+
"items": { "type": "string" }
|
|
140
|
+
},
|
|
141
|
+
"unreachable_devices": {
|
|
142
|
+
"type": "array",
|
|
143
|
+
"items": { "type": "string" }
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"always_enforced": {
|
|
148
|
+
"type": "array",
|
|
149
|
+
"minItems": 1,
|
|
150
|
+
"items": {
|
|
151
|
+
"type": "string"
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"authority": {
|
|
155
|
+
"type": "string",
|
|
156
|
+
"enum": ["hub_synced", "standalone_local", "lease_expired"]
|
|
157
|
+
},
|
|
158
|
+
"updated_at": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"minLength": 10
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
package/src/_auth.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolve @smartindustriesllc/ecosystem-auth from node_modules when installed
|
|
5
|
+
* as a package, or fall back to the sibling monorepo auth/js source during
|
|
6
|
+
* local development and testing.
|
|
7
|
+
*/
|
|
8
|
+
const path = require("path");
|
|
9
|
+
|
|
10
|
+
let authModule;
|
|
11
|
+
try {
|
|
12
|
+
authModule = require("@smartindustriesllc/ecosystem-auth");
|
|
13
|
+
} catch {
|
|
14
|
+
authModule = require(path.resolve(__dirname, "../../auth/js/src/tokens"));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = authModule;
|
|
18
|
+
|
package/src/ai_profile.js
CHANGED