@sasjs/api 0.39.0 → 0.40.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.
Files changed (38) hide show
  1. package/build/browser.js +513 -234
  2. package/build/cjs/appstream/bundle.js +125 -54
  3. package/build/cjs/appstream/service.js +140 -65
  4. package/build/cjs/appstream/store.js +12 -5
  5. package/build/cjs/appstream/web.js +17 -4
  6. package/build/cjs/corpus/app.js +37 -0
  7. package/build/cjs/corpus/deploy.js +113 -0
  8. package/build/cjs/corpus/runner.js +1 -1
  9. package/build/cjs/host/dispatch.js +59 -11
  10. package/build/cjs/index.js +8 -2
  11. package/build/cjs/routes/generated.js +13 -1
  12. package/build/esm/appstream/bundle.d.ts +56 -12
  13. package/build/esm/appstream/bundle.d.ts.map +1 -1
  14. package/build/esm/appstream/bundle.js +124 -53
  15. package/build/esm/appstream/service.d.ts +51 -11
  16. package/build/esm/appstream/service.d.ts.map +1 -1
  17. package/build/esm/appstream/service.js +137 -64
  18. package/build/esm/appstream/store.d.ts.map +1 -1
  19. package/build/esm/appstream/store.js +12 -5
  20. package/build/esm/appstream/web.d.ts +11 -1
  21. package/build/esm/appstream/web.d.ts.map +1 -1
  22. package/build/esm/appstream/web.js +15 -3
  23. package/build/esm/corpus/app.d.ts.map +1 -1
  24. package/build/esm/corpus/app.js +37 -0
  25. package/build/esm/corpus/deploy.d.ts.map +1 -1
  26. package/build/esm/corpus/deploy.js +113 -0
  27. package/build/esm/corpus/drive.d.ts +9 -0
  28. package/build/esm/corpus/drive.d.ts.map +1 -1
  29. package/build/esm/corpus/runner.d.ts.map +1 -1
  30. package/build/esm/corpus/runner.js +1 -1
  31. package/build/esm/host/dispatch.d.ts.map +1 -1
  32. package/build/esm/host/dispatch.js +60 -12
  33. package/build/esm/index.d.ts +3 -3
  34. package/build/esm/index.d.ts.map +1 -1
  35. package/build/esm/index.js +3 -3
  36. package/build/esm/routes/generated.d.ts.map +1 -1
  37. package/build/esm/routes/generated.js +13 -1
  38. package/package.json +1 -1
@@ -17,11 +17,18 @@ const isEntry = (value) => {
17
17
  if (typeof value !== 'object' || value === null)
18
18
  return false;
19
19
  const entry = value;
20
- return (typeof entry.id === 'string' &&
21
- typeof entry.name === 'string' &&
22
- typeof entry.appLoc === 'string' &&
23
- typeof entry.streamWebFolder === 'string' &&
24
- typeof entry.publishedAt === 'string');
20
+ if (typeof entry.id !== 'string' ||
21
+ typeof entry.name !== 'string' ||
22
+ typeof entry.publishedAt !== 'string')
23
+ return false;
24
+ if (entry.appLoc !== undefined && typeof entry.appLoc !== 'string')
25
+ return false;
26
+ if (entry.streamWebFolder !== undefined &&
27
+ typeof entry.streamWebFolder !== 'string')
28
+ return false;
29
+ // the legacy shape states where the assets are, so it needs both halves: a
30
+ // `streamWebFolder` with no `appLoc` names no folder at all
31
+ return !(entry.streamWebFolder !== undefined && entry.appLoc === undefined);
25
32
  };
26
33
  export const createDriveAppStreamStore = (drive, filePath = APP_STREAM_INDEX) => ({
27
34
  async read() {
@@ -8,7 +8,8 @@ export declare const NO_SUCH_APP = "There's no App Stream available here.";
8
8
  export interface AppStreamApp {
9
9
  id: string;
10
10
  name: string;
11
- appLoc: string;
11
+ /** The backend this frontend calls, or null when it names none. */
12
+ appLoc: string | null;
12
13
  /** An asset inside the app, addressed from the app's own URL. */
13
14
  logo: string | null;
14
15
  /** The app's URL, `/app/<id>/`. */
@@ -70,5 +71,14 @@ export declare const contentTypeFor: (filePath: string) => string;
70
71
  * the previous deployment's shell against the new bundle.
71
72
  */
72
73
  export declare const cacheControlFor: (filePath: string) => string;
74
+ /**
75
+ * Where an entry's files are read from.
76
+ *
77
+ * A frontend lives in one folder named after the app - `apps/<name>` - so the
78
+ * entry records nothing about it, and moving a frontend is a delete and a publish.
79
+ * A legacy entry states its own location, because that is where its deployment put
80
+ * it: `<appLoc>/services/<streamWebFolder>`.
81
+ */
82
+ export declare const appRootOf: (entry: AppStreamEntry) => string;
73
83
  export declare const createAppStreamWebService: (appStream: AppStreamService, drive: DriveService, options?: AppStreamWebOptions) => AppStreamWebService;
74
84
  //# sourceMappingURL=web.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"web.d.ts","sourceRoot":"","sources":["../../../src/appstream/web.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpE,iEAAiE;AACjE,eAAO,MAAM,gBAAgB,SAAS,CAAA;AAEtC,iFAAiF;AACjF,eAAO,MAAM,WAAW,0CAA0C,CAAA;AAElE,uEAAuE;AACvE,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;IACd,iEAAiE;IACjE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,mCAAmC;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;CAC3B;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,sCAAsC;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,uEAAuE;AACvE,MAAM,MAAM,SAAS,GAAG,CAAC,KAAK,EAAE,cAAc,KAAK,OAAO,CAAA;AAE1D,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAA;IACd,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED,MAAM,WAAW,mBAAmB;IAClC,4BAA4B;IAC5B,I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qE;AACrE,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,MAIjD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,MAGT,CAAA;AAmC1C;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,KAAG,MAGhB,CAAA;AAElC,eAAO,MAAM,yBAAyB,GACpC,WAAW,gBAAgB,EAC3B,OAAO,YAAY,EACnB,UAAS,mBAAwB,KAChC,mBAoLF,CAAA"}
@@ -19,6 +19,7 @@
19
19
  * and neither the URL nor the lookup has to care.
20
20
  */
21
21
  import { ApiError } from '../types.js';
22
+ import { frontendFolderOf } from './service.js';
22
23
  /** Where the surface lives unless a host mounts it elsewhere. */
23
24
  export const DEFAULT_APP_PATH = '/app';
24
25
  /** The words a caller sees when there is nothing at the address it asked for. */
@@ -106,6 +107,17 @@ const decoded = (segment) => {
106
107
  return undefined;
107
108
  }
108
109
  };
110
+ /**
111
+ * Where an entry's files are read from.
112
+ *
113
+ * A frontend lives in one folder named after the app - `apps/<name>` - so the
114
+ * entry records nothing about it, and moving a frontend is a delete and a publish.
115
+ * A legacy entry states its own location, because that is where its deployment put
116
+ * it: `<appLoc>/services/<streamWebFolder>`.
117
+ */
118
+ export const appRootOf = (entry) => entry.streamWebFolder !== undefined && entry.appLoc !== undefined
119
+ ? `${entry.appLoc}/services/${entry.streamWebFolder}`
120
+ : frontendFolderOf(entry.name);
109
121
  export const createAppStreamWebService = (appStream, drive, options = {}) => {
110
122
  const base = (options.basePath ?? DEFAULT_APP_PATH).replace(/\/+$/, '');
111
123
  const title = options.title ?? 'SASjs App Stream';
@@ -113,7 +125,7 @@ export const createAppStreamWebService = (appStream, drive, options = {}) => {
113
125
  const rowOf = (entry) => ({
114
126
  id: entry.id,
115
127
  name: entry.name,
116
- appLoc: entry.appLoc,
128
+ appLoc: entry.appLoc ?? null,
117
129
  logo: entry.logo === undefined ? null : `${urlOf(entry)}${entry.logo}`,
118
130
  url: urlOf(entry),
119
131
  publishedAt: entry.publishedAt ?? null
@@ -127,7 +139,7 @@ export const createAppStreamWebService = (appStream, drive, options = {}) => {
127
139
  const tiles = rows.length
128
140
  ? `<ul class="apps">${rows
129
141
  .map((row) => `<li><a href="${escapeHtml(row.url)}">${escapeHtml(row.name)}</a>` +
130
- `<span class="loc">${escapeHtml(row.appLoc)}</span></li>`)
142
+ `<span class="loc">${escapeHtml(row.appLoc ?? frontendFolderOf(row.name))}</span></li>`)
131
143
  .join('')}</ul>`
132
144
  : '<p class="empty">No apps have been published yet.</p>';
133
145
  return html(200, [
@@ -172,7 +184,7 @@ export const createAppStreamWebService = (appStream, drive, options = {}) => {
172
184
  return noSuchApp();
173
185
  const relative = parts.join('/') || 'index.html';
174
186
  try {
175
- const file = await drive.read(`${entry.appLoc}/services/${entry.streamWebFolder}/${relative}`);
187
+ const file = await drive.read(`${appRootOf(entry)}/${relative}`);
176
188
  return {
177
189
  status: 200,
178
190
  body: file.contents,
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/corpus/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAQ5C,eAAO,MAAM,UAAU,EAAE,UAAU,EAkDlC,CAAA"}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/corpus/app.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAyB5C,eAAO,MAAM,UAAU,EAAE,UAAU,EAyElC,CAAA"}
@@ -1,5 +1,20 @@
1
1
  import { CORPUS_APP } from './runner.js';
2
2
  const SUBJECT = { userId: 'user-admin', clientId: 'web_app' };
3
+ /**
4
+ * An app published as a frontend with no backend named.
5
+ *
6
+ * `streamWebFolder` is what tells the two shapes apart: an entry carrying it is
7
+ * served from `<appLoc>/services/<streamWebFolder>`, and every other entry from
8
+ * `apps/<name>`. `appLoc` is the backend a frontend calls, so it is absent here
9
+ * because this app calls none.
10
+ */
11
+ const FRONTEND_APP = {
12
+ id: '9d8c7b6a-5f4e-4d3c-8b2a-1f0e9d8c7b6a',
13
+ name: 'frontend-only',
14
+ publishedAt: '2026-02-02T00:00:00.000Z'
15
+ };
16
+ /** Where that app's files are read from, which nothing on the entry records. */
17
+ const FRONTEND_ENTRY_FILE = `/apps/${FRONTEND_APP.name}/index.html`;
3
18
  /** Where the app's streamed entry file sits inside its folder. */
4
19
  const ENTRY_FILE_PATH = `${CORPUS_APP.appLoc}/services/${CORPUS_APP.streamWebFolder}/index.html`;
5
20
  export const APP_CORPUS = [
@@ -28,6 +43,28 @@ export const APP_CORPUS = [
28
43
  }
29
44
  }
30
45
  },
46
+ {
47
+ id: 'app-detail-frontend',
48
+ route: 'GET /SASjsApi/app/{id}',
49
+ description: 'describes an app published as a frontend, from the folder its name derives',
50
+ // the two shapes an index can hold, and the folder each is read from: this
51
+ // entry names no `appLoc` and no `streamWebFolder`, so the folder has to come
52
+ // from the name
53
+ appStream: [FRONTEND_APP],
54
+ seed: { [FRONTEND_ENTRY_FILE]: '<!doctype html><title>frontend</title>' },
55
+ request: { subject: SUBJECT, params: { id: FRONTEND_APP.id } },
56
+ expect: {
57
+ status: 200,
58
+ partial: {
59
+ id: FRONTEND_APP.id,
60
+ name: FRONTEND_APP.name,
61
+ frontendFolder: `/apps/${FRONTEND_APP.name}`,
62
+ entryFile: 'index.html',
63
+ entryFileExists: true,
64
+ url: `/app/${FRONTEND_APP.id}/`
65
+ }
66
+ }
67
+ },
31
68
  {
32
69
  id: 'app-detail-entry-file-missing',
33
70
  route: 'GET /SASjsApi/app/{id}',
@@ -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,EAwVrC,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,EA6crC,CAAA"}
@@ -241,6 +241,119 @@ export const DEPLOY_CORPUS = [
241
241
  }
242
242
  }
243
243
  },
244
+ {
245
+ id: 'deploy-publishes-a-package',
246
+ route: 'POST /SASjsApi/drive/deploy',
247
+ description: 'publishes a frontend to apps/<name> and writes the backend it carries to appLoc',
248
+ request: {
249
+ subject: SUBJECT,
250
+ body: {
251
+ fileTree: {
252
+ members: [
253
+ {
254
+ name: 'sasjs.app.json',
255
+ type: 'file',
256
+ code: JSON.stringify({
257
+ name: 'macrodash',
258
+ appLoc: '/Public/app/md'
259
+ })
260
+ },
261
+ {
262
+ name: 'web',
263
+ type: 'folder',
264
+ members: [
265
+ { name: 'index.html', type: 'file', code: '<h1>Dash</h1>' }
266
+ ]
267
+ },
268
+ {
269
+ name: 'backend',
270
+ type: 'folder',
271
+ members: [
272
+ {
273
+ name: 'services',
274
+ type: 'folder',
275
+ members: [{ name: 'run', type: 'service', code: '%put hi;' }]
276
+ }
277
+ ]
278
+ }
279
+ ]
280
+ }
281
+ }
282
+ },
283
+ // the halves are named, so a host has to write them to two folders rather
284
+ // than deploy the container: a status alone cannot see that
285
+ expectDrive: {
286
+ present: ['/apps/macrodash/index.html', '/Public/app/md/services/run.sas']
287
+ },
288
+ expect: {
289
+ status: 200,
290
+ partial: {
291
+ status: 'success',
292
+ app: { name: 'macrodash' }
293
+ }
294
+ }
295
+ },
296
+ {
297
+ id: 'deploy-refuses-a-backend-with-no-apploc',
298
+ route: 'POST /SASjsApi/drive/deploy',
299
+ description: 'refuses a bundle carrying services that names no folder to deploy them to',
300
+ request: {
301
+ subject: SUBJECT,
302
+ body: {
303
+ fileTree: {
304
+ members: [
305
+ {
306
+ name: 'sasjs.app.json',
307
+ type: 'file',
308
+ code: JSON.stringify({ name: 'orphan-backend' })
309
+ },
310
+ {
311
+ name: 'web',
312
+ type: 'folder',
313
+ members: [
314
+ { name: 'index.html', type: 'file', code: '<h1>orphan</h1>' }
315
+ ]
316
+ },
317
+ {
318
+ name: 'backend',
319
+ type: 'folder',
320
+ members: [
321
+ {
322
+ name: 'services',
323
+ type: 'folder',
324
+ members: [{ name: 'run', type: 'service', code: '' }]
325
+ }
326
+ ]
327
+ }
328
+ ]
329
+ }
330
+ }
331
+ },
332
+ // both hosts refuse this the same way, and neither writes the frontend it
333
+ // could have deployed: half a deployment is worse than none
334
+ expectDrive: { missing: ['/apps/orphan-backend/index.html'] },
335
+ expect: {
336
+ status: 400,
337
+ error: 'This bundle carries a "backend" folder but names no "appLoc" for it: state the backend folder in sasjs.app.json, or in the request.'
338
+ }
339
+ },
340
+ {
341
+ id: 'deploy-refuses-a-bundle-that-names-no-folder',
342
+ route: 'POST /SASjsApi/drive/deploy',
343
+ description: 'refuses a tree with no app named and no folder to deploy to, naming the field',
344
+ request: {
345
+ subject: SUBJECT,
346
+ body: {
347
+ fileTree: {
348
+ members: [{ name: 'run', type: 'service', code: '%put hi;' }]
349
+ }
350
+ }
351
+ },
352
+ expect: {
353
+ status: 400,
354
+ error: '"appLoc" is required to deploy files that do not name an app.'
355
+ }
356
+ },
244
357
  {
245
358
  id: 'deploy-refuses-a-bad-manifest',
246
359
  route: 'POST /SASjsApi/drive/deploy',
@@ -13,6 +13,7 @@
13
13
  */
14
14
  import type { ApiRequest } from '../host/dispatch.js';
15
15
  import type { IdentityFixture } from '../identity/fixture.js';
16
+ import type { AppStreamEntry } from '../appstream/service.js';
16
17
  export interface CorpusCase {
17
18
  /** Stable name, used as the test's title. */
18
19
  id: string;
@@ -23,6 +24,14 @@ export interface CorpusCase {
23
24
  seed?: Record<string, string | Uint8Array>;
24
25
  /** The identity the case starts from; the default fixture when omitted. */
25
26
  identity?: IdentityFixture;
27
+ /**
28
+ * The apps the case starts from; the default fixture when omitted.
29
+ *
30
+ * An index holds two shapes - an app published as a frontend at `apps/<name>`,
31
+ * and the older one served out of a folder's `services/` - and a case that only
32
+ * ever starts from one of them cannot see a route that reads the other wrong.
33
+ */
34
+ appStream?: AppStreamEntry[];
26
35
  /**
27
36
  * The drive refuses every write, so a case can pin the refusal a route answers
28
37
  * when storing fails - `POST /drive/deploy` documents a `500`, and a mock drive
@@ -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,CAAA;IACnB,kCAAkC;IAClC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC,CAAA;IAC1C,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IACnE,uEAAuE;IACvE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,WAAW,GAAG,SAAS,CAAA;IACnC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE;QACZ,uDAAuD;QACv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.ts","sourceRoot":"","sources":["../../../src/corpus/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAyBnD;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;CAMtB,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,UAAU,KAAG,QA0ClD,CAAA;AA8DD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,UAAU,EACpB,WAAU,QAAgC,KACzC,OAAO,CAAC,UAAU,CAgBpB,CAAA"}
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/corpus/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAyBnD;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;CAMtB,CAAA;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,QAAQ,CAAC,EAAE,MAAM,GAAG,UAAU,CAAA;IAC9B,wDAAwD;IACxD,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,UAAU,KAAG,QA4ClD,CAAA;AA8DD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,UAAU,EACpB,WAAU,QAAgC,KACzC,OAAO,CAAC,UAAU,CAgBpB,CAAA"}
@@ -67,7 +67,7 @@ export const servicesFor = (testCase) => {
67
67
  directory: createDirectoryService(identity, CORPUS_DIRECTORY),
68
68
  identity: createIdentityService(identity),
69
69
  records: createRecordService(identity),
70
- appStream: createAppStreamService(new MemoryAppStreamStore([CORPUS_APP])),
70
+ appStream: createAppStreamService(new MemoryAppStreamStore(testCase.appStream ?? [CORPUS_APP])),
71
71
  session: createSessionService(identity, runner),
72
72
  // no `runTimes` option: the default is the five the document names, so a
73
73
  // case is never refused for a reason that belongs to one host's install
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/host/dispatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAA;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAG/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC/D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KA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AW,CAAA;IAClB;;;OAGG;IACH,UAAU,CAAC,EAAE,iBAAiB,CAAA;IAC9B;;;OAGG;IACH,KAAK,CAAC,EAAE,YAAY,CAAA;IACpB;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,KAAK,EAAE,YAAY,CAAA;IACnB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,eAAe,CAAA;IAC1B,yFAAyF;IACzF,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAA;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB;;;;OAIG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAA;CAC7B;AAmFD,eAAO,MAAM,QAAQ,GACnB,UAAU,QAAQ,EAClB,SAAS,MAAM,EACf,UAAS,UAAe,KACvB,OAAO,CAAC,WAAW,CAw1BrB,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,SAAS,MAAM,KAAG,QAO3C,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,cAAc,EAAE,MAAM,EA+DlC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { routeById } from '../routes/index.js';
2
- import { appSummary, checkPublishRequest } from '../appstream/service.js';
2
+ import { appSummary, checkPublishRequest, frontendFolderOf } from '../appstream/service.js';
3
+ import { appRootOf } from '../appstream/web.js';
3
4
  import { publishRequestFor, splitAppBundle } from '../appstream/bundle.js';
4
5
  import { ApiError, isApiError } from '../types.js';
5
6
  import { DEPLOY_SUCCESS } from '../drive/deploy.js';
@@ -310,10 +311,13 @@ export const dispatch = async (services, routeId, request = {}) => {
310
311
  // expansion, which is why the two share this path rather than reading bytes.
311
312
  case 'POST /SASjsApi/drive/deploy/upload':
312
313
  case 'POST /SASjsApi/drive/deploy': {
313
- // A bundle is one archive: the deployment and - when it carries one - the
314
- // statement that this folder is an app. The manifest is metadata, so it is
315
- // taken out of the tree before anything is written.
314
+ // A bundle is one archive: a deployment, and - when it carries one - the
315
+ // statement that this is an app. A current bundle names its halves, `web/`
316
+ // and `backend/`; the older shape is one tree with the web assets inside the
317
+ // backend's folder. The manifest is metadata either way, so it is taken out
318
+ // of the tree before anything is written.
316
319
  const bundle = splitAppBundle(body.fileTree);
320
+ const packaged = bundle.frontend !== undefined;
317
321
  const isUpload = routeId === 'POST /SASjsApi/drive/deploy/upload';
318
322
  // The query is read on the upload route only: that is where the document
319
323
  // states these, because the archive is the body. There the body is still the
@@ -321,20 +325,25 @@ export const dispatch = async (services, routeId, request = {}) => {
321
325
  // JSON route the document states them in the body, and a stray `?appLoc=`
322
326
  // beside a body that names one would silently deploy to another folder.
323
327
  const setting = (name) => isUpload ? (given(query[name]) ?? body?.[name]) : body?.[name];
324
- const appLoc = String(setting('appLoc') ?? '');
328
+ // a setting the caller omitted is ABSENT, not an empty string: `''` names no
329
+ // folder, and handing it on turns "not stated" into a refusal about how the
330
+ // folder is spelled
331
+ const statedAppLoc = given(setting('appLoc'));
332
+ const appLoc = typeof statedAppLoc === 'string' ? statedAppLoc : undefined;
325
333
  const requested = services.appStream
326
334
  ? publishRequestFor({
335
+ name: given(setting('name')),
327
336
  appLoc,
328
337
  streamWebFolder: given(setting('streamWebFolder')),
329
338
  streamServiceName: given(setting('streamServiceName')),
330
339
  streamLogo: given(setting('streamLogo'))
331
- }, bundle.manifest)
340
+ }, bundle.manifest, { packaged })
332
341
  : undefined;
333
342
  // the index's own checks run BEFORE the drive is written: a tree the index
334
343
  // would refuse must not leave its files behind, which is what happened when
335
344
  // the deploy came first - a request answered `400` had already deployed.
336
- // The tree goes in, so a tree without the folder the app would be served
337
- // from is refused rather than indexed as an app that 404s.
345
+ // The tree goes in, so what a browser would open is judged: a package's
346
+ // frontend, or the whole tree of a legacy bundle.
338
347
  // the folder the refusal should tell the caller to fix: the bundle's, when
339
348
  // the request did not state one and the manifest did
340
349
  const folderFromManifest = requested?.streamWebFolder !== undefined &&
@@ -342,11 +351,38 @@ export const dispatch = async (services, routeId, request = {}) => {
342
351
  bundle.manifest?.streamWebFolder !== undefined;
343
352
  const publish = requested === undefined
344
353
  ? undefined
345
- : checkPublishRequest(requested, bundle.tree, { folderFromManifest });
354
+ : checkPublishRequest(requested, packaged ? bundle.frontend : bundle.tree, { folderFromManifest });
355
+ // a package has nowhere to go without an index: its frontend is `apps/<name>`,
356
+ // which only a published app has
357
+ if (packaged && publish === undefined)
358
+ throw new ApiError(501, `This host has no app stream, so it cannot publish the frontend this bundle carries.`);
359
+ if (publish !== undefined && publish.streamWebFolder === undefined) {
360
+ // a bundle that carries services has to say where they go: skipping the
361
+ // write would answer `200` for a deployment whose backend is missing, and
362
+ // the response is the only place a caller could have seen it
363
+ if (bundle.backend !== undefined && publish.appLoc === undefined)
364
+ throw new ApiError(400, 'This bundle carries a "backend" folder but names no "appLoc" for it: state the backend folder in sasjs.app.json, or in the request.');
365
+ // check, backend, frontend, index - the backend first so a frontend is
366
+ // never live against services that are not deployed yet, and additively
367
+ // because several frontends may name one backend
368
+ if (bundle.backend !== undefined)
369
+ await drive.deploy(publish.appLoc, bundle.backend, {
370
+ replace: false
371
+ });
372
+ // publishing a frontend means the folder is what this bundle says it is
373
+ await drive.deploy(frontendFolderOf(publish.name), (packaged ? bundle.frontend : bundle.tree), { replace: true });
374
+ const entry = await services.appStream.publish(publish);
375
+ return {
376
+ status: 200,
377
+ body: { ...DEPLOY_SUCCESS, app: appSummary(entry) }
378
+ };
379
+ }
346
380
  // an archive upload replaces by default - publishing a folder means the
347
381
  // folder is what the archive says it is - while the JSON route writes over
348
382
  // what is there unless it is told otherwise
349
383
  const replace = replaceOf(setting('replace')) ?? isUpload;
384
+ if (appLoc === undefined)
385
+ throw new ApiError(400, '"appLoc" is required to deploy files that do not name an app.');
350
386
  await drive.deploy(appLoc, bundle.tree, { replace });
351
387
  // a deploy of something that is not an app writes files and says so; an app
352
388
  // is indexed in the same request, so the two cannot disagree
@@ -384,7 +420,12 @@ export const dispatch = async (services, routeId, request = {}) => {
384
420
  throw appNotRegistered();
385
421
  throw err;
386
422
  });
387
- const folder = `${entry.appLoc}/services/${entry.streamWebFolder}`;
423
+ // the entry's own folder, whichever shape it was published in: `streamWebFolder`
424
+ // is the field that separates them - an entry carrying it is served from
425
+ // `<appLoc>/services/<streamWebFolder>`, every other entry from `apps/<name>` -
426
+ // so the folder is derived rather than reconstructed from fields an entry may
427
+ // not carry
428
+ const folder = appRootOf(entry);
388
429
  // An index entry can outlive its deployment - the folder deleted from under
389
430
  // the host - and reporting a file and a date that are not there would be worse
390
431
  // than reporting none, so the listing decides both.
@@ -408,8 +449,15 @@ export const dispatch = async (services, routeId, request = {}) => {
408
449
  const body = {
409
450
  id: entry.id,
410
451
  name: entry.name,
411
- appLoc: entry.appLoc,
412
- streamWebFolder: entry.streamWebFolder,
452
+ // the folder the entry is read from, which is what this route describes:
453
+ // `apps/<name>` for a frontend, and the legacy deployment's own folder for
454
+ // the older shape. A host that answered one and not the other would leave
455
+ // a client reading a path out of fields the entry may not carry.
456
+ frontendFolder: folder,
457
+ ...(entry.appLoc === undefined ? {} : { appLoc: entry.appLoc }),
458
+ ...(entry.streamWebFolder === undefined
459
+ ? {}
460
+ : { streamWebFolder: entry.streamWebFolder }),
413
461
  publishedAt: entry.publishedAt ?? null,
414
462
  entryFile: APP_ENTRY_FILE,
415
463
  entryFileExists,
@@ -85,12 +85,12 @@ export { RECORD_CORPUS, ADMIN_SIGNED_IN, PROVIDER_MANAGED } from './corpus/recor
85
85
  export type { CorpusCase } from './corpus/drive.js';
86
86
  export { runCase, servicesFor } from './corpus/runner.js';
87
87
  export type { CaseResult } from './corpus/runner.js';
88
- export { appSummary, checkPublishRequest, createAppStreamService, defaultAppName, MemoryAppStreamStore } from './appstream/service.js';
88
+ export { APP_FOLDERS_ROOT, appSummary, checkPublishRequest, createAppStreamService, defaultAppName, frontendFolderOf, hasFrontendRoot, MemoryAppStreamStore } from './appstream/service.js';
89
89
  export type { AppStreamEntry, AppStreamService, AppStreamStore, CheckedPublish, PublishAppRequest } from './appstream/service.js';
90
- export { APP_MANIFEST, parseAppManifest, publishRequestFor, splitAppBundle } from './appstream/bundle.js';
90
+ export { APP_MANIFEST, BACKEND_FOLDER, FRONTEND_FOLDER, parseAppManifest, publishRequestFor, splitAppBundle } from './appstream/bundle.js';
91
91
  export type { AppBundle, AppManifest, DeployPublish } from './appstream/bundle.js';
92
92
  export { APP_STREAM_INDEX, createDriveAppStreamStore } from './appstream/store.js';
93
- export { DEFAULT_APP_PATH, NO_SUCH_APP, cacheControlFor, contentTypeFor, createAppStreamWebService, escapeHtml } from './appstream/web.js';
93
+ export { DEFAULT_APP_PATH, NO_SUCH_APP, appRootOf, cacheControlFor, contentTypeFor, createAppStreamWebService, escapeHtml } from './appstream/web.js';
94
94
  export type { AppFilter, AppStreamApp, AppStreamPage, AppStreamRequest, AppStreamWebOptions, AppStreamWebService } from './appstream/web.js';
95
95
  export { isAppId, newAppId, normaliseAppLoc } from './appstream/identity.js';
96
96
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACR,MAAM,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAA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Y,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,iBAAiB,EAClB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,UAAU,EACX,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,cAAc,YAAY,CAAA;AAC1B,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACR,MAAM,EACP,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,iBAAiB,EAClB,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACX,MAAM,mBAAmB,CAAA;AAC1B,YAAY,EACV,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,SAAS,EACT,SAAS,EACV,MAAM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ACZ,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACf,MAAM,uBAAuB,CAAA;AAC9B,YAAY,EACV,SAAS,EACT,WAAW,EACX,aAAa,EACd,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,SAAS,EACT,eAAe,EACf,cAAc,EACd,yBAAyB,EACzB,UAAU,EACX,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,SAAS,EACT,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA"}
@@ -62,8 +62,8 @@ export { MemorySessionRunner } from './runtime/memory-runner.js';
62
62
  export { RUNTIME_CORPUS } from './corpus/runtime.js';
63
63
  export { RECORD_CORPUS, ADMIN_SIGNED_IN, PROVIDER_MANAGED } from './corpus/records.js';
64
64
  export { runCase, servicesFor } from './corpus/runner.js';
65
- export { appSummary, checkPublishRequest, createAppStreamService, defaultAppName, MemoryAppStreamStore } from './appstream/service.js';
66
- export { APP_MANIFEST, parseAppManifest, publishRequestFor, splitAppBundle } from './appstream/bundle.js';
65
+ export { APP_FOLDERS_ROOT, appSummary, checkPublishRequest, createAppStreamService, defaultAppName, frontendFolderOf, hasFrontendRoot, MemoryAppStreamStore } from './appstream/service.js';
66
+ export { APP_MANIFEST, BACKEND_FOLDER, FRONTEND_FOLDER, parseAppManifest, publishRequestFor, splitAppBundle } from './appstream/bundle.js';
67
67
  export { APP_STREAM_INDEX, createDriveAppStreamStore } from './appstream/store.js';
68
- export { DEFAULT_APP_PATH, NO_SUCH_APP, cacheControlFor, contentTypeFor, createAppStreamWebService, escapeHtml } from './appstream/web.js';
68
+ export { DEFAULT_APP_PATH, NO_SUCH_APP, appRootOf, cacheControlFor, contentTypeFor, createAppStreamWebService, escapeHtml } from './appstream/web.js';
69
69
  export { isAppId, newAppId, normaliseAppLoc } from './appstream/identity.js';
@@ -1 +1 @@
1
- {"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../src/routes/generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,gBAAgB,EAAE,cAAc,EAkmE5C,CAAA"}
1
+ {"version":3,"file":"generated.d.ts","sourceRoot":"","sources":["../../../src/routes/generated.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAEjD,eAAO,MAAM,gBAAgB,EAAE,cAAc,EA8mE5C,CAAA"}
@@ -571,7 +571,13 @@ export const GENERATED_ROUTES = [
571
571
  {
572
572
  name: 'appLoc',
573
573
  in: 'body',
574
- required: true,
574
+ required: false,
575
+ type: 'string'
576
+ },
577
+ {
578
+ name: 'name',
579
+ in: 'body',
580
+ required: false,
575
581
  type: 'string'
576
582
  },
577
583
  {
@@ -632,6 +638,12 @@ export const GENERATED_ROUTES = [
632
638
  tag: 'Drive',
633
639
  summary: 'Deploy an uploaded file to SASjs Drive',
634
640
  params: [
641
+ {
642
+ name: 'name',
643
+ in: 'query',
644
+ required: false,
645
+ type: 'string'
646
+ },
635
647
  {
636
648
  name: 'appLoc',
637
649
  in: 'query',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.39.0",
3
+ "version": "0.40.1",
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",