@codemation/host 0.1.7 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/{AppConfigFactory-BBEn2B-i.d.ts → AppConfigFactory-DHdAGOmC.d.ts} +3 -3
  3. package/dist/{AppContainerFactory-CeKsjo8L.js → AppContainerFactory-BKaAUIi-.js} +13 -9
  4. package/dist/AppContainerFactory-BKaAUIi-.js.map +1 -0
  5. package/dist/{CodemationConfig-9PkOBCh-.d.ts → CodemationConfig-DBbMU3HB.d.ts} +2 -2
  6. package/dist/{CodemationConfigNormalizer-DIc-LYqW.d.ts → CodemationConfigNormalizer-C8wC0skq.d.ts} +2 -2
  7. package/dist/{CodemationConsumerConfigLoader-CeW4bnOg.d.ts → CodemationConsumerConfigLoader-Ceh6sB3X.d.ts} +2 -2
  8. package/dist/{CodemationPluginListMerger-Cv7CaM5_.d.ts → CodemationPluginListMerger-Cx9DnyR-.d.ts} +5 -5
  9. package/dist/{CredentialServices-Dp_jXTJo.d.ts → CredentialServices-CYETzKyb.d.ts} +14 -5
  10. package/dist/{CredentialServices-xVxVA9Tq.js → CredentialServices-D8BBZH1i.js} +40 -6
  11. package/dist/CredentialServices-D8BBZH1i.js.map +1 -0
  12. package/dist/{PublicFrontendBootstrapFactory-SQVHMxLg.d.ts → PublicFrontendBootstrapFactory-DeMjp3cs.d.ts} +2 -2
  13. package/dist/consumer.d.ts +4 -4
  14. package/dist/credentials.d.ts +3 -3
  15. package/dist/credentials.js +1 -1
  16. package/dist/devServerSidecar.d.ts +1 -1
  17. package/dist/{index-CLRTQLAp.d.ts → index-dK05sTQ4.d.ts} +9 -1
  18. package/dist/index.d.ts +10 -10
  19. package/dist/index.js +3 -3
  20. package/dist/nextServer.d.ts +9 -8
  21. package/dist/nextServer.js +2 -2
  22. package/dist/{persistenceServer-Dv7fg_Jf.d.ts → persistenceServer-D9vUTMqc.d.ts} +2 -2
  23. package/dist/persistenceServer.d.ts +5 -5
  24. package/dist/{server-CioY8PP3.js → server-C-WZcsId.js} +3 -3
  25. package/dist/{server-CioY8PP3.js.map → server-C-WZcsId.js.map} +1 -1
  26. package/dist/{server-C5oqDnZQ.d.ts → server-fxqY2WEi.d.ts} +5 -5
  27. package/dist/server.d.ts +8 -8
  28. package/dist/server.js +3 -3
  29. package/package.json +5 -5
  30. package/src/domain/credentials/CredentialInstanceService.ts +8 -1
  31. package/src/domain/credentials/CredentialOAuth2ScopeResolver.ts +61 -0
  32. package/src/domain/credentials/CredentialServices.ts +1 -0
  33. package/src/domain/credentials/OAuth2ConnectServiceFactory.ts +9 -2
  34. package/dist/AppContainerFactory-CeKsjo8L.js.map +0 -1
  35. package/dist/CredentialServices-xVxVA9Tq.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @codemation/host
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#60](https://github.com/MadeRelevant/codemation/pull/60) [`056c045`](https://github.com/MadeRelevant/codemation/commit/056c045d7813e7e6b749f0dc03bb43855ff7f58c) Thanks [@cblokland90](https://github.com/cblokland90)! - Harden the Gmail plugin so it imports reliably from the package root, returns an authenticated official Gmail session, and supports trigger/read/send/reply/label workflows with one OAuth credential.
8
+
9
+ Add framework support for OAuth scope presets and custom per-credential scope replacement, and update the plugin starter/docs so future plugins scaffold the same publishable root-entrypoint conventions.
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies [[`056c045`](https://github.com/MadeRelevant/codemation/commit/056c045d7813e7e6b749f0dc03bb43855ff7f58c)]:
14
+ - @codemation/core@0.5.0
15
+ - @codemation/core-nodes@0.1.1
16
+ - @codemation/eventbus-redis@0.0.27
17
+
3
18
  ## 0.1.7
4
19
 
5
20
  ### Patch Changes
@@ -1,5 +1,5 @@
1
- import { _ as AppPersistenceConfig, g as AppConfig } from "./CodemationConfig-9PkOBCh-.js";
2
- import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-DIc-LYqW.js";
1
+ import { _ as AppPersistenceConfig, g as AppConfig } from "./CodemationConfig-DBbMU3HB.js";
2
+ import { t as NormalizedCodemationConfig } from "./CodemationConfigNormalizer-C8wC0skq.js";
3
3
  import { AnyNull, AnyNullClass, DbNull, DbNullClass, Decimal, JsonNull, JsonNullClass, NullTypes as NullTypes$1, ObjectEnumValue, PrismaClientInitializationError, PrismaClientKnownRequestError, PrismaClientRustPanicError, PrismaClientUnknownRequestError, PrismaClientValidationError, RawValue, Sql, Value, empty, isAnyNull, isDbNull, isJsonNull, isObjectEnumValue, join, raw, sql as sqltag } from "@prisma/client-runtime-utils";
4
4
 
5
5
  //#region src/infrastructure/persistence/generated/prisma-postgresql-client/runtime/client.d.ts
@@ -28903,4 +28903,4 @@ declare class AppConfigFactory {
28903
28903
  }
28904
28904
  //#endregion
28905
28905
  export { PrismaClient as i, PrismaMigrationDeployer as n, PrismaDatabaseClient as r, AppConfigFactory as t };
28906
- //# sourceMappingURL=AppConfigFactory-BBEn2B-i.d.ts.map
28906
+ //# sourceMappingURL=AppConfigFactory-DHdAGOmC.d.ts.map
@@ -2,7 +2,7 @@ import { i as __toESM, r as __require, t as __commonJS } from "./chunk-7V6ThxGB.
2
2
  import { o as LogLevelPolicyFactory, s as logLevelPolicyFactory, t as ServerLoggerFactory } from "./ServerLoggerFactory-BltIIDfQ.js";
3
3
  import { n as __decorateMetadata, t as __decorateParam } from "./decorateParam-DrsXNPuw.js";
4
4
  import { t as __decorate } from "./decorate-B0PP651O.js";
5
- import { a as CredentialInstanceService, c as CredentialFieldEnvOverlayService, d as ApplicationRequestError, f as CredentialTypeRegistryImpl, i as CredentialBindingService, l as WorkflowCredentialNodeResolver, m as OpenAiApiKeyCredentialHealthTester, n as CredentialSessionServiceImpl, o as CredentialMaterialResolver, p as OpenAiApiKeyCredentialTypeFactory, r as CredentialRuntimeMaterialService, s as CredentialSecretCipher, t as CredentialTestService, u as ApplicationTokens } from "./CredentialServices-xVxVA9Tq.js";
5
+ import { a as CredentialInstanceService, c as CredentialSecretCipher, d as ApplicationTokens, f as ApplicationRequestError, h as OpenAiApiKeyCredentialHealthTester, i as CredentialBindingService, l as CredentialFieldEnvOverlayService, m as OpenAiApiKeyCredentialTypeFactory, n as CredentialSessionServiceImpl, o as CredentialOAuth2ScopeResolver, p as CredentialTypeRegistryImpl, r as CredentialRuntimeMaterialService, s as CredentialMaterialResolver, t as CredentialTestService, u as WorkflowCredentialNodeResolver } from "./CredentialServices-D8BBZH1i.js";
6
6
  import { i as require_client$2, r as PrismaMigrationDeployer } from "./AppConfigFactory-ByT1D8dM.js";
7
7
  import { mkdir, rm, stat } from "node:fs/promises";
8
8
  import path from "node:path";
@@ -2080,13 +2080,13 @@ OAuth2ProviderRegistry = _OAuth2ProviderRegistry = __decorate([injectable()], OA
2080
2080
 
2081
2081
  //#endregion
2082
2082
  //#region src/domain/credentials/OAuth2ConnectServiceFactory.ts
2083
- var _ref$33, _ref2$9, _ref3$4, _ref4$2, _ref5$1, _ref6, _ref7, _OAuth2ConnectService;
2083
+ var _ref$33, _ref2$9, _ref3$4, _ref4$2, _ref5$1, _ref6, _ref7, _ref8, _OAuth2ConnectService;
2084
2084
  let OAuth2ConnectService = class OAuth2ConnectService$1 {
2085
2085
  static {
2086
2086
  _OAuth2ConnectService = this;
2087
2087
  }
2088
2088
  static stateTtlMs = 600 * 1e3;
2089
- constructor(credentialStore, credentialInstanceService, credentialTypeRegistry, credentialRuntimeMaterialService, credentialFieldEnvOverlayService, credentialMaterialResolver, credentialSecretCipher, oauth2ProviderRegistry, appConfig) {
2089
+ constructor(credentialStore, credentialInstanceService, credentialTypeRegistry, credentialRuntimeMaterialService, credentialFieldEnvOverlayService, credentialMaterialResolver, credentialSecretCipher, credentialOAuth2ScopeResolver, oauth2ProviderRegistry, appConfig) {
2090
2090
  this.credentialStore = credentialStore;
2091
2091
  this.credentialInstanceService = credentialInstanceService;
2092
2092
  this.credentialTypeRegistry = credentialTypeRegistry;
@@ -2094,6 +2094,7 @@ let OAuth2ConnectService = class OAuth2ConnectService$1 {
2094
2094
  this.credentialFieldEnvOverlayService = credentialFieldEnvOverlayService;
2095
2095
  this.credentialMaterialResolver = credentialMaterialResolver;
2096
2096
  this.credentialSecretCipher = credentialSecretCipher;
2097
+ this.credentialOAuth2ScopeResolver = credentialOAuth2ScopeResolver;
2097
2098
  this.oauth2ProviderRegistry = oauth2ProviderRegistry;
2098
2099
  this.appConfig = appConfig;
2099
2100
  }
@@ -2107,6 +2108,7 @@ let OAuth2ConnectService = class OAuth2ConnectService$1 {
2107
2108
  material: emptyMaterial
2108
2109
  });
2109
2110
  const provider = this.oauth2ProviderRegistry.resolve(credentialType.definition, resolvedPublicConfig);
2111
+ const requestedScopes = this.credentialOAuth2ScopeResolver.resolveRequestedScopes(credentialType.definition.auth, resolvedPublicConfig);
2110
2112
  const redirectUri = this.getRedirectUri(requestOrigin);
2111
2113
  const state = this.createOpaqueValue();
2112
2114
  const codeVerifier = this.createOpaqueValue();
@@ -2118,7 +2120,7 @@ let OAuth2ConnectService = class OAuth2ConnectService$1 {
2118
2120
  instanceId,
2119
2121
  codeVerifier,
2120
2122
  providerId: provider.providerId,
2121
- requestedScopes: credentialType.definition.auth.scopes,
2123
+ requestedScopes,
2122
2124
  createdAt: createdAt.toISOString(),
2123
2125
  expiresAt: expiresAt.toISOString()
2124
2126
  });
@@ -2126,7 +2128,7 @@ let OAuth2ConnectService = class OAuth2ConnectService$1 {
2126
2128
  authorizeUrl.searchParams.set("response_type", "code");
2127
2129
  authorizeUrl.searchParams.set("client_id", this.oauth2ProviderRegistry.resolveClientId(credentialType.definition.auth, resolvedPublicConfig));
2128
2130
  authorizeUrl.searchParams.set("redirect_uri", redirectUri);
2129
- authorizeUrl.searchParams.set("scope", credentialType.definition.auth.scopes.join(" "));
2131
+ authorizeUrl.searchParams.set("scope", requestedScopes.join(" "));
2130
2132
  authorizeUrl.searchParams.set("state", state);
2131
2133
  authorizeUrl.searchParams.set("code_challenge", codeChallenge);
2132
2134
  authorizeUrl.searchParams.set("code_challenge_method", "S256");
@@ -2324,8 +2326,9 @@ OAuth2ConnectService = _OAuth2ConnectService = __decorate([
2324
2326
  __decorateParam(4, inject(CredentialFieldEnvOverlayService)),
2325
2327
  __decorateParam(5, inject(CredentialMaterialResolver)),
2326
2328
  __decorateParam(6, inject(CredentialSecretCipher)),
2327
- __decorateParam(7, inject(OAuth2ProviderRegistry)),
2328
- __decorateParam(8, inject(ApplicationTokens.AppConfig)),
2329
+ __decorateParam(7, inject(CredentialOAuth2ScopeResolver)),
2330
+ __decorateParam(8, inject(OAuth2ProviderRegistry)),
2331
+ __decorateParam(9, inject(ApplicationTokens.AppConfig)),
2329
2332
  __decorateMetadata("design:paramtypes", [
2330
2333
  Object,
2331
2334
  typeof (_ref$33 = typeof CredentialInstanceService !== "undefined" && CredentialInstanceService) === "function" ? _ref$33 : Object,
@@ -2334,7 +2337,8 @@ OAuth2ConnectService = _OAuth2ConnectService = __decorate([
2334
2337
  typeof (_ref4$2 = typeof CredentialFieldEnvOverlayService !== "undefined" && CredentialFieldEnvOverlayService) === "function" ? _ref4$2 : Object,
2335
2338
  typeof (_ref5$1 = typeof CredentialMaterialResolver !== "undefined" && CredentialMaterialResolver) === "function" ? _ref5$1 : Object,
2336
2339
  typeof (_ref6 = typeof CredentialSecretCipher !== "undefined" && CredentialSecretCipher) === "function" ? _ref6 : Object,
2337
- typeof (_ref7 = typeof OAuth2ProviderRegistry !== "undefined" && OAuth2ProviderRegistry) === "function" ? _ref7 : Object,
2340
+ typeof (_ref7 = typeof CredentialOAuth2ScopeResolver !== "undefined" && CredentialOAuth2ScopeResolver) === "function" ? _ref7 : Object,
2341
+ typeof (_ref8 = typeof OAuth2ProviderRegistry !== "undefined" && OAuth2ProviderRegistry) === "function" ? _ref8 : Object,
2338
2342
  Object
2339
2343
  ])
2340
2344
  ], OAuth2ConnectService);
@@ -15333,4 +15337,4 @@ var AppContainerFactory = class AppContainerFactory {
15333
15337
 
15334
15338
  //#endregion
15335
15339
  export { GetWorkflowDetailQuery as C, ListUserAccountsQuery as E, GetWorkflowSummariesQuery as S, UpsertLocalBootstrapUserCommand as T, CodemationFrontendAuthSnapshotFactory as _, AppContainerLifecycle as a, WorkflowDefinitionMapper as b, RequestToWebhookItemMapper as c, CredentialHttpRouteHandler as d, CodemationHonoApiApp as f, FrontendAppConfigFactory as g, InternalAuthBootstrapFactory as h, DatabaseMigrations as i, RunHttpRouteHandler as l, PublicFrontendBootstrapFactory as m, WorkerRuntime as n, WorkflowHttpRouteHandler as o, BinaryHttpRouteHandler as p, FrontendRuntime as r, WebhookHttpRouteHandler as s, AppContainerFactory as t, OAuth2HttpRouteHandler as u, WorkflowWebsocketServer as v, RunBinaryAttachmentLookupService as w, WorkflowPolicyUiPresentationFactory as x, ApiPaths as y };
15336
- //# sourceMappingURL=AppContainerFactory-CeKsjo8L.js.map
15340
+ //# sourceMappingURL=AppContainerFactory-BKaAUIi-.js.map