@gravity-rail/sdk 0.46.0 → 0.47.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/internal.cjs CHANGED
@@ -5906,6 +5906,45 @@ var DashboardsApi = class extends BaseApiClient {
5906
5906
 
5907
5907
  // src/api/data-types.ts
5908
5908
  var DataTypesApi = class extends BaseApiClient {
5909
+ /** Read an anonymous Form's visitor-writable schema without a Member session. */
5910
+ async getAnonymousFormSchema(wid, formUuid) {
5911
+ return this.fetchPublicAnonymousForm(
5912
+ `w/${encodeURIComponent(wid)}/anonymous-forms/${encodeURIComponent(formUuid)}`
5913
+ );
5914
+ }
5915
+ /** Submit visitor-provided values. No cookie or API credential is sent. */
5916
+ async submitAnonymousForm(wid, formUuid, input) {
5917
+ return this.fetchPublicAnonymousForm(
5918
+ `w/${encodeURIComponent(wid)}/anonymous-forms/${encodeURIComponent(formUuid)}/submissions`,
5919
+ { method: "POST", body: JSON.stringify(input) }
5920
+ );
5921
+ }
5922
+ async fetchPublicAnonymousForm(endpoint, options = {}) {
5923
+ const headers = new Headers(options.headers);
5924
+ if (options.body !== void 0) headers.set("Content-Type", "application/json");
5925
+ let response;
5926
+ try {
5927
+ response = await this.fetchFunction(`${this.baseUrl}/api/v2/${endpoint}`, {
5928
+ ...options,
5929
+ credentials: "omit",
5930
+ headers
5931
+ });
5932
+ } catch {
5933
+ throw new ApiError("Anonymous Form request failed", 0);
5934
+ }
5935
+ if (!response.ok) {
5936
+ let message = `Request failed with status ${response.status}`;
5937
+ try {
5938
+ const body = await response.json();
5939
+ if (typeof body.detail === "string" && body.detail.length > 0) {
5940
+ message = body.detail;
5941
+ }
5942
+ } catch {
5943
+ }
5944
+ throw new ApiError(message, response.status);
5945
+ }
5946
+ return await response.json();
5947
+ }
5909
5948
  /** Read the local Form's draft and optimistic publication counters. */
5910
5949
  async getDataTypeDraft(wid, id) {
5911
5950
  return this.fetch(`w/${wid}/data-types/${id}/schema-draft`);
@@ -14418,6 +14457,7 @@ var WORKSPACE_METHOD_NAMES = [
14418
14457
  "getAgents",
14419
14458
  "getAnonymousResolution",
14420
14459
  "getAnonymousFormSubmission",
14460
+ "getAnonymousFormSchema",
14421
14461
  "getAnonymousResolutions",
14422
14462
  "getApiKeys",
14423
14463
  "getArchiveBlockers",
@@ -14803,6 +14843,7 @@ var WORKSPACE_METHOD_NAMES = [
14803
14843
  "linkUnlinkedSalesforceMembersByIdentity",
14804
14844
  "listAbilities",
14805
14845
  "listAnonymousFormSubmissions",
14846
+ "submitAnonymousForm",
14806
14847
  "listAppConnections",
14807
14848
  "listAvailableAppConnections",
14808
14849
  "listInstallations",
@@ -15256,6 +15297,8 @@ function bindTrackedLinksMethods(target, trackedLinks) {
15256
15297
 
15257
15298
  // src/client/bindings/data-types.ts
15258
15299
  function bindDataTypesMethods(target, dataTypes) {
15300
+ target.getAnonymousFormSchema = dataTypes.getAnonymousFormSchema.bind(dataTypes);
15301
+ target.submitAnonymousForm = dataTypes.submitAnonymousForm.bind(dataTypes);
15259
15302
  target.getDataTypeDraft = dataTypes.getDataTypeDraft.bind(dataTypes);
15260
15303
  target.saveDataTypeDraft = dataTypes.saveDataTypeDraft.bind(dataTypes);
15261
15304
  target.publishDataTypeDraft = dataTypes.publishDataTypeDraft.bind(dataTypes);
@@ -16450,6 +16493,8 @@ var GravityRailClient = class {
16450
16493
  getCelContext;
16451
16494
  validateCelExpression;
16452
16495
  // Data Types API
16496
+ getAnonymousFormSchema;
16497
+ submitAnonymousForm;
16453
16498
  getDataTypes;
16454
16499
  getDataTypeDraft;
16455
16500
  saveDataTypeDraft;