@sasjs/api 0.23.1 → 0.25.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 (55) hide show
  1. package/README.md +10 -0
  2. package/build/browser.js +695 -101
  3. package/build/cjs/appstream/bundle.js +124 -0
  4. package/build/cjs/appstream/identity.js +69 -0
  5. package/build/cjs/appstream/service.js +226 -0
  6. package/build/cjs/appstream/store.js +69 -0
  7. package/build/cjs/appstream/web.js +248 -0
  8. package/build/cjs/corpus/deploy.js +112 -29
  9. package/build/cjs/corpus/runner.js +30 -18
  10. package/build/cjs/drive/deploy.js +20 -4
  11. package/build/cjs/drive/service.js +2 -2
  12. package/build/cjs/host/dispatch.js +38 -9
  13. package/build/cjs/index.js +25 -4
  14. package/build/cjs/routes/generated.js +2 -8
  15. package/build/cjs/routes/overlay.js +2 -2
  16. package/build/esm/appstream/bundle.d.ts +46 -0
  17. package/build/esm/appstream/bundle.d.ts.map +1 -0
  18. package/build/esm/appstream/bundle.js +118 -0
  19. package/build/esm/appstream/identity.d.ts +27 -0
  20. package/build/esm/appstream/identity.d.ts.map +1 -0
  21. package/build/esm/appstream/identity.js +63 -0
  22. package/build/esm/appstream/service.d.ts +96 -0
  23. package/build/esm/appstream/service.d.ts.map +1 -0
  24. package/build/esm/appstream/service.js +218 -0
  25. package/build/esm/appstream/store.d.ts +6 -0
  26. package/build/esm/appstream/store.d.ts.map +1 -0
  27. package/build/esm/appstream/store.js +65 -0
  28. package/build/esm/appstream/web.d.ts +74 -0
  29. package/build/esm/appstream/web.d.ts.map +1 -0
  30. package/build/esm/appstream/web.js +241 -0
  31. package/build/esm/corpus/deploy.d.ts +5 -5
  32. package/build/esm/corpus/deploy.d.ts.map +1 -1
  33. package/build/esm/corpus/deploy.js +112 -29
  34. package/build/esm/corpus/runner.d.ts.map +1 -1
  35. package/build/esm/corpus/runner.js +14 -2
  36. package/build/esm/drive/deploy.d.ts +41 -2
  37. package/build/esm/drive/deploy.d.ts.map +1 -1
  38. package/build/esm/drive/deploy.js +20 -4
  39. package/build/esm/drive/service.d.ts +2 -1
  40. package/build/esm/drive/service.d.ts.map +1 -1
  41. package/build/esm/drive/service.js +2 -2
  42. package/build/esm/host/dispatch.d.ts +5 -4
  43. package/build/esm/host/dispatch.d.ts.map +1 -1
  44. package/build/esm/host/dispatch.js +38 -9
  45. package/build/esm/index.d.ts +9 -3
  46. package/build/esm/index.d.ts.map +1 -1
  47. package/build/esm/index.js +5 -1
  48. package/build/esm/routes/generated.d.ts.map +1 -1
  49. package/build/esm/routes/generated.js +2 -8
  50. package/build/esm/routes/overlay.js +2 -2
  51. package/package.json +5 -4
  52. package/build/cjs/drive/registry.js +0 -38
  53. package/build/esm/drive/registry.d.ts +0 -52
  54. package/build/esm/drive/registry.d.ts.map +0 -1
  55. package/build/esm/drive/registry.js +0 -33
@@ -9,46 +9,35 @@ export const DEPLOY_CORPUS = [
9
9
  {
10
10
  id: 'deploy-unpublish',
11
11
  route: 'DELETE /SASjsApi/drive/deploy',
12
- description: 'removes a published app stream and answers the status',
12
+ description: 'removes the app the id names, and says what went',
13
13
  request: {
14
14
  subject: SUBJECT,
15
- body: { streamServiceName: 'myApp', appLoc: '/Public/myApp' }
15
+ body: { id: '6f1c1c1e-6a1e-4c4a-9d1a-1b2c3d4e5f60' }
16
16
  },
17
- expect: { status: 200, body: { status: 'success' } }
18
- },
19
- {
20
- id: 'deploy-unpublish-other-name',
21
- route: 'DELETE /SASjsApi/drive/deploy',
22
- description: 'removes the app by its folder when the name has been renamed',
23
- request: {
24
- subject: SUBJECT,
25
- body: { streamServiceName: 'renamed-app', appLoc: '/Public/myApp' }
26
- },
27
- expect: { status: 200, body: { status: 'success' } }
28
- },
29
- {
30
- id: 'deploy-unpublish-no-stream-name',
31
- route: 'DELETE /SASjsApi/drive/deploy',
32
- description: 'refuses a body that does not say which stream to remove',
33
- request: { subject: SUBJECT, body: { appLoc: '/Public/myApp' } },
34
- expect: { status: 400, error: '"streamServiceName" is required' }
17
+ expect: {
18
+ status: 200,
19
+ partial: {
20
+ status: 'success',
21
+ app: { id: '6f1c1c1e-6a1e-4c4a-9d1a-1b2c3d4e5f60', name: 'myApp' }
22
+ }
23
+ }
35
24
  },
36
25
  {
37
- id: 'deploy-unpublish-no-app-loc',
26
+ id: 'deploy-unpublish-no-id',
38
27
  route: 'DELETE /SASjsApi/drive/deploy',
39
- description: 'refuses a body that does not say which folder to remove',
40
- request: { subject: SUBJECT, body: { streamServiceName: 'myApp' } },
41
- expect: { status: 400, error: '"appLoc" is required' }
28
+ description: 'refuses a body that does not say which app to remove',
29
+ request: { subject: SUBJECT, body: {} },
30
+ expect: { status: 400, error: '"id" is required' }
42
31
  },
43
32
  {
44
- id: 'deploy-unpublish-unknown-folder',
33
+ id: 'deploy-unpublish-unknown-id',
45
34
  route: 'DELETE /SASjsApi/drive/deploy',
46
- description: 'answers 404 for a folder nothing is published at',
35
+ description: 'answers 404 for an id the index does not hold',
47
36
  request: {
48
37
  subject: SUBJECT,
49
- body: { streamServiceName: 'myApp', appLoc: '/Public/not-an-app' }
38
+ body: { id: '11111111-1111-4111-8111-111111111111' }
50
39
  },
51
- expect: { status: 404, error: 'No app is published at that folder.' }
40
+ expect: { status: 404, error: 'No app is published with that id.' }
52
41
  },
53
42
  // ------------------------------------------- the uploaded-archive route
54
43
  // The archive is expanded by the host, so what arrives here is the same tree
@@ -63,7 +52,35 @@ export const DEPLOY_CORPUS = [
63
52
  appLoc: '/Public/apps/uploaded',
64
53
  fileTree: {
65
54
  members: [
66
- { name: 'index.html', type: 'file', code: 'PGgxPkhlbGxvPC9oMT4=' }
55
+ {
56
+ name: 'index.html',
57
+ type: 'file',
58
+ code: 'PGgxPkhlbGxvPC9oMT4=',
59
+ encoding: 'base64'
60
+ }
61
+ ]
62
+ }
63
+ }
64
+ },
65
+ expect: {
66
+ status: 200,
67
+ body: {
68
+ status: 'success',
69
+ message: 'Files deployed successfully to @sasjs/server.'
70
+ }
71
+ }
72
+ },
73
+ {
74
+ id: 'upload-text-file',
75
+ route: 'POST /SASjsApi/drive/deploy/upload',
76
+ description: 'writes a file member as its own text when no encoding is stated',
77
+ request: {
78
+ subject: SUBJECT,
79
+ body: {
80
+ appLoc: '/Public/apps/text',
81
+ fileTree: {
82
+ members: [
83
+ { name: 'index.html', type: 'file', code: '<h1>Hello</h1>' }
67
84
  ]
68
85
  }
69
86
  }
@@ -113,6 +130,72 @@ export const DEPLOY_CORPUS = [
113
130
  error: 'The file tree exceeds the deploy limit: 10001 entries (maximum 10000).'
114
131
  }
115
132
  },
133
+ // ------------------------------------------- a bundle that is an app
134
+ // One deploy writes the tree and indexes the app, from the manifest at the
135
+ // root of the archive. The id is minted, so the case pins what can be pinned:
136
+ // the app exists, under the label the manifest states.
137
+ {
138
+ id: 'deploy-publishes-an-app',
139
+ route: 'POST /SASjsApi/drive/deploy',
140
+ description: 'indexes a bundle as an app from the manifest it carries, in one request',
141
+ request: {
142
+ subject: SUBJECT,
143
+ body: {
144
+ appLoc: '/Public/apps/mario',
145
+ fileTree: {
146
+ members: [
147
+ {
148
+ name: 'sasjs.app.json',
149
+ type: 'file',
150
+ code: JSON.stringify({
151
+ name: 'Mario',
152
+ streamWebFolder: 'web',
153
+ logo: 'logo.png'
154
+ })
155
+ },
156
+ {
157
+ name: 'services',
158
+ type: 'folder',
159
+ members: [
160
+ {
161
+ name: 'web',
162
+ type: 'folder',
163
+ members: [
164
+ { name: 'index.html', type: 'file', code: '<h1>Mario</h1>' }
165
+ ]
166
+ },
167
+ { name: 'run', type: 'service', code: '%put hi;' }
168
+ ]
169
+ }
170
+ ]
171
+ }
172
+ }
173
+ },
174
+ expect: {
175
+ status: 200,
176
+ partial: {
177
+ status: 'success',
178
+ app: { name: 'Mario' }
179
+ }
180
+ }
181
+ },
182
+ {
183
+ id: 'deploy-refuses-a-bad-manifest',
184
+ route: 'POST /SASjsApi/drive/deploy',
185
+ description: 'refuses a bundle whose manifest is not JSON',
186
+ request: {
187
+ subject: SUBJECT,
188
+ body: {
189
+ appLoc: '/Public/apps/bad-manifest',
190
+ fileTree: {
191
+ members: [{ name: 'sasjs.app.json', type: 'file', code: '{not json' }]
192
+ }
193
+ }
194
+ },
195
+ expect: {
196
+ status: 400
197
+ }
198
+ },
116
199
  {
117
200
  id: 'upload-refused-by-store',
118
201
  route: 'POST /SASjsApi/drive/deploy/upload',
@@ -1 +1 @@
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;AAsBnD,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;AA2BD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,UAAU,EACpB,WAAU,QAAgC,KACzC,OAAO,CAAC,UAAU,CAepB,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;AAsCnD,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;AA2BD;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,UAAU,EACpB,WAAU,QAAgC,KACzC,OAAO,CAAC,UAAU,CAepB,CAAA"}
@@ -1,7 +1,7 @@
1
1
  import { dispatch } from '../host/dispatch.js';
2
2
  import { createDriveService } from '../drive/service.js';
3
3
  import { MemoryDriveStore } from '../drive/memory-store.js';
4
- import { MemoryAppStreamRegistry } from '../drive/registry.js';
4
+ import { MemoryAppStreamStore, createAppStreamService } from '../appstream/service.js';
5
5
  import { createIdentityService } from '../identity/service.js';
6
6
  import { createRecordService } from '../identity/records.js';
7
7
  import { createSessionService } from '../session/service.js';
@@ -19,6 +19,18 @@ import { CORPUS_WEB_PAGE } from './home.js';
19
19
  import { MemoryIdentityStore } from '../identity/memory-store.js';
20
20
  import { DEFAULT_IDENTITY } from '../identity/fixture.js';
21
21
  import { isApiError } from '../types.js';
22
+ /**
23
+ * The app every case starts from: one published app, at the folder the unpublish
24
+ * cases name, so a removal has something to remove. Its id is stated rather than
25
+ * minted, because a case that pins "the id that is there" cannot invent one.
26
+ */
27
+ const CORPUS_APP = {
28
+ id: '6f1c1c1e-6a1e-4c4a-9d1a-1b2c3d4e5f60',
29
+ name: 'myApp',
30
+ appLoc: '/Public/myApp',
31
+ streamWebFolder: 'web',
32
+ publishedAt: '2026-01-01T00:00:00.000Z'
33
+ };
22
34
  /**
23
35
  * Services over fresh stores, seeded with the case's files and identity.
24
36
  *
@@ -54,7 +66,7 @@ export const servicesFor = (testCase) => {
54
66
  directory: createDirectoryService(identity, CORPUS_DIRECTORY),
55
67
  identity: createIdentityService(identity),
56
68
  records: createRecordService(identity),
57
- registry: new MemoryAppStreamRegistry(),
69
+ appStream: createAppStreamService(new MemoryAppStreamStore([CORPUS_APP])),
58
70
  session: createSessionService(identity, runner),
59
71
  // no `runTimes` option: the default is the five the document names, so a
60
72
  // case is never refused for a reason that belongs to one host's install
@@ -19,6 +19,14 @@
19
19
  import type { DriveStore } from '../types.js';
20
20
  /** The three member kinds the wire format carries. */
21
21
  export type DeployMemberType = 'folder' | 'service' | 'file';
22
+ /**
23
+ * How a `file` member carries its bytes.
24
+ *
25
+ * `utf8` is the default: `code` is the file's text, which is what most of a
26
+ * deployment is. `base64` is for bytes that are not text - an image, a font, a
27
+ * zip - and is the only form that survives the trip through JSON unchanged.
28
+ */
29
+ export type DeployFileEncoding = 'utf8' | 'base64';
22
30
  export interface DeployFolderMember {
23
31
  name: string;
24
32
  type: 'folder';
@@ -30,11 +38,20 @@ export interface DeployServiceMember {
30
38
  type: 'service';
31
39
  code: string;
32
40
  }
33
- /** A file; `code` is base64 of the bytes to write. */
41
+ /**
42
+ * A file; `code` is its text, or base64 of its bytes when `encoding` says so.
43
+ *
44
+ * An absent `encoding` means `utf8` - a caller publishing an HTML page or a
45
+ * JSON config writes the text it already holds. A binary member states
46
+ * `base64` and nothing is guessed from the contents: `test` and `data` are
47
+ * both valid base64, so sniffing would corrupt short text rather than decode a
48
+ * file.
49
+ */
34
50
  export interface DeployFileMember {
35
51
  name: string;
36
52
  type: 'file';
37
53
  code: string;
54
+ encoding?: DeployFileEncoding;
38
55
  }
39
56
  export type DeployMember = DeployFolderMember | DeployServiceMember | DeployFileMember;
40
57
  export interface DeployTree {
@@ -138,6 +155,28 @@ export declare const checkDeployTree: (members: DeployMember[], limits?: DeployL
138
155
  * a string `name`. Anything else is the `400` the routes already answer.
139
156
  */
140
157
  export declare const isDeployTree: (value: unknown) => value is DeployTree;
158
+ /**
159
+ * What a deploy may be told beyond the tree itself.
160
+ *
161
+ * `replace` writes the tree as the folder's whole contents: the folder is
162
+ * removed first, so a file the new version renamed or dropped stops answering
163
+ * at its old URL. It is opt-in because a caller may deploy one folder of a
164
+ * larger app, and a deploy that quietly deleted the rest would be worse than a
165
+ * stale file.
166
+ *
167
+ * The removal happens AFTER the tree is accepted (shape, containment, cap), so
168
+ * a request that is going to be refused never destroys what is already there.
169
+ *
170
+ * A folder can hold two published apps as a special case - the unpublish
171
+ * contract documents that - and replacing it removes both. The delete names the
172
+ * folder, not an app.
173
+ */
174
+ export interface DeployOptions {
175
+ /** Remove the app folder before writing the tree. Default `false`. */
176
+ replace?: boolean;
177
+ /** The cap to apply. Defaults to `DEPLOY_LIMITS`. */
178
+ limits?: DeployLimits;
179
+ }
141
180
  /**
142
181
  * Deploys a tree into `appLoc`, or refuses without writing.
143
182
  *
@@ -149,5 +188,5 @@ export declare const isDeployTree: (value: unknown) => value is DeployTree;
149
188
  * A write that fails part-way answers the deploy routes' `500`; the tree before
150
189
  * the failure is already on the drive, which the message does not hide.
151
190
  */
152
- export declare const deployTree: (store: DriveStore, appLoc: unknown, tree: unknown, limits?: DeployLimits) => Promise<void>;
191
+ export declare const deployTree: (store: DriveStore, appLoc: unknown, tree: unknown, options?: DeployOptions) => Promise<void>;
153
192
  //# sourceMappingURL=deploy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/drive/deploy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAI7C,sDAAsD;AACtD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,CAAA;AAE5D,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,QAAQ,CAAA;IACd,OAAO,EAAE,YAAY,EAAE,CAAA;CACxB;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,IAAI,EAAE,MAAM,CAAA;CACb;AAED,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI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M,UAAU,GACrB,OAAO,UAAU,EACjB,QAAQ,OAAO,EACf,MAAM,OAAO,EACb,UAAS,aAAkB,KAC1B,OAAO,CAAC,IAAI,CA0Cd,CAAA"}
@@ -87,7 +87,9 @@ const utf8Length = (value) => {
87
87
  /** The name a member is written under - a service gains the extension. */
88
88
  const memberName = (member) => member.type === 'service' ? `${member.name}.sas` : member.name;
89
89
  /** The bytes a member writes. */
90
- const memberBytes = (member) => member.type === 'file' ? base64Length(member.code) : utf8Length(member.code);
90
+ const memberBytes = (member) => member.type === 'file' && member.encoding === 'base64'
91
+ ? base64Length(member.code)
92
+ : utf8Length(member.code);
91
93
  const MEGABYTE = 1024 * 1024;
92
94
  /**
93
95
  * A MEASURED size, rounded UP to one decimal in binary megabytes.
@@ -242,8 +244,13 @@ const isDeployMember = (value) => {
242
244
  return false;
243
245
  if (member.type === 'folder')
244
246
  return Array.isArray(member.members) && member.members.every(isDeployMember);
245
- if (member.type === 'service' || member.type === 'file')
247
+ if (member.type === 'service')
246
248
  return typeof member.code === 'string';
249
+ if (member.type === 'file')
250
+ return (typeof member.code === 'string' &&
251
+ (member.encoding === undefined ||
252
+ member.encoding === 'utf8' ||
253
+ member.encoding === 'base64'));
247
254
  return false;
248
255
  };
249
256
  /**
@@ -257,7 +264,8 @@ const isDeployMember = (value) => {
257
264
  * A write that fails part-way answers the deploy routes' `500`; the tree before
258
265
  * the failure is already on the drive, which the message does not hide.
259
266
  */
260
- export const deployTree = async (store, appLoc, tree, limits = DEPLOY_LIMITS) => {
267
+ export const deployTree = async (store, appLoc, tree, options = {}) => {
268
+ const limits = options.limits ?? DEPLOY_LIMITS;
261
269
  if (!isDeployTree(tree))
262
270
  throw new ApiError(400, 'Provided not supported data format.', {
263
271
  status: 'failure',
@@ -278,6 +286,12 @@ export const deployTree = async (store, appLoc, tree, limits = DEPLOY_LIMITS) =>
278
286
  message: refusal.message
279
287
  });
280
288
  try {
289
+ if (options.replace && (await store.exists(root)))
290
+ await store.remove(root);
291
+ // The app's own folder is created before the first member is written: a tree
292
+ // whose root holds only files has no folder member to create it, and a store
293
+ // that writes through to a filesystem refuses a missing parent.
294
+ await store.mkdirp(root);
281
295
  await writeMembers(store, tree.members, root);
282
296
  }
283
297
  catch {
@@ -296,6 +310,8 @@ const writeMembers = async (store, members, parentPath) => {
296
310
  await writeMembers(store, member.members, path);
297
311
  continue;
298
312
  }
299
- await store.write(path, member.type === 'file' ? decodeBase64(member.code) : member.code);
313
+ await store.write(path, member.type === 'file' && member.encoding === 'base64'
314
+ ? decodeBase64(member.code)
315
+ : member.code);
300
316
  }
301
317
  };
@@ -12,6 +12,7 @@
12
12
  * in every consumer.
13
13
  */
14
14
  import type { DriveStore, TreeNode } from '../types.js';
15
+ import type { DeployOptions } from './deploy.js';
15
16
  export interface DriveResult {
16
17
  status: 'success';
17
18
  }
@@ -44,7 +45,7 @@ export interface DriveService {
44
45
  * the shape is one of the things this decides - a mistyped tree earns the
45
46
  * routes' `400` rather than a crash in a host that trusted it.
46
47
  */
47
- deploy(appLoc: string, tree: unknown): Promise<DriveResult>;
48
+ deploy(appLoc: string, tree: unknown, options?: DeployOptions): Promise<DriveResult>;
48
49
  }
49
50
  export declare const createDriveService: (store: DriveStore) => DriveService;
50
51
  //# sourceMappingURL=service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/drive/service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAYvD,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,SAAS,CAAA;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB;AAED,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;IAC7B,MAAM,EAAE,OAAO,CAAA;C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;;OAMG;IACH,MAAM,CACJ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,OAAO,EACb,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,WAAW,CAAC,CAAA;CACxB;AAqBD,eAAO,MAAM,kBAAkB,GAAI,OAAO,UAAU,KAAG,YAiKtD,CAAA"}
@@ -150,8 +150,8 @@ export const createDriveService = (store) => {
150
150
  throw new ApiError(400, 'Not a Folder.');
151
151
  return { status: 'success', tree: await treeOf(path) };
152
152
  },
153
- async deploy(appLoc, tree) {
154
- await deployTree(store, appLoc, tree);
153
+ async deploy(appLoc, tree, options) {
154
+ await deployTree(store, appLoc, tree, options);
155
155
  return { status: 'success' };
156
156
  }
157
157
  };
@@ -3,7 +3,7 @@ import type { IdentityService } from '../identity/service.js';
3
3
  import type { RecordService } from '../identity/records.js';
4
4
  import type { SessionService } from '../session/service.js';
5
5
  import type { RuntimeService } from '../runtime/service.js';
6
- import type { AppStreamRegistry } from '../drive/registry.js';
6
+ import type { AppStreamService } from '../appstream/service.js';
7
7
  import type { CodeService } from '../code/service.js';
8
8
  import type { InfoService } from '../info/service.js';
9
9
  import type { AuthConfigService } from '../authconfig/service.js';
@@ -100,10 +100,11 @@ export interface Services {
100
100
  */
101
101
  runtime?: RuntimeService;
102
102
  /**
103
- * The app streams a host has published. Absent, `DELETE /drive/deploy`
104
- * answers 501 - the package cannot know a host's stream registry.
103
+ * The apps a host has published, and their index. Absent, a deploy publishes
104
+ * nothing and `DELETE /drive/deploy` answers 501 - the package can decide what
105
+ * an app is, but only a host can store one.
105
106
  */
106
- registry?: AppStreamRegistry;
107
+ appStream?: AppStreamService;
107
108
  }
108
109
  export declare const dispatch: (services: Services, routeId: string, request?: ApiRequest) => Promise<ApiResponse>;
109
110
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../../../src/host/dispatch.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBA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,KAAG,QAO3C,CAAA;AAED,0DAA0D;AAC1D,eAAO,MAAM,cAAc,EAAE,MAAM,EA8DlC,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { routeById } from '../routes/index.js';
2
- import { unpublishAppStream } from '../drive/registry.js';
2
+ import { appSummary, checkPublishRequest } from '../appstream/service.js';
3
+ import { publishRequestFor, splitAppBundle } from '../appstream/bundle.js';
3
4
  import { ApiError } from '../types.js';
4
5
  import { DEPLOY_SUCCESS } from '../drive/deploy.js';
5
6
  /** The defaults sasjs/server's Client schema applies to an omitted lifetime. */
@@ -20,6 +21,8 @@ const RUN_ROUTES = [
20
21
  'POST /SASjsApi/code/execute',
21
22
  'POST /SASjsApi/code/trigger'
22
23
  ];
24
+ /** A payload value, when the caller actually stated one. */
25
+ const given = (value) => typeof value === 'string' && value !== '' ? value : undefined;
23
26
  /**
24
27
  * The parameters the table marks required, checked before the handler runs.
25
28
  *
@@ -275,18 +278,44 @@ export const dispatch = async (services, routeId, request = {}) => {
275
278
  // expansion, which is why the two share this path rather than reading bytes.
276
279
  case 'POST /SASjsApi/drive/deploy/upload':
277
280
  case 'POST /SASjsApi/drive/deploy': {
278
- // `streamWebFolder` is the host's: publishing an app stream is not a drive
279
- // operation, and a host that has no app stream ignores it.
280
- await drive.deploy(String(body.appLoc ?? ''), body.fileTree);
281
- return { status: 200, body: DEPLOY_SUCCESS };
281
+ // A bundle is one archive: the deployment and - when it carries one - the
282
+ // statement that this folder is an app. The manifest is metadata, so it is
283
+ // taken out of the tree before anything is written.
284
+ const bundle = splitAppBundle(body.fileTree);
285
+ const appLoc = String(body.appLoc ?? '');
286
+ const requested = services.appStream
287
+ ? publishRequestFor({
288
+ appLoc,
289
+ streamWebFolder: given(body.streamWebFolder),
290
+ streamServiceName: given(body.streamServiceName),
291
+ streamLogo: given(body.streamLogo)
292
+ }, bundle.manifest)
293
+ : undefined;
294
+ // the index's own checks run BEFORE the drive is written: a tree the index
295
+ // would refuse must not leave its files behind, which is what happened when
296
+ // the deploy came first - a request answered `400` had already deployed
297
+ const publish = requested === undefined ? undefined : checkPublishRequest(requested);
298
+ await drive.deploy(appLoc, bundle.tree);
299
+ // a deploy of something that is not an app writes files and says so; an app
300
+ // is indexed in the same request, so the two cannot disagree
301
+ if (publish === undefined || !services.appStream)
302
+ return { status: 200, body: DEPLOY_SUCCESS };
303
+ const entry = await services.appStream.publish(publish);
304
+ return {
305
+ status: 200,
306
+ body: { ...DEPLOY_SUCCESS, app: appSummary(entry) }
307
+ };
282
308
  }
283
- case 'DELETE /SASjsApi/drive/deploy':
284
- if (!services.registry)
285
- throw new ApiError(501, `This host has no app stream registry, so it cannot answer ${routeId}.`);
309
+ case 'DELETE /SASjsApi/drive/deploy': {
310
+ if (!services.appStream)
311
+ throw new ApiError(501, `This host has no app stream, so it cannot answer ${routeId}.`);
312
+ // the id is the app: a label is not unique and a folder is not a handle
313
+ const removed = await services.appStream.unpublish(String(body.id ?? ''));
286
314
  return {
287
315
  status: 200,
288
- body: await unpublishAppStream(services.registry, body)
316
+ body: { status: 'success', app: appSummary(removed) }
289
317
  };
318
+ }
290
319
  case 'GET /SASjsApi/drive/filetree':
291
320
  return { status: 200, body: await drive.tree(query._folderPath) };
292
321
  // ------------------------------------------------------------- run times
@@ -17,7 +17,7 @@ export * from './types.js';
17
17
  export { normaliseDrivePath, hasBlockedExtension, dirname, basename, isRoot } from './drive/paths.js';
18
18
  export { createDriveService } from './drive/service.js';
19
19
  export { DEPLOY_LIMITS, DEPLOY_PAYLOAD_BYTES, DEPLOY_SUCCESS, checkDeployTree, decodeBase64, deployTree, isDeployTree, measureDeployTree } from './drive/deploy.js';
20
- export type { DeployLimits, DeployMeasurements, DeployMember, DeployRefusal, DeployTree } from './drive/deploy.js';
20
+ export type { DeployFileEncoding, DeployLimits, DeployMeasurements, DeployMember, DeployOptions, DeployRefusal, DeployTree } from './drive/deploy.js';
21
21
  export type { DriveService, DriveResult, DriveListing, DriveFile, DriveTree } from './drive/service.js';
22
22
  export { MemoryDriveStore } from './drive/memory-store.js';
23
23
  export { ROUTES, routeById, findRoute } from './routes/index.js';
@@ -63,10 +63,16 @@ export type { ProgramSource, RunOutcome, RunRequest, RunnerSession, RuntimeReque
63
63
  export { MemorySessionRunner } from './runtime/memory-runner.js';
64
64
  export type { MemoryRunnerOptions } from './runtime/memory-runner.js';
65
65
  export { RUNTIME_CORPUS } from './corpus/runtime.js';
66
- export { MemoryAppStreamRegistry, unpublishAppStream } from './drive/registry.js';
67
- export type { AppStreamRegistry, UnpublishBody } from './drive/registry.js';
68
66
  export { RECORD_CORPUS, ADMIN_SIGNED_IN, PROVIDER_MANAGED } from './corpus/records.js';
69
67
  export type { CorpusCase } from './corpus/drive.js';
70
68
  export { runCase, servicesFor } from './corpus/runner.js';
71
69
  export type { CaseResult } from './corpus/runner.js';
70
+ export { appSummary, createAppStreamService, defaultAppName, MemoryAppStreamStore } from './appstream/service.js';
71
+ export type { AppStreamEntry, AppStreamService, AppStreamStore, PublishAppRequest } from './appstream/service.js';
72
+ export { APP_MANIFEST, parseAppManifest, publishRequestFor, splitAppBundle } from './appstream/bundle.js';
73
+ export type { AppBundle, AppManifest, DeployPublish } from './appstream/bundle.js';
74
+ export { APP_STREAM_INDEX, createDriveAppStreamStore } from './appstream/store.js';
75
+ export { DEFAULT_APP_PATH, NO_SUCH_APP, cacheControlFor, contentTypeFor, createAppStreamWebService, escapeHtml } from './appstream/web.js';
76
+ export type { AppFilter, AppStreamApp, AppStreamPage, AppStreamRequest, AppStreamWebOptions, AppStreamWebService } from './appstream/web.js';
77
+ export { isAppId, newAppId, normaliseAppLoc } from './appstream/identity.js';
72
78
  //# 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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AC9B,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"}
@@ -47,6 +47,10 @@ export { DEFAULT_SESSIONS, MemorySessionHost } from './session/memory-host.js';
47
47
  export { CODE_DEBUG, DOCUMENTED_RUN_TIMES, createRuntimeService } from './runtime/service.js';
48
48
  export { MemorySessionRunner } from './runtime/memory-runner.js';
49
49
  export { RUNTIME_CORPUS } from './corpus/runtime.js';
50
- export { MemoryAppStreamRegistry, unpublishAppStream } from './drive/registry.js';
51
50
  export { RECORD_CORPUS, ADMIN_SIGNED_IN, PROVIDER_MANAGED } from './corpus/records.js';
52
51
  export { runCase, servicesFor } from './corpus/runner.js';
52
+ export { appSummary, createAppStreamService, defaultAppName, MemoryAppStreamStore } from './appstream/service.js';
53
+ export { APP_MANIFEST, parseAppManifest, publishRequestFor, splitAppBundle } from './appstream/bundle.js';
54
+ export { APP_STREAM_INDEX, createDriveAppStreamStore } from './appstream/store.js';
55
+ export { DEFAULT_APP_PATH, NO_SUCH_APP, cacheControlFor, contentTypeFor, createAppStreamWebService, escapeHtml } from './appstream/web.js';
56
+ 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,EAshE5C,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,EAghE5C,CAAA"}
@@ -505,13 +505,7 @@ export const GENERATED_ROUTES = [
505
505
  summary: 'Remove an app stream entry',
506
506
  params: [
507
507
  {
508
- name: 'appLoc',
509
- in: 'body',
510
- required: true,
511
- type: 'string'
512
- },
513
- {
514
- name: 'streamServiceName',
508
+ name: 'id',
515
509
  in: 'body',
516
510
  required: true,
517
511
  type: 'string'
@@ -529,7 +523,7 @@ export const GENERATED_ROUTES = [
529
523
  },
530
524
  {
531
525
  status: 404,
532
- description: 'No app is published at that folder'
526
+ description: 'No app is published with that id'
533
527
  }
534
528
  ]
535
529
  },
@@ -248,8 +248,8 @@ export const OVERLAY = {
248
248
  }
249
249
  },
250
250
  'POST /SASjsApi/drive/deploy/upload': { implemented: true },
251
- // `404` is a pair - the registry name and the appLoc it was published from -
252
- // that matches no entry, and the drive's content is deliberately left alone.
251
+ // `404` is an id the index does not hold - the id is the app, and its label and
252
+ // folder are not handles - and the drive's content is deliberately left alone.
253
253
  'DELETE /SASjsApi/drive/deploy': { implemented: true },
254
254
  // Group - members and the groups themselves
255
255
  'GET /SASjsApi/group': { implemented: true },