just-bash-nx 3.0.9 → 3.0.10

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.
@@ -23,10 +23,12 @@ _mock_collect_flag_values() {
23
23
  flag="$1"
24
24
  shift
25
25
  while [ "$#" -gt 0 ]; do
26
- if [ "$1" = "$flag" ] && [ "$#" -ge 2 ]; then
27
- printf '%s\n' "$2"
28
- shift 2
29
- continue
26
+ if [ "$1" = "$flag" ]; then
27
+ if [ "$#" -ge 2 ]; then
28
+ printf '%s\n' "$2"
29
+ shift 2
30
+ continue
31
+ fi
30
32
  fi
31
33
  shift
32
34
  done
@@ -37,9 +39,11 @@ _mock_find_next() {
37
39
  flag="$1"
38
40
  shift
39
41
  while [ "$#" -gt 0 ]; do
40
- if [ "$1" = "$flag" ] && [ "$#" -ge 2 ]; then
41
- printf '%s' "$2"
42
- return 0
42
+ if [ "$1" = "$flag" ]; then
43
+ if [ "$#" -ge 2 ]; then
44
+ printf '%s' "$2"
45
+ return 0
46
+ fi
43
47
  fi
44
48
  shift
45
49
  done
@@ -121,6 +125,58 @@ send-chat() {
121
125
  JSON
122
126
  }
123
127
 
128
+ forward-thread() {
129
+ to_sid="$(_mock_find_next --to-session-id "$@" || true)"
130
+ from_sid="$(_mock_find_next --from-session-id "$@" || true)"
131
+ thread_ts="$(_mock_find_next --thread-timestamp "$@" || true)"
132
+ if [ -z "$to_sid" ]; then
133
+ to_sid="mock-destination-session"
134
+ fi
135
+ if [ -z "$from_sid" ]; then
136
+ from_sid="mock-source-session"
137
+ fi
138
+ if [ -z "$thread_ts" ]; then
139
+ thread_ts="$(_mock_now_ms)"
140
+ fi
141
+
142
+ cat <<JSON
143
+ {"messageId":"forward-thread-$(_mock_now_ms)","echo":{"toSessionId":"$(_mock_escape_json "$to_sid")","fromSessionId":"$(_mock_escape_json "$from_sid")","threadTimestamp":"$(_mock_escape_json "$thread_ts")"}}
144
+ JSON
145
+ }
146
+
147
+ forward-messages() {
148
+ to_sid="$(_mock_find_next --to-session-id "$@" || true)"
149
+ from_sid="$(_mock_find_next --from-session-id "$@" || true)"
150
+ message_ids="$(_mock_find_next --message-ids "$@" || true)"
151
+ if [ -z "$to_sid" ]; then
152
+ to_sid="mock-destination-session"
153
+ fi
154
+ if [ -z "$from_sid" ]; then
155
+ from_sid="mock-source-session"
156
+ fi
157
+ if [ -z "$message_ids" ]; then
158
+ message_ids="msg-1"
159
+ fi
160
+
161
+ message_ids_json='['
162
+ first_id=1
163
+ for message_id in $(printf '%s' "$message_ids" | tr ',' ' '); do
164
+ if [ -z "$message_id" ]; then
165
+ continue
166
+ fi
167
+ if [ "$first_id" -eq 0 ]; then
168
+ message_ids_json="${message_ids_json},"
169
+ fi
170
+ message_ids_json="${message_ids_json}\"$(_mock_escape_json "$message_id")\""
171
+ first_id=0
172
+ done
173
+ message_ids_json="${message_ids_json}]"
174
+
175
+ cat <<JSON
176
+ {"messageId":"forward-messages-$(_mock_now_ms)","echo":{"toSessionId":"$(_mock_escape_json "$to_sid")","fromSessionId":"$(_mock_escape_json "$from_sid")","messageIds":"$(_mock_escape_json "$message_ids")"},"messageIds":$message_ids_json}
177
+ JSON
178
+ }
179
+
124
180
  edit-chat() {
125
181
  sid="$(_mock_find_next --session-id "$@" || true)"
126
182
  mid="$(_mock_find_next --message-id "$@" || true)"
@@ -159,11 +215,13 @@ add-members() {
159
215
  first_jid="$(printf '%s\n' "$jids" | sed -n '1p')"
160
216
  fi
161
217
 
162
- if [ -n "$first_jid" ] && [ "${MOCK_ADD_MEMBERS_DENY_FIRST:-0}" = "1" ]; then
163
- cat <<JSON
218
+ if [ -n "$first_jid" ]; then
219
+ if [ "${MOCK_ADD_MEMBERS_DENY_FIRST:-0}" = "1" ]; then
220
+ cat <<JSON
164
221
  {"sessionId":"$(_mock_escape_json "$sid")","invitedCount":$((invited-1)),"notAllowedList":[{"jid":"$(_mock_escape_json "$first_jid")","reason":"mock_denied"}],"echo":{"jids":"$(_mock_escape_json "$jids")","emails":"$(_mock_escape_json "$emails")"}}
165
222
  JSON
166
- return 0
223
+ return 0
224
+ fi
167
225
  fi
168
226
 
169
227
  cat <<JSON
@@ -249,6 +307,201 @@ open-session() {
249
307
  JSON
250
308
  }
251
309
 
310
+ make-deeplink() {
311
+ sid="$(_mock_find_next --sid "$@" || true)"
312
+ mid="$(_mock_find_next --mid "$@" || true)"
313
+ time_value="$(_mock_find_next --time "$@" || true)"
314
+ sid2="$(_mock_find_next --sid2 "$@" || true)"
315
+ aiid="$(_mock_find_next --aiid "$@" || true)"
316
+ if [ -z "$sid" ]; then
317
+ sid="mock-session"
318
+ fi
319
+
320
+ deeplink="zoommtg://chat?sid=$(_mock_escape_json "$sid")"
321
+ if [ -n "$mid" ]; then
322
+ deeplink="${deeplink}&mid=$(_mock_escape_json "$mid")"
323
+ fi
324
+ if [ -n "$time_value" ]; then
325
+ deeplink="${deeplink}&time=$(_mock_escape_json "$time_value")"
326
+ fi
327
+ if [ -n "$sid2" ]; then
328
+ deeplink="${deeplink}&sid2=$(_mock_escape_json "$sid2")"
329
+ fi
330
+ if [ -n "$aiid" ]; then
331
+ deeplink="${deeplink}&aiid=$(_mock_escape_json "$aiid")"
332
+ fi
333
+
334
+ cat <<JSON
335
+ {"deeplink":"$deeplink"}
336
+ JSON
337
+ }
338
+
339
+ calendar-create-event() {
340
+ event_kind="$(_mock_find_next --event-kind "$@" || true)"
341
+ organizer_mail="$(_mock_find_next --organizer-mail "$@" || true)"
342
+ subject="$(_mock_find_next --subject "$@" || true)"
343
+ start="$(_mock_find_next --start "$@" || true)"
344
+ duration="$(_mock_find_next --duration "$@" || true)"
345
+ description="$(_mock_find_next --description "$@" || true)"
346
+ time_zone="$(_mock_find_next --time-zone "$@" || true)"
347
+ location="$(_mock_find_next --location "$@" || true)"
348
+ send_updates="$(_mock_find_next --send-updates "$@" || true)"
349
+ attendees="$(_mock_collect_flag_values --attendee "$@")"
350
+
351
+ if [ -z "$event_kind" ]; then
352
+ event_kind="zoom_meeting"
353
+ fi
354
+ if [ -z "$organizer_mail" ]; then
355
+ organizer_mail="primary"
356
+ fi
357
+ if [ -z "$subject" ]; then
358
+ subject="Mock Event"
359
+ fi
360
+ if [ -z "$start" ]; then
361
+ start="2026-06-11T09:00:00Z"
362
+ fi
363
+ if [ -z "$duration" ]; then
364
+ duration="30"
365
+ fi
366
+
367
+ attendee_count=0
368
+ attendees_json='[]'
369
+ if [ -n "$attendees" ]; then
370
+ attendee_count="$(printf '%s\n' "$attendees" | sed '/^$/d' | wc -l | tr -d ' ')"
371
+ attendees_json='['
372
+ first_attendee=1
373
+ while IFS= read -r attendee; do
374
+ if [ -z "$attendee" ]; then
375
+ continue
376
+ fi
377
+ if [ "$first_attendee" -eq 0 ]; then
378
+ attendees_json="${attendees_json},"
379
+ fi
380
+ attendees_json="${attendees_json}\"$(_mock_escape_json "$attendee")\""
381
+ first_attendee=0
382
+ done <<EOF
383
+ $attendees
384
+ EOF
385
+ attendees_json="${attendees_json}]"
386
+ fi
387
+
388
+ cat <<JSON
389
+ {"event":{"id":"event-$(_mock_now_ms)","subject":"$(_mock_escape_json "$subject")","start":"$(_mock_escape_json "$start")","duration":$duration,"eventKind":"$(_mock_escape_json "$event_kind")","organizerMail":"$(_mock_escape_json "$organizer_mail")","description":"$(_mock_escape_json "${description:-}")","timeZone":"$(_mock_escape_json "${time_zone:-}")","location":"$(_mock_escape_json "${location:-}")","sendUpdates":"$(_mock_escape_json "${send_updates:-}")","attendeeCount":$attendee_count},"echo":{"attendees":$attendees_json}}
390
+ JSON
391
+ }
392
+
393
+ calendar-list-events() {
394
+ owners="$(_mock_collect_flag_values --calendar-owner-mail "$@")"
395
+ start="$(_mock_find_next --start "$@" || true)"
396
+ duration="$(_mock_find_next --duration "$@" || true)"
397
+ time_zone="$(_mock_find_next --time-zone "$@" || true)"
398
+ if [ -z "$start" ]; then
399
+ start="2026-06-11T09:00:00Z"
400
+ fi
401
+ if [ -z "$duration" ]; then
402
+ duration="30"
403
+ fi
404
+
405
+ owner_count=0
406
+ owners_json='[]'
407
+ if [ -n "$owners" ]; then
408
+ owner_count="$(printf '%s\n' "$owners" | sed '/^$/d' | wc -l | tr -d ' ')"
409
+ owners_json='['
410
+ first_owner=1
411
+ while IFS= read -r owner; do
412
+ if [ -z "$owner" ]; then
413
+ continue
414
+ fi
415
+ if [ "$first_owner" -eq 0 ]; then
416
+ owners_json="${owners_json},"
417
+ fi
418
+ owners_json="${owners_json}\"$(_mock_escape_json "$owner")\""
419
+ first_owner=0
420
+ done <<EOF
421
+ $owners
422
+ EOF
423
+ owners_json="${owners_json}]"
424
+ fi
425
+
426
+ cat <<JSON
427
+ {"events":[{"id":"event-1","subject":"Mock Calendar Event","start":"$(_mock_escape_json "$start")","duration":$duration}],"meta":{"calendarOwnerCount":$owner_count,"calendarOwners":$owners_json,"timeZone":"$(_mock_escape_json "${time_zone:-}")"}}
428
+ JSON
429
+ }
430
+
431
+ calendar-get-free-busy() {
432
+ owners="$(_mock_collect_flag_values --calendar-owner-mail "$@")"
433
+ start="$(_mock_find_next --start "$@" || true)"
434
+ end="$(_mock_find_next --end "$@" || true)"
435
+ duration="$(_mock_find_next --duration "$@" || true)"
436
+ time_zone="$(_mock_find_next --time-zone "$@" || true)"
437
+ suggest_time=false
438
+ if _mock_has_flag --suggest-time "$@"; then
439
+ suggest_time=true
440
+ fi
441
+ if [ -z "$start" ]; then
442
+ start="2026-06-11T09:00:00Z"
443
+ fi
444
+ if [ -z "$end" ]; then
445
+ end="2026-06-11T10:00:00Z"
446
+ fi
447
+ if [ -z "$duration" ]; then
448
+ duration="30"
449
+ fi
450
+
451
+ owner_count=0
452
+ if [ -n "$owners" ]; then
453
+ owner_count="$(printf '%s\n' "$owners" | sed '/^$/d' | wc -l | tr -d ' ')"
454
+ fi
455
+
456
+ cat <<JSON
457
+ {"busy":[],"suggestions":[{"start":"$(_mock_escape_json "$start")","end":"$(_mock_escape_json "$end")","duration":$duration}],"meta":{"calendarOwnerCount":$owner_count,"timeZone":"$(_mock_escape_json "${time_zone:-}")","suggestTime":$suggest_time}}
458
+ JSON
459
+ }
460
+
461
+ calendar-patch-event() {
462
+ organizer_mail="$(_mock_find_next --organizer-mail "$@" || true)"
463
+ event_id="$(_mock_find_next --event-id "$@" || true)"
464
+ subject="$(_mock_find_next --subject "$@" || true)"
465
+ start="$(_mock_find_next --start "$@" || true)"
466
+ duration="$(_mock_find_next --duration "$@" || true)"
467
+ description="$(_mock_find_next --description "$@" || true)"
468
+ time_zone="$(_mock_find_next --time-zone "$@" || true)"
469
+ location="$(_mock_find_next --location "$@" || true)"
470
+ send_updates="$(_mock_find_next --send-updates "$@" || true)"
471
+ attendees="$(_mock_collect_flag_values --attendee "$@")"
472
+ if [ -z "$organizer_mail" ]; then
473
+ organizer_mail="primary"
474
+ fi
475
+ if [ -z "$event_id" ]; then
476
+ event_id="event-1"
477
+ fi
478
+
479
+ attendee_count=0
480
+ if [ -n "$attendees" ]; then
481
+ attendee_count="$(printf '%s\n' "$attendees" | sed '/^$/d' | wc -l | tr -d ' ')"
482
+ fi
483
+
484
+ cat <<JSON
485
+ {"event":{"id":"$(_mock_escape_json "$event_id")","subject":"$(_mock_escape_json "${subject:-Mock Patched Event}")","start":"$(_mock_escape_json "${start:-}")","duration":"$(_mock_escape_json "${duration:-}")","description":"$(_mock_escape_json "${description:-}")","timeZone":"$(_mock_escape_json "${time_zone:-}")","location":"$(_mock_escape_json "${location:-}")","organizerMail":"$(_mock_escape_json "$organizer_mail")","sendUpdates":"$(_mock_escape_json "${send_updates:-}")","attendeeCount":$attendee_count}}
486
+ JSON
487
+ }
488
+
489
+ calendar-delete-event() {
490
+ organizer_mail="$(_mock_find_next --organizer-mail "$@" || true)"
491
+ event_id="$(_mock_find_next --event-id "$@" || true)"
492
+ send_updates="$(_mock_find_next --send-updates "$@" || true)"
493
+ if [ -z "$organizer_mail" ]; then
494
+ organizer_mail="primary"
495
+ fi
496
+ if [ -z "$event_id" ]; then
497
+ event_id="event-1"
498
+ fi
499
+
500
+ cat <<JSON
501
+ {"ok":true,"eventId":"$(_mock_escape_json "$event_id")","calendarId":"$(_mock_escape_json "$organizer_mail")","sendUpdates":"$(_mock_escape_json "${send_updates:-all}")"}
502
+ JSON
503
+ }
504
+
252
505
  create-or-update-skill() {
253
506
  content="$(_mock_find_next --content "$@" || true)"
254
507
  update_sid="$(_mock_find_next --update-session-id "$@" || true)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "just-bash-nx",
3
- "version": "3.0.9",
3
+ "version": "3.0.10",
4
4
  "description": "A simulated bash environment with virtual filesystem",
5
5
  "repository": {
6
6
  "type": "git",