@sasjs/api 0.38.0 → 0.40.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.
@@ -1,12 +1,26 @@
1
+ /**
2
+ * Where a frontend lives in the drive: one reserved folder, so an app's files are
3
+ * found by its name alone and nothing has to be recorded about the location.
4
+ */
5
+ export declare const APP_FOLDERS_ROOT = "apps";
6
+ /** The drive folder holding an app's frontend. */
7
+ export declare const frontendFolderOf: (name: string) => string;
1
8
  export interface AppStreamEntry {
2
9
  /** The identity: a version 4 UUID, minted once and kept for the life of the app. */
3
10
  id: string;
4
- /** The label a person reads. Not unique, not a key, not in any URL. */
11
+ /** The key: the app's name, its folder under `apps/`, and its address. */
5
12
  name: string;
6
- /** The folder the app was deployed to - the one app one folder rule. */
7
- appLoc: string;
8
- /** The folder holding the web assets, relative to `appLoc/services`. */
9
- streamWebFolder: string;
13
+ /**
14
+ * The backend this frontend calls, when it has one. Metadata: several apps may
15
+ * name the same folder, and a frontend-only app names none.
16
+ */
17
+ appLoc?: string;
18
+ /**
19
+ * The legacy shape, and only the legacy shape: the web assets live at
20
+ * `<appLoc>/services/<streamWebFolder>`. An entry without it is served from
21
+ * `apps/<name>`.
22
+ */
23
+ streamWebFolder?: string;
10
24
  /** An asset inside the app, served from the app's own URL. */
11
25
  logo?: string;
12
26
  /** Origins allowed to frame the app, as CSP `frame-ancestors` sources. */
@@ -27,10 +41,19 @@ export interface AppStreamStore {
27
41
  write(entries: AppStreamEntry[]): Promise<void>;
28
42
  }
29
43
  export interface PublishAppRequest {
30
- appLoc: string;
31
- streamWebFolder: string;
32
- /** The label. Defaults to the last segment of `appLoc`. */
44
+ /**
45
+ * The app's name: the key, the folder under `apps/` and the address. Required
46
+ * of a frontend publish, optional for a legacy one (which derives it from the
47
+ * folder).
48
+ */
33
49
  name?: string;
50
+ /** The backend this frontend calls. Optional: a frontend-only app names none. */
51
+ appLoc?: string;
52
+ /**
53
+ * The legacy publish only: the folder under `<appLoc>/services` holding the web
54
+ * assets. Stating it keeps the entry in the legacy shape.
55
+ */
56
+ streamWebFolder?: string;
34
57
  logo?: string;
35
58
  frameAncestors?: string | string[];
36
59
  /** The publish time, for a caller that has a clock of its own (or a test). */
@@ -77,16 +100,33 @@ export interface CheckedPublish extends Omit<PublishAppRequest, 'frameAncestors'
77
100
  * folder.
78
101
  */
79
102
  export declare const hasStreamFolder: (tree: unknown, streamWebFolder: string) => boolean;
103
+ /**
104
+ * Whether a deploy tree is a frontend: something to open.
105
+ *
106
+ * A frontend is served from its folder root, so the root has to hold the page a
107
+ * browser opens. Without it the publish would advertise an app that answers `404`
108
+ * to every request - a tile that opens nothing, which is worse than a refusal that
109
+ * names what is missing.
110
+ */
111
+ export declare const hasFrontendRoot: (tree: unknown) => boolean;
80
112
  /**
81
113
  * A publish request, checked and normalised, with no default applied.
82
114
  *
83
115
  * Separate from `publish` so a host can refuse a publish BEFORE it writes the
84
116
  * deployment: the drive and the index are two writes, and a request the index
85
117
  * would refuse must not leave the files behind. `name` is left absent when the
86
- * caller did not state one, because a redeploy inherits the label it had.
118
+ * caller did not state one, because a legacy redeploy inherits the label it had.
119
+ *
120
+ * Two shapes, told apart by `streamWebFolder`:
121
+ *
122
+ * - **legacy** - `streamWebFolder` and `appLoc` stated: the web assets are at
123
+ * `<appLoc>/services/<streamWebFolder>`, which is where the tree has to carry
124
+ * them. This is what an older CLI deploys, and it stays exactly as it was.
125
+ * - **frontend** - no `streamWebFolder`: the app is `apps/<name>`, so the name is
126
+ * required and is validated as the folder it now is. `appLoc` is optional
127
+ * metadata naming the backend.
87
128
  *
88
- * The tree is optional so that a caller holding only the request can still check
89
- * it; when it is stated, the folder the app would be served from has to be in it.
129
+ * The tree is optional so a caller holding only the request can still check it.
90
130
  */
91
131
  export declare const checkPublishRequest: (request: PublishAppRequest, tree?: unknown, options?: {
92
132
  folderFromManifest?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../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E,CAAC;IAIjC,KAAK,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAGtD"}
@@ -1,30 +1,44 @@
1
1
  /**
2
2
  * The app index: what has been published, keyed by a UUID.
3
3
  *
4
- * An app is one deployed folder (`appLoc`), the web assets inside it
5
- * (`appLoc/services/<streamWebFolder>`) and a UUID assigned when it is first
6
- * published. The id is the key the routes, the listing and the permission rules
7
- * point at, and it is what a redeploy keeps. The name is a label a person reads
8
- * AND - when exactly one app holds it - an address: `/app/<name>` opens the app,
9
- * so a name the caller states is validated as a URL segment and has to be free.
10
- * A label derived from the folder carries no such rule, because it was not
11
- * chosen: two folders may share a leaf name and both stay openable by id.
4
+ * An app is a **frontend**: a named folder under `apps/` in the drive, and a UUID
5
+ * assigned when it is first published. The id is the key the routes, the listing
6
+ * and the permission rules point at, and it is what a redeploy keeps. The name is
7
+ * the app's address as well as its label - `/app/<name>` opens it and
8
+ * `apps/<name>` holds it - so a name is validated as a URL segment and has to be
9
+ * free.
10
+ *
11
+ * A backend is metadata. An app may name the `appLoc` whose services its frontend
12
+ * calls, and several apps may name the same one: a frontend is what an app is,
13
+ * and where its services live is a fact about the app rather than its identity.
14
+ * The backend's files are provisioned by a publish that carries them, which is a
15
+ * separate, optional half of a bundle.
16
+ *
17
+ * One legacy shape survives, and only so that a deployment made by an older CLI
18
+ * keeps serving: an entry carrying `streamWebFolder` keeps its web assets where
19
+ * that shape put them, `<appLoc>/services/<streamWebFolder>`, and is still keyed
20
+ * by its folder. Republishing it from a current bundle moves it to `apps/<name>`.
12
21
  *
13
22
  * The service is the decisions, and a host supplies the storage. That split is
14
23
  * the point of this package: sasjs/server keeps the index in a JSON file beside
15
24
  * its drive, the browser build keeps it in the drive it already has, and both
16
25
  * answer the same listing because both call this file.
17
26
  *
18
- * One app per folder. Publishing a folder that is already published is the same
19
- * app published again: it keeps its id (so its URL survives a redeploy) and takes
20
- * the values the new publish states - except the label, which carries over when
21
- * the new publish does not name one, so a redeploy that has forgotten what the
22
- * app is called does not rename it to its folder. Nothing is derived from the
23
- * path, so a capital, a space or a `..` in a folder name is the drive's business
24
- * rather than an identity question.
27
+ * Publishing an app that is already published is the same app published again: it
28
+ * keeps its id (so its URL survives a redeploy) and takes the values the new
29
+ * publish states - except the label, which carries over when the new publish does
30
+ * not name one, so a redeploy that has forgotten what the app is called does not
31
+ * rename it.
25
32
  */
26
33
  import { ApiError } from '../types.js';
27
34
  import { newAppId, normaliseAppLoc } from './identity.js';
35
+ /**
36
+ * Where a frontend lives in the drive: one reserved folder, so an app's files are
37
+ * found by its name alone and nothing has to be recorded about the location.
38
+ */
39
+ export const APP_FOLDERS_ROOT = 'apps';
40
+ /** The drive folder holding an app's frontend. */
41
+ export const frontendFolderOf = (name) => `/${APP_FOLDERS_ROOT}/${name}`;
28
42
  /** What a publish answers: enough for a client to print the app's URL. */
29
43
  export const appSummary = (entry) => ({
30
44
  id: entry.id,
@@ -89,50 +103,92 @@ export const hasStreamFolder = (tree, streamWebFolder) => {
89
103
  return (Array.isArray(children) &&
90
104
  children.some((member) => isFolder(member, streamWebFolder)));
91
105
  };
106
+ /**
107
+ * Whether a deploy tree is a frontend: something to open.
108
+ *
109
+ * A frontend is served from its folder root, so the root has to hold the page a
110
+ * browser opens. Without it the publish would advertise an app that answers `404`
111
+ * to every request - a tile that opens nothing, which is worse than a refusal that
112
+ * names what is missing.
113
+ */
114
+ export const hasFrontendRoot = (tree) => {
115
+ const members = tree?.members;
116
+ if (!Array.isArray(members))
117
+ return false;
118
+ return members.some((member) => {
119
+ const entry = member;
120
+ return entry?.type === 'file' && entry?.name === 'index.html';
121
+ });
122
+ };
92
123
  /**
93
124
  * A publish request, checked and normalised, with no default applied.
94
125
  *
95
126
  * Separate from `publish` so a host can refuse a publish BEFORE it writes the
96
127
  * deployment: the drive and the index are two writes, and a request the index
97
128
  * would refuse must not leave the files behind. `name` is left absent when the
98
- * caller did not state one, because a redeploy inherits the label it had.
129
+ * caller did not state one, because a legacy redeploy inherits the label it had.
130
+ *
131
+ * Two shapes, told apart by `streamWebFolder`:
132
+ *
133
+ * - **legacy** - `streamWebFolder` and `appLoc` stated: the web assets are at
134
+ * `<appLoc>/services/<streamWebFolder>`, which is where the tree has to carry
135
+ * them. This is what an older CLI deploys, and it stays exactly as it was.
136
+ * - **frontend** - no `streamWebFolder`: the app is `apps/<name>`, so the name is
137
+ * required and is validated as the folder it now is. `appLoc` is optional
138
+ * metadata naming the backend.
99
139
  *
100
- * The tree is optional so that a caller holding only the request can still check
101
- * it; when it is stated, the folder the app would be served from has to be in it.
140
+ * The tree is optional so a caller holding only the request can still check it.
102
141
  */
103
142
  export const checkPublishRequest = (request, tree, options = {}) => {
104
- const appLoc = appLocOf(request.appLoc);
105
- // the drive root is not a folder an app can live in: a deploy to `/` writes
106
- // `//index.html`, which nothing can read, so it is refused rather than indexed
107
- if (appLoc === '/')
108
- throw new ApiError(400, 'An app cannot be published at the drive root.');
109
143
  const logo = logoOf(request.logo);
110
144
  const frameAncestors = frameAncestorsOf(request.frameAncestors);
111
- const streamWebFolder = webFolderOf(request.streamWebFolder);
112
- // the tree has to carry the folder the app is served from, or the publish
113
- // advertises an app whose every request is a `404`. The advice names the source
114
- // of the folder: a caller whose bundle stated it cannot omit the field, and the
115
- // bundle is the thing to correct.
116
- if (tree !== undefined && !hasStreamFolder(tree, streamWebFolder))
117
- throw new ApiError(400, `The deployed tree has no "services/${streamWebFolder}" folder, so nothing would be published at ${appLoc}. Deploy the web assets under services/${streamWebFolder}, or ${options.folderFromManifest
118
- ? 'correct the folder sasjs.app.json names.'
119
- : 'omit streamWebFolder.'}`);
145
+ const timing = request.publishedAt === undefined
146
+ ? {}
147
+ : { publishedAt: request.publishedAt };
148
+ if (request.streamWebFolder !== undefined) {
149
+ if (request.appLoc === undefined)
150
+ throw new ApiError(400, '"appLoc" is required when "streamWebFolder" is stated: the entry keeps its web assets at <appLoc>/services/<streamWebFolder>, so both halves are needed to say where they are.');
151
+ const appLoc = appLocOf(request.appLoc);
152
+ // the drive root is not a folder an app can live in: a deploy to `/` writes
153
+ // `//index.html`, which nothing can read, so it is refused rather than indexed
154
+ if (appLoc === '/')
155
+ throw new ApiError(400, 'An app cannot be published at the drive root.');
156
+ const streamWebFolder = webFolderOf(request.streamWebFolder);
157
+ // the tree has to carry the folder the app is served from, or the publish
158
+ // advertises an app whose every request is a `404`. The advice names the source
159
+ // of the folder: a caller whose bundle stated it cannot omit the field, and the
160
+ // bundle is the thing to correct.
161
+ if (tree !== undefined && !hasStreamFolder(tree, streamWebFolder))
162
+ throw new ApiError(400, `The deployed tree has no "services/${streamWebFolder}" folder, so nothing would be published at ${appLoc}. Deploy the web assets under services/${streamWebFolder}, or ${options.folderFromManifest
163
+ ? 'correct the folder sasjs.app.json names.'
164
+ : 'omit streamWebFolder.'}`);
165
+ return {
166
+ appLoc,
167
+ streamWebFolder,
168
+ ...(request.name === undefined ? {} : { name: nameOf(request.name) }),
169
+ ...(logo === undefined ? {} : { logo }),
170
+ ...(frameAncestors === undefined ? {} : { frameAncestors }),
171
+ ...timing
172
+ };
173
+ }
174
+ // a frontend publish: the name is the folder, so there is no sensible default
175
+ if (request.name === undefined)
176
+ throw new ApiError(400, '"name" is required: an app is published at apps/<name>, so the publish has to say what it is called.');
177
+ const name = nameOf(request.name);
178
+ const appLoc = request.appLoc === undefined ? undefined : appLocOf(request.appLoc);
179
+ if (appLoc === '/')
180
+ throw new ApiError(400, 'An app cannot name the drive root as its backend.');
181
+ if (tree !== undefined && !hasFrontendRoot(tree))
182
+ throw new ApiError(400, `The deployed tree has no "index.html" at its root, so nothing would be published at apps/${name}. Publish the compiled web folder itself, not the folder that holds it.`);
120
183
  return {
121
- appLoc,
122
- streamWebFolder,
123
- ...(request.name === undefined
124
- ? {}
125
- : { name: nameOf(request.name, appLoc) }),
184
+ name,
185
+ ...(appLoc === undefined ? {} : { appLoc }),
126
186
  ...(logo === undefined ? {} : { logo }),
127
187
  ...(frameAncestors === undefined ? {} : { frameAncestors }),
128
- ...(request.publishedAt === undefined
129
- ? {}
130
- : { publishedAt: request.publishedAt })
188
+ ...timing
131
189
  };
132
190
  };
133
- const nameOf = (value, appLoc) => {
134
- if (value === undefined)
135
- return defaultAppName(appLoc);
191
+ const nameOf = (value) => {
136
192
  if (typeof value !== 'string' || value.trim() === '')
137
193
  throw new ApiError(400, '"name" must be a non-empty string');
138
194
  return urlSafeName(value.trim());
@@ -218,48 +274,65 @@ export const createAppStreamService = (store) => {
218
274
  catch (_) {
219
275
  return undefined;
220
276
  }
221
- const entry = (await store.read()).find((candidate) => sameAppLoc(candidate.appLoc, normalised));
277
+ // legacy entries only: a frontend app names a backend it CALLS, which is not
278
+ // a claim to have been published there
279
+ const entry = (await store.read()).find((candidate) => candidate.streamWebFolder !== undefined &&
280
+ candidate.appLoc !== undefined &&
281
+ sameAppLoc(candidate.appLoc, normalised));
222
282
  return entry ? { ...entry } : undefined;
223
283
  },
224
284
  publish(request) {
225
285
  return mutate(async () => {
226
286
  const checked = checkPublishRequest(request);
227
- const appLoc = checked.appLoc;
228
- const streamWebFolder = checked.streamWebFolder;
229
287
  const entries = await store.read();
230
- // the folder is the app, so a redeploy is the same app published again:
231
- // it keeps the id its URL depends on, and takes the values this publish
232
- // states rather than the ones the previous publish left behind
233
- const existing = entries.find((entry) => sameAppLoc(entry.appLoc, appLoc));
288
+ const legacy = checked.streamWebFolder !== undefined;
289
+ // A legacy publish is keyed by the folder it deployed to; a frontend
290
+ // publish by its name, which IS its folder. Either way a redeploy finds the
291
+ // entry it published before and keeps its id, which is what its URL
292
+ // depends on. The name is compared exactly: a drive that ignores case would
293
+ // hold one folder for two spellings, so a case-only difference is a clash
294
+ // rather than a redeploy.
295
+ const sameTarget = (candidate) => legacy
296
+ ? candidate.streamWebFolder !== undefined &&
297
+ candidate.appLoc !== undefined &&
298
+ sameAppLoc(candidate.appLoc, checked.appLoc)
299
+ : candidate.streamWebFolder === undefined &&
300
+ candidate.name === checked.name;
301
+ const existing = entries.find(sameTarget);
234
302
  const logo = checked.logo;
235
303
  const frameAncestors = checked.frameAncestors;
236
- // A name this publish STATES is an address, so it is validated as a URL
237
- // segment and has to be free. A name it inherits from the last publish,
238
- // or one derived from the folder, is a label only: it was not chosen
239
- // here, it may predate this rule, and two folders may share a leaf name.
240
- const statedName = checked.name;
241
- const name = statedName !== undefined
242
- ? nameOf(statedName, appLoc)
243
- : (existing?.name ?? nameOf(undefined, appLoc));
244
- if (statedName !== undefined) {
245
- const clash = entries.find((candidate) => !sameAppLoc(candidate.appLoc, appLoc) &&
304
+ // A legacy label is a label: it was not chosen here, it may predate this
305
+ // rule, and two folders may share a leaf name. A frontend name is the
306
+ // folder and the address, so it has to be free.
307
+ const name = legacy
308
+ ? (checked.name ??
309
+ existing?.name ??
310
+ defaultAppName(checked.appLoc))
311
+ : checked.name;
312
+ // A legacy label is only validated when this publish STATES one; a name it
313
+ // inherits, or one derived from the folder, predates the rule. A frontend
314
+ // name is the folder and the address, so it is always the caller's.
315
+ if (!legacy || checked.name !== undefined) {
316
+ const clash = entries.find((candidate) => candidate !== existing &&
246
317
  candidate.name.toLowerCase() === name.toLowerCase());
247
318
  if (clash)
248
- throw new ApiError(409, `The name "${name}" is already the address of the app published at ${clash.appLoc}. A stated name is how the app opens (/app/${name}), and two apps holding one name would answer an ambiguous lookup with nothing, so publish this one under a different name.`);
319
+ throw new ApiError(409, `The name "${name}" is already the address of the app at ${clash.appLoc ?? frontendFolderOf(clash.name)}. An app's name is how it opens (/app/${name}), and two apps holding one name would answer an ambiguous lookup with nothing, so publish this one under a different name.`);
249
320
  }
250
321
  const entry = {
251
322
  id: existing ? existing.id : newAppId(),
252
323
  // the label is the one field a redeploy inherits: everything else is
253
324
  // what this publish states
254
325
  name,
255
- appLoc,
256
- streamWebFolder,
326
+ ...(checked.appLoc === undefined ? {} : { appLoc: checked.appLoc }),
327
+ ...(checked.streamWebFolder === undefined
328
+ ? {}
329
+ : { streamWebFolder: checked.streamWebFolder }),
257
330
  ...(logo === undefined ? {} : { logo }),
258
331
  ...(frameAncestors === undefined ? {} : { frameAncestors }),
259
332
  publishedAt: checked.publishedAt ?? new Date().toISOString()
260
333
  };
261
334
  await store.write([
262
- ...entries.filter((candidate) => !sameAppLoc(candidate.appLoc, appLoc)),
335
+ ...entries.filter((candidate) => !sameTarget(candidate)),
263
336
  entry
264
337
  ]);
265
338
  return { ...entry };
@@ -1 +1 @@
1
- {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/appstream/store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,cAAc,CAAA;AAElE,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,sBAAsB,CAAA;AAgBnD,eAAO,MAAM,yBAAyB,GACpC,OAAO,YAAY,EACnB,WAAU,MAAyB,KAClC,cAsDD,CAAA"}
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../src/appstream/store.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AACvD,OAAO,KAAK,EAAkB,cAAc,EAAE,MAAM,cAAc,CAAA;AAElE,mFAAmF;AACnF,eAAO,MAAM,gBAAgB,sBAAsB,CAAA;AA4BnD,eAAO,MAAM,yBAAyB,GACpC,OAAO,YAAY,EACnB,WAAU,MAAyB,KAClC,cAsDD,CAAA"}
@@ -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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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":"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,EA+ZrC,CAAA"}
@@ -241,6 +241,75 @@ 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-bundle-that-names-no-folder',
298
+ route: 'POST /SASjsApi/drive/deploy',
299
+ description: 'refuses a tree with no app named and no folder to deploy to, naming the field',
300
+ request: {
301
+ subject: SUBJECT,
302
+ body: {
303
+ fileTree: {
304
+ members: [{ name: 'run', type: 'service', code: '%put hi;' }]
305
+ }
306
+ }
307
+ },
308
+ expect: {
309
+ status: 400,
310
+ error: '"appLoc" is required to deploy files that do not name an app.'
311
+ }
312
+ },
244
313
  {
245
314
  id: 'deploy-refuses-a-bad-manifest',
246
315
  route: 'POST /SASjsApi/drive/deploy',
@@ -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,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