@ofocus/sdk 0.1.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 (200) hide show
  1. package/README.md +80 -0
  2. package/api-report/ofocus-sdk.api.md +564 -0
  3. package/dist/.tsbuildinfo +1 -0
  4. package/dist/applescript.d.ts +30 -0
  5. package/dist/applescript.d.ts.map +1 -0
  6. package/dist/applescript.js +142 -0
  7. package/dist/applescript.js.map +1 -0
  8. package/dist/commands/batch.d.ts +23 -0
  9. package/dist/commands/batch.d.ts.map +1 -0
  10. package/dist/commands/batch.js +324 -0
  11. package/dist/commands/batch.js.map +1 -0
  12. package/dist/commands/complete.d.ts +14 -0
  13. package/dist/commands/complete.d.ts.map +1 -0
  14. package/dist/commands/complete.js +37 -0
  15. package/dist/commands/complete.js.map +1 -0
  16. package/dist/commands/create-project.d.ts +6 -0
  17. package/dist/commands/create-project.d.ts.map +1 -0
  18. package/dist/commands/create-project.js +124 -0
  19. package/dist/commands/create-project.js.map +1 -0
  20. package/dist/commands/drop.d.ts +26 -0
  21. package/dist/commands/drop.d.ts.map +1 -0
  22. package/dist/commands/drop.js +62 -0
  23. package/dist/commands/drop.js.map +1 -0
  24. package/dist/commands/folders.d.ts +10 -0
  25. package/dist/commands/folders.d.ts.map +1 -0
  26. package/dist/commands/folders.js +150 -0
  27. package/dist/commands/folders.js.map +1 -0
  28. package/dist/commands/inbox.d.ts +6 -0
  29. package/dist/commands/inbox.d.ts.map +1 -0
  30. package/dist/commands/inbox.js +124 -0
  31. package/dist/commands/inbox.js.map +1 -0
  32. package/dist/commands/perspectives.d.ts +20 -0
  33. package/dist/commands/perspectives.d.ts.map +1 -0
  34. package/dist/commands/perspectives.js +166 -0
  35. package/dist/commands/perspectives.js.map +1 -0
  36. package/dist/commands/projects.d.ts +6 -0
  37. package/dist/commands/projects.d.ts.map +1 -0
  38. package/dist/commands/projects.js +113 -0
  39. package/dist/commands/projects.js.map +1 -0
  40. package/dist/commands/repetition.d.ts +17 -0
  41. package/dist/commands/repetition.d.ts.map +1 -0
  42. package/dist/commands/repetition.js +59 -0
  43. package/dist/commands/repetition.js.map +1 -0
  44. package/dist/commands/review.d.ts +10 -0
  45. package/dist/commands/review.d.ts.map +1 -0
  46. package/dist/commands/review.js +132 -0
  47. package/dist/commands/review.js.map +1 -0
  48. package/dist/commands/search.d.ts +6 -0
  49. package/dist/commands/search.d.ts.map +1 -0
  50. package/dist/commands/search.js +150 -0
  51. package/dist/commands/search.js.map +1 -0
  52. package/dist/commands/subtasks.d.ts +14 -0
  53. package/dist/commands/subtasks.d.ts.map +1 -0
  54. package/dist/commands/subtasks.js +370 -0
  55. package/dist/commands/subtasks.js.map +1 -0
  56. package/dist/commands/tags-crud.d.ts +22 -0
  57. package/dist/commands/tags-crud.d.ts.map +1 -0
  58. package/dist/commands/tags-crud.js +187 -0
  59. package/dist/commands/tags-crud.js.map +1 -0
  60. package/dist/commands/tags.d.ts +6 -0
  61. package/dist/commands/tags.d.ts.map +1 -0
  62. package/dist/commands/tags.js +61 -0
  63. package/dist/commands/tags.js.map +1 -0
  64. package/dist/commands/tasks.d.ts +6 -0
  65. package/dist/commands/tasks.d.ts.map +1 -0
  66. package/dist/commands/tasks.js +160 -0
  67. package/dist/commands/tasks.js.map +1 -0
  68. package/dist/commands/update.d.ts +6 -0
  69. package/dist/commands/update.d.ts.map +1 -0
  70. package/dist/commands/update.js +179 -0
  71. package/dist/commands/update.js.map +1 -0
  72. package/dist/errors.d.ts +38 -0
  73. package/dist/errors.d.ts.map +1 -0
  74. package/dist/errors.js +77 -0
  75. package/dist/errors.js.map +1 -0
  76. package/dist/escape.d.ts +6 -0
  77. package/dist/escape.d.ts.map +1 -0
  78. package/dist/escape.js +8 -0
  79. package/dist/escape.js.map +1 -0
  80. package/dist/index.d.ts +30 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +36 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/ofocus-sdk.d.ts +608 -0
  85. package/dist/result.d.ts +15 -0
  86. package/dist/result.d.ts.map +1 -0
  87. package/dist/result.js +29 -0
  88. package/dist/result.js.map +1 -0
  89. package/dist/types.d.ts +228 -0
  90. package/dist/types.d.ts.map +1 -0
  91. package/dist/types.js +2 -0
  92. package/dist/types.js.map +1 -0
  93. package/dist/validation.d.ts +57 -0
  94. package/dist/validation.d.ts.map +1 -0
  95. package/dist/validation.js +172 -0
  96. package/dist/validation.js.map +1 -0
  97. package/docs/index.md +30 -0
  98. package/docs/sdk.addtoinbox.md +68 -0
  99. package/docs/sdk.applescriptresult.data.md +11 -0
  100. package/docs/sdk.applescriptresult.error.md +11 -0
  101. package/docs/sdk.applescriptresult.md +92 -0
  102. package/docs/sdk.applescriptresult.success.md +11 -0
  103. package/docs/sdk.clierror.code.md +11 -0
  104. package/docs/sdk.clierror.details.md +11 -0
  105. package/docs/sdk.clierror.md +92 -0
  106. package/docs/sdk.clierror.message.md +11 -0
  107. package/docs/sdk.clioutput.data.md +11 -0
  108. package/docs/sdk.clioutput.error.md +11 -0
  109. package/docs/sdk.clioutput.md +90 -0
  110. package/docs/sdk.clioutput.success.md +11 -0
  111. package/docs/sdk.commandinfo.description.md +11 -0
  112. package/docs/sdk.commandinfo.md +90 -0
  113. package/docs/sdk.commandinfo.name.md +11 -0
  114. package/docs/sdk.commandinfo.usage.md +11 -0
  115. package/docs/sdk.completeresult.completed.md +11 -0
  116. package/docs/sdk.completeresult.md +90 -0
  117. package/docs/sdk.completeresult.taskid.md +11 -0
  118. package/docs/sdk.completeresult.taskname.md +11 -0
  119. package/docs/sdk.completetask.md +52 -0
  120. package/docs/sdk.createerror.md +82 -0
  121. package/docs/sdk.errorcode.md +24 -0
  122. package/docs/sdk.escapeapplescript.md +52 -0
  123. package/docs/sdk.failure.md +52 -0
  124. package/docs/sdk.failuremessage.md +52 -0
  125. package/docs/sdk.inboxoptions.defer.md +11 -0
  126. package/docs/sdk.inboxoptions.due.md +11 -0
  127. package/docs/sdk.inboxoptions.flag.md +11 -0
  128. package/docs/sdk.inboxoptions.md +134 -0
  129. package/docs/sdk.inboxoptions.note.md +11 -0
  130. package/docs/sdk.inboxoptions.tags.md +11 -0
  131. package/docs/sdk.jsonhelpers.md +13 -0
  132. package/docs/sdk.md +471 -0
  133. package/docs/sdk.ofperspective.id.md +11 -0
  134. package/docs/sdk.ofperspective.md +73 -0
  135. package/docs/sdk.ofperspective.name.md +11 -0
  136. package/docs/sdk.ofproject.folderid.md +11 -0
  137. package/docs/sdk.ofproject.foldername.md +11 -0
  138. package/docs/sdk.ofproject.id.md +11 -0
  139. package/docs/sdk.ofproject.md +192 -0
  140. package/docs/sdk.ofproject.name.md +11 -0
  141. package/docs/sdk.ofproject.note.md +11 -0
  142. package/docs/sdk.ofproject.remainingtaskcount.md +11 -0
  143. package/docs/sdk.ofproject.sequential.md +11 -0
  144. package/docs/sdk.ofproject.status.md +11 -0
  145. package/docs/sdk.ofproject.taskcount.md +11 -0
  146. package/docs/sdk.oftag.availabletaskcount.md +11 -0
  147. package/docs/sdk.oftag.id.md +11 -0
  148. package/docs/sdk.oftag.md +124 -0
  149. package/docs/sdk.oftag.name.md +11 -0
  150. package/docs/sdk.oftag.parentid.md +11 -0
  151. package/docs/sdk.oftag.parentname.md +11 -0
  152. package/docs/sdk.oftask.completed.md +11 -0
  153. package/docs/sdk.oftask.completiondate.md +11 -0
  154. package/docs/sdk.oftask.deferdate.md +11 -0
  155. package/docs/sdk.oftask.duedate.md +11 -0
  156. package/docs/sdk.oftask.flagged.md +11 -0
  157. package/docs/sdk.oftask.id.md +11 -0
  158. package/docs/sdk.oftask.md +226 -0
  159. package/docs/sdk.oftask.name.md +11 -0
  160. package/docs/sdk.oftask.note.md +11 -0
  161. package/docs/sdk.oftask.projectid.md +11 -0
  162. package/docs/sdk.oftask.projectname.md +11 -0
  163. package/docs/sdk.oftask.tags.md +11 -0
  164. package/docs/sdk.omnifocusscript.md +52 -0
  165. package/docs/sdk.omnifocusscriptwithhelpers.md +52 -0
  166. package/docs/sdk.parseapplescripterror.md +52 -0
  167. package/docs/sdk.projectqueryoptions.folder.md +11 -0
  168. package/docs/sdk.projectqueryoptions.md +96 -0
  169. package/docs/sdk.projectqueryoptions.sequential.md +11 -0
  170. package/docs/sdk.projectqueryoptions.status.md +11 -0
  171. package/docs/sdk.queryprojects.md +54 -0
  172. package/docs/sdk.querytags.md +54 -0
  173. package/docs/sdk.querytasks.md +54 -0
  174. package/docs/sdk.runapplescript.md +52 -0
  175. package/docs/sdk.runapplescriptfile.md +68 -0
  176. package/docs/sdk.success.md +52 -0
  177. package/docs/sdk.tagqueryoptions.md +58 -0
  178. package/docs/sdk.tagqueryoptions.parent.md +11 -0
  179. package/docs/sdk.taskqueryoptions.available.md +11 -0
  180. package/docs/sdk.taskqueryoptions.completed.md +11 -0
  181. package/docs/sdk.taskqueryoptions.dueafter.md +11 -0
  182. package/docs/sdk.taskqueryoptions.duebefore.md +11 -0
  183. package/docs/sdk.taskqueryoptions.flagged.md +11 -0
  184. package/docs/sdk.taskqueryoptions.md +172 -0
  185. package/docs/sdk.taskqueryoptions.project.md +11 -0
  186. package/docs/sdk.taskqueryoptions.tag.md +11 -0
  187. package/docs/sdk.taskupdateoptions.defer.md +11 -0
  188. package/docs/sdk.taskupdateoptions.due.md +11 -0
  189. package/docs/sdk.taskupdateoptions.flag.md +11 -0
  190. package/docs/sdk.taskupdateoptions.md +172 -0
  191. package/docs/sdk.taskupdateoptions.note.md +11 -0
  192. package/docs/sdk.taskupdateoptions.project.md +11 -0
  193. package/docs/sdk.taskupdateoptions.tags.md +11 -0
  194. package/docs/sdk.taskupdateoptions.title.md +11 -0
  195. package/docs/sdk.updatetask.md +66 -0
  196. package/docs/sdk.validatedatestring.md +54 -0
  197. package/docs/sdk.validateid.md +66 -0
  198. package/docs/sdk.validateprojectname.md +52 -0
  199. package/docs/sdk.validatetags.md +52 -0
  200. package/package.json +51 -0
@@ -0,0 +1,82 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [createError](./sdk.createerror.md)
4
+
5
+ ## createError() function
6
+
7
+ Create a CliError with the given code and message.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function createError(code: ErrorCode, message: string, details?: string): CliError;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ code
36
+
37
+
38
+ </td><td>
39
+
40
+ [ErrorCode](./sdk.errorcode.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td></tr>
47
+ <tr><td>
48
+
49
+ message
50
+
51
+
52
+ </td><td>
53
+
54
+ string
55
+
56
+
57
+ </td><td>
58
+
59
+
60
+ </td></tr>
61
+ <tr><td>
62
+
63
+ details
64
+
65
+
66
+ </td><td>
67
+
68
+ string
69
+
70
+
71
+ </td><td>
72
+
73
+ _(Optional)_
74
+
75
+
76
+ </td></tr>
77
+ </tbody></table>
78
+
79
+ **Returns:**
80
+
81
+ [CliError](./sdk.clierror.md)
82
+
@@ -0,0 +1,24 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [ErrorCode](./sdk.errorcode.md)
4
+
5
+ ## ErrorCode variable
6
+
7
+ Error codes for semantic error handling.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ ErrorCode: {
13
+ readonly TASK_NOT_FOUND: "TASK_NOT_FOUND";
14
+ readonly PROJECT_NOT_FOUND: "PROJECT_NOT_FOUND";
15
+ readonly TAG_NOT_FOUND: "TAG_NOT_FOUND";
16
+ readonly OMNIFOCUS_NOT_RUNNING: "OMNIFOCUS_NOT_RUNNING";
17
+ readonly INVALID_DATE_FORMAT: "INVALID_DATE_FORMAT";
18
+ readonly INVALID_ID_FORMAT: "INVALID_ID_FORMAT";
19
+ readonly APPLESCRIPT_ERROR: "APPLESCRIPT_ERROR";
20
+ readonly JSON_PARSE_ERROR: "JSON_PARSE_ERROR";
21
+ readonly VALIDATION_ERROR: "VALIDATION_ERROR";
22
+ readonly UNKNOWN_ERROR: "UNKNOWN_ERROR";
23
+ }
24
+ ```
@@ -0,0 +1,52 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [escapeAppleScript](./sdk.escapeapplescript.md)
4
+
5
+ ## escapeAppleScript() function
6
+
7
+ Escape a string for safe use in AppleScript double-quoted strings. Handles backslashes and double quotes.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function escapeAppleScript(str: string): string;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ str
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td></tr>
47
+ </tbody></table>
48
+
49
+ **Returns:**
50
+
51
+ string
52
+
@@ -0,0 +1,52 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [failure](./sdk.failure.md)
4
+
5
+ ## failure() function
6
+
7
+ Create a failed CLI output with a structured error.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function failure<T = null>(error: CliError): CliOutput<T>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ error
36
+
37
+
38
+ </td><td>
39
+
40
+ [CliError](./sdk.clierror.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td></tr>
47
+ </tbody></table>
48
+
49
+ **Returns:**
50
+
51
+ [CliOutput](./sdk.clioutput.md)<!-- -->&lt;T&gt;
52
+
@@ -0,0 +1,52 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [failureMessage](./sdk.failuremessage.md)
4
+
5
+ ## failureMessage() function
6
+
7
+ Create a failed CLI output with a simple string message. This is a convenience function that wraps the message in an UNKNOWN\_ERROR.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export declare function failureMessage<T = null>(message: string): CliOutput<T>;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ message
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td></tr>
47
+ </tbody></table>
48
+
49
+ **Returns:**
50
+
51
+ [CliOutput](./sdk.clioutput.md)<!-- -->&lt;T&gt;
52
+
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [InboxOptions](./sdk.inboxoptions.md) &gt; [defer](./sdk.inboxoptions.defer.md)
4
+
5
+ ## InboxOptions.defer property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ defer?: string | undefined;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [InboxOptions](./sdk.inboxoptions.md) &gt; [due](./sdk.inboxoptions.due.md)
4
+
5
+ ## InboxOptions.due property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ due?: string | undefined;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [InboxOptions](./sdk.inboxoptions.md) &gt; [flag](./sdk.inboxoptions.flag.md)
4
+
5
+ ## InboxOptions.flag property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ flag?: boolean | undefined;
11
+ ```
@@ -0,0 +1,134 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [InboxOptions](./sdk.inboxoptions.md)
4
+
5
+ ## InboxOptions interface
6
+
7
+ Options for adding a task to the inbox.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export interface InboxOptions
13
+ ```
14
+
15
+ ## Properties
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Property
20
+
21
+
22
+ </th><th>
23
+
24
+ Modifiers
25
+
26
+
27
+ </th><th>
28
+
29
+ Type
30
+
31
+
32
+ </th><th>
33
+
34
+ Description
35
+
36
+
37
+ </th></tr></thead>
38
+ <tbody><tr><td>
39
+
40
+ [defer?](./sdk.inboxoptions.defer.md)
41
+
42
+
43
+ </td><td>
44
+
45
+
46
+ </td><td>
47
+
48
+ string \| undefined
49
+
50
+
51
+ </td><td>
52
+
53
+ _(Optional)_
54
+
55
+
56
+ </td></tr>
57
+ <tr><td>
58
+
59
+ [due?](./sdk.inboxoptions.due.md)
60
+
61
+
62
+ </td><td>
63
+
64
+
65
+ </td><td>
66
+
67
+ string \| undefined
68
+
69
+
70
+ </td><td>
71
+
72
+ _(Optional)_
73
+
74
+
75
+ </td></tr>
76
+ <tr><td>
77
+
78
+ [flag?](./sdk.inboxoptions.flag.md)
79
+
80
+
81
+ </td><td>
82
+
83
+
84
+ </td><td>
85
+
86
+ boolean \| undefined
87
+
88
+
89
+ </td><td>
90
+
91
+ _(Optional)_
92
+
93
+
94
+ </td></tr>
95
+ <tr><td>
96
+
97
+ [note?](./sdk.inboxoptions.note.md)
98
+
99
+
100
+ </td><td>
101
+
102
+
103
+ </td><td>
104
+
105
+ string \| undefined
106
+
107
+
108
+ </td><td>
109
+
110
+ _(Optional)_
111
+
112
+
113
+ </td></tr>
114
+ <tr><td>
115
+
116
+ [tags?](./sdk.inboxoptions.tags.md)
117
+
118
+
119
+ </td><td>
120
+
121
+
122
+ </td><td>
123
+
124
+ string\[\] \| undefined
125
+
126
+
127
+ </td><td>
128
+
129
+ _(Optional)_
130
+
131
+
132
+ </td></tr>
133
+ </tbody></table>
134
+
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [InboxOptions](./sdk.inboxoptions.md) &gt; [note](./sdk.inboxoptions.note.md)
4
+
5
+ ## InboxOptions.note property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ note?: string | undefined;
11
+ ```
@@ -0,0 +1,11 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [InboxOptions](./sdk.inboxoptions.md) &gt; [tags](./sdk.inboxoptions.tags.md)
4
+
5
+ ## InboxOptions.tags property
6
+
7
+ **Signature:**
8
+
9
+ ```typescript
10
+ tags?: string[] | undefined;
11
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [@ofocus/sdk](./sdk.md) &gt; [jsonHelpers](./sdk.jsonhelpers.md)
4
+
5
+ ## jsonHelpers variable
6
+
7
+ AppleScript helper functions for JSON serialization. These must be defined at the top level (outside tell blocks).
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ jsonHelpers = "\non jsonString(val)\n if val is \"\" or val is missing value or val is \"missing value\" then\n return \"null\"\n else\n return \"\\\"\" & my escapeJson(val) & \"\\\"\"\n end if\nend jsonString\n\non jsonArray(theList)\n if (count of theList) is 0 then\n return \"[]\"\n end if\n set output to \"[\"\n repeat with i from 1 to count of theList\n if i > 1 then set output to output & \",\"\n set output to output & \"\\\"\" & (my escapeJson(item i of theList)) & \"\\\"\"\n end repeat\n return output & \"]\"\nend jsonArray\n\non escapeJson(str)\n set output to \"\"\n repeat with c in characters of (str as string)\n if c is \"\\\"\" then\n set output to output & \"\\\\\\\"\"\n else if c is \"\\\\\" then\n set output to output & \"\\\\\\\\\"\n else if c is return then\n set output to output & \"\\\\n\"\n else if c is linefeed then\n set output to output & \"\\\\n\"\n else\n set output to output & c\n end if\n end repeat\n return output\nend escapeJson\n"
13
+ ```