@sasjs/api 0.45.0 → 0.47.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.
package/build/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- /* @sasjs/api 0.45.0 - the SASjs Server API, for a service worker. https://github.com/sasjs/api */
1
+ /* @sasjs/api 0.47.0 - 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;
@@ -4070,6 +4070,13 @@ var SASjsApi = (() => {
4070
4070
  decision: "in",
4071
4071
  reason: "the job path a deployed service runs through"
4072
4072
  },
4073
+ {
4074
+ path: "/jobDefinitions/definitions/{}",
4075
+ family: "viya-jobs",
4076
+ decision: "in",
4077
+ source: "capture",
4078
+ reason: "the definition itself, which the client reads through the link a folder listing handed it - the URL arrives as data, so no literal in the adapter states it"
4079
+ },
4073
4080
  {
4074
4081
  path: "/jobExecution/jobs",
4075
4082
  family: "viya-jobs",
@@ -4395,6 +4402,33 @@ var SASjsApi = (() => {
4395
4402
  },
4396
4403
  shape: void 0
4397
4404
  },
4405
+ {
4406
+ id: "GET /compute/sessions/{}/variables/{}",
4407
+ method: "GET",
4408
+ path: "/compute/sessions/{}/variables/{}",
4409
+ steps: ["compute/execute-script"],
4410
+ statuses: [200],
4411
+ queries: [],
4412
+ request: {
4413
+ queries: [],
4414
+ body: void 0
4415
+ },
4416
+ shape: {
4417
+ links: [
4418
+ {
4419
+ href: "string",
4420
+ method: "string",
4421
+ rel: "string",
4422
+ type: "string",
4423
+ uri: "string"
4424
+ }
4425
+ ],
4426
+ name: "string",
4427
+ scope: "string",
4428
+ value: "string",
4429
+ version: "number"
4430
+ }
4431
+ },
4398
4432
  {
4399
4433
  id: "POST /files/files",
4400
4434
  method: "POST",
@@ -4548,7 +4582,7 @@ var SASjsApi = (() => {
4548
4582
  id: "GET /files/files/{}/content",
4549
4583
  method: "GET",
4550
4584
  path: "/files/files/{}/content",
4551
- steps: ["files/content"],
4585
+ steps: ["files/content", "jobs/execute"],
4552
4586
  statuses: [200],
4553
4587
  queries: [],
4554
4588
  request: {
@@ -4609,7 +4643,7 @@ var SASjsApi = (() => {
4609
4643
  id: "POST /folders/folders",
4610
4644
  method: "POST",
4611
4645
  path: "/folders/folders",
4612
- steps: ["folders/create"],
4646
+ steps: ["folders/create", "jobs/folder-create"],
4613
4647
  statuses: [201],
4614
4648
  queries: ["parentFolderUri"],
4615
4649
  request: {
@@ -4645,7 +4679,7 @@ var SASjsApi = (() => {
4645
4679
  id: "GET /folders/folders/{}",
4646
4680
  method: "GET",
4647
4681
  path: "/folders/folders/{}",
4648
- steps: ["folders/delete"],
4682
+ steps: ["folders/delete", "jobs/folders/delete"],
4649
4683
  statuses: [200],
4650
4684
  queries: [],
4651
4685
  request: {
@@ -4682,7 +4716,7 @@ var SASjsApi = (() => {
4682
4716
  id: "PATCH /folders/folders/{}",
4683
4717
  method: "PATCH",
4684
4718
  path: "/folders/folders/{}",
4685
- steps: ["folders/delete"],
4719
+ steps: ["folders/delete", "jobs/folders/delete"],
4686
4720
  statuses: [200],
4687
4721
  queries: [],
4688
4722
  request: {
@@ -4722,8 +4756,8 @@ var SASjsApi = (() => {
4722
4756
  steps: [
4723
4757
  "files/content",
4724
4758
  "files/replace",
4725
- "folders/create",
4726
- "folders/members"
4759
+ "folders/members",
4760
+ "jobs/execute"
4727
4761
  ],
4728
4762
  statuses: [200],
4729
4763
  queries: ["limit"],
@@ -4786,7 +4820,13 @@ var SASjsApi = (() => {
4786
4820
  "folders/create",
4787
4821
  "folders/delete",
4788
4822
  "folders/item",
4789
- "folders/members"
4823
+ "folders/members",
4824
+ "folders/missing",
4825
+ "folders/unauthorized",
4826
+ "jobs/definition",
4827
+ "jobs/execute",
4828
+ "jobs/folder-create",
4829
+ "jobs/folders/delete"
4790
4830
  ],
4791
4831
  statuses: [200, 401, 404],
4792
4832
  queries: ["path"],
@@ -4821,7 +4861,7 @@ var SASjsApi = (() => {
4821
4861
  id: "GET /folders/folders/@myRecycleBin",
4822
4862
  method: "GET",
4823
4863
  path: "/folders/folders/@myRecycleBin",
4824
- steps: ["folders/delete"],
4864
+ steps: ["folders/delete", "jobs/folders/delete"],
4825
4865
  statuses: [200],
4826
4866
  queries: [],
4827
4867
  request: {
@@ -4894,6 +4934,348 @@ var SASjsApi = (() => {
4894
4934
  version: "number"
4895
4935
  }
4896
4936
  },
4937
+ {
4938
+ id: "POST /jobDefinitions/definitions",
4939
+ method: "POST",
4940
+ path: "/jobDefinitions/definitions",
4941
+ steps: ["jobs/definition"],
4942
+ statuses: [201],
4943
+ queries: ["parentFolderUri"],
4944
+ request: {
4945
+ queries: ["parentFolderUri"],
4946
+ body: {
4947
+ code: "string",
4948
+ name: "string",
4949
+ parameters: [
4950
+ {
4951
+ defaultValue: "string",
4952
+ name: "string",
4953
+ type: "string"
4954
+ }
4955
+ ],
4956
+ type: "string"
4957
+ }
4958
+ },
4959
+ shape: {
4960
+ code: "string",
4961
+ createdBy: "string",
4962
+ creationTimeStamp: "string",
4963
+ id: "string",
4964
+ links: [
4965
+ {
4966
+ href: "string",
4967
+ method: "string",
4968
+ rel: "string",
4969
+ type: "string",
4970
+ uri: "string"
4971
+ }
4972
+ ],
4973
+ modifiedBy: "string",
4974
+ modifiedTimeStamp: "string",
4975
+ name: "string",
4976
+ parameters: [
4977
+ {
4978
+ defaultValue: "string",
4979
+ name: "string",
4980
+ required: "boolean",
4981
+ type: "string",
4982
+ version: "number"
4983
+ }
4984
+ ],
4985
+ type: "string",
4986
+ version: "number"
4987
+ }
4988
+ },
4989
+ {
4990
+ id: "GET /jobDefinitions/definitions/{}",
4991
+ method: "GET",
4992
+ path: "/jobDefinitions/definitions/{}",
4993
+ steps: ["jobs/execute"],
4994
+ statuses: [200],
4995
+ queries: [],
4996
+ request: {
4997
+ queries: [],
4998
+ body: void 0
4999
+ },
5000
+ shape: {
5001
+ code: "string",
5002
+ createdBy: "string",
5003
+ creationTimeStamp: "string",
5004
+ id: "string",
5005
+ links: [
5006
+ {
5007
+ href: "string",
5008
+ method: "string",
5009
+ rel: "string",
5010
+ type: "string",
5011
+ uri: "string"
5012
+ }
5013
+ ],
5014
+ modifiedBy: "string",
5015
+ modifiedTimeStamp: "string",
5016
+ name: "string",
5017
+ parameters: [
5018
+ {
5019
+ defaultValue: "string",
5020
+ name: "string",
5021
+ required: "boolean",
5022
+ type: "string",
5023
+ version: "number"
5024
+ }
5025
+ ],
5026
+ type: "string",
5027
+ version: "number"
5028
+ }
5029
+ },
5030
+ {
5031
+ id: "POST /jobExecution/jobs",
5032
+ method: "POST",
5033
+ path: "/jobExecution/jobs",
5034
+ steps: ["jobs/execute"],
5035
+ statuses: [201],
5036
+ queries: ["_action"],
5037
+ request: {
5038
+ queries: ["_action"],
5039
+ body: {
5040
+ arguments: {
5041
+ _DEBUG: "string",
5042
+ _OMITJSONLISTING: "string",
5043
+ _OMITJSONLOG: "string",
5044
+ _OMITTEXTLISTING: "string",
5045
+ _OMITTEXTLOG: "string",
5046
+ _contextName: "string",
5047
+ _omitSessionResults: "string",
5048
+ _program: "string",
5049
+ _webin_file_count: "string"
5050
+ },
5051
+ description: "string",
5052
+ jobDefinition: {
5053
+ code: "string",
5054
+ createdBy: "string",
5055
+ creationTimeStamp: "string",
5056
+ id: "string",
5057
+ links: [
5058
+ {
5059
+ href: "string",
5060
+ method: "string",
5061
+ rel: "string",
5062
+ type: "string",
5063
+ uri: "string"
5064
+ }
5065
+ ],
5066
+ modifiedBy: "string",
5067
+ modifiedTimeStamp: "string",
5068
+ name: "string",
5069
+ parameters: [
5070
+ {
5071
+ defaultValue: "string",
5072
+ name: "string",
5073
+ required: "boolean",
5074
+ type: "string",
5075
+ version: "number"
5076
+ }
5077
+ ],
5078
+ type: "string",
5079
+ version: "number"
5080
+ },
5081
+ name: "string"
5082
+ }
5083
+ },
5084
+ shape: {
5085
+ createdBy: "string",
5086
+ creationTimeStamp: "string",
5087
+ elapsedTime: "number",
5088
+ heartbeatInterval: "number",
5089
+ heartbeatTimeStamp: "string",
5090
+ id: "string",
5091
+ jobRequest: {
5092
+ arguments: {
5093
+ _DEBUG: "string",
5094
+ _OMITJSONLISTING: "string",
5095
+ _OMITJSONLOG: "string",
5096
+ _OMITTEXTLISTING: "string",
5097
+ _OMITTEXTLOG: "string",
5098
+ _addjesbeginendmacros: "string",
5099
+ _contextName: "string",
5100
+ _omitSessionResults: "string",
5101
+ _program: "string",
5102
+ _webin_file_count: "string"
5103
+ },
5104
+ createdByApplication: "string",
5105
+ description: "string",
5106
+ jobDefinition: {
5107
+ code: "string",
5108
+ createdBy: "string",
5109
+ creationTimeStamp: "string",
5110
+ id: "string",
5111
+ links: ["object"],
5112
+ modifiedBy: "string",
5113
+ modifiedTimeStamp: "string",
5114
+ name: "string",
5115
+ parameters: ["object"],
5116
+ type: "string",
5117
+ version: "number"
5118
+ },
5119
+ name: "string",
5120
+ properties: "array",
5121
+ version: "number"
5122
+ },
5123
+ links: [
5124
+ {
5125
+ href: "string",
5126
+ method: "string",
5127
+ rel: "string",
5128
+ type: "string",
5129
+ uri: "string"
5130
+ }
5131
+ ],
5132
+ modifiedBy: "string",
5133
+ modifiedTimeStamp: "string",
5134
+ results: {},
5135
+ state: "string",
5136
+ submittedByApplication: "string",
5137
+ version: "number"
5138
+ }
5139
+ },
5140
+ {
5141
+ id: "GET /jobExecution/jobs/{}",
5142
+ method: "GET",
5143
+ path: "/jobExecution/jobs/{}",
5144
+ steps: ["jobs/execute"],
5145
+ statuses: [200],
5146
+ queries: [],
5147
+ request: {
5148
+ queries: [],
5149
+ body: void 0
5150
+ },
5151
+ shape: {
5152
+ createdBy: "string",
5153
+ creationTimeStamp: "string",
5154
+ elapsedTime: "number",
5155
+ endTimeStamp: "string",
5156
+ heartbeatInterval: "number",
5157
+ heartbeatTimeStamp: "string",
5158
+ id: "string",
5159
+ jobRequest: {
5160
+ arguments: {
5161
+ _DEBUG: "string",
5162
+ _OMITJSONLISTING: "string",
5163
+ _OMITJSONLOG: "string",
5164
+ _OMITTEXTLISTING: "string",
5165
+ _OMITTEXTLOG: "string",
5166
+ _addjesbeginendmacros: "string",
5167
+ _contextName: "string",
5168
+ _omitSessionResults: "string",
5169
+ _program: "string",
5170
+ _webin_file_count: "string"
5171
+ },
5172
+ createdByApplication: "string",
5173
+ description: "string",
5174
+ jobDefinition: {
5175
+ code: "string",
5176
+ createdBy: "string",
5177
+ creationTimeStamp: "string",
5178
+ id: "string",
5179
+ links: ["object"],
5180
+ modifiedBy: "string",
5181
+ modifiedTimeStamp: "string",
5182
+ name: "string",
5183
+ parameters: ["object"],
5184
+ type: "string",
5185
+ version: "number"
5186
+ },
5187
+ name: "string",
5188
+ properties: "array",
5189
+ version: "number"
5190
+ },
5191
+ links: [
5192
+ {
5193
+ href: "string",
5194
+ method: "string",
5195
+ rel: "string",
5196
+ type: "string",
5197
+ uri: "string"
5198
+ }
5199
+ ],
5200
+ logLocation: "string",
5201
+ modifiedBy: "string",
5202
+ modifiedTimeStamp: "string",
5203
+ results: {
5204
+ COMPUTE_CONTEXT: "string",
5205
+ COMPUTE_JOB: "string",
5206
+ COMPUTE_SESSION: "string",
5207
+ "{}.log": "string",
5208
+ "{}.log.txt": "string"
5209
+ },
5210
+ state: "string",
5211
+ submittedByApplication: "string",
5212
+ version: "number"
5213
+ }
5214
+ },
5215
+ {
5216
+ id: "GET /jobExecution/jobs/{}/state",
5217
+ method: "GET",
5218
+ path: "/jobExecution/jobs/{}/state",
5219
+ steps: ["jobs/execute"],
5220
+ statuses: [200],
5221
+ queries: ["_action", "wait"],
5222
+ request: {
5223
+ queries: ["_action", "wait"],
5224
+ body: void 0
5225
+ },
5226
+ shape: void 0
5227
+ },
5228
+ {
5229
+ id: "GET /launcher/contexts",
5230
+ method: "GET",
5231
+ path: "/launcher/contexts",
5232
+ steps: ["compute/launcher-contexts"],
5233
+ statuses: [200],
5234
+ queries: ["limit"],
5235
+ request: {
5236
+ queries: ["limit"],
5237
+ body: void 0
5238
+ },
5239
+ shape: {
5240
+ accept: "string",
5241
+ count: "number",
5242
+ items: [
5243
+ {
5244
+ createdBy: "string",
5245
+ creationTimeStamp: "string",
5246
+ description: "string",
5247
+ id: "string",
5248
+ links: [
5249
+ {
5250
+ href: "string",
5251
+ method: "string",
5252
+ rel: "string",
5253
+ type: "string",
5254
+ uri: "string"
5255
+ }
5256
+ ],
5257
+ modifiedBy: "string",
5258
+ modifiedTimeStamp: "string",
5259
+ name: "string",
5260
+ type: "string",
5261
+ version: "number"
5262
+ }
5263
+ ],
5264
+ limit: "number",
5265
+ links: [
5266
+ {
5267
+ href: "string",
5268
+ method: "string",
5269
+ rel: "string",
5270
+ type: "string",
5271
+ uri: "string"
5272
+ }
5273
+ ],
5274
+ name: "string",
5275
+ start: "number",
5276
+ version: "number"
5277
+ }
5278
+ },
4897
5279
  {
4898
5280
  id: "POST /SASLogon/oauth/token",
4899
5281
  method: "POST",
@@ -4931,7 +5313,45 @@ var SASjsApi = (() => {
4931
5313
  queries: ["limit"],
4932
5314
  body: void 0
4933
5315
  },
4934
- shape: void 0
5316
+ shape: {
5317
+ accept: "string",
5318
+ count: "number",
5319
+ items: [
5320
+ {
5321
+ description: "string",
5322
+ iconUri: "string",
5323
+ label: "string",
5324
+ links: [
5325
+ {
5326
+ href: "string",
5327
+ method: "string",
5328
+ rel: "string",
5329
+ type: "string",
5330
+ uri: "string"
5331
+ }
5332
+ ],
5333
+ mediaType: "string",
5334
+ name: "string",
5335
+ resourceUri: "string",
5336
+ tags: ["string"],
5337
+ version: "number"
5338
+ }
5339
+ ],
5340
+ limit: "number",
5341
+ links: [
5342
+ {
5343
+ href: "string",
5344
+ itemType: "string",
5345
+ method: "string",
5346
+ rel: "string",
5347
+ type: "string",
5348
+ uri: "string"
5349
+ }
5350
+ ],
5351
+ name: "string",
5352
+ start: "number",
5353
+ version: "number"
5354
+ }
4935
5355
  }
4936
5356
  ];
4937
5357
 
@@ -4967,28 +5387,6 @@ var SASjsApi = (() => {
4967
5387
  {
4968
5388
  path: "/SASLogon/oauth/authorize",
4969
5389
  reason: "no capture: the authorisation-code step needs a browser; the pass uses the password grant"
4970
- },
4971
- // Compute operations the scripted passes do not reach.
4972
- {
4973
- path: "/compute/sessions/{}/variables/{}",
4974
- reason: "no capture: the adapter reads a session variable only to report a submitted job's pid (`printPid`), which the pass does not set"
4975
- },
4976
- {
4977
- path: "/launcher/contexts",
4978
- reason: "no capture: the fallback list, asked for only when the compute context list fails; a healthy estate never reaches it"
4979
- },
4980
- // The job path needs something deployed to run.
4981
- {
4982
- path: "/jobDefinitions/definitions",
4983
- reason: "no capture: needs a job definition on the estate. The next pass deploys a service pack under its own app folder and reads the definition back"
4984
- },
4985
- {
4986
- path: "/jobExecution/jobs",
4987
- reason: "no capture: needs a deployed service to submit. The next pass deploys a service pack under its own app folder"
4988
- },
4989
- {
4990
- path: "/jobExecution/jobs/{}",
4991
- reason: "no capture: follows a submission, so it arrives with the same pass as POST /jobExecution/jobs"
4992
5390
  }
4993
5391
  ];
4994
5392
 
@@ -5024,6 +5422,7 @@ var SASjsApi = (() => {
5024
5422
 
5025
5423
  // src/viya/overlay.ts
5026
5424
  var NEEDS_AUTH = "The token endpoint is answered by the host that mounts the emulator, which owns the token port.";
5425
+ var NEEDS_JOBS = "The emulator answers the compute and content families; the job definitions a deploy creates and the executions a run submits are not modelled yet.";
5027
5426
  var VIYA_OVERLAY = {
5028
5427
  // answered here
5029
5428
  "POST /folders/folders": { implemented: true },
@@ -5049,6 +5448,32 @@ var SASjsApi = (() => {
5049
5448
  "PATCH /files/files/{}": { implemented: true },
5050
5449
  "GET /files/files/{}/content": { implemented: true },
5051
5450
  "PUT /files/files/{}/content": { implemented: true },
5451
+ // declined: the job family needs a job service
5452
+ //
5453
+ // A capture describes what the estate answers on the deploy-and-run path, and
5454
+ // the emulator does not answer that path yet: a client that deploys a service
5455
+ // pack against an emulated estate stops here, with a reason rather than a 404.
5456
+ "POST /jobDefinitions/definitions": {
5457
+ implemented: false,
5458
+ reason: NEEDS_JOBS
5459
+ },
5460
+ "GET /jobDefinitions/definitions/{}": {
5461
+ implemented: false,
5462
+ reason: NEEDS_JOBS
5463
+ },
5464
+ "POST /jobExecution/jobs": { implemented: false, reason: NEEDS_JOBS },
5465
+ "GET /jobExecution/jobs/{}": { implemented: false, reason: NEEDS_JOBS },
5466
+ "GET /jobExecution/jobs/{}/state": { implemented: false, reason: NEEDS_JOBS },
5467
+ // declined: contexts come from the seed, not from the launcher
5468
+ "GET /launcher/contexts": {
5469
+ implemented: false,
5470
+ reason: "The emulator answers compute contexts from its seed; the launcher list a client falls back to is not modelled, and nothing on the emulated path asks for it."
5471
+ },
5472
+ // declined: session variables are not modelled
5473
+ "GET /compute/sessions/{}/variables/{}": {
5474
+ implemented: false,
5475
+ reason: "The emulator does not model session variables; the client reads these only to log the pid of a job it is about to submit (SYSJOBID), and any name it asks for is refused here rather than answered with a value the emulator did not run."
5476
+ },
5052
5477
  // declined: the host owns the token port
5053
5478
  "POST /SASLogon/oauth/token": { implemented: false, reason: NEEDS_AUTH },
5054
5479
  // declared, not captured: the webout an application's service returns
@@ -5205,6 +5630,7 @@ var SASjsApi = (() => {
5205
5630
  // src/viya/ids.ts
5206
5631
  var EMULATED_NOW = "2026-01-01T00:00:00.000Z";
5207
5632
  var EMULATED_USER = { id: "emulated-user", name: "Emulated User" };
5633
+ var callerId = (subject) => subject?.userId ?? EMULATED_USER.id;
5208
5634
  var idFor = (path, kind = "folder") => {
5209
5635
  const hash2 = (input, seed) => {
5210
5636
  let value = seed;
@@ -5263,23 +5689,23 @@ var SASjsApi = (() => {
5263
5689
  const match = /name\s*,\s*'([^']*)'|name\s*,\s*"([^"]*)"/i.exec(filter);
5264
5690
  return match?.[1] ?? match?.[2] ?? DEFAULT_CONTEXT_NAME;
5265
5691
  };
5266
- var contextBody = (name) => ({
5692
+ var contextBody = (name, caller) => ({
5267
5693
  id: EMULATED_CONTEXT_ID,
5268
5694
  name,
5269
- createdBy: EMULATED_USER.id,
5695
+ createdBy: caller,
5270
5696
  version: 2,
5271
5697
  links: linksFor(
5272
5698
  `/compute/contexts/${EMULATED_CONTEXT_ID}`,
5273
5699
  "application/vnd.sas.compute.context"
5274
5700
  )
5275
5701
  });
5276
- var sessionBody = (services, session, autoExecLines) => {
5702
+ var sessionBody = (services, session, autoExecLines, caller) => {
5277
5703
  const { id } = session;
5278
5704
  const uri = `/compute/sessions/${id}`;
5279
5705
  return {
5280
5706
  id,
5281
5707
  applicationName: "emulated",
5282
- owner: EMULATED_USER.id,
5708
+ owner: caller,
5283
5709
  serverId: idFor(
5284
5710
  normaliseServerUrl(services.viya?.serverUrl) || "emulated",
5285
5711
  "server"
@@ -5358,7 +5784,12 @@ var SASjsApi = (() => {
5358
5784
  limit,
5359
5785
  count: 1,
5360
5786
  version: 2,
5361
- items: [contextBody(contextNameFrom(request.query?.filter))],
5787
+ items: [
5788
+ contextBody(
5789
+ contextNameFrom(request.query?.filter),
5790
+ callerId(request.subject)
5791
+ )
5792
+ ],
5362
5793
  links: linksFor(
5363
5794
  "/compute/contexts",
5364
5795
  "application/vnd.sas.compute.context",
@@ -5381,7 +5812,8 @@ var SASjsApi = (() => {
5381
5812
  body: sessionBody(
5382
5813
  services,
5383
5814
  session,
5384
- body.environment?.autoExecLines ?? []
5815
+ body.environment?.autoExecLines ?? [],
5816
+ callerId(request.subject)
5385
5817
  )
5386
5818
  };
5387
5819
  },
@@ -5497,7 +5929,7 @@ var SASjsApi = (() => {
5497
5929
  if (/\.(jpe?g)$/i.test(name)) return "image/jpeg";
5498
5930
  return "application/octet-stream";
5499
5931
  };
5500
- var fileBody = (file) => {
5932
+ var fileBody = (file, caller) => {
5501
5933
  const id = idFor(file.path, "file");
5502
5934
  const uri = `/files/files/${id}`;
5503
5935
  const contentType = contentTypeOf(file.name);
@@ -5512,8 +5944,8 @@ var SASjsApi = (() => {
5512
5944
  fileVersion: 1,
5513
5945
  version: 2,
5514
5946
  typeDefName: "file",
5515
- createdBy: EMULATED_USER.id,
5516
- modifiedBy: EMULATED_USER.id,
5947
+ createdBy: caller,
5948
+ modifiedBy: caller,
5517
5949
  creationTimeStamp: EMULATED_NOW,
5518
5950
  modifiedTimeStamp: EMULATED_NOW,
5519
5951
  quarantine: false,
@@ -5525,7 +5957,7 @@ var SASjsApi = (() => {
5525
5957
  "content.openInBrowser": "true",
5526
5958
  "content.preview": "false",
5527
5959
  sasIconKey: "file",
5528
- typeRegistrant: EMULATED_USER.id
5960
+ typeRegistrant: caller
5529
5961
  },
5530
5962
  links: [
5531
5963
  {
@@ -5605,12 +6037,18 @@ var SASjsApi = (() => {
5605
6037
  const parent = await parentOf(drive, request.query?.parentFolderUri);
5606
6038
  const path = `${parent}/${upload.name}`.replace(/\/{2,}/g, "/");
5607
6039
  await drive.save(path, upload.contents);
5608
- return { status: 201, body: fileBody(await bodyOf(drive, path)) };
6040
+ return {
6041
+ status: 201,
6042
+ body: fileBody(await bodyOf(drive, path), callerId(request.subject))
6043
+ };
5609
6044
  },
5610
- "GET /files/files/{}": async ({ services, params }) => {
6045
+ "GET /files/files/{}": async ({ services, params, request }) => {
5611
6046
  const drive = requireDrive(services);
5612
6047
  const path = await pathForFileId(drive, params.id);
5613
- return { status: 200, body: fileBody(await bodyOf(drive, path)) };
6048
+ return {
6049
+ status: 200,
6050
+ body: fileBody(await bodyOf(drive, path), callerId(request.subject))
6051
+ };
5614
6052
  },
5615
6053
  "PATCH /files/files/{}": async ({ services, params, request }) => {
5616
6054
  const drive = requireDrive(services);
@@ -5622,7 +6060,10 @@ var SASjsApi = (() => {
5622
6060
  "/"
5623
6061
  );
5624
6062
  if (target !== path) await drive.rename(path, target);
5625
- return { status: 200, body: fileBody(await bodyOf(drive, target)) };
6063
+ return {
6064
+ status: 200,
6065
+ body: fileBody(await bodyOf(drive, target), callerId(request.subject))
6066
+ };
5626
6067
  },
5627
6068
  "GET /files/files/{}/content": async ({ services, params }) => {
5628
6069
  const drive = requireDrive(services);
@@ -5644,7 +6085,10 @@ var SASjsApi = (() => {
5644
6085
  if (contents === void 0 || contents === null)
5645
6086
  throw new ApiError(400, "File content is required.");
5646
6087
  await drive.update(path, contents);
5647
- return { status: 200, body: fileBody(await bodyOf(drive, path)) };
6088
+ return {
6089
+ status: 200,
6090
+ body: fileBody(await bodyOf(drive, path), callerId(request.subject))
6091
+ };
5648
6092
  }
5649
6093
  };
5650
6094
 
@@ -5667,7 +6111,7 @@ var SASjsApi = (() => {
5667
6111
  };
5668
6112
  return collection ? [members, self] : [self, members];
5669
6113
  };
5670
- var folderBody = async (drive, path) => {
6114
+ var folderBody = async (drive, path, caller) => {
5671
6115
  const listing = await drive.list(path);
5672
6116
  const id = idFor(path);
5673
6117
  const name = path.split("/").filter(Boolean).pop() ?? "";
@@ -5678,8 +6122,8 @@ var SASjsApi = (() => {
5678
6122
  description: "",
5679
6123
  type: "folder",
5680
6124
  version: 1,
5681
- createdBy: EMULATED_USER.id,
5682
- modifiedBy: EMULATED_USER.id,
6125
+ createdBy: caller,
6126
+ modifiedBy: caller,
5683
6127
  creationTimeStamp: EMULATED_NOW,
5684
6128
  modifiedTimeStamp: EMULATED_NOW,
5685
6129
  memberCount: listing.files.length + listing.folders.length,
@@ -5687,7 +6131,7 @@ var SASjsApi = (() => {
5687
6131
  links: linksFor2(`/folders/folders/${id}`)
5688
6132
  };
5689
6133
  };
5690
- var recycleBin = () => {
6134
+ var recycleBin = (caller) => {
5691
6135
  const path = "@myRecycleBin";
5692
6136
  const id = idFor(path);
5693
6137
  return {
@@ -5696,8 +6140,8 @@ var SASjsApi = (() => {
5696
6140
  description: "Recycle Bin",
5697
6141
  type: "trashFolder",
5698
6142
  version: 1,
5699
- createdBy: EMULATED_USER.id,
5700
- modifiedBy: EMULATED_USER.id,
6143
+ createdBy: caller,
6144
+ modifiedBy: caller,
5701
6145
  creationTimeStamp: EMULATED_NOW,
5702
6146
  modifiedTimeStamp: EMULATED_NOW,
5703
6147
  memberCount: 0,
@@ -5735,7 +6179,7 @@ var SASjsApi = (() => {
5735
6179
  var VIYA_HANDLERS = {
5736
6180
  "GET /identities/users/@currentUser": async ({ services, request }) => {
5737
6181
  const subject = request.subject ?? await services.identity?.authenticate(request.token);
5738
- const id = subject?.userId ?? EMULATED_USER.id;
6182
+ const id = callerId(subject);
5739
6183
  return {
5740
6184
  status: 200,
5741
6185
  body: {
@@ -5774,19 +6218,27 @@ var SASjsApi = (() => {
5774
6218
  }),
5775
6219
  "GET /folders/folders/@item": async ({ services, request }) => ({
5776
6220
  status: 200,
5777
- body: await folderBody(requireDrive(services), pathFromQuery(request))
6221
+ body: await folderBody(
6222
+ requireDrive(services),
6223
+ pathFromQuery(request),
6224
+ callerId(request.subject)
6225
+ )
5778
6226
  }),
5779
- "GET /folders/folders/@myRecycleBin": async () => ({
6227
+ "GET /folders/folders/@myRecycleBin": async ({ request }) => ({
5780
6228
  status: 200,
5781
- body: recycleBin()
6229
+ body: recycleBin(callerId(request.subject))
5782
6230
  }),
5783
- "GET /folders/folders/{}": async ({ services, params }) => {
6231
+ "GET /folders/folders/{}": async ({ services, params, request }) => {
5784
6232
  if (params.id === idFor("@myRecycleBin"))
5785
- return { status: 200, body: recycleBin() };
6233
+ return { status: 200, body: recycleBin(callerId(request.subject)) };
5786
6234
  const drive = requireDrive(services);
5787
6235
  return {
5788
6236
  status: 200,
5789
- body: await folderBody(drive, await pathForId(drive, params.id))
6237
+ body: await folderBody(
6238
+ drive,
6239
+ await pathForId(drive, params.id),
6240
+ callerId(request.subject)
6241
+ )
5790
6242
  };
5791
6243
  },
5792
6244
  "GET /folders/folders/{}/members": async ({ services, params, request }) => {
@@ -5810,14 +6262,15 @@ var SASjsApi = (() => {
5810
6262
  };
5811
6263
  const path = await pathForId(drive, params.id);
5812
6264
  const listing = await drive.list(path);
6265
+ const caller = callerId(request.subject);
5813
6266
  const items = [
5814
6267
  ...listing.folders.map((name) => ({
5815
6268
  id: idFor(`${path}/${name}`.replace(/\/{2,}/g, "/")),
5816
6269
  name,
5817
6270
  type: "folder",
5818
6271
  version: 1,
5819
- createdBy: EMULATED_USER.id,
5820
- modifiedBy: EMULATED_USER.id,
6272
+ createdBy: caller,
6273
+ modifiedBy: caller,
5821
6274
  creationTimeStamp: EMULATED_NOW,
5822
6275
  modifiedTimeStamp: EMULATED_NOW,
5823
6276
  parentFolderUri: `/folders/folders/${idFor(path)}`,
@@ -5832,8 +6285,8 @@ var SASjsApi = (() => {
5832
6285
  type: "file",
5833
6286
  version: 1,
5834
6287
  contentType: "text/plain",
5835
- createdBy: EMULATED_USER.id,
5836
- modifiedBy: EMULATED_USER.id,
6288
+ createdBy: caller,
6289
+ modifiedBy: caller,
5837
6290
  creationTimeStamp: EMULATED_NOW,
5838
6291
  modifiedTimeStamp: EMULATED_NOW,
5839
6292
  parentFolderUri: `/folders/folders/${idFor(path)}`,
@@ -5867,7 +6320,10 @@ var SASjsApi = (() => {
5867
6320
  const parent = parentUri ? await pathForId(drive, String(parentUri).split("/").pop()) : "/";
5868
6321
  const path = normalisePath(`${parent}/${body.name}`);
5869
6322
  await drive.mkdir(path);
5870
- return { status: 201, body: await folderBody(drive, path) };
6323
+ return {
6324
+ status: 201,
6325
+ body: await folderBody(drive, path, callerId(request.subject))
6326
+ };
5871
6327
  },
5872
6328
  "PATCH /folders/folders/{}": async ({ services, request, params }) => {
5873
6329
  const drive = requireDrive(services);
@@ -5876,7 +6332,7 @@ var SASjsApi = (() => {
5876
6332
  const path = await pathForId(drive, params.id);
5877
6333
  const body = request.body ?? {};
5878
6334
  if (isRecycleBin(body.parentFolderUri)) {
5879
- const removed = await folderBody(drive, path);
6335
+ const removed = await folderBody(drive, path, callerId(request.subject));
5880
6336
  await drive.rmdir(path);
5881
6337
  return {
5882
6338
  status: 200,
@@ -5890,7 +6346,10 @@ var SASjsApi = (() => {
5890
6346
  );
5891
6347
  const target = normalisePath(`${parent}/${name}`);
5892
6348
  if (target !== path) await drive.rename(path, target);
5893
- return { status: 200, body: await folderBody(drive, target) };
6349
+ return {
6350
+ status: 200,
6351
+ body: await folderBody(drive, target, callerId(request.subject))
6352
+ };
5894
6353
  },
5895
6354
  ...COMPUTE_HANDLERS,
5896
6355
  ...FILE_HANDLERS
@@ -6210,6 +6669,28 @@ var SASjsApi = (() => {
6210
6669
  expected: 200,
6211
6670
  shape: void 0
6212
6671
  },
6672
+ {
6673
+ route: "GET /compute/sessions/{}/variables/{}",
6674
+ step: "compute/execute-script",
6675
+ queries: [],
6676
+ statuses: [200],
6677
+ expected: 200,
6678
+ shape: {
6679
+ links: [
6680
+ {
6681
+ href: "string",
6682
+ method: "string",
6683
+ rel: "string",
6684
+ type: "string",
6685
+ uri: "string"
6686
+ }
6687
+ ],
6688
+ name: "string",
6689
+ scope: "string",
6690
+ value: "string",
6691
+ version: "number"
6692
+ }
6693
+ },
6213
6694
  {
6214
6695
  route: "POST /files/files",
6215
6696
  step: "files/create",
@@ -6618,6 +7099,264 @@ var SASjsApi = (() => {
6618
7099
  version: "number"
6619
7100
  }
6620
7101
  },
7102
+ {
7103
+ route: "POST /jobDefinitions/definitions",
7104
+ step: "jobs/definition",
7105
+ queries: ["parentFolderUri"],
7106
+ statuses: [201],
7107
+ expected: 201,
7108
+ shape: {
7109
+ code: "string",
7110
+ createdBy: "string",
7111
+ creationTimeStamp: "string",
7112
+ id: "string",
7113
+ links: [
7114
+ {
7115
+ href: "string",
7116
+ method: "string",
7117
+ rel: "string",
7118
+ type: "string",
7119
+ uri: "string"
7120
+ }
7121
+ ],
7122
+ modifiedBy: "string",
7123
+ modifiedTimeStamp: "string",
7124
+ name: "string",
7125
+ parameters: [
7126
+ {
7127
+ defaultValue: "string",
7128
+ name: "string",
7129
+ required: "boolean",
7130
+ type: "string",
7131
+ version: "number"
7132
+ }
7133
+ ],
7134
+ type: "string",
7135
+ version: "number"
7136
+ }
7137
+ },
7138
+ {
7139
+ route: "GET /jobDefinitions/definitions/{}",
7140
+ step: "jobs/execute",
7141
+ queries: [],
7142
+ statuses: [200],
7143
+ expected: 200,
7144
+ shape: {
7145
+ code: "string",
7146
+ createdBy: "string",
7147
+ creationTimeStamp: "string",
7148
+ id: "string",
7149
+ links: [
7150
+ {
7151
+ href: "string",
7152
+ method: "string",
7153
+ rel: "string",
7154
+ type: "string",
7155
+ uri: "string"
7156
+ }
7157
+ ],
7158
+ modifiedBy: "string",
7159
+ modifiedTimeStamp: "string",
7160
+ name: "string",
7161
+ parameters: [
7162
+ {
7163
+ defaultValue: "string",
7164
+ name: "string",
7165
+ required: "boolean",
7166
+ type: "string",
7167
+ version: "number"
7168
+ }
7169
+ ],
7170
+ type: "string",
7171
+ version: "number"
7172
+ }
7173
+ },
7174
+ {
7175
+ route: "POST /jobExecution/jobs",
7176
+ step: "jobs/execute",
7177
+ queries: ["_action"],
7178
+ statuses: [201],
7179
+ expected: 201,
7180
+ shape: {
7181
+ createdBy: "string",
7182
+ creationTimeStamp: "string",
7183
+ elapsedTime: "number",
7184
+ heartbeatInterval: "number",
7185
+ heartbeatTimeStamp: "string",
7186
+ id: "string",
7187
+ jobRequest: {
7188
+ arguments: {
7189
+ _DEBUG: "string",
7190
+ _OMITJSONLISTING: "string",
7191
+ _OMITJSONLOG: "string",
7192
+ _OMITTEXTLISTING: "string",
7193
+ _OMITTEXTLOG: "string",
7194
+ _addjesbeginendmacros: "string",
7195
+ _contextName: "string",
7196
+ _omitSessionResults: "string",
7197
+ _program: "string",
7198
+ _webin_file_count: "string"
7199
+ },
7200
+ createdByApplication: "string",
7201
+ description: "string",
7202
+ jobDefinition: {
7203
+ code: "string",
7204
+ createdBy: "string",
7205
+ creationTimeStamp: "string",
7206
+ id: "string",
7207
+ links: ["object"],
7208
+ modifiedBy: "string",
7209
+ modifiedTimeStamp: "string",
7210
+ name: "string",
7211
+ parameters: ["object"],
7212
+ type: "string",
7213
+ version: "number"
7214
+ },
7215
+ name: "string",
7216
+ properties: "array",
7217
+ version: "number"
7218
+ },
7219
+ links: [
7220
+ {
7221
+ href: "string",
7222
+ method: "string",
7223
+ rel: "string",
7224
+ type: "string",
7225
+ uri: "string"
7226
+ }
7227
+ ],
7228
+ modifiedBy: "string",
7229
+ modifiedTimeStamp: "string",
7230
+ results: {},
7231
+ state: "string",
7232
+ submittedByApplication: "string",
7233
+ version: "number"
7234
+ }
7235
+ },
7236
+ {
7237
+ route: "GET /jobExecution/jobs/{}",
7238
+ step: "jobs/execute",
7239
+ queries: [],
7240
+ statuses: [200],
7241
+ expected: 200,
7242
+ shape: {
7243
+ createdBy: "string",
7244
+ creationTimeStamp: "string",
7245
+ elapsedTime: "number",
7246
+ endTimeStamp: "string",
7247
+ heartbeatInterval: "number",
7248
+ heartbeatTimeStamp: "string",
7249
+ id: "string",
7250
+ jobRequest: {
7251
+ arguments: {
7252
+ _DEBUG: "string",
7253
+ _OMITJSONLISTING: "string",
7254
+ _OMITJSONLOG: "string",
7255
+ _OMITTEXTLISTING: "string",
7256
+ _OMITTEXTLOG: "string",
7257
+ _addjesbeginendmacros: "string",
7258
+ _contextName: "string",
7259
+ _omitSessionResults: "string",
7260
+ _program: "string",
7261
+ _webin_file_count: "string"
7262
+ },
7263
+ createdByApplication: "string",
7264
+ description: "string",
7265
+ jobDefinition: {
7266
+ code: "string",
7267
+ createdBy: "string",
7268
+ creationTimeStamp: "string",
7269
+ id: "string",
7270
+ links: ["object"],
7271
+ modifiedBy: "string",
7272
+ modifiedTimeStamp: "string",
7273
+ name: "string",
7274
+ parameters: ["object"],
7275
+ type: "string",
7276
+ version: "number"
7277
+ },
7278
+ name: "string",
7279
+ properties: "array",
7280
+ version: "number"
7281
+ },
7282
+ links: [
7283
+ {
7284
+ href: "string",
7285
+ method: "string",
7286
+ rel: "string",
7287
+ type: "string",
7288
+ uri: "string"
7289
+ }
7290
+ ],
7291
+ logLocation: "string",
7292
+ modifiedBy: "string",
7293
+ modifiedTimeStamp: "string",
7294
+ results: {
7295
+ COMPUTE_CONTEXT: "string",
7296
+ COMPUTE_JOB: "string",
7297
+ COMPUTE_SESSION: "string",
7298
+ "{}.log": "string",
7299
+ "{}.log.txt": "string"
7300
+ },
7301
+ state: "string",
7302
+ submittedByApplication: "string",
7303
+ version: "number"
7304
+ }
7305
+ },
7306
+ {
7307
+ route: "GET /jobExecution/jobs/{}/state",
7308
+ step: "jobs/execute",
7309
+ queries: ["_action", "wait"],
7310
+ statuses: [200],
7311
+ expected: 200,
7312
+ shape: void 0
7313
+ },
7314
+ {
7315
+ route: "GET /launcher/contexts",
7316
+ step: "compute/launcher-contexts",
7317
+ queries: ["limit"],
7318
+ statuses: [200],
7319
+ expected: 200,
7320
+ shape: {
7321
+ accept: "string",
7322
+ count: "number",
7323
+ items: [
7324
+ {
7325
+ createdBy: "string",
7326
+ creationTimeStamp: "string",
7327
+ description: "string",
7328
+ id: "string",
7329
+ links: [
7330
+ {
7331
+ href: "string",
7332
+ method: "string",
7333
+ rel: "string",
7334
+ type: "string",
7335
+ uri: "string"
7336
+ }
7337
+ ],
7338
+ modifiedBy: "string",
7339
+ modifiedTimeStamp: "string",
7340
+ name: "string",
7341
+ type: "string",
7342
+ version: "number"
7343
+ }
7344
+ ],
7345
+ limit: "number",
7346
+ links: [
7347
+ {
7348
+ href: "string",
7349
+ method: "string",
7350
+ rel: "string",
7351
+ type: "string",
7352
+ uri: "string"
7353
+ }
7354
+ ],
7355
+ name: "string",
7356
+ start: "number",
7357
+ version: "number"
7358
+ }
7359
+ },
6621
7360
  {
6622
7361
  route: "POST /SASLogon/oauth/token",
6623
7362
  step: "auth/token-refresh",
@@ -6643,7 +7382,45 @@ var SASjsApi = (() => {
6643
7382
  queries: ["limit"],
6644
7383
  statuses: [200],
6645
7384
  expected: 200,
6646
- shape: void 0
7385
+ shape: {
7386
+ accept: "string",
7387
+ count: "number",
7388
+ items: [
7389
+ {
7390
+ description: "string",
7391
+ iconUri: "string",
7392
+ label: "string",
7393
+ links: [
7394
+ {
7395
+ href: "string",
7396
+ method: "string",
7397
+ rel: "string",
7398
+ type: "string",
7399
+ uri: "string"
7400
+ }
7401
+ ],
7402
+ mediaType: "string",
7403
+ name: "string",
7404
+ resourceUri: "string",
7405
+ tags: ["string"],
7406
+ version: "number"
7407
+ }
7408
+ ],
7409
+ limit: "number",
7410
+ links: [
7411
+ {
7412
+ href: "string",
7413
+ itemType: "string",
7414
+ method: "string",
7415
+ rel: "string",
7416
+ type: "string",
7417
+ uri: "string"
7418
+ }
7419
+ ],
7420
+ name: "string",
7421
+ start: "number",
7422
+ version: "number"
7423
+ }
6647
7424
  }
6648
7425
  ];
6649
7426