@teleporthq/teleport-plugin-next-workflows 0.43.20 → 0.43.21

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.
@@ -60,20 +60,46 @@ describe('resolveAuthEnvValue', () => {
60
60
  ).toBe('')
61
61
  })
62
62
 
63
- it('PRESERVES the CMS_ACCESS_TOKEN alias placeholder so the deploy worker can resolve it', () => {
64
- // Regression: the CMS access token is stored under a uniquified secret name
65
- // (e.g. CONTENTFUL_API_TOKEN2) and exposed via the STABLE alias env key
66
- // CMS_ACCESS_TOKEN. Emptying it lost the alias→target mapping: the worker's
67
- // empty-value fallback looked up projectSecrets['CMS_ACCESS_TOKEN'] (absent)
68
- // instead of projectSecrets['CONTENTFUL_API_TOKEN2'], so the token shipped
69
- // blank and every CMS fetch on the deployed site returned 401.
70
- expect(
71
- resolveAuthEnvValue('CMS_ACCESS_TOKEN', 'teleporthq.secrets.CONTENTFUL_API_TOKEN2', oauthKeys)
72
- ).toBe('teleporthq.secrets.CONTENTFUL_API_TOKEN2')
73
- // Holds even with no preserveKeys argument (the alias set is unconditional).
74
- expect(resolveAuthEnvValue('CMS_ACCESS_TOKEN', 'teleporthq.secrets.CONTENTFUL_API_TOKEN')).toBe(
75
- 'teleporthq.secrets.CONTENTFUL_API_TOKEN'
76
- )
63
+ // Regression: every CMS type in the platform exposes its base URL + access
64
+ // token through exactly two STABLE env keys CMS_URL and CMS_ACCESS_TOKEN
65
+ // regardless of how the underlying secret is named. Whenever the value is a
66
+ // `teleporthq.secrets.<name>` alias (env KEY != secret name), emptying it lost
67
+ // the mapping: the deploy worker's empty-value fallback looked up a secret
68
+ // named after the KEY (CMS_URL / CMS_ACCESS_TOKEN), which never exists — only
69
+ // the referenced name (STRAPI_URL, CONTENTFUL_API_TOKEN2, …) does. So the CMS
70
+ // base URL and/or token shipped blank and every CMS fetch on the deployed site
71
+ // failed (empty CMS_URL → hostless `/api/...`; empty token → 401). The list
72
+ // rendered in the GUI but was empty in the deployed project. These must all be
73
+ // PRESERVED so the worker resolves them via its `teleporthq.secrets.*` branch.
74
+ // Source of truth for the secret names: each integration's flow.ts
75
+ // getUniqueNameForSecret(...) + to-uidl-mapper provideBaseUrl/provideAccessToken.
76
+ describe('PRESERVES CMS alias placeholders for every CMS type', () => {
77
+ const cmsAliasCases: Array<[string, string, string]> = [
78
+ // [cmsType, env key, alias value emitted by the GUI mapper]
79
+ ['contentful (token)', 'CMS_ACCESS_TOKEN', 'teleporthq.secrets.CONTENTFUL_API_TOKEN2'],
80
+ ['strapi (url)', 'CMS_URL', 'teleporthq.secrets.STRAPI_URL'],
81
+ ['strapi (token)', 'CMS_ACCESS_TOKEN', 'teleporthq.secrets.STRAPI_ACCESS_TOKEN'],
82
+ ['flotiq (url)', 'CMS_URL', 'teleporthq.secrets.FLOTIQ_URL'],
83
+ ['flotiq (token)', 'CMS_ACCESS_TOKEN', 'teleporthq.secrets.FLOTIQ_ACCESS_TOKEN'],
84
+ ['caisy (token)', 'CMS_ACCESS_TOKEN', 'teleporthq.secrets.CAISY_ACCESS_TOKEN'],
85
+ ['wordpress (url)', 'CMS_URL', 'teleporthq.secrets.WORDPRESS_URL'],
86
+ ]
87
+ it.each(cmsAliasCases)('%s alias survives', (_label, key, value) => {
88
+ expect(resolveAuthEnvValue(key, value, oauthKeys)).toBe(value)
89
+ // Holds even with no preserveKeys argument (the CMS set is unconditional).
90
+ expect(resolveAuthEnvValue(key, value)).toBe(value)
91
+ })
92
+
93
+ // CMS_URL values that are NOT secret refs (Contentful delivery URL, caisy
94
+ // GraphQL URL) pass through untouched whether or not they're in the preserve
95
+ // set — listing CMS_URL is a harmless no-op for them.
96
+ const cmsPlainUrlCases: Array<[string, string]> = [
97
+ ['contentful', 'https://cdn.contentful.com/spaces/0g5imrx0o9y5/environments/master'],
98
+ ['caisy', 'https://cloud.caisy.io/api/v3/e/PROJECT_ID/graphql'],
99
+ ]
100
+ it.each(cmsPlainUrlCases)('%s plain CMS_URL passes through untouched', (_label, url) => {
101
+ expect(resolveAuthEnvValue('CMS_URL', url, oauthKeys)).toBe(url)
102
+ })
77
103
  })
78
104
 
79
105
  it('keeps NEXTAUTH defaults and leaves non-auth behavior unchanged', () => {