@magda/typescript-common 1.2.0-rc.0 → 2.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/dist/OpaCompileResponseParser.d.ts +147 -34
  2. package/dist/OpaCompileResponseParser.js +479 -293
  3. package/dist/OpaCompileResponseParser.js.map +1 -1
  4. package/dist/SQLUtils.d.ts +70 -0
  5. package/dist/SQLUtils.js +263 -0
  6. package/dist/SQLUtils.js.map +1 -0
  7. package/dist/ServerError.d.ts +9 -0
  8. package/dist/ServerError.js +17 -0
  9. package/dist/ServerError.js.map +1 -0
  10. package/dist/authorization-api/authMiddleware.d.ts +59 -1
  11. package/dist/authorization-api/authMiddleware.js +146 -3
  12. package/dist/authorization-api/authMiddleware.js.map +1 -1
  13. package/dist/authorization-api/constants.d.ts +5 -0
  14. package/dist/authorization-api/constants.js +13 -0
  15. package/dist/authorization-api/constants.js.map +1 -0
  16. package/dist/authorization-api/model.d.ts +1 -6
  17. package/dist/express/getNoCacheHeaders.d.ts +6 -0
  18. package/dist/express/getNoCacheHeaders.js +9 -0
  19. package/dist/express/getNoCacheHeaders.js.map +1 -0
  20. package/dist/express/setResponseNoCache.d.ts +3 -0
  21. package/dist/express/setResponseNoCache.js +9 -0
  22. package/dist/express/setResponseNoCache.js.map +1 -0
  23. package/dist/generated/registry/api.d.ts +36 -2
  24. package/dist/generated/registry/api.js +140 -2
  25. package/dist/generated/registry/api.js.map +1 -1
  26. package/dist/getAbsoluteUrl.d.ts +3 -2
  27. package/dist/getAbsoluteUrl.js +2 -1
  28. package/dist/getAbsoluteUrl.js.map +1 -1
  29. package/dist/opa/AspectQuery.d.ts +71 -0
  30. package/dist/opa/AspectQuery.js +216 -0
  31. package/dist/opa/AspectQuery.js.map +1 -0
  32. package/dist/opa/AuthDecision.d.ts +51 -0
  33. package/dist/opa/AuthDecision.js +241 -0
  34. package/dist/opa/AuthDecision.js.map +1 -0
  35. package/dist/opa/AuthDecisionQueryClient.d.ts +23 -0
  36. package/dist/opa/AuthDecisionQueryClient.js +110 -0
  37. package/dist/opa/AuthDecisionQueryClient.js.map +1 -0
  38. package/dist/pgTypes.d.ts +1 -0
  39. package/dist/pgTypes.js +18 -0
  40. package/dist/pgTypes.js.map +1 -0
  41. package/dist/registry/AuthorizedRegistryClient.d.ts +1 -0
  42. package/dist/registry/AuthorizedRegistryClient.js +17 -0
  43. package/dist/registry/AuthorizedRegistryClient.js.map +1 -1
  44. package/dist/registry/RegistryClient.d.ts +10 -0
  45. package/dist/registry/RegistryClient.js +32 -0
  46. package/dist/registry/RegistryClient.js.map +1 -1
  47. package/dist/test/getAuthDecision.spec.js +2 -2
  48. package/dist/test/getAuthDecision.spec.js.map +1 -1
  49. package/dist/test/sampleAuthDecisions/content.json +29 -0
  50. package/dist/test/sampleAuthDecisions/datasetPermissionWithOrgUnitConstraint.json +79 -0
  51. package/dist/test/sampleAuthDecisions/simple.json +29 -0
  52. package/dist/test/sampleAuthDecisions/singleTermAspectRef.json +39 -0
  53. package/dist/test/sampleAuthDecisions/unconditionalFalseSimple.json +6 -0
  54. package/dist/test/sampleAuthDecisions/unconditionalNotMacthed.json +6 -0
  55. package/dist/test/sampleAuthDecisions/unconditionalNotMacthedWithExtraRefs.json +6 -0
  56. package/dist/test/sampleAuthDecisions/unconditionalTrue.json +6 -0
  57. package/dist/test/sampleAuthDecisions/unconditionalTrueSimple.json +6 -0
  58. package/dist/test/sampleAuthDecisions/unconditionalTrueWithDefaultRule.json +6 -0
  59. package/dist/test/sampleAuthDecisions/withDefaultRule.json +6 -0
  60. package/dist/test/{sampleOpaResponse.json → sampleOpaResponses/content.json} +0 -0
  61. package/dist/test/sampleOpaResponses/datasetPermissionWithOrgUnitConstraint.json +341 -0
  62. package/dist/test/{sampleOpaResponseSimple.json → sampleOpaResponses/simple.json} +0 -0
  63. package/dist/test/sampleOpaResponses/singleTermAspectRef.json +233 -0
  64. package/dist/test/sampleOpaResponses/unconditionalFalseSimple.json +3 -0
  65. package/dist/test/sampleOpaResponses/unconditionalNotMacthed.json +73 -0
  66. package/dist/test/sampleOpaResponses/unconditionalNotMacthedWithExtraRefs.json +155 -0
  67. package/dist/test/{sampleOpaResponseUnconditionalTrue.json → sampleOpaResponses/unconditionalTrue.json} +0 -0
  68. package/dist/test/sampleOpaResponses/unconditionalTrueSimple.json +48 -0
  69. package/dist/test/{sampleOpaResponseUnconditionalTrueWithDefaultRule.json → sampleOpaResponses/unconditionalTrueWithDefaultRule.json} +0 -0
  70. package/dist/test/{sampleOpaResponseWithDefaultRule.json → sampleOpaResponses/withDefaultRule.json} +0 -0
  71. package/dist/test/testOpaCompileResponseParser.spec.js +195 -20
  72. package/dist/test/testOpaCompileResponseParser.spec.js.map +1 -1
  73. package/package.json +7 -3
@@ -0,0 +1,233 @@
1
+ {
2
+ "result": {
3
+ "queries": [
4
+ [
5
+ {
6
+ "terms": {
7
+ "type": "ref",
8
+ "value": [
9
+ {
10
+ "type": "var",
11
+ "value": "data"
12
+ },
13
+ {
14
+ "type": "string",
15
+ "value": "partial"
16
+ },
17
+ {
18
+ "type": "string",
19
+ "value": "entrypoint"
20
+ },
21
+ {
22
+ "type": "string",
23
+ "value": "allow"
24
+ }
25
+ ]
26
+ },
27
+ "index": 0
28
+ }
29
+ ]
30
+ ],
31
+ "support": [
32
+ {
33
+ "package": {
34
+ "path": [
35
+ {
36
+ "type": "var",
37
+ "value": "data"
38
+ },
39
+ {
40
+ "type": "string",
41
+ "value": "partial"
42
+ },
43
+ {
44
+ "type": "string",
45
+ "value": "object"
46
+ },
47
+ {
48
+ "type": "string",
49
+ "value": "record"
50
+ }
51
+ ]
52
+ },
53
+ "rules": [
54
+ {
55
+ "default": true,
56
+ "head": {
57
+ "name": "allow",
58
+ "value": {
59
+ "type": "boolean",
60
+ "value": false
61
+ }
62
+ },
63
+ "body": [
64
+ {
65
+ "terms": {
66
+ "type": "boolean",
67
+ "value": true
68
+ },
69
+ "index": 0
70
+ }
71
+ ]
72
+ },
73
+ {
74
+ "head": {
75
+ "name": "allow",
76
+ "value": {
77
+ "type": "boolean",
78
+ "value": true
79
+ }
80
+ },
81
+ "body": [
82
+ {
83
+ "terms": {
84
+ "type": "ref",
85
+ "value": [
86
+ {
87
+ "type": "var",
88
+ "value": "input"
89
+ },
90
+ {
91
+ "type": "string",
92
+ "value": "object"
93
+ },
94
+ {
95
+ "type": "string",
96
+ "value": "record"
97
+ },
98
+ {
99
+ "type": "string",
100
+ "value": "dcat-dataset-strings"
101
+ }
102
+ ]
103
+ },
104
+ "index": 0
105
+ },
106
+ {
107
+ "terms": [
108
+ {
109
+ "type": "ref",
110
+ "value": [
111
+ {
112
+ "type": "var",
113
+ "value": "eq"
114
+ }
115
+ ]
116
+ },
117
+ {
118
+ "type": "ref",
119
+ "value": [
120
+ {
121
+ "type": "var",
122
+ "value": "input"
123
+ },
124
+ {
125
+ "type": "string",
126
+ "value": "object"
127
+ },
128
+ {
129
+ "type": "string",
130
+ "value": "record"
131
+ },
132
+ {
133
+ "type": "string",
134
+ "value": "publishing"
135
+ },
136
+ {
137
+ "type": "string",
138
+ "value": "state"
139
+ }
140
+ ]
141
+ },
142
+ {
143
+ "type": "string",
144
+ "value": "published"
145
+ }
146
+ ],
147
+ "index": 1
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ },
153
+ {
154
+ "package": {
155
+ "path": [
156
+ {
157
+ "type": "var",
158
+ "value": "data"
159
+ },
160
+ {
161
+ "type": "string",
162
+ "value": "partial"
163
+ },
164
+ {
165
+ "type": "string",
166
+ "value": "entrypoint"
167
+ }
168
+ ]
169
+ },
170
+ "rules": [
171
+ {
172
+ "default": true,
173
+ "head": {
174
+ "name": "allow",
175
+ "value": {
176
+ "type": "boolean",
177
+ "value": false
178
+ }
179
+ },
180
+ "body": [
181
+ {
182
+ "terms": {
183
+ "type": "boolean",
184
+ "value": true
185
+ },
186
+ "index": 0
187
+ }
188
+ ]
189
+ },
190
+ {
191
+ "head": {
192
+ "name": "allow",
193
+ "value": {
194
+ "type": "boolean",
195
+ "value": true
196
+ }
197
+ },
198
+ "body": [
199
+ {
200
+ "terms": {
201
+ "type": "ref",
202
+ "value": [
203
+ {
204
+ "type": "var",
205
+ "value": "data"
206
+ },
207
+ {
208
+ "type": "string",
209
+ "value": "partial"
210
+ },
211
+ {
212
+ "type": "string",
213
+ "value": "object"
214
+ },
215
+ {
216
+ "type": "string",
217
+ "value": "record"
218
+ },
219
+ {
220
+ "type": "string",
221
+ "value": "allow"
222
+ }
223
+ ]
224
+ },
225
+ "index": 0
226
+ }
227
+ ]
228
+ }
229
+ ]
230
+ }
231
+ ]
232
+ }
233
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "result": {}
3
+ }
@@ -0,0 +1,73 @@
1
+ {
2
+ "result": {
3
+ "queries": [
4
+ [
5
+ {
6
+ "terms": {
7
+ "type": "ref",
8
+ "value": [
9
+ {
10
+ "type": "var",
11
+ "value": "data"
12
+ },
13
+ {
14
+ "type": "string",
15
+ "value": "partial"
16
+ },
17
+ {
18
+ "type": "string",
19
+ "value": "entrypoint"
20
+ },
21
+ {
22
+ "type": "string",
23
+ "value": "allow"
24
+ }
25
+ ]
26
+ },
27
+ "index": 0
28
+ }
29
+ ]
30
+ ],
31
+ "support": [
32
+ {
33
+ "package": {
34
+ "path": [
35
+ {
36
+ "type": "var",
37
+ "value": "data"
38
+ },
39
+ {
40
+ "type": "string",
41
+ "value": "partial"
42
+ },
43
+ {
44
+ "type": "string",
45
+ "value": "entrypoint"
46
+ }
47
+ ]
48
+ },
49
+ "rules": [
50
+ {
51
+ "default": true,
52
+ "head": {
53
+ "name": "allow",
54
+ "value": {
55
+ "type": "boolean",
56
+ "value": false
57
+ }
58
+ },
59
+ "body": [
60
+ {
61
+ "terms": {
62
+ "type": "boolean",
63
+ "value": true
64
+ },
65
+ "index": 0
66
+ }
67
+ ]
68
+ }
69
+ ]
70
+ }
71
+ ]
72
+ }
73
+ }
@@ -0,0 +1,155 @@
1
+ {
2
+ "result": {
3
+ "queries": [
4
+ [
5
+ {
6
+ "terms": {
7
+ "type": "ref",
8
+ "value": [
9
+ {
10
+ "type": "var",
11
+ "value": "data"
12
+ },
13
+ {
14
+ "type": "string",
15
+ "value": "partial"
16
+ },
17
+ {
18
+ "type": "string",
19
+ "value": "entrypoint"
20
+ },
21
+ {
22
+ "type": "string",
23
+ "value": "allow"
24
+ }
25
+ ]
26
+ },
27
+ "index": 0
28
+ }
29
+ ]
30
+ ],
31
+ "support": [
32
+ {
33
+ "package": {
34
+ "path": [
35
+ {
36
+ "type": "var",
37
+ "value": "data"
38
+ },
39
+ {
40
+ "type": "string",
41
+ "value": "partial"
42
+ },
43
+ {
44
+ "type": "string",
45
+ "value": "object"
46
+ },
47
+ {
48
+ "type": "string",
49
+ "value": "dataset"
50
+ }
51
+ ]
52
+ },
53
+ "rules": [
54
+ {
55
+ "default": true,
56
+ "head": {
57
+ "name": "allow",
58
+ "value": {
59
+ "type": "boolean",
60
+ "value": false
61
+ }
62
+ },
63
+ "body": [
64
+ {
65
+ "terms": {
66
+ "type": "boolean",
67
+ "value": true
68
+ },
69
+ "index": 0
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ },
75
+ {
76
+ "package": {
77
+ "path": [
78
+ {
79
+ "type": "var",
80
+ "value": "data"
81
+ },
82
+ {
83
+ "type": "string",
84
+ "value": "partial"
85
+ },
86
+ {
87
+ "type": "string",
88
+ "value": "entrypoint"
89
+ }
90
+ ]
91
+ },
92
+ "rules": [
93
+ {
94
+ "default": true,
95
+ "head": {
96
+ "name": "allow",
97
+ "value": {
98
+ "type": "boolean",
99
+ "value": false
100
+ }
101
+ },
102
+ "body": [
103
+ {
104
+ "terms": {
105
+ "type": "boolean",
106
+ "value": true
107
+ },
108
+ "index": 0
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ "head": {
114
+ "name": "allow",
115
+ "value": {
116
+ "type": "boolean",
117
+ "value": true
118
+ }
119
+ },
120
+ "body": [
121
+ {
122
+ "terms": {
123
+ "type": "ref",
124
+ "value": [
125
+ {
126
+ "type": "var",
127
+ "value": "data"
128
+ },
129
+ {
130
+ "type": "string",
131
+ "value": "partial"
132
+ },
133
+ {
134
+ "type": "string",
135
+ "value": "object"
136
+ },
137
+ {
138
+ "type": "string",
139
+ "value": "dataset"
140
+ },
141
+ {
142
+ "type": "string",
143
+ "value": "allow"
144
+ }
145
+ ]
146
+ },
147
+ "index": 0
148
+ }
149
+ ]
150
+ }
151
+ ]
152
+ }
153
+ ]
154
+ }
155
+ }
@@ -0,0 +1,48 @@
1
+ {
2
+ "result": {
3
+ "queries": [
4
+ [],
5
+ [
6
+ {
7
+ "index": 0,
8
+ "terms": [
9
+ {
10
+ "type": "ref",
11
+ "value": [
12
+ {
13
+ "type": "var",
14
+ "value": "gte"
15
+ }
16
+ ]
17
+ },
18
+ {
19
+ "type": "number",
20
+ "value": 4
21
+ },
22
+ {
23
+ "type": "ref",
24
+ "value": [
25
+ {
26
+ "type": "var",
27
+ "value": "data"
28
+ },
29
+ {
30
+ "type": "string",
31
+ "value": "reports"
32
+ },
33
+ {
34
+ "type": "var",
35
+ "value": "$02"
36
+ },
37
+ {
38
+ "type": "string",
39
+ "value": "clearance_level"
40
+ }
41
+ ]
42
+ }
43
+ ]
44
+ }
45
+ ]
46
+ ]
47
+ }
48
+ }