@sasjs/api 0.40.1 → 0.40.2

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.40.1 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.40.2 - 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;
@@ -6561,17 +6561,16 @@ var SASjsApi = (() => {
6561
6561
  }
6562
6562
  const rest = { ...tree, members: withoutManifest };
6563
6563
  const web = folderNamed(withoutManifest, FRONTEND_FOLDER);
6564
- if (web === void 0 && manifest === void 0)
6564
+ const backendFolder = folderNamed(withoutManifest, BACKEND_FOLDER);
6565
+ if (web === void 0 && backendFolder === void 0 && manifest === void 0)
6565
6566
  return { tree };
6566
6567
  if (manifest?.streamWebFolder !== void 0) return { tree: rest, manifest };
6567
- const backend = contentsOf(folderNamed(withoutManifest, BACKEND_FOLDER));
6568
+ const backend = contentsOf(backendFolder);
6569
+ const ownFiles = withoutManifest.filter((member) => member !== backendFolder);
6570
+ const frontend = contentsOf(web) ?? (ownFiles.length === 0 ? void 0 : { members: ownFiles });
6568
6571
  return {
6569
6572
  tree: rest,
6570
- frontend: contentsOf(web) ?? {
6571
- members: withoutManifest.filter(
6572
- (member) => member !== folderNamed(withoutManifest, BACKEND_FOLDER)
6573
- )
6574
- },
6573
+ ...frontend === void 0 ? {} : { frontend },
6575
6574
  ...backend === void 0 ? {} : { backend },
6576
6575
  manifest
6577
6576
  };
@@ -127,10 +127,14 @@ const splitAppBundle = (tree) => {
127
127
  }
128
128
  const rest = { ...tree, members: withoutManifest };
129
129
  const web = folderNamed(withoutManifest, exports.FRONTEND_FOLDER);
130
+ const backendFolder = folderNamed(withoutManifest, exports.BACKEND_FOLDER);
130
131
  // nothing says this is an app: pass the tree through untouched, so a caller that
131
132
  // keeps its own copy sees no change and the deploy is the thing that judges it.
132
- // A manifest is the only other way out of this branch, so there is none here.
133
- if (web === undefined && manifest === undefined)
133
+ // The two folder names are what a package is made of, so either of them - or a
134
+ // manifest - is the bundle saying it is one.
135
+ if (web === undefined &&
136
+ backendFolder === undefined &&
137
+ manifest === undefined)
134
138
  return { tree: tree };
135
139
  // `streamWebFolder` names the older shape, where the web assets sit inside the
136
140
  // backend's folder and one tree is deployed to `appLoc`. It decides on its own:
@@ -139,13 +143,24 @@ const splitAppBundle = (tree) => {
139
143
  if (manifest?.streamWebFolder !== undefined)
140
144
  return { tree: rest, manifest };
141
145
  // a `web/` folder is the frontend; without one, a manifest still says the tree
142
- // is an app, and the whole tree is then the app's own files
143
- const backend = contentsOf(folderNamed(withoutManifest, exports.BACKEND_FOLDER));
146
+ // is an app, and what is left once the backend is taken out is then the app's
147
+ // own files.
148
+ const backend = contentsOf(backendFolder);
149
+ const ownFiles = withoutManifest.filter((member) => member !== backendFolder);
150
+ /**
151
+ * Nothing left is not a frontend.
152
+ *
153
+ * A bundle that carries only `backend/` and a manifest has no files to serve: the
154
+ * remaining tree is EMPTY, and reading that as a frontend publishes an app whose
155
+ * folder holds nothing, then refuses it for having no name. Such a bundle deploys
156
+ * its backend and publishes nothing - the halves are independent, which is what
157
+ * makes a backend shareable between frontends.
158
+ */
159
+ const frontend = contentsOf(web) ??
160
+ (ownFiles.length === 0 ? undefined : { members: ownFiles });
144
161
  return {
145
162
  tree: rest,
146
- frontend: contentsOf(web) ?? {
147
- members: withoutManifest.filter((member) => member !== folderNamed(withoutManifest, exports.BACKEND_FOLDER))
148
- },
163
+ ...(frontend === undefined ? {} : { frontend }),
149
164
  ...(backend === undefined ? {} : { backend }),
150
165
  manifest: manifest
151
166
  };
@@ -1 +1 @@
1
- {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../../src/appstream/bundle.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,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,aAAa;IAC5B,mDAAmD;IACnD,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,2EAA2E;IAC3E,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,iBAAiB,GAC5B,QAAQ,aAAa,EACrB,WAAW,WAAW,EACtB,UAAS;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,KACnC,iBAAiB,GAAG,SAwBtB,CAAA"}
@@ -123,10 +123,14 @@ export const splitAppBundle = (tree) => {
123
123
  }
124
124
  const rest = { ...tree, members: withoutManifest };
125
125
  const web = folderNamed(withoutManifest, FRONTEND_FOLDER);
126
+ const backendFolder = folderNamed(withoutManifest, BACKEND_FOLDER);
126
127
  // nothing says this is an app: pass the tree through untouched, so a caller that
127
128
  // keeps its own copy sees no change and the deploy is the thing that judges it.
128
- // A manifest is the only other way out of this branch, so there is none here.
129
- if (web === undefined && manifest === undefined)
129
+ // The two folder names are what a package is made of, so either of them - or a
130
+ // manifest - is the bundle saying it is one.
131
+ if (web === undefined &&
132
+ backendFolder === undefined &&
133
+ manifest === undefined)
130
134
  return { tree: tree };
131
135
  // `streamWebFolder` names the older shape, where the web assets sit inside the
132
136
  // backend's folder and one tree is deployed to `appLoc`. It decides on its own:
@@ -135,13 +139,24 @@ export const splitAppBundle = (tree) => {
135
139
  if (manifest?.streamWebFolder !== undefined)
136
140
  return { tree: rest, manifest };
137
141
  // a `web/` folder is the frontend; without one, a manifest still says the tree
138
- // is an app, and the whole tree is then the app's own files
139
- const backend = contentsOf(folderNamed(withoutManifest, BACKEND_FOLDER));
142
+ // is an app, and what is left once the backend is taken out is then the app's
143
+ // own files.
144
+ const backend = contentsOf(backendFolder);
145
+ const ownFiles = withoutManifest.filter((member) => member !== backendFolder);
146
+ /**
147
+ * Nothing left is not a frontend.
148
+ *
149
+ * A bundle that carries only `backend/` and a manifest has no files to serve: the
150
+ * remaining tree is EMPTY, and reading that as a frontend publishes an app whose
151
+ * folder holds nothing, then refuses it for having no name. Such a bundle deploys
152
+ * its backend and publishes nothing - the halves are independent, which is what
153
+ * makes a backend shareable between frontends.
154
+ */
155
+ const frontend = contentsOf(web) ??
156
+ (ownFiles.length === 0 ? undefined : { members: ownFiles });
140
157
  return {
141
158
  tree: rest,
142
- frontend: contentsOf(web) ?? {
143
- members: withoutManifest.filter((member) => member !== folderNamed(withoutManifest, BACKEND_FOLDER))
144
- },
159
+ ...(frontend === undefined ? {} : { frontend }),
145
160
  ...(backend === undefined ? {} : { backend }),
146
161
  manifest: manifest
147
162
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.40.1",
3
+ "version": "0.40.2",
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",