@ticatec/omniflow-aliyun 1.0.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/LICENSE +21 -0
- package/README.md +100 -0
- package/README_CN.md +100 -0
- package/dist/client/AliyunClient.d.ts +7 -0
- package/dist/client/AliyunClient.d.ts.map +1 -0
- package/dist/client/AliyunClient.js +6 -0
- package/dist/client/AliyunClient.js.map +1 -0
- package/dist/docker/AliyunAcrPublisher.d.ts +22 -0
- package/dist/docker/AliyunAcrPublisher.d.ts.map +1 -0
- package/dist/docker/AliyunAcrPublisher.js +54 -0
- package/dist/docker/AliyunAcrPublisher.js.map +1 -0
- package/dist/generic/AliyunGenericPublisher.d.ts +35 -0
- package/dist/generic/AliyunGenericPublisher.d.ts.map +1 -0
- package/dist/generic/AliyunGenericPublisher.js +212 -0
- package/dist/generic/AliyunGenericPublisher.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/maven/AliyunMavenPublisher.d.ts +41 -0
- package/dist/maven/AliyunMavenPublisher.d.ts.map +1 -0
- package/dist/maven/AliyunMavenPublisher.js +261 -0
- package/dist/maven/AliyunMavenPublisher.js.map +1 -0
- package/dist/npm/AliyunNpmPublisher.d.ts +17 -0
- package/dist/npm/AliyunNpmPublisher.d.ts.map +1 -0
- package/dist/npm/AliyunNpmPublisher.js +63 -0
- package/dist/npm/AliyunNpmPublisher.js.map +1 -0
- package/package.json +58 -0
- package/src/client/AliyunClient.ts +14 -0
- package/src/docker/AliyunAcrPublisher.ts +61 -0
- package/src/generic/AliyunGenericPublisher.ts +273 -0
- package/src/index.ts +56 -0
- package/src/maven/AliyunMavenPublisher.ts +330 -0
- package/src/npm/AliyunNpmPublisher.ts +76 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { BaseNpmPublisher } from '@ticatec/omniflow-artifact'
|
|
2
|
+
import type { RegistryConfig } from '@ticatec/omniflow-artifact'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Aliyun Apsara DevOps (云效) NPM Package Registry Publisher.
|
|
6
|
+
*
|
|
7
|
+
* Endpoint format: https://packages.aliyun.com/npm/registry/<repoId>/
|
|
8
|
+
* Or direct custom console URL: https://packages.aliyun.com/<orgId>/npm/registry/<repoId>/
|
|
9
|
+
*/
|
|
10
|
+
export class AliyunNpmPublisher extends BaseNpmPublisher {
|
|
11
|
+
readonly id = 'aliyun-npm'
|
|
12
|
+
readonly name = 'Aliyun Packages NPM'
|
|
13
|
+
readonly platform = 'aliyun-npm'
|
|
14
|
+
override readonly priority = 20
|
|
15
|
+
|
|
16
|
+
override detect(registry: RegistryConfig): boolean {
|
|
17
|
+
if (registry.type !== 'npm') {
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const regName = (registry.name || '').toLowerCase()
|
|
22
|
+
if (regName === 'aliyun' || regName.startsWith('aliyun-')) {
|
|
23
|
+
return true
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const server = (registry.server || '').toLowerCase()
|
|
27
|
+
try {
|
|
28
|
+
const parsed = new URL(server.includes('://') ? server : `https://${server}`)
|
|
29
|
+
const host = parsed.hostname.toLowerCase()
|
|
30
|
+
const segments = host.split('.')
|
|
31
|
+
const isAliyun = host === 'aliyun.com' || host.endsWith('.aliyun.com')
|
|
32
|
+
const isPackages = segments.includes('packages') || host === 'packages.aliyun.com'
|
|
33
|
+
return isAliyun && isPackages
|
|
34
|
+
} catch {
|
|
35
|
+
return false
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override normalizeRegistryUrl(server: string, _registryOrNamespace?: RegistryConfig | string): string {
|
|
40
|
+
let url = server.trim()
|
|
41
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
42
|
+
url = `https://${url}`
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const parsed = new URL(url)
|
|
46
|
+
const cleanBase = url.replace(/\/+$/, '')
|
|
47
|
+
|
|
48
|
+
// M6 Escape hatch: if server URL already has path segments beyond root '/', use it as-is
|
|
49
|
+
if (parsed.pathname !== '/' && parsed.pathname !== '') {
|
|
50
|
+
return cleanBase.endsWith('/') ? cleanBase : `${cleanBase}/`
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Extract repoId strictly from namespace or options/metadata
|
|
54
|
+
let repoId: string | undefined
|
|
55
|
+
if (typeof _registryOrNamespace === 'string') {
|
|
56
|
+
repoId = _registryOrNamespace.trim()
|
|
57
|
+
} else if (_registryOrNamespace && typeof _registryOrNamespace === 'object') {
|
|
58
|
+
const reg = _registryOrNamespace as RegistryConfig & { metadata?: Record<string, unknown> }
|
|
59
|
+
repoId =
|
|
60
|
+
reg.namespace?.trim() ||
|
|
61
|
+
(reg.options?.repoId as string | undefined)?.trim() ||
|
|
62
|
+
(reg.metadata?.repoId as string | undefined)?.trim()
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (!repoId) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`Aliyun NPM registry requires a valid repository ID (specify via registry.namespace or full server URL)`
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return `${cleanBase}/npm/registry/${encodeURIComponent(repoId)}/`
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// NOTE: login() is NOT overridden here. BaseNpmPublisher handles .npmrc backup, auth token injection,
|
|
75
|
+
// and cleanup(session) in finally to ensure 100% credential cleanup without disk leaks (S1 fix).
|
|
76
|
+
}
|