@xylex-group/athena 2.8.0 → 2.9.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/README.md +165 -68
- package/dist/browser.cjs +1331 -70
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +8 -7
- package/dist/browser.d.ts +8 -7
- package/dist/browser.js +1325 -71
- package/dist/browser.js.map +1 -1
- package/dist/cli/index.cjs +1354 -117
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.cts +3 -3
- package/dist/cli/index.d.ts +3 -3
- package/dist/cli/index.js +1354 -117
- package/dist/cli/index.js.map +1 -1
- package/dist/{model-form-DMed05gE.d.cts → client-CfAE_QOj.d.cts} +741 -132
- package/dist/{model-form-DXPlOnlI.d.ts → client-D6EIJdQS.d.ts} +741 -132
- package/dist/index.cjs +1391 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +1385 -72
- package/dist/index.js.map +1 -1
- package/dist/model-form-ByvyyvxB.d.ts +96 -0
- package/dist/model-form-DACdBLYG.d.cts +96 -0
- package/dist/next/client.cjs +7875 -0
- package/dist/next/client.cjs.map +1 -0
- package/dist/next/client.d.cts +25 -0
- package/dist/next/client.d.ts +25 -0
- package/dist/next/client.js +7873 -0
- package/dist/next/client.js.map +1 -0
- package/dist/next/server.cjs +7993 -0
- package/dist/next/server.cjs.map +1 -0
- package/dist/next/server.d.cts +52 -0
- package/dist/next/server.d.ts +52 -0
- package/dist/next/server.js +7990 -0
- package/dist/next/server.js.map +1 -0
- package/dist/{pipeline-D4sJRKqN.d.cts → pipeline-CmUZsXsi.d.cts} +1 -1
- package/dist/{pipeline-CkMnhwPI.d.ts → pipeline-DZMsPxUg.d.ts} +1 -1
- package/dist/{react-email-DZhDDlEl.d.cts → react-email-BvJ3fj_F.d.cts} +35 -7
- package/dist/{react-email-Lrz9A-BW.d.ts → react-email-PLAJuZuO.d.ts} +35 -7
- package/dist/react.cjs +30 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.cts +39 -10
- package/dist/react.d.ts +39 -10
- package/dist/react.js +30 -2
- package/dist/react.js.map +1 -1
- package/dist/shared-BW6hoLBY.d.cts +33 -0
- package/dist/shared-BiJvoURI.d.ts +33 -0
- package/dist/{types-vikz9YIO.d.cts → types-BeZIHduP.d.cts} +5 -1
- package/dist/{types-vikz9YIO.d.ts → types-BeZIHduP.d.ts} +5 -1
- package/dist/{types-CAtTGGoz.d.cts → types-C-YvfgYh.d.cts} +27 -2
- package/dist/{types-BzY6fETM.d.ts → types-CRjDwmtJ.d.ts} +27 -2
- package/package.json +37 -49
package/dist/cli/index.js
CHANGED
|
@@ -686,6 +686,77 @@ function resolveProviderSchemas(providerConfig) {
|
|
|
686
686
|
return [...DEFAULT_POSTGRES_SCHEMAS];
|
|
687
687
|
}
|
|
688
688
|
|
|
689
|
+
// src/generator/table-selection.ts
|
|
690
|
+
function normalizeTableSelector(value) {
|
|
691
|
+
const trimmed = value.trim();
|
|
692
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
693
|
+
}
|
|
694
|
+
function normalizeTableSelection(value) {
|
|
695
|
+
if (typeof value === "string") {
|
|
696
|
+
return Array.from(
|
|
697
|
+
new Set(
|
|
698
|
+
value.split(",").map(normalizeTableSelector).filter((entry) => Boolean(entry))
|
|
699
|
+
)
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
if (Array.isArray(value)) {
|
|
703
|
+
return Array.from(
|
|
704
|
+
new Set(
|
|
705
|
+
value.map((entry) => typeof entry === "string" ? normalizeTableSelector(entry) : void 0).filter((entry) => Boolean(entry))
|
|
706
|
+
)
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
return [];
|
|
710
|
+
}
|
|
711
|
+
function matchesTableSelector(schemaName, tableName, selector) {
|
|
712
|
+
const separatorIndex = selector.indexOf(".");
|
|
713
|
+
if (separatorIndex < 0) {
|
|
714
|
+
return tableName === selector;
|
|
715
|
+
}
|
|
716
|
+
const selectorSchema = selector.slice(0, separatorIndex).trim();
|
|
717
|
+
const selectorTable = selector.slice(separatorIndex + 1).trim();
|
|
718
|
+
return selectorSchema === schemaName && selectorTable === tableName;
|
|
719
|
+
}
|
|
720
|
+
function shouldKeepTable(schemaName, tableName, filter) {
|
|
721
|
+
const included = filter.includeTables.length === 0 || filter.includeTables.some((selector) => matchesTableSelector(schemaName, tableName, selector));
|
|
722
|
+
if (!included) {
|
|
723
|
+
return false;
|
|
724
|
+
}
|
|
725
|
+
return !filter.excludeTables.some((selector) => matchesTableSelector(schemaName, tableName, selector));
|
|
726
|
+
}
|
|
727
|
+
function hasTableFilters(filter) {
|
|
728
|
+
return filter.includeTables.length > 0 || filter.excludeTables.length > 0;
|
|
729
|
+
}
|
|
730
|
+
function filterIntrospectionSnapshot(snapshot, filter) {
|
|
731
|
+
if (!hasTableFilters(filter)) {
|
|
732
|
+
return snapshot;
|
|
733
|
+
}
|
|
734
|
+
const schemas = {};
|
|
735
|
+
for (const [schemaName, schema] of Object.entries(snapshot.schemas)) {
|
|
736
|
+
const tables = Object.fromEntries(
|
|
737
|
+
Object.entries(schema.tables).filter(([tableName]) => shouldKeepTable(schemaName, tableName, filter))
|
|
738
|
+
);
|
|
739
|
+
if (Object.keys(tables).length === 0) {
|
|
740
|
+
continue;
|
|
741
|
+
}
|
|
742
|
+
schemas[schemaName] = {
|
|
743
|
+
...schema,
|
|
744
|
+
tables
|
|
745
|
+
};
|
|
746
|
+
}
|
|
747
|
+
if (Object.keys(schemas).length === 0) {
|
|
748
|
+
const includeLabel = filter.includeTables.length > 0 ? ` includeTables=${filter.includeTables.join(", ")}` : "";
|
|
749
|
+
const excludeLabel = filter.excludeTables.length > 0 ? ` excludeTables=${filter.excludeTables.join(", ")}` : "";
|
|
750
|
+
throw new Error(
|
|
751
|
+
`Generator table filters matched no tables after schema selection.${includeLabel}${excludeLabel}`
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
...snapshot,
|
|
756
|
+
schemas
|
|
757
|
+
};
|
|
758
|
+
}
|
|
759
|
+
|
|
689
760
|
// src/generator/config.ts
|
|
690
761
|
var POSTGRES_PROTOCOLS = /* @__PURE__ */ new Set(["postgres:", "postgresql:"]);
|
|
691
762
|
var DEFAULT_CONFIG_CANDIDATES = [
|
|
@@ -696,13 +767,20 @@ var DEFAULT_CONFIG_CANDIDATES = [
|
|
|
696
767
|
".athena.config.ts",
|
|
697
768
|
".athena.config.js"
|
|
698
769
|
];
|
|
699
|
-
var
|
|
770
|
+
var LEGACY_DEFAULT_TARGETS = {
|
|
700
771
|
model: "athena/models/{schema_kebab}/{model_kebab}.ts",
|
|
701
772
|
schema: "athena/schemas/{schema_kebab}.ts",
|
|
702
773
|
database: "athena/relations.ts",
|
|
703
774
|
registry: "athena/config.ts"
|
|
704
775
|
};
|
|
705
|
-
var
|
|
776
|
+
var ATHENA_DIRECT_TARGETS = {
|
|
777
|
+
model: "athena/models/{schema_kebab}/{model_kebab}.ts",
|
|
778
|
+
schema: "athena/schemas/{schema_kebab}.ts",
|
|
779
|
+
database: "athena/relations.ts",
|
|
780
|
+
registry: "athena/registry.generated.ts"
|
|
781
|
+
};
|
|
782
|
+
var DEFAULT_OUTPUT_FORMAT = "table-builder";
|
|
783
|
+
var DEFAULT_OUTPUT_PRESET = "athena-direct";
|
|
706
784
|
var DEFAULT_NAMING = {
|
|
707
785
|
modelType: "pascal",
|
|
708
786
|
modelConst: "camel",
|
|
@@ -721,6 +799,10 @@ var DEFAULT_EXPERIMENTAL_FLAGS = {
|
|
|
721
799
|
var DEFAULT_INTERNAL_CONFIG = {
|
|
722
800
|
schemaVersion: 1
|
|
723
801
|
};
|
|
802
|
+
var DEFAULT_FILTER_CONFIG = {
|
|
803
|
+
includeTables: [],
|
|
804
|
+
excludeTables: []
|
|
805
|
+
};
|
|
724
806
|
var PROJECT_ENV_FILENAMES = [".env", ".env.local"];
|
|
725
807
|
var DIRECT_CONNECTION_STRING_ENV_KEYS = [
|
|
726
808
|
"ATHENA_GENERATOR_PG_URL",
|
|
@@ -739,10 +821,13 @@ var GATEWAY_API_KEY_ENV_KEYS = [
|
|
|
739
821
|
];
|
|
740
822
|
var GENERATOR_SCHEMA_ENV_KEYS = ["ATHENA_GENERATOR_SCHEMAS"];
|
|
741
823
|
var OUTPUT_FORMAT_ENV_KEYS = ["ATHENA_GENERATOR_OUTPUT_FORMAT"];
|
|
824
|
+
var OUTPUT_PRESET_ENV_KEYS = ["ATHENA_GENERATOR_OUTPUT_PRESET"];
|
|
742
825
|
var MODEL_TARGET_ENV_KEYS = ["ATHENA_GENERATOR_MODEL_TARGET"];
|
|
743
826
|
var SCHEMA_TARGET_ENV_KEYS = ["ATHENA_GENERATOR_SCHEMA_TARGET"];
|
|
744
827
|
var DATABASE_TARGET_ENV_KEYS = ["ATHENA_GENERATOR_DATABASE_TARGET"];
|
|
745
828
|
var REGISTRY_TARGET_ENV_KEYS = ["ATHENA_GENERATOR_REGISTRY_TARGET"];
|
|
829
|
+
var TABLES_ENV_KEYS = ["ATHENA_GENERATOR_TABLES"];
|
|
830
|
+
var EXCLUDE_TABLES_ENV_KEYS = ["ATHENA_GENERATOR_EXCLUDE_TABLES"];
|
|
746
831
|
var PLACEHOLDER_MAP_ENV_KEYS = ["ATHENA_GENERATOR_PLACEHOLDER_MAP"];
|
|
747
832
|
var MODEL_TYPE_ENV_KEYS = ["ATHENA_GENERATOR_MODEL_TYPE", "ATHENA_GENERATOR_MODEL_STYLE"];
|
|
748
833
|
var MODEL_CONST_ENV_KEYS = ["ATHENA_GENERATOR_MODEL_CONST"];
|
|
@@ -757,7 +842,12 @@ var SCYLLA_PROVIDER_CONTRACTS_ENV_KEYS = ["ATHENA_GENERATOR_SCYLLA_PROVIDER_CONT
|
|
|
757
842
|
var ENV_ONLY_CONFIG_PATH = "[environment defaults]";
|
|
758
843
|
var NAMING_STYLE_VALUES = ["preserve", "camel", "pascal", "snake", "kebab"];
|
|
759
844
|
var OUTPUT_FORMAT_VALUES = ["define-model", "table-builder"];
|
|
845
|
+
var OUTPUT_PRESET_VALUES = ["legacy", "athena-direct"];
|
|
760
846
|
var BACKEND_TYPE_VALUES = ["athena", "postgrest", "postgresql", "scylladb"];
|
|
847
|
+
var OUTPUT_PRESET_TARGETS = {
|
|
848
|
+
legacy: LEGACY_DEFAULT_TARGETS,
|
|
849
|
+
"athena-direct": ATHENA_DIRECT_TARGETS
|
|
850
|
+
};
|
|
761
851
|
function normalizeRawEnvValue(rawValue) {
|
|
762
852
|
if (rawValue.startsWith('"') && rawValue.endsWith('"') && rawValue.length >= 2) {
|
|
763
853
|
const inner = rawValue.slice(1, -1);
|
|
@@ -964,11 +1054,19 @@ function normalizeExperimentalFlags(input) {
|
|
|
964
1054
|
)
|
|
965
1055
|
};
|
|
966
1056
|
}
|
|
1057
|
+
function normalizeFilterConfig(input) {
|
|
1058
|
+
return {
|
|
1059
|
+
includeTables: normalizeTableSelection(input?.includeTables),
|
|
1060
|
+
excludeTables: normalizeTableSelection(input?.excludeTables)
|
|
1061
|
+
};
|
|
1062
|
+
}
|
|
967
1063
|
function normalizeOutputConfig(output) {
|
|
1064
|
+
const preset = output?.preset ?? DEFAULT_OUTPUT_PRESET;
|
|
968
1065
|
return {
|
|
969
1066
|
format: output?.format ?? DEFAULT_OUTPUT_FORMAT,
|
|
1067
|
+
preset,
|
|
970
1068
|
targets: {
|
|
971
|
-
...
|
|
1069
|
+
...OUTPUT_PRESET_TARGETS[preset],
|
|
972
1070
|
...output?.targets ?? {}
|
|
973
1071
|
},
|
|
974
1072
|
placeholderMap: {
|
|
@@ -1048,6 +1146,10 @@ function normalizeGeneratorConfig(input) {
|
|
|
1048
1146
|
...DEFAULT_NAMING,
|
|
1049
1147
|
...input.naming ?? {}
|
|
1050
1148
|
},
|
|
1149
|
+
filter: {
|
|
1150
|
+
...DEFAULT_FILTER_CONFIG,
|
|
1151
|
+
...normalizeFilterConfig(input.filter)
|
|
1152
|
+
},
|
|
1051
1153
|
features: normalizeFeatureFlags(input.features),
|
|
1052
1154
|
experimental: normalizeExperimentalFlags(input.experimental),
|
|
1053
1155
|
internal: {
|
|
@@ -1108,16 +1210,18 @@ function importConfigModule(moduleSpecifier) {
|
|
|
1108
1210
|
}
|
|
1109
1211
|
function buildEnvironmentOutputConfig() {
|
|
1110
1212
|
const format = resolveOptionalOneOf(OUTPUT_FORMAT_ENV_KEYS, OUTPUT_FORMAT_VALUES);
|
|
1213
|
+
const preset = resolveOptionalOneOf(OUTPUT_PRESET_ENV_KEYS, OUTPUT_PRESET_VALUES);
|
|
1111
1214
|
const modelTarget = resolveFallbackValue(MODEL_TARGET_ENV_KEYS);
|
|
1112
1215
|
const schemaTarget = resolveFallbackValue(SCHEMA_TARGET_ENV_KEYS);
|
|
1113
1216
|
const databaseTarget = resolveFallbackValue(DATABASE_TARGET_ENV_KEYS);
|
|
1114
1217
|
const registryTarget = resolveFallbackValue(REGISTRY_TARGET_ENV_KEYS);
|
|
1115
1218
|
const placeholderMap = resolveOptionalJson(PLACEHOLDER_MAP_ENV_KEYS);
|
|
1116
|
-
if (format === void 0 && modelTarget === void 0 && schemaTarget === void 0 && databaseTarget === void 0 && registryTarget === void 0 && placeholderMap === void 0) {
|
|
1219
|
+
if (format === void 0 && preset === void 0 && modelTarget === void 0 && schemaTarget === void 0 && databaseTarget === void 0 && registryTarget === void 0 && placeholderMap === void 0) {
|
|
1117
1220
|
return void 0;
|
|
1118
1221
|
}
|
|
1119
1222
|
return {
|
|
1120
1223
|
format,
|
|
1224
|
+
preset,
|
|
1121
1225
|
targets: {
|
|
1122
1226
|
...modelTarget ? { model: modelTarget } : {},
|
|
1123
1227
|
...schemaTarget ? { schema: schemaTarget } : {},
|
|
@@ -1127,6 +1231,17 @@ function buildEnvironmentOutputConfig() {
|
|
|
1127
1231
|
placeholderMap
|
|
1128
1232
|
};
|
|
1129
1233
|
}
|
|
1234
|
+
function buildEnvironmentFilterConfig() {
|
|
1235
|
+
const includeTables = resolveFallbackValue(TABLES_ENV_KEYS);
|
|
1236
|
+
const excludeTables = resolveFallbackValue(EXCLUDE_TABLES_ENV_KEYS);
|
|
1237
|
+
if (includeTables === void 0 && excludeTables === void 0) {
|
|
1238
|
+
return void 0;
|
|
1239
|
+
}
|
|
1240
|
+
return {
|
|
1241
|
+
...includeTables !== void 0 ? { includeTables } : {},
|
|
1242
|
+
...excludeTables !== void 0 ? { excludeTables } : {}
|
|
1243
|
+
};
|
|
1244
|
+
}
|
|
1130
1245
|
function buildEnvironmentNamingConfig() {
|
|
1131
1246
|
const modelType = resolveOptionalOneOf(MODEL_TYPE_ENV_KEYS, NAMING_STYLE_VALUES);
|
|
1132
1247
|
const modelConst = resolveOptionalOneOf(MODEL_CONST_ENV_KEYS, NAMING_STYLE_VALUES);
|
|
@@ -1202,6 +1317,7 @@ function createEnvironmentGeneratorConfig() {
|
|
|
1202
1317
|
provider,
|
|
1203
1318
|
output: buildEnvironmentOutputConfig(),
|
|
1204
1319
|
naming: buildEnvironmentNamingConfig(),
|
|
1320
|
+
filter: buildEnvironmentFilterConfig(),
|
|
1205
1321
|
features: buildEnvironmentFeatureFlags(),
|
|
1206
1322
|
experimental: buildEnvironmentExperimentalFlags()
|
|
1207
1323
|
};
|
|
@@ -1363,7 +1479,7 @@ ${schemaEntries}
|
|
|
1363
1479
|
content
|
|
1364
1480
|
};
|
|
1365
1481
|
}
|
|
1366
|
-
function renderRegistryArtifact(registryPath, databasePath, databaseConstName, registryConstName, databaseName, generatedAt, outputFormat, schemaVersion) {
|
|
1482
|
+
function renderRegistryArtifact(registryPath, databasePath, databaseConstName, registryConstName, databaseName, generatedAt, outputPreset, outputFormat, schemaVersion) {
|
|
1367
1483
|
const databaseImportPath = toModuleImportPath(registryPath, databasePath);
|
|
1368
1484
|
const content = `import { defineRegistry } from '@xylex-group/athena'
|
|
1369
1485
|
import { ${databaseConstName} } from '${databaseImportPath}'
|
|
@@ -1372,6 +1488,7 @@ export const __athena_schema_meta = {
|
|
|
1372
1488
|
schemaVersion: ${schemaVersion},
|
|
1373
1489
|
generatedAt: ${escapeStringLiteral(generatedAt)},
|
|
1374
1490
|
database: ${escapeStringLiteral(databaseName)},
|
|
1491
|
+
outputPreset: ${escapeStringLiteral(outputPreset)},
|
|
1375
1492
|
outputFormat: ${escapeStringLiteral(outputFormat)},
|
|
1376
1493
|
} as const
|
|
1377
1494
|
|
|
@@ -1541,6 +1658,7 @@ function composeGeneratorArtifacts(input) {
|
|
|
1541
1658
|
toSafeIdentifier("registry", config.naming.registryConst, "registry"),
|
|
1542
1659
|
databaseName,
|
|
1543
1660
|
snapshot.generatedAt,
|
|
1661
|
+
config.output.preset,
|
|
1544
1662
|
config.output.format,
|
|
1545
1663
|
config.internal.schemaVersion
|
|
1546
1664
|
)
|
|
@@ -1646,7 +1764,7 @@ export const ${descriptor.tableConstName} = table(${escapeStringLiteral(descript
|
|
|
1646
1764
|
.columns({
|
|
1647
1765
|
${columnLines}
|
|
1648
1766
|
})
|
|
1649
|
-
.primaryKey(${descriptor.table.primaryKey.map((value) => escapeStringLiteral(value)).join(", ")})
|
|
1767
|
+
${descriptor.table.primaryKey.length > 0 ? `.primaryKey(${descriptor.table.primaryKey.map((value) => escapeStringLiteral(value)).join(", ")})` : ".withoutPrimaryKey()"}
|
|
1650
1768
|
${relationsAssignment ? `${relationsAssignment}` : ""}
|
|
1651
1769
|
export type ${descriptor.rowTypeName} = RowOf<typeof ${descriptor.tableConstName}>
|
|
1652
1770
|
export type ${descriptor.insertTypeName} = InsertOf<typeof ${descriptor.tableConstName}>
|
|
@@ -1743,11 +1861,12 @@ ${nullableLines}
|
|
|
1743
1861
|
}
|
|
1744
1862
|
function generateArtifactsFromSnapshot(snapshot, config) {
|
|
1745
1863
|
const normalizedConfig = "internal" in config ? config : normalizeGeneratorConfig(config);
|
|
1864
|
+
const filteredSnapshot = filterIntrospectionSnapshot(snapshot, normalizedConfig.filter);
|
|
1746
1865
|
if (normalizedConfig.output.format === "table-builder") {
|
|
1747
|
-
return generateTableBuilderArtifactsFromSnapshot(
|
|
1866
|
+
return generateTableBuilderArtifactsFromSnapshot(filteredSnapshot, normalizedConfig);
|
|
1748
1867
|
}
|
|
1749
1868
|
return composeGeneratorArtifacts({
|
|
1750
|
-
snapshot,
|
|
1869
|
+
snapshot: filteredSnapshot,
|
|
1751
1870
|
config: normalizedConfig,
|
|
1752
1871
|
createModelDescriptor({ providerName, databaseName, schemaName, tableName, table }) {
|
|
1753
1872
|
const modelConstName = toSafeIdentifier(
|
|
@@ -1777,7 +1896,7 @@ function generateArtifactsFromSnapshot(snapshot, config) {
|
|
|
1777
1896
|
table
|
|
1778
1897
|
};
|
|
1779
1898
|
},
|
|
1780
|
-
renderModelArtifact: (descriptor) => renderModelArtifact2(
|
|
1899
|
+
renderModelArtifact: (descriptor) => renderModelArtifact2(filteredSnapshot.database, descriptor, normalizedConfig)
|
|
1781
1900
|
});
|
|
1782
1901
|
}
|
|
1783
1902
|
|
|
@@ -1883,7 +2002,7 @@ var getSessionCookie = (request, config) => {
|
|
|
1883
2002
|
|
|
1884
2003
|
// package.json
|
|
1885
2004
|
var package_default = {
|
|
1886
|
-
version: "2.
|
|
2005
|
+
version: "2.9.0"
|
|
1887
2006
|
};
|
|
1888
2007
|
|
|
1889
2008
|
// src/sdk-version.ts
|
|
@@ -1896,6 +2015,7 @@ function buildSdkHeaderValue(sdkName) {
|
|
|
1896
2015
|
var DEFAULT_CLIENT = "railway_direct";
|
|
1897
2016
|
var SDK_NAME = "xylex-group/athena";
|
|
1898
2017
|
var SDK_HEADER_VALUE = buildSdkHeaderValue(SDK_NAME);
|
|
2018
|
+
var NO_CACHE_HEADER_VALUE = "no-cache";
|
|
1899
2019
|
function parseResponseBody(rawText, contentType) {
|
|
1900
2020
|
if (!rawText) {
|
|
1901
2021
|
return { parsed: null, parseFailed: false };
|
|
@@ -1914,6 +2034,9 @@ function parseResponseBody(rawText, contentType) {
|
|
|
1914
2034
|
function normalizeHeaderValue(value) {
|
|
1915
2035
|
return value ? value : void 0;
|
|
1916
2036
|
}
|
|
2037
|
+
function isCacheControlHeaderName(name) {
|
|
2038
|
+
return name.toLowerCase() === "cache-control";
|
|
2039
|
+
}
|
|
1917
2040
|
function resolveHeaderValue(headers, candidates) {
|
|
1918
2041
|
for (const candidate of candidates) {
|
|
1919
2042
|
const direct = normalizeHeaderValue(headers[candidate]);
|
|
@@ -2072,6 +2195,7 @@ function buildRpcGetEndpoint(payload) {
|
|
|
2072
2195
|
}
|
|
2073
2196
|
function buildHeaders(config, options) {
|
|
2074
2197
|
const mergedStripNulls = options?.stripNulls ?? true;
|
|
2198
|
+
const forceNoCache = Boolean(config.forceNoCache || options?.forceNoCache);
|
|
2075
2199
|
const extraHeaders = {
|
|
2076
2200
|
...config.headers ?? {},
|
|
2077
2201
|
...options?.headers ?? {}
|
|
@@ -2125,11 +2249,15 @@ function buildHeaders(config, options) {
|
|
|
2125
2249
|
const athenaClientKeys = ["x-athena-client", "X-Athena-Client"];
|
|
2126
2250
|
Object.entries(extraHeaders).forEach(([key, value]) => {
|
|
2127
2251
|
if (athenaClientKeys.includes(key)) return;
|
|
2252
|
+
if (forceNoCache && isCacheControlHeaderName(key)) return;
|
|
2128
2253
|
const normalized = normalizeHeaderValue(value);
|
|
2129
2254
|
if (normalized) {
|
|
2130
2255
|
headers[key] = normalized;
|
|
2131
2256
|
}
|
|
2132
2257
|
});
|
|
2258
|
+
if (forceNoCache) {
|
|
2259
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE;
|
|
2260
|
+
}
|
|
2133
2261
|
return headers;
|
|
2134
2262
|
}
|
|
2135
2263
|
function toInvalidUrlResponse(error, endpoint, method) {
|
|
@@ -2569,6 +2697,35 @@ function quoteSelectColumnsExpression(columns) {
|
|
|
2569
2697
|
}
|
|
2570
2698
|
return tokens.map(quoteSelectToken).join(", ");
|
|
2571
2699
|
}
|
|
2700
|
+
var ATHENA_AUTH_MAX_TEMPLATE_VARIABLES = 64;
|
|
2701
|
+
var ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH = 128;
|
|
2702
|
+
function describeTemplateVariableTarget(target) {
|
|
2703
|
+
const normalized = target?.trim();
|
|
2704
|
+
return normalized && normalized.length > 0 ? normalized : "Athena auth admin email template variables";
|
|
2705
|
+
}
|
|
2706
|
+
function assertAthenaAuthTemplateVariables(variables, target) {
|
|
2707
|
+
const label = describeTemplateVariableTarget(target);
|
|
2708
|
+
if (!Array.isArray(variables)) {
|
|
2709
|
+
throw new Error(`${label} must be an array of strings.`);
|
|
2710
|
+
}
|
|
2711
|
+
if (variables.length > ATHENA_AUTH_MAX_TEMPLATE_VARIABLES) {
|
|
2712
|
+
throw new Error(
|
|
2713
|
+
`${label} cannot contain more than ${ATHENA_AUTH_MAX_TEMPLATE_VARIABLES} entries.`
|
|
2714
|
+
);
|
|
2715
|
+
}
|
|
2716
|
+
variables.forEach((variable, index) => {
|
|
2717
|
+
if (typeof variable !== "string") {
|
|
2718
|
+
throw new Error(
|
|
2719
|
+
`${label} must contain only strings. Received ${typeof variable} at index ${index}.`
|
|
2720
|
+
);
|
|
2721
|
+
}
|
|
2722
|
+
if (variable.length > ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH) {
|
|
2723
|
+
throw new Error(
|
|
2724
|
+
`${label} cannot contain entries longer than ${ATHENA_AUTH_MAX_TEMPLATE_VARIABLE_LENGTH} characters. Received ${variable.length} characters at index ${index}.`
|
|
2725
|
+
);
|
|
2726
|
+
}
|
|
2727
|
+
});
|
|
2728
|
+
}
|
|
2572
2729
|
|
|
2573
2730
|
// src/auth/react-email.ts
|
|
2574
2731
|
var reactEmailRenderModulePromise;
|
|
@@ -2758,6 +2915,7 @@ async function resolveReactEmailPayloadFields(input, fields, options) {
|
|
|
2758
2915
|
var DEFAULT_AUTH_BASE_URL = "http://localhost:3001/api/auth";
|
|
2759
2916
|
var SDK_NAME2 = "xylex-group/athena-auth";
|
|
2760
2917
|
var SDK_HEADER_VALUE2 = buildSdkHeaderValue(SDK_NAME2);
|
|
2918
|
+
var NO_CACHE_HEADER_VALUE2 = "no-cache";
|
|
2761
2919
|
function normalizeBaseUrl(baseUrl) {
|
|
2762
2920
|
return (baseUrl ?? DEFAULT_AUTH_BASE_URL).replace(/\/$/, "");
|
|
2763
2921
|
}
|
|
@@ -2767,6 +2925,9 @@ function isRecord4(value) {
|
|
|
2767
2925
|
function normalizeHeaderValue2(value) {
|
|
2768
2926
|
return value ? value : void 0;
|
|
2769
2927
|
}
|
|
2928
|
+
function isCacheControlHeaderName2(name) {
|
|
2929
|
+
return name.toLowerCase() === "cache-control";
|
|
2930
|
+
}
|
|
2770
2931
|
function parseResponseBody2(rawText, contentType) {
|
|
2771
2932
|
if (!rawText) {
|
|
2772
2933
|
return { parsed: null, parseFailed: false };
|
|
@@ -2822,6 +2983,54 @@ function mergeCallOptions(base, override) {
|
|
|
2822
2983
|
}
|
|
2823
2984
|
};
|
|
2824
2985
|
}
|
|
2986
|
+
function toSessionGuardFailure(sessionResult) {
|
|
2987
|
+
if (sessionResult.status === 401 || sessionResult.data == null) {
|
|
2988
|
+
return {
|
|
2989
|
+
ok: false,
|
|
2990
|
+
reason: "unauthorized",
|
|
2991
|
+
status: 401,
|
|
2992
|
+
error: sessionResult.error ?? "Unauthorized",
|
|
2993
|
+
sessionResult
|
|
2994
|
+
};
|
|
2995
|
+
}
|
|
2996
|
+
return {
|
|
2997
|
+
ok: false,
|
|
2998
|
+
reason: "upstream_error",
|
|
2999
|
+
status: sessionResult.status,
|
|
3000
|
+
error: sessionResult.error ?? "Failed to resolve current session",
|
|
3001
|
+
sessionResult
|
|
3002
|
+
};
|
|
3003
|
+
}
|
|
3004
|
+
function toPermissionGuardFailure(permissionResult, sessionResult) {
|
|
3005
|
+
if (permissionResult.status === 401) {
|
|
3006
|
+
return {
|
|
3007
|
+
ok: false,
|
|
3008
|
+
reason: "unauthorized",
|
|
3009
|
+
status: 401,
|
|
3010
|
+
error: permissionResult.error ?? "Unauthorized",
|
|
3011
|
+
sessionResult,
|
|
3012
|
+
permissionResult
|
|
3013
|
+
};
|
|
3014
|
+
}
|
|
3015
|
+
if (permissionResult.status === 403) {
|
|
3016
|
+
return {
|
|
3017
|
+
ok: false,
|
|
3018
|
+
reason: "forbidden",
|
|
3019
|
+
status: 403,
|
|
3020
|
+
error: permissionResult.error ?? "Forbidden",
|
|
3021
|
+
sessionResult,
|
|
3022
|
+
permissionResult
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
return {
|
|
3026
|
+
ok: false,
|
|
3027
|
+
reason: "upstream_error",
|
|
3028
|
+
status: permissionResult.status,
|
|
3029
|
+
error: permissionResult.error ?? "Failed to resolve permission check",
|
|
3030
|
+
sessionResult,
|
|
3031
|
+
permissionResult
|
|
3032
|
+
};
|
|
3033
|
+
}
|
|
2825
3034
|
function extractFetchOptions(input) {
|
|
2826
3035
|
if (!input) {
|
|
2827
3036
|
return {
|
|
@@ -2837,6 +3046,7 @@ function extractFetchOptions(input) {
|
|
|
2837
3046
|
};
|
|
2838
3047
|
}
|
|
2839
3048
|
function buildHeaders2(config, options) {
|
|
3049
|
+
const forceNoCache = Boolean(config.forceNoCache || options?.forceNoCache);
|
|
2840
3050
|
const headers = {
|
|
2841
3051
|
"Content-Type": "application/json",
|
|
2842
3052
|
"X-Athena-Sdk": SDK_HEADER_VALUE2
|
|
@@ -2850,16 +3060,30 @@ function buildHeaders2(config, options) {
|
|
|
2850
3060
|
if (bearerToken) {
|
|
2851
3061
|
headers.Authorization = `Bearer ${bearerToken}`;
|
|
2852
3062
|
}
|
|
3063
|
+
const cookie = options?.cookie ?? config.cookie;
|
|
3064
|
+
if (cookie) {
|
|
3065
|
+
headers.Cookie = cookie;
|
|
3066
|
+
}
|
|
3067
|
+
const sessionToken = options?.sessionToken ?? config.sessionToken;
|
|
3068
|
+
if (sessionToken) {
|
|
3069
|
+
headers["X-Athena-Auth-Session-Token"] = sessionToken;
|
|
3070
|
+
}
|
|
2853
3071
|
const mergedExtraHeaders = {
|
|
2854
3072
|
...config.headers ?? {},
|
|
2855
3073
|
...options?.headers ?? {}
|
|
2856
3074
|
};
|
|
2857
3075
|
Object.entries(mergedExtraHeaders).forEach(([key, value]) => {
|
|
3076
|
+
if (forceNoCache && isCacheControlHeaderName2(key)) {
|
|
3077
|
+
return;
|
|
3078
|
+
}
|
|
2858
3079
|
const normalized = normalizeHeaderValue2(value);
|
|
2859
3080
|
if (normalized) {
|
|
2860
3081
|
headers[key] = normalized;
|
|
2861
3082
|
}
|
|
2862
3083
|
});
|
|
3084
|
+
if (forceNoCache) {
|
|
3085
|
+
headers["Cache-Control"] = NO_CACHE_HEADER_VALUE2;
|
|
3086
|
+
}
|
|
2863
3087
|
return headers;
|
|
2864
3088
|
}
|
|
2865
3089
|
function appendQueryParam(searchParams, key, value) {
|
|
@@ -3124,7 +3348,91 @@ function createAuthClient(config = {}) {
|
|
|
3124
3348
|
htmlField: "htmlTemplate",
|
|
3125
3349
|
textField: "textTemplate",
|
|
3126
3350
|
variablesField: "variables"
|
|
3127
|
-
}, withReactEmailRoute(route))
|
|
3351
|
+
}, withReactEmailRoute(route)).then((payload) => {
|
|
3352
|
+
if ("variables" in payload && payload.variables !== void 0 && payload.variables !== null) {
|
|
3353
|
+
assertAthenaAuthTemplateVariables(
|
|
3354
|
+
payload.variables,
|
|
3355
|
+
`${route} variables`
|
|
3356
|
+
);
|
|
3357
|
+
}
|
|
3358
|
+
return payload;
|
|
3359
|
+
});
|
|
3360
|
+
const requireSession = async (input, options) => {
|
|
3361
|
+
const sessionInput = input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0;
|
|
3362
|
+
const sessionResult = await getGeneric(
|
|
3363
|
+
"/get-session",
|
|
3364
|
+
sessionInput,
|
|
3365
|
+
options
|
|
3366
|
+
);
|
|
3367
|
+
if (!sessionResult.ok || sessionResult.data == null) {
|
|
3368
|
+
return toSessionGuardFailure(sessionResult);
|
|
3369
|
+
}
|
|
3370
|
+
return {
|
|
3371
|
+
ok: true,
|
|
3372
|
+
session: sessionResult.data
|
|
3373
|
+
};
|
|
3374
|
+
};
|
|
3375
|
+
const getUser = async (input, options) => {
|
|
3376
|
+
const sessionResult = await getGeneric(
|
|
3377
|
+
"/get-session",
|
|
3378
|
+
input,
|
|
3379
|
+
options
|
|
3380
|
+
);
|
|
3381
|
+
if (!sessionResult.ok) {
|
|
3382
|
+
return {
|
|
3383
|
+
...sessionResult,
|
|
3384
|
+
data: null
|
|
3385
|
+
};
|
|
3386
|
+
}
|
|
3387
|
+
return {
|
|
3388
|
+
...sessionResult,
|
|
3389
|
+
data: {
|
|
3390
|
+
user: sessionResult.data?.user ?? null
|
|
3391
|
+
}
|
|
3392
|
+
};
|
|
3393
|
+
};
|
|
3394
|
+
const requirePermission = async (endpoint, input, options) => {
|
|
3395
|
+
const sessionGuard = await requireSession(
|
|
3396
|
+
input?.fetchOptions ? { fetchOptions: input.fetchOptions } : void 0,
|
|
3397
|
+
options
|
|
3398
|
+
);
|
|
3399
|
+
if (!sessionGuard.ok) {
|
|
3400
|
+
return sessionGuard;
|
|
3401
|
+
}
|
|
3402
|
+
const permissionResult = await postGeneric(
|
|
3403
|
+
endpoint,
|
|
3404
|
+
input,
|
|
3405
|
+
options
|
|
3406
|
+
);
|
|
3407
|
+
if (!permissionResult.ok) {
|
|
3408
|
+
return toPermissionGuardFailure(permissionResult, {
|
|
3409
|
+
ok: true,
|
|
3410
|
+
status: 200,
|
|
3411
|
+
data: sessionGuard.session,
|
|
3412
|
+
error: null,
|
|
3413
|
+
errorDetails: null,
|
|
3414
|
+
raw: sessionGuard.session
|
|
3415
|
+
});
|
|
3416
|
+
}
|
|
3417
|
+
if (!permissionResult.data?.success) {
|
|
3418
|
+
return {
|
|
3419
|
+
ok: false,
|
|
3420
|
+
reason: "forbidden",
|
|
3421
|
+
status: 403,
|
|
3422
|
+
error: permissionResult.data?.error ?? "Forbidden",
|
|
3423
|
+
sessionResult: {
|
|
3424
|
+
ok: true,
|
|
3425
|
+
status: 200,
|
|
3426
|
+
data: sessionGuard.session,
|
|
3427
|
+
error: null,
|
|
3428
|
+
errorDetails: null,
|
|
3429
|
+
raw: sessionGuard.session
|
|
3430
|
+
},
|
|
3431
|
+
permissionResult
|
|
3432
|
+
};
|
|
3433
|
+
}
|
|
3434
|
+
return sessionGuard;
|
|
3435
|
+
};
|
|
3128
3436
|
const listUserEmailsWithFallback = async (input, options) => {
|
|
3129
3437
|
const primary = await getWithQuery(
|
|
3130
3438
|
"/email/list",
|
|
@@ -3286,6 +3594,7 @@ function createAuthClient(config = {}) {
|
|
|
3286
3594
|
input,
|
|
3287
3595
|
options
|
|
3288
3596
|
),
|
|
3597
|
+
requirePermission: (input, options) => requirePermission("/organization/has-permission", input, options),
|
|
3289
3598
|
invitation: {
|
|
3290
3599
|
cancel: (input, options) => executePostWithCompatibleInput(
|
|
3291
3600
|
resolvedConfig,
|
|
@@ -3481,6 +3790,8 @@ function createAuthClient(config = {}) {
|
|
|
3481
3790
|
};
|
|
3482
3791
|
const auth = {
|
|
3483
3792
|
getSession: (input, options) => getGeneric("/get-session", input, options),
|
|
3793
|
+
getUser,
|
|
3794
|
+
requireSession,
|
|
3484
3795
|
signOut,
|
|
3485
3796
|
forgetPassword: (input, options) => postGeneric("/forget-password", input, options),
|
|
3486
3797
|
resetPassword: authResetPassword,
|
|
@@ -3575,6 +3886,7 @@ function createAuthClient(config = {}) {
|
|
|
3575
3886
|
}
|
|
3576
3887
|
},
|
|
3577
3888
|
hasPermission: (input, options) => postGeneric("/admin/has-permission", input, options),
|
|
3889
|
+
requirePermission: (input, options) => requirePermission("/admin/has-permission", input, options),
|
|
3578
3890
|
apiKey: {
|
|
3579
3891
|
create: (input, options) => postGeneric("/admin/api-key/create", input, options)
|
|
3580
3892
|
},
|
|
@@ -3726,6 +4038,8 @@ function createAuthClient(config = {}) {
|
|
|
3726
4038
|
input,
|
|
3727
4039
|
options
|
|
3728
4040
|
),
|
|
4041
|
+
getUser,
|
|
4042
|
+
requireSession,
|
|
3729
4043
|
listSessions: (input, options) => executeGetWithCompatibleInput(
|
|
3730
4044
|
resolvedConfig,
|
|
3731
4045
|
{ endpoint: "/list-sessions", method: "GET" },
|
|
@@ -3879,7 +4193,12 @@ function createStorageFileModule(base, config = {}) {
|
|
|
3879
4193
|
content_type: input.content_type ?? source.contentType,
|
|
3880
4194
|
size_bytes: source.sizeBytes,
|
|
3881
4195
|
public: input.public,
|
|
3882
|
-
metadata: input.metadata
|
|
4196
|
+
metadata: input.metadata,
|
|
4197
|
+
server_side_encryption: input.server_side_encryption,
|
|
4198
|
+
sse: input.sse,
|
|
4199
|
+
ssekms_key_id: input.ssekms_key_id,
|
|
4200
|
+
kms_key_id: input.kms_key_id,
|
|
4201
|
+
bucket_key_enabled: input.bucket_key_enabled
|
|
3883
4202
|
}
|
|
3884
4203
|
};
|
|
3885
4204
|
});
|
|
@@ -3890,10 +4209,17 @@ function createStorageFileModule(base, config = {}) {
|
|
|
3890
4209
|
for (let index = 0; index < uploadRequests.length; index += 1) {
|
|
3891
4210
|
const request = uploadRequests[index];
|
|
3892
4211
|
const uploadUrl = uploadUrls[index];
|
|
3893
|
-
const response = await putUploadBody(
|
|
3894
|
-
|
|
3895
|
-
|
|
3896
|
-
|
|
4212
|
+
const response = await putUploadBody(
|
|
4213
|
+
uploadUrl.upload.url,
|
|
4214
|
+
uploadUrl.upload.headers ?? {},
|
|
4215
|
+
request.source,
|
|
4216
|
+
input,
|
|
4217
|
+
options,
|
|
4218
|
+
(progress) => {
|
|
4219
|
+
aggregateLoaded[index] = progress.loaded;
|
|
4220
|
+
input.onProgress?.(createProgressSnapshot("uploading", sources, index, progress.loaded, sum(aggregateLoaded)));
|
|
4221
|
+
}
|
|
4222
|
+
);
|
|
3897
4223
|
uploaded.push({
|
|
3898
4224
|
file: uploadUrl.file,
|
|
3899
4225
|
upload: uploadUrl.upload,
|
|
@@ -3996,8 +4322,9 @@ function validateUploadConstraints(sources, input) {
|
|
|
3996
4322
|
}
|
|
3997
4323
|
}
|
|
3998
4324
|
}
|
|
3999
|
-
async function putUploadBody(url, source, input, options, onProgress) {
|
|
4000
|
-
const headers = new Headers(
|
|
4325
|
+
async function putUploadBody(url, uploadHeaders, source, input, options, onProgress) {
|
|
4326
|
+
const headers = new Headers(uploadHeaders);
|
|
4327
|
+
new Headers(input.uploadHeaders).forEach((value, key) => headers.set(key, value));
|
|
4001
4328
|
if (source.contentType && !headers.has("Content-Type")) {
|
|
4002
4329
|
headers.set("Content-Type", source.contentType);
|
|
4003
4330
|
}
|
|
@@ -4208,129 +4535,624 @@ var storageSdkManifest = {
|
|
|
4208
4535
|
responseType: "{ data: S3CatalogItem[] }"
|
|
4209
4536
|
},
|
|
4210
4537
|
{
|
|
4211
|
-
name: "createStorageCatalog",
|
|
4538
|
+
name: "createStorageCatalog",
|
|
4539
|
+
method: "POST",
|
|
4540
|
+
path: "/storage/catalogs",
|
|
4541
|
+
requestType: "CreateStorageCatalogRequest",
|
|
4542
|
+
responseEnvelope: "raw",
|
|
4543
|
+
responseType: "S3CatalogItem"
|
|
4544
|
+
},
|
|
4545
|
+
{
|
|
4546
|
+
name: "updateStorageCatalog",
|
|
4547
|
+
method: "PATCH",
|
|
4548
|
+
path: "/storage/catalogs/{id}",
|
|
4549
|
+
pathParams: ["id"],
|
|
4550
|
+
requestType: "UpdateStorageCatalogRequest",
|
|
4551
|
+
responseEnvelope: "raw",
|
|
4552
|
+
responseType: "S3CatalogItem"
|
|
4553
|
+
},
|
|
4554
|
+
{
|
|
4555
|
+
name: "deleteStorageCatalog",
|
|
4556
|
+
method: "DELETE",
|
|
4557
|
+
path: "/storage/catalogs/{id}",
|
|
4558
|
+
pathParams: ["id"],
|
|
4559
|
+
responseEnvelope: "raw",
|
|
4560
|
+
responseType: "{ id: string; deleted: boolean }"
|
|
4561
|
+
},
|
|
4562
|
+
{
|
|
4563
|
+
name: "listStorageCredentials",
|
|
4564
|
+
method: "GET",
|
|
4565
|
+
path: "/storage/credentials",
|
|
4566
|
+
responseEnvelope: "raw",
|
|
4567
|
+
responseType: "{ data: S3CredentialListItem[] }"
|
|
4568
|
+
},
|
|
4569
|
+
{
|
|
4570
|
+
name: "createStorageUploadUrl",
|
|
4571
|
+
method: "POST",
|
|
4572
|
+
path: "/storage/files/upload-url",
|
|
4573
|
+
requestType: "CreateStorageUploadUrlRequest",
|
|
4574
|
+
responseEnvelope: "athena",
|
|
4575
|
+
responseType: "StorageUploadUrlResponse"
|
|
4576
|
+
},
|
|
4577
|
+
{
|
|
4578
|
+
name: "createStorageUploadUrls",
|
|
4579
|
+
method: "POST",
|
|
4580
|
+
path: "/storage/files/upload-urls",
|
|
4581
|
+
requestType: "CreateStorageUploadUrlsRequest",
|
|
4582
|
+
responseEnvelope: "athena",
|
|
4583
|
+
responseType: "StorageBatchUploadUrlResponse"
|
|
4584
|
+
},
|
|
4585
|
+
{
|
|
4586
|
+
name: "listStorageFiles",
|
|
4587
|
+
method: "POST",
|
|
4588
|
+
path: "/storage/files/list",
|
|
4589
|
+
requestType: "ListStorageFilesRequest",
|
|
4590
|
+
responseEnvelope: "athena",
|
|
4591
|
+
responseType: "StorageListFilesResponse"
|
|
4592
|
+
},
|
|
4593
|
+
{
|
|
4594
|
+
name: "getStorageFile",
|
|
4595
|
+
method: "GET",
|
|
4596
|
+
path: "/storage/files/{file_id}",
|
|
4597
|
+
pathParams: ["file_id"],
|
|
4598
|
+
responseEnvelope: "athena",
|
|
4599
|
+
responseType: "StorageFileMutationResponse"
|
|
4600
|
+
},
|
|
4601
|
+
{
|
|
4602
|
+
name: "getStorageFileUrl",
|
|
4603
|
+
method: "GET",
|
|
4604
|
+
path: "/storage/files/{file_id}/url",
|
|
4605
|
+
pathParams: ["file_id"],
|
|
4606
|
+
queryParams: ["purpose"],
|
|
4607
|
+
responseEnvelope: "athena",
|
|
4608
|
+
responseType: "PresignedFileUrlResponse"
|
|
4609
|
+
},
|
|
4610
|
+
{
|
|
4611
|
+
name: "getStorageFileProxy",
|
|
4612
|
+
method: "GET",
|
|
4613
|
+
path: "/storage/files/{file_id}/proxy",
|
|
4614
|
+
pathParams: ["file_id"],
|
|
4615
|
+
queryParams: ["purpose"],
|
|
4616
|
+
responseEnvelope: "raw",
|
|
4617
|
+
responseType: "Response",
|
|
4618
|
+
binary: true
|
|
4619
|
+
},
|
|
4620
|
+
{
|
|
4621
|
+
name: "updateStorageFile",
|
|
4622
|
+
method: "PATCH",
|
|
4623
|
+
path: "/storage/files/{file_id}",
|
|
4624
|
+
pathParams: ["file_id"],
|
|
4625
|
+
requestType: "UpdateStorageFileRequest",
|
|
4626
|
+
responseEnvelope: "athena",
|
|
4627
|
+
responseType: "StorageFileMutationResponse"
|
|
4628
|
+
},
|
|
4629
|
+
{
|
|
4630
|
+
name: "deleteStorageFile",
|
|
4631
|
+
method: "DELETE",
|
|
4632
|
+
path: "/storage/files/{file_id}",
|
|
4633
|
+
pathParams: ["file_id"],
|
|
4634
|
+
responseEnvelope: "athena",
|
|
4635
|
+
responseType: "StorageFileMutationResponse"
|
|
4636
|
+
},
|
|
4637
|
+
{
|
|
4638
|
+
name: "setStorageFileVisibility",
|
|
4639
|
+
method: "PATCH",
|
|
4640
|
+
path: "/storage/files/{file_id}/visibility",
|
|
4641
|
+
pathParams: ["file_id"],
|
|
4642
|
+
requestType: "SetStorageFileVisibilityRequest",
|
|
4643
|
+
responseEnvelope: "athena",
|
|
4644
|
+
responseType: "StorageFileMutationResponse"
|
|
4645
|
+
},
|
|
4646
|
+
{
|
|
4647
|
+
name: "postStorageFileVisibility",
|
|
4648
|
+
method: "POST",
|
|
4649
|
+
path: "/storage/files/{file_id}/visibility",
|
|
4650
|
+
pathParams: ["file_id"],
|
|
4651
|
+
requestType: "SetStorageFileVisibilityRequest",
|
|
4652
|
+
responseEnvelope: "athena",
|
|
4653
|
+
responseType: "StorageFileMutationResponse"
|
|
4654
|
+
},
|
|
4655
|
+
{
|
|
4656
|
+
name: "setManyStorageFileVisibility",
|
|
4657
|
+
method: "POST",
|
|
4658
|
+
path: "/storage/files/visibility-many",
|
|
4659
|
+
requestType: "SetManyStorageFileVisibilityRequest",
|
|
4660
|
+
responseEnvelope: "athena",
|
|
4661
|
+
responseType: "StorageFileMutationManyResponse"
|
|
4662
|
+
},
|
|
4663
|
+
{
|
|
4664
|
+
name: "deleteStorageFolder",
|
|
4665
|
+
method: "POST",
|
|
4666
|
+
path: "/storage/folders/delete",
|
|
4667
|
+
requestType: "DeleteStorageFolderRequest",
|
|
4668
|
+
responseEnvelope: "athena",
|
|
4669
|
+
responseType: "StorageFolderMutationResponse"
|
|
4670
|
+
},
|
|
4671
|
+
{
|
|
4672
|
+
name: "moveStorageFolder",
|
|
4673
|
+
method: "POST",
|
|
4674
|
+
path: "/storage/folders/move",
|
|
4675
|
+
requestType: "MoveStorageFolderRequest",
|
|
4676
|
+
responseEnvelope: "athena",
|
|
4677
|
+
responseType: "StorageFolderMutationResponse"
|
|
4678
|
+
},
|
|
4679
|
+
{
|
|
4680
|
+
name: "searchStorageFiles",
|
|
4681
|
+
method: "POST",
|
|
4682
|
+
path: "/storage/files/search",
|
|
4683
|
+
requestType: "SearchStorageFilesRequest",
|
|
4684
|
+
responseEnvelope: "athena",
|
|
4685
|
+
responseType: "StorageListFilesResponse"
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
name: "confirmStorageUpload",
|
|
4689
|
+
method: "POST",
|
|
4690
|
+
path: "/storage/files/{file_id}/confirm-upload",
|
|
4691
|
+
pathParams: ["file_id"],
|
|
4692
|
+
requestType: "ConfirmStorageUploadRequest",
|
|
4693
|
+
responseEnvelope: "athena",
|
|
4694
|
+
responseType: "StorageFileMutationResponse"
|
|
4695
|
+
},
|
|
4696
|
+
{
|
|
4697
|
+
name: "uploadStorageFileBinary",
|
|
4698
|
+
method: "PUT",
|
|
4699
|
+
path: "/storage/files/{file_id}/upload",
|
|
4700
|
+
pathParams: ["file_id"],
|
|
4701
|
+
responseEnvelope: "athena",
|
|
4702
|
+
responseType: "StorageFileMutationResponse",
|
|
4703
|
+
binary: true
|
|
4704
|
+
},
|
|
4705
|
+
{
|
|
4706
|
+
name: "copyStorageFile",
|
|
4707
|
+
method: "POST",
|
|
4708
|
+
path: "/storage/files/{file_id}/copy",
|
|
4709
|
+
pathParams: ["file_id"],
|
|
4710
|
+
requestType: "CopyStorageFileRequest",
|
|
4711
|
+
responseEnvelope: "athena",
|
|
4712
|
+
responseType: "StorageFileMutationResponse"
|
|
4713
|
+
},
|
|
4714
|
+
{
|
|
4715
|
+
name: "deleteManyStorageFiles",
|
|
4716
|
+
method: "POST",
|
|
4717
|
+
path: "/storage/files/delete-many",
|
|
4718
|
+
requestType: "DeleteManyStorageFilesRequest",
|
|
4719
|
+
responseEnvelope: "athena",
|
|
4720
|
+
responseType: "StorageFileMutationManyResponse"
|
|
4721
|
+
},
|
|
4722
|
+
{
|
|
4723
|
+
name: "updateManyStorageFiles",
|
|
4724
|
+
method: "POST",
|
|
4725
|
+
path: "/storage/files/update-many",
|
|
4726
|
+
requestType: "UpdateManyStorageFilesRequest",
|
|
4727
|
+
responseEnvelope: "athena",
|
|
4728
|
+
responseType: "StorageFileMutationManyResponse"
|
|
4729
|
+
},
|
|
4730
|
+
{
|
|
4731
|
+
name: "restoreStorageFile",
|
|
4732
|
+
method: "POST",
|
|
4733
|
+
path: "/storage/files/{file_id}/restore",
|
|
4734
|
+
pathParams: ["file_id"],
|
|
4735
|
+
responseEnvelope: "athena",
|
|
4736
|
+
responseType: "StorageFileMutationResponse"
|
|
4737
|
+
},
|
|
4738
|
+
{
|
|
4739
|
+
name: "purgeStorageFile",
|
|
4740
|
+
method: "DELETE",
|
|
4741
|
+
path: "/storage/files/{file_id}/purge",
|
|
4742
|
+
pathParams: ["file_id"],
|
|
4743
|
+
responseEnvelope: "athena",
|
|
4744
|
+
responseType: "StorageFileMutationResponse"
|
|
4745
|
+
},
|
|
4746
|
+
{
|
|
4747
|
+
name: "getStorageFilePublicUrl",
|
|
4748
|
+
method: "GET",
|
|
4749
|
+
path: "/storage/files/{file_id}/public-url",
|
|
4750
|
+
pathParams: ["file_id"],
|
|
4751
|
+
responseEnvelope: "athena",
|
|
4752
|
+
responseType: "Record<string, unknown>"
|
|
4753
|
+
},
|
|
4754
|
+
{
|
|
4755
|
+
name: "getStorageFileProxyUrl",
|
|
4756
|
+
method: "GET",
|
|
4757
|
+
path: "/storage/files/{file_id}/proxy-url",
|
|
4758
|
+
pathParams: ["file_id"],
|
|
4759
|
+
queryParams: ["purpose"],
|
|
4760
|
+
responseEnvelope: "athena",
|
|
4761
|
+
responseType: "Record<string, unknown>"
|
|
4762
|
+
},
|
|
4763
|
+
{
|
|
4764
|
+
name: "listStorageFileVersions",
|
|
4765
|
+
method: "GET",
|
|
4766
|
+
path: "/storage/files/{file_id}/versions",
|
|
4767
|
+
pathParams: ["file_id"],
|
|
4768
|
+
responseEnvelope: "athena",
|
|
4769
|
+
responseType: "Record<string, unknown>"
|
|
4770
|
+
},
|
|
4771
|
+
{
|
|
4772
|
+
name: "restoreStorageFileVersion",
|
|
4773
|
+
method: "POST",
|
|
4774
|
+
path: "/storage/files/{file_id}/versions/{version_id}/restore",
|
|
4775
|
+
pathParams: ["file_id", "version_id"],
|
|
4776
|
+
responseEnvelope: "athena",
|
|
4777
|
+
responseType: "Record<string, unknown>"
|
|
4778
|
+
},
|
|
4779
|
+
{
|
|
4780
|
+
name: "deleteStorageFileVersion",
|
|
4781
|
+
method: "DELETE",
|
|
4782
|
+
path: "/storage/files/{file_id}/versions/{version_id}",
|
|
4783
|
+
pathParams: ["file_id", "version_id"],
|
|
4784
|
+
responseEnvelope: "athena",
|
|
4785
|
+
responseType: "Record<string, unknown>"
|
|
4786
|
+
},
|
|
4787
|
+
{
|
|
4788
|
+
name: "getStorageFileRetention",
|
|
4789
|
+
method: "GET",
|
|
4790
|
+
path: "/storage/files/{file_id}/retention",
|
|
4791
|
+
pathParams: ["file_id"],
|
|
4792
|
+
queryParams: ["version_id"],
|
|
4793
|
+
responseEnvelope: "athena",
|
|
4794
|
+
responseType: "Record<string, unknown>"
|
|
4795
|
+
},
|
|
4796
|
+
{
|
|
4797
|
+
name: "setStorageFileRetention",
|
|
4798
|
+
method: "POST",
|
|
4799
|
+
path: "/storage/files/{file_id}/retention",
|
|
4800
|
+
pathParams: ["file_id"],
|
|
4801
|
+
requestType: "StorageFileRetentionRequest",
|
|
4802
|
+
responseEnvelope: "athena",
|
|
4803
|
+
responseType: "Record<string, unknown>"
|
|
4804
|
+
},
|
|
4805
|
+
{
|
|
4806
|
+
name: "listStorageFolders",
|
|
4807
|
+
method: "POST",
|
|
4808
|
+
path: "/storage/folders/list",
|
|
4809
|
+
requestType: "ListStorageFoldersRequest",
|
|
4810
|
+
responseEnvelope: "athena",
|
|
4811
|
+
responseType: "Record<string, unknown>"
|
|
4812
|
+
},
|
|
4813
|
+
{
|
|
4814
|
+
name: "treeStorageFolders",
|
|
4815
|
+
method: "POST",
|
|
4816
|
+
path: "/storage/folders/tree",
|
|
4817
|
+
requestType: "TreeStorageFoldersRequest",
|
|
4818
|
+
responseEnvelope: "athena",
|
|
4819
|
+
responseType: "Record<string, unknown>"
|
|
4820
|
+
},
|
|
4821
|
+
{
|
|
4822
|
+
name: "listStoragePermissions",
|
|
4823
|
+
method: "POST",
|
|
4824
|
+
path: "/storage/permissions/list",
|
|
4825
|
+
requestType: "StoragePermissionListRequest",
|
|
4826
|
+
responseEnvelope: "athena",
|
|
4827
|
+
responseType: "StoragePermissionListResponse"
|
|
4828
|
+
},
|
|
4829
|
+
{
|
|
4830
|
+
name: "grantStoragePermission",
|
|
4831
|
+
method: "POST",
|
|
4832
|
+
path: "/storage/permissions/grant",
|
|
4833
|
+
requestType: "StoragePermissionGrantRequest",
|
|
4834
|
+
responseEnvelope: "athena",
|
|
4835
|
+
responseType: "Record<string, unknown>"
|
|
4836
|
+
},
|
|
4837
|
+
{
|
|
4838
|
+
name: "revokeStoragePermission",
|
|
4839
|
+
method: "POST",
|
|
4840
|
+
path: "/storage/permissions/revoke",
|
|
4841
|
+
requestType: "StoragePermissionRevokeRequest",
|
|
4842
|
+
responseEnvelope: "athena",
|
|
4843
|
+
responseType: "Record<string, unknown>"
|
|
4844
|
+
},
|
|
4845
|
+
{
|
|
4846
|
+
name: "checkStoragePermission",
|
|
4847
|
+
method: "POST",
|
|
4848
|
+
path: "/storage/permissions/check",
|
|
4849
|
+
requestType: "StoragePermissionCheckRequest",
|
|
4850
|
+
responseEnvelope: "athena",
|
|
4851
|
+
responseType: "StoragePermissionCheckResponse"
|
|
4852
|
+
},
|
|
4853
|
+
{
|
|
4854
|
+
name: "listStorageObjects",
|
|
4855
|
+
method: "POST",
|
|
4856
|
+
path: "/storage/objects",
|
|
4857
|
+
requestType: "StorageListObjectsRequest",
|
|
4858
|
+
responseEnvelope: "athena",
|
|
4859
|
+
responseType: "Record<string, unknown>"
|
|
4860
|
+
},
|
|
4861
|
+
{
|
|
4862
|
+
name: "headStorageObject",
|
|
4863
|
+
method: "POST",
|
|
4864
|
+
path: "/storage/objects/head",
|
|
4865
|
+
requestType: "StorageObjectRequest",
|
|
4866
|
+
responseEnvelope: "athena",
|
|
4867
|
+
responseType: "Record<string, unknown>"
|
|
4868
|
+
},
|
|
4869
|
+
{
|
|
4870
|
+
name: "existsStorageObject",
|
|
4871
|
+
method: "POST",
|
|
4872
|
+
path: "/storage/objects/exists",
|
|
4873
|
+
requestType: "StorageObjectRequest",
|
|
4874
|
+
responseEnvelope: "athena",
|
|
4875
|
+
responseType: "Record<string, unknown>"
|
|
4876
|
+
},
|
|
4877
|
+
{
|
|
4878
|
+
name: "validateStorageObject",
|
|
4879
|
+
method: "POST",
|
|
4880
|
+
path: "/storage/objects/validate",
|
|
4881
|
+
requestType: "StorageObjectValidateRequest",
|
|
4882
|
+
responseEnvelope: "athena",
|
|
4883
|
+
responseType: "Record<string, unknown>"
|
|
4884
|
+
},
|
|
4885
|
+
{
|
|
4886
|
+
name: "updateStorageObject",
|
|
4887
|
+
method: "POST",
|
|
4888
|
+
path: "/storage/objects/update",
|
|
4889
|
+
requestType: "StorageUpdateObjectRequest",
|
|
4890
|
+
responseEnvelope: "athena",
|
|
4891
|
+
responseType: "Record<string, unknown>"
|
|
4892
|
+
},
|
|
4893
|
+
{
|
|
4894
|
+
name: "copyStorageObject",
|
|
4895
|
+
method: "POST",
|
|
4896
|
+
path: "/storage/objects/copy",
|
|
4897
|
+
requestType: "StorageObjectCopyRequest",
|
|
4898
|
+
responseEnvelope: "athena",
|
|
4899
|
+
responseType: "Record<string, unknown>"
|
|
4900
|
+
},
|
|
4901
|
+
{
|
|
4902
|
+
name: "getStorageObjectUrl",
|
|
4903
|
+
method: "POST",
|
|
4904
|
+
path: "/storage/objects/url",
|
|
4905
|
+
requestType: "StorageObjectRequest",
|
|
4906
|
+
responseEnvelope: "athena",
|
|
4907
|
+
responseType: "Record<string, unknown>"
|
|
4908
|
+
},
|
|
4909
|
+
{
|
|
4910
|
+
name: "getStorageObjectPublicUrl",
|
|
4911
|
+
method: "POST",
|
|
4912
|
+
path: "/storage/objects/public-url",
|
|
4913
|
+
requestType: "StorageObjectPublicUrlRequest",
|
|
4914
|
+
responseEnvelope: "athena",
|
|
4915
|
+
responseType: "Record<string, unknown>"
|
|
4916
|
+
},
|
|
4917
|
+
{
|
|
4918
|
+
name: "deleteStorageObject",
|
|
4919
|
+
method: "POST",
|
|
4920
|
+
path: "/storage/objects/delete",
|
|
4921
|
+
requestType: "StorageObjectRequest",
|
|
4922
|
+
responseEnvelope: "athena",
|
|
4923
|
+
responseType: "Record<string, unknown>"
|
|
4924
|
+
},
|
|
4925
|
+
{
|
|
4926
|
+
name: "createStorageObjectUploadUrl",
|
|
4927
|
+
method: "POST",
|
|
4928
|
+
path: "/storage/objects/upload-url",
|
|
4929
|
+
requestType: "StoragePresignUploadRequest",
|
|
4930
|
+
responseEnvelope: "athena",
|
|
4931
|
+
responseType: "Record<string, unknown>"
|
|
4932
|
+
},
|
|
4933
|
+
{
|
|
4934
|
+
name: "createStorageObjectPostPolicy",
|
|
4935
|
+
method: "POST",
|
|
4936
|
+
path: "/storage/objects/post-policy",
|
|
4937
|
+
requestType: "StorageSignedPostPolicyRequest",
|
|
4938
|
+
responseEnvelope: "athena",
|
|
4939
|
+
responseType: "Record<string, unknown>"
|
|
4940
|
+
},
|
|
4941
|
+
{
|
|
4942
|
+
name: "listStorageObjectVersions",
|
|
4943
|
+
method: "POST",
|
|
4944
|
+
path: "/storage/objects/versions",
|
|
4945
|
+
requestType: "StorageObjectVersionListRequest",
|
|
4946
|
+
responseEnvelope: "athena",
|
|
4947
|
+
responseType: "Record<string, unknown>"
|
|
4948
|
+
},
|
|
4949
|
+
{
|
|
4950
|
+
name: "restoreStorageObjectVersion",
|
|
4951
|
+
method: "POST",
|
|
4952
|
+
path: "/storage/objects/versions/restore",
|
|
4953
|
+
requestType: "StorageObjectVersionMutationRequest",
|
|
4954
|
+
responseEnvelope: "athena",
|
|
4955
|
+
responseType: "Record<string, unknown>"
|
|
4956
|
+
},
|
|
4957
|
+
{
|
|
4958
|
+
name: "deleteStorageObjectVersion",
|
|
4959
|
+
method: "POST",
|
|
4960
|
+
path: "/storage/objects/versions/delete",
|
|
4961
|
+
requestType: "StorageObjectVersionMutationRequest",
|
|
4962
|
+
responseEnvelope: "athena",
|
|
4963
|
+
responseType: "Record<string, unknown>"
|
|
4964
|
+
},
|
|
4965
|
+
{
|
|
4966
|
+
name: "createStorageObjectFolder",
|
|
4967
|
+
method: "POST",
|
|
4968
|
+
path: "/storage/objects/folder",
|
|
4969
|
+
requestType: "StorageObjectFolderCreateRequest",
|
|
4970
|
+
responseEnvelope: "athena",
|
|
4971
|
+
responseType: "Record<string, unknown>"
|
|
4972
|
+
},
|
|
4973
|
+
{
|
|
4974
|
+
name: "deleteStorageObjectFolder",
|
|
4975
|
+
method: "POST",
|
|
4976
|
+
path: "/storage/objects/folder/delete",
|
|
4977
|
+
requestType: "StorageObjectFolderDeleteRequest",
|
|
4978
|
+
responseEnvelope: "athena",
|
|
4979
|
+
responseType: "Record<string, unknown>"
|
|
4980
|
+
},
|
|
4981
|
+
{
|
|
4982
|
+
name: "renameStorageObjectFolder",
|
|
4983
|
+
method: "POST",
|
|
4984
|
+
path: "/storage/objects/folder/rename",
|
|
4985
|
+
requestType: "StorageObjectFolderRenameRequest",
|
|
4986
|
+
responseEnvelope: "athena",
|
|
4987
|
+
responseType: "Record<string, unknown>"
|
|
4988
|
+
},
|
|
4989
|
+
{
|
|
4990
|
+
name: "listStorageBuckets",
|
|
4991
|
+
method: "POST",
|
|
4992
|
+
path: "/storage/buckets/list",
|
|
4993
|
+
requestType: "Omit<StorageObjectBaseRequest, 'bucket'>",
|
|
4994
|
+
responseEnvelope: "athena",
|
|
4995
|
+
responseType: "Record<string, unknown>"
|
|
4996
|
+
},
|
|
4997
|
+
{
|
|
4998
|
+
name: "createStorageBucket",
|
|
4999
|
+
method: "POST",
|
|
5000
|
+
path: "/storage/buckets/create",
|
|
5001
|
+
requestType: "StorageObjectBaseRequest",
|
|
5002
|
+
responseEnvelope: "athena",
|
|
5003
|
+
responseType: "Record<string, unknown>"
|
|
5004
|
+
},
|
|
5005
|
+
{
|
|
5006
|
+
name: "deleteStorageBucket",
|
|
5007
|
+
method: "POST",
|
|
5008
|
+
path: "/storage/buckets/delete",
|
|
5009
|
+
requestType: "StorageObjectBaseRequest",
|
|
5010
|
+
responseEnvelope: "athena",
|
|
5011
|
+
responseType: "Record<string, unknown>"
|
|
5012
|
+
},
|
|
5013
|
+
{
|
|
5014
|
+
name: "getStorageBucketLifecycle",
|
|
5015
|
+
method: "POST",
|
|
5016
|
+
path: "/storage/buckets/lifecycle",
|
|
5017
|
+
requestType: "StorageBucketLifecycleRequest",
|
|
5018
|
+
responseEnvelope: "athena",
|
|
5019
|
+
responseType: "Record<string, unknown>"
|
|
5020
|
+
},
|
|
5021
|
+
{
|
|
5022
|
+
name: "setStorageBucketLifecycle",
|
|
5023
|
+
method: "POST",
|
|
5024
|
+
path: "/storage/buckets/lifecycle/set",
|
|
5025
|
+
requestType: "StorageSetBucketLifecycleRequest",
|
|
5026
|
+
responseEnvelope: "athena",
|
|
5027
|
+
responseType: "Record<string, unknown>"
|
|
5028
|
+
},
|
|
5029
|
+
{
|
|
5030
|
+
name: "deleteStorageBucketLifecycle",
|
|
5031
|
+
method: "POST",
|
|
5032
|
+
path: "/storage/buckets/lifecycle/delete",
|
|
5033
|
+
requestType: "StorageBucketLifecycleRequest",
|
|
5034
|
+
responseEnvelope: "athena",
|
|
5035
|
+
responseType: "Record<string, unknown>"
|
|
5036
|
+
},
|
|
5037
|
+
{
|
|
5038
|
+
name: "getStorageBucketPolicy",
|
|
4212
5039
|
method: "POST",
|
|
4213
|
-
path: "/storage/
|
|
4214
|
-
requestType: "
|
|
4215
|
-
responseEnvelope: "
|
|
4216
|
-
responseType: "
|
|
5040
|
+
path: "/storage/buckets/policy",
|
|
5041
|
+
requestType: "StorageBucketPolicyRequest",
|
|
5042
|
+
responseEnvelope: "athena",
|
|
5043
|
+
responseType: "Record<string, unknown>"
|
|
4217
5044
|
},
|
|
4218
5045
|
{
|
|
4219
|
-
name: "
|
|
4220
|
-
method: "
|
|
4221
|
-
path: "/storage/
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
responseType: "S3CatalogItem"
|
|
5046
|
+
name: "setStorageBucketPolicy",
|
|
5047
|
+
method: "POST",
|
|
5048
|
+
path: "/storage/buckets/policy/set",
|
|
5049
|
+
requestType: "StorageSetBucketPolicyRequest",
|
|
5050
|
+
responseEnvelope: "athena",
|
|
5051
|
+
responseType: "Record<string, unknown>"
|
|
4226
5052
|
},
|
|
4227
5053
|
{
|
|
4228
|
-
name: "
|
|
4229
|
-
method: "
|
|
4230
|
-
path: "/storage/
|
|
4231
|
-
|
|
4232
|
-
responseEnvelope: "
|
|
4233
|
-
responseType: "
|
|
5054
|
+
name: "deleteStorageBucketPolicy",
|
|
5055
|
+
method: "POST",
|
|
5056
|
+
path: "/storage/buckets/policy/delete",
|
|
5057
|
+
requestType: "StorageBucketPolicyRequest",
|
|
5058
|
+
responseEnvelope: "athena",
|
|
5059
|
+
responseType: "Record<string, unknown>"
|
|
4234
5060
|
},
|
|
4235
5061
|
{
|
|
4236
|
-
name: "
|
|
4237
|
-
method: "
|
|
4238
|
-
path: "/storage/
|
|
4239
|
-
|
|
4240
|
-
|
|
5062
|
+
name: "getStorageBucketPublicAccess",
|
|
5063
|
+
method: "POST",
|
|
5064
|
+
path: "/storage/buckets/public-access",
|
|
5065
|
+
requestType: "StoragePublicAccessBlockRequest",
|
|
5066
|
+
responseEnvelope: "athena",
|
|
5067
|
+
responseType: "Record<string, unknown>"
|
|
4241
5068
|
},
|
|
4242
5069
|
{
|
|
4243
|
-
name: "
|
|
5070
|
+
name: "setStorageBucketPublicAccess",
|
|
4244
5071
|
method: "POST",
|
|
4245
|
-
path: "/storage/
|
|
4246
|
-
requestType: "
|
|
5072
|
+
path: "/storage/buckets/public-access/set",
|
|
5073
|
+
requestType: "StorageSetPublicAccessBlockRequest",
|
|
4247
5074
|
responseEnvelope: "athena",
|
|
4248
|
-
responseType: "
|
|
5075
|
+
responseType: "Record<string, unknown>"
|
|
4249
5076
|
},
|
|
4250
5077
|
{
|
|
4251
|
-
name: "
|
|
5078
|
+
name: "deleteStorageBucketPublicAccess",
|
|
4252
5079
|
method: "POST",
|
|
4253
|
-
path: "/storage/
|
|
4254
|
-
requestType: "
|
|
5080
|
+
path: "/storage/buckets/public-access/delete",
|
|
5081
|
+
requestType: "StoragePublicAccessBlockRequest",
|
|
4255
5082
|
responseEnvelope: "athena",
|
|
4256
|
-
responseType: "
|
|
5083
|
+
responseType: "Record<string, unknown>"
|
|
4257
5084
|
},
|
|
4258
5085
|
{
|
|
4259
|
-
name: "
|
|
5086
|
+
name: "getStorageBucketCors",
|
|
4260
5087
|
method: "POST",
|
|
4261
|
-
path: "/storage/
|
|
4262
|
-
requestType: "
|
|
5088
|
+
path: "/storage/buckets/cors",
|
|
5089
|
+
requestType: "StorageBucketCorsRequest",
|
|
4263
5090
|
responseEnvelope: "athena",
|
|
4264
|
-
responseType: "
|
|
5091
|
+
responseType: "Record<string, unknown>"
|
|
4265
5092
|
},
|
|
4266
5093
|
{
|
|
4267
|
-
name: "
|
|
4268
|
-
method: "
|
|
4269
|
-
path: "/storage/
|
|
4270
|
-
|
|
5094
|
+
name: "setStorageBucketCors",
|
|
5095
|
+
method: "POST",
|
|
5096
|
+
path: "/storage/buckets/cors/set",
|
|
5097
|
+
requestType: "StorageSetBucketCorsRequest",
|
|
4271
5098
|
responseEnvelope: "athena",
|
|
4272
|
-
responseType: "
|
|
5099
|
+
responseType: "Record<string, unknown>"
|
|
4273
5100
|
},
|
|
4274
5101
|
{
|
|
4275
|
-
name: "
|
|
4276
|
-
method: "
|
|
4277
|
-
path: "/storage/
|
|
4278
|
-
|
|
4279
|
-
queryParams: ["purpose"],
|
|
5102
|
+
name: "deleteStorageBucketCors",
|
|
5103
|
+
method: "POST",
|
|
5104
|
+
path: "/storage/buckets/cors/delete",
|
|
5105
|
+
requestType: "StorageBucketCorsRequest",
|
|
4280
5106
|
responseEnvelope: "athena",
|
|
4281
|
-
responseType: "
|
|
5107
|
+
responseType: "Record<string, unknown>"
|
|
4282
5108
|
},
|
|
4283
5109
|
{
|
|
4284
|
-
name: "
|
|
4285
|
-
method: "
|
|
4286
|
-
path: "/storage/
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
responseType: "Response",
|
|
4291
|
-
binary: true
|
|
5110
|
+
name: "createStorageMultipartUpload",
|
|
5111
|
+
method: "POST",
|
|
5112
|
+
path: "/storage/multipart/create",
|
|
5113
|
+
requestType: "StorageMultipartCreateRequest",
|
|
5114
|
+
responseEnvelope: "athena",
|
|
5115
|
+
responseType: "Record<string, unknown>"
|
|
4292
5116
|
},
|
|
4293
5117
|
{
|
|
4294
|
-
name: "
|
|
4295
|
-
method: "
|
|
4296
|
-
path: "/storage/
|
|
4297
|
-
|
|
4298
|
-
requestType: "UpdateStorageFileRequest",
|
|
5118
|
+
name: "signStorageMultipartPart",
|
|
5119
|
+
method: "POST",
|
|
5120
|
+
path: "/storage/multipart/sign-part",
|
|
5121
|
+
requestType: "StorageMultipartSignPartRequest",
|
|
4299
5122
|
responseEnvelope: "athena",
|
|
4300
|
-
responseType: "
|
|
5123
|
+
responseType: "Record<string, unknown>"
|
|
4301
5124
|
},
|
|
4302
5125
|
{
|
|
4303
|
-
name: "
|
|
4304
|
-
method: "
|
|
4305
|
-
path: "/storage/
|
|
4306
|
-
|
|
5126
|
+
name: "completeStorageMultipartUpload",
|
|
5127
|
+
method: "POST",
|
|
5128
|
+
path: "/storage/multipart/complete",
|
|
5129
|
+
requestType: "StorageMultipartCompleteRequest",
|
|
4307
5130
|
responseEnvelope: "athena",
|
|
4308
5131
|
responseType: "StorageFileMutationResponse"
|
|
4309
5132
|
},
|
|
4310
5133
|
{
|
|
4311
|
-
name: "
|
|
4312
|
-
method: "
|
|
4313
|
-
path: "/storage/
|
|
4314
|
-
|
|
4315
|
-
requestType: "SetStorageFileVisibilityRequest",
|
|
5134
|
+
name: "abortStorageMultipartUpload",
|
|
5135
|
+
method: "POST",
|
|
5136
|
+
path: "/storage/multipart/abort",
|
|
5137
|
+
requestType: "StorageMultipartAbortRequest",
|
|
4316
5138
|
responseEnvelope: "athena",
|
|
4317
|
-
responseType: "
|
|
5139
|
+
responseType: "Record<string, unknown>"
|
|
4318
5140
|
},
|
|
4319
5141
|
{
|
|
4320
|
-
name: "
|
|
5142
|
+
name: "listStorageMultipartParts",
|
|
4321
5143
|
method: "POST",
|
|
4322
|
-
path: "/storage/
|
|
4323
|
-
requestType: "
|
|
5144
|
+
path: "/storage/multipart/list-parts",
|
|
5145
|
+
requestType: "StorageMultipartListPartsRequest",
|
|
4324
5146
|
responseEnvelope: "athena",
|
|
4325
|
-
responseType: "
|
|
5147
|
+
responseType: "Record<string, unknown>"
|
|
4326
5148
|
},
|
|
4327
5149
|
{
|
|
4328
|
-
name: "
|
|
5150
|
+
name: "listStorageAuditEvents",
|
|
4329
5151
|
method: "POST",
|
|
4330
|
-
path: "/storage/
|
|
4331
|
-
requestType: "
|
|
5152
|
+
path: "/storage/audit/list",
|
|
5153
|
+
requestType: "StorageAuditQueryRequest",
|
|
4332
5154
|
responseEnvelope: "athena",
|
|
4333
|
-
responseType: "
|
|
5155
|
+
responseType: "StorageAuditListResponse"
|
|
4334
5156
|
}
|
|
4335
5157
|
]
|
|
4336
5158
|
};
|
|
@@ -4783,7 +5605,7 @@ async function putPresignedUploadBody(uploadUrl, uploadHeaders, body, options) {
|
|
|
4783
5605
|
return fetch(uploadUrl, init);
|
|
4784
5606
|
}
|
|
4785
5607
|
function attachManagedUpload(upload) {
|
|
4786
|
-
const headers = {};
|
|
5608
|
+
const headers = { ...upload.headers ?? {} };
|
|
4787
5609
|
return {
|
|
4788
5610
|
...upload,
|
|
4789
5611
|
method: "PUT",
|
|
@@ -4829,7 +5651,12 @@ function normalizeUploadUrlRequest(input) {
|
|
|
4829
5651
|
file_id: input.file_id ?? input.fileId,
|
|
4830
5652
|
public: input.public,
|
|
4831
5653
|
visibility: input.visibility,
|
|
4832
|
-
metadata: input.metadata
|
|
5654
|
+
metadata: input.metadata,
|
|
5655
|
+
server_side_encryption: input.server_side_encryption,
|
|
5656
|
+
sse: input.sse,
|
|
5657
|
+
ssekms_key_id: input.ssekms_key_id,
|
|
5658
|
+
kms_key_id: input.kms_key_id,
|
|
5659
|
+
bucket_key_enabled: input.bucket_key_enabled
|
|
4833
5660
|
};
|
|
4834
5661
|
}
|
|
4835
5662
|
async function callStorageUploadBinaryEndpoint(gateway, endpoint, body, options, runtimeOptions) {
|
|
@@ -4980,6 +5807,12 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
4980
5807
|
options,
|
|
4981
5808
|
resolvedRuntimeOptions
|
|
4982
5809
|
);
|
|
5810
|
+
const callStorageFileVisibility = (fileId, method, input, options) => callAthena2(
|
|
5811
|
+
withPathParam("/storage/files/{file_id}/visibility", "file_id", fileId),
|
|
5812
|
+
method,
|
|
5813
|
+
input,
|
|
5814
|
+
options
|
|
5815
|
+
);
|
|
4983
5816
|
const base = {
|
|
4984
5817
|
listStorageCatalogs(options) {
|
|
4985
5818
|
return callRaw("/storage/catalogs", "GET", void 0, options);
|
|
@@ -5029,7 +5862,7 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5029
5862
|
return callAthena2(withPathParam("/storage/files/{file_id}", "file_id", fileId), "DELETE", void 0, options);
|
|
5030
5863
|
},
|
|
5031
5864
|
setStorageFileVisibility(fileId, input, options) {
|
|
5032
|
-
return
|
|
5865
|
+
return callStorageFileVisibility(fileId, "PATCH", input, options);
|
|
5033
5866
|
},
|
|
5034
5867
|
deleteStorageFolder(input, options) {
|
|
5035
5868
|
return callAthena2("/storage/folders/delete", "POST", input, options);
|
|
@@ -5101,13 +5934,62 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5101
5934
|
publicUrl(fileId, options) {
|
|
5102
5935
|
return callAthena2(withPathParam("/storage/files/{file_id}/public-url", "file_id", fileId), "GET", void 0, options);
|
|
5103
5936
|
},
|
|
5937
|
+
proxyUrl(fileId, query, options) {
|
|
5938
|
+
const path = appendQuery(
|
|
5939
|
+
withPathParam("/storage/files/{file_id}/proxy-url", "file_id", fileId),
|
|
5940
|
+
query
|
|
5941
|
+
);
|
|
5942
|
+
return callAthena2(path, "GET", void 0, options);
|
|
5943
|
+
},
|
|
5104
5944
|
proxy(fileId, query, options) {
|
|
5105
5945
|
return base.getStorageFileProxy(fileId, query, options);
|
|
5106
5946
|
},
|
|
5107
|
-
|
|
5947
|
+
versions(fileId, options) {
|
|
5948
|
+
return callAthena2(withPathParam("/storage/files/{file_id}/versions", "file_id", fileId), "GET", void 0, options);
|
|
5949
|
+
},
|
|
5950
|
+
restoreVersion(fileId, versionId, options) {
|
|
5951
|
+
return callAthena2(
|
|
5952
|
+
withPathParam(
|
|
5953
|
+
withPathParam("/storage/files/{file_id}/versions/{version_id}/restore", "file_id", fileId),
|
|
5954
|
+
"version_id",
|
|
5955
|
+
versionId
|
|
5956
|
+
),
|
|
5957
|
+
"POST",
|
|
5958
|
+
{},
|
|
5959
|
+
options
|
|
5960
|
+
);
|
|
5961
|
+
},
|
|
5962
|
+
deleteVersion(fileId, versionId, options) {
|
|
5963
|
+
return callAthena2(
|
|
5964
|
+
withPathParam(
|
|
5965
|
+
withPathParam("/storage/files/{file_id}/versions/{version_id}", "file_id", fileId),
|
|
5966
|
+
"version_id",
|
|
5967
|
+
versionId
|
|
5968
|
+
),
|
|
5969
|
+
"DELETE",
|
|
5970
|
+
void 0,
|
|
5971
|
+
options
|
|
5972
|
+
);
|
|
5973
|
+
},
|
|
5974
|
+
retention: {
|
|
5975
|
+
get(fileId, query, options) {
|
|
5976
|
+
const path = appendQuery(
|
|
5977
|
+
withPathParam("/storage/files/{file_id}/retention", "file_id", fileId),
|
|
5978
|
+
query
|
|
5979
|
+
);
|
|
5980
|
+
return callAthena2(path, "GET", void 0, options);
|
|
5981
|
+
},
|
|
5108
5982
|
set(fileId, input, options) {
|
|
5983
|
+
return callAthena2(withPathParam("/storage/files/{file_id}/retention", "file_id", fileId), "POST", input, options);
|
|
5984
|
+
}
|
|
5985
|
+
},
|
|
5986
|
+
visibility: {
|
|
5987
|
+
update(fileId, input, options) {
|
|
5109
5988
|
return base.setStorageFileVisibility(fileId, input, options);
|
|
5110
5989
|
},
|
|
5990
|
+
set(fileId, input, options) {
|
|
5991
|
+
return callStorageFileVisibility(fileId, "POST", input, options);
|
|
5992
|
+
},
|
|
5111
5993
|
setMany(input, options) {
|
|
5112
5994
|
return callAthena2("/storage/files/visibility-many", "POST", input, options);
|
|
5113
5995
|
}
|
|
@@ -5202,6 +6084,18 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5202
6084
|
uploadUrl(input, options) {
|
|
5203
6085
|
return callAthena2("/storage/objects/upload-url", "POST", input, options);
|
|
5204
6086
|
},
|
|
6087
|
+
versions(input, options) {
|
|
6088
|
+
return callAthena2("/storage/objects/versions", "POST", input, options);
|
|
6089
|
+
},
|
|
6090
|
+
restoreVersion(input, options) {
|
|
6091
|
+
return callAthena2("/storage/objects/versions/restore", "POST", input, options);
|
|
6092
|
+
},
|
|
6093
|
+
deleteVersion(input, options) {
|
|
6094
|
+
return callAthena2("/storage/objects/versions/delete", "POST", input, options);
|
|
6095
|
+
},
|
|
6096
|
+
postPolicy(input, options) {
|
|
6097
|
+
return callAthena2("/storage/objects/post-policy", "POST", input, options);
|
|
6098
|
+
},
|
|
5205
6099
|
folder: objectFolder
|
|
5206
6100
|
};
|
|
5207
6101
|
const bucket = {
|
|
@@ -5214,6 +6108,39 @@ function createStorageModule(gateway, runtimeOptions) {
|
|
|
5214
6108
|
delete(input, options) {
|
|
5215
6109
|
return callAthena2("/storage/buckets/delete", "POST", input, options);
|
|
5216
6110
|
},
|
|
6111
|
+
lifecycle: {
|
|
6112
|
+
get(input, options) {
|
|
6113
|
+
return callAthena2("/storage/buckets/lifecycle", "POST", input, options);
|
|
6114
|
+
},
|
|
6115
|
+
set(input, options) {
|
|
6116
|
+
return callAthena2("/storage/buckets/lifecycle/set", "POST", input, options);
|
|
6117
|
+
},
|
|
6118
|
+
delete(input, options) {
|
|
6119
|
+
return callAthena2("/storage/buckets/lifecycle/delete", "POST", input, options);
|
|
6120
|
+
}
|
|
6121
|
+
},
|
|
6122
|
+
policy: {
|
|
6123
|
+
get(input, options) {
|
|
6124
|
+
return callAthena2("/storage/buckets/policy", "POST", input, options);
|
|
6125
|
+
},
|
|
6126
|
+
set(input, options) {
|
|
6127
|
+
return callAthena2("/storage/buckets/policy/set", "POST", input, options);
|
|
6128
|
+
},
|
|
6129
|
+
delete(input, options) {
|
|
6130
|
+
return callAthena2("/storage/buckets/policy/delete", "POST", input, options);
|
|
6131
|
+
}
|
|
6132
|
+
},
|
|
6133
|
+
publicAccess: {
|
|
6134
|
+
get(input, options) {
|
|
6135
|
+
return callAthena2("/storage/buckets/public-access", "POST", input, options);
|
|
6136
|
+
},
|
|
6137
|
+
set(input, options) {
|
|
6138
|
+
return callAthena2("/storage/buckets/public-access/set", "POST", input, options);
|
|
6139
|
+
},
|
|
6140
|
+
delete(input, options) {
|
|
6141
|
+
return callAthena2("/storage/buckets/public-access/delete", "POST", input, options);
|
|
6142
|
+
}
|
|
6143
|
+
},
|
|
5217
6144
|
cors: {
|
|
5218
6145
|
get(input, options) {
|
|
5219
6146
|
return callAthena2("/storage/buckets/cors", "POST", input, options);
|
|
@@ -7790,6 +8717,59 @@ function createQueryBuilder(client, formatGatewayResult, experimental, tracer) {
|
|
|
7790
8717
|
);
|
|
7791
8718
|
};
|
|
7792
8719
|
}
|
|
8720
|
+
function normalizeOptionalString2(value) {
|
|
8721
|
+
if (typeof value !== "string") {
|
|
8722
|
+
return void 0;
|
|
8723
|
+
}
|
|
8724
|
+
const normalizedValue = value.trim();
|
|
8725
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
8726
|
+
}
|
|
8727
|
+
function readHeaderBagValue(headers, targetKey) {
|
|
8728
|
+
if (!headers) {
|
|
8729
|
+
return void 0;
|
|
8730
|
+
}
|
|
8731
|
+
if (typeof headers.get === "function") {
|
|
8732
|
+
return normalizeOptionalString2(headers.get(targetKey));
|
|
8733
|
+
}
|
|
8734
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
8735
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
8736
|
+
if (key.toLowerCase() !== normalizedTargetKey) {
|
|
8737
|
+
continue;
|
|
8738
|
+
}
|
|
8739
|
+
if (typeof value === "string") {
|
|
8740
|
+
return normalizeOptionalString2(value);
|
|
8741
|
+
}
|
|
8742
|
+
return void 0;
|
|
8743
|
+
}
|
|
8744
|
+
return void 0;
|
|
8745
|
+
}
|
|
8746
|
+
function resolveSessionContextOptions(session, options) {
|
|
8747
|
+
const sessionToken = normalizeOptionalString2(session?.session?.token);
|
|
8748
|
+
const requestCookie = readHeaderBagValue(options?.requestHeaders, "cookie") ?? readHeaderBagValue(options?.headers, "cookie");
|
|
8749
|
+
const authInput = options?.auth;
|
|
8750
|
+
const resolvedUserId = options?.userId !== void 0 ? options.userId : session?.user?.id;
|
|
8751
|
+
const resolvedOrganizationId = options?.organizationId !== void 0 ? options.organizationId : session?.session?.activeOrganizationId;
|
|
8752
|
+
const resolvedBearerToken = authInput?.bearerToken !== void 0 ? authInput.bearerToken : sessionToken;
|
|
8753
|
+
const resolvedSessionToken = authInput?.sessionToken !== void 0 ? authInput.sessionToken : sessionToken;
|
|
8754
|
+
const resolvedCookie = authInput?.cookie !== void 0 ? authInput.cookie : requestCookie;
|
|
8755
|
+
const auth = authInput !== void 0 || resolvedBearerToken !== void 0 || resolvedSessionToken !== void 0 || resolvedCookie !== void 0 ? {
|
|
8756
|
+
...authInput ?? {},
|
|
8757
|
+
...resolvedBearerToken !== void 0 ? { bearerToken: resolvedBearerToken } : {},
|
|
8758
|
+
...resolvedSessionToken !== void 0 ? { sessionToken: resolvedSessionToken } : {},
|
|
8759
|
+
...resolvedCookie !== void 0 ? { cookie: resolvedCookie } : {},
|
|
8760
|
+
headers: authInput?.headers ? { ...authInput.headers } : void 0
|
|
8761
|
+
} : void 0;
|
|
8762
|
+
if (resolvedUserId === void 0 && resolvedOrganizationId === void 0 && options?.forceNoCache === void 0 && !options?.headers && !auth) {
|
|
8763
|
+
return void 0;
|
|
8764
|
+
}
|
|
8765
|
+
return {
|
|
8766
|
+
userId: resolvedUserId,
|
|
8767
|
+
organizationId: resolvedOrganizationId,
|
|
8768
|
+
forceNoCache: options?.forceNoCache,
|
|
8769
|
+
headers: options?.headers ? { ...options.headers } : void 0,
|
|
8770
|
+
auth
|
|
8771
|
+
};
|
|
8772
|
+
}
|
|
7793
8773
|
function resolveClientServiceBaseUrl(value, label) {
|
|
7794
8774
|
if (value === void 0 || value === null) {
|
|
7795
8775
|
return void 0;
|
|
@@ -7811,21 +8791,143 @@ function resolveServiceUrls(config) {
|
|
|
7811
8791
|
storageUrl: resolveServiceUrlOverride(config.storage?.url, "Athena storage base URL") ?? resolveServiceUrlOverride(config.storageUrl, "Athena storage base URL") ?? (baseUrl ? appendServicePath(baseUrl, "storage") : void 0)
|
|
7812
8792
|
};
|
|
7813
8793
|
}
|
|
8794
|
+
function resolveOptionalClientName(value) {
|
|
8795
|
+
if (value === void 0 || value === null) {
|
|
8796
|
+
return void 0;
|
|
8797
|
+
}
|
|
8798
|
+
const normalizedValue = value.trim();
|
|
8799
|
+
return normalizedValue ? normalizedValue : void 0;
|
|
8800
|
+
}
|
|
8801
|
+
function resolveRequiredClientApiKey(value) {
|
|
8802
|
+
if (value === void 0 || value === null) {
|
|
8803
|
+
throw new Error(
|
|
8804
|
+
"Athena API key is required. Pass createClient(url, key) with a real API key, or set key in the config object."
|
|
8805
|
+
);
|
|
8806
|
+
}
|
|
8807
|
+
const normalizedValue = value.trim();
|
|
8808
|
+
if (!normalizedValue) {
|
|
8809
|
+
throw new Error(
|
|
8810
|
+
"Athena API key is required. Pass createClient(url, key) with a real API key, or set key in the config object."
|
|
8811
|
+
);
|
|
8812
|
+
}
|
|
8813
|
+
return normalizedValue;
|
|
8814
|
+
}
|
|
8815
|
+
function hasHeaderIgnoreCase(headers, targetKey) {
|
|
8816
|
+
const normalizedTargetKey = targetKey.toLowerCase();
|
|
8817
|
+
return Object.keys(headers).some((key) => key.toLowerCase() === normalizedTargetKey);
|
|
8818
|
+
}
|
|
8819
|
+
function mergeClientHeaders(current, next) {
|
|
8820
|
+
if (!current && !next) {
|
|
8821
|
+
return void 0;
|
|
8822
|
+
}
|
|
8823
|
+
return {
|
|
8824
|
+
...current ?? {},
|
|
8825
|
+
...next ?? {}
|
|
8826
|
+
};
|
|
8827
|
+
}
|
|
8828
|
+
function mergeDefinedObject(current, next) {
|
|
8829
|
+
if (!current && !next) {
|
|
8830
|
+
return void 0;
|
|
8831
|
+
}
|
|
8832
|
+
const merged = {
|
|
8833
|
+
...current ?? {}
|
|
8834
|
+
};
|
|
8835
|
+
const mutableMerged = merged;
|
|
8836
|
+
for (const [key, value] of Object.entries(next ?? {})) {
|
|
8837
|
+
if (value !== void 0) {
|
|
8838
|
+
mutableMerged[key] = value;
|
|
8839
|
+
}
|
|
8840
|
+
}
|
|
8841
|
+
return merged;
|
|
8842
|
+
}
|
|
8843
|
+
function mergeAuthClientOptions(current, next) {
|
|
8844
|
+
const merged = mergeDefinedObject(current, next);
|
|
8845
|
+
if (!merged) {
|
|
8846
|
+
return void 0;
|
|
8847
|
+
}
|
|
8848
|
+
const mergedHeaders = mergeClientHeaders(current?.headers, next?.headers);
|
|
8849
|
+
if (mergedHeaders) {
|
|
8850
|
+
merged.headers = mergedHeaders;
|
|
8851
|
+
}
|
|
8852
|
+
return merged;
|
|
8853
|
+
}
|
|
8854
|
+
function mergeServiceUrlOverrides(current, next) {
|
|
8855
|
+
return mergeDefinedObject(current, next);
|
|
8856
|
+
}
|
|
8857
|
+
function toClientContextOverrides(context) {
|
|
8858
|
+
if (!context) {
|
|
8859
|
+
return void 0;
|
|
8860
|
+
}
|
|
8861
|
+
return {
|
|
8862
|
+
userId: context.userId,
|
|
8863
|
+
organizationId: context.organizationId,
|
|
8864
|
+
forceNoCache: context.forceNoCache,
|
|
8865
|
+
headers: context.headers,
|
|
8866
|
+
auth: context.auth ? {
|
|
8867
|
+
...context.auth,
|
|
8868
|
+
headers: context.auth.headers ? { ...context.auth.headers } : void 0
|
|
8869
|
+
} : void 0
|
|
8870
|
+
};
|
|
8871
|
+
}
|
|
8872
|
+
function mergeClientOverrideOptions(base, overrides) {
|
|
8873
|
+
if (!overrides) {
|
|
8874
|
+
return {
|
|
8875
|
+
...base,
|
|
8876
|
+
headers: base.headers ? { ...base.headers } : void 0,
|
|
8877
|
+
auth: base.auth ? {
|
|
8878
|
+
...base.auth,
|
|
8879
|
+
headers: base.auth.headers ? { ...base.auth.headers } : void 0
|
|
8880
|
+
} : void 0,
|
|
8881
|
+
db: base.db ? { ...base.db } : void 0,
|
|
8882
|
+
gateway: base.gateway ? { ...base.gateway } : void 0,
|
|
8883
|
+
storage: base.storage ? { ...base.storage } : void 0
|
|
8884
|
+
};
|
|
8885
|
+
}
|
|
8886
|
+
const merged = mergeDefinedObject(base, overrides) ?? { ...base };
|
|
8887
|
+
return {
|
|
8888
|
+
...merged,
|
|
8889
|
+
headers: mergeClientHeaders(base.headers, overrides.headers),
|
|
8890
|
+
auth: mergeAuthClientOptions(base.auth, overrides.auth),
|
|
8891
|
+
db: mergeServiceUrlOverrides(base.db, overrides.db),
|
|
8892
|
+
gateway: mergeServiceUrlOverrides(base.gateway, overrides.gateway),
|
|
8893
|
+
storage: mergeServiceUrlOverrides(base.storage, overrides.storage)
|
|
8894
|
+
};
|
|
8895
|
+
}
|
|
7814
8896
|
function normalizeAuthClientConfig(auth, defaultBaseUrl) {
|
|
7815
8897
|
if (!auth && defaultBaseUrl === void 0) {
|
|
7816
8898
|
return void 0;
|
|
7817
8899
|
}
|
|
7818
|
-
const {
|
|
8900
|
+
const {
|
|
8901
|
+
url,
|
|
8902
|
+
baseUrl,
|
|
8903
|
+
apiKey,
|
|
8904
|
+
bearerToken,
|
|
8905
|
+
cookie,
|
|
8906
|
+
sessionToken,
|
|
8907
|
+
...rest
|
|
8908
|
+
} = auth ?? {};
|
|
7819
8909
|
const normalized = {
|
|
7820
8910
|
...rest
|
|
7821
8911
|
};
|
|
7822
8912
|
const resolvedBaseUrl = resolveClientServiceBaseUrl(
|
|
7823
|
-
url ??
|
|
8913
|
+
url ?? baseUrl ?? defaultBaseUrl,
|
|
7824
8914
|
"Athena auth base URL"
|
|
7825
8915
|
);
|
|
7826
8916
|
if (resolvedBaseUrl !== void 0) {
|
|
7827
8917
|
normalized.baseUrl = resolvedBaseUrl;
|
|
7828
8918
|
}
|
|
8919
|
+
if (typeof apiKey === "string") {
|
|
8920
|
+
normalized.apiKey = apiKey;
|
|
8921
|
+
}
|
|
8922
|
+
if (typeof bearerToken === "string") {
|
|
8923
|
+
normalized.bearerToken = bearerToken;
|
|
8924
|
+
}
|
|
8925
|
+
if (typeof cookie === "string") {
|
|
8926
|
+
normalized.cookie = cookie;
|
|
8927
|
+
}
|
|
8928
|
+
if (typeof sessionToken === "string") {
|
|
8929
|
+
normalized.sessionToken = sessionToken;
|
|
8930
|
+
}
|
|
7829
8931
|
return normalized;
|
|
7830
8932
|
}
|
|
7831
8933
|
function resolveCreateClientConfig(config) {
|
|
@@ -7837,8 +8939,11 @@ function resolveCreateClientConfig(config) {
|
|
|
7837
8939
|
}
|
|
7838
8940
|
return {
|
|
7839
8941
|
baseUrl: resolvedUrls.dbUrl,
|
|
7840
|
-
apiKey: config.key,
|
|
7841
|
-
client: config.client,
|
|
8942
|
+
apiKey: resolveRequiredClientApiKey(config.key),
|
|
8943
|
+
client: resolveOptionalClientName(config.client),
|
|
8944
|
+
userId: config.userId,
|
|
8945
|
+
organizationId: config.organizationId,
|
|
8946
|
+
forceNoCache: config.forceNoCache,
|
|
7842
8947
|
backend: toBackendConfig(config.backend),
|
|
7843
8948
|
headers: config.headers,
|
|
7844
8949
|
auth: config.auth,
|
|
@@ -7847,23 +8952,39 @@ function resolveCreateClientConfig(config) {
|
|
|
7847
8952
|
experimental: config.experimental
|
|
7848
8953
|
};
|
|
7849
8954
|
}
|
|
7850
|
-
function
|
|
8955
|
+
function createClientFromInput(sourceConfig) {
|
|
8956
|
+
return createClientFromConfig(resolveCreateClientConfig(sourceConfig), sourceConfig);
|
|
8957
|
+
}
|
|
8958
|
+
function createClientFromConfig(config, sourceConfig) {
|
|
8959
|
+
const normalizedAuthConfig = normalizeAuthClientConfig(config.auth, config.authUrl);
|
|
7851
8960
|
const gatewayHeaders = {
|
|
7852
8961
|
...config.headers ?? {}
|
|
7853
8962
|
};
|
|
7854
|
-
if (
|
|
7855
|
-
gatewayHeaders["X-Athena-Auth-Bearer-Token"] =
|
|
8963
|
+
if (normalizedAuthConfig?.bearerToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Bearer-Token")) {
|
|
8964
|
+
gatewayHeaders["X-Athena-Auth-Bearer-Token"] = normalizedAuthConfig.bearerToken;
|
|
8965
|
+
}
|
|
8966
|
+
if (normalizedAuthConfig?.cookie && !hasHeaderIgnoreCase(gatewayHeaders, "Cookie")) {
|
|
8967
|
+
gatewayHeaders.Cookie = normalizedAuthConfig.cookie;
|
|
8968
|
+
}
|
|
8969
|
+
if (normalizedAuthConfig?.sessionToken && !hasHeaderIgnoreCase(gatewayHeaders, "X-Athena-Auth-Session-Token")) {
|
|
8970
|
+
gatewayHeaders["X-Athena-Auth-Session-Token"] = normalizedAuthConfig.sessionToken;
|
|
7856
8971
|
}
|
|
7857
8972
|
const gateway = createAthenaGatewayClient({
|
|
7858
8973
|
baseUrl: config.baseUrl,
|
|
7859
8974
|
apiKey: config.apiKey,
|
|
7860
8975
|
client: config.client,
|
|
8976
|
+
userId: config.userId,
|
|
8977
|
+
organizationId: config.organizationId,
|
|
8978
|
+
forceNoCache: config.forceNoCache,
|
|
7861
8979
|
backend: config.backend,
|
|
7862
8980
|
headers: gatewayHeaders
|
|
7863
8981
|
});
|
|
7864
8982
|
const formatGatewayResult = createResultFormatter(config.experimental);
|
|
7865
8983
|
const queryTracer = createQueryTracer(config.experimental);
|
|
7866
|
-
const auth = createAuthClient(
|
|
8984
|
+
const auth = createAuthClient({
|
|
8985
|
+
...normalizedAuthConfig ?? {},
|
|
8986
|
+
...config.forceNoCache ? { forceNoCache: true } : {}
|
|
8987
|
+
});
|
|
7867
8988
|
function from(tableOrModel, options) {
|
|
7868
8989
|
if (isAthenaModelTarget(tableOrModel)) {
|
|
7869
8990
|
if (options?.schema !== void 0) {
|
|
@@ -7911,17 +9032,45 @@ function createClientFromConfig(config) {
|
|
|
7911
9032
|
queryTracer
|
|
7912
9033
|
);
|
|
7913
9034
|
const db = createDbModule({ from, rpc, query });
|
|
9035
|
+
const withContext = (context) => createClientFromInput(
|
|
9036
|
+
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
9037
|
+
);
|
|
9038
|
+
const withSession = (session, options) => createClientFromInput(
|
|
9039
|
+
mergeClientOverrideOptions(
|
|
9040
|
+
sourceConfig,
|
|
9041
|
+
toClientContextOverrides(resolveSessionContextOptions(session, options))
|
|
9042
|
+
)
|
|
9043
|
+
);
|
|
9044
|
+
const authWithOptions = (options) => createClientFromInput(mergeClientOverrideOptions(sourceConfig, options));
|
|
7914
9045
|
const sdkClient = {
|
|
7915
9046
|
from,
|
|
7916
9047
|
db,
|
|
7917
9048
|
rpc,
|
|
7918
9049
|
query,
|
|
7919
9050
|
verifyConnection: gateway.verifyConnection,
|
|
7920
|
-
auth: auth.auth
|
|
9051
|
+
auth: auth.auth,
|
|
9052
|
+
withContext,
|
|
9053
|
+
withSession,
|
|
9054
|
+
withOptions: authWithOptions
|
|
7921
9055
|
};
|
|
7922
9056
|
if (config.experimental?.athenaStorageBackend) {
|
|
9057
|
+
const storageWithContext = (context) => createClientFromInput(
|
|
9058
|
+
mergeClientOverrideOptions(sourceConfig, toClientContextOverrides(context))
|
|
9059
|
+
);
|
|
9060
|
+
const storageWithSession = (session, options) => createClientFromInput(
|
|
9061
|
+
mergeClientOverrideOptions(
|
|
9062
|
+
sourceConfig,
|
|
9063
|
+
toClientContextOverrides(resolveSessionContextOptions(session, options))
|
|
9064
|
+
)
|
|
9065
|
+
);
|
|
9066
|
+
const storageWithOptions = (options) => createClientFromInput(
|
|
9067
|
+
mergeClientOverrideOptions(sourceConfig, options)
|
|
9068
|
+
);
|
|
7923
9069
|
const storageClient = {
|
|
7924
9070
|
...sdkClient,
|
|
9071
|
+
withContext: storageWithContext,
|
|
9072
|
+
withSession: storageWithSession,
|
|
9073
|
+
withOptions: storageWithOptions,
|
|
7925
9074
|
storage: createStorageModule(gateway, {
|
|
7926
9075
|
...config.experimental.storage,
|
|
7927
9076
|
...config.storageUrl ? {
|
|
@@ -7935,14 +9084,14 @@ function createClientFromConfig(config) {
|
|
|
7935
9084
|
return sdkClient;
|
|
7936
9085
|
}
|
|
7937
9086
|
function createClient(configOrUrl, apiKey, options) {
|
|
7938
|
-
if (typeof configOrUrl === "string") {
|
|
7939
|
-
return
|
|
9087
|
+
if (typeof configOrUrl === "string" || configOrUrl === null || configOrUrl === void 0) {
|
|
9088
|
+
return createClientFromInput({
|
|
7940
9089
|
url: configOrUrl,
|
|
7941
9090
|
key: apiKey ?? "",
|
|
7942
9091
|
...options
|
|
7943
|
-
})
|
|
9092
|
+
});
|
|
7944
9093
|
}
|
|
7945
|
-
return
|
|
9094
|
+
return createClientFromInput(configOrUrl);
|
|
7946
9095
|
}
|
|
7947
9096
|
|
|
7948
9097
|
// src/schema/postgres-introspection-core.ts
|
|
@@ -8498,16 +9647,25 @@ async function fileExists(path) {
|
|
|
8498
9647
|
}
|
|
8499
9648
|
async function writeArtifacts(files, cwd) {
|
|
8500
9649
|
const writtenFiles = [];
|
|
9650
|
+
const skippedFiles = [];
|
|
8501
9651
|
for (const file of files) {
|
|
8502
9652
|
const absolutePath = resolve(cwd, file.path);
|
|
8503
9653
|
if (!canOverwriteArtifact(file) && await fileExists(absolutePath)) {
|
|
9654
|
+
skippedFiles.push({
|
|
9655
|
+
kind: file.kind,
|
|
9656
|
+
path: file.path,
|
|
9657
|
+
reason: "protected-existing-file"
|
|
9658
|
+
});
|
|
8504
9659
|
continue;
|
|
8505
9660
|
}
|
|
8506
9661
|
await mkdir(dirname(absolutePath), { recursive: true });
|
|
8507
9662
|
await writeFile(absolutePath, file.content, "utf8");
|
|
8508
9663
|
writtenFiles.push(file.path);
|
|
8509
9664
|
}
|
|
8510
|
-
return
|
|
9665
|
+
return {
|
|
9666
|
+
writtenFiles,
|
|
9667
|
+
skippedFiles
|
|
9668
|
+
};
|
|
8511
9669
|
}
|
|
8512
9670
|
async function runSchemaGenerator(options = {}) {
|
|
8513
9671
|
const cwd = options.cwd ?? process.cwd();
|
|
@@ -8521,11 +9679,13 @@ async function runSchemaGenerator(options = {}) {
|
|
|
8521
9679
|
schemas: resolveProviderSchemas(config.provider)
|
|
8522
9680
|
});
|
|
8523
9681
|
const generated = generateArtifactsFromSnapshot(snapshot, config);
|
|
8524
|
-
const
|
|
9682
|
+
const writeResult = options.dryRun ? { writtenFiles: [], skippedFiles: [] } : await writeArtifacts(generated.files, cwd);
|
|
8525
9683
|
return {
|
|
8526
9684
|
...generated,
|
|
8527
9685
|
configPath,
|
|
8528
|
-
|
|
9686
|
+
config,
|
|
9687
|
+
writtenFiles: writeResult.writtenFiles,
|
|
9688
|
+
skippedFiles: writeResult.skippedFiles
|
|
8529
9689
|
};
|
|
8530
9690
|
}
|
|
8531
9691
|
|
|
@@ -8553,7 +9713,7 @@ function generateUsage() {
|
|
|
8553
9713
|
"",
|
|
8554
9714
|
"Options:",
|
|
8555
9715
|
" --config <path> Explicit path to athena.config.ts or athena-js.config.ts",
|
|
8556
|
-
" --dry-run Build generated files in memory without writing them to disk",
|
|
9716
|
+
" --dry-run Build generated files in memory without writing them to disk and print mode/target hints",
|
|
8557
9717
|
" -h, --help Show help for generate",
|
|
8558
9718
|
"",
|
|
8559
9719
|
"Config resolution:",
|
|
@@ -8567,6 +9727,68 @@ function generateUsage() {
|
|
|
8567
9727
|
" athena-js generate --config ./athena.config.ts --dry-run"
|
|
8568
9728
|
].join("\n");
|
|
8569
9729
|
}
|
|
9730
|
+
function normalizePath2(pathValue) {
|
|
9731
|
+
return pathValue.replace(/\\/g, "/");
|
|
9732
|
+
}
|
|
9733
|
+
function isLegacyConfigRegistryTarget(target) {
|
|
9734
|
+
return normalizePath2(target) === "athena/config.ts";
|
|
9735
|
+
}
|
|
9736
|
+
function isFlatSchemaTarget(target) {
|
|
9737
|
+
return normalizePath2(target) === "athena/schema.ts";
|
|
9738
|
+
}
|
|
9739
|
+
function formatProviderLine(result) {
|
|
9740
|
+
const { provider } = result.config;
|
|
9741
|
+
if (provider.kind === "postgres") {
|
|
9742
|
+
const schemaList = Array.isArray(provider.schemas) ? provider.schemas.join(",") : typeof provider.schemas === "string" ? provider.schemas : "public";
|
|
9743
|
+
const database = provider.database ? ` database=${provider.database}` : "";
|
|
9744
|
+
const backend = provider.mode === "gateway" && provider.backend ? ` backend=${provider.backend}` : "";
|
|
9745
|
+
return `[provider] kind=${provider.kind} mode=${provider.mode}${database}${backend} schemas=${schemaList}`;
|
|
9746
|
+
}
|
|
9747
|
+
const datacenter = provider.datacenter ? ` datacenter=${provider.datacenter}` : "";
|
|
9748
|
+
return `[provider] kind=${provider.kind} mode=${provider.mode} keyspace=${provider.keyspace} contactPoints=${provider.contactPoints.join(",")}${datacenter}`;
|
|
9749
|
+
}
|
|
9750
|
+
function formatFilterLine(result) {
|
|
9751
|
+
const { includeTables, excludeTables } = result.config.filter;
|
|
9752
|
+
if (includeTables.length === 0 && excludeTables.length === 0) {
|
|
9753
|
+
return void 0;
|
|
9754
|
+
}
|
|
9755
|
+
return `[filter] include=${includeTables.length > 0 ? includeTables.join(",") : "-"} exclude=${excludeTables.length > 0 ? excludeTables.join(",") : "-"}`;
|
|
9756
|
+
}
|
|
9757
|
+
function formatGeneratorModeLines(result) {
|
|
9758
|
+
const lines = [
|
|
9759
|
+
`[mode] preset=${result.config.output.preset} format=${result.config.output.format} modelTarget=${result.config.output.targets.model}`,
|
|
9760
|
+
formatProviderLine(result),
|
|
9761
|
+
`[targets] schema=${result.config.output.targets.schema} database=${result.config.output.targets.database} registry=${result.config.output.targets.registry}`
|
|
9762
|
+
];
|
|
9763
|
+
const filterLine = formatFilterLine(result);
|
|
9764
|
+
if (filterLine) {
|
|
9765
|
+
lines.push(filterLine);
|
|
9766
|
+
}
|
|
9767
|
+
if (result.config.output.format === "define-model") {
|
|
9768
|
+
lines.push(
|
|
9769
|
+
'[note] Legacy define-model compatibility output is active. Set output.format="table-builder" or ATHENA_GENERATOR_OUTPUT_FORMAT=table-builder to emit table(...).schema(...).columns(...).primaryKey(...).'
|
|
9770
|
+
);
|
|
9771
|
+
}
|
|
9772
|
+
if (result.config.output.preset === "legacy") {
|
|
9773
|
+
lines.push(
|
|
9774
|
+
'[note] Legacy preset is active. It keeps registry output on athena/config.ts for compatibility; prefer output.preset="athena-direct" for the default safe direct layout.'
|
|
9775
|
+
);
|
|
9776
|
+
}
|
|
9777
|
+
lines.push(
|
|
9778
|
+
"[note] Default generator mode is preset=athena-direct + format=table-builder. experimental.findManyAst only affects runtime findMany(...) transport and does not enable generator table output."
|
|
9779
|
+
);
|
|
9780
|
+
if (isLegacyConfigRegistryTarget(result.config.output.targets.registry)) {
|
|
9781
|
+
lines.push(
|
|
9782
|
+
'[warn] Registry target points at athena/config.ts. That file is often a handwritten runtime seam; prefer output.preset="athena-direct" or output.targets.registry="athena/registry.generated.ts" unless you intentionally need legacy compatibility.'
|
|
9783
|
+
);
|
|
9784
|
+
}
|
|
9785
|
+
if (isFlatSchemaTarget(result.config.output.targets.schema)) {
|
|
9786
|
+
lines.push(
|
|
9787
|
+
"[warn] Schema target points at athena/schema.ts. Prefer schema-scoped output such as athena/schemas/{schema_kebab}.ts."
|
|
9788
|
+
);
|
|
9789
|
+
}
|
|
9790
|
+
return lines;
|
|
9791
|
+
}
|
|
8570
9792
|
function usage(topic = "root") {
|
|
8571
9793
|
return topic === "generate" ? generateUsage() : rootUsage();
|
|
8572
9794
|
}
|
|
@@ -8649,6 +9871,12 @@ function formatGeneratorError(error, configPath) {
|
|
|
8649
9871
|
}
|
|
8650
9872
|
return new Error(normalizeErrorMessage(error));
|
|
8651
9873
|
}
|
|
9874
|
+
function formatSkippedArtifactLine(artifact) {
|
|
9875
|
+
if (artifact.reason === "protected-existing-file") {
|
|
9876
|
+
return ` [skip] ${artifact.path} (existing ${artifact.kind} artifacts are protected from overwrite; delete or retarget the file to regenerate it)`;
|
|
9877
|
+
}
|
|
9878
|
+
return ` [skip] ${artifact.path}`;
|
|
9879
|
+
}
|
|
8652
9880
|
async function runCLI(argv, runtime = {}) {
|
|
8653
9881
|
const log = runtime.log ?? console.log;
|
|
8654
9882
|
const runGenerator = runtime.runGenerator ?? runSchemaGenerator;
|
|
@@ -8668,15 +9896,24 @@ async function runCLI(argv, runtime = {}) {
|
|
|
8668
9896
|
}
|
|
8669
9897
|
if (parsed.dryRun) {
|
|
8670
9898
|
log(`[dry-run] Generated ${result.files.length} files from ${result.configPath}`);
|
|
9899
|
+
for (const line of formatGeneratorModeLines(result)) {
|
|
9900
|
+
log(line);
|
|
9901
|
+
}
|
|
8671
9902
|
for (const file of result.files) {
|
|
8672
9903
|
log(` - ${file.path}`);
|
|
8673
9904
|
}
|
|
8674
9905
|
return;
|
|
8675
9906
|
}
|
|
8676
9907
|
log(`Generated ${result.writtenFiles.length} files from ${result.configPath}`);
|
|
9908
|
+
for (const line of formatGeneratorModeLines(result)) {
|
|
9909
|
+
log(line);
|
|
9910
|
+
}
|
|
8677
9911
|
for (const filePath of result.writtenFiles) {
|
|
8678
9912
|
log(` - ${filePath}`);
|
|
8679
9913
|
}
|
|
9914
|
+
for (const artifact of result.skippedFiles) {
|
|
9915
|
+
log(formatSkippedArtifactLine(artifact));
|
|
9916
|
+
}
|
|
8680
9917
|
}
|
|
8681
9918
|
|
|
8682
9919
|
export { parseCommand, runCLI, usage };
|