chore: import upstream snapshot with attribution
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled

This commit is contained in:
wehub-resource-sync
2026-07-13 13:20:55 +08:00
commit d25d482dc2
13754 changed files with 4996608 additions and 0 deletions
+101
View File
@@ -0,0 +1,101 @@
import { createLogger } from '@sim/logger'
export const FORMS_API_BASE = 'https://forms.googleapis.com/v1'
const logger = createLogger('GoogleFormsUtils')
function isRecord(value: unknown): value is Record<string, unknown> {
return value !== null && typeof value === 'object'
}
export function getGoogleFormsErrorMessage(data: unknown, fallback: string): string {
if (!isRecord(data)) return fallback
const { error } = data
if (!isRecord(error)) return fallback
const { message } = error
return typeof message === 'string' ? message : fallback
}
export function buildListResponsesUrl(params: {
formId: string
pageSize?: number
pageToken?: string
filter?: string
}): string {
const { formId, pageSize, pageToken, filter } = params
const url = new URL(`${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}/responses`)
if (pageSize && pageSize > 0) {
const limited = Math.min(pageSize, 5000)
url.searchParams.set('pageSize', String(limited))
}
if (pageToken) {
url.searchParams.set('pageToken', pageToken)
}
if (filter) {
url.searchParams.set('filter', filter)
}
const finalUrl = url.toString()
logger.debug('Built Google Forms list responses URL', { finalUrl })
return finalUrl
}
export function buildGetResponseUrl(params: { formId: string; responseId: string }): string {
const { formId, responseId } = params
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}/responses/${encodeURIComponent(responseId)}`
logger.debug('Built Google Forms get response URL', { finalUrl })
return finalUrl
}
export function buildGetFormUrl(formId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}`
logger.debug('Built Google Forms get form URL', { finalUrl })
return finalUrl
}
export function buildCreateFormUrl(unpublished?: boolean): string {
const url = new URL(`${FORMS_API_BASE}/forms`)
if (unpublished) {
url.searchParams.set('unpublished', 'true')
}
const finalUrl = url.toString()
logger.debug('Built Google Forms create form URL', { finalUrl })
return finalUrl
}
export function buildBatchUpdateUrl(formId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}:batchUpdate`
logger.debug('Built Google Forms batch update URL', { finalUrl })
return finalUrl
}
export function buildSetPublishSettingsUrl(formId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}:setPublishSettings`
logger.debug('Built Google Forms set publish settings URL', { finalUrl })
return finalUrl
}
export function buildListWatchesUrl(formId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}/watches`
logger.debug('Built Google Forms list watches URL', { finalUrl })
return finalUrl
}
export function buildCreateWatchUrl(formId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}/watches`
logger.debug('Built Google Forms create watch URL', { finalUrl })
return finalUrl
}
export function buildDeleteWatchUrl(formId: string, watchId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}/watches/${encodeURIComponent(watchId)}`
logger.debug('Built Google Forms delete watch URL', { finalUrl })
return finalUrl
}
export function buildRenewWatchUrl(formId: string, watchId: string): string {
const finalUrl = `${FORMS_API_BASE}/forms/${encodeURIComponent(formId)}/watches/${encodeURIComponent(watchId)}:renew`
logger.debug('Built Google Forms renew watch URL', { finalUrl })
return finalUrl
}