powersync 0.2.1 → 0.2.3

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.
@@ -44,7 +44,7 @@ function getAugmentedNamespace(n) {
44
44
  return a;
45
45
  }
46
46
 
47
- var dist$4 = {};
47
+ var dist$5 = {};
48
48
 
49
49
  var nodeClient = {};
50
50
 
@@ -5976,7 +5976,7 @@ transformers.drain = drain;
5976
5976
 
5977
5977
  var utils$7 = {};
5978
5978
 
5979
- var dist$3 = {};
5979
+ var dist$4 = {};
5980
5980
 
5981
5981
  var errors$2 = {};
5982
5982
 
@@ -6146,7 +6146,7 @@ var utils$6 = {};
6146
6146
  Object.defineProperty(exports, "__esModule", { value: true });
6147
6147
  __exportStar(errors$2, exports);
6148
6148
  __exportStar(utils$6, exports);
6149
- } (dist$3));
6149
+ } (dist$4));
6150
6150
 
6151
6151
  var __createBinding$7 = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6152
6152
  if (k2 === undefined) k2 = k;
@@ -6173,7 +6173,7 @@ var __importStar$7 = (commonjsGlobal && commonjsGlobal.__importStar) || function
6173
6173
  };
6174
6174
  Object.defineProperty(utils$7, "__esModule", { value: true });
6175
6175
  utils$7.validateDataStream = utils$7.readableFrom = utils$7.iterableFromReadable = void 0;
6176
- const micro_errors$1 = __importStar$7(dist$3);
6176
+ const micro_errors$1 = __importStar$7(dist$4);
6177
6177
  const cross_stream = __importStar$7(crossStream);
6178
6178
  /**
6179
6179
  * Construct an AsyncIterator from a given ReadableStream.
@@ -6278,24 +6278,24 @@ utils$7.validateDataStream = validateDataStream;
6278
6278
  __exportStar(utils$7, exports);
6279
6279
  } (web$1));
6280
6280
 
6281
- var definitions$4 = {};
6281
+ var definitions$5 = {};
6282
6282
 
6283
- Object.defineProperty(definitions$4, "__esModule", { value: true });
6284
- definitions$4.METHOD = definitions$4.ContentType = definitions$4.Header = void 0;
6283
+ Object.defineProperty(definitions$5, "__esModule", { value: true });
6284
+ definitions$5.METHOD = definitions$5.ContentType = definitions$5.Header = void 0;
6285
6285
  var Header;
6286
6286
  (function (Header) {
6287
6287
  Header["ContentType"] = "Content-Type";
6288
6288
  Header["Accept"] = "Accept";
6289
6289
  Header["Authorization"] = "Authorization";
6290
6290
  Header["UserAgent"] = "User-Agent";
6291
- })(Header || (definitions$4.Header = Header = {}));
6291
+ })(Header || (definitions$5.Header = Header = {}));
6292
6292
  var ContentType;
6293
6293
  (function (ContentType) {
6294
6294
  ContentType["JSON"] = "application/json";
6295
6295
  ContentType["BSON"] = "application/bson";
6296
6296
  ContentType["HeaderStream"] = "application/vnd.journeyapps.raw+header";
6297
6297
  ContentType["BSONStream"] = "application/vnd.journeyapps.bson-stream+header";
6298
- })(ContentType || (definitions$4.ContentType = ContentType = {}));
6298
+ })(ContentType || (definitions$5.ContentType = ContentType = {}));
6299
6299
  var METHOD;
6300
6300
  (function (METHOD) {
6301
6301
  METHOD["POST"] = "POST";
@@ -6303,7 +6303,7 @@ var METHOD;
6303
6303
  METHOD["PATCH"] = "PATCH";
6304
6304
  METHOD["GET"] = "GET";
6305
6305
  METHOD["DELETE"] = "DELETE";
6306
- })(METHOD || (definitions$4.METHOD = METHOD = {}));
6306
+ })(METHOD || (definitions$5.METHOD = METHOD = {}));
6307
6307
 
6308
6308
  (function (exports) {
6309
6309
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -6332,7 +6332,7 @@ var METHOD;
6332
6332
  Object.defineProperty(exports, "__esModule", { value: true });
6333
6333
  exports.headersForStream = exports.isBsonStream = exports.isHeaderStream = exports.isRawStream = exports.isStreamedPayload = exports.BsonStream = exports.HeaderStream = exports.RawStream = exports.StreamType = exports.ensureIterable = void 0;
6334
6334
  const micro_streaming = __importStar(web$1);
6335
- const defs = __importStar(definitions$4);
6335
+ const defs = __importStar(definitions$5);
6336
6336
  /**
6337
6337
  * This is for web compatibility. Web based ReadableStreams are not iterable even though we type them as such
6338
6338
  */
@@ -7119,7 +7119,7 @@ var __importStar$6 = (commonjsGlobal && commonjsGlobal.__importStar) || function
7119
7119
  };
7120
7120
  Object.defineProperty(errors$1, "__esModule", { value: true });
7121
7121
  errors$1.UnparsableServiceResponse = errors$1.TimeoutError = void 0;
7122
- const micro_errors = __importStar$6(dist$3);
7122
+ const micro_errors = __importStar$6(dist$4);
7123
7123
  class TimeoutError extends Error {
7124
7124
  constructor() {
7125
7125
  super();
@@ -7168,7 +7168,7 @@ var codecs = {};
7168
7168
  };
7169
7169
  Object.defineProperty(exports, "__esModule", { value: true });
7170
7170
  exports.DEFAULT_CODECS = exports.BSONCodec = exports.JSONCodec = void 0;
7171
- const defs = __importStar(definitions$4);
7171
+ const defs = __importStar(definitions$5);
7172
7172
  const bson = __importStar(require$$1);
7173
7173
  exports.JSONCodec = {
7174
7174
  encode: (data) => JSON.stringify(data),
@@ -7228,8 +7228,8 @@ var codecs = {};
7228
7228
  };
7229
7229
  Object.defineProperty(exports, "__esModule", { value: true });
7230
7230
  exports.decodeServiceResponse = exports.decodeResponse = void 0;
7231
- const micro_errors = __importStar(dist$3);
7232
- const defs = __importStar(definitions$4);
7231
+ const micro_errors = __importStar(dist$4);
7232
+ const defs = __importStar(definitions$5);
7233
7233
  const errors = __importStar(errors$1);
7234
7234
  const codecs$1 = __importStar(codecs);
7235
7235
  const decodeResponse = async (response, meta) => {
@@ -7293,7 +7293,7 @@ var codecs = {};
7293
7293
  exports.request = void 0;
7294
7294
  const micro_streaming = __importStar(web$1);
7295
7295
  const streaming$1 = __importStar(streaming);
7296
- const defs = __importStar(definitions$4);
7296
+ const defs = __importStar(definitions$5);
7297
7297
  const decoders$1 = __importStar(decoders);
7298
7298
  const codecs$1 = __importStar(codecs);
7299
7299
  const errors = __importStar(errors$1);
@@ -7760,8 +7760,8 @@ var __importStar$5 = (commonjsGlobal && commonjsGlobal.__importStar) || function
7760
7760
  Object.defineProperty(endpoints$1, "__esModule", { value: true });
7761
7761
  endpoints$1.createEndpoint = void 0;
7762
7762
  const micro_streaming = __importStar$5(web$1);
7763
- const defs$9 = __importStar$5(definitions$4);
7764
- const definitions_1$2 = definitions$4;
7763
+ const defs$9 = __importStar$5(definitions$5);
7764
+ const definitions_1$2 = definitions$5;
7765
7765
  const utils$4 = __importStar$5(utils$5);
7766
7766
  const createEndpoint = (options) => {
7767
7767
  const request = async (payload, override) => {
@@ -7944,7 +7944,7 @@ sdkClient.SDKClient = SDKClient;
7944
7944
  __exportStar(webClient, exports);
7945
7945
  __exportStar(fetchClients, exports);
7946
7946
  __exportStar(sdkClients, exports);
7947
- __exportStar(definitions$4, exports);
7947
+ __exportStar(definitions$5, exports);
7948
7948
  __exportStar(streaming, exports);
7949
7949
  __exportStar(utils$5, exports);
7950
7950
  } (web));
@@ -7967,17 +7967,17 @@ sdkClient.SDKClient = SDKClient;
7967
7967
  Object.defineProperty(exports, "__esModule", { value: true });
7968
7968
  __exportStar(nodeClient, exports);
7969
7969
  __exportStar(web, exports);
7970
- } (dist$4));
7970
+ } (dist$5));
7971
7971
 
7972
- var dist$2 = {};
7972
+ var dist$3 = {};
7973
7973
 
7974
- var dist$1 = {};
7974
+ var dist$2 = {};
7975
7975
 
7976
7976
  var HostedConfig = {};
7977
7977
 
7978
- var dist = {};
7978
+ var dist$1 = {};
7979
7979
 
7980
- var definitions$3 = {};
7980
+ var definitions$4 = {};
7981
7981
 
7982
7982
  (function (exports) {
7983
7983
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -7999,11 +7999,11 @@ var definitions$3 = {};
7999
7999
  CodecType["Union"] = "union";
8000
8000
  CodecType["Intersection"] = "intersection";
8001
8001
  })(exports.CodecType || (exports.CodecType = {}));
8002
- } (definitions$3));
8002
+ } (definitions$4));
8003
8003
 
8004
8004
  var jsonSchema = {};
8005
8005
 
8006
- var definitions$2 = {};
8006
+ var definitions$3 = {};
8007
8007
 
8008
8008
  (function (exports) {
8009
8009
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -8012,7 +8012,7 @@ var definitions$2 = {};
8012
8012
  TransformTarget["Encoded"] = "encoded";
8013
8013
  TransformTarget["Decoded"] = "decoded";
8014
8014
  })(exports.TransformTarget || (exports.TransformTarget = {}));
8015
- } (definitions$2));
8015
+ } (definitions$3));
8016
8016
 
8017
8017
  var generator = {};
8018
8018
 
@@ -8054,7 +8054,7 @@ root$4.RootParser = RootParser;
8054
8054
 
8055
8055
  Object.defineProperty(combinators$1, "__esModule", { value: true });
8056
8056
  combinators$1.UnionParser = combinators$1.IntersectionParser = void 0;
8057
- const defs$8 = definitions$3;
8057
+ const defs$8 = definitions$4;
8058
8058
  const utils_1$3 = utils$3;
8059
8059
  const root$3 = root$4;
8060
8060
  /**
@@ -8131,7 +8131,7 @@ var primitives$1 = {};
8131
8131
  (function (exports) {
8132
8132
  Object.defineProperty(exports, "__esModule", { value: true });
8133
8133
  exports.LiteralParser = exports.EnumParser = exports.AnyParser = exports.NullParser = exports.BooleanParser = exports.NumberParser = exports.StringParser = exports.createPrimitiveParser = void 0;
8134
- const defs = definitions$3;
8134
+ const defs = definitions$4;
8135
8135
  const utils_1 = utils$3;
8136
8136
  const createPrimitiveParser = (type) => {
8137
8137
  return (0, utils_1.createParser)(type, () => {
@@ -8164,7 +8164,7 @@ var recursive$2 = {};
8164
8164
 
8165
8165
  Object.defineProperty(recursive$2, "__esModule", { value: true });
8166
8166
  recursive$2.RecursiveParser = void 0;
8167
- const defs$7 = definitions$3;
8167
+ const defs$7 = definitions$4;
8168
8168
  const utils_1$2 = utils$3;
8169
8169
  const root$2 = root$4;
8170
8170
  recursive$2.RecursiveParser = (0, utils_1$2.createParser)(defs$7.CodecType.Recursive, (codec, options) => {
@@ -8188,7 +8188,7 @@ var objects = {};
8188
8188
 
8189
8189
  Object.defineProperty(objects, "__esModule", { value: true });
8190
8190
  objects.RecordParser = objects.ObjectParser = void 0;
8191
- const defs$6 = definitions$3;
8191
+ const defs$6 = definitions$4;
8192
8192
  const utils_1$1 = utils$3;
8193
8193
  const root$1 = root$4;
8194
8194
  objects.ObjectParser = (0, utils_1$1.createParser)(defs$6.CodecType.Object, (codec, options) => {
@@ -8220,7 +8220,7 @@ var arrays$1 = {};
8220
8220
 
8221
8221
  Object.defineProperty(arrays$1, "__esModule", { value: true });
8222
8222
  arrays$1.TupleParser = arrays$1.ArrayParser = void 0;
8223
- const defs$5 = definitions$3;
8223
+ const defs$5 = definitions$4;
8224
8224
  const utils_1 = utils$3;
8225
8225
  const root = root$4;
8226
8226
  arrays$1.ArrayParser = (0, utils_1.createParser)(defs$5.CodecType.Array, (codec, options) => {
@@ -8260,7 +8260,7 @@ arrays$1.TupleParser = (0, utils_1.createParser)(defs$5.CodecType.Tuple, (codec,
8260
8260
 
8261
8261
  Object.defineProperty(generator, "__esModule", { value: true });
8262
8262
  generator.generateJSONSchema = void 0;
8263
- const defs$4 = definitions$2;
8263
+ const defs$4 = definitions$3;
8264
8264
  const p = parsers;
8265
8265
  const generateJSONSchema = (codec, options) => {
8266
8266
  const parsers = [
@@ -8306,7 +8306,7 @@ generator.generateJSONSchema = generateJSONSchema;
8306
8306
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
8307
8307
  };
8308
8308
  Object.defineProperty(exports, "__esModule", { value: true });
8309
- __exportStar(definitions$2, exports);
8309
+ __exportStar(definitions$3, exports);
8310
8310
  __exportStar(generator, exports);
8311
8311
  __exportStar(parsers, exports);
8312
8312
  __exportStar(utils$3, exports);
@@ -8338,7 +8338,7 @@ var codec = {};
8338
8338
  (function (exports) {
8339
8339
  Object.defineProperty(exports, "__esModule", { value: true });
8340
8340
  exports.optional = exports.union = exports.createUnionTransformer = exports.intersection = exports.createIntersectionTransformer = exports.codec = void 0;
8341
- const defs = definitions$3;
8341
+ const defs = definitions$4;
8342
8342
  const utils = utils$2;
8343
8343
  const codec = (tag, encode, decode, props) => {
8344
8344
  const c = {
@@ -8449,7 +8449,7 @@ var codec = {};
8449
8449
 
8450
8450
  Object.defineProperty(maps$1, "__esModule", { value: true });
8451
8451
  maps$1.record = maps$1.object = void 0;
8452
- const defs$3 = definitions$3;
8452
+ const defs$3 = definitions$4;
8453
8453
  const utils$1 = utils$2;
8454
8454
  const codec_1$2 = codec;
8455
8455
  const objectAssertion = (data) => {
@@ -8496,7 +8496,7 @@ maps$1.record = record;
8496
8496
 
8497
8497
  Object.defineProperty(combinators, "__esModule", { value: true });
8498
8498
  combinators.partial = combinators.omit = void 0;
8499
- const defs$2 = definitions$3;
8499
+ const defs$2 = definitions$4;
8500
8500
  const maps = maps$1;
8501
8501
  const c = codec;
8502
8502
  const omit = (codec, mask) => {
@@ -8578,7 +8578,7 @@ var primitives = {};
8578
8578
  (function (exports) {
8579
8579
  Object.defineProperty(exports, "__esModule", { value: true });
8580
8580
  exports.Enum = exports.any = exports.Null = exports.literal = exports.number = exports.boolean = exports.string = exports.identityCodec = void 0;
8581
- const defs = definitions$3;
8581
+ const defs = definitions$4;
8582
8582
  const utils = utils$2;
8583
8583
  const codec_1 = codec;
8584
8584
  const identityCodec = (type) => {
@@ -8633,7 +8633,7 @@ var recursive$1 = {};
8633
8633
 
8634
8634
  Object.defineProperty(recursive$1, "__esModule", { value: true });
8635
8635
  recursive$1.recursive = void 0;
8636
- const defs$1 = definitions$3;
8636
+ const defs$1 = definitions$4;
8637
8637
  const codec_1$1 = codec;
8638
8638
  const recursive = (id, resolver) => {
8639
8639
  return (0, codec_1$1.codec)(defs$1.CodecType.Recursive, (data) => {
@@ -8653,7 +8653,7 @@ var arrays = {};
8653
8653
 
8654
8654
  Object.defineProperty(arrays, "__esModule", { value: true });
8655
8655
  arrays.tuple = arrays.array = void 0;
8656
- const defs = definitions$3;
8656
+ const defs = definitions$4;
8657
8657
  const utils = utils$2;
8658
8658
  const codec_1 = codec;
8659
8659
  const array = (type) => {
@@ -8703,7 +8703,7 @@ arrays.tuple = tuple;
8703
8703
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
8704
8704
  };
8705
8705
  Object.defineProperty(exports, "__esModule", { value: true });
8706
- __exportStar(definitions$3, exports);
8706
+ __exportStar(definitions$4, exports);
8707
8707
  __exportStar(jsonSchema, exports);
8708
8708
  __exportStar(combinators, exports);
8709
8709
  __exportStar(primitives, exports);
@@ -8712,7 +8712,7 @@ arrays.tuple = tuple;
8712
8712
  __exportStar(codec, exports);
8713
8713
  __exportStar(maps$1, exports);
8714
8714
  __exportStar(utils$2, exports);
8715
- } (dist));
8715
+ } (dist$1));
8716
8716
 
8717
8717
  (function (exports) {
8718
8718
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -8740,7 +8740,7 @@ arrays.tuple = tuple;
8740
8740
  };
8741
8741
  Object.defineProperty(exports, "__esModule", { value: true });
8742
8742
  exports.powerSyncHostedConfig = exports.jwks = exports.jwk = exports.jwkHmac = exports.jwkRSA = exports.anyConnection = exports.hostedDemoConnection = exports.hostedPostgresConnection = exports.isHostedSecretValue = exports.hostedSecret = exports.hostedSecretRef = exports.hostedSecretValue = void 0;
8743
- const t = __importStar(dist);
8743
+ const t = __importStar(dist$1);
8744
8744
  exports.hostedSecretValue = t.object({
8745
8745
  secret: t.string
8746
8746
  });
@@ -8862,7 +8862,7 @@ var PowerSyncConfig = {};
8862
8862
  };
8863
8863
  Object.defineProperty(exports, "__esModule", { value: true });
8864
8864
  exports.powerSyncConfig = exports.storageConfig = exports.strictJwks = exports.jwkHmac = exports.jwkRSA = exports.postgresConnection = void 0;
8865
- const t = __importStar(dist);
8865
+ const t = __importStar(dist$1);
8866
8866
  exports.postgresConnection = t.object({
8867
8867
  type: t.literal('postgresql'),
8868
8868
  /** Unique identifier for the connection - optional when a single connection is present. */
@@ -8960,9 +8960,9 @@ var PowerSyncConfig = {};
8960
8960
 
8961
8961
  } (PowerSyncConfig));
8962
8962
 
8963
- var routes = {};
8963
+ var routes$1 = {};
8964
8964
 
8965
- var definitions$1 = {};
8965
+ var definitions$2 = {};
8966
8966
 
8967
8967
  (function (exports) {
8968
8968
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -8990,7 +8990,7 @@ var definitions$1 = {};
8990
8990
  };
8991
8991
  Object.defineProperty(exports, "__esModule", { value: true });
8992
8992
  exports.InstanceSchema = exports.DatabaseSchema = exports.ConnectionStatus = exports.SyncRulesStatus = exports.TableInfo = exports.ReplicationError = exports.AppId = exports.InstanceId = void 0;
8993
- const t = __importStar(dist);
8993
+ const t = __importStar(dist$1);
8994
8994
  exports.InstanceId = t.object({
8995
8995
  org_id: t.string,
8996
8996
  app_id: t.string,
@@ -9087,7 +9087,7 @@ var definitions$1 = {};
9087
9087
  }))
9088
9088
  });
9089
9089
 
9090
- } (definitions$1));
9090
+ } (definitions$2));
9091
9091
 
9092
9092
  var internal_routes$1 = {};
9093
9093
 
@@ -9117,8 +9117,8 @@ var __importStar$3 = (commonjsGlobal && commonjsGlobal.__importStar) || function
9117
9117
  Object.defineProperty(internal_routes$1, "__esModule", { value: true });
9118
9118
  internal_routes$1.ValidateResponse = internal_routes$1.ValidateRequest = internal_routes$1.ReprocessResponse = internal_routes$1.ReprocessRequest = internal_routes$1.GetSchemaResponse = internal_routes$1.GetSchemaRequest = internal_routes$1.DiagnosticsResponse = internal_routes$1.DiagnosticsRequest = internal_routes$1.DemoCredentialsResponse = internal_routes$1.DemoCredentialsRequest = internal_routes$1.ExecuteSqlResponse = internal_routes$1.ExecuteSqlRequest = void 0;
9119
9119
  // Routes for management service -> instance
9120
- const t$1 = __importStar$3(dist);
9121
- const definitions_1$1 = definitions$1;
9120
+ const t$1 = __importStar$3(dist$1);
9121
+ const definitions_1$1 = definitions$2;
9122
9122
  internal_routes$1.ExecuteSqlRequest = t$1.object({
9123
9123
  connection_id: t$1.string.optional(),
9124
9124
  sql: t$1.object({
@@ -9207,18 +9207,18 @@ var __importStar$2 = (commonjsGlobal && commonjsGlobal.__importStar) || function
9207
9207
  __setModuleDefault$2(result, mod);
9208
9208
  return result;
9209
9209
  };
9210
- Object.defineProperty(routes, "__esModule", { value: true });
9211
- routes.ListRegionsResponse = routes.ListRegionsRequest = routes.InstanceDiagnosticsResponse = routes.InstanceDiagnosticsRequest = routes.ReprocessSyncRulesResponse = routes.ReprocessSyncRulesRequest = routes.ValidateSyncRulesResponse = routes.ValidateSyncRulesRequest = routes.ExecuteSqlResponse = routes.ExecuteSqlRequest = routes.GetSchemaResponse = routes.GetSchemaRequest = routes.TestPostgresConnectionResponse = routes.TestPostgresConnectionRequest = routes.DemoCredentialsResponse = routes.DemoCredentialsRequest = routes.DEV_ROUTES = routes.DeactivateInstanceResponse = routes.DeactivateInstanceRequest = routes.DestroyInstanceResponse = routes.DestroyInstanceRequest = routes.InstanceStatusResponse = routes.InstanceStatusRequest = routes.InstanceConfigResponse = routes.InstanceConfigRequest = routes.DeployInstanceResponse = routes.DeployInstanceRequest = routes.CreateInstanceResponse = routes.CreateInstanceRequest = routes.ListInstancesResponse = routes.ListInstancesRequest = routes.MANAGE_ROUTES = routes.GENERAL_ROUTES = void 0;
9212
- const t = __importStar$2(dist);
9210
+ Object.defineProperty(routes$1, "__esModule", { value: true });
9211
+ routes$1.ListRegionsResponse = routes$1.ListRegionsRequest = routes$1.InstanceDiagnosticsResponse = routes$1.InstanceDiagnosticsRequest = routes$1.ReprocessSyncRulesResponse = routes$1.ReprocessSyncRulesRequest = routes$1.ValidateSyncRulesResponse = routes$1.ValidateSyncRulesRequest = routes$1.ExecuteSqlResponse = routes$1.ExecuteSqlRequest = routes$1.GetSchemaResponse = routes$1.GetSchemaRequest = routes$1.TestPostgresConnectionResponse = routes$1.TestPostgresConnectionRequest = routes$1.DemoCredentialsResponse = routes$1.DemoCredentialsRequest = routes$1.DEV_ROUTES = routes$1.DeactivateInstanceResponse = routes$1.DeactivateInstanceRequest = routes$1.DestroyInstanceResponse = routes$1.DestroyInstanceRequest = routes$1.InstanceStatusResponse = routes$1.InstanceStatusRequest = routes$1.InstanceConfigResponse = routes$1.InstanceConfigRequest = routes$1.DeployInstanceResponse = routes$1.DeployInstanceRequest = routes$1.CreateInstanceResponse = routes$1.CreateInstanceRequest = routes$1.ListInstancesResponse = routes$1.ListInstancesRequest = routes$1.MANAGE_ROUTES = routes$1.GENERAL_ROUTES = void 0;
9212
+ const t = __importStar$2(dist$1);
9213
9213
  const HostedConfig_1 = HostedConfig;
9214
- const definitions_1 = definitions$1;
9214
+ const definitions_1 = definitions$2;
9215
9215
  const internal_routes = __importStar$2(internal_routes$1);
9216
9216
  // Manage instances
9217
9217
  var GENERAL_ROUTES;
9218
9218
  (function (GENERAL_ROUTES) {
9219
9219
  /** GET */
9220
9220
  GENERAL_ROUTES["LIST_REGIONS"] = "/api/v1/regions";
9221
- })(GENERAL_ROUTES || (routes.GENERAL_ROUTES = GENERAL_ROUTES = {}));
9221
+ })(GENERAL_ROUTES || (routes$1.GENERAL_ROUTES = GENERAL_ROUTES = {}));
9222
9222
  var MANAGE_ROUTES;
9223
9223
  (function (MANAGE_ROUTES) {
9224
9224
  MANAGE_ROUTES["LIST"] = "/api/v1/instances/list";
@@ -9229,40 +9229,40 @@ var MANAGE_ROUTES;
9229
9229
  MANAGE_ROUTES["CONFIG"] = "/api/v1/instances/config";
9230
9230
  MANAGE_ROUTES["STATUS"] = "/api/v1/instances/status";
9231
9231
  MANAGE_ROUTES["DIAGNOSTICS"] = "/api/v1/instances/diagnostics";
9232
- })(MANAGE_ROUTES || (routes.MANAGE_ROUTES = MANAGE_ROUTES = {}));
9232
+ })(MANAGE_ROUTES || (routes$1.MANAGE_ROUTES = MANAGE_ROUTES = {}));
9233
9233
  // POST /api/v1/instances/list
9234
- routes.ListInstancesRequest = t.object({
9234
+ routes$1.ListInstancesRequest = t.object({
9235
9235
  org_id: t.string,
9236
9236
  app_id: t.string
9237
9237
  });
9238
- routes.ListInstancesResponse = t.object({
9238
+ routes$1.ListInstancesResponse = t.object({
9239
9239
  instances: t.array(t.object({
9240
9240
  id: t.string,
9241
9241
  name: t.string
9242
9242
  }))
9243
9243
  });
9244
9244
  // POST /api/v1/instances/create
9245
- routes.CreateInstanceRequest = t.object({
9245
+ routes$1.CreateInstanceRequest = t.object({
9246
9246
  org_id: t.string,
9247
9247
  app_id: t.string,
9248
9248
  name: t.string
9249
9249
  });
9250
- routes.CreateInstanceResponse = t.object({
9250
+ routes$1.CreateInstanceResponse = t.object({
9251
9251
  id: t.string
9252
9252
  });
9253
9253
  // POST /api/instances/deploy
9254
- routes.DeployInstanceRequest = definitions_1.InstanceId.and(t.object({
9254
+ routes$1.DeployInstanceRequest = definitions_1.InstanceId.and(t.object({
9255
9255
  name: t.string.optional(),
9256
9256
  config: HostedConfig_1.powerSyncHostedConfig,
9257
9257
  sync_rules: t.string.optional()
9258
9258
  }));
9259
- routes.DeployInstanceResponse = t.object({
9259
+ routes$1.DeployInstanceResponse = t.object({
9260
9260
  id: t.string,
9261
9261
  operation_id: t.string
9262
9262
  });
9263
9263
  // POST /api/v1/instances/config
9264
- routes.InstanceConfigRequest = definitions_1.InstanceId;
9265
- routes.InstanceConfigResponse = t.object({
9264
+ routes$1.InstanceConfigRequest = definitions_1.InstanceId;
9265
+ routes$1.InstanceConfigResponse = t.object({
9266
9266
  id: t.string,
9267
9267
  name: t.string,
9268
9268
  config: HostedConfig_1.powerSyncHostedConfig.optional(),
@@ -9271,8 +9271,8 @@ routes.InstanceConfigResponse = t.object({
9271
9271
  // POST /api/v1/instances/status
9272
9272
  // Get provisioning status. Once provisioned, other requests can be used for additional
9273
9273
  // diagnostics.
9274
- routes.InstanceStatusRequest = definitions_1.InstanceId;
9275
- routes.InstanceStatusResponse = t.object({
9274
+ routes$1.InstanceStatusRequest = definitions_1.InstanceId;
9275
+ routes$1.InstanceStatusResponse = t.object({
9276
9276
  id: t.string,
9277
9277
  /** True if provisioned at least once, and should therefore be running. */
9278
9278
  provisioned: t.boolean,
@@ -9287,14 +9287,14 @@ routes.InstanceStatusResponse = t.object({
9287
9287
  instance_url: t.string.optional()
9288
9288
  });
9289
9289
  // POST /api/v1/instances/destroy
9290
- routes.DestroyInstanceRequest = definitions_1.InstanceId;
9291
- routes.DestroyInstanceResponse = t.object({
9290
+ routes$1.DestroyInstanceRequest = definitions_1.InstanceId;
9291
+ routes$1.DestroyInstanceResponse = t.object({
9292
9292
  id: t.string,
9293
9293
  operation_id: t.string.optional()
9294
9294
  });
9295
9295
  // POST /api/v1/instances/deactivate
9296
- routes.DeactivateInstanceRequest = definitions_1.InstanceId;
9297
- routes.DeactivateInstanceResponse = t.object({
9296
+ routes$1.DeactivateInstanceRequest = definitions_1.InstanceId;
9297
+ routes$1.DeactivateInstanceResponse = t.object({
9298
9298
  id: t.string,
9299
9299
  operation_id: t.string.optional()
9300
9300
  });
@@ -9307,20 +9307,20 @@ var DEV_ROUTES;
9307
9307
  DEV_ROUTES["REPROCESS_SYNC_RULES"] = "/api/v1/instances/dev/reprocess-sync-rules";
9308
9308
  DEV_ROUTES["TEST_CONNECTION"] = "/api/v1/connections/test";
9309
9309
  DEV_ROUTES["DEMO_CREDENTIALS"] = "/api/v1/instances/demo-credentials";
9310
- })(DEV_ROUTES || (routes.DEV_ROUTES = DEV_ROUTES = {}));
9310
+ })(DEV_ROUTES || (routes$1.DEV_ROUTES = DEV_ROUTES = {}));
9311
9311
  // POST /api/v1/instances/demo-credentials
9312
9312
  // Get demo credentials if available.
9313
- routes.DemoCredentialsRequest = definitions_1.InstanceId.and(internal_routes.DemoCredentialsRequest);
9314
- routes.DemoCredentialsResponse = internal_routes.DemoCredentialsResponse;
9313
+ routes$1.DemoCredentialsRequest = definitions_1.InstanceId.and(internal_routes.DemoCredentialsRequest);
9314
+ routes$1.DemoCredentialsResponse = internal_routes.DemoCredentialsResponse;
9315
9315
  // POST /api/v1/connections/test
9316
9316
  // Test a connection without deploying
9317
- routes.TestPostgresConnectionRequest = t.object({
9317
+ routes$1.TestPostgresConnectionRequest = t.object({
9318
9318
  org_id: t.string,
9319
9319
  app_id: t.string,
9320
9320
  id: t.string.optional(),
9321
9321
  connection: HostedConfig_1.hostedPostgresConnection
9322
9322
  });
9323
- routes.TestPostgresConnectionResponse = t.object({
9323
+ routes$1.TestPostgresConnectionResponse = t.object({
9324
9324
  /** If false, check the fields below. */
9325
9325
  success: t.boolean,
9326
9326
  connection: t.object({
@@ -9363,34 +9363,34 @@ routes.TestPostgresConnectionResponse = t.object({
9363
9363
  });
9364
9364
  // POST /api/instances/dev/schema
9365
9365
  // Only works if the instance is already provisioned.
9366
- routes.GetSchemaRequest = definitions_1.InstanceId;
9367
- routes.GetSchemaResponse = internal_routes.GetSchemaResponse;
9366
+ routes$1.GetSchemaRequest = definitions_1.InstanceId;
9367
+ routes$1.GetSchemaResponse = internal_routes.GetSchemaResponse;
9368
9368
  // POST /api/v1/instances/dev/execute-sql
9369
9369
  // Only works if the instance is already provisioned.
9370
- routes.ExecuteSqlRequest = definitions_1.InstanceId.and(internal_routes.ExecuteSqlRequest);
9371
- routes.ExecuteSqlResponse = internal_routes.ExecuteSqlResponse;
9370
+ routes$1.ExecuteSqlRequest = definitions_1.InstanceId.and(internal_routes.ExecuteSqlRequest);
9371
+ routes$1.ExecuteSqlResponse = internal_routes.ExecuteSqlResponse;
9372
9372
  // POST /api/v1/instances/dev/validate-sync-rules
9373
9373
  // Only works if the instance is already provisioned.
9374
- routes.ValidateSyncRulesRequest = definitions_1.InstanceId.and(internal_routes.ValidateRequest);
9375
- routes.ValidateSyncRulesResponse = internal_routes.ValidateResponse;
9374
+ routes$1.ValidateSyncRulesRequest = definitions_1.InstanceId.and(internal_routes.ValidateRequest);
9375
+ routes$1.ValidateSyncRulesResponse = internal_routes.ValidateResponse;
9376
9376
  // POST /api/v1/instances/dev/reprocess-sync-rules
9377
9377
  // Only works if the instance is already provisioned.
9378
- routes.ReprocessSyncRulesRequest = definitions_1.InstanceId.and(internal_routes.ReprocessRequest);
9379
- routes.ReprocessSyncRulesResponse = internal_routes.ReprocessResponse;
9378
+ routes$1.ReprocessSyncRulesRequest = definitions_1.InstanceId.and(internal_routes.ReprocessRequest);
9379
+ routes$1.ReprocessSyncRulesResponse = internal_routes.ReprocessResponse;
9380
9380
  // POST /api/v1/instances/diagnostics
9381
9381
  // Get instance diagnostics once provisioned.
9382
- routes.InstanceDiagnosticsRequest = definitions_1.InstanceId.and(internal_routes.DiagnosticsRequest);
9383
- routes.InstanceDiagnosticsResponse = internal_routes.DiagnosticsResponse;
9382
+ routes$1.InstanceDiagnosticsRequest = definitions_1.InstanceId.and(internal_routes.DiagnosticsRequest);
9383
+ routes$1.InstanceDiagnosticsResponse = internal_routes.DiagnosticsResponse;
9384
9384
  // GET /api/v1/regions
9385
9385
  // Returns list of regions to whitelist on the database.
9386
- routes.ListRegionsRequest = t.object({});
9386
+ routes$1.ListRegionsRequest = t.object({});
9387
9387
  /**
9388
9388
  * For IP whitelisting, we recommend just including IPs from all regions.
9389
9389
  *
9390
9390
  * An additional "dev" region is included, with IPs used for development purposes,
9391
9391
  * e.g. "test connection".
9392
9392
  */
9393
- routes.ListRegionsResponse = t.object({
9393
+ routes$1.ListRegionsResponse = t.object({
9394
9394
  regions: t.array(t.object({
9395
9395
  name: t.string,
9396
9396
  /** false for "dev" region */
@@ -10952,15 +10952,15 @@ normalize.baseUri = baseUri;
10952
10952
  exports.isHostedSecretValue = exports.powerSyncHostedConfig = exports.internal_routes = exports.routes = exports.configFile = exports.hostedConfig = void 0;
10953
10953
  exports.hostedConfig = __importStar(HostedConfig);
10954
10954
  exports.configFile = __importStar(PowerSyncConfig);
10955
- exports.routes = __importStar(routes);
10955
+ exports.routes = __importStar(routes$1);
10956
10956
  exports.internal_routes = __importStar(internal_routes$1);
10957
10957
  var HostedConfig_js_1 = HostedConfig;
10958
10958
  Object.defineProperty(exports, "powerSyncHostedConfig", { enumerable: true, get: function () { return HostedConfig_js_1.powerSyncHostedConfig; } });
10959
10959
  Object.defineProperty(exports, "isHostedSecretValue", { enumerable: true, get: function () { return HostedConfig_js_1.isHostedSecretValue; } });
10960
- __exportStar(definitions$1, exports);
10960
+ __exportStar(definitions$2, exports);
10961
10961
  __exportStar(normalize, exports);
10962
10962
 
10963
- } (dist$1));
10963
+ } (dist$2));
10964
10964
 
10965
10965
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10966
10966
  if (k2 === undefined) k2 = k;
@@ -10985,10 +10985,10 @@ var __importStar = (commonjsGlobal && commonjsGlobal.__importStar) || function (
10985
10985
  __setModuleDefault(result, mod);
10986
10986
  return result;
10987
10987
  };
10988
- Object.defineProperty(dist$2, "__esModule", { value: true });
10989
- var Client_1 = dist$2.Client = void 0;
10990
- const powersync_types_1 = dist$1;
10991
- const sdk = __importStar(dist$4);
10988
+ Object.defineProperty(dist$3, "__esModule", { value: true });
10989
+ var Client_1 = dist$3.Client = void 0;
10990
+ const powersync_types_1 = dist$2;
10991
+ const sdk = __importStar(dist$5);
10992
10992
  const dev = powersync_types_1.routes.DEV_ROUTES;
10993
10993
  const manage = powersync_types_1.routes.MANAGE_ROUTES;
10994
10994
  const general = powersync_types_1.routes.GENERAL_ROUTES;
@@ -11043,16 +11043,16 @@ class Client extends sdk.SDKClient {
11043
11043
  });
11044
11044
  }
11045
11045
  }
11046
- Client_1 = dist$2.Client = Client;
11046
+ Client_1 = dist$3.Client = Client;
11047
11047
 
11048
11048
  var main$1 = {exports: {}};
11049
11049
 
11050
- var name = "dotenv";
11051
- var version$1 = "16.4.1";
11052
- var description$1 = "Loads environment variables from .env file";
11050
+ var name$1 = "dotenv";
11051
+ var version$2 = "16.4.4";
11052
+ var description$2 = "Loads environment variables from .env file";
11053
11053
  var main = "lib/main.js";
11054
- var types$2 = "lib/main.d.ts";
11055
- var exports = {
11054
+ var types$3 = "lib/main.d.ts";
11055
+ var exports$1 = {
11056
11056
  ".": {
11057
11057
  types: "./lib/main.d.ts",
11058
11058
  require: "./lib/main.js",
@@ -11066,20 +11066,21 @@ var exports = {
11066
11066
  "./lib/cli-options.js": "./lib/cli-options.js",
11067
11067
  "./package.json": "./package.json"
11068
11068
  };
11069
- var scripts = {
11069
+ var scripts$1 = {
11070
11070
  "dts-check": "tsc --project tests/types/tsconfig.json",
11071
11071
  lint: "standard",
11072
11072
  "lint-readme": "standard-markdown",
11073
11073
  pretest: "npm run lint && npm run dts-check",
11074
11074
  test: "tap tests/*.js --100 -Rspec",
11075
+ "test:coverage": "tap --coverage-report=lcov",
11075
11076
  prerelease: "npm test",
11076
11077
  release: "standard-version"
11077
11078
  };
11078
- var repository = {
11079
+ var repository$1 = {
11079
11080
  type: "git",
11080
11081
  url: "git://github.com/motdotla/dotenv.git"
11081
11082
  };
11082
- var funding = "https://github.com/motdotla/dotenv?sponsor=1";
11083
+ var funding = "https://dotenvx.com";
11083
11084
  var keywords = [
11084
11085
  "dotenv",
11085
11086
  "env",
@@ -11090,8 +11091,8 @@ var keywords = [
11090
11091
  "settings"
11091
11092
  ];
11092
11093
  var readmeFilename = "README.md";
11093
- var license = "BSD-2-Clause";
11094
- var devDependencies = {
11094
+ var license$1 = "BSD-2-Clause";
11095
+ var devDependencies$1 = {
11095
11096
  "@definitelytyped/dtslint": "^0.0.133",
11096
11097
  "@types/node": "^18.11.3",
11097
11098
  decache: "^4.6.1",
@@ -11103,27 +11104,27 @@ var devDependencies = {
11103
11104
  tar: "^6.1.11",
11104
11105
  typescript: "^4.8.4"
11105
11106
  };
11106
- var engines = {
11107
+ var engines$1 = {
11107
11108
  node: ">=12"
11108
11109
  };
11109
11110
  var browser = {
11110
11111
  fs: false
11111
11112
  };
11112
11113
  var require$$4 = {
11113
- name: name,
11114
- version: version$1,
11115
- description: description$1,
11114
+ name: name$1,
11115
+ version: version$2,
11116
+ description: description$2,
11116
11117
  main: main,
11117
- types: types$2,
11118
- exports: exports,
11119
- scripts: scripts,
11120
- repository: repository,
11118
+ types: types$3,
11119
+ exports: exports$1,
11120
+ scripts: scripts$1,
11121
+ repository: repository$1,
11121
11122
  funding: funding,
11122
11123
  keywords: keywords,
11123
11124
  readmeFilename: readmeFilename,
11124
- license: license,
11125
- devDependencies: devDependencies,
11126
- engines: engines,
11125
+ license: license$1,
11126
+ devDependencies: devDependencies$1,
11127
+ engines: engines$1,
11127
11128
  browser: browser
11128
11129
  };
11129
11130
 
@@ -11133,7 +11134,7 @@ const os = require$$2;
11133
11134
  const crypto = require$$3$1;
11134
11135
  const packageJson = require$$4;
11135
11136
 
11136
- const version = packageJson.version;
11137
+ const version$1 = packageJson.version;
11137
11138
 
11138
11139
  const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;
11139
11140
 
@@ -11188,7 +11189,7 @@ function _parseVault (options) {
11188
11189
  }
11189
11190
 
11190
11191
  // handle scenario for comma separated keys - for use with key rotation
11191
- // example: DOTENV_KEY="dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenv.org/vault/.env.vault?environment=prod"
11192
+ // example: DOTENV_KEY="dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=prod,dotenv://:key_7890@dotenvx.com/vault/.env.vault?environment=prod"
11192
11193
  const keys = _dotenvKey(options).split(',');
11193
11194
  const length = keys.length;
11194
11195
 
@@ -11219,15 +11220,15 @@ function _parseVault (options) {
11219
11220
  }
11220
11221
 
11221
11222
  function _log (message) {
11222
- console.log(`[dotenv@${version}][INFO] ${message}`);
11223
+ console.log(`[dotenv@${version$1}][INFO] ${message}`);
11223
11224
  }
11224
11225
 
11225
11226
  function _warn (message) {
11226
- console.log(`[dotenv@${version}][WARN] ${message}`);
11227
+ console.log(`[dotenv@${version$1}][WARN] ${message}`);
11227
11228
  }
11228
11229
 
11229
11230
  function _debug (message) {
11230
- console.log(`[dotenv@${version}][DEBUG] ${message}`);
11231
+ console.log(`[dotenv@${version$1}][DEBUG] ${message}`);
11231
11232
  }
11232
11233
 
11233
11234
  function _dotenvKey (options) {
@@ -11252,7 +11253,7 @@ function _instructions (result, dotenvKey) {
11252
11253
  uri = new URL(dotenvKey);
11253
11254
  } catch (error) {
11254
11255
  if (error.code === 'ERR_INVALID_URL') {
11255
- const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenv.org/vault/.env.vault?environment=development');
11256
+ const err = new Error('INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development');
11256
11257
  err.code = 'INVALID_DOTENV_KEY';
11257
11258
  throw err
11258
11259
  }
@@ -11332,37 +11333,50 @@ function _configVault (options) {
11332
11333
  }
11333
11334
 
11334
11335
  function configDotenv (options) {
11335
- let dotenvPath = path.resolve(process.cwd(), '.env');
11336
+ const dotenvPath = path.resolve(process.cwd(), '.env');
11336
11337
  let encoding = 'utf8';
11337
11338
  const debug = Boolean(options && options.debug);
11338
11339
 
11339
- if (options) {
11340
- if (options.path != null) {
11341
- let envPath = options.path;
11340
+ if (options && options.encoding) {
11341
+ encoding = options.encoding;
11342
+ } else {
11343
+ if (debug) {
11344
+ _debug('No encoding is specified. UTF-8 is used by default');
11345
+ }
11346
+ }
11342
11347
 
11343
- if (Array.isArray(envPath)) {
11344
- for (const filepath of options.path) {
11345
- if (fs.existsSync(filepath)) {
11346
- envPath = filepath;
11347
- break
11348
- }
11349
- }
11348
+ let optionPathsThatExist = [];
11349
+ if (options && options.path) {
11350
+ if (!Array.isArray(options.path)) {
11351
+ if (fs.existsSync(options.path)) {
11352
+ optionPathsThatExist = [_resolveHome(options.path)];
11350
11353
  }
11351
-
11352
- dotenvPath = _resolveHome(envPath);
11353
- }
11354
- if (options.encoding != null) {
11355
- encoding = options.encoding;
11356
11354
  } else {
11357
- if (debug) {
11358
- _debug('No encoding is specified. UTF-8 is used by default');
11355
+ for (const filepath of options.path) {
11356
+ if (fs.existsSync(filepath)) {
11357
+ optionPathsThatExist.push(_resolveHome(filepath));
11358
+ }
11359
11359
  }
11360
11360
  }
11361
+
11362
+ if (!optionPathsThatExist.length) {
11363
+ optionPathsThatExist = [dotenvPath];
11364
+ }
11361
11365
  }
11362
11366
 
11367
+ // If we have options.path, and it had valid paths, use them. Else fall back to .env
11368
+ const pathsToProcess = optionPathsThatExist.length ? optionPathsThatExist : [dotenvPath];
11369
+
11370
+ // Build the parsed data in a temporary object (because we need to return it). Once we have the final
11371
+ // parsed data, we will combine it with process.env (or options.processEnv if provided).
11372
+
11373
+ const parsed = {};
11363
11374
  try {
11364
- // Specifying an encoding returns a string instead of a buffer
11365
- const parsed = DotenvModule.parse(fs.readFileSync(dotenvPath, { encoding }));
11375
+ for (const path of pathsToProcess) {
11376
+ // Specifying an encoding returns a string instead of a buffer
11377
+ const singleFileParsed = DotenvModule.parse(fs.readFileSync(path, { encoding }));
11378
+ DotenvModule.populate(parsed, singleFileParsed, options);
11379
+ }
11366
11380
 
11367
11381
  let processEnv = process.env;
11368
11382
  if (options && options.processEnv != null) {
@@ -11370,15 +11384,13 @@ function configDotenv (options) {
11370
11384
  }
11371
11385
 
11372
11386
  DotenvModule.populate(processEnv, parsed, options);
11373
-
11374
- return { parsed }
11375
11387
  } catch (e) {
11376
11388
  if (debug) {
11377
- _debug(`Failed to load ${dotenvPath} ${e.message}`);
11389
+ _debug(`Failed to load ${pathsToProcess} ${e.message}`);
11378
11390
  }
11379
-
11380
11391
  return { error: e }
11381
11392
  }
11393
+ return { parsed }
11382
11394
  }
11383
11395
 
11384
11396
  // Populates process.env from .env file
@@ -11489,11 +11501,280 @@ const ENDPOINTS = {
11489
11501
  POWERSYNC_URL: "https://powersync-api.journeyapps.com"
11490
11502
  };
11491
11503
 
11492
- const generateHeader = (bearerToken) => ({
11493
- Accept: "application/json",
11494
- Authorization: `Bearer ${bearerToken}`,
11495
- ContentType: "application/json"
11496
- });
11504
+ var dist = {};
11505
+
11506
+ var definitions$1 = {};
11507
+
11508
+ var signupActions = {};
11509
+
11510
+ Object.defineProperty(signupActions, "__esModule", { value: true });
11511
+ signupActions.SignupActionSource = void 0;
11512
+ var SignupActionSource;
11513
+ (function (SignupActionSource) {
11514
+ SignupActionSource["CLICK"] = "click";
11515
+ SignupActionSource["INPUT"] = "input";
11516
+ SignupActionSource["KEYPRESS"] = "keypress";
11517
+ SignupActionSource["SYSTEM"] = "system";
11518
+ })(SignupActionSource || (signupActions.SignupActionSource = SignupActionSource = {}));
11519
+
11520
+ var userActions = {};
11521
+
11522
+ Object.defineProperty(userActions, "__esModule", { value: true });
11523
+ userActions.ACTION_STATUS = void 0;
11524
+ var ACTION_STATUS;
11525
+ (function (ACTION_STATUS) {
11526
+ ACTION_STATUS["SUCCESS"] = "SUCCESS";
11527
+ ACTION_STATUS["FAILURE"] = "FAILURE";
11528
+ })(ACTION_STATUS || (userActions.ACTION_STATUS = ACTION_STATUS = {}));
11529
+
11530
+ var serviceActions = {};
11531
+
11532
+ Object.defineProperty(serviceActions, "__esModule", { value: true });
11533
+ serviceActions.UserActionSource = void 0;
11534
+ /**
11535
+ * The source application that triggered the service user action
11536
+ */
11537
+ var UserActionSource;
11538
+ (function (UserActionSource) {
11539
+ UserActionSource["POWERSYNC_CLI"] = "POWERSYNC_CLI";
11540
+ })(UserActionSource || (serviceActions.UserActionSource = UserActionSource = {}));
11541
+
11542
+ var generics = {};
11543
+
11544
+ Object.defineProperty(generics, "__esModule", { value: true });
11545
+
11546
+ var events = {};
11547
+
11548
+ Object.defineProperty(events, "__esModule", { value: true });
11549
+ events.FLIGHT_LOG_EVENT = events.FLIGHT_LOG_EVENT_VERSION = void 0;
11550
+ var FLIGHT_LOG_EVENT_VERSION;
11551
+ (function (FLIGHT_LOG_EVENT_VERSION) {
11552
+ FLIGHT_LOG_EVENT_VERSION["V1"] = "V1";
11553
+ })(FLIGHT_LOG_EVENT_VERSION || (events.FLIGHT_LOG_EVENT_VERSION = FLIGHT_LOG_EVENT_VERSION = {}));
11554
+ var FLIGHT_LOG_EVENT;
11555
+ (function (FLIGHT_LOG_EVENT) {
11556
+ FLIGHT_LOG_EVENT["USER_ACTION"] = "USER_METRICS.ACTION";
11557
+ FLIGHT_LOG_EVENT["SIGNUP_ACTION"] = "USER_METRICS.SIGNUP_ACTION";
11558
+ FLIGHT_LOG_EVENT["SERVICE_ACTION"] = "USER_METRICS.SERVICE_ACTION";
11559
+ })(FLIGHT_LOG_EVENT || (events.FLIGHT_LOG_EVENT = FLIGHT_LOG_EVENT = {}));
11560
+
11561
+ var routes = {};
11562
+
11563
+ Object.defineProperty(routes, "__esModule", { value: true });
11564
+ routes.Routes = void 0;
11565
+ var Routes;
11566
+ (function (Routes) {
11567
+ Routes["LOG_ACTIONS"] = "/api/v1/collection/log-actions";
11568
+ Routes["LOG_SIGNUP_ACTIONS"] = "/api/v1/collection/log-signup-actions";
11569
+ Routes["LOG_SERVICE_USER_ACTIONS"] = "/api/v1/collection/log-service-user-actions";
11570
+ })(Routes || (routes.Routes = Routes = {}));
11571
+
11572
+ var headers = {};
11573
+
11574
+ Object.defineProperty(headers, "__esModule", { value: true });
11575
+ headers.MetricSourceVersionHeader = headers.MetricSourceHeader = void 0;
11576
+ // Note these are lowercase since https headers are converted to lowercase anyway
11577
+ headers.MetricSourceHeader = 'x-journey-metric-source';
11578
+ headers.MetricSourceVersionHeader = 'x-journey-metric-source-version';
11579
+
11580
+ (function (exports) {
11581
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11582
+ if (k2 === undefined) k2 = k;
11583
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11584
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11585
+ desc = { enumerable: true, get: function() { return m[k]; } };
11586
+ }
11587
+ Object.defineProperty(o, k2, desc);
11588
+ }) : (function(o, m, k, k2) {
11589
+ if (k2 === undefined) k2 = k;
11590
+ o[k2] = m[k];
11591
+ }));
11592
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
11593
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11594
+ };
11595
+ Object.defineProperty(exports, "__esModule", { value: true });
11596
+ __exportStar(signupActions, exports);
11597
+ __exportStar(userActions, exports);
11598
+ __exportStar(serviceActions, exports);
11599
+ __exportStar(generics, exports);
11600
+ __exportStar(events, exports);
11601
+ __exportStar(routes, exports);
11602
+ __exportStar(headers, exports);
11603
+ } (definitions$1));
11604
+
11605
+ var v1 = {};
11606
+
11607
+ Object.defineProperty(v1, "__esModule", { value: true });
11608
+
11609
+ var kafka = {};
11610
+
11611
+ Object.defineProperty(kafka, "__esModule", { value: true });
11612
+ kafka.KAFKA_TOPIC = void 0;
11613
+ var KAFKA_TOPIC;
11614
+ (function (KAFKA_TOPIC) {
11615
+ KAFKA_TOPIC["USER_METRICS"] = "user-metrics";
11616
+ })(KAFKA_TOPIC || (kafka.KAFKA_TOPIC = KAFKA_TOPIC = {}));
11617
+
11618
+ (function (exports) {
11619
+ var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11620
+ if (k2 === undefined) k2 = k;
11621
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11622
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11623
+ desc = { enumerable: true, get: function() { return m[k]; } };
11624
+ }
11625
+ Object.defineProperty(o, k2, desc);
11626
+ }) : (function(o, m, k, k2) {
11627
+ if (k2 === undefined) k2 = k;
11628
+ o[k2] = m[k];
11629
+ }));
11630
+ var __exportStar = (commonjsGlobal && commonjsGlobal.__exportStar) || function(m, exports) {
11631
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11632
+ };
11633
+ Object.defineProperty(exports, "__esModule", { value: true });
11634
+ __exportStar(definitions$1, exports);
11635
+ __exportStar(v1, exports);
11636
+ __exportStar(kafka, exports);
11637
+ } (dist));
11638
+
11639
+ var author = "JourneyApps";
11640
+ var bin = {
11641
+ cli: "./bin/run.js"
11642
+ };
11643
+ var publishConfig = {
11644
+ registry: "https://registry.npmjs.org/",
11645
+ access: "public"
11646
+ };
11647
+ var description$1 = "PowerSync CLI";
11648
+ var engines = {
11649
+ node: ">=20.0.0"
11650
+ };
11651
+ var files = [
11652
+ "/bin",
11653
+ "/dist",
11654
+ "/oclif.manifest.json"
11655
+ ];
11656
+ var version = "0.2.3";
11657
+ var bugs = "https://github.com/powersync-ja/cli/issues";
11658
+ var types$2 = "dist/index.d.ts";
11659
+ var exports = "./lib/index.js";
11660
+ var type$2 = "module";
11661
+ var homepage = "https://github.com/powersync-ja/cli";
11662
+ var license = "UNLICENSED";
11663
+ var name = "powersync";
11664
+ var oclif = {
11665
+ bin: "powersync",
11666
+ dirname: "powersync",
11667
+ commands: "./dist/commands",
11668
+ plugins: [
11669
+ "@oclif/plugin-help",
11670
+ "@oclif/plugin-not-found",
11671
+ "@oclif/plugin-warn-if-update-available"
11672
+ ],
11673
+ topics: {
11674
+ "instance:sync-rules": {
11675
+ description: "run \"powersync instance sync-rules\" to see a list of subcommands"
11676
+ },
11677
+ instance: {
11678
+ description: "run \"powersync instance\" to see a list of subcommands"
11679
+ }
11680
+ },
11681
+ topicSeparator: " "
11682
+ };
11683
+ var repository = "powersync-ja/cli";
11684
+ var scripts = {
11685
+ build: "pnpm build:oclif-commands && pnpm bundle:powersync-deps && ./combine-bundle-and-build.sh && pnpm readme",
11686
+ "build:oclif-commands": "shx rm -rf dist && tsc -b",
11687
+ "bundle:powersync-deps": "shx rm -rf lib && rollup -c rollup.config.mjs",
11688
+ lint: "eslint . --ext .ts",
11689
+ postpack: "shx rm -f oclif.manifest.json",
11690
+ posttest: "pnpm run lint",
11691
+ prepack: "pnpm run build && oclif manifest && oclif readme",
11692
+ readme: "oclif readme",
11693
+ prepare: "pnpm run build",
11694
+ test: "vitest",
11695
+ release: "pnpm build && pnpm changeset publish",
11696
+ prettier: "prettier --write .",
11697
+ version: "oclif readme && git add README.md",
11698
+ "pack:tarballs": "oclif pack tarballs --parallel"
11699
+ };
11700
+ var dependencies$1 = {
11701
+ "@oclif/core": "^3.19.2",
11702
+ "@oclif/plugin-help": "^6.0.13",
11703
+ "@oclif/plugin-not-found": "^3.0.10",
11704
+ "@oclif/plugin-warn-if-update-available": "^3.0.11",
11705
+ "@rollup/plugin-typescript": "^11.1.6",
11706
+ dotenv: "^16.4.4",
11707
+ inquirer: "^9.2.14",
11708
+ ora: "^8.0.1"
11709
+ };
11710
+ var devDependencies = {
11711
+ "@changesets/cli": "^2.27.1",
11712
+ "@journeyapps-platform/powersync-sync-rules": "^0.16.7",
11713
+ "@journeyapps-platform/powersync-types": "^0.16.7",
11714
+ "@journeyapps-platform/sdk-accounts-hub": "^5.1.0",
11715
+ "@journeyapps-platform/sdk-common": "^5.5.0",
11716
+ "@journeyapps-platform/sdk-powersync": "^0.16.7",
11717
+ "@journeyapps-platform/types-accounts-hub": "^5.1.0",
11718
+ "@journeyapps-platform/types-flight-log": "^0.3.0",
11719
+ "@rollup/plugin-commonjs": "^25.0.7",
11720
+ "@rollup/plugin-json": "^6.1.0",
11721
+ "@rollup/plugin-node-resolve": "^15.2.3",
11722
+ "@types/inquirer": "^9.0.7",
11723
+ "@types/node": "^20.11.19",
11724
+ esbuild: "^0.20.1",
11725
+ eslint: "^8.56.0",
11726
+ "eslint-config-oclif": "^5",
11727
+ "eslint-config-oclif-typescript": "^3.0.48",
11728
+ "eslint-config-prettier": "^9.1.0",
11729
+ "eslint-plugin-prettier": "^5.1.3",
11730
+ glob: "^10.3.10",
11731
+ oclif: "^4.4.16",
11732
+ prettier: "^3.2.5",
11733
+ rollup: "^4.12.0",
11734
+ "rollup-plugin-esbuild": "^6.1.1",
11735
+ shx: "^0.3.4",
11736
+ "strip-ansi": "^7.1.0",
11737
+ "ts-node": "^10.9.2",
11738
+ typescript: "^5.3.3",
11739
+ vitest: "^1.3.0"
11740
+ };
11741
+ var packageJSON = {
11742
+ author: author,
11743
+ bin: bin,
11744
+ publishConfig: publishConfig,
11745
+ description: description$1,
11746
+ engines: engines,
11747
+ files: files,
11748
+ version: version,
11749
+ bugs: bugs,
11750
+ types: types$2,
11751
+ exports: exports,
11752
+ type: type$2,
11753
+ homepage: homepage,
11754
+ license: license,
11755
+ name: name,
11756
+ oclif: oclif,
11757
+ repository: repository,
11758
+ scripts: scripts,
11759
+ dependencies: dependencies$1,
11760
+ devDependencies: devDependencies
11761
+ };
11762
+
11763
+ const generateHeader = (bearerToken, shouldApplyAdditionalHeaders = true) => {
11764
+ const defaultHeaders = {
11765
+ Accept: "application/json",
11766
+ Authorization: `Bearer ${bearerToken}`,
11767
+ ContentType: "application/json"
11768
+ };
11769
+ if (!shouldApplyAdditionalHeaders) {
11770
+ return defaultHeaders;
11771
+ }
11772
+ return {
11773
+ ...defaultHeaders,
11774
+ [dist.MetricSourceHeader]: dist.UserActionSource.POWERSYNC_CLI,
11775
+ [dist.MetricSourceVersionHeader]: packageJSON.version
11776
+ };
11777
+ };
11497
11778
  const checkAppId = (appId) => {
11498
11779
  if (!appId)
11499
11780
  throw new Error("No app id found");
@@ -37367,143 +37648,140 @@ var ENV_VARIABLES;
37367
37648
  ENV_VARIABLES2["INSTANCE_ID"] = "INSTANCE_ID";
37368
37649
  ENV_VARIABLES2["ORG_ID"] = "ORG_ID";
37369
37650
  })(ENV_VARIABLES || (ENV_VARIABLES = {}));
37370
- const powerSyncClient = ({ authToken } = {}) => {
37651
+ const powerSyncClient = ({ authToken, options } = {}) => {
37371
37652
  const finalToken = authToken || AUTH_TOKEN;
37372
37653
  if (!finalToken) {
37373
37654
  throw new Error("No auth token found");
37374
37655
  }
37375
- const HEADERS = generateHeader(finalToken);
37656
+ const HEADERS = generateHeader(finalToken, options?.shouldApplyAdditionalHeaders);
37376
37657
  return new Client_1({
37377
- client: dist$4.createWebNetworkClient({ headers: HEADERS }),
37658
+ client: dist$5.createWebNetworkClient({ headers: HEADERS }),
37378
37659
  endpoint: ENDPOINTS.POWERSYNC_URL
37379
37660
  });
37380
37661
  };
37381
- const getInstancesList = async () => {
37662
+ const getInstancesList = async ({ options } = {}) => {
37382
37663
  checkOrgId(ORG_ID);
37383
37664
  checkAppId(APP_ID);
37384
- return powerSyncClient().listInstances({
37665
+ return powerSyncClient({ options }).listInstances({
37385
37666
  app_id: APP_ID,
37386
37667
  org_id: ORG_ID
37387
37668
  });
37388
37669
  };
37389
- const getInstanceConfig = async () => {
37670
+ const getInstanceConfig = async ({ options } = {}) => {
37390
37671
  checkOrgId(ORG_ID);
37391
37672
  checkAppId(APP_ID);
37392
37673
  checkInstanceId(INSTANCE_ID);
37393
- return powerSyncClient().getInstanceConfig({
37674
+ return powerSyncClient({ options }).getInstanceConfig({
37394
37675
  app_id: APP_ID,
37395
37676
  id: INSTANCE_ID,
37396
37677
  org_id: ORG_ID
37397
37678
  });
37398
37679
  };
37399
- const getInstanceDiagnostics = async ({ appId, authToken, instanceId, orgId }) => {
37680
+ const getInstanceDiagnostics = async ({ appId, authToken, instanceId, options, orgId }) => {
37400
37681
  const finalAppId = appId || APP_ID;
37401
37682
  const finalInstanceId = instanceId || INSTANCE_ID;
37402
37683
  const finalOrgId = orgId || ORG_ID;
37403
37684
  checkOrgId(finalOrgId);
37404
37685
  checkAppId(finalAppId);
37405
37686
  checkInstanceId(finalInstanceId);
37406
- return powerSyncClient({ authToken }).getInstanceDiagnostics({
37687
+ return powerSyncClient({ authToken, options }).getInstanceDiagnostics({
37407
37688
  app_id: finalAppId,
37408
37689
  id: finalInstanceId,
37409
37690
  org_id: finalOrgId
37410
37691
  });
37411
37692
  };
37412
- const getInstanceSchema = async () => {
37693
+ const getInstanceSchema = async ({ options } = {}) => {
37413
37694
  checkOrgId(ORG_ID);
37414
37695
  checkAppId(APP_ID);
37415
37696
  checkInstanceId(INSTANCE_ID);
37416
- return powerSyncClient().getInstanceSchema({
37697
+ return powerSyncClient({ options }).getInstanceSchema({
37417
37698
  app_id: APP_ID,
37418
37699
  id: INSTANCE_ID,
37419
37700
  org_id: ORG_ID
37420
37701
  });
37421
37702
  };
37422
- const getInstanceStatus = async (instanceId) => {
37703
+ const getInstanceStatus = async (instanceId, { options } = {}) => {
37423
37704
  const finalInstanceId = instanceId || INSTANCE_ID;
37424
37705
  checkOrgId(ORG_ID);
37425
37706
  checkAppId(APP_ID);
37426
37707
  checkInstanceId(finalInstanceId);
37427
- return powerSyncClient().getInstanceStatus({
37708
+ return powerSyncClient({ options }).getInstanceStatus({
37428
37709
  app_id: APP_ID,
37429
37710
  id: instanceId ?? INSTANCE_ID,
37430
37711
  org_id: ORG_ID
37431
37712
  });
37432
37713
  };
37433
- const destroyInstance = async () => {
37714
+ const destroyInstance = async ({ options } = {}) => {
37434
37715
  checkOrgId(ORG_ID);
37435
37716
  checkAppId(APP_ID);
37436
37717
  checkInstanceId(INSTANCE_ID);
37437
- return powerSyncClient().destroyInstance({
37718
+ return powerSyncClient({ options }).destroyInstance({
37438
37719
  app_id: APP_ID,
37439
37720
  id: INSTANCE_ID,
37440
37721
  org_id: ORG_ID
37441
37722
  });
37442
37723
  };
37443
- const deactivateInstance = async () => {
37724
+ const deactivateInstance = async ({ options } = {}) => {
37444
37725
  checkOrgId(ORG_ID);
37445
37726
  checkAppId(APP_ID);
37446
37727
  checkInstanceId(INSTANCE_ID);
37447
- return powerSyncClient().deactivateInstance({
37728
+ return powerSyncClient({ options }).deactivateInstance({
37448
37729
  app_id: APP_ID,
37449
37730
  id: INSTANCE_ID,
37450
37731
  org_id: ORG_ID
37451
37732
  });
37452
37733
  };
37453
- const createInstance = async (name) => {
37734
+ const createInstance = async (name, { options } = {}) => {
37454
37735
  checkOrgId(ORG_ID);
37455
37736
  checkAppId(APP_ID);
37456
- checkInstanceId(INSTANCE_ID);
37457
- return powerSyncClient().createInstance({
37737
+ return powerSyncClient({ options }).createInstance({
37458
37738
  app_id: APP_ID,
37459
37739
  name,
37460
37740
  org_id: ORG_ID
37461
37741
  });
37462
37742
  };
37463
- const testConnection = async (connection) => {
37743
+ const testConnection = async (connection, { options } = {}) => {
37464
37744
  checkOrgId(ORG_ID);
37465
37745
  checkAppId(APP_ID);
37466
- checkInstanceId(INSTANCE_ID);
37467
- return powerSyncClient().testConnection({
37746
+ return powerSyncClient({ options }).testConnection({
37468
37747
  app_id: APP_ID,
37469
37748
  connection,
37470
- id: INSTANCE_ID,
37471
37749
  org_id: ORG_ID
37472
37750
  });
37473
37751
  };
37474
- const deployInstance = async (config, instanceId) => {
37752
+ const deployInstance = async (config, instanceId, { options } = {}) => {
37475
37753
  checkOrgId(ORG_ID);
37476
37754
  checkAppId(APP_ID);
37477
- return powerSyncClient().deployInstance({
37755
+ return powerSyncClient({ options }).deployInstance({
37478
37756
  app_id: APP_ID,
37479
37757
  config,
37480
37758
  id: instanceId,
37481
37759
  org_id: ORG_ID
37482
37760
  });
37483
37761
  };
37484
- const validateSyncRules = async (syncRules) => {
37762
+ const validateSyncRules = async (syncRules, { options } = {}) => {
37485
37763
  checkOrgId(ORG_ID);
37486
37764
  checkAppId(APP_ID);
37487
37765
  checkInstanceId(INSTANCE_ID);
37488
- return powerSyncClient().validateSyncRules({
37766
+ return powerSyncClient({ options }).validateSyncRules({
37489
37767
  app_id: APP_ID,
37490
37768
  id: INSTANCE_ID,
37491
37769
  org_id: ORG_ID,
37492
37770
  sync_rules: syncRules
37493
37771
  });
37494
37772
  };
37495
- const deploySyncRules = async (syncRules) => {
37773
+ const deploySyncRules = async (syncRules, { options } = {}) => {
37496
37774
  checkOrgId(ORG_ID);
37497
37775
  checkAppId(APP_ID);
37498
37776
  checkInstanceId(INSTANCE_ID);
37499
- const config = await getInstanceConfig();
37777
+ const config = await getInstanceConfig({ options: { shouldApplyAdditionalHeaders: false } });
37500
37778
  if (!config.config) {
37501
37779
  throw new Error("No instance config found");
37502
37780
  }
37503
37781
  if (!syncRules) {
37504
37782
  throw new Error("No sync rules found");
37505
37783
  }
37506
- return powerSyncClient().deployInstance({
37784
+ return powerSyncClient({ options }).deployInstance({
37507
37785
  app_id: APP_ID,
37508
37786
  config: config.config,
37509
37787
  id: INSTANCE_ID,
@@ -37511,11 +37789,11 @@ const deploySyncRules = async (syncRules) => {
37511
37789
  sync_rules: syncRules
37512
37790
  });
37513
37791
  };
37514
- const processSyncRules = async () => {
37792
+ const processSyncRules = async ({ options }) => {
37515
37793
  checkOrgId(ORG_ID);
37516
37794
  checkAppId(APP_ID);
37517
37795
  checkInstanceId(INSTANCE_ID);
37518
- powerSyncClient().reprocessSyncRules({
37796
+ powerSyncClient({ options }).reprocessSyncRules({
37519
37797
  app_id: APP_ID,
37520
37798
  id: INSTANCE_ID,
37521
37799
  org_id: ORG_ID
@@ -37524,13 +37802,13 @@ const processSyncRules = async () => {
37524
37802
  const waitForStatusChange = async (instanceId) => {
37525
37803
  const interval = 5e3;
37526
37804
  try {
37527
- const result = await getInstanceStatus(instanceId);
37805
+ const result = await getInstanceStatus(instanceId, { options: { shouldApplyAdditionalHeaders: false } });
37528
37806
  let { status } = result.operations[0];
37529
37807
  while (status !== "failed" && status !== "completed") {
37530
37808
  await new Promise((resolve) => {
37531
37809
  setTimeout(resolve, interval);
37532
37810
  });
37533
- const response = await getInstanceStatus(instanceId);
37811
+ const response = await getInstanceStatus(instanceId, { options: { shouldApplyAdditionalHeaders: false } });
37534
37812
  status = response.operations[0].status;
37535
37813
  }
37536
37814
  return status;