@webiny/api-composition-standalone-sql 0.0.0-unstable.e1999482d0 → 6.6.0-alpha.13

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.
@@ -23,7 +23,7 @@ export type CreateSqlApiHandlerConfig = Pick<BaseConfig, "extensions"> & {
23
23
  * What the handler puts in the root container, once per process: the storage (the connection and
24
24
  * its settings, its `RequestStorage` and its schema setup runner), the login storage's
25
25
  * `RequestStorage`, and the self-hosted JWT identity provider. The IdP is in the root so the
26
- * RequestIdentityLoader (driven by NodeHttpIdentityLoaderDecorator) can resolve it; it only needs the
26
+ * RequestIdentityLoader (driven by HttpIdentityLoaderDecorator) can resolve it; it only needs the
27
27
  * token issuer, and the login use cases it registers resolve the credential storage from the
28
28
  * request's container.
29
29
  */
@@ -1 +1 @@
1
- {"version":3,"file":"createWebinyApiHandler.js","sources":["../src/createWebinyApiHandler.ts"],"sourcesContent":["/**\n * Webiny API handler for the standalone Node server transport on a SQL storage.\n *\n * Thin variant over the transport base (@webiny/api-composition-standalone): takes the storage\n * (`createSqliteStorage` from @webiny/api-storage-sqlite, or `createPgStorage` from\n * @webiny/api-storage-pg, each built from its connection) and adds the self-hosted identity provider\n * (JWT IdP + SQL credential storage) on the storage's connection.\n *\n * At start, before the server accepts a request, it runs the storage's schema setup\n * (`SqlSchemaSetupRunner`) on a container built the way a request's is, so the storage, the login\n * tables and the modules among the project's extensions set up theirs. Then the storage is\n * schema-managed: no request checks for or creates tables. The JWT signing secret is read from\n * `WEBINY_SELF_HOSTED_AUTH_SECRET` when the handler is created.\n */\nimport type { Container } from \"@webiny/di\";\nimport { RequestStorage } from \"@webiny/api-core\";\nimport { SqlSchemaSetupRunner, type SqlStorage } from \"@webiny/api-core-sql\";\nimport { ApiRequestRegistration } from \"@webiny/api-composition-core\";\nimport {\n createWebinyApiHandler as createBaseHandler,\n type CreateWebinyApiHandlerConfig as BaseConfig\n} from \"@webiny/api-composition-standalone\";\nimport { SelfHostedAuthApiFeature } from \"@webiny/self-hosted-auth\";\nimport { SelfHostedAuthSqlFeature } from \"@webiny/self-hosted-auth-sql\";\nimport { readSigningSecret } from \"~/readSigningSecret.js\";\n\nexport type CreateSqlApiHandlerConfig = Pick<BaseConfig, \"extensions\"> & {\n /** The SQL storage of the API, built from its connection. */\n storage: SqlStorage;\n};\n\n/*\n * The login storage of a request: the credentials and reset codes, on the storage's connection and\n * table settings (`KnexClient`, `SqlSchemaConfig`, in the root).\n */\nconst SelfHostedAuthRequestStorage: RequestStorage.Interface = {\n register(container) {\n SelfHostedAuthSqlFeature.register(container);\n }\n};\n\n/**\n * What the handler puts in the root container, once per process: the storage (the connection and\n * its settings, its `RequestStorage` and its schema setup runner), the login storage's\n * `RequestStorage`, and the self-hosted JWT identity provider. The IdP is in the root so the\n * RequestIdentityLoader (driven by NodeHttpIdentityLoaderDecorator) can resolve it; it only needs the\n * token issuer, and the login use cases it registers resolve the credential storage from the\n * request's container.\n */\nexport function registerSqlApiRoot(\n container: Container,\n params: { storage: SqlStorage; signingSecret: string }\n): void {\n params.storage.register(container);\n container.registerInstance(RequestStorage, SelfHostedAuthRequestStorage);\n SelfHostedAuthApiFeature.register(container, { signingSecret: params.signingSecret });\n}\n\nexport function createSqlApiHandler(config: CreateSqlApiHandlerConfig) {\n const { storage } = config;\n // Read once, so a missing secret stops the server at boot instead of failing the first login.\n const signingSecret = readSigningSecret(process.env);\n\n return createBaseHandler({\n extensions: config.extensions,\n registerRootStorage: async container => {\n registerSqlApiRoot(container, { storage, signingSecret });\n /*\n * Before the server takes traffic: `root` runs before the server is handed back to\n * listen. The setup's container is built as a request's (`ApiRequestRegistration`), so\n * the login storage's `RequestStorage` adds the login tables. A failure (a missing\n * module, a database that's down) stops the server here.\n */\n await container.resolve(SqlSchemaSetupRunner).run({\n request: container.resolve(ApiRequestRegistration)\n });\n }\n });\n}\n"],"names":["SelfHostedAuthRequestStorage","container","SelfHostedAuthSqlFeature","registerSqlApiRoot","params","RequestStorage","SelfHostedAuthApiFeature","createSqlApiHandler","config","storage","signingSecret","readSigningSecret","process","createBaseHandler","SqlSchemaSetupRunner","ApiRequestRegistration"],"mappings":";;;;;;;AAmCA,MAAMA,+BAAyD;IAC3D,UAASC,SAAS;QACdC,yBAAyB,QAAQ,CAACD;IACtC;AACJ;AAUO,SAASE,mBACZF,SAAoB,EACpBG,MAAsD;IAEtDA,OAAO,OAAO,CAAC,QAAQ,CAACH;IACxBA,UAAU,gBAAgB,CAACI,gBAAgBL;IAC3CM,yBAAyB,QAAQ,CAACL,WAAW;QAAE,eAAeG,OAAO,aAAa;IAAC;AACvF;AAEO,SAASG,oBAAoBC,MAAiC;IACjE,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,MAAME,gBAAgBC,kBAAkBC,QAAQ,GAAG;IAEnD,OAAOC,uBAAkB;QACrB,YAAYL,OAAO,UAAU;QAC7B,qBAAqB,OAAMP;YACvBE,mBAAmBF,WAAW;gBAAEQ;gBAASC;YAAc;YAOvD,MAAMT,UAAU,OAAO,CAACa,sBAAsB,GAAG,CAAC;gBAC9C,SAASb,UAAU,OAAO,CAACc;YAC/B;QACJ;IACJ;AACJ"}
1
+ {"version":3,"file":"createWebinyApiHandler.js","sources":["../src/createWebinyApiHandler.ts"],"sourcesContent":["/**\n * Webiny API handler for the standalone Node server transport on a SQL storage.\n *\n * Thin variant over the transport base (@webiny/api-composition-standalone): takes the storage\n * (`createSqliteStorage` from @webiny/api-storage-sqlite, or `createPgStorage` from\n * @webiny/api-storage-pg, each built from its connection) and adds the self-hosted identity provider\n * (JWT IdP + SQL credential storage) on the storage's connection.\n *\n * At start, before the server accepts a request, it runs the storage's schema setup\n * (`SqlSchemaSetupRunner`) on a container built the way a request's is, so the storage, the login\n * tables and the modules among the project's extensions set up theirs. Then the storage is\n * schema-managed: no request checks for or creates tables. The JWT signing secret is read from\n * `WEBINY_SELF_HOSTED_AUTH_SECRET` when the handler is created.\n */\nimport type { Container } from \"@webiny/di\";\nimport { RequestStorage } from \"@webiny/api-core\";\nimport { SqlSchemaSetupRunner, type SqlStorage } from \"@webiny/api-core-sql\";\nimport { ApiRequestRegistration } from \"@webiny/api-composition-core\";\nimport {\n createWebinyApiHandler as createBaseHandler,\n type CreateWebinyApiHandlerConfig as BaseConfig\n} from \"@webiny/api-composition-standalone\";\nimport { SelfHostedAuthApiFeature } from \"@webiny/self-hosted-auth\";\nimport { SelfHostedAuthSqlFeature } from \"@webiny/self-hosted-auth-sql\";\nimport { readSigningSecret } from \"~/readSigningSecret.js\";\n\nexport type CreateSqlApiHandlerConfig = Pick<BaseConfig, \"extensions\"> & {\n /** The SQL storage of the API, built from its connection. */\n storage: SqlStorage;\n};\n\n/*\n * The login storage of a request: the credentials and reset codes, on the storage's connection and\n * table settings (`KnexClient`, `SqlSchemaConfig`, in the root).\n */\nconst SelfHostedAuthRequestStorage: RequestStorage.Interface = {\n register(container) {\n SelfHostedAuthSqlFeature.register(container);\n }\n};\n\n/**\n * What the handler puts in the root container, once per process: the storage (the connection and\n * its settings, its `RequestStorage` and its schema setup runner), the login storage's\n * `RequestStorage`, and the self-hosted JWT identity provider. The IdP is in the root so the\n * RequestIdentityLoader (driven by HttpIdentityLoaderDecorator) can resolve it; it only needs the\n * token issuer, and the login use cases it registers resolve the credential storage from the\n * request's container.\n */\nexport function registerSqlApiRoot(\n container: Container,\n params: { storage: SqlStorage; signingSecret: string }\n): void {\n params.storage.register(container);\n container.registerInstance(RequestStorage, SelfHostedAuthRequestStorage);\n SelfHostedAuthApiFeature.register(container, { signingSecret: params.signingSecret });\n}\n\nexport function createSqlApiHandler(config: CreateSqlApiHandlerConfig) {\n const { storage } = config;\n // Read once, so a missing secret stops the server at boot instead of failing the first login.\n const signingSecret = readSigningSecret(process.env);\n\n return createBaseHandler({\n extensions: config.extensions,\n registerRootStorage: async container => {\n registerSqlApiRoot(container, { storage, signingSecret });\n /*\n * Before the server takes traffic: `root` runs before the server is handed back to\n * listen. The setup's container is built as a request's (`ApiRequestRegistration`), so\n * the login storage's `RequestStorage` adds the login tables. A failure (a missing\n * module, a database that's down) stops the server here.\n */\n await container.resolve(SqlSchemaSetupRunner).run({\n request: container.resolve(ApiRequestRegistration)\n });\n }\n });\n}\n"],"names":["SelfHostedAuthRequestStorage","container","SelfHostedAuthSqlFeature","registerSqlApiRoot","params","RequestStorage","SelfHostedAuthApiFeature","createSqlApiHandler","config","storage","signingSecret","readSigningSecret","process","createBaseHandler","SqlSchemaSetupRunner","ApiRequestRegistration"],"mappings":";;;;;;;AAmCA,MAAMA,+BAAyD;IAC3D,UAASC,SAAS;QACdC,yBAAyB,QAAQ,CAACD;IACtC;AACJ;AAUO,SAASE,mBACZF,SAAoB,EACpBG,MAAsD;IAEtDA,OAAO,OAAO,CAAC,QAAQ,CAACH;IACxBA,UAAU,gBAAgB,CAACI,gBAAgBL;IAC3CM,yBAAyB,QAAQ,CAACL,WAAW;QAAE,eAAeG,OAAO,aAAa;IAAC;AACvF;AAEO,SAASG,oBAAoBC,MAAiC;IACjE,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAEpB,MAAME,gBAAgBC,kBAAkBC,QAAQ,GAAG;IAEnD,OAAOC,uBAAkB;QACrB,YAAYL,OAAO,UAAU;QAC7B,qBAAqB,OAAMP;YACvBE,mBAAmBF,WAAW;gBAAEQ;gBAASC;YAAc;YAOvD,MAAMT,UAAU,OAAO,CAACa,sBAAsB,GAAG,CAAC;gBAC9C,SAASb,UAAU,OAAO,CAACc;YAC/B;QACJ;IACJ;AACJ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-composition-standalone-sql",
3
- "version": "0.0.0-unstable.e1999482d0",
3
+ "version": "6.6.0-alpha.13",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "exports": {
@@ -18,29 +18,33 @@
18
18
  ],
19
19
  "license": "MIT",
20
20
  "dependencies": {
21
- "@webiny/api-composition-core": "0.0.0-unstable.e1999482d0",
22
- "@webiny/api-composition-standalone": "0.0.0-unstable.e1999482d0",
23
- "@webiny/api-core": "0.0.0-unstable.e1999482d0",
24
- "@webiny/api-core-sql": "0.0.0-unstable.e1999482d0",
25
- "@webiny/api-mailer": "0.0.0-unstable.e1999482d0",
21
+ "@webiny/api-composition-core": "6.6.0-alpha.13",
22
+ "@webiny/api-composition-standalone": "6.6.0-alpha.13",
23
+ "@webiny/api-core": "6.6.0-alpha.13",
24
+ "@webiny/api-core-sql": "6.6.0-alpha.13",
25
+ "@webiny/api-mailer": "6.6.0-alpha.13",
26
26
  "@webiny/di": "2.0.0",
27
- "@webiny/handler": "0.0.0-unstable.e1999482d0",
28
- "@webiny/self-hosted-auth": "0.0.0-unstable.e1999482d0",
29
- "@webiny/self-hosted-auth-sql": "0.0.0-unstable.e1999482d0"
27
+ "@webiny/handler": "6.6.0-alpha.13",
28
+ "@webiny/self-hosted-auth": "6.6.0-alpha.13",
29
+ "@webiny/self-hosted-auth-sql": "6.6.0-alpha.13"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@electric-sql/pglite": "0.5.17",
33
33
  "@electric-sql/pglite-socket": "0.2.20",
34
34
  "@types/ws": "8.18.2",
35
- "@webiny/api-aco": "0.0.0-unstable.e1999482d0",
36
- "@webiny/api-aco-pg": "0.0.0-unstable.e1999482d0",
37
- "@webiny/api-audit-logs": "0.0.0-unstable.e1999482d0",
38
- "@webiny/api-headless-cms": "0.0.0-unstable.e1999482d0",
39
- "@webiny/api-headless-cms-pg": "0.0.0-unstable.e1999482d0",
40
- "@webiny/api-storage-pg": "0.0.0-unstable.e1999482d0",
41
- "@webiny/api-storage-sqlite": "0.0.0-unstable.e1999482d0",
42
- "@webiny/api-websockets": "0.0.0-unstable.e1999482d0",
43
- "@webiny/build-tools": "0.0.0-unstable.e1999482d0",
35
+ "@webiny/api-aco": "6.6.0-alpha.13",
36
+ "@webiny/api-aco-pg": "6.6.0-alpha.13",
37
+ "@webiny/api-audit-logs": "6.6.0-alpha.13",
38
+ "@webiny/api-graphql": "6.6.0-alpha.13",
39
+ "@webiny/api-headless-cms": "6.6.0-alpha.13",
40
+ "@webiny/api-headless-cms-pg": "6.6.0-alpha.13",
41
+ "@webiny/api-kernel-core": "6.6.0-alpha.13",
42
+ "@webiny/api-object-storage": "6.6.0-alpha.13",
43
+ "@webiny/api-object-storage-disk": "6.6.0-alpha.13",
44
+ "@webiny/api-storage-pg": "6.6.0-alpha.13",
45
+ "@webiny/api-storage-sqlite": "6.6.0-alpha.13",
46
+ "@webiny/api-websockets": "6.6.0-alpha.13",
47
+ "@webiny/build-tools": "6.6.0-alpha.13",
44
48
  "knex": "3.3.0",
45
49
  "rimraf": "6.1.4",
46
50
  "typescript": "7.0.2",