@undefineds.co/xpod 0.2.16 → 0.2.20
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/config/cloud.json +2 -2
- package/config/xpod.cluster.json +2 -2
- package/dist/api/container/cloud.js +6 -1
- package/dist/api/container/cloud.js.map +1 -1
- package/dist/api/container/routes.js +5 -1
- package/dist/api/container/routes.js.map +1 -1
- package/dist/api/container/types.d.ts +2 -0
- package/dist/api/container/types.js.map +1 -1
- package/dist/api/handlers/WebIdProfileHandler.d.ts +2 -0
- package/dist/api/handlers/WebIdProfileHandler.js +61 -2
- package/dist/api/handlers/WebIdProfileHandler.js.map +1 -1
- package/dist/components/components.jsonld +2 -0
- package/dist/components/context.jsonld +42 -0
- package/dist/identity/drizzle/PodLookupRepository.d.ts +4 -0
- package/dist/identity/drizzle/PodLookupRepository.js +7 -0
- package/dist/identity/drizzle/PodLookupRepository.js.map +1 -1
- package/dist/identity/drizzle/WebIdProfileRepository.d.ts +8 -5
- package/dist/identity/drizzle/WebIdProfileRepository.js +12 -2
- package/dist/identity/drizzle/WebIdProfileRepository.js.map +1 -1
- package/dist/identity/drizzle/WebIdProfileRepository.jsonld +108 -0
- package/dist/identity/oidc/LoopbackClientIdAdapterFactory.d.ts +7 -0
- package/dist/identity/oidc/LoopbackClientIdAdapterFactory.js +48 -0
- package/dist/identity/oidc/LoopbackClientIdAdapterFactory.js.map +1 -0
- package/dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld +49 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/dist/provision/ProvisionPodCreator.d.ts +4 -0
- package/dist/provision/ProvisionPodCreator.js +33 -2
- package/dist/provision/ProvisionPodCreator.js.map +1 -1
- package/dist/provision/ProvisionPodCreator.jsonld +23 -0
- package/package.json +13 -5
- package/static/app/assets/index.css +1 -1
- package/static/app/assets/main.js +15 -15
|
@@ -7,11 +7,15 @@
|
|
|
7
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
8
|
exports.WebIdProfileRepository = void 0;
|
|
9
9
|
const drizzle_orm_1 = require("drizzle-orm");
|
|
10
|
+
const db_1 = require("./db");
|
|
10
11
|
const global_logger_factory_1 = require("global-logger-factory");
|
|
11
12
|
const logger = (0, global_logger_factory_1.getLoggerFor)('WebIdProfileRepository');
|
|
12
13
|
class WebIdProfileRepository {
|
|
13
|
-
constructor(
|
|
14
|
-
this.db = db;
|
|
14
|
+
constructor(options) {
|
|
15
|
+
this.db = options.db ?? getIdentityDatabaseFromOptions(options);
|
|
16
|
+
if (!options.baseUrl) {
|
|
17
|
+
throw new Error('WebIdProfileRepository requires baseUrl.');
|
|
18
|
+
}
|
|
15
19
|
this.baseUrl = options.baseUrl.replace(/\/$/, '');
|
|
16
20
|
}
|
|
17
21
|
/**
|
|
@@ -154,4 +158,10 @@ class WebIdProfileRepository {
|
|
|
154
158
|
}
|
|
155
159
|
}
|
|
156
160
|
exports.WebIdProfileRepository = WebIdProfileRepository;
|
|
161
|
+
function getIdentityDatabaseFromOptions(options) {
|
|
162
|
+
if (options.identityDbUrl) {
|
|
163
|
+
return (0, db_1.getIdentityDatabase)(options.identityDbUrl);
|
|
164
|
+
}
|
|
165
|
+
throw new Error('WebIdProfileRepository requires db or identityDbUrl.');
|
|
166
|
+
}
|
|
157
167
|
//# sourceMappingURL=WebIdProfileRepository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebIdProfileRepository.js","sourceRoot":"","sources":["../../../src/identity/drizzle/WebIdProfileRepository.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAiC;AAEjC,iEAAqD;AAErD,MAAM,MAAM,GAAG,IAAA,oCAAY,EAAC,wBAAwB,CAAC,CAAC;AA0BtD,MAAa,sBAAsB;IAGjC,YACmB,EAAoB,EACrC,OAA4B;QADX,OAAE,GAAF,EAAE,CAAkB;QAGrC,IAAI,CAAC,OAAO,GAAG,O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C,EAAE;CACtC,CAAC;IACA,CAAC;IAED;;OAEG;IACK,sBAAsB,CAC5B,QAAgB,EAChB,QAAgB,EAChB,UAAmB;QAEnB,MAAM,OAAO,GAA4B;YACvC,UAAU,EAAE;gBACV,IAAI,EAAE,4BAA4B;gBAClC,KAAK,EAAE,mCAAmC;aAC3C;YACD,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,aAAa;YACtB,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE;SAC5C,CAAC;QAEF,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QACnD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAhLD,wDAgLC","sourcesContent":["/**\n * WebID Profile Repository\n *\n * 管理 WebID Profile 的托管,支持身份与存储分离架构\n */\n\nimport { eq } from 'drizzle-orm';\nimport type { IdentityDatabase } from './db';\nimport { getLoggerFor } from 'global-logger-factory';\n\nconst logger = getLoggerFor('WebIdProfileRepository');\n\nexport interface WebIdProfile {\n username: string;\n webidUrl: string;\n storageUrl?: string;\n storageMode: 'cloud' | 'local' | 'custom';\n oidcIssuer?: string;\n profileData?: Record<string, unknown>;\n accountId?: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface CreateWebIdProfileInput {\n username: string;\n storageMode?: 'cloud' | 'local' | 'custom';\n storageUrl?: string;\n accountId?: string;\n}\n\nexport interface UpdateStorageInput {\n storageUrl: string;\n storageMode?: 'cloud' | 'local' | 'custom';\n}\n\nexport class WebIdProfileRepository {\n private readonly baseUrl: string;\n\n constructor(\n private readonly db: IdentityDatabase,\n options: { baseUrl: string },\n ) {\n this.baseUrl = options.baseUrl.replace(/\\/$/, '');\n }\n\n /**\n * 创建 WebID Profile\n */\n async create(input: CreateWebIdProfileInput): Promise<WebIdProfile> {\n const { username, storageMode = 'cloud', storageUrl, accountId } = input;\n\n // 生成 WebID URL\n const webidUrl = `${this.baseUrl}/${username}/profile/card#me`;\n\n // 默认 storage URL\n const defaultStorageUrl = storageMode === 'cloud'\n ? `${this.baseUrl}/${username}/`\n : storageUrl;\n\n // 生成默认的 Profile 数据\n const profileData = this.generateDefaultProfile(username, webidUrl, defaultStorageUrl);\n\n const now = new Date();\n\n await this.db.insert(this.db.schema.webidProfiles).values({\n username,\n webidUrl,\n storageUrl: defaultStorageUrl,\n storageMode,\n oidcIssuer: this.baseUrl,\n profileData,\n accountId,\n createdAt: now,\n updatedAt: now,\n });\n\n logger.info(`Created WebID profile for ${username}: ${webidUrl}`);\n\n return {\n username,\n webidUrl,\n storageUrl: defaultStorageUrl,\n storageMode,\n oidcIssuer: this.baseUrl,\n profileData,\n accountId,\n createdAt: now,\n updatedAt: now,\n };\n }\n\n /**\n * 获取 WebID Profile\n */\n async get(username: string): Promise<WebIdProfile | null> {\n const results = await this.db\n .select()\n .from(this.db.schema.webidProfiles)\n .where(eq(this.db.schema.webidProfiles.username, username))\n .limit(1);\n\n if (results.length === 0) {\n return null;\n }\n\n const row = results[0];\n return {\n username: row.username,\n webidUrl: row.webidUrl,\n storageUrl: row.storageUrl ?? undefined,\n storageMode: (row.storageMode as 'cloud' | 'local' | 'custom') ?? 'cloud',\n oidcIssuer: row.oidcIssuer ?? undefined,\n profileData: row.profileData as Record<string, unknown> | undefined,\n accountId: row.accountId ?? undefined,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n }\n\n /**\n * 更新 Storage URL(用于 Local 节点更新指针)\n */\n async updateStorage(username: string, input: UpdateStorageInput): Promise<WebIdProfile | null> {\n const { storageUrl, storageMode } = input;\n\n const existing = await this.get(username);\n if (!existing) {\n return null;\n }\n\n // 更新 Profile 数据中的 storage\n const profileData = {\n ...(existing.profileData ?? {}),\n 'solid:storage': { '@id': storageUrl },\n };\n\n const now = new Date();\n\n await this.db\n .update(this.db.schema.webidProfiles)\n .set({\n storageUrl,\n storageMode: storageMode ?? existing.storageMode,\n profileData,\n updatedAt: now,\n })\n .where(eq(this.db.schema.webidProfiles.username, username));\n\n logger.info(`Updated storage for ${username}: ${storageUrl}`);\n\n return {\n ...existing,\n storageUrl,\n storageMode: storageMode ?? existing.storageMode,\n profileData,\n updatedAt: now,\n };\n }\n\n /**\n * 删除 WebID Profile\n */\n async delete(username: string): Promise<boolean> {\n const result = await this.db\n .delete(this.db.schema.webidProfiles)\n .where(eq(this.db.schema.webidProfiles.username, username));\n\n // drizzle 返回的结果格式因数据库而异\n return true;\n }\n\n /**\n * 生成 WebID Profile 的 Turtle 格式\n */\n generateProfileTurtle(profile: WebIdProfile): string {\n const { webidUrl, storageUrl, oidcIssuer } = profile;\n\n return `@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n\n<${webidUrl}>\n a foaf:Person;\n solid:oidcIssuer <${oidcIssuer}>${storageUrl ? `;\n solid:storage <${storageUrl}>` : ''}.\n`;\n }\n\n /**\n * 生成默认的 Profile 数据(JSON-LD 格式)\n */\n private generateDefaultProfile(\n username: string,\n webidUrl: string,\n storageUrl?: string,\n ): Record<string, unknown> {\n const profile: Record<string, unknown> = {\n '@context': {\n foaf: 'http://xmlns.com/foaf/0.1/',\n solid: 'http://www.w3.org/ns/solid/terms#',\n },\n '@id': webidUrl,\n '@type': 'foaf:Person',\n 'solid:oidcIssuer': { '@id': this.baseUrl },\n };\n\n if (storageUrl) {\n profile['solid:storage'] = { '@id': storageUrl };\n }\n\n return profile;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"WebIdProfileRepository.js","sourceRoot":"","sources":["../../../src/identity/drizzle/WebIdProfileRepository.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAiC;AACjC,6BAAkE;AAClE,iEAAqD;AAErD,MAAM,MAAM,GAAG,IAAA,oCAAY,EAAC,wBAAwB,CAAC,CAAC;AAgCtD,MAAa,sBAAsB;IAIjC,YAAmB,OAAsC;QACvD,IA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IAED;;OAEG;IACH,qBAAqB,CAAC,OAAqB;QACzC,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;QAErD,OAAO;;;GAGR,QAAQ;;wBAEa,UAAU,IAAI,UAAU,CAAC,CAAC,CAAC;qBAC9B,UAAU,GAAG,CAAC,CAAC,CAAC,EAAE;CACtC,CAAC;IACA,CAAC;IAED;;OAEG;IACK,sBAAsB,CAC5B,QAAgB,EAChB,QAAgB,EAChB,UAAmB;QAEnB,MAAM,OAAO,GAA4B;YACvC,UAAU,EAAE;gBACV,IAAI,EAAE,4BAA4B;gBAClC,KAAK,EAAE,mCAAmC;aAC3C;YACD,KAAK,EAAE,QAAQ;YACf,OAAO,EAAE,aAAa;YACtB,kBAAkB,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE;SAC5C,CAAC;QAEF,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QACnD,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAlLD,wDAkLC;AAED,SAAS,8BAA8B,CAAC,OAAsC;IAC5E,IAAI,OAAO,CAAC,aAAa,EAAE,CAAC;QAC1B,OAAO,IAAA,wBAAmB,EAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["/**\n * WebID Profile Repository\n *\n * 管理 WebID Profile 的托管,支持身份与存储分离架构\n */\n\nimport { eq } from 'drizzle-orm';\nimport { getIdentityDatabase, type IdentityDatabase } from './db';\nimport { getLoggerFor } from 'global-logger-factory';\n\nconst logger = getLoggerFor('WebIdProfileRepository');\n\nexport interface WebIdProfile {\n username: string;\n webidUrl: string;\n storageUrl?: string;\n storageMode: 'cloud' | 'local' | 'custom';\n oidcIssuer?: string;\n profileData?: Record<string, unknown>;\n accountId?: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface CreateWebIdProfileInput {\n username: string;\n storageMode?: 'cloud' | 'local' | 'custom';\n storageUrl?: string;\n accountId?: string;\n}\n\nexport interface UpdateStorageInput {\n storageUrl: string;\n storageMode?: 'cloud' | 'local' | 'custom';\n}\n\nexport interface WebIdProfileRepositoryOptions {\n baseUrl: string;\n db?: IdentityDatabase;\n identityDbUrl?: string;\n}\n\nexport class WebIdProfileRepository {\n private readonly baseUrl: string;\n private readonly db: IdentityDatabase;\n\n public constructor(options: WebIdProfileRepositoryOptions) {\n this.db = options.db ?? getIdentityDatabaseFromOptions(options);\n if (!options.baseUrl) {\n throw new Error('WebIdProfileRepository requires baseUrl.');\n }\n this.baseUrl = options.baseUrl.replace(/\\/$/, '');\n }\n\n /**\n * 创建 WebID Profile\n */\n async create(input: CreateWebIdProfileInput): Promise<WebIdProfile> {\n const { username, storageMode = 'cloud', storageUrl, accountId } = input;\n\n // 生成 WebID URL\n const webidUrl = `${this.baseUrl}/${username}/profile/card#me`;\n\n // 默认 storage URL\n const defaultStorageUrl = storageMode === 'cloud'\n ? `${this.baseUrl}/${username}/`\n : storageUrl;\n\n // 生成默认的 Profile 数据\n const profileData = this.generateDefaultProfile(username, webidUrl, defaultStorageUrl);\n\n const now = new Date();\n\n await this.db.insert(this.db.schema.webidProfiles).values({\n username,\n webidUrl,\n storageUrl: defaultStorageUrl,\n storageMode,\n oidcIssuer: this.baseUrl,\n profileData,\n accountId,\n createdAt: now,\n updatedAt: now,\n });\n\n logger.info(`Created WebID profile for ${username}: ${webidUrl}`);\n\n return {\n username,\n webidUrl,\n storageUrl: defaultStorageUrl,\n storageMode,\n oidcIssuer: this.baseUrl,\n profileData,\n accountId,\n createdAt: now,\n updatedAt: now,\n };\n }\n\n /**\n * 获取 WebID Profile\n */\n async get(username: string): Promise<WebIdProfile | null> {\n const results = await this.db\n .select()\n .from(this.db.schema.webidProfiles)\n .where(eq(this.db.schema.webidProfiles.username, username))\n .limit(1);\n\n if (results.length === 0) {\n return null;\n }\n\n const row = results[0];\n return {\n username: row.username,\n webidUrl: row.webidUrl,\n storageUrl: row.storageUrl ?? undefined,\n storageMode: (row.storageMode as 'cloud' | 'local' | 'custom') ?? 'cloud',\n oidcIssuer: row.oidcIssuer ?? undefined,\n profileData: row.profileData as Record<string, unknown> | undefined,\n accountId: row.accountId ?? undefined,\n createdAt: row.createdAt,\n updatedAt: row.updatedAt,\n };\n }\n\n /**\n * 更新 Storage URL(用于 Local 节点更新指针)\n */\n async updateStorage(username: string, input: UpdateStorageInput): Promise<WebIdProfile | null> {\n const { storageUrl, storageMode } = input;\n\n const existing = await this.get(username);\n if (!existing) {\n return null;\n }\n\n // 更新 Profile 数据中的 storage\n const profileData = {\n ...(existing.profileData ?? {}),\n 'solid:storage': { '@id': storageUrl },\n };\n\n const now = new Date();\n\n await this.db\n .update(this.db.schema.webidProfiles)\n .set({\n storageUrl,\n storageMode: storageMode ?? existing.storageMode,\n profileData,\n updatedAt: now,\n })\n .where(eq(this.db.schema.webidProfiles.username, username));\n\n logger.info(`Updated storage for ${username}: ${storageUrl}`);\n\n return {\n ...existing,\n storageUrl,\n storageMode: storageMode ?? existing.storageMode,\n profileData,\n updatedAt: now,\n };\n }\n\n /**\n * 删除 WebID Profile\n */\n async delete(username: string): Promise<boolean> {\n const result = await this.db\n .delete(this.db.schema.webidProfiles)\n .where(eq(this.db.schema.webidProfiles.username, username));\n\n // drizzle 返回的结果格式因数据库而异\n return true;\n }\n\n /**\n * 生成 WebID Profile 的 Turtle 格式\n */\n generateProfileTurtle(profile: WebIdProfile): string {\n const { webidUrl, storageUrl, oidcIssuer } = profile;\n\n return `@prefix foaf: <http://xmlns.com/foaf/0.1/>.\n@prefix solid: <http://www.w3.org/ns/solid/terms#>.\n\n<${webidUrl}>\n a foaf:Person;\n solid:oidcIssuer <${oidcIssuer}>${storageUrl ? `;\n solid:storage <${storageUrl}>` : ''}.\n`;\n }\n\n /**\n * 生成默认的 Profile 数据(JSON-LD 格式)\n */\n private generateDefaultProfile(\n username: string,\n webidUrl: string,\n storageUrl?: string,\n ): Record<string, unknown> {\n const profile: Record<string, unknown> = {\n '@context': {\n foaf: 'http://xmlns.com/foaf/0.1/',\n solid: 'http://www.w3.org/ns/solid/terms#',\n },\n '@id': webidUrl,\n '@type': 'foaf:Person',\n 'solid:oidcIssuer': { '@id': this.baseUrl },\n };\n\n if (storageUrl) {\n profile['solid:storage'] = { '@id': storageUrl };\n }\n\n return profile;\n }\n}\n\nfunction getIdentityDatabaseFromOptions(options: WebIdProfileRepositoryOptions): IdentityDatabase {\n if (options.identityDbUrl) {\n return getIdentityDatabase(options.identityDbUrl);\n }\n\n throw new Error('WebIdProfileRepository requires db or identityDbUrl.');\n}\n"]}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld"
|
|
4
|
+
],
|
|
5
|
+
"@id": "npmd:@undefineds.co/xpod",
|
|
6
|
+
"components": [
|
|
7
|
+
{
|
|
8
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository",
|
|
9
|
+
"@type": "Class",
|
|
10
|
+
"requireElement": "WebIdProfileRepository",
|
|
11
|
+
"parameters": [
|
|
12
|
+
{
|
|
13
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options_baseUrl",
|
|
14
|
+
"range": "xsd:string"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options_db",
|
|
18
|
+
"range": {
|
|
19
|
+
"@type": "ParameterRangeUnion",
|
|
20
|
+
"parameterRangeElements": [
|
|
21
|
+
{
|
|
22
|
+
"@type": "ParameterRangeWildcard"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"@type": "ParameterRangeUndefined"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options_identityDbUrl",
|
|
32
|
+
"range": {
|
|
33
|
+
"@type": "ParameterRangeUnion",
|
|
34
|
+
"parameterRangeElements": [
|
|
35
|
+
"xsd:string",
|
|
36
|
+
{
|
|
37
|
+
"@type": "ParameterRangeUndefined"
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
"memberFields": [
|
|
44
|
+
{
|
|
45
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_baseUrl",
|
|
46
|
+
"memberFieldName": "baseUrl"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_db",
|
|
50
|
+
"memberFieldName": "db"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_constructor",
|
|
54
|
+
"memberFieldName": "constructor"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_create",
|
|
58
|
+
"memberFieldName": "create"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_get",
|
|
62
|
+
"memberFieldName": "get"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_updateStorage",
|
|
66
|
+
"memberFieldName": "updateStorage"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_delete",
|
|
70
|
+
"memberFieldName": "delete"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_generateProfileTurtle",
|
|
74
|
+
"memberFieldName": "generateProfileTurtle"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository__member_generateDefaultProfile",
|
|
78
|
+
"memberFieldName": "generateDefaultProfile"
|
|
79
|
+
}
|
|
80
|
+
],
|
|
81
|
+
"constructorArguments": [
|
|
82
|
+
{
|
|
83
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options__constructorArgument",
|
|
84
|
+
"fields": [
|
|
85
|
+
{
|
|
86
|
+
"keyRaw": "baseUrl",
|
|
87
|
+
"value": {
|
|
88
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options_baseUrl"
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"keyRaw": "db",
|
|
93
|
+
"value": {
|
|
94
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options_db"
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"keyRaw": "identityDbUrl",
|
|
99
|
+
"value": {
|
|
100
|
+
"@id": "undefineds:dist/identity/drizzle/WebIdProfileRepository.jsonld#WebIdProfileRepository_options_identityDbUrl"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Adapter } from 'oidc-provider';
|
|
2
|
+
import { ClientIdAdapterFactory, type AdapterFactory, type RepresentationConverter } from '@solid/community-server';
|
|
3
|
+
export declare class LoopbackClientIdAdapterFactory extends ClientIdAdapterFactory {
|
|
4
|
+
private readonly loopbackConverter;
|
|
5
|
+
constructor(source: AdapterFactory, converter: RepresentationConverter);
|
|
6
|
+
createStorageAdapter(name: string): Adapter;
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LoopbackClientIdAdapterFactory = void 0;
|
|
4
|
+
const community_server_1 = require("@solid/community-server");
|
|
5
|
+
function isLoopbackRedirectUri(value) {
|
|
6
|
+
try {
|
|
7
|
+
const url = new URL(value);
|
|
8
|
+
return url.protocol === 'http:' &&
|
|
9
|
+
(url.hostname === '127.0.0.1' || url.hostname === 'localhost' || url.hostname === '[::1]');
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function isNativeClientPayload(payload) {
|
|
16
|
+
if (payload.application_type === 'native') {
|
|
17
|
+
return true;
|
|
18
|
+
}
|
|
19
|
+
const redirectUris = Array.isArray(payload.redirect_uris) ? payload.redirect_uris : [];
|
|
20
|
+
return redirectUris.some((uri) => typeof uri === 'string' && isLoopbackRedirectUri(uri));
|
|
21
|
+
}
|
|
22
|
+
class LoopbackClientIdAdapter extends community_server_1.ClientIdAdapter {
|
|
23
|
+
async find(id) {
|
|
24
|
+
const payload = await super.find(id);
|
|
25
|
+
if (!payload) {
|
|
26
|
+
return payload;
|
|
27
|
+
}
|
|
28
|
+
if (isNativeClientPayload(payload)) {
|
|
29
|
+
return {
|
|
30
|
+
...payload,
|
|
31
|
+
application_type: 'native',
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return payload;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
class LoopbackClientIdAdapterFactory extends community_server_1.ClientIdAdapterFactory {
|
|
38
|
+
constructor(source, converter) {
|
|
39
|
+
super(source, converter);
|
|
40
|
+
this.loopbackConverter = converter;
|
|
41
|
+
}
|
|
42
|
+
createStorageAdapter(name) {
|
|
43
|
+
const adapter = this.source.createStorageAdapter(name);
|
|
44
|
+
return new LoopbackClientIdAdapter(name, adapter, this.loopbackConverter);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.LoopbackClientIdAdapterFactory = LoopbackClientIdAdapterFactory;
|
|
48
|
+
//# sourceMappingURL=LoopbackClientIdAdapterFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoopbackClientIdAdapterFactory.js","sourceRoot":"","sources":["../../../src/identity/oidc/LoopbackClientIdAdapterFactory.ts"],"names":[],"mappings":";;;AACA,8DAKiC;AAEjC,SAAS,qBAAqB,CAAC,KAAa;IAC1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;QAC3B,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO;YAC7B,CAAC,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,WAAW,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;IAC/F,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,SAAS,qBAAqB,CAAC,OAAuB;IACpD,IAAI,OAAO,CAAC,gBAAgB,KAAK,QAAQ,EAAE,CAAC;QAC1C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC;IACvF,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,IAAI,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3F,CAAC;AAED,MAAM,uBAAwB,SAAQ,kCAAe;IACnC,KAAK,CAAC,IAAI,CAAC,EAAU;QACnC,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACrC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,IAAI,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC;YACnC,OAAO;gBACL,GAAG,OAAO;gBACV,gBAAgB,EAAE,QAAQ;aAC3B,CAAC;QACJ,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAED,MAAa,8BAA+B,SAAQ,yCAAsB;IAGxE,YAAmB,MAAsB,EAAE,SAAkC;QAC3E,KAAK,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACzB,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACrC,CAAC;IAEe,oBAAoB,CAAC,IAAY;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACvD,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC5E,CAAC;CACF;AAZD,wEAYC","sourcesContent":["import type { Adapter, AdapterPayload } from 'oidc-provider';\nimport {\n ClientIdAdapter,\n ClientIdAdapterFactory,\n type AdapterFactory,\n type RepresentationConverter,\n} from '@solid/community-server';\n\nfunction isLoopbackRedirectUri(value: string): boolean {\n try {\n const url = new URL(value);\n return url.protocol === 'http:' &&\n (url.hostname === '127.0.0.1' || url.hostname === 'localhost' || url.hostname === '[::1]');\n } catch {\n return false;\n }\n}\n\nfunction isNativeClientPayload(payload: AdapterPayload): boolean {\n if (payload.application_type === 'native') {\n return true;\n }\n\n const redirectUris = Array.isArray(payload.redirect_uris) ? payload.redirect_uris : [];\n return redirectUris.some((uri) => typeof uri === 'string' && isLoopbackRedirectUri(uri));\n}\n\nclass LoopbackClientIdAdapter extends ClientIdAdapter {\n public override async find(id: string): Promise<AdapterPayload | void> {\n const payload = await super.find(id);\n if (!payload) {\n return payload;\n }\n\n if (isNativeClientPayload(payload)) {\n return {\n ...payload,\n application_type: 'native',\n };\n }\n\n return payload;\n }\n}\n\nexport class LoopbackClientIdAdapterFactory extends ClientIdAdapterFactory {\n private readonly loopbackConverter: RepresentationConverter;\n\n public constructor(source: AdapterFactory, converter: RepresentationConverter) {\n super(source, converter);\n this.loopbackConverter = converter;\n }\n\n public override createStorageAdapter(name: string): Adapter {\n const adapter = this.source.createStorageAdapter(name);\n return new LoopbackClientIdAdapter(name, adapter, this.loopbackConverter);\n }\n}\n"]}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"@context": [
|
|
3
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@undefineds.co/xpod/^0.0.0/components/context.jsonld",
|
|
4
|
+
"https://linkedsoftwaredependencies.org/bundles/npm/@solid/community-server/^8.0.0/components/context.jsonld"
|
|
5
|
+
],
|
|
6
|
+
"@id": "npmd:@undefineds.co/xpod",
|
|
7
|
+
"components": [
|
|
8
|
+
{
|
|
9
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory",
|
|
10
|
+
"@type": "Class",
|
|
11
|
+
"requireElement": "LoopbackClientIdAdapterFactory",
|
|
12
|
+
"extends": [
|
|
13
|
+
"ClientIdAdapter:Factory"
|
|
14
|
+
],
|
|
15
|
+
"parameters": [
|
|
16
|
+
{
|
|
17
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory_source",
|
|
18
|
+
"range": "css:dist/identity/storage/AdapterFactory.jsonld#AdapterFactory"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory_converter",
|
|
22
|
+
"range": "css:dist/storage/conversion/RepresentationConverter.jsonld#RepresentationConverter"
|
|
23
|
+
}
|
|
24
|
+
],
|
|
25
|
+
"memberFields": [
|
|
26
|
+
{
|
|
27
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory__member_loopbackConverter",
|
|
28
|
+
"memberFieldName": "loopbackConverter"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory__member_constructor",
|
|
32
|
+
"memberFieldName": "constructor"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory__member_createStorageAdapter",
|
|
36
|
+
"memberFieldName": "createStorageAdapter"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"constructorArguments": [
|
|
40
|
+
{
|
|
41
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory_source"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"@id": "undefineds:dist/identity/oidc/LoopbackClientIdAdapterFactory.jsonld#LoopbackClientIdAdapterFactory_converter"
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { TerminalHttpHandler } from './http/terminal/TerminalHttpHandler';
|
|
|
21
21
|
import { EdgeNodeCertificateHttpHandler } from './http/admin/EdgeNodeCertificateHttpHandler';
|
|
22
22
|
import { ReservedSuffixIdentifierGenerator } from './pods/ReservedSuffixIdentifierGenerator';
|
|
23
23
|
import { DrizzleIndexedStorage } from './identity/drizzle/DrizzleIndexedStorage';
|
|
24
|
+
import { WebIdProfileRepository } from './identity/drizzle/WebIdProfileRepository';
|
|
24
25
|
import { PostgresKeyValueStorage } from './storage/keyvalue/PostgresKeyValueStorage';
|
|
25
26
|
import { RedisKeyValueStorage } from './storage/keyvalue/RedisKeyValueStorage';
|
|
26
27
|
import { SqliteKeyValueStorage } from './storage/keyvalue/SqliteKeyValueStorage';
|
|
@@ -66,6 +67,7 @@ import { DisabledOidcHandler } from './identity/oidc/DisabledOidcHandler';
|
|
|
66
67
|
import { DisabledIdentityProviderHandler } from './identity/oidc/DisabledIdentityProviderHandler';
|
|
67
68
|
import { AutoDetectOidcHandler } from './identity/oidc/AutoDetectOidcHandler';
|
|
68
69
|
import { AutoDetectIdentityProviderHandler } from './identity/oidc/AutoDetectIdentityProviderHandler';
|
|
70
|
+
import { LoopbackClientIdAdapterFactory } from './identity/oidc/LoopbackClientIdAdapterFactory';
|
|
69
71
|
import { ProvisionPodCreator } from './provision/ProvisionPodCreator';
|
|
70
72
|
import { ProvisionCodeCodec } from './provision/ProvisionCodeCodec';
|
|
71
73
|
import { AuthModeSelector } from './authorization/AuthModeSelector';
|
|
@@ -77,4 +79,4 @@ export type { EntitlementProvider, AccountEntitlement } from './quota/Entitlemen
|
|
|
77
79
|
export type { TunnelProvider, TunnelConfig, TunnelSetupOptions, TunnelStatus, } from './tunnel/TunnelProvider';
|
|
78
80
|
export type { SubdomainRegistration, ConnectivityResult, SubdomainServiceOptions, } from './subdomain/SubdomainService';
|
|
79
81
|
export { AppStaticAssetHandler } from './http/AppStaticAssetHandler';
|
|
80
|
-
export { RepresentationPartialConvertingStore, MinioDataAccessor, QuadstoreSparqlDataAccessor, QuintStoreSparqlDataAccessor, MixDataAccessor, ConfigurableLoggerFactory, SparqlUpdateResourceStore, SubgraphQueryEngine, QuadstoreSparqlEngine, QuintstoreSparqlEngine, SubgraphSparqlHttpHandler, QuotaAdminHttpHandler, ClusterIngressRouter, ClusterWebSocketConfigurator, EdgeNodeDirectDebugHttpHandler, EdgeNodeProxyHttpHandler, RouterHttpHandler, RouterHttpRoute, TracingHandler, EdgeNodeCertificateHttpHandler, TerminalHttpHandler, ReservedSuffixIdentifierGenerator, DrizzleIndexedStorage, PostgresKeyValueStorage, RedisKeyValueStorage, SqliteKeyValueStorage, DrizzleQuotaService, NoopQuotaService, HttpEntitlementProvider, NoopEntitlementProvider, PerAccountQuotaStrategy, TencentDnsProvider, EdgeNodeDnsCoordinator, Dns01CertificateProvisioner, SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager, FrpTunnelManager, EdgeNodeHealthProbeService, EdgeNodeAgent, EdgeNodeCertificateService, AcmeCertificateManager, EdgeNodeModeDetector, ClusterIdentifierStrategy, UsageTrackingStore, CenterNodeRegistrationService, PodRoutingHttpHandler, ReactAppViewHandler, QuintStore, SqliteQuintStore, PgQuintStore, BaseQuintStore, VectorStore, SqliteVectorStore, PostgresVectorStore, VectorHttpHandler, ProviderRegistry, ProviderRegistryImpl, EmbeddingService, EmbeddingServiceImpl, CredentialReader, CredentialReaderImpl, CloudflareTunnelProvider, LocalTunnelProvider, SubdomainService, MultiDomainIdentifierStrategy, SubdomainPodIdentifierStrategy, DisabledOidcHandler, DisabledIdentityProviderHandler, AutoDetectOidcHandler, AutoDetectIdentityProviderHandler, UrlAwareRedisLocker, ProvisionPodCreator, ProvisionCodeCodec, AuthModeSelector, };
|
|
82
|
+
export { RepresentationPartialConvertingStore, MinioDataAccessor, QuadstoreSparqlDataAccessor, QuintStoreSparqlDataAccessor, MixDataAccessor, ConfigurableLoggerFactory, SparqlUpdateResourceStore, SubgraphQueryEngine, QuadstoreSparqlEngine, QuintstoreSparqlEngine, SubgraphSparqlHttpHandler, QuotaAdminHttpHandler, ClusterIngressRouter, ClusterWebSocketConfigurator, EdgeNodeDirectDebugHttpHandler, EdgeNodeProxyHttpHandler, RouterHttpHandler, RouterHttpRoute, TracingHandler, EdgeNodeCertificateHttpHandler, TerminalHttpHandler, ReservedSuffixIdentifierGenerator, DrizzleIndexedStorage, WebIdProfileRepository, PostgresKeyValueStorage, RedisKeyValueStorage, SqliteKeyValueStorage, DrizzleQuotaService, NoopQuotaService, HttpEntitlementProvider, NoopEntitlementProvider, PerAccountQuotaStrategy, TencentDnsProvider, EdgeNodeDnsCoordinator, Dns01CertificateProvisioner, SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager, FrpTunnelManager, EdgeNodeHealthProbeService, EdgeNodeAgent, EdgeNodeCertificateService, AcmeCertificateManager, EdgeNodeModeDetector, ClusterIdentifierStrategy, UsageTrackingStore, CenterNodeRegistrationService, PodRoutingHttpHandler, ReactAppViewHandler, QuintStore, SqliteQuintStore, PgQuintStore, BaseQuintStore, VectorStore, SqliteVectorStore, PostgresVectorStore, VectorHttpHandler, ProviderRegistry, ProviderRegistryImpl, EmbeddingService, EmbeddingServiceImpl, CredentialReader, CredentialReaderImpl, CloudflareTunnelProvider, LocalTunnelProvider, SubdomainService, MultiDomainIdentifierStrategy, SubdomainPodIdentifierStrategy, DisabledOidcHandler, DisabledIdentityProviderHandler, AutoDetectOidcHandler, AutoDetectIdentityProviderHandler, LoopbackClientIdAdapterFactory, UrlAwareRedisLocker, ProvisionPodCreator, ProvisionCodeCodec, AuthModeSelector, };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.AuthModeSelector = exports.ProvisionCodeCodec = exports.ProvisionPodCreator = exports.UrlAwareRedisLocker = exports.AutoDetectIdentityProviderHandler = exports.AutoDetectOidcHandler = exports.DisabledIdentityProviderHandler = exports.DisabledOidcHandler = exports.SubdomainPodIdentifierStrategy = exports.MultiDomainIdentifierStrategy = exports.SubdomainService = exports.LocalTunnelProvider = exports.CloudflareTunnelProvider = exports.CredentialReaderImpl = exports.CredentialReader = exports.EmbeddingServiceImpl = exports.EmbeddingService = exports.ProviderRegistryImpl = exports.ProviderRegistry = exports.VectorHttpHandler = exports.PostgresVectorStore = exports.SqliteVectorStore = exports.VectorStore = exports.BaseQuintStore = exports.PgQuintStore = void 0;
|
|
3
|
+
exports.QuintStore = exports.ReactAppViewHandler = exports.PodRoutingHttpHandler = exports.CenterNodeRegistrationService = exports.UsageTrackingStore = exports.ClusterIdentifierStrategy = exports.EdgeNodeModeDetector = exports.AcmeCertificateManager = exports.EdgeNodeCertificateService = exports.EdgeNodeAgent = exports.EdgeNodeHealthProbeService = exports.FrpTunnelManager = exports.NoopEdgeNodeTunnelManager = exports.SimpleEdgeNodeTunnelManager = exports.Dns01CertificateProvisioner = exports.EdgeNodeDnsCoordinator = exports.TencentDnsProvider = exports.PerAccountQuotaStrategy = exports.NoopEntitlementProvider = exports.HttpEntitlementProvider = exports.NoopQuotaService = exports.DrizzleQuotaService = exports.SqliteKeyValueStorage = exports.RedisKeyValueStorage = exports.PostgresKeyValueStorage = exports.WebIdProfileRepository = exports.DrizzleIndexedStorage = exports.ReservedSuffixIdentifierGenerator = exports.TerminalHttpHandler = exports.EdgeNodeCertificateHttpHandler = exports.TracingHandler = exports.RouterHttpRoute = exports.RouterHttpHandler = exports.EdgeNodeProxyHttpHandler = exports.EdgeNodeDirectDebugHttpHandler = exports.ClusterWebSocketConfigurator = exports.ClusterIngressRouter = exports.QuotaAdminHttpHandler = exports.SubgraphSparqlHttpHandler = exports.QuintstoreSparqlEngine = exports.QuadstoreSparqlEngine = exports.SubgraphQueryEngine = exports.SparqlUpdateResourceStore = exports.ConfigurableLoggerFactory = exports.MixDataAccessor = exports.QuintStoreSparqlDataAccessor = exports.QuadstoreSparqlDataAccessor = exports.MinioDataAccessor = exports.RepresentationPartialConvertingStore = exports.AppStaticAssetHandler = void 0;
|
|
4
|
+
exports.AuthModeSelector = exports.ProvisionCodeCodec = exports.ProvisionPodCreator = exports.UrlAwareRedisLocker = exports.LoopbackClientIdAdapterFactory = exports.AutoDetectIdentityProviderHandler = exports.AutoDetectOidcHandler = exports.DisabledIdentityProviderHandler = exports.DisabledOidcHandler = exports.SubdomainPodIdentifierStrategy = exports.MultiDomainIdentifierStrategy = exports.SubdomainService = exports.LocalTunnelProvider = exports.CloudflareTunnelProvider = exports.CredentialReaderImpl = exports.CredentialReader = exports.EmbeddingServiceImpl = exports.EmbeddingService = exports.ProviderRegistryImpl = exports.ProviderRegistry = exports.VectorHttpHandler = exports.PostgresVectorStore = exports.SqliteVectorStore = exports.VectorStore = exports.BaseQuintStore = exports.PgQuintStore = exports.SqliteQuintStore = void 0;
|
|
5
5
|
require("./runtime/configure-drizzle-solid");
|
|
6
6
|
const RepresentationPartialConvertingStore_1 = require("./storage/RepresentationPartialConvertingStore");
|
|
7
7
|
Object.defineProperty(exports, "RepresentationPartialConvertingStore", { enumerable: true, get: function () { return RepresentationPartialConvertingStore_1.RepresentationPartialConvertingStore; } });
|
|
@@ -47,6 +47,8 @@ const ReservedSuffixIdentifierGenerator_1 = require("./pods/ReservedSuffixIdenti
|
|
|
47
47
|
Object.defineProperty(exports, "ReservedSuffixIdentifierGenerator", { enumerable: true, get: function () { return ReservedSuffixIdentifierGenerator_1.ReservedSuffixIdentifierGenerator; } });
|
|
48
48
|
const DrizzleIndexedStorage_1 = require("./identity/drizzle/DrizzleIndexedStorage");
|
|
49
49
|
Object.defineProperty(exports, "DrizzleIndexedStorage", { enumerable: true, get: function () { return DrizzleIndexedStorage_1.DrizzleIndexedStorage; } });
|
|
50
|
+
const WebIdProfileRepository_1 = require("./identity/drizzle/WebIdProfileRepository");
|
|
51
|
+
Object.defineProperty(exports, "WebIdProfileRepository", { enumerable: true, get: function () { return WebIdProfileRepository_1.WebIdProfileRepository; } });
|
|
50
52
|
const PostgresKeyValueStorage_1 = require("./storage/keyvalue/PostgresKeyValueStorage");
|
|
51
53
|
Object.defineProperty(exports, "PostgresKeyValueStorage", { enumerable: true, get: function () { return PostgresKeyValueStorage_1.PostgresKeyValueStorage; } });
|
|
52
54
|
const RedisKeyValueStorage_1 = require("./storage/keyvalue/RedisKeyValueStorage");
|
|
@@ -143,6 +145,8 @@ const AutoDetectOidcHandler_1 = require("./identity/oidc/AutoDetectOidcHandler")
|
|
|
143
145
|
Object.defineProperty(exports, "AutoDetectOidcHandler", { enumerable: true, get: function () { return AutoDetectOidcHandler_1.AutoDetectOidcHandler; } });
|
|
144
146
|
const AutoDetectIdentityProviderHandler_1 = require("./identity/oidc/AutoDetectIdentityProviderHandler");
|
|
145
147
|
Object.defineProperty(exports, "AutoDetectIdentityProviderHandler", { enumerable: true, get: function () { return AutoDetectIdentityProviderHandler_1.AutoDetectIdentityProviderHandler; } });
|
|
148
|
+
const LoopbackClientIdAdapterFactory_1 = require("./identity/oidc/LoopbackClientIdAdapterFactory");
|
|
149
|
+
Object.defineProperty(exports, "LoopbackClientIdAdapterFactory", { enumerable: true, get: function () { return LoopbackClientIdAdapterFactory_1.LoopbackClientIdAdapterFactory; } });
|
|
146
150
|
// Provision components
|
|
147
151
|
const ProvisionPodCreator_1 = require("./provision/ProvisionPodCreator");
|
|
148
152
|
Object.defineProperty(exports, "ProvisionPodCreator", { enumerable: true, get: function () { return ProvisionPodCreator_1.ProvisionPodCreator; } });
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,6CAA2C;AAC3C,yGAAsG;AAyGlG,qHAzGK,2EAAoC,OAyGL;AAxGxC,6EAA0E;AAyGtE,kGAzGK,qCAAiB,OAyGL;AAxGrB,iGAA8F;AAyG1F,4GAzGK,yDAA2B,OAyGL;AAxG/B,mGAAgG;AAyG5F,6GAzGK,2DAA4B,OAyGL;AAxGhC,yEAAsE;AAyGlE,gGAzGK,iCAAe,OAyGL;AAxGnB,mFAAgF;AAyG5E,0GAzGK,qDAAyB,OAyGL;AAxG7B,8EAA0H;AA0GtH,oGA1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,oEAAiE;AA8G/D,iGA9GO,mCAAgB,OA8GP;AA7GlB,4EAAyE;AA8GvE,qGA9GO,2CAAoB,OA8GP;AA7GtB,8DAA2D;AAmGzD,4FAnGO,yBAAW,OAmGP;AAlGb,kCAAkC;AAClC,gFAA6E;AA6G3E,yGA7GO,mDAAwB,OA6GP;AA5G1B,sEAAmE;AA6GjE,oGA7GO,yCAAmB,OA6GP;AA5GrB,mEAAgE;AA6G9D,iGA7GO,mCAAgB,OA6GP;AA5GlB,+EAA4E;AAoH1E,oGApHO,yCAAmB,OAoHP;AAnHrB,+BAA+B;AAC/B,oGAAiG;AA4G/F,8GA5GO,6DAA6B,OA4GP;AA3G/B,sGAAmG;AA4GjG,+GA5GO,+DAA8B,OA4GP;AA3GhC,6EAA0E;AA4GxE,oGA5GO,yCAAmB,OA4GP;AA3GrB,qGAAkG;AA4GhG,gHA5GO,iEAA+B,OA4GP;AA3GjC,iFAA8E;AA4G5E,sGA5GO,6CAAqB,OA4GP;AA3GvB,yGAAsG;AA4GpG,kHA5GO,qEAAiC,OA4GP;AA3GnC,uBAAuB;AACvB,yEAAsE;AA6GpE,oGA7GO,yCAAmB,OA6GP;AA5GrB,uEAAoE;AA6GlE,mGA7GO,uCAAkB,OA6GP;AA5GpB,2BAA2B;AAC3B,uEAAoE;AA6GlE,iGA7GO,mCAAgB,OA6GP;AApFlB,uCAAuC;AACvC,sEAAqE;AAA5D,8HAAA,qBAAqB,OAAA","sourcesContent":["import './runtime/configure-drizzle-solid';\nimport { RepresentationPartialConvertingStore } from './storage/RepresentationPartialConvertingStore';\nimport { MinioDataAccessor } from './storage/accessors/MinioDataAccessor';\nimport { QuadstoreSparqlDataAccessor } from './storage/accessors/QuadstoreSparqlDataAccessor';\nimport { QuintStoreSparqlDataAccessor } from './storage/accessors/QuintStoreSparqlDataAccessor';\nimport { MixDataAccessor } from './storage/accessors/MixDataAccessor';\nimport { ConfigurableLoggerFactory } from './logging/ConfigurableLoggerFactory';\nimport { SubgraphQueryEngine, QuadstoreSparqlEngine, QuintstoreSparqlEngine } from './storage/sparql/SubgraphQueryEngine';\nexport type { SparqlEngine } from './storage/sparql/SubgraphQueryEngine';\nimport { SubgraphSparqlHttpHandler } from './http/SubgraphSparqlHttpHandler';\nimport { QuotaAdminHttpHandler } from './http/quota/QuotaAdminHttpHandler';\nimport { SparqlUpdateResourceStore } from './storage/SparqlUpdateResourceStore';\nimport { ClusterIngressRouter } from './http/ClusterIngressRouter';\nimport { ClusterWebSocketConfigurator } from './http/ClusterWebSocketConfigurator';\nimport { EdgeNodeDirectDebugHttpHandler } from './http/EdgeNodeDirectDebugHttpHandler';\nimport { EdgeNodeProxyHttpHandler } from './http/EdgeNodeProxyHttpHandler';\nimport { RouterHttpHandler } from './http/RouterHttpHandler';\nimport { RouterHttpRoute } from './http/RouterHttpRoute';\nimport { TracingHandler } from './http/TracingHandler';\nimport { TerminalHttpHandler } from './http/terminal/TerminalHttpHandler';\nimport { EdgeNodeCertificateHttpHandler } from './http/admin/EdgeNodeCertificateHttpHandler';\nimport { ReservedSuffixIdentifierGenerator } from './pods/ReservedSuffixIdentifierGenerator';\nimport { DrizzleIndexedStorage } from './identity/drizzle/DrizzleIndexedStorage';\nimport { PostgresKeyValueStorage } from './storage/keyvalue/PostgresKeyValueStorage';\nimport { RedisKeyValueStorage } from './storage/keyvalue/RedisKeyValueStorage';\nimport { SqliteKeyValueStorage } from './storage/keyvalue/SqliteKeyValueStorage';\nimport { DrizzleQuotaService } from './quota/DrizzleQuotaService';\nimport { NoopQuotaService } from './quota/NoopQuotaService';\nimport { HttpEntitlementProvider, NoopEntitlementProvider } from './quota/EntitlementProvider';\nimport { PerAccountQuotaStrategy } from './storage/quota/PerAccountQuotaStrategy';\nimport { TencentDnsProvider } from './dns/tencent/TencentDnsProvider';\nimport { EdgeNodeDnsCoordinator } from './edge/EdgeNodeDnsCoordinator';\nimport { Dns01CertificateProvisioner } from './edge/Dns01CertificateProvisioner';\nimport { SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager } from './edge/EdgeNodeTunnelManager';\nimport { FrpTunnelManager } from './edge/FrpTunnelManager';\nimport { AcmeCertificateManager } from './edge/acme/AcmeCertificateManager';\nimport { EdgeNodeHealthProbeService } from './edge/EdgeNodeHealthProbeService';\nimport { EdgeNodeAgent } from './edge/EdgeNodeAgent';\nimport { EdgeNodeCertificateService } from './service/EdgeNodeCertificateService';\nimport { createBandwidthThrottleTransform } from './util/stream/BandwidthThrottleTransform';\nimport { UsageTrackingStore } from './storage/quota/UsageTrackingStore';\nimport { EdgeNodeModeDetector } from './edge/EdgeNodeModeDetector';\nimport { ClusterIdentifierStrategy } from './util/identifiers/ClusterIdentifierStrategy';\nimport { CenterNodeRegistrationService } from './identity/CenterNodeRegistrationService';\nimport { PodRoutingHttpHandler } from './http/PodRoutingHttpHandler';\nimport { ReactAppViewHandler } from './identity/ReactAppViewHandler';\nimport { SqliteQuintStore } from './storage/quint/SqliteQuintStore';\nimport { PgQuintStore } from './storage/quint/PgQuintStore';\nimport { BaseQuintStore } from './storage/quint/BaseQuintStore';\nimport { QuintStore } from './storage/quint/types';\nimport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\n// Vector components\nimport { SqliteVectorStore, PostgresVectorStore } from './storage/vector/index';\nimport { VectorHttpHandler } from './http/vector/VectorHttpHandler';\nimport { ProviderRegistry } from './ai/service/ProviderRegistry';\nimport { ProviderRegistryImpl } from './ai/service/ProviderRegistryImpl';\nimport { EmbeddingService } from './ai/service/EmbeddingService';\nimport { EmbeddingServiceImpl } from './ai/service/EmbeddingServiceImpl';\nimport { CredentialReader } from './ai/service/CredentialReader';\nimport { CredentialReaderImpl } from './ai/service/CredentialReaderImpl';\nimport { VectorStore } from './storage/vector/VectorStore';\n// Tunnel and Subdomain components\nimport { CloudflareTunnelProvider } from './tunnel/CloudflareTunnelProvider';\nimport { LocalTunnelProvider } from './tunnel/LocalTunnelProvider';\nimport { SubdomainService } from './subdomain/SubdomainService';\nimport { UrlAwareRedisLocker } from './storage/locking/UrlAwareRedisLocker';\n// IdP/SP separation components\nimport { MultiDomainIdentifierStrategy } from './util/identifiers/MultiDomainIdentifierStrategy';\nimport { SubdomainPodIdentifierStrategy } from './util/identifiers/SubdomainPodIdentifierStrategy';\nimport { DisabledOidcHandler } from './identity/oidc/DisabledOidcHandler';\nimport { DisabledIdentityProviderHandler } from './identity/oidc/DisabledIdentityProviderHandler';\nimport { AutoDetectOidcHandler } from './identity/oidc/AutoDetectOidcHandler';\nimport { AutoDetectIdentityProviderHandler } from './identity/oidc/AutoDetectIdentityProviderHandler';\n// Provision components\nimport { ProvisionPodCreator } from './provision/ProvisionPodCreator';\nimport { ProvisionCodeCodec } from './provision/ProvisionCodeCodec';\n// Authorization components\nimport { AuthModeSelector } from './authorization/AuthModeSelector';\nexport type {\n DnsProvider,\n ListDnsRecordsInput,\n ListableDnsProvider,\n DeleteDnsRecordInput,\n DnsRecordSummary,\n UpsertDnsRecordInput,\n} from './dns/DnsProvider';\nexport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\nexport type { EdgeNodeTunnelManager } from './edge/interfaces/EdgeNodeTunnelManager';\nexport type { QuotaService, AccountQuota } from './quota/QuotaService';\nexport type { EntitlementProvider, AccountEntitlement } from './quota/EntitlementProvider';\n// Tunnel and Subdomain types\nexport type {\n TunnelProvider,\n TunnelConfig,\n TunnelSetupOptions,\n TunnelStatus,\n} from './tunnel/TunnelProvider';\nexport type {\n SubdomainRegistration,\n ConnectivityResult,\n SubdomainServiceOptions,\n} from './subdomain/SubdomainService';\n// Export the new AppStaticAssetHandler\nexport { AppStaticAssetHandler } from './http/AppStaticAssetHandler';\n\nexport { \n RepresentationPartialConvertingStore,\n MinioDataAccessor, \n QuadstoreSparqlDataAccessor,\n QuintStoreSparqlDataAccessor,\n MixDataAccessor,\n ConfigurableLoggerFactory,\n SparqlUpdateResourceStore,\n SubgraphQueryEngine,\n QuadstoreSparqlEngine,\n QuintstoreSparqlEngine,\n SubgraphSparqlHttpHandler,\n QuotaAdminHttpHandler,\n ClusterIngressRouter,\n ClusterWebSocketConfigurator,\n EdgeNodeDirectDebugHttpHandler,\n EdgeNodeProxyHttpHandler,\n RouterHttpHandler,\n RouterHttpRoute,\n TracingHandler,\n EdgeNodeCertificateHttpHandler,\n TerminalHttpHandler,\n ReservedSuffixIdentifierGenerator,\n DrizzleIndexedStorage,\n PostgresKeyValueStorage,\n RedisKeyValueStorage,\n SqliteKeyValueStorage,\n DrizzleQuotaService,\n NoopQuotaService,\n HttpEntitlementProvider,\n NoopEntitlementProvider,\n PerAccountQuotaStrategy,\n TencentDnsProvider,\n EdgeNodeDnsCoordinator,\n Dns01CertificateProvisioner,\n SimpleEdgeNodeTunnelManager,\n NoopEdgeNodeTunnelManager,\n FrpTunnelManager,\n EdgeNodeHealthProbeService,\n EdgeNodeAgent,\n EdgeNodeCertificateService,\n AcmeCertificateManager,\n EdgeNodeModeDetector,\n ClusterIdentifierStrategy,\n UsageTrackingStore,\n CenterNodeRegistrationService,\n PodRoutingHttpHandler,\n ReactAppViewHandler,\n // Quint exports\n QuintStore,\n SqliteQuintStore,\n PgQuintStore,\n BaseQuintStore,\n // Vector exports\n VectorStore,\n SqliteVectorStore,\n PostgresVectorStore,\n VectorHttpHandler,\n // Embedding exports\n ProviderRegistry,\n ProviderRegistryImpl,\n EmbeddingService,\n EmbeddingServiceImpl,\n CredentialReader,\n CredentialReaderImpl,\n // Tunnel and Subdomain exports\n CloudflareTunnelProvider,\n LocalTunnelProvider,\n SubdomainService,\n // IdP/SP separation exports\n MultiDomainIdentifierStrategy,\n SubdomainPodIdentifierStrategy,\n DisabledOidcHandler,\n DisabledIdentityProviderHandler,\n AutoDetectOidcHandler,\n AutoDetectIdentityProviderHandler,\n UrlAwareRedisLocker,\n // Provision exports\n ProvisionPodCreator,\n ProvisionCodeCodec,\n // Authorization exports\n AuthModeSelector,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sour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/GO,uCAAkB,OA+GP;AA9GpB,2BAA2B;AAC3B,uEAAoE;AA+GlE,iGA/GO,mCAAgB,OA+GP;AAtFlB,uCAAuC;AACvC,sEAAqE;AAA5D,8HAAA,qBAAqB,OAAA","sourcesContent":["import './runtime/configure-drizzle-solid';\nimport { RepresentationPartialConvertingStore } from './storage/RepresentationPartialConvertingStore';\nimport { MinioDataAccessor } from './storage/accessors/MinioDataAccessor';\nimport { QuadstoreSparqlDataAccessor } from './storage/accessors/QuadstoreSparqlDataAccessor';\nimport { QuintStoreSparqlDataAccessor } from './storage/accessors/QuintStoreSparqlDataAccessor';\nimport { MixDataAccessor } from './storage/accessors/MixDataAccessor';\nimport { ConfigurableLoggerFactory } from './logging/ConfigurableLoggerFactory';\nimport { SubgraphQueryEngine, QuadstoreSparqlEngine, QuintstoreSparqlEngine } from './storage/sparql/SubgraphQueryEngine';\nexport type { SparqlEngine } from './storage/sparql/SubgraphQueryEngine';\nimport { SubgraphSparqlHttpHandler } from './http/SubgraphSparqlHttpHandler';\nimport { QuotaAdminHttpHandler } from './http/quota/QuotaAdminHttpHandler';\nimport { SparqlUpdateResourceStore } from './storage/SparqlUpdateResourceStore';\nimport { ClusterIngressRouter } from './http/ClusterIngressRouter';\nimport { ClusterWebSocketConfigurator } from './http/ClusterWebSocketConfigurator';\nimport { EdgeNodeDirectDebugHttpHandler } from './http/EdgeNodeDirectDebugHttpHandler';\nimport { EdgeNodeProxyHttpHandler } from './http/EdgeNodeProxyHttpHandler';\nimport { RouterHttpHandler } from './http/RouterHttpHandler';\nimport { RouterHttpRoute } from './http/RouterHttpRoute';\nimport { TracingHandler } from './http/TracingHandler';\nimport { TerminalHttpHandler } from './http/terminal/TerminalHttpHandler';\nimport { EdgeNodeCertificateHttpHandler } from './http/admin/EdgeNodeCertificateHttpHandler';\nimport { ReservedSuffixIdentifierGenerator } from './pods/ReservedSuffixIdentifierGenerator';\nimport { DrizzleIndexedStorage } from './identity/drizzle/DrizzleIndexedStorage';\nimport { WebIdProfileRepository } from './identity/drizzle/WebIdProfileRepository';\nimport { PostgresKeyValueStorage } from './storage/keyvalue/PostgresKeyValueStorage';\nimport { RedisKeyValueStorage } from './storage/keyvalue/RedisKeyValueStorage';\nimport { SqliteKeyValueStorage } from './storage/keyvalue/SqliteKeyValueStorage';\nimport { DrizzleQuotaService } from './quota/DrizzleQuotaService';\nimport { NoopQuotaService } from './quota/NoopQuotaService';\nimport { HttpEntitlementProvider, NoopEntitlementProvider } from './quota/EntitlementProvider';\nimport { PerAccountQuotaStrategy } from './storage/quota/PerAccountQuotaStrategy';\nimport { TencentDnsProvider } from './dns/tencent/TencentDnsProvider';\nimport { EdgeNodeDnsCoordinator } from './edge/EdgeNodeDnsCoordinator';\nimport { Dns01CertificateProvisioner } from './edge/Dns01CertificateProvisioner';\nimport { SimpleEdgeNodeTunnelManager, NoopEdgeNodeTunnelManager } from './edge/EdgeNodeTunnelManager';\nimport { FrpTunnelManager } from './edge/FrpTunnelManager';\nimport { AcmeCertificateManager } from './edge/acme/AcmeCertificateManager';\nimport { EdgeNodeHealthProbeService } from './edge/EdgeNodeHealthProbeService';\nimport { EdgeNodeAgent } from './edge/EdgeNodeAgent';\nimport { EdgeNodeCertificateService } from './service/EdgeNodeCertificateService';\nimport { createBandwidthThrottleTransform } from './util/stream/BandwidthThrottleTransform';\nimport { UsageTrackingStore } from './storage/quota/UsageTrackingStore';\nimport { EdgeNodeModeDetector } from './edge/EdgeNodeModeDetector';\nimport { ClusterIdentifierStrategy } from './util/identifiers/ClusterIdentifierStrategy';\nimport { CenterNodeRegistrationService } from './identity/CenterNodeRegistrationService';\nimport { PodRoutingHttpHandler } from './http/PodRoutingHttpHandler';\nimport { ReactAppViewHandler } from './identity/ReactAppViewHandler';\nimport { SqliteQuintStore } from './storage/quint/SqliteQuintStore';\nimport { PgQuintStore } from './storage/quint/PgQuintStore';\nimport { BaseQuintStore } from './storage/quint/BaseQuintStore';\nimport { QuintStore } from './storage/quint/types';\nimport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\n// Vector components\nimport { SqliteVectorStore, PostgresVectorStore } from './storage/vector/index';\nimport { VectorHttpHandler } from './http/vector/VectorHttpHandler';\nimport { ProviderRegistry } from './ai/service/ProviderRegistry';\nimport { ProviderRegistryImpl } from './ai/service/ProviderRegistryImpl';\nimport { EmbeddingService } from './ai/service/EmbeddingService';\nimport { EmbeddingServiceImpl } from './ai/service/EmbeddingServiceImpl';\nimport { CredentialReader } from './ai/service/CredentialReader';\nimport { CredentialReaderImpl } from './ai/service/CredentialReaderImpl';\nimport { VectorStore } from './storage/vector/VectorStore';\n// Tunnel and Subdomain components\nimport { CloudflareTunnelProvider } from './tunnel/CloudflareTunnelProvider';\nimport { LocalTunnelProvider } from './tunnel/LocalTunnelProvider';\nimport { SubdomainService } from './subdomain/SubdomainService';\nimport { UrlAwareRedisLocker } from './storage/locking/UrlAwareRedisLocker';\n// IdP/SP separation components\nimport { MultiDomainIdentifierStrategy } from './util/identifiers/MultiDomainIdentifierStrategy';\nimport { SubdomainPodIdentifierStrategy } from './util/identifiers/SubdomainPodIdentifierStrategy';\nimport { DisabledOidcHandler } from './identity/oidc/DisabledOidcHandler';\nimport { DisabledIdentityProviderHandler } from './identity/oidc/DisabledIdentityProviderHandler';\nimport { AutoDetectOidcHandler } from './identity/oidc/AutoDetectOidcHandler';\nimport { AutoDetectIdentityProviderHandler } from './identity/oidc/AutoDetectIdentityProviderHandler';\nimport { LoopbackClientIdAdapterFactory } from './identity/oidc/LoopbackClientIdAdapterFactory';\n// Provision components\nimport { ProvisionPodCreator } from './provision/ProvisionPodCreator';\nimport { ProvisionCodeCodec } from './provision/ProvisionCodeCodec';\n// Authorization components\nimport { AuthModeSelector } from './authorization/AuthModeSelector';\nexport type {\n DnsProvider,\n ListDnsRecordsInput,\n ListableDnsProvider,\n DeleteDnsRecordInput,\n DnsRecordSummary,\n UpsertDnsRecordInput,\n} from './dns/DnsProvider';\nexport type { EdgeNodeCertificateProvisioner } from './edge/EdgeNodeCertificateProvisioner';\nexport type { EdgeNodeTunnelManager } from './edge/interfaces/EdgeNodeTunnelManager';\nexport type { QuotaService, AccountQuota } from './quota/QuotaService';\nexport type { EntitlementProvider, AccountEntitlement } from './quota/EntitlementProvider';\n// Tunnel and Subdomain types\nexport type {\n TunnelProvider,\n TunnelConfig,\n TunnelSetupOptions,\n TunnelStatus,\n} from './tunnel/TunnelProvider';\nexport type {\n SubdomainRegistration,\n ConnectivityResult,\n SubdomainServiceOptions,\n} from './subdomain/SubdomainService';\n// Export the new AppStaticAssetHandler\nexport { AppStaticAssetHandler } from './http/AppStaticAssetHandler';\n\nexport { \n RepresentationPartialConvertingStore,\n MinioDataAccessor, \n QuadstoreSparqlDataAccessor,\n QuintStoreSparqlDataAccessor,\n MixDataAccessor,\n ConfigurableLoggerFactory,\n SparqlUpdateResourceStore,\n SubgraphQueryEngine,\n QuadstoreSparqlEngine,\n QuintstoreSparqlEngine,\n SubgraphSparqlHttpHandler,\n QuotaAdminHttpHandler,\n ClusterIngressRouter,\n ClusterWebSocketConfigurator,\n EdgeNodeDirectDebugHttpHandler,\n EdgeNodeProxyHttpHandler,\n RouterHttpHandler,\n RouterHttpRoute,\n TracingHandler,\n EdgeNodeCertificateHttpHandler,\n TerminalHttpHandler,\n ReservedSuffixIdentifierGenerator,\n DrizzleIndexedStorage,\n WebIdProfileRepository,\n PostgresKeyValueStorage,\n RedisKeyValueStorage,\n SqliteKeyValueStorage,\n DrizzleQuotaService,\n NoopQuotaService,\n HttpEntitlementProvider,\n NoopEntitlementProvider,\n PerAccountQuotaStrategy,\n TencentDnsProvider,\n EdgeNodeDnsCoordinator,\n Dns01CertificateProvisioner,\n SimpleEdgeNodeTunnelManager,\n NoopEdgeNodeTunnelManager,\n FrpTunnelManager,\n EdgeNodeHealthProbeService,\n EdgeNodeAgent,\n EdgeNodeCertificateService,\n AcmeCertificateManager,\n EdgeNodeModeDetector,\n ClusterIdentifierStrategy,\n UsageTrackingStore,\n CenterNodeRegistrationService,\n PodRoutingHttpHandler,\n ReactAppViewHandler,\n // Quint exports\n QuintStore,\n SqliteQuintStore,\n PgQuintStore,\n BaseQuintStore,\n // Vector exports\n VectorStore,\n SqliteVectorStore,\n PostgresVectorStore,\n VectorHttpHandler,\n // Embedding exports\n ProviderRegistry,\n ProviderRegistryImpl,\n EmbeddingService,\n EmbeddingServiceImpl,\n CredentialReader,\n CredentialReaderImpl,\n // Tunnel and Subdomain exports\n CloudflareTunnelProvider,\n LocalTunnelProvider,\n SubdomainService,\n // IdP/SP separation exports\n MultiDomainIdentifierStrategy,\n SubdomainPodIdentifierStrategy,\n DisabledOidcHandler,\n DisabledIdentityProviderHandler,\n AutoDetectOidcHandler,\n AutoDetectIdentityProviderHandler,\n LoopbackClientIdAdapterFactory,\n UrlAwareRedisLocker,\n // Provision exports\n ProvisionPodCreator,\n ProvisionCodeCodec,\n // Authorization exports\n AuthModeSelector,\n};\n"]}
|
|
@@ -8,13 +8,17 @@
|
|
|
8
8
|
* - 没有 → 委托给原始 BasePodCreator(标准本地创建)
|
|
9
9
|
*/
|
|
10
10
|
import { BasePodCreator, type PodCreatorInput, type PodCreatorOutput, type BasePodCreatorArgs } from '@solid/community-server';
|
|
11
|
+
import type { WebIdProfileRepository } from '../identity/drizzle/WebIdProfileRepository';
|
|
11
12
|
export interface ProvisionPodCreatorArgs extends BasePodCreatorArgs {
|
|
12
13
|
/** 与 ProvisionHandler 使用相同的 baseUrl 派生签名密钥 */
|
|
13
14
|
provisionBaseUrl?: string;
|
|
15
|
+
/** Optional Cloud profile repository used to reconcile solid:storage after remote provisioning */
|
|
16
|
+
webIdProfileRepo?: WebIdProfileRepository;
|
|
14
17
|
}
|
|
15
18
|
export declare class ProvisionPodCreator extends BasePodCreator {
|
|
16
19
|
private readonly provisionLogger;
|
|
17
20
|
private readonly codec;
|
|
21
|
+
private readonly webIdProfileRepo?;
|
|
18
22
|
constructor(args: ProvisionPodCreatorArgs);
|
|
19
23
|
handle(input: PodCreatorInput): Promise<PodCreatorOutput>;
|
|
20
24
|
private handleStandardPodCreate;
|
|
@@ -18,11 +18,21 @@ function joinUrlPath(baseUrl, relativePath) {
|
|
|
18
18
|
const normalizedRelativePath = relativePath.replace(/^\/+/u, '');
|
|
19
19
|
return `${normalizedBaseUrl}/${normalizedRelativePath}`;
|
|
20
20
|
}
|
|
21
|
+
function remapPodConflict(error, podName) {
|
|
22
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
23
|
+
if (/There already is a resource at/i.test(message)) {
|
|
24
|
+
throw new community_server_1.ConflictHttpError(`Pod name "${podName}" is already taken for this storage target.`, {
|
|
25
|
+
cause: error instanceof Error ? error : undefined,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
21
30
|
class ProvisionPodCreator extends community_server_1.BasePodCreator {
|
|
22
31
|
constructor(args) {
|
|
23
32
|
super(args);
|
|
24
33
|
this.provisionLogger = (0, global_logger_factory_1.getLoggerFor)(this);
|
|
25
34
|
this.codec = new ProvisionCodeCodec_1.ProvisionCodeCodec(args.provisionBaseUrl ?? args.baseUrl);
|
|
35
|
+
this.webIdProfileRepo = args.webIdProfileRepo;
|
|
26
36
|
}
|
|
27
37
|
async handle(input) {
|
|
28
38
|
const provisionCode = input.settings?.provisionCode;
|
|
@@ -60,7 +70,8 @@ class ProvisionPodCreator extends community_server_1.BasePodCreator {
|
|
|
60
70
|
const storageBase = payload.spDomain
|
|
61
71
|
? `https://${payload.spDomain}`
|
|
62
72
|
: payload.spUrl.replace(/\/$/, '');
|
|
63
|
-
const
|
|
73
|
+
const canonicalStorageUrl = `${storageBase}/${podName}/`;
|
|
74
|
+
const podUrl = spResult.podUrl || canonicalStorageUrl;
|
|
64
75
|
// 3. 生成 WebID(指向 Cloud,storage 指向 SP)
|
|
65
76
|
const webId = input.webId ?? `${this.baseUrl}${podName}/profile/card#me`;
|
|
66
77
|
// 4. 链接 WebID 到账户 + 在本地 PodStore 记录
|
|
@@ -75,6 +86,17 @@ class ProvisionPodCreator extends community_server_1.BasePodCreator {
|
|
|
75
86
|
};
|
|
76
87
|
const webIdLink = await this.handleWebId(!input.webId, webId, input.accountId, podSettings);
|
|
77
88
|
const podId = await this.createPod(input.accountId, podSettings, !input.name, webIdLink);
|
|
89
|
+
if (!input.webId && this.webIdProfileRepo) {
|
|
90
|
+
try {
|
|
91
|
+
await this.webIdProfileRepo.updateStorage(podName, {
|
|
92
|
+
storageUrl: canonicalStorageUrl,
|
|
93
|
+
storageMode: 'local',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
this.provisionLogger.warn(`Failed to reconcile storage pointer for ${podName}: ${error.message}`);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
78
100
|
this.provisionLogger.info(`Provisioned pod ${podName} on SP ${payload.spUrl}, podUrl: ${podUrl}`);
|
|
79
101
|
return {
|
|
80
102
|
podUrl,
|
|
@@ -99,7 +121,16 @@ class ProvisionPodCreator extends community_server_1.BasePodCreator {
|
|
|
99
121
|
const webIdLink = await this.handleWebId(!input.webId, webId, input.accountId, podSettings);
|
|
100
122
|
const webIdElapsed = Date.now() - webIdStarted;
|
|
101
123
|
const podStarted = Date.now();
|
|
102
|
-
|
|
124
|
+
let podId;
|
|
125
|
+
try {
|
|
126
|
+
podId = await this.createPod(input.accountId, podSettings, !input.name, webIdLink);
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
if (input.name) {
|
|
130
|
+
remapPodConflict(error, input.name);
|
|
131
|
+
}
|
|
132
|
+
throw error;
|
|
133
|
+
}
|
|
103
134
|
const podElapsed = Date.now() - podStarted;
|
|
104
135
|
const totalElapsed = Date.now() - totalStarted;
|
|
105
136
|
this.provisionLogger.info(`[timing] ProvisionPodCreator.standard account=${input.accountId} pod=${baseIdentifier.path} handleWebId=${webIdElapsed}ms createPod=${podElapsed}ms total=${totalElapsed}ms`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-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WAAW,GAAG;YAClB,GAAG,aAAa;YAChB,IAAI,EAAE,cAAc;YACpB,KAAK;YACL,UAAU;SACX,CAAC;QAEF,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAChC,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC5F,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC;QAE/C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACzF,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;QAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC;QAE/C,IAAI,CAAC,eAAe,CAAC,IAAI,CACvB,iDAAiD,KAAK,CAAC,SAAS,QAAQ,cAAc,CAAC,IAAI,gBAAgB,YAAY,gBAAgB,UAAU,YAAY,YAAY,IAAI,CAC9K,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,cAAc,CAAC,IAAI;YAC3B,KAAK;YACL,KAAK;YACL,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAnHD,kDAmHC","sourcesContent":["/**\n * ProvisionPodCreator\n *\n * 等位替换 CSS 的 BasePodCreator。\n *\n * 检查 settings 里有没有 provisionCode:\n * - 有 → 解码 JWT,回调远端 SP 的 /provision/pods 创建 Pod\n * - 没有 → 委托给原始 BasePodCreator(标准本地创建)\n */\n\nimport { getLoggerFor } from 'global-logger-factory';\nimport {\n BasePodCreator,\n type PodCreatorInput,\n type PodCreatorOutput,\n type BasePodCreatorArgs,\n} from '@solid/community-server';\nimport { ProvisionCodeCodec } from './ProvisionCodeCodec';\n\nfunction joinUrlPath(baseUrl: string, relativePath: string): string {\n const normalizedBaseUrl = baseUrl.replace(/\\/+$/u, '');\n const normalizedRelativePath = relativePath.replace(/^\\/+/u, '');\n return `${normalizedBaseUrl}/${normalizedRelativePath}`;\n}\n\nexport interface ProvisionPodCreatorArgs extends BasePodCreatorArgs {\n /** 与 ProvisionHandler 使用相同的 baseUrl 派生签名密钥 */\n provisionBaseUrl?: string;\n}\n\nexport class ProvisionPodCreator extends BasePodCreator {\n private readonly provisionLogger = getLoggerFor(this);\n private readonly codec: ProvisionCodeCodec;\n\n public constructor(args: ProvisionPodCreatorArgs) {\n super(args);\n this.codec = new ProvisionCodeCodec(args.provisionBaseUrl ?? args.baseUrl);\n }\n\n public override async handle(input: PodCreatorInput): Promise<PodCreatorOutput> {\n const provisionCode = input.settings?.provisionCode as string | undefined;\n\n if (!provisionCode) {\n return this.handleStandardPodCreate(input);\n }\n\n // SP 模式:解码 provisionCode,回调远端 SP\n const payload = this.codec.decode(provisionCode);\n if (!payload) {\n throw new Error('Invalid or expired provisionCode');\n }\n\n this.provisionLogger.info(`Provisioning pod on remote SP: ${payload.spUrl}`);\n\n // 1. 确定 podName\n const podName = input.name;\n if (!podName) {\n throw new Error('Pod name is required for remote provisioning');\n }\n\n // 2. 回调 SP 创建 Pod\n const callbackUrl = `${payload.spUrl.replace(/\\/$/, '')}/provision/pods`;\n const spResponse = await fetch(callbackUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${payload.serviceToken}`,\n },\n body: JSON.stringify({ podName }),\n });\n\n if (!spResponse.ok) {\n const errBody = await spResponse.text();\n this.provisionLogger.error(`SP callback failed: ${spResponse.status} ${errBody}`);\n throw new Error(`Failed to create pod on SP: ${spResponse.status}`);\n }\n\n const spResult = await spResponse.json() as { podUrl?: string };\n\n // storage URL 优先用 Cloud 分配的子域名,回调用实际地址\n const storageBase = payload.spDomain\n ? `https://${payload.spDomain}`\n : payload.spUrl.replace(/\\/$/, '');\n const podUrl = spResult.podUrl || `${storageBase}/${podName}/`;\n\n // 3. 生成 WebID(指向 Cloud,storage 指向 SP)\n const webId = input.webId ?? `${this.baseUrl}${podName}/profile/card#me`;\n\n // 4. 链接 WebID 到账户 + 在本地 PodStore 记录\n // base.path 必须在 Cloud 的 identifier space 内(CSS PodStore 会检查),\n // 所以用 Cloud 本地路径;真实的 SP storage URL 通过 podUrl 返回。\n const localBase = this.identifierGenerator.generate(podName);\n const podSettings = {\n ...input.settings,\n base: localBase,\n webId,\n oidcIssuer: this.baseUrl,\n };\n\n const webIdLink = await this.handleWebId(!input.webId, webId, input.accountId, podSettings);\n const podId = await this.createPod(input.accountId, podSettings, !input.name, webIdLink);\n\n this.provisionLogger.info(`Provisioned pod ${podName} on SP ${payload.spUrl}, podUrl: ${podUrl}`);\n\n return {\n podUrl,\n webId,\n podId,\n webIdLink,\n };\n }\n\n private async handleStandardPodCreate(input: PodCreatorInput): Promise<PodCreatorOutput> {\n const totalStarted = Date.now();\n const baseIdentifier = this.generateBaseIdentifier(input.name);\n const webId = input.webId ?? joinUrlPath(baseIdentifier.path, this.relativeWebIdPath);\n const inputSettings = input.settings as Record<string, unknown> | undefined;\n const oidcIssuer = typeof inputSettings?.oidcIssuer === 'string' ? inputSettings.oidcIssuer : this.baseUrl;\n const podSettings = {\n ...inputSettings,\n base: baseIdentifier,\n webId,\n oidcIssuer,\n };\n\n const webIdStarted = Date.now();\n const webIdLink = await this.handleWebId(!input.webId, webId, input.accountId, podSettings);\n const webIdElapsed = Date.now() - webIdStarted;\n\n const podStarted = Date.now();\n const podId = await this.createPod(input.accountId, podSettings, !input.name, webIdLink);\n const podElapsed = Date.now() - podStarted;\n const totalElapsed = Date.now() - totalStarted;\n\n this.provisionLogger.info(\n `[timing] ProvisionPodCreator.standard account=${input.accountId} pod=${baseIdentifier.path} handleWebId=${webIdElapsed}ms createPod=${podElapsed}ms total=${totalElapsed}ms`,\n );\n\n return {\n podUrl: baseIdentifier.path,\n webId,\n podId,\n webIdLink,\n };\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ProvisionPodCreator.js","sourceRoot":"","sources":["../../src/provision/ProvisionPodCreator.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,iEAAqD;AACrD,8DAMiC;AACjC,6DAA0D;AAG1D,SAAS,WAAW,CAAC,OAAe,EAAE,YAAoB;IACxD,MAAM,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACvD,MAAM,sBAAsB,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IACjE,OAAO,GAAG,iBAAiB,IAAI,sBAAsB,EAAE,CAAC;AAC1D,CAAC;AASD,SAAS,gBAAgB,CAAC,KAAc,EAAE,OAAe;IACvD,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,IAAI,iCAAiC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,oCAAiB,CAAC,aAAa,OAAO,6CAA6C,EAAE;YAC7F,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS;SAClD,CAAC,CAAC;IACL,CAAC;IAED,MAAM,KAAK,CAAC;AACd,CAAC;AAED,MAAa,mBAAoB,SAAQ,iCAAc;IAKrD,YAAmB,IAA6B;QAC9C,KAAK,CAAC,IAAI,CAAC,CAAC;QALG,oBAAe,GAAG,IAAA,oCAAY,EAAC,IAAI,CAAC,CAAC;QAMpD,IAAI,CAAC,KAAK,GAAG,IAAI,uCAAkB,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QAC3E,IAAI,CAA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K,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC5F,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC;QAE/C,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAC9B,IAAI,KAAa,CAAC;QAClB,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;QACrF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;gBACf,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;YACtC,CAAC;YACD,MAAM,KAAK,CAAC;QACd,CAAC;QACD,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC;QAC3C,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,YAAY,CAAC;QAE/C,IAAI,CAAC,eAAe,CAAC,IAAI,CACvB,iDAAiD,KAAK,CAAC,SAAS,QAAQ,cAAc,CAAC,IAAI,gBAAgB,YAAY,gBAAgB,UAAU,YAAY,YAAY,IAAI,CAC9K,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,cAAc,CAAC,IAAI;YAC3B,KAAK;YACL,KAAK;YACL,SAAS;SACV,CAAC;IACJ,CAAC;CACF;AAzID,kDAyIC","sourcesContent":["/**\n * ProvisionPodCreator\n *\n * 等位替换 CSS 的 BasePodCreator。\n *\n * 检查 settings 里有没有 provisionCode:\n * - 有 → 解码 JWT,回调远端 SP 的 /provision/pods 创建 Pod\n * - 没有 → 委托给原始 BasePodCreator(标准本地创建)\n */\n\nimport { getLoggerFor } from 'global-logger-factory';\nimport {\n BasePodCreator,\n type PodCreatorInput,\n type PodCreatorOutput,\n type BasePodCreatorArgs,\n ConflictHttpError,\n} from '@solid/community-server';\nimport { ProvisionCodeCodec } from './ProvisionCodeCodec';\nimport type { WebIdProfileRepository } from '../identity/drizzle/WebIdProfileRepository';\n\nfunction joinUrlPath(baseUrl: string, relativePath: string): string {\n const normalizedBaseUrl = baseUrl.replace(/\\/+$/u, '');\n const normalizedRelativePath = relativePath.replace(/^\\/+/u, '');\n return `${normalizedBaseUrl}/${normalizedRelativePath}`;\n}\n\nexport interface ProvisionPodCreatorArgs extends BasePodCreatorArgs {\n /** 与 ProvisionHandler 使用相同的 baseUrl 派生签名密钥 */\n provisionBaseUrl?: string;\n /** Optional Cloud profile repository used to reconcile solid:storage after remote provisioning */\n webIdProfileRepo?: WebIdProfileRepository;\n}\n\nfunction remapPodConflict(error: unknown, podName: string): never {\n const message = error instanceof Error ? error.message : String(error);\n if (/There already is a resource at/i.test(message)) {\n throw new ConflictHttpError(`Pod name \"${podName}\" is already taken for this storage target.`, {\n cause: error instanceof Error ? error : undefined,\n });\n }\n\n throw error;\n}\n\nexport class ProvisionPodCreator extends BasePodCreator {\n private readonly provisionLogger = getLoggerFor(this);\n private readonly codec: ProvisionCodeCodec;\n private readonly webIdProfileRepo?: WebIdProfileRepository;\n\n public constructor(args: ProvisionPodCreatorArgs) {\n super(args);\n this.codec = new ProvisionCodeCodec(args.provisionBaseUrl ?? args.baseUrl);\n this.webIdProfileRepo = args.webIdProfileRepo;\n }\n\n public override async handle(input: PodCreatorInput): Promise<PodCreatorOutput> {\n const provisionCode = input.settings?.provisionCode as string | undefined;\n\n if (!provisionCode) {\n return this.handleStandardPodCreate(input);\n }\n\n // SP 模式:解码 provisionCode,回调远端 SP\n const payload = this.codec.decode(provisionCode);\n if (!payload) {\n throw new Error('Invalid or expired provisionCode');\n }\n\n this.provisionLogger.info(`Provisioning pod on remote SP: ${payload.spUrl}`);\n\n // 1. 确定 podName\n const podName = input.name;\n if (!podName) {\n throw new Error('Pod name is required for remote provisioning');\n }\n\n // 2. 回调 SP 创建 Pod\n const callbackUrl = `${payload.spUrl.replace(/\\/$/, '')}/provision/pods`;\n const spResponse = await fetch(callbackUrl, {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${payload.serviceToken}`,\n },\n body: JSON.stringify({ podName }),\n });\n\n if (!spResponse.ok) {\n const errBody = await spResponse.text();\n this.provisionLogger.error(`SP callback failed: ${spResponse.status} ${errBody}`);\n throw new Error(`Failed to create pod on SP: ${spResponse.status}`);\n }\n\n const spResult = await spResponse.json() as { podUrl?: string };\n\n // storage URL 优先用 Cloud 分配的子域名,回调用实际地址\n const storageBase = payload.spDomain\n ? `https://${payload.spDomain}`\n : payload.spUrl.replace(/\\/$/, '');\n const canonicalStorageUrl = `${storageBase}/${podName}/`;\n const podUrl = spResult.podUrl || canonicalStorageUrl;\n\n // 3. 生成 WebID(指向 Cloud,storage 指向 SP)\n const webId = input.webId ?? `${this.baseUrl}${podName}/profile/card#me`;\n\n // 4. 链接 WebID 到账户 + 在本地 PodStore 记录\n // base.path 必须在 Cloud 的 identifier space 内(CSS PodStore 会检查),\n // 所以用 Cloud 本地路径;真实的 SP storage URL 通过 podUrl 返回。\n const localBase = this.identifierGenerator.generate(podName);\n const podSettings = {\n ...input.settings,\n base: localBase,\n webId,\n oidcIssuer: this.baseUrl,\n };\n\n const webIdLink = await this.handleWebId(!input.webId, webId, input.accountId, podSettings);\n const podId = await this.createPod(input.accountId, podSettings, !input.name, webIdLink);\n\n if (!input.webId && this.webIdProfileRepo) {\n try {\n await this.webIdProfileRepo.updateStorage(podName, {\n storageUrl: canonicalStorageUrl,\n storageMode: 'local',\n });\n } catch (error) {\n this.provisionLogger.warn(`Failed to reconcile storage pointer for ${podName}: ${(error as Error).message}`);\n }\n }\n\n this.provisionLogger.info(`Provisioned pod ${podName} on SP ${payload.spUrl}, podUrl: ${podUrl}`);\n\n return {\n podUrl,\n webId,\n podId,\n webIdLink,\n };\n }\n\n private async handleStandardPodCreate(input: PodCreatorInput): Promise<PodCreatorOutput> {\n const totalStarted = Date.now();\n const baseIdentifier = this.generateBaseIdentifier(input.name);\n const webId = input.webId ?? joinUrlPath(baseIdentifier.path, this.relativeWebIdPath);\n const inputSettings = input.settings as Record<string, unknown> | undefined;\n const oidcIssuer = typeof inputSettings?.oidcIssuer === 'string' ? inputSettings.oidcIssuer : this.baseUrl;\n const podSettings = {\n ...inputSettings,\n base: baseIdentifier,\n webId,\n oidcIssuer,\n };\n\n const webIdStarted = Date.now();\n const webIdLink = await this.handleWebId(!input.webId, webId, input.accountId, podSettings);\n const webIdElapsed = Date.now() - webIdStarted;\n\n const podStarted = Date.now();\n let podId: string;\n try {\n podId = await this.createPod(input.accountId, podSettings, !input.name, webIdLink);\n } catch (error) {\n if (input.name) {\n remapPodConflict(error, input.name);\n }\n throw error;\n }\n const podElapsed = Date.now() - podStarted;\n const totalElapsed = Date.now() - totalStarted;\n\n this.provisionLogger.info(\n `[timing] ProvisionPodCreator.standard account=${input.accountId} pod=${baseIdentifier.path} handleWebId=${webIdElapsed}ms createPod=${podElapsed}ms total=${totalElapsed}ms`,\n );\n\n return {\n podUrl: baseIdentifier.path,\n webId,\n podId,\n webIdLink,\n };\n }\n}\n"]}
|