@dyne/interfacer-client 0.2.8 → 0.3.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/dist/index.d.cts CHANGED
@@ -1,12 +1,37 @@
1
1
  /**
2
2
  * Configuration for the InterfacerClient.
3
3
  *
4
- * All service URLs are explicit — no process.env dependency.
5
- * Apps consuming the SDK provide URLs from their own environment.
4
+ * The simplest way to configure is via `proxyUrl` — all service URLs
5
+ * are derived from it using well-known path conventions:
6
+ *
7
+ * zenflowsUrl → ${proxyUrl}/zenflows/api
8
+ * zenflowsFileUrl → ${proxyUrl}/zenflows/api/file
9
+ * dppUrl → ${proxyUrl}/interfacer-dpp
10
+ * inbox.send → ${proxyUrl}/inbox/send
11
+ * inbox.read → ${proxyUrl}/inbox/read
12
+ * inbox.countUnread → ${proxyUrl}/inbox/count-unread
13
+ * inbox.setRead → ${proxyUrl}/inbox/set-read
14
+ * walletUrl → ${proxyUrl}/wallet/token
15
+ * social.personBase → ${proxyUrl}/inbox/person
16
+ * social.economicResourceBase → ${proxyUrl}/inbox/economicresource
17
+ * oshUrl → ${proxyUrl}/osh
18
+ *
19
+ * You can override any derived URL by passing it explicitly.
20
+ *
21
+ * Fields that CANNOT be derived from proxyUrl (must be provided
22
+ * separately): loshId, zenflowsAdmin, specs, walletCycle, location.
6
23
  */
7
24
  interface InterfacerConfig {
25
+ /**
26
+ * Proxy base URL. When provided, all service URLs below are derived
27
+ * automatically using well-known paths. Individual URLs can still be
28
+ * overridden if needed.
29
+ *
30
+ * Example: "https://proxy.dpp-dev.ddns.dyne.org"
31
+ */
32
+ proxyUrl?: string;
8
33
  /** Base URL of the Zenflows GraphQL API (e.g. https://proxy.example.com/zenflows/api) */
9
- zenflowsUrl: string;
34
+ zenflowsUrl?: string;
10
35
  /** Base URL of the Zenflows file storage endpoint */
11
36
  zenflowsFileUrl?: string;
12
37
  /** Base URL of the DPP service (e.g. https://proxy.example.com/interfacer-dpp) */
@@ -40,6 +65,10 @@ interface InterfacerConfig {
40
65
  machine?: string;
41
66
  /** Material spec ID (for material classification) */
42
67
  material?: string;
68
+ /** Product spec ID (for createProject with Product type) */
69
+ product?: string;
70
+ /** Service spec ID (for createProject with Service type) */
71
+ service?: string;
43
72
  };
44
73
  /** Zenflows admin token (needed for sign-up mutations) */
45
74
  zenflowsAdmin?: string;
@@ -52,8 +81,40 @@ interface InterfacerConfig {
52
81
  };
53
82
  }
54
83
  /**
55
- * Create a config object with defaults.
56
- * All URLs are required; there are no defaults.
84
+ * Endpoints derived from a proxy URL.
85
+ * Returned by {@link deriveEndpointsFromProxy}.
86
+ */
87
+ interface DerivedEndpoints {
88
+ zenflowsUrl: string;
89
+ zenflowsFileUrl: string;
90
+ dppUrl: string;
91
+ inbox: {
92
+ send: string;
93
+ read: string;
94
+ countUnread: string;
95
+ setRead: string;
96
+ };
97
+ walletUrl: string;
98
+ social: {
99
+ personBase: string;
100
+ economicResourceBase: string;
101
+ };
102
+ oshUrl: string;
103
+ }
104
+ /**
105
+ * Derive all service endpoints from a proxy base URL using well-known paths.
106
+ *
107
+ * @example
108
+ * const endpoints = deriveEndpointsFromProxy("https://proxy.dpp-dev.ddns.dyne.org");
109
+ * // endpoints.zenflowsUrl === "https://proxy.dpp-dev.ddns.dyne.org/zenflows/api"
110
+ * // endpoints.dppUrl === "https://proxy.dpp-dev.ddns.dyne.org/interfacer-dpp"
111
+ */
112
+ declare function deriveEndpointsFromProxy(proxyUrl: string): DerivedEndpoints;
113
+ /**
114
+ * Create a resolved config object.
115
+ *
116
+ * If `proxyUrl` is provided, all service URLs that are not explicitly
117
+ * set will be derived from it. Explicit values always take precedence.
57
118
  */
58
119
  declare function createConfig(config: InterfacerConfig): InterfacerConfig;
59
120
 
@@ -105,10 +166,10 @@ declare class GraphQLClient {
105
166
  * hide the complexity of EconomicResources, EconomicEvents, etc.
106
167
  */
107
168
  declare enum ProjectType {
108
- DESIGN = "DESIGN",
109
- PRODUCT = "PRODUCT",
110
- SERVICE = "SERVICE",
111
- MACHINE = "MACHINE",
169
+ DESIGN = "Design",
170
+ PRODUCT = "Product",
171
+ SERVICE = "Service",
172
+ MACHINE = "Machine",
112
173
  DPP = "DPP"
113
174
  }
114
175
  declare enum ProposalStatus {
@@ -643,6 +704,10 @@ interface CreateProjectParams$1 {
643
704
  lat?: number;
644
705
  lng?: number;
645
706
  };
707
+ /** Pre-created location ID (avoids duplicate location creation) */
708
+ locationId?: string;
709
+ /** Pre-created process ID (avoids duplicate process creation) */
710
+ processId?: string;
646
711
  metadata?: Record<string, unknown>;
647
712
  }
648
713
  interface CreateMachineParams {
@@ -976,6 +1041,10 @@ interface CreateProjectParams {
976
1041
  lat?: number;
977
1042
  lng?: number;
978
1043
  };
1044
+ /** Pre-created location ID (avoids duplicate location creation) */
1045
+ locationId?: string;
1046
+ /** Pre-created process ID (avoids duplicate process creation) */
1047
+ processId?: string;
979
1048
  metadata?: Record<string, unknown>;
980
1049
  }
981
1050
  interface ProjectFilter {
@@ -1037,8 +1106,8 @@ interface SpecInfo {
1037
1106
  }
1038
1107
  interface InstanceVariables {
1039
1108
  projectDesign: SpecInfo;
1040
- projectProduct: SpecInfo;
1041
- projectService: SpecInfo;
1109
+ projectProduct?: SpecInfo;
1110
+ projectService?: SpecInfo;
1042
1111
  dpp?: SpecInfo;
1043
1112
  machine?: SpecInfo;
1044
1113
  material?: SpecInfo;
@@ -1089,4 +1158,4 @@ declare function signDidRequest(body: string, store: KeyStorage): Promise<{
1089
1158
  */
1090
1159
  declare function signFileUpload(checksumHex: string, store: KeyStorage): Promise<string>;
1091
1160
 
1092
- export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Contributor, type CreateProjectParams, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FileClient, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
1161
+ export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Contributor, type CreateProjectParams, type DerivedEndpoints, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FileClient, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, deriveEndpointsFromProxy, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
package/dist/index.d.ts CHANGED
@@ -1,12 +1,37 @@
1
1
  /**
2
2
  * Configuration for the InterfacerClient.
3
3
  *
4
- * All service URLs are explicit — no process.env dependency.
5
- * Apps consuming the SDK provide URLs from their own environment.
4
+ * The simplest way to configure is via `proxyUrl` — all service URLs
5
+ * are derived from it using well-known path conventions:
6
+ *
7
+ * zenflowsUrl → ${proxyUrl}/zenflows/api
8
+ * zenflowsFileUrl → ${proxyUrl}/zenflows/api/file
9
+ * dppUrl → ${proxyUrl}/interfacer-dpp
10
+ * inbox.send → ${proxyUrl}/inbox/send
11
+ * inbox.read → ${proxyUrl}/inbox/read
12
+ * inbox.countUnread → ${proxyUrl}/inbox/count-unread
13
+ * inbox.setRead → ${proxyUrl}/inbox/set-read
14
+ * walletUrl → ${proxyUrl}/wallet/token
15
+ * social.personBase → ${proxyUrl}/inbox/person
16
+ * social.economicResourceBase → ${proxyUrl}/inbox/economicresource
17
+ * oshUrl → ${proxyUrl}/osh
18
+ *
19
+ * You can override any derived URL by passing it explicitly.
20
+ *
21
+ * Fields that CANNOT be derived from proxyUrl (must be provided
22
+ * separately): loshId, zenflowsAdmin, specs, walletCycle, location.
6
23
  */
7
24
  interface InterfacerConfig {
25
+ /**
26
+ * Proxy base URL. When provided, all service URLs below are derived
27
+ * automatically using well-known paths. Individual URLs can still be
28
+ * overridden if needed.
29
+ *
30
+ * Example: "https://proxy.dpp-dev.ddns.dyne.org"
31
+ */
32
+ proxyUrl?: string;
8
33
  /** Base URL of the Zenflows GraphQL API (e.g. https://proxy.example.com/zenflows/api) */
9
- zenflowsUrl: string;
34
+ zenflowsUrl?: string;
10
35
  /** Base URL of the Zenflows file storage endpoint */
11
36
  zenflowsFileUrl?: string;
12
37
  /** Base URL of the DPP service (e.g. https://proxy.example.com/interfacer-dpp) */
@@ -40,6 +65,10 @@ interface InterfacerConfig {
40
65
  machine?: string;
41
66
  /** Material spec ID (for material classification) */
42
67
  material?: string;
68
+ /** Product spec ID (for createProject with Product type) */
69
+ product?: string;
70
+ /** Service spec ID (for createProject with Service type) */
71
+ service?: string;
43
72
  };
44
73
  /** Zenflows admin token (needed for sign-up mutations) */
45
74
  zenflowsAdmin?: string;
@@ -52,8 +81,40 @@ interface InterfacerConfig {
52
81
  };
53
82
  }
54
83
  /**
55
- * Create a config object with defaults.
56
- * All URLs are required; there are no defaults.
84
+ * Endpoints derived from a proxy URL.
85
+ * Returned by {@link deriveEndpointsFromProxy}.
86
+ */
87
+ interface DerivedEndpoints {
88
+ zenflowsUrl: string;
89
+ zenflowsFileUrl: string;
90
+ dppUrl: string;
91
+ inbox: {
92
+ send: string;
93
+ read: string;
94
+ countUnread: string;
95
+ setRead: string;
96
+ };
97
+ walletUrl: string;
98
+ social: {
99
+ personBase: string;
100
+ economicResourceBase: string;
101
+ };
102
+ oshUrl: string;
103
+ }
104
+ /**
105
+ * Derive all service endpoints from a proxy base URL using well-known paths.
106
+ *
107
+ * @example
108
+ * const endpoints = deriveEndpointsFromProxy("https://proxy.dpp-dev.ddns.dyne.org");
109
+ * // endpoints.zenflowsUrl === "https://proxy.dpp-dev.ddns.dyne.org/zenflows/api"
110
+ * // endpoints.dppUrl === "https://proxy.dpp-dev.ddns.dyne.org/interfacer-dpp"
111
+ */
112
+ declare function deriveEndpointsFromProxy(proxyUrl: string): DerivedEndpoints;
113
+ /**
114
+ * Create a resolved config object.
115
+ *
116
+ * If `proxyUrl` is provided, all service URLs that are not explicitly
117
+ * set will be derived from it. Explicit values always take precedence.
57
118
  */
58
119
  declare function createConfig(config: InterfacerConfig): InterfacerConfig;
59
120
 
@@ -105,10 +166,10 @@ declare class GraphQLClient {
105
166
  * hide the complexity of EconomicResources, EconomicEvents, etc.
106
167
  */
107
168
  declare enum ProjectType {
108
- DESIGN = "DESIGN",
109
- PRODUCT = "PRODUCT",
110
- SERVICE = "SERVICE",
111
- MACHINE = "MACHINE",
169
+ DESIGN = "Design",
170
+ PRODUCT = "Product",
171
+ SERVICE = "Service",
172
+ MACHINE = "Machine",
112
173
  DPP = "DPP"
113
174
  }
114
175
  declare enum ProposalStatus {
@@ -643,6 +704,10 @@ interface CreateProjectParams$1 {
643
704
  lat?: number;
644
705
  lng?: number;
645
706
  };
707
+ /** Pre-created location ID (avoids duplicate location creation) */
708
+ locationId?: string;
709
+ /** Pre-created process ID (avoids duplicate process creation) */
710
+ processId?: string;
646
711
  metadata?: Record<string, unknown>;
647
712
  }
648
713
  interface CreateMachineParams {
@@ -976,6 +1041,10 @@ interface CreateProjectParams {
976
1041
  lat?: number;
977
1042
  lng?: number;
978
1043
  };
1044
+ /** Pre-created location ID (avoids duplicate location creation) */
1045
+ locationId?: string;
1046
+ /** Pre-created process ID (avoids duplicate process creation) */
1047
+ processId?: string;
979
1048
  metadata?: Record<string, unknown>;
980
1049
  }
981
1050
  interface ProjectFilter {
@@ -1037,8 +1106,8 @@ interface SpecInfo {
1037
1106
  }
1038
1107
  interface InstanceVariables {
1039
1108
  projectDesign: SpecInfo;
1040
- projectProduct: SpecInfo;
1041
- projectService: SpecInfo;
1109
+ projectProduct?: SpecInfo;
1110
+ projectService?: SpecInfo;
1042
1111
  dpp?: SpecInfo;
1043
1112
  machine?: SpecInfo;
1044
1113
  material?: SpecInfo;
@@ -1089,4 +1158,4 @@ declare function signDidRequest(body: string, store: KeyStorage): Promise<{
1089
1158
  */
1090
1159
  declare function signFileUpload(checksumHex: string, store: KeyStorage): Promise<string>;
1091
1160
 
1092
- export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Contributor, type CreateProjectParams, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FileClient, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
1161
+ export { AVAILABILITY_OPTIONS, AuthClient, CO2_THRESHOLDS_KG, type Contributor, type CreateProjectParams, type DerivedEndpoints, type DppAttachment, DppClient, type DppDocument, type DppStatus, ENERGY_THRESHOLDS_KWH, FileClient, type GqlFile, GraphQLClient, type ImageRef, ImportClient, InboxClient, type InstanceVariables, InterfacerClient, type InterfacerConfig, type KeyStorage, type Keyring, type License, type Location, MANUFACTURABLE_TRUE_TAG, type MachineRef, type MaterialRef, type ModelFile, POWER_COMPATIBILITY_OPTIONS, POWER_REQUIREMENT_THRESHOLDS_W, PRODUCT_CATEGORY_OPTIONS, type ProductFilters, type Project, type ProjectFilter, type ProjectModelMetadata, ProjectType, type Proposal, RECYCLABILITY_THRESHOLDS_PCT, REPAIRABILITY_AVAILABLE_TAG, REPLICABILITY_OPTIONS, ResourceClient, SERVICE_TYPE_OPTIONS, SYSTEM_TAG_PREFIXES, type ServiceFilters, SocialClient, TAG_PREFIX, TaggingClient, type UserChallenges, WalletClient, type ZenflowsFile, clearInstanceVariablesCache, createConfig, createMemoryStorage, deriveEndpointsFromProxy, derivedProductFilterTags, extractUserTagValues, formatImageSrc, getInstanceVariables, getResourceImage, isSystemTag, isUserTag, mergeTags, monotonicRangeTags, normalizeUserTagsForSave, prefixedTag, prepFileForZenflows, prepFilesForZenflows, rangeFilterTags, removeTagsWithPrefixes, signDidRequest, signFileUpload, signGraphQLRequest, slugifyTagValue, stripUserTagPrefix, userTag };
package/dist/index.js CHANGED
@@ -1189,7 +1189,9 @@ var GraphQLClient = class {
1189
1189
  console.warn("[interfacer-client] GraphQL signing failed:", err);
1190
1190
  }
1191
1191
  }
1192
- const res = await fetch(this.config.zenflowsUrl, {
1192
+ const url = this.config.zenflowsUrl;
1193
+ if (!url) throw new Error("zenflowsUrl not configured. Provide zenflowsUrl or proxyUrl in config.");
1194
+ const res = await fetch(url, {
1193
1195
  method: "POST",
1194
1196
  headers,
1195
1197
  body
@@ -1410,8 +1412,8 @@ async function getInstanceVariables(client) {
1410
1412
  if (!d) throw new Error("No instance variables returned.");
1411
1413
  cachedVars = {
1412
1414
  projectDesign: d.specs.specProjectDesign,
1413
- projectProduct: d.specs.specProjectProduct,
1414
- projectService: d.specs.specProjectService,
1415
+ projectProduct: d.specs.specProjectProduct ?? void 0,
1416
+ projectService: d.specs.specProjectService ?? void 0,
1415
1417
  dpp: d.specs.specDpp ?? void 0,
1416
1418
  machine: d.specs.specMachine ?? void 0,
1417
1419
  material: d.specs.specMaterial ?? void 0,
@@ -1445,13 +1447,13 @@ var ResourceClient = class {
1445
1447
  // ─── Helpers ───────────────────────────────────────────────────────
1446
1448
  specIdForType(vars, type) {
1447
1449
  switch (type) {
1448
- case "DESIGN" /* DESIGN */:
1450
+ case "Design" /* DESIGN */:
1449
1451
  return vars.projectDesign.id;
1450
- case "PRODUCT" /* PRODUCT */:
1451
- return vars.projectProduct.id;
1452
- case "SERVICE" /* SERVICE */:
1453
- return vars.projectService.id;
1454
- case "MACHINE" /* MACHINE */:
1452
+ case "Product" /* PRODUCT */:
1453
+ return vars.projectProduct?.id || this.config.specs?.product || "";
1454
+ case "Service" /* SERVICE */:
1455
+ return vars.projectService?.id || this.config.specs?.service || "";
1456
+ case "Machine" /* MACHINE */:
1455
1457
  return vars.machine?.id || this.config.specs?.machine || "";
1456
1458
  case "DPP" /* DPP */:
1457
1459
  return vars.dpp?.id || this.config.specs?.dpp || "";
@@ -1481,9 +1483,10 @@ var ResourceClient = class {
1481
1483
  async createProject(params) {
1482
1484
  const vars = await this.getInstanceVars();
1483
1485
  const specId = this.specIdForType(vars, params.projectType);
1484
- const processId = await this.createProcess(`creation of ${params.name} by owner`);
1485
- let locationId;
1486
- if (params.location) {
1486
+ if (!specId) throw new Error(`${params.projectType} spec ID not found in instance variables or config`);
1487
+ const processId = params.processId || await this.createProcess(`creation of ${params.name} by owner`);
1488
+ let locationId = params.locationId;
1489
+ if (!locationId && params.location) {
1487
1490
  const loc = await this.createLocation(params.location);
1488
1491
  locationId = loc.id;
1489
1492
  }
@@ -2216,8 +2219,39 @@ var InterfacerClient = class {
2216
2219
  init_hashing();
2217
2220
 
2218
2221
  // src/config/config.ts
2222
+ function deriveEndpointsFromProxy(proxyUrl) {
2223
+ const base = proxyUrl.replace(/\/$/, "");
2224
+ return {
2225
+ zenflowsUrl: `${base}/zenflows/api`,
2226
+ zenflowsFileUrl: `${base}/zenflows/api/file`,
2227
+ dppUrl: `${base}/interfacer-dpp`,
2228
+ inbox: {
2229
+ send: `${base}/inbox/send`,
2230
+ read: `${base}/inbox/read`,
2231
+ countUnread: `${base}/inbox/count-unread`,
2232
+ setRead: `${base}/inbox/set-read`
2233
+ },
2234
+ walletUrl: `${base}/wallet/token`,
2235
+ social: {
2236
+ personBase: `${base}/inbox/person`,
2237
+ economicResourceBase: `${base}/inbox/economicresource`
2238
+ },
2239
+ oshUrl: `${base}/osh`
2240
+ };
2241
+ }
2219
2242
  function createConfig(config) {
2220
- return config;
2243
+ if (!config.proxyUrl) return config;
2244
+ const derived = deriveEndpointsFromProxy(config.proxyUrl);
2245
+ return {
2246
+ ...config,
2247
+ zenflowsUrl: config.zenflowsUrl ?? derived.zenflowsUrl,
2248
+ zenflowsFileUrl: config.zenflowsFileUrl ?? derived.zenflowsFileUrl,
2249
+ dppUrl: config.dppUrl ?? derived.dppUrl,
2250
+ inbox: config.inbox ?? derived.inbox,
2251
+ walletUrl: config.walletUrl ?? derived.walletUrl,
2252
+ social: config.social ?? derived.social,
2253
+ oshUrl: config.oshUrl ?? derived.oshUrl
2254
+ };
2221
2255
  }
2222
2256
 
2223
2257
  // src/index.ts
@@ -2250,6 +2284,7 @@ export {
2250
2284
  clearInstanceVariablesCache,
2251
2285
  createConfig,
2252
2286
  createMemoryStorage,
2287
+ deriveEndpointsFromProxy,
2253
2288
  derivedProductFilterTags,
2254
2289
  extractUserTagValues,
2255
2290
  formatImageSrc,