{"_id":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql","_rev":"2-d122b16d53312f185c74e7c12f08b0d4","name":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql","dist-tags":{"latest":"1.0.0-alpha.2"},"versions":{"1.0.0-alpha.0":{"name":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql","version":"1.0.0-alpha.0","keywords":["shopify","node","app","graphql","rest","webhook","Admin API","Storefront API","postgresql","PostgreSQL","session storage","pg-promise"],"_id":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql@1.0.0-alpha.0","maintainers":[{"name":"bazaarforgegs","email":"hello@bazaarforge.com"}],"homepage":"https://github.com/bazaarforge/enhanced-shopify-app-session-storage-adaptable-postgresql","bugs":{"url":"https://github.com/bazaarforge/enhanced-shopify-app-session-storage-adaptable-postgresql/issues"},"dist":{"shasum":"0d0817c6594774f23bdd7d1e223c901290efff36","tarball":"https://registry.npmjs.org/@bazaarforge/shopify-app-session-storage-adaptable-postgresql/-/shopify-app-session-storage-adaptable-postgresql-1.0.0-alpha.0.tgz","fileCount":8,"integrity":"sha512-HOY9sMiDq7ihiCZfyioVIDDH0XGXgeLd6zbq2acefCxa/yG0P4tgm9hw5VD4PyYolPmS9XK4qahYiNM2n3acvA==","signatures":[{"sig":"MEUCIQD19V2bX8U/u/B/Kh2Zw3k9fESrXwV7huDLqBMZq6qilwIgYpjUHnKkkC2iriwndRx9Pedf5hJRcm3KZ/D2cD31FhI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39343},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"e897135191f23a4c211bbee1d215bfc958e83795","scripts":{"dev":"tsup --watch","lint":"eslint .","test":"vitest","build":"tsup","format":"prettier --write .","prepublishOnly":"npm run build"},"_npmUser":{"name":"bazaarforgegs","email":"hello@bazaarforge.com"},"repository":{"url":"git+https://github.com/bazaarforge/enhanced-shopify-app-session-storage-adaptable-postgresql.git","type":"git"},"_npmVersion":"10.9.0","description":"Enhanced Shopify App Session Storage for PostgreSQL","directories":{},"_nodeVersion":"22.10.0","dependencies":{"@shopify/shopify-api":"^11.8.1","@shopify/shopify-app-session-storage":"^3.0.12"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0","devDependencies":{"pg":"^8.12.0","tsup":"^8.3.6","eslint":"^9.20.0","vitest":"^3.0.5","prettier":"^3.4.2","pg-promise":"^11.9.0","typescript":"^5.7.3","@types/node":"^22.13.1","vitest-fetch-mock":"^0.4.3","pg-connection-string":"^2.7.0","eslint-config-prettier":"^10.0.1","eslint-plugin-prettier":"^5.2.3","@typescript-eslint/parser":"^8.23.0","@typescript-eslint/eslint-plugin":"^8.23.0"},"peerDependencies":{"pg":"^8.12.0","pg-promise":"^11.9.0","pg-connection-string":"^2.7.0"},"peerDependenciesMeta":{"pg":{"optional":true},"pg-promise":{"optional":true},"pg-connection-string":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/shopify-app-session-storage-adaptable-postgresql_1.0.0-alpha.0_1739025658374_0.4334071327368889","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-alpha.1":{"name":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql","version":"1.0.0-alpha.1","keywords":["shopify","node","app","graphql","rest","webhook","Admin API","Storefront API","postgresql","PostgreSQL","session storage","pg-promise"],"_id":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql@1.0.0-alpha.1","maintainers":[{"name":"bazaarforgegs","email":"hello@bazaarforge.com"}],"homepage":"https://github.com/bazaarforge/enhanced-shopify-app-session-storage-adaptable-postgresql","bugs":{"url":"https://github.com/bazaarforge/enhanced-shopify-app-session-storage-adaptable-postgresql/issues"},"dist":{"shasum":"4d5ced0388696fff7fba2020a4f126c8d8e8c88d","tarball":"https://registry.npmjs.org/@bazaarforge/shopify-app-session-storage-adaptable-postgresql/-/shopify-app-session-storage-adaptable-postgresql-1.0.0-alpha.1.tgz","fileCount":6,"integrity":"sha512-hGqyQBgU7MrogsCnhPiOSW6WjTuzzmSekbgssVExFre8W8ii6/un4UKaF/3DdVBM4NP54Z91II10c/z/1RilPQ==","signatures":[{"sig":"MEYCIQDke4FG5z3dAQejegjORHQqdx0lRa8hTbMUfhw70etCnwIhAODr9IeAtO5uDE3lgj2vFWS3uOwLtaXODUmVv5x4jxab","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16691},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"e897135191f23a4c211bbee1d215bfc958e83795","scripts":{"dev":"tsup --watch","lint":"eslint .","test":"vitest","build":"tsup","format":"prettier --write .","prepublishOnly":"npm run build"},"_npmUser":{"name":"bazaarforgegs","email":"hello@bazaarforge.com"},"repository":{"url":"git+https://github.com/bazaarforge/enhanced-shopify-app-session-storage-adaptable-postgresql.git","type":"git"},"_npmVersion":"10.9.0","description":"Enhanced Shopify App Session Storage for PostgreSQL","directories":{},"_nodeVersion":"22.10.0","dependencies":{"@shopify/shopify-api":"^11.8.1","@shopify/shopify-app-session-storage":"^3.0.12"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0","devDependencies":{"pg":"^8.12.0","tsup":"^8.3.6","eslint":"^9.20.0","vitest":"^3.0.5","prettier":"^3.4.2","pg-promise":"^11.9.0","typescript":"^5.7.3","@types/node":"^22.13.1","vitest-fetch-mock":"^0.4.3","pg-connection-string":"^2.7.0","eslint-config-prettier":"^10.0.1","eslint-plugin-prettier":"^5.2.3","@typescript-eslint/parser":"^8.23.0","@typescript-eslint/eslint-plugin":"^8.23.0"},"peerDependencies":{"pg":"^8.12.0","pg-promise":"^11.9.0","pg-connection-string":"^2.7.0"},"peerDependenciesMeta":{"pg":{"optional":true},"pg-promise":{"optional":true},"pg-connection-string":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/shopify-app-session-storage-adaptable-postgresql_1.0.0-alpha.1_1739027247809_0.627529170792255","host":"s3://npm-registry-packages-npm-production"}},"1.0.0-alpha.2":{"name":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql","version":"1.0.0-alpha.2","description":"Enhanced Shopify App Session Storage for PostgreSQL","repository":{"type":"git","url":"git+https://github.com/bazaarforge/shopify-app-session-storage-adaptable-postgresql.git"},"bugs":{"url":"https://github.com/bazaarforge/shopify-app-session-storage-adaptable-postgresql/issues"},"keywords":["shopify","node","app","graphql","rest","webhook","Admin API","Storefront API","postgresql","PostgreSQL","session storage","pg-promise"],"homepage":"https://github.com/bazaarforge/shopify-app-session-storage-adaptable-postgresql","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.cjs","import":"./dist/index.js"}},"scripts":{"build":"tsup","dev":"tsup --watch","test":"vitest","lint":"eslint .","prepublishOnly":"npm run build","format":"prettier --write ."},"dependencies":{"@shopify/shopify-api":"^11.8.1","@shopify/shopify-app-session-storage":"^3.0.12"},"devDependencies":{"@types/node":"^22.13.1","@typescript-eslint/eslint-plugin":"^8.23.0","@typescript-eslint/parser":"^8.23.0","eslint":"^9.20.0","eslint-config-prettier":"^10.0.1","eslint-plugin-prettier":"^5.2.3","pg":"^8.12.0","pg-connection-string":"^2.7.0","pg-promise":"^11.9.0","prettier":"^3.4.2","tsup":"^8.3.6","typescript":"^5.7.3","vitest":"^3.0.5","vitest-fetch-mock":"^0.4.3"},"peerDependencies":{"pg":"^8.12.0","pg-connection-string":"^2.7.0","pg-promise":"^11.9.0"},"peerDependenciesMeta":{"pg":{"optional":true},"pg-connection-string":{"optional":true},"pg-promise":{"optional":true}},"publishConfig":{"access":"public"},"packageManager":"pnpm@9.15.4+sha512.b2dc20e2fc72b3e18848459b37359a32064663e5627a51e4c74b2c29dd8e8e0491483c3abb40789cfd578bf362fb6ba8261b05f0387d76792ed6e23ea3b1b6a0","_id":"@bazaarforge/shopify-app-session-storage-adaptable-postgresql@1.0.0-alpha.2","gitHead":"2b8460a5095ca2b77202de458b24c9e822838abf","_nodeVersion":"22.10.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-x9mvpsWuULgf3MPOI7k2EEqIlDmIv7xwAoiRNFOamtnUZ7X/4FfjFWmDsypDbTiWlpWDwrSB/D4ccUz5SmzX/w==","shasum":"b5709e03bfe5389b9224dccae18fbd5dac67455d","tarball":"https://registry.npmjs.org/@bazaarforge/shopify-app-session-storage-adaptable-postgresql/-/shopify-app-session-storage-adaptable-postgresql-1.0.0-alpha.2.tgz","fileCount":6,"unpackedSize":23470,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDKk8RUK7fky1M8t8W29qmY6a/Hwzy76anQaMJZEa/F3wIgEnMpRfxUyUyMN54Il/b2rRhtLYLIycO4w7f58UBwEmk="}]},"_npmUser":{"name":"bazaarforgegs","email":"hello@bazaarforge.com"},"directories":{},"maintainers":[{"name":"bazaarforgegs","email":"hello@bazaarforge.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/shopify-app-session-storage-adaptable-postgresql_1.0.0-alpha.2_1739041186056_0.612697701113261"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-08T14:40:58.267Z","modified":"2025-02-08T18:59:46.455Z","1.0.0-alpha.0":"2025-02-08T14:40:58.565Z","1.0.0-alpha.1":"2025-02-08T15:07:28.004Z","1.0.0-alpha.2":"2025-02-08T18:59:46.238Z"},"bugs":{"url":"https://github.com/bazaarforge/shopify-app-session-storage-adaptable-postgresql/issues"},"homepage":"https://github.com/bazaarforge/shopify-app-session-storage-adaptable-postgresql","keywords":["shopify","node","app","graphql","rest","webhook","Admin API","Storefront API","postgresql","PostgreSQL","session storage","pg-promise"],"repository":{"type":"git","url":"git+https://github.com/bazaarforge/shopify-app-session-storage-adaptable-postgresql.git"},"description":"Enhanced Shopify App Session Storage for PostgreSQL","maintainers":[{"name":"bazaarforgegs","email":"hello@bazaarforge.com"}],"readme":"# Adaptable Shopify Session Adapter\n\nA shopify session adapter that allows you to customize how you connect to PostgreSQL.\n\n## Customizable Access to PostgreSQL\n\nIf you're using a library such as `pg-promise` or want to customize the way the connection is managed or the database is queried, the adapter offered by Shopify may not be ideal.\n\nThis adapter offers the following:\n\n- more flexibility in choosing how to connect to PostgreSQL\n- no automatic table creation or migration\n- possibility to encrypt the `accessToken`\n\n### Native PostgreSQL Adapter\n\nUsing the native `pg` library:\n\n```typescript\n// Example usage with NativePostgresConnection\n\nimport {\n  NativePostgresConnection,\n  AdaptablePostgresStorage\n} from '@bazaarforge/shopify-app-session-storage-adaptable-postgresql';\n\nconst sessionTableName = 'shopify_sessions';\nconst url = `postgres://user:password@host/dbname`\n\nconst storage = new AdaptablePostgresStorage(\n  new NativePostgresConnection(url, sessionTableName)\n);\n```\n\n### pg-promise Adapter\n\nUsing the `pg-promise` adapter:\n\n```typescript\n// Example usage with PgPromiseConnection\n\nimport pgPromise from 'pg-promise';\nimport {\n  PgPromiseConnection,\n  AdaptablePostgresStorage\n} from '@bazaarforge/shopify-app-session-storage-adaptable-postgresql';\n\n\nconst sessionTableName = 'shopify_sessions';\nconst pgp = pgPromise();\nconst db = pgp('postgres://user:password@host/dbname');\n\nconst storage = new AdaptablePostgresStorage(\n  new PgPromiseConnection(db, sessionTableName)\n);\n```\n\n### Custom Connection\n\nYou can extend the class `BasePostgresConnection`, see examples in `src`.\n\n\n### No Auto-Creation of Session Table\n\nUnlike Shopify's adapter, this adapter will not automatically create the session database table.\nWe believe this is not the responsibility of the runtime to do so.\n\nInstead, you can add this table to your database manually:\n\n```sql\nCREATE TABLE IF NOT EXISTS \"UserSession\" (\n  \"id\" varchar(255) NOT NULL PRIMARY KEY,\n  \"shop\" TEXT NOT NULL,\n  \"state\" varchar(255) NOT NULL,\n  \"isOnline\" boolean NOT NULL,\n  \"scope\" TEXT,\n  \"expires\" integer,\n  \"onlineAccessInfo\" TEXT,\n  \"accessToken\" TEXT\n);\n```\n\nWe recommend using a migration tool such as [goose](https://github.com/pressly/goose), [node-pg-migrate](https://www.npmjs.com/package/node-pg-migrate), [umzug](https://github.com/sequelize/umzug), etc.\n\n### Option to encrypt access token\n\nShopify recommends encrypting the database at rest; however, we believe that storing merchants' access tokens in plain text within the database poses significant privacy risks.\n\nUnlike Shopify's default adapter, which does not encrypt session tokens, this adapter allows you to configure a signature key for [symmetrical client-side encryption](https://en.wikipedia.org/wiki/Symmetric-key_algorithm). As a result, access tokens are securely encrypted before being stored in the database.\n\n#### Encrypt access token\n\nBe aware that this should **not** be done on an existing production database without a proper migration.\n\n1. **Generate a secret key**, it should be a 32 bit key. On Linux, you can run in the terminal `openssl rand -hex 32`. This key should be kept **secret** and **not be lost**, as **it is essential for encrypting and decrypting your data**. You can store this key in an env variable or in a vault.\n\nTo use the `SymmetricEncryptor` for encrypting and decrypting data, follow the example below:\n\n```typescript\nimport {\n  SymmetricEncryptor,\n  NativePostgresConnection,\n  AdaptablePostgresStorage\n} from '@bazaarforge/shopify-app-session-storage-adaptable-postgresql';\nimport crypto from 'crypto';\n\n// The encryption key that you generated in the previous step\nconst key = process.env.ENCRYPTION_KEY;\n\n// Create an instance of SymmetricEncryptor\nconst encryptor = new SymmetricEncryptor({ key });\n\n// Create an instance of AdaptablePostgresStorage using the encryptor\nconst storage = new AdaptablePostgresStorage(\n  new NativePostgresConnection(\"postgres://...\"),\n  {\n    encryptor\n  }\n);\n```\n","readmeFilename":"README.md"}