@sasjs/api 0.27.1 → 0.29.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.
package/build/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.27.1 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.29.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
2
2
  "use strict";
3
3
  var SASjsApi = (() => {
4
4
  var __defProp = Object.defineProperty;
@@ -6559,15 +6559,18 @@ var SASjsApi = (() => {
6559
6559
  },
6560
6560
  // ------------------------------------------- the uploaded-archive route
6561
6561
  // The archive is expanded by the host, so what arrives here is the same tree
6562
- // `POST /deploy` takes - which is why every answer below matches its twin.
6562
+ // `POST /deploy` takes - which is why every answer below matches its twin. The
6563
+ // folder and the stream are stated in the QUERY, where the document puts them on
6564
+ // this route: the body is the archive. A host that receives an archive builds it
6565
+ // from the tree below; the tree is what the archive has to expand to.
6563
6566
  {
6564
6567
  id: "upload-tree",
6565
6568
  route: "POST /SASjsApi/drive/deploy/upload",
6566
6569
  description: "writes the tree an uploaded archive expanded to",
6567
6570
  request: {
6568
6571
  subject: SUBJECT,
6572
+ query: { appLoc: "/Public/apps/uploaded" },
6569
6573
  body: {
6570
- appLoc: "/Public/apps/uploaded",
6571
6574
  fileTree: {
6572
6575
  members: [
6573
6576
  {
@@ -6650,8 +6653,8 @@ var SASjsApi = (() => {
6650
6653
  description: "writes a file member as its own text when no encoding is stated",
6651
6654
  request: {
6652
6655
  subject: SUBJECT,
6656
+ query: { appLoc: "/Public/apps/text" },
6653
6657
  body: {
6654
- appLoc: "/Public/apps/text",
6655
6658
  fileTree: {
6656
6659
  members: [
6657
6660
  { name: "index.html", type: "file", code: "<h1>Hello</h1>" }
@@ -6671,9 +6674,12 @@ var SASjsApi = (() => {
6671
6674
  id: "upload-refused-by-shape",
6672
6675
  route: "POST /SASjsApi/drive/deploy/upload",
6673
6676
  description: "refuses an expansion that is not a tree",
6677
+ // no archive expands to this: only a host handed an expansion can send it
6678
+ transport: "expansion",
6674
6679
  request: {
6675
6680
  subject: SUBJECT,
6676
- body: { appLoc: "/Public/apps/bad", fileTree: { members: 1 } }
6681
+ query: { appLoc: "/Public/apps/bad" },
6682
+ body: { fileTree: { members: 1 } }
6677
6683
  },
6678
6684
  expect: {
6679
6685
  status: 400,
@@ -6690,8 +6696,8 @@ var SASjsApi = (() => {
6690
6696
  description: "applies the deploy cap to the expanded tree, not the bytes",
6691
6697
  request: {
6692
6698
  subject: SUBJECT,
6699
+ query: { appLoc: "/Public/apps/many" },
6693
6700
  body: {
6694
- appLoc: "/Public/apps/many",
6695
6701
  fileTree: { members: manyMembers2(10001) }
6696
6702
  }
6697
6703
  },
@@ -6777,8 +6783,8 @@ var SASjsApi = (() => {
6777
6783
  unwritable: true,
6778
6784
  request: {
6779
6785
  subject: SUBJECT,
6786
+ query: { appLoc: "/Public/apps/demo" },
6780
6787
  body: {
6781
- appLoc: "/Public/apps/demo",
6782
6788
  fileTree: {
6783
6789
  members: [{ name: "run", type: "service", code: "%put hi;" }]
6784
6790
  }
@@ -44,15 +44,18 @@ exports.DEPLOY_CORPUS = [
44
44
  },
45
45
  // ------------------------------------------- the uploaded-archive route
46
46
  // The archive is expanded by the host, so what arrives here is the same tree
47
- // `POST /deploy` takes - which is why every answer below matches its twin.
47
+ // `POST /deploy` takes - which is why every answer below matches its twin. The
48
+ // folder and the stream are stated in the QUERY, where the document puts them on
49
+ // this route: the body is the archive. A host that receives an archive builds it
50
+ // from the tree below; the tree is what the archive has to expand to.
48
51
  {
49
52
  id: 'upload-tree',
50
53
  route: 'POST /SASjsApi/drive/deploy/upload',
51
54
  description: 'writes the tree an uploaded archive expanded to',
52
55
  request: {
53
56
  subject: SUBJECT,
57
+ query: { appLoc: '/Public/apps/uploaded' },
54
58
  body: {
55
- appLoc: '/Public/apps/uploaded',
56
59
  fileTree: {
57
60
  members: [
58
61
  {
@@ -135,8 +138,8 @@ exports.DEPLOY_CORPUS = [
135
138
  description: 'writes a file member as its own text when no encoding is stated',
136
139
  request: {
137
140
  subject: SUBJECT,
141
+ query: { appLoc: '/Public/apps/text' },
138
142
  body: {
139
- appLoc: '/Public/apps/text',
140
143
  fileTree: {
141
144
  members: [
142
145
  { name: 'index.html', type: 'file', code: '<h1>Hello</h1>' }
@@ -156,9 +159,12 @@ exports.DEPLOY_CORPUS = [
156
159
  id: 'upload-refused-by-shape',
157
160
  route: 'POST /SASjsApi/drive/deploy/upload',
158
161
  description: 'refuses an expansion that is not a tree',
162
+ // no archive expands to this: only a host handed an expansion can send it
163
+ transport: 'expansion',
159
164
  request: {
160
165
  subject: SUBJECT,
161
- body: { appLoc: '/Public/apps/bad', fileTree: { members: 1 } }
166
+ query: { appLoc: '/Public/apps/bad' },
167
+ body: { fileTree: { members: 1 } }
162
168
  },
163
169
  expect: {
164
170
  status: 400,
@@ -175,8 +181,8 @@ exports.DEPLOY_CORPUS = [
175
181
  description: 'applies the deploy cap to the expanded tree, not the bytes',
176
182
  request: {
177
183
  subject: SUBJECT,
184
+ query: { appLoc: '/Public/apps/many' },
178
185
  body: {
179
- appLoc: '/Public/apps/many',
180
186
  fileTree: { members: manyMembers(10001) }
181
187
  }
182
188
  },
@@ -262,8 +268,8 @@ exports.DEPLOY_CORPUS = [
262
268
  unwritable: true,
263
269
  request: {
264
270
  subject: SUBJECT,
271
+ query: { appLoc: '/Public/apps/demo' },
265
272
  body: {
266
- appLoc: '/Public/apps/demo',
267
273
  fileTree: {
268
274
  members: [{ name: 'run', type: 'service', code: '%put hi;' }]
269
275
  }
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/corpus/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAW5C,eAAO,MAAM,aAAa,EAAE,UAAU,EAkVrC,CAAA"}
1
+ {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/corpus/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAW5C,eAAO,MAAM,aAAa,EAAE,UAAU,EAwVrC,CAAA"}
@@ -41,15 +41,18 @@ export const DEPLOY_CORPUS = [
41
41
  },
42
42
  // ------------------------------------------- the uploaded-archive route
43
43
  // The archive is expanded by the host, so what arrives here is the same tree
44
- // `POST /deploy` takes - which is why every answer below matches its twin.
44
+ // `POST /deploy` takes - which is why every answer below matches its twin. The
45
+ // folder and the stream are stated in the QUERY, where the document puts them on
46
+ // this route: the body is the archive. A host that receives an archive builds it
47
+ // from the tree below; the tree is what the archive has to expand to.
45
48
  {
46
49
  id: 'upload-tree',
47
50
  route: 'POST /SASjsApi/drive/deploy/upload',
48
51
  description: 'writes the tree an uploaded archive expanded to',
49
52
  request: {
50
53
  subject: SUBJECT,
54
+ query: { appLoc: '/Public/apps/uploaded' },
51
55
  body: {
52
- appLoc: '/Public/apps/uploaded',
53
56
  fileTree: {
54
57
  members: [
55
58
  {
@@ -132,8 +135,8 @@ export const DEPLOY_CORPUS = [
132
135
  description: 'writes a file member as its own text when no encoding is stated',
133
136
  request: {
134
137
  subject: SUBJECT,
138
+ query: { appLoc: '/Public/apps/text' },
135
139
  body: {
136
- appLoc: '/Public/apps/text',
137
140
  fileTree: {
138
141
  members: [
139
142
  { name: 'index.html', type: 'file', code: '<h1>Hello</h1>' }
@@ -153,9 +156,12 @@ export const DEPLOY_CORPUS = [
153
156
  id: 'upload-refused-by-shape',
154
157
  route: 'POST /SASjsApi/drive/deploy/upload',
155
158
  description: 'refuses an expansion that is not a tree',
159
+ // no archive expands to this: only a host handed an expansion can send it
160
+ transport: 'expansion',
156
161
  request: {
157
162
  subject: SUBJECT,
158
- body: { appLoc: '/Public/apps/bad', fileTree: { members: 1 } }
163
+ query: { appLoc: '/Public/apps/bad' },
164
+ body: { fileTree: { members: 1 } }
159
165
  },
160
166
  expect: {
161
167
  status: 400,
@@ -172,8 +178,8 @@ export const DEPLOY_CORPUS = [
172
178
  description: 'applies the deploy cap to the expanded tree, not the bytes',
173
179
  request: {
174
180
  subject: SUBJECT,
181
+ query: { appLoc: '/Public/apps/many' },
175
182
  body: {
176
- appLoc: '/Public/apps/many',
177
183
  fileTree: { members: manyMembers(10001) }
178
184
  }
179
185
  },
@@ -259,8 +265,8 @@ export const DEPLOY_CORPUS = [
259
265
  unwritable: true,
260
266
  request: {
261
267
  subject: SUBJECT,
268
+ query: { appLoc: '/Public/apps/demo' },
262
269
  body: {
263
- appLoc: '/Public/apps/demo',
264
270
  fileTree: {
265
271
  members: [{ name: 'run', type: 'service', code: '%put hi;' }]
266
272
  }
@@ -42,6 +42,16 @@ export interface CorpusCase {
42
42
  };
43
43
  /** The run fails, so a case can pin the `400` a failed run answers. */
44
44
  failingRun?: boolean;
45
+ /**
46
+ * Which host transport can produce this request, where only one can.
47
+ *
48
+ * Most cases are reachable either way: a host that expands an archive before it
49
+ * dispatches, and one that takes the archive and expands it itself. A case whose
50
+ * request no archive could produce - a tree that is not a tree - is reachable
51
+ * only by the first, and says so here rather than in the filter of each host that
52
+ * runs the corpus.
53
+ */
54
+ transport?: 'expansion' | 'archive';
45
55
  /**
46
56
  * The state the case leaves in the drive, where a status cannot see it.
47
57
  *
@@ -1 +1 @@
1
- {"version":3,"file":"drive.d.ts","sourceRoot":"","sources":["../../../src/corpus/drive.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAE7D,MAAM,WAAW,UAAU;IACzB,6CAA6C;IAC7C,EAAE,EAAE,MAAM,CAAA;IACV,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAA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,MAAM,EAAE,CAAA;QACf;;;;;;;;;WASG;QACH,KAAK,CAAC,EAAE;YACN,QAAQ,EAAE,MAAM,EAAE,CAAA;YAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;SACpB,CAAA;QACD;;;;;;;WAOG;QACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAC3B,CAAA;CACF;AAmBD,eAAO,MAAM,YAAY,EAAE,UAAU,EAwapC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.27.1",
3
+ "version": "0.29.0",
4
4
  "description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
5
5
  "license": "MIT",
6
6
  "author": "SASjs",
@@ -38,8 +38,8 @@
38
38
  "test": "jest --coverage",
39
39
  "coverage:comment": "node scripts/coverage-comment.mjs",
40
40
  "test:watch": "jest --watch",
41
- "lint": "prettier --check \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
42
- "lint:fix": "prettier --write \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
41
+ "lint": "prettier --check \"{src,spec,scripts,tools}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
42
+ "lint:fix": "prettier --write \"{src,spec,scripts,tools}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
43
43
  "sync:routes": "node scripts/sync-routes.mjs",
44
44
  "check:routes": "node scripts/sync-routes.mjs --check",
45
45
  "audit:gate": "node scripts/audit.mjs",