@sasjs/api 0.24.0 → 0.26.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 (53) hide show
  1. package/README.md +10 -0
  2. package/build/browser.js +703 -94
  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 +83 -28
  9. package/build/cjs/corpus/runner.js +30 -18
  10. package/build/cjs/host/dispatch.js +38 -9
  11. package/build/cjs/identity/memory-store.js +51 -1
  12. package/build/cjs/index.js +25 -4
  13. package/build/cjs/routes/generated.js +2 -8
  14. package/build/cjs/routes/overlay.js +2 -2
  15. package/build/esm/appstream/bundle.d.ts +46 -0
  16. package/build/esm/appstream/bundle.d.ts.map +1 -0
  17. package/build/esm/appstream/bundle.js +118 -0
  18. package/build/esm/appstream/identity.d.ts +27 -0
  19. package/build/esm/appstream/identity.d.ts.map +1 -0
  20. package/build/esm/appstream/identity.js +63 -0
  21. package/build/esm/appstream/service.d.ts +96 -0
  22. package/build/esm/appstream/service.d.ts.map +1 -0
  23. package/build/esm/appstream/service.js +218 -0
  24. package/build/esm/appstream/store.d.ts +6 -0
  25. package/build/esm/appstream/store.d.ts.map +1 -0
  26. package/build/esm/appstream/store.js +65 -0
  27. package/build/esm/appstream/web.d.ts +74 -0
  28. package/build/esm/appstream/web.d.ts.map +1 -0
  29. package/build/esm/appstream/web.js +241 -0
  30. package/build/esm/corpus/deploy.d.ts +5 -5
  31. package/build/esm/corpus/deploy.d.ts.map +1 -1
  32. package/build/esm/corpus/deploy.js +83 -28
  33. package/build/esm/corpus/runner.d.ts.map +1 -1
  34. package/build/esm/corpus/runner.js +14 -2
  35. package/build/esm/host/dispatch.d.ts +5 -4
  36. package/build/esm/host/dispatch.d.ts.map +1 -1
  37. package/build/esm/host/dispatch.js +38 -9
  38. package/build/esm/identity/fixture.d.ts +9 -4
  39. package/build/esm/identity/fixture.d.ts.map +1 -1
  40. package/build/esm/identity/memory-store.d.ts +22 -0
  41. package/build/esm/identity/memory-store.d.ts.map +1 -1
  42. package/build/esm/identity/memory-store.js +51 -1
  43. package/build/esm/index.d.ts +8 -2
  44. package/build/esm/index.d.ts.map +1 -1
  45. package/build/esm/index.js +5 -1
  46. package/build/esm/routes/generated.d.ts.map +1 -1
  47. package/build/esm/routes/generated.js +2 -8
  48. package/build/esm/routes/overlay.js +2 -2
  49. package/package.json +5 -4
  50. package/build/cjs/drive/registry.js +0 -38
  51. package/build/esm/drive/registry.d.ts +0 -52
  52. package/build/esm/drive/registry.d.ts.map +0 -1
  53. package/build/esm/drive/registry.js +0 -33
@@ -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
@@ -14,8 +14,13 @@ export interface IdentityFixtureUser {
14
14
  uid: string;
15
15
  username: string;
16
16
  displayName: string;
17
- /** Plain text on purpose: a fixture, not a credential store. */
18
- password: string;
17
+ /**
18
+ * Plain text on purpose: a fixture, not a credential store. Absent when the
19
+ * account has no local password - one a directory imported authenticates
20
+ * there, and `createUser` leaves the password to a separate `setPassword`
21
+ * call, so a store can hold such an account as well.
22
+ */
23
+ password?: string;
19
24
  isAdmin: boolean;
20
25
  isActive: boolean;
21
26
  needsToUpdatePassword: boolean;
@@ -41,9 +46,9 @@ export interface IdentityFixturePermission {
41
46
  type: string;
42
47
  /** `Grant` or `Deny`. */
43
48
  setting: string;
44
- /** The username the rule is assigned to, when it is not a group's. */
49
+ /** The uid of the account the rule is assigned to, when it is not a group's. */
45
50
  user?: string;
46
- /** The group the rule is assigned to, when it is not a user's. */
51
+ /** The uid of the group the rule is assigned to, when it is not a user's. */
47
52
  group?: string;
48
53
  }
49
54
  export interface IdentityFixtureClient {
@@ -1 +1 @@
1
- {"version":3,"file":"fixture.d.ts","sourceRoot":"","sources":["../../../src/identity/fixture.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,eAAe,IAAI,CAAA;AAEhC,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,OAAO,CAAA;IAChB,QAAQ,EAAE,OAAO,CAAA;IACjB,qBAAqB,EAAE,OAAO,CAAA;IAC9B,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;IACjB,gCAA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AA;IACpB,qCAAqC;IACrC,qBAAqB,EAAE,MAAM,CAAA;IAC7B,qCAAqC;IACrC,sBAAsB,EAAE,MAAM,CAAA;CAC/B;AAED,wFAAwF;AACxF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,2EAA2E;AAC3E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,KAAK,EAAE,mBAAmB,EAAE,CAAA;IAC5B,MAAM,EAAE,oBAAoB,EAAE,CAAA;IAC9B,WAAW,EAAE,yBAAyB,EAAE,CAAA;IACxC,OAAO,EAAE,qBAAqB,EAAE,CAAA;IAChC,sDAAsD;IACtD,MAAM,CAAC,EAAE,oBAAoB,EAAE,CAAA;IAC/B,mEAAmE;IACnE,KAAK,CAAC,EAAE,mBAAmB,EAAE,CAAA;CAC9B;AAID,eAAO,MAAM,gBAAgB,EAAE,eA6E9B,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,OAAO,KAAG,eA2B5C,CAAA"}
@@ -81,5 +81,27 @@ export declare class MemoryIdentityStore implements IdentityStore {
81
81
  deletePermission(uid: string): Promise<void>;
82
82
  clients(): Promise<IdentityClientRecord[]>;
83
83
  createClient(input: IdentityClientRecord): Promise<IdentityClientRecord>;
84
+ /**
85
+ * The fixture this store would be seeded from now.
86
+ *
87
+ * A host that persists the store - the browser build keeps it beside the
88
+ * drive - writes this object and seeds the next boot from it, so the file a
89
+ * person reads and the object the store speaks are the same shape. Passwords
90
+ * are carried because a seed needs them to sign in: the administration
91
+ * records deliberately leave them out, and a snapshot that did too would be a
92
+ * fixture no one could log into.
93
+ *
94
+ * Tokens and authorization codes are absent on purpose. They are credentials
95
+ * with a lifetime, minted per session; a persisted one would authenticate a
96
+ * caller after the pair it names had been rotated or revoked, which is the
97
+ * failure a token store exists to prevent.
98
+ *
99
+ * An account with no local password - one a directory imported, or one
100
+ * created and never given a password - is stated without one. Writing an
101
+ * empty string would seed an account the equality check signs in with `''`,
102
+ * while an absent password refuses every attempt, which is what this store
103
+ * itself answers for that account.
104
+ */
105
+ snapshot(): IdentityFixture;
84
106
  }
85
107
  //# sourceMappingURL=memory-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"memory-store.d.ts","sourceRoot":"","sources":["../../../src/identity/memory-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,aAAa,EACb,OAAO,EACP,OAAO,EACP,SAAS,EACT,UAAU,EACX,MAAM,YAAY,CAAA;AACnB,OAAO,EAGL,KAAK,eAAe,EACrB,MAAM,cAAc,CAAA;AA+DrB;;;;;GAKG;AACH,qBAAa,mBAAoB,YAAW,aAAa;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAmB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAyC;IACnE,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA8C;IAC7E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA0C;IACxE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAoC;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA+B;IACrD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA4B;IACnD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA4B;IACpD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA4B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,KAAK,EAAE,oBAAoB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IAUhC;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,QAAQ,IAAI,eAAe;CA4B5B"}
@@ -63,7 +63,11 @@ export class MemoryIdentityStore {
63
63
  authProvider: user.authProvider,
64
64
  autoExec: user.autoExec
65
65
  });
66
- this.passwords.set(user.uid, user.password);
66
+ // a fixture states no password for an account whose password lives at
67
+ // its provider - a directory import writes exactly that shape - and an
68
+ // absent entry is what refuses every attempt, empty string included
69
+ if (user.password !== undefined)
70
+ this.passwords.set(user.uid, user.password);
67
71
  }
68
72
  for (const client of fixture.clients) {
69
73
  this.clientMap.set(client.clientId, {
@@ -376,4 +380,50 @@ export class MemoryIdentityStore {
376
380
  });
377
381
  return input;
378
382
  }
383
+ /**
384
+ * The fixture this store would be seeded from now.
385
+ *
386
+ * A host that persists the store - the browser build keeps it beside the
387
+ * drive - writes this object and seeds the next boot from it, so the file a
388
+ * person reads and the object the store speaks are the same shape. Passwords
389
+ * are carried because a seed needs them to sign in: the administration
390
+ * records deliberately leave them out, and a snapshot that did too would be a
391
+ * fixture no one could log into.
392
+ *
393
+ * Tokens and authorization codes are absent on purpose. They are credentials
394
+ * with a lifetime, minted per session; a persisted one would authenticate a
395
+ * caller after the pair it names had been rotated or revoked, which is the
396
+ * failure a token store exists to prevent.
397
+ *
398
+ * An account with no local password - one a directory imported, or one
399
+ * created and never given a password - is stated without one. Writing an
400
+ * empty string would seed an account the equality check signs in with `''`,
401
+ * while an absent password refuses every attempt, which is what this store
402
+ * itself answers for that account.
403
+ */
404
+ snapshot() {
405
+ return {
406
+ format: IDENTITY_FORMAT,
407
+ users: this.userList.map((user) => {
408
+ const password = this.passwords.get(user.uid);
409
+ return {
410
+ ...user,
411
+ ...(password === undefined ? {} : { password })
412
+ };
413
+ }),
414
+ groups: [...this.groupList.values()].map((group) => ({
415
+ ...group,
416
+ // the store holds members as uids; the fixture states them by username,
417
+ // which is what the constructor resolves back - writing uids here would
418
+ // seed a group whose membership matches no account
419
+ users: group.users
420
+ .map((uid) => this.userList.find((user) => user.uid === uid)?.username)
421
+ .filter((username) => username !== undefined)
422
+ })),
423
+ permissions: [...this.permissionList.values()].map((permission) => ({
424
+ ...permission
425
+ })),
426
+ clients: [...this.clientRecords.values()].map((client) => ({ ...client }))
427
+ };
428
+ }
379
429
  }
@@ -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":"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B,CAAA;AAC/B,YAAY,EACV,cAAc,EACd,gBAAgB,EAChB,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"}
@@ -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 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sasjs/api",
3
- "version": "0.24.0",
3
+ "version": "0.26.0",
4
4
  "description": "The SASjs Server API, described once - a generated route table, the services behind it, and the conformance corpus both hosts run",
5
5
  "license": "MIT",
6
6
  "author": "SASjs",
@@ -38,11 +38,12 @@
38
38
  "test": "jest --coverage",
39
39
  "coverage:comment": "node scripts/coverage-comment.mjs",
40
40
  "test:watch": "jest --watch",
41
- "lint": "prettier --check \"{src,spec,scripts}/**/*.{ts,mjs,md}\" \"*.{json,md}\"",
42
- "lint:fix": "prettier --write \"{src,spec,scripts}/**/*.{ts,mjs,md}\" \"*.{json,md}\"",
41
+ "lint": "prettier --check \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
42
+ "lint:fix": "prettier --write \"{src,spec,scripts}/**/*.{ts,mjs,cjs,md}\" \"*.{json,md}\"",
43
43
  "sync:routes": "node scripts/sync-routes.mjs",
44
44
  "check:routes": "node scripts/sync-routes.mjs --check",
45
- "audit:gate": "node scripts/audit.mjs"
45
+ "audit:gate": "node scripts/audit.mjs",
46
+ "check:appstream": "node scripts/appstream-browser-check.cjs"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@semantic-release/commit-analyzer": "13.0.1",
@@ -1,38 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MemoryAppStreamRegistry = exports.unpublishAppStream = void 0;
4
- const types_js_1 = require("../types.js");
5
- /**
6
- * `DELETE /SASjsApi/drive/deploy`.
7
- *
8
- * The document requires both body values, so both are checked - a caller that
9
- * names a stream but not the folder has not said what to remove. Only the folder
10
- * reaches the registry, because that is what identifies the app.
11
- *
12
- * The checks are here rather than in the transport because this is the one
13
- * implementation of the operation: a host calling it directly gets the same
14
- * refusals in the same order, and with the same messages the document states.
15
- */
16
- const unpublishAppStream = async (registry, body) => {
17
- if (!body?.streamServiceName)
18
- throw new types_js_1.ApiError(400, '"streamServiceName" is required');
19
- if (!body.appLoc)
20
- throw new types_js_1.ApiError(400, '"appLoc" is required');
21
- if (!(await registry.unpublish(body.appLoc)))
22
- throw new types_js_1.ApiError(404, 'No app is published at that folder.');
23
- return { status: 'success' };
24
- };
25
- exports.unpublishAppStream = unpublishAppStream;
26
- /**
27
- * The registry the corpus and the package's own tests read: one published app,
28
- * identified by its folder alone.
29
- */
30
- class MemoryAppStreamRegistry {
31
- constructor(folders = ['/Public/myApp']) {
32
- this.folders = new Set(folders);
33
- }
34
- async unpublish(appLoc) {
35
- return this.folders.delete(appLoc);
36
- }
37
- }
38
- exports.MemoryAppStreamRegistry = MemoryAppStreamRegistry;
@@ -1,52 +0,0 @@
1
- /**
2
- * The app streams a host has published, as the API needs to unpublish one.
3
- *
4
- * A published stream is the host's own record - a directory convention, a
5
- * registry table, whatever it uses to know that `/Public/myApp` is served at
6
- * `/Public/myApp/index.html`. The package cannot invent it, so the route takes
7
- * this port and answers 501 without it, the same way the session routes do.
8
- */
9
- export interface AppStreamRegistry {
10
- /**
11
- * Removes the app published at `appLoc`.
12
- *
13
- * **The folder is the identity.** An app is one thing to deploy and one thing
14
- * to delete, and what it is called is a label on it: two apps can share a
15
- * folder only as a special case, and they are still one thing to load or
16
- * remove. So the lookup is by folder, and a name that no longer matches the
17
- * one recorded does not turn a correct deletion into a `404`.
18
- *
19
- * `false` when nothing is published at that folder, which the route reports as
20
- * a 404 - a delete that silently succeeded on a folder nobody deployed would
21
- * hide a caller's typo.
22
- */
23
- unpublish(appLoc: string): Promise<boolean>;
24
- }
25
- export interface UnpublishBody {
26
- streamServiceName?: string;
27
- appLoc?: string;
28
- }
29
- /**
30
- * `DELETE /SASjsApi/drive/deploy`.
31
- *
32
- * The document requires both body values, so both are checked - a caller that
33
- * names a stream but not the folder has not said what to remove. Only the folder
34
- * reaches the registry, because that is what identifies the app.
35
- *
36
- * The checks are here rather than in the transport because this is the one
37
- * implementation of the operation: a host calling it directly gets the same
38
- * refusals in the same order, and with the same messages the document states.
39
- */
40
- export declare const unpublishAppStream: (registry: AppStreamRegistry, body: UnpublishBody | undefined) => Promise<{
41
- status: "success";
42
- }>;
43
- /**
44
- * The registry the corpus and the package's own tests read: one published app,
45
- * identified by its folder alone.
46
- */
47
- export declare class MemoryAppStreamRegistry implements AppStreamRegistry {
48
- private readonly folders;
49
- constructor(folders?: string[]);
50
- unpublish(appLoc: string): Promise<boolean>;
51
- }
52
- //# sourceMappingURL=registry.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/drive/registry.ts"],"names":[],"mappings":"AAEA;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC5C;AAED,MAAM,WAAW,aAAa;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,iBAAiB,EAC3B,MAAM,aAAa,GAAG,SAAS,KAC9B,OAAO,CAAC;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,CAU/B,CAAA;AAED;;;GAGG;AACH,qBAAa,uBAAwB,YAAW,iBAAiB;IAC/D,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAa;gBAEzB,OAAO,GAAE,MAAM,EAAsB;IAI3C,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAGlD"}
@@ -1,33 +0,0 @@
1
- import { ApiError } from '../types.js';
2
- /**
3
- * `DELETE /SASjsApi/drive/deploy`.
4
- *
5
- * The document requires both body values, so both are checked - a caller that
6
- * names a stream but not the folder has not said what to remove. Only the folder
7
- * reaches the registry, because that is what identifies the app.
8
- *
9
- * The checks are here rather than in the transport because this is the one
10
- * implementation of the operation: a host calling it directly gets the same
11
- * refusals in the same order, and with the same messages the document states.
12
- */
13
- export const unpublishAppStream = async (registry, body) => {
14
- if (!body?.streamServiceName)
15
- throw new ApiError(400, '"streamServiceName" is required');
16
- if (!body.appLoc)
17
- throw new ApiError(400, '"appLoc" is required');
18
- if (!(await registry.unpublish(body.appLoc)))
19
- throw new ApiError(404, 'No app is published at that folder.');
20
- return { status: 'success' };
21
- };
22
- /**
23
- * The registry the corpus and the package's own tests read: one published app,
24
- * identified by its folder alone.
25
- */
26
- export class MemoryAppStreamRegistry {
27
- constructor(folders = ['/Public/myApp']) {
28
- this.folders = new Set(folders);
29
- }
30
- async unpublish(appLoc) {
31
- return this.folders.delete(appLoc);
32
- }
33
- }