@hot-updater/neon 0.0.0-stage → 1.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,33 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Sungyu Kang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ ---
24
+
25
+ ADDITIONAL DISCLAIMER
26
+
27
+ The authors of this software shall not be held responsible for any legal issues,
28
+ regulatory violations, policy violations, or disputes arising from the use,
29
+ distribution, or integration of this software.
30
+
31
+ Users are solely responsible for ensuring compliance with all applicable laws,
32
+ regulations, and third-party policies (including but not limited to app store
33
+ policies).
package/dist/index.cjs ADDED
@@ -0,0 +1,39 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ let _hot_updater_storage_s3 = require("@hot-updater/storage-s3");
3
+ let _hot_updater_postgres = require("@hot-updater/postgres");
4
+ //#region src/neonStorage.ts
5
+ /** The endpoint's origin, or an error that names the variable to set. */
6
+ const endpointOrigin = (endpoint) => {
7
+ let url;
8
+ try {
9
+ url = new URL(endpoint);
10
+ } catch {
11
+ throw new Error("neonStorage needs the branch's storage endpoint (AWS_ENDPOINT_URL_S3), such as https://br-xxx.storage.c-5.us-east-2.aws.neon.tech.");
12
+ }
13
+ if (url.pathname !== "/" && url.pathname !== "") throw new Error(`neonStorage endpoint must not include a path: pass the bucket as bucketName instead of "${url.pathname}".`);
14
+ return url.origin;
15
+ };
16
+ /**
17
+ * Bundles in a Neon Object Storage bucket, through its S3 API. Devices
18
+ * download from presigned URLs that expire, so a private bucket works.
19
+ */
20
+ const neonStorage = (config) => {
21
+ const { endpoint, region, ...s3Config } = config;
22
+ return (0, _hot_updater_storage_s3.createS3Storage)({
23
+ name: "neonStorage",
24
+ protocol: "neon"
25
+ }, {
26
+ ...s3Config,
27
+ endpoint: endpointOrigin(endpoint),
28
+ forcePathStyle: true,
29
+ region: region ?? "us-east-1"
30
+ });
31
+ };
32
+ //#endregion
33
+ exports.neonStorage = neonStorage;
34
+ Object.defineProperty(exports, "postgres", {
35
+ enumerable: true,
36
+ get: function() {
37
+ return _hot_updater_postgres.postgres;
38
+ }
39
+ });
@@ -0,0 +1,33 @@
1
+ import { StorageAdapterWith } from "@hot-updater/plugin-core";
2
+ import { S3ClientConfig, S3StorageOperations } from "@hot-updater/storage-s3";
3
+ import { PostgresConfig, postgres } from "@hot-updater/postgres";
4
+ //#region src/neonStorage.d.ts
5
+ interface NeonStorageConfig extends Omit<S3ClientConfig, "credentials" | "endpoint" | "forcePathStyle"> {
6
+ /**
7
+ * The branch's object storage endpoint, such as
8
+ * `https://br-xxx.storage.c-5.us-east-2.aws.neon.tech`: the
9
+ * `AWS_ENDPOINT_URL_S3` that `neon env pull` writes.
10
+ */
11
+ endpoint: string;
12
+ /** The bucket on that branch. */
13
+ bucketName: string;
14
+ /**
15
+ * A storage credential of the project: the `AWS_ACCESS_KEY_ID` and
16
+ * `AWS_SECRET_ACCESS_KEY` that `neon env pull` writes.
17
+ */
18
+ credentials: NonNullable<S3ClientConfig["credentials"]>;
19
+ /** Base path where bundles will be stored in the bucket. */
20
+ basePath?: string;
21
+ /**
22
+ * Lifetime of the download URLs in seconds, at most seven days, the
23
+ * SigV4 limit. @default 3600
24
+ */
25
+ signedUrlExpiresIn?: number;
26
+ }
27
+ /**
28
+ * Bundles in a Neon Object Storage bucket, through its S3 API. Devices
29
+ * download from presigned URLs that expire, so a private bucket works.
30
+ */
31
+ declare const neonStorage: (config: NeonStorageConfig) => StorageAdapterWith<S3StorageOperations>;
32
+ //#endregion
33
+ export { NeonStorageConfig, type PostgresConfig, neonStorage, postgres };
@@ -0,0 +1,33 @@
1
+ import { S3ClientConfig, S3StorageOperations } from "@hot-updater/storage-s3";
2
+ import { PostgresConfig, postgres } from "@hot-updater/postgres";
3
+ import { StorageAdapterWith } from "@hot-updater/plugin-core";
4
+ //#region src/neonStorage.d.ts
5
+ interface NeonStorageConfig extends Omit<S3ClientConfig, "credentials" | "endpoint" | "forcePathStyle"> {
6
+ /**
7
+ * The branch's object storage endpoint, such as
8
+ * `https://br-xxx.storage.c-5.us-east-2.aws.neon.tech`: the
9
+ * `AWS_ENDPOINT_URL_S3` that `neon env pull` writes.
10
+ */
11
+ endpoint: string;
12
+ /** The bucket on that branch. */
13
+ bucketName: string;
14
+ /**
15
+ * A storage credential of the project: the `AWS_ACCESS_KEY_ID` and
16
+ * `AWS_SECRET_ACCESS_KEY` that `neon env pull` writes.
17
+ */
18
+ credentials: NonNullable<S3ClientConfig["credentials"]>;
19
+ /** Base path where bundles will be stored in the bucket. */
20
+ basePath?: string;
21
+ /**
22
+ * Lifetime of the download URLs in seconds, at most seven days, the
23
+ * SigV4 limit. @default 3600
24
+ */
25
+ signedUrlExpiresIn?: number;
26
+ }
27
+ /**
28
+ * Bundles in a Neon Object Storage bucket, through its S3 API. Devices
29
+ * download from presigned URLs that expire, so a private bucket works.
30
+ */
31
+ declare const neonStorage: (config: NeonStorageConfig) => StorageAdapterWith<S3StorageOperations>;
32
+ //#endregion
33
+ export { NeonStorageConfig, type PostgresConfig, neonStorage, postgres };
package/dist/index.mjs ADDED
@@ -0,0 +1,32 @@
1
+ import { createS3Storage } from "@hot-updater/storage-s3";
2
+ import { postgres } from "@hot-updater/postgres";
3
+ //#region src/neonStorage.ts
4
+ /** The endpoint's origin, or an error that names the variable to set. */
5
+ const endpointOrigin = (endpoint) => {
6
+ let url;
7
+ try {
8
+ url = new URL(endpoint);
9
+ } catch {
10
+ throw new Error("neonStorage needs the branch's storage endpoint (AWS_ENDPOINT_URL_S3), such as https://br-xxx.storage.c-5.us-east-2.aws.neon.tech.");
11
+ }
12
+ if (url.pathname !== "/" && url.pathname !== "") throw new Error(`neonStorage endpoint must not include a path: pass the bucket as bucketName instead of "${url.pathname}".`);
13
+ return url.origin;
14
+ };
15
+ /**
16
+ * Bundles in a Neon Object Storage bucket, through its S3 API. Devices
17
+ * download from presigned URLs that expire, so a private bucket works.
18
+ */
19
+ const neonStorage = (config) => {
20
+ const { endpoint, region, ...s3Config } = config;
21
+ return createS3Storage({
22
+ name: "neonStorage",
23
+ protocol: "neon"
24
+ }, {
25
+ ...s3Config,
26
+ endpoint: endpointOrigin(endpoint),
27
+ forcePathStyle: true,
28
+ region: region ?? "us-east-1"
29
+ });
30
+ };
31
+ //#endregion
32
+ export { neonStorage, postgres };
package/package.json CHANGED
@@ -1,6 +1,50 @@
1
1
  {
2
2
  "name": "@hot-updater/neon",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "type": "module",
4
+ "version": "1.1.5",
5
+ "description": "React Native OTA solution for self-hosted",
6
+ "main": "dist/index.cjs",
7
+ "module": "dist/index.mjs",
8
+ "types": "dist/index.d.cts",
9
+ "exports": {
10
+ ".": {
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ },
14
+ "./package.json": "./package.json"
15
+ },
16
+ "license": "MIT",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/gronxb/hot-updater"
20
+ },
21
+ "author": "gronxb <gron1gh1@gmail.com> (https://github.com/gronxb)",
22
+ "bugs": {
23
+ "url": "https://github.com/gronxb/hot-updater/issues"
24
+ },
25
+ "homepage": "https://github.com/gronxb/hot-updater#readme",
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "files": [
30
+ "dist",
31
+ "!**/*.spec.ts",
32
+ "package.json"
33
+ ],
34
+ "dependencies": {
35
+ "@hot-updater/plugin-core": "1.1.5",
36
+ "@hot-updater/postgres": "1.1.5",
37
+ "@hot-updater/storage-s3": "1.1.5"
38
+ },
39
+ "devDependencies": {
40
+ "@aws-sdk/client-s3": "3.1066.0",
41
+ "@aws-sdk/lib-storage": "3.1066.0",
42
+ "@types/node": "^20",
43
+ "vitest": "4.1.4",
44
+ "@hot-updater/test-utils": "1.1.5"
45
+ },
46
+ "scripts": {
47
+ "build": "tsdown",
48
+ "test:type": "tsc --noEmit"
49
+ }
6
50
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.