powersync 0.1.0 → 0.1.1

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 (191) hide show
  1. package/README.md +14 -14
  2. package/dist/commands/init.d.ts +0 -1
  3. package/dist/commands/init.js +9 -8
  4. package/dist/commands/instance/sync-rules/generate-schema.js +6 -6
  5. package/dist/constants.d.ts +2 -5
  6. package/dist/constants.js +4 -2
  7. package/dist/service/accounts.client.js +11129 -25
  8. package/dist/service/powersync.client.js +37453 -113
  9. package/dist/service/types.js +1 -1
  10. package/dist/service/utils.js +6 -6
  11. package/dist/utils.js +3 -3
  12. package/oclif.manifest.json +1 -1
  13. package/package.json +28 -20
  14. package/dist/powersync-sdk/accounts/api.d.ts +0 -717
  15. package/dist/powersync-sdk/accounts/api.js +0 -182
  16. package/dist/powersync-sdk/accounts/client.d.ts +0 -1096
  17. package/dist/powersync-sdk/accounts/client.js +0 -124
  18. package/dist/powersync-sdk/accounts/codecs.d.ts +0 -32
  19. package/dist/powersync-sdk/accounts/codecs.js +0 -93
  20. package/dist/powersync-sdk/accounts/index.d.ts +0 -4
  21. package/dist/powersync-sdk/accounts/index.js +0 -4
  22. package/dist/powersync-sdk/accounts/models.d.ts +0 -260
  23. package/dist/powersync-sdk/accounts/models.js +0 -96
  24. package/dist/powersync-sdk/accounts/routes.d.ts +0 -44
  25. package/dist/powersync-sdk/accounts/routes.js +0 -45
  26. package/dist/powersync-sdk/accounts/source.d.ts +0 -76
  27. package/dist/powersync-sdk/accounts/source.js +0 -32
  28. package/dist/powersync-sdk/errors/errors.d.ts +0 -62
  29. package/dist/powersync-sdk/errors/errors.js +0 -115
  30. package/dist/powersync-sdk/errors/index.d.ts +0 -2
  31. package/dist/powersync-sdk/errors/index.js +0 -2
  32. package/dist/powersync-sdk/errors/utils.d.ts +0 -4
  33. package/dist/powersync-sdk/errors/utils.js +0 -18
  34. package/dist/powersync-sdk/fetch-clients/codecs.d.ts +0 -4
  35. package/dist/powersync-sdk/fetch-clients/codecs.js +0 -34
  36. package/dist/powersync-sdk/fetch-clients/decoders.d.ts +0 -3
  37. package/dist/powersync-sdk/fetch-clients/decoders.js +0 -35
  38. package/dist/powersync-sdk/fetch-clients/definitions.d.ts +0 -97
  39. package/dist/powersync-sdk/fetch-clients/definitions.js +0 -22
  40. package/dist/powersync-sdk/fetch-clients/errors.d.ts +0 -7
  41. package/dist/powersync-sdk/fetch-clients/errors.js +0 -19
  42. package/dist/powersync-sdk/fetch-clients/index.d.ts +0 -5
  43. package/dist/powersync-sdk/fetch-clients/index.js +0 -5
  44. package/dist/powersync-sdk/fetch-clients/node-client.d.ts +0 -9
  45. package/dist/powersync-sdk/fetch-clients/node-client.js +0 -107
  46. package/dist/powersync-sdk/fetch-clients/request.d.ts +0 -11
  47. package/dist/powersync-sdk/fetch-clients/request.js +0 -138
  48. package/dist/powersync-sdk/fetch-clients/streaming.d.ts +0 -65
  49. package/dist/powersync-sdk/fetch-clients/streaming.js +0 -99
  50. package/dist/powersync-sdk/fetch-clients/utils.d.ts +0 -13
  51. package/dist/powersync-sdk/fetch-clients/utils.js +0 -43
  52. package/dist/powersync-sdk/fetch-clients/web-client.d.ts +0 -14
  53. package/dist/powersync-sdk/fetch-clients/web-client.js +0 -56
  54. package/dist/powersync-sdk/json/index.d.ts +0 -4
  55. package/dist/powersync-sdk/json/index.js +0 -3
  56. package/dist/powersync-sdk/json/json.d.ts +0 -5
  57. package/dist/powersync-sdk/json/json.js +0 -35
  58. package/dist/powersync-sdk/json/json_container.d.ts +0 -18
  59. package/dist/powersync-sdk/json/json_container.js +0 -28
  60. package/dist/powersync-sdk/json/json_stringify.d.ts +0 -36
  61. package/dist/powersync-sdk/json/json_stringify.js +0 -162
  62. package/dist/powersync-sdk/powersync/client.d.ts +0 -449
  63. package/dist/powersync-sdk/powersync/client.js +0 -53
  64. package/dist/powersync-sdk/powersync/config/HostedConfig.d.ts +0 -327
  65. package/dist/powersync-sdk/powersync/config/HostedConfig.js +0 -92
  66. package/dist/powersync-sdk/powersync/config/PowerSyncConfig.d.ts +0 -211
  67. package/dist/powersync-sdk/powersync/config/PowerSyncConfig.js +0 -97
  68. package/dist/powersync-sdk/powersync/config/normalize.d.ts +0 -32
  69. package/dist/powersync-sdk/powersync/config/normalize.js +0 -85
  70. package/dist/powersync-sdk/powersync/definitions.d.ts +0 -149
  71. package/dist/powersync-sdk/powersync/definitions.js +0 -97
  72. package/dist/powersync-sdk/powersync/index.d.ts +0 -8
  73. package/dist/powersync-sdk/powersync/index.js +0 -8
  74. package/dist/powersync-sdk/powersync/internal_routes.d.ts +0 -247
  75. package/dist/powersync-sdk/powersync/internal_routes.js +0 -69
  76. package/dist/powersync-sdk/powersync/routes.d.ts +0 -779
  77. package/dist/powersync-sdk/powersync/routes.js +0 -191
  78. package/dist/powersync-sdk/sdk-clients/endpoints.d.ts +0 -31
  79. package/dist/powersync-sdk/sdk-clients/endpoints.js +0 -48
  80. package/dist/powersync-sdk/sdk-clients/index.d.ts +0 -3
  81. package/dist/powersync-sdk/sdk-clients/index.js +0 -3
  82. package/dist/powersync-sdk/sdk-clients/pagination.d.ts +0 -14
  83. package/dist/powersync-sdk/sdk-clients/pagination.js +0 -21
  84. package/dist/powersync-sdk/sdk-clients/sdk-client.d.ts +0 -17
  85. package/dist/powersync-sdk/sdk-clients/sdk-client.js +0 -30
  86. package/dist/powersync-sdk/streaming/bson/buffer-array.d.ts +0 -31
  87. package/dist/powersync-sdk/streaming/bson/buffer-array.js +0 -79
  88. package/dist/powersync-sdk/streaming/bson/constants.d.ts +0 -2
  89. package/dist/powersync-sdk/streaming/bson/constants.js +0 -1
  90. package/dist/powersync-sdk/streaming/bson/decoder.d.ts +0 -10
  91. package/dist/powersync-sdk/streaming/bson/decoder.js +0 -62
  92. package/dist/powersync-sdk/streaming/bson/encoder.d.ts +0 -10
  93. package/dist/powersync-sdk/streaming/bson/encoder.js +0 -23
  94. package/dist/powersync-sdk/streaming/bson/header.d.ts +0 -11
  95. package/dist/powersync-sdk/streaming/bson/header.js +0 -52
  96. package/dist/powersync-sdk/streaming/bson/index.d.ts +0 -5
  97. package/dist/powersync-sdk/streaming/bson/index.js +0 -5
  98. package/dist/powersync-sdk/streaming/core/backpressure.d.ts +0 -15
  99. package/dist/powersync-sdk/streaming/core/backpressure.js +0 -34
  100. package/dist/powersync-sdk/streaming/core/cross-stream.d.ts +0 -6
  101. package/dist/powersync-sdk/streaming/core/cross-stream.js +0 -17
  102. package/dist/powersync-sdk/streaming/core/index.d.ts +0 -4
  103. package/dist/powersync-sdk/streaming/core/index.js +0 -4
  104. package/dist/powersync-sdk/streaming/core/node-utils.d.ts +0 -7
  105. package/dist/powersync-sdk/streaming/core/node-utils.js +0 -11
  106. package/dist/powersync-sdk/streaming/core/transformers.d.ts +0 -41
  107. package/dist/powersync-sdk/streaming/core/transformers.js +0 -70
  108. package/dist/powersync-sdk/streaming/core/utils.d.ts +0 -36
  109. package/dist/powersync-sdk/streaming/core/utils.js +0 -66
  110. package/dist/powersync-sdk/streaming/index.d.ts +0 -3
  111. package/dist/powersync-sdk/streaming/index.js +0 -3
  112. package/dist/powersync-sdk/streaming/web.d.ts +0 -4
  113. package/dist/powersync-sdk/streaming/web.js +0 -4
  114. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binaryreader.d.ts +0 -2
  115. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binaryreader.js +0 -36
  116. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binarywriter.d.ts +0 -2
  117. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/binarywriter.js +0 -58
  118. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometry.d.ts +0 -18
  119. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometry.js +0 -348
  120. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometrycollection.d.ts +0 -11
  121. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/geometrycollection.js +0 -118
  122. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/linestring.d.ts +0 -11
  123. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/linestring.js +0 -131
  124. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multilinestring.d.ts +0 -11
  125. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multilinestring.js +0 -134
  126. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipoint.d.ts +0 -11
  127. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipoint.js +0 -122
  128. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipolygon.d.ts +0 -11
  129. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/multipolygon.js +0 -158
  130. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/point.d.ts +0 -14
  131. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/point.js +0 -165
  132. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/polygon.d.ts +0 -11
  133. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/polygon.js +0 -207
  134. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/types.d.ts +0 -30
  135. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/types.js +0 -29
  136. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wktparser.d.ts +0 -2
  137. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wktparser.js +0 -111
  138. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wkx.d.ts +0 -9
  139. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/wkx.js +0 -9
  140. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/zigzag.d.ts +0 -5
  141. package/dist/powersync-sdk/sync-rules/@syncpoint/wkx/zigzag.js +0 -9
  142. package/dist/powersync-sdk/sync-rules/DartSchemaGenerator.d.ts +0 -12
  143. package/dist/powersync-sdk/sync-rules/DartSchemaGenerator.js +0 -35
  144. package/dist/powersync-sdk/sync-rules/ExpressionType.d.ts +0 -33
  145. package/dist/powersync-sdk/sync-rules/ExpressionType.js +0 -62
  146. package/dist/powersync-sdk/sync-rules/IdSequence.d.ts +0 -4
  147. package/dist/powersync-sdk/sync-rules/IdSequence.js +0 -7
  148. package/dist/powersync-sdk/sync-rules/JsSchemaGenerator.d.ts +0 -12
  149. package/dist/powersync-sdk/sync-rules/JsSchemaGenerator.js +0 -38
  150. package/dist/powersync-sdk/sync-rules/SchemaGenerator.d.ts +0 -14
  151. package/dist/powersync-sdk/sync-rules/SchemaGenerator.js +0 -24
  152. package/dist/powersync-sdk/sync-rules/SourceTableInterface.d.ts +0 -5
  153. package/dist/powersync-sdk/sync-rules/SourceTableInterface.js +0 -1
  154. package/dist/powersync-sdk/sync-rules/SqlBucketDescriptor.d.ts +0 -37
  155. package/dist/powersync-sdk/sync-rules/SqlBucketDescriptor.js +0 -116
  156. package/dist/powersync-sdk/sync-rules/SqlDataQuery.d.ts +0 -39
  157. package/dist/powersync-sdk/sync-rules/SqlDataQuery.js +0 -245
  158. package/dist/powersync-sdk/sync-rules/SqlParameterQuery.d.ts +0 -43
  159. package/dist/powersync-sdk/sync-rules/SqlParameterQuery.js +0 -254
  160. package/dist/powersync-sdk/sync-rules/SqlSyncRules.d.ts +0 -52
  161. package/dist/powersync-sdk/sync-rules/SqlSyncRules.js +0 -252
  162. package/dist/powersync-sdk/sync-rules/StaticSchema.d.ts +0 -26
  163. package/dist/powersync-sdk/sync-rules/StaticSchema.js +0 -71
  164. package/dist/powersync-sdk/sync-rules/StaticSqlParameterQuery.d.ts +0 -24
  165. package/dist/powersync-sdk/sync-rules/StaticSqlParameterQuery.js +0 -71
  166. package/dist/powersync-sdk/sync-rules/TablePattern.d.ts +0 -17
  167. package/dist/powersync-sdk/sync-rules/TablePattern.js +0 -56
  168. package/dist/powersync-sdk/sync-rules/TableQuerySchema.d.ts +0 -9
  169. package/dist/powersync-sdk/sync-rules/TableQuerySchema.js +0 -41
  170. package/dist/powersync-sdk/sync-rules/errors.d.ts +0 -22
  171. package/dist/powersync-sdk/sync-rules/errors.js +0 -60
  172. package/dist/powersync-sdk/sync-rules/generators.d.ts +0 -6
  173. package/dist/powersync-sdk/sync-rules/generators.js +0 -6
  174. package/dist/powersync-sdk/sync-rules/index.d.ts +0 -17
  175. package/dist/powersync-sdk/sync-rules/index.js +0 -17
  176. package/dist/powersync-sdk/sync-rules/json_schema.d.ts +0 -3
  177. package/dist/powersync-sdk/sync-rules/json_schema.js +0 -50
  178. package/dist/powersync-sdk/sync-rules/sql_filters.d.ts +0 -91
  179. package/dist/powersync-sdk/sync-rules/sql_filters.js +0 -491
  180. package/dist/powersync-sdk/sync-rules/sql_functions.d.ts +0 -53
  181. package/dist/powersync-sdk/sync-rules/sql_functions.js +0 -755
  182. package/dist/powersync-sdk/sync-rules/sql_support.d.ts +0 -22
  183. package/dist/powersync-sdk/sync-rules/sql_support.js +0 -208
  184. package/dist/powersync-sdk/sync-rules/types.d.ts +0 -174
  185. package/dist/powersync-sdk/sync-rules/types.js +0 -9
  186. package/dist/powersync-sdk/sync-rules/utils.d.ts +0 -45
  187. package/dist/powersync-sdk/sync-rules/utils.js +0 -163
  188. package/dist/service/accounts.client.d.ts +0 -26
  189. package/dist/service/powersync.client.d.ts +0 -269
  190. package/dist/service/types.d.ts +0 -69
  191. package/dist/service/utils.d.ts +0 -5
package/README.md CHANGED
@@ -13,7 +13,7 @@ $ npm install -g powersync
13
13
  $ powersync COMMAND
14
14
  running command...
15
15
  $ powersync (--version)
16
- powersync/0.1.0 linux-x64 node-v20.10.0
16
+ powersync/0.1.1 linux-x64 node-v20.11.0
17
17
  $ powersync --help [COMMAND]
18
18
  USAGE
19
19
  $ powersync COMMAND
@@ -74,7 +74,7 @@ EXAMPLES
74
74
  $ powersync init
75
75
  ```
76
76
 
77
- _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/init.ts)_
77
+ _See code: [src/commands/init.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/init.ts)_
78
78
 
79
79
  ## `powersync instance config`
80
80
 
@@ -91,7 +91,7 @@ EXAMPLES
91
91
  $ powersync instance config
92
92
  ```
93
93
 
94
- _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/config.ts)_
94
+ _See code: [src/commands/instance/config.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/config.ts)_
95
95
 
96
96
  ## `powersync instance create`
97
97
 
@@ -118,7 +118,7 @@ EXAMPLES
118
118
  $ powersync instance create
119
119
  ```
120
120
 
121
- _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/create.ts)_
121
+ _See code: [src/commands/instance/create.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/create.ts)_
122
122
 
123
123
  ## `powersync instance deploy`
124
124
 
@@ -143,7 +143,7 @@ EXAMPLES
143
143
  $ powersync instance deploy
144
144
  ```
145
145
 
146
- _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/deploy.ts)_
146
+ _See code: [src/commands/instance/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/deploy.ts)_
147
147
 
148
148
  ## `powersync instance destroy`
149
149
 
@@ -165,7 +165,7 @@ EXAMPLES
165
165
  $ powersync instance destroy --instanceId=1234
166
166
  ```
167
167
 
168
- _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/destroy.ts)_
168
+ _See code: [src/commands/instance/destroy.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/destroy.ts)_
169
169
 
170
170
  ## `powersync instance schema`
171
171
 
@@ -182,7 +182,7 @@ EXAMPLES
182
182
  $ powersync instance schema
183
183
  ```
184
184
 
185
- _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/schema.ts)_
185
+ _See code: [src/commands/instance/schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/schema.ts)_
186
186
 
187
187
  ## `powersync instance set`
188
188
 
@@ -204,7 +204,7 @@ EXAMPLES
204
204
  $ powersync instance set --instanceId=1234
205
205
  ```
206
206
 
207
- _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/set.ts)_
207
+ _See code: [src/commands/instance/set.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/set.ts)_
208
208
 
209
209
  ## `powersync instance status`
210
210
 
@@ -221,7 +221,7 @@ EXAMPLES
221
221
  $ powersync instance status
222
222
  ```
223
223
 
224
- _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/status.ts)_
224
+ _See code: [src/commands/instance/status.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/status.ts)_
225
225
 
226
226
  ## `powersync instance stop`
227
227
 
@@ -243,7 +243,7 @@ EXAMPLES
243
243
  $ powersync instance stop --instanceId=1234
244
244
  ```
245
245
 
246
- _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/stop.ts)_
246
+ _See code: [src/commands/instance/stop.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/stop.ts)_
247
247
 
248
248
  ## `powersync instance sync-rules deploy`
249
249
 
@@ -268,7 +268,7 @@ EXAMPLES
268
268
  $ powersync instance sync-rules deploy -f path/to/file
269
269
  ```
270
270
 
271
- _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/sync-rules/deploy.ts)_
271
+ _See code: [src/commands/instance/sync-rules/deploy.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/sync-rules/deploy.ts)_
272
272
 
273
273
  ## `powersync instance sync-rules generate-schema`
274
274
 
@@ -294,7 +294,7 @@ EXAMPLES
294
294
  $ powersync instance sync-rules generate-schema -f path/to/file
295
295
  ```
296
296
 
297
- _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/sync-rules/generate-schema.ts)_
297
+ _See code: [src/commands/instance/sync-rules/generate-schema.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/sync-rules/generate-schema.ts)_
298
298
 
299
299
  ## `powersync instance sync-rules validate`
300
300
 
@@ -318,7 +318,7 @@ EXAMPLES
318
318
  $ powersync instance sync-rules validate -f path/to/file
319
319
  ```
320
320
 
321
- _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instance/sync-rules/validate.ts)_
321
+ _See code: [src/commands/instance/sync-rules/validate.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instance/sync-rules/validate.ts)_
322
322
 
323
323
  ## `powersync instances`
324
324
 
@@ -335,5 +335,5 @@ EXAMPLES
335
335
  $ powersync instances
336
336
  ```
337
337
 
338
- _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.1.0/src/commands/instances.ts)_
338
+ _See code: [src/commands/instances.ts](https://github.com/powersync-ja/cli/blob/v0.1.1/src/commands/instances.ts)_
339
339
  <!-- commandsstop -->
@@ -1,5 +1,4 @@
1
1
  import { Command } from '@oclif/core';
2
- import 'dotenv/config';
3
2
  export default class Init extends Command {
4
3
  static description: string;
5
4
  static examples: string[];
@@ -1,7 +1,7 @@
1
1
  import { Command, ux } from '@oclif/core';
2
- import 'dotenv/config';
3
2
  import inquirer from 'inquirer';
4
3
  import fs from 'node:fs';
4
+ import { ENV_FILE_PATH, POWERSYNC_DIRECTORY } from '../constants.js';
5
5
  import * as AccountsClient from '../service/accounts.client.js';
6
6
  import { green, red } from '../utils.js';
7
7
  export default class Init extends Command {
@@ -10,22 +10,22 @@ export default class Init extends Command {
10
10
  async run() {
11
11
  const cardinalTokenQuestions = [
12
12
  {
13
- message: 'What is your cardinal token? Contact support to get one.',
13
+ message: 'Enter your API token:.',
14
14
  name: 'cardinalToken',
15
15
  type: 'password',
16
16
  validate(value) {
17
- return value.length > 0 ? true : 'Please enter your application ID.';
17
+ return value.length > 0 ? true : 'Please enter your API token.';
18
18
  }
19
19
  }
20
20
  ];
21
21
  const cardinalTokenAnswers = await inquirer.prompt(cardinalTokenQuestions);
22
22
  const organizations = await AccountsClient.getOrgs(cardinalTokenAnswers.cardinalToken);
23
23
  if (organizations.count > 1) {
24
- return ux.error(red('Multiple organizations found. Please contact support for assistance.'), { exit: 1 });
24
+ return ux.error(red('Multiple organizations found. Please contact support for assistance - support@powersync.com'), { exit: 1 });
25
25
  }
26
26
  const apps = await AccountsClient.getPowerSyncApps(cardinalTokenAnswers.cardinalToken);
27
27
  if (apps.length === 0) {
28
- return ux.error(red('No apps found. Please contact support for assistance.'), { exit: 1 });
28
+ return ux.error(red('No apps found. Please contact support for assistance - support@powersync.com'), { exit: 1 });
29
29
  }
30
30
  const appQuestions = [
31
31
  {
@@ -37,10 +37,11 @@ export default class Init extends Command {
37
37
  ];
38
38
  const appAnswers = await inquirer.prompt(appQuestions);
39
39
  const orgId = organizations.objects[0].id;
40
- if (fs.existsSync('.env')) {
41
- fs.unlinkSync('.env');
40
+ fs.mkdirSync(POWERSYNC_DIRECTORY);
41
+ if (fs.existsSync(ENV_FILE_PATH)) {
42
+ fs.unlinkSync(ENV_FILE_PATH);
42
43
  }
43
- fs.writeFileSync('.env', `ORG_ID=${orgId}\nAPP_ID=${appAnswers.appId}\nCARDINAL_TOKEN=${cardinalTokenAnswers.cardinalToken}\n`);
44
+ fs.writeFileSync(ENV_FILE_PATH, `ORG_ID=${orgId}\nAPP_ID=${appAnswers.appId}\nCARDINAL_TOKEN=${cardinalTokenAnswers.cardinalToken}\n`);
44
45
  ux.log(green('CLI has been initialized'));
45
46
  ux.log(`run ${green(`"${this.config.bin} instances"`)} to view your instances or`);
46
47
  ux.log(`run ${green(`"${this.config.bin} instance create"`)} to create an instance or`);
@@ -2,9 +2,6 @@ import { Command, Flags, ux } from '@oclif/core';
2
2
  import inquirer from 'inquirer';
3
3
  import fs from 'node:fs';
4
4
  import { LANGUAGES } from '../../../constants.js';
5
- import { SqlSyncRules } from '../../../powersync-sdk/sync-rules/SqlSyncRules.js';
6
- import { StaticSchema } from '../../../powersync-sdk/sync-rules/StaticSchema.js';
7
- import { schemaGenerators } from '../../../powersync-sdk/sync-rules/generators.js';
8
5
  import * as PowerSyncClient from '../../../service/powersync.client.js';
9
6
  import { checkForValidEnvFile, green, red } from '../../../utils.js';
10
7
  export default class SyncRulesGenerateSchema extends Command {
@@ -36,9 +33,12 @@ export default class SyncRulesGenerateSchema extends Command {
36
33
  ];
37
34
  const answers = await inquirer.prompt(questions);
38
35
  const schema = await PowerSyncClient.getInstanceSchema();
39
- const parsedSchema = new StaticSchema(schema.connections);
36
+ const parsedSchema = new PowerSyncClient.StaticSchema(schema.connections);
40
37
  const syncRulesFromFile = fs.readFileSync(flags.filePath, 'utf8');
41
- const syncRules = SqlSyncRules.fromYaml(syncRulesFromFile, { schema: parsedSchema, throwOnError: false });
38
+ const syncRules = PowerSyncClient.SqlSyncRules.fromYaml(syncRulesFromFile, {
39
+ schema: parsedSchema,
40
+ throwOnError: false
41
+ });
42
42
  const { errors } = syncRules;
43
43
  if (errors.length > 0) {
44
44
  ux.log(red(`❌ sync rule errors found:`));
@@ -48,7 +48,7 @@ export default class SyncRulesGenerateSchema extends Command {
48
48
  return ux.exit(1);
49
49
  }
50
50
  const language = flags.language || answers.language;
51
- const generator = schemaGenerators[language];
51
+ const generator = PowerSyncClient.schemaGenerators[language];
52
52
  const languageSchema = await generator.generate(syncRules, parsedSchema);
53
53
  ux.log(green(languageSchema));
54
54
  }
@@ -1,8 +1,5 @@
1
- export declare const HEADERS: {
2
- Accept: string;
3
- Authorization: string;
4
- ContentType: string;
5
- };
1
+ export declare const POWERSYNC_DIRECTORY: string;
2
+ export declare const ENV_FILE_PATH: string;
6
3
  export declare const ENDPOINTS: {
7
4
  ACCOUNTS_URL: string;
8
5
  POWERSYNC_URL: string;
package/dist/constants.js CHANGED
@@ -1,5 +1,7 @@
1
- const BEARER_TOKEN = `Bearer ${process.env.CARDINAL_TOKEN}`;
2
- export const HEADERS = { Accept: 'application/json', Authorization: BEARER_TOKEN, ContentType: 'application/json' };
1
+ import { homedir } from 'node:os';
2
+ import path from 'node:path';
3
+ export const POWERSYNC_DIRECTORY = path.join(homedir(), '/powersync');
4
+ export const ENV_FILE_PATH = `${POWERSYNC_DIRECTORY}/.env.powersync`;
3
5
  export const ENDPOINTS = {
4
6
  ACCOUNTS_URL: 'https://accounts.journeyapps.com',
5
7
  POWERSYNC_URL: 'https://powersync-api.journeyapps.com'