@adobe/spacecat-shared-data-access 3.64.0 → 3.66.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [@adobe/spacecat-shared-data-access-v3.66.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.65.0...@adobe/spacecat-shared-data-access-v3.66.0) (2026-05-21)
2
+
3
+ ### Features
4
+
5
+ * **ci:** migrate npm publishing to OIDC Trusted Publishers ([#1592](https://github.com/adobe/spacecat-shared/issues/1592)) ([7556295](https://github.com/adobe/spacecat-shared/commit/75562957a223b5783a97998c8dc12eebd3e4db34))
6
+
7
+ ## [@adobe/spacecat-shared-data-access-v3.65.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.64.0...@adobe/spacecat-shared-data-access-v3.65.0) (2026-05-16)
8
+
9
+ ### Features
10
+
11
+ * submodule support — reinstate clone, fix pull, add hasSubmodules flag ([#1550](https://github.com/adobe/spacecat-shared/issues/1550)) ([3329ff8](https://github.com/adobe/spacecat-shared/commit/3329ff82740c2311545bd7a1ab693eb92ecb8f5d))
12
+
1
13
  ## [@adobe/spacecat-shared-data-access-v3.64.0](https://github.com/adobe/spacecat-shared/compare/@adobe/spacecat-shared-data-access-v3.63.0...@adobe/spacecat-shared-data-access-v3.64.0) (2026-05-15)
2
14
 
3
15
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spacecat-shared-data-access",
3
- "version": "3.64.0",
3
+ "version": "3.66.0",
4
4
  "description": "Shared modules of the Spacecat Services - Data Access",
5
5
  "type": "module",
6
6
  "engines": {
@@ -34,6 +34,92 @@ export interface HlxConfig {
34
34
  };
35
35
  }
36
36
 
37
+ /**
38
+ * One entry per submodule declared in the parent repo's `.gitmodules`.
39
+ * Each row carries both the importer-detected facts (declared section,
40
+ * original URL, external flag) and any onboarding-resolved CM URL the
41
+ * cm-client uses at clone/pull time to rewrite `.git/config`.
42
+ *
43
+ * Lifecycle:
44
+ * - Importer-written fields (`sectionName`, `gitmodulesUrl`, `external`)
45
+ * are refreshed on every import. Entries whose `sectionName` is no
46
+ * longer present in the parent's `.gitmodules` are dropped.
47
+ * - Onboarding-written fields (`resolvedUrl`) are preserved across
48
+ * imports for surviving entries — the importer cannot re-derive
49
+ * them (no CM Management API access from Lambda) and onboarding
50
+ * refreshes them out-of-band.
51
+ */
52
+ export interface SubmoduleEntry {
53
+ /**
54
+ * The `<X>` from `[submodule "<X>"]` in `.gitmodules`. Used by
55
+ * cm-client as the `.git/config` key when rewriting URLs (i.e.
56
+ * `submodule.<sectionName>.url`). In every customer `.gitmodules`
57
+ * we've seen this matches the `path = …` value, but git's lookup
58
+ * is by section name so we capture it here.
59
+ */
60
+ sectionName: string;
61
+ /**
62
+ * The submodule URL exactly as declared in `.gitmodules`, with
63
+ * basic-auth credentials stripped from https/http forms. Relative
64
+ * (`../foo.git`) and SSH (`git@host:path`) forms are preserved as-is.
65
+ */
66
+ gitmodulesUrl: string;
67
+ /**
68
+ * True when this submodule's URL points to a host other than the
69
+ * parent repo's host. Relative URLs (`../foo.git`) and SSH URLs
70
+ * targeting the parent's host classify as internal (`false`).
71
+ */
72
+ external: boolean;
73
+ /**
74
+ * BYOG-only. Onboarding-populated URL the cm-client writes into
75
+ * `.git/config submodule.<sectionName>.url` at clone/pull time.
76
+ *
77
+ * The CM repo service proxies BYOG clones through URLs of the form
78
+ * `{CM_REPO_URL}/api/program/{programId}/repository/{numericId}.git`.
79
+ * When `.gitmodules` uses relative or SSH URLs, git resolves them to
80
+ * paths the proxy can't serve. The cm-client rewrites each submodule's
81
+ * `.git/config` URL to a CM-reachable form before running
82
+ * `git submodule update`. `.gitmodules` itself is never modified.
83
+ *
84
+ * URL form depends on the underlying repo type, decided at onboarding:
85
+ * - BYOG (`github`/`gitlab`/`bitbucket`/`azure_devops`):
86
+ * `{cmRepoUrl}/api/program/{programId}/repository/{numericId}.git`
87
+ * - `standard`:
88
+ * `https://git.cloudmanager.adobe.com/{orgName}/{repoName}/`
89
+ *
90
+ * The cm-client picks the auth scope to apply by parsing each
91
+ * `resolvedUrl`'s host. URLs on the CM proxy host get
92
+ * Bearer + x-api-key + x-gw-ims-org-id; URLs on
93
+ * `https://git.cloudmanager.adobe.com/{orgName}/` get Basic auth
94
+ * from `CM_STANDARD_REPO_CREDENTIALS[programId]` scoped to the org
95
+ * prefix.
96
+ *
97
+ * Absent when:
98
+ * - the parent is `standard` (cm-client takes the native
99
+ * `--recurse-submodules` path and ignores this array entirely),
100
+ * - this submodule is `external` to a host outside CM's reach,
101
+ * - onboarding hasn't run for this site yet.
102
+ *
103
+ * When absent on a BYOG parent, cm-client logs a warning and skips
104
+ * that submodule during `submodule update`.
105
+ */
106
+ resolvedUrl?: string;
107
+ }
108
+
109
+ /**
110
+ * Per-submodule list captured during code import. Empty array when the
111
+ * cloned repo has no `.gitmodules` file (and therefore no submodules).
112
+ */
113
+ export type SubmodulesMetadata = SubmoduleEntry[];
114
+
115
+ /**
116
+ * Metadata extracted during code import. Consumers should assume an
117
+ * empty object when a field is absent.
118
+ */
119
+ export interface CodeMetadata {
120
+ submodules?: SubmodulesMetadata;
121
+ }
122
+
37
123
  export interface CodeConfig {
38
124
  type: string;
39
125
  owner: string;
@@ -41,7 +127,17 @@ export interface CodeConfig {
41
127
  ref: string;
42
128
  installationId?: string;
43
129
  url: string;
130
+ /**
131
+ * S3 key (not full URL) where the imported repository ZIP is stored.
132
+ * Written by the code importer after successful ingestion.
133
+ */
44
134
  s3StoragePath?: string;
135
+ /**
136
+ * Metadata extracted from the cloned repository. Always overwritten
137
+ * on each successful import — a re-import that finds no submodules
138
+ * clears any submodule entries from an earlier import.
139
+ */
140
+ metadata?: CodeMetadata;
45
141
  }
46
142
 
47
143
  export interface DeliveryConfig {
@@ -76,6 +76,27 @@ const schema = new SchemaBuilder(Site, SiteCollection)
76
76
  validate: (value) => isNonEmptyObject(validateConfiguration(value)),
77
77
  get: (value) => Config(value),
78
78
  })
79
+ /**
80
+ * Repository configuration used by the code importer and downstream
81
+ * consumers (autofix, suggestion generation, code analysis).
82
+ *
83
+ * Fields written by the importer after a successful clone:
84
+ * - s3StoragePath: S3 key (not full URL) of the imported repository ZIP
85
+ * - metadata.submodules: per-submodule array. Each entry carries
86
+ * `{ sectionName, gitmodulesUrl, external }` from the parent's
87
+ * `.gitmodules`. Empty array when the repo has no `.gitmodules`.
88
+ * The importer refreshes these fields on every import; entries whose
89
+ * `sectionName` is no longer present are dropped.
90
+ *
91
+ * Fields populated at onboarding (not by the importer):
92
+ * - metadata.submodules[].resolvedUrl: BYOG-only. Pre-resolved CM URL
93
+ * the cm-client writes into `.git/config submodule.<sectionName>.url`
94
+ * at clone/pull time so submodules can fetch through the CM proxy
95
+ * (or `git.cloudmanager.adobe.com` for standard submodules of BYOG
96
+ * parents). Preserved across re-imports for surviving sectionNames.
97
+ *
98
+ * See SubmoduleEntry / CodeConfig in index.d.ts for the full TypeScript shape.
99
+ */
79
100
  .addAttribute('code', {
80
101
  type: 'any',
81
102
  required: false,
@@ -89,6 +110,7 @@ const schema = new SchemaBuilder(Site, SiteCollection)
89
110
  installationId: { type: 'string', required: false },
90
111
  url: { type: 'string', required: true, validate: (value) => isValidUrl(value) },
91
112
  s3StoragePath: { type: 'string', required: false },
113
+ metadata: { type: 'any', required: false },
92
114
  },
93
115
  })
94
116
  .addAttribute('deliveryType', {