@zyphr-dev/node-sdk 0.1.24 → 0.1.25

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.js CHANGED
@@ -1086,6 +1086,9 @@ function AuthUserFromJSONTyped(json, ignoreDiscriminator) {
1086
1086
  "phoneVerified": json["phone_verified"] == null ? void 0 : json["phone_verified"],
1087
1087
  "status": json["status"] == null ? void 0 : json["status"],
1088
1088
  "mfaEnabled": json["mfa_enabled"] == null ? void 0 : json["mfa_enabled"],
1089
+ "isAnonymous": json["is_anonymous"] == null ? void 0 : json["is_anonymous"],
1090
+ "anonymousDeviceId": json["anonymous_device_id"] == null ? void 0 : json["anonymous_device_id"],
1091
+ "firstActivityAt": json["first_activity_at"] == null ? void 0 : new Date(json["first_activity_at"]),
1089
1092
  "createdAt": json["created_at"] == null ? void 0 : new Date(json["created_at"]),
1090
1093
  "updatedAt": json["updated_at"] == null ? void 0 : new Date(json["updated_at"]),
1091
1094
  "lastLoginAt": json["last_login_at"] == null ? void 0 : new Date(json["last_login_at"])
@@ -1109,6 +1112,9 @@ function AuthUserToJSONTyped(value, ignoreDiscriminator = false) {
1109
1112
  "phone_verified": value["phoneVerified"],
1110
1113
  "status": value["status"],
1111
1114
  "mfa_enabled": value["mfaEnabled"],
1115
+ "is_anonymous": value["isAnonymous"],
1116
+ "anonymous_device_id": value["anonymousDeviceId"],
1117
+ "first_activity_at": value["firstActivityAt"] == null ? void 0 : value["firstActivityAt"].toISOString(),
1112
1118
  "created_at": value["createdAt"] == null ? void 0 : value["createdAt"].toISOString(),
1113
1119
  "updated_at": value["updatedAt"] == null ? void 0 : value["updatedAt"].toISOString(),
1114
1120
  "last_login_at": value["lastLoginAt"] == null ? void 0 : value["lastLoginAt"].toISOString()
@@ -2060,6 +2066,172 @@ function ConsentWithdrawResponseToJSONTyped(value, ignoreDiscriminator = false)
2060
2066
  };
2061
2067
  }
2062
2068
 
2069
+ // src/src/models/ConvertAnonymousUserRequestOneOf.ts
2070
+ var ConvertAnonymousUserRequestOneOfMethodEnum = {
2071
+ PASSWORD: "password"
2072
+ };
2073
+ function instanceOfConvertAnonymousUserRequestOneOf(value) {
2074
+ if (!("method" in value) || value["method"] === void 0) return false;
2075
+ if (!("email" in value) || value["email"] === void 0) return false;
2076
+ if (!("password" in value) || value["password"] === void 0) return false;
2077
+ return true;
2078
+ }
2079
+ function ConvertAnonymousUserRequestOneOfFromJSON(json) {
2080
+ return ConvertAnonymousUserRequestOneOfFromJSONTyped(json, false);
2081
+ }
2082
+ function ConvertAnonymousUserRequestOneOfFromJSONTyped(json, ignoreDiscriminator) {
2083
+ if (json == null) {
2084
+ return json;
2085
+ }
2086
+ return {
2087
+ "method": json["method"],
2088
+ "email": json["email"],
2089
+ "password": json["password"],
2090
+ "name": json["name"] == null ? void 0 : json["name"]
2091
+ };
2092
+ }
2093
+ function ConvertAnonymousUserRequestOneOfToJSON(json) {
2094
+ return ConvertAnonymousUserRequestOneOfToJSONTyped(json, false);
2095
+ }
2096
+ function ConvertAnonymousUserRequestOneOfToJSONTyped(value, ignoreDiscriminator = false) {
2097
+ if (value == null) {
2098
+ return value;
2099
+ }
2100
+ return {
2101
+ "method": value["method"],
2102
+ "email": value["email"],
2103
+ "password": value["password"],
2104
+ "name": value["name"]
2105
+ };
2106
+ }
2107
+
2108
+ // src/src/models/ConvertAnonymousUserRequestOneOf1AppleUserName.ts
2109
+ function instanceOfConvertAnonymousUserRequestOneOf1AppleUserName(value) {
2110
+ return true;
2111
+ }
2112
+ function ConvertAnonymousUserRequestOneOf1AppleUserNameFromJSON(json) {
2113
+ return ConvertAnonymousUserRequestOneOf1AppleUserNameFromJSONTyped(json, false);
2114
+ }
2115
+ function ConvertAnonymousUserRequestOneOf1AppleUserNameFromJSONTyped(json, ignoreDiscriminator) {
2116
+ if (json == null) {
2117
+ return json;
2118
+ }
2119
+ return {
2120
+ "firstName": json["firstName"] == null ? void 0 : json["firstName"],
2121
+ "lastName": json["lastName"] == null ? void 0 : json["lastName"]
2122
+ };
2123
+ }
2124
+ function ConvertAnonymousUserRequestOneOf1AppleUserNameToJSON(json) {
2125
+ return ConvertAnonymousUserRequestOneOf1AppleUserNameToJSONTyped(json, false);
2126
+ }
2127
+ function ConvertAnonymousUserRequestOneOf1AppleUserNameToJSONTyped(value, ignoreDiscriminator = false) {
2128
+ if (value == null) {
2129
+ return value;
2130
+ }
2131
+ return {
2132
+ "firstName": value["firstName"],
2133
+ "lastName": value["lastName"]
2134
+ };
2135
+ }
2136
+
2137
+ // src/src/models/ConvertAnonymousUserRequestOneOf1AppleUser.ts
2138
+ function instanceOfConvertAnonymousUserRequestOneOf1AppleUser(value) {
2139
+ return true;
2140
+ }
2141
+ function ConvertAnonymousUserRequestOneOf1AppleUserFromJSON(json) {
2142
+ return ConvertAnonymousUserRequestOneOf1AppleUserFromJSONTyped(json, false);
2143
+ }
2144
+ function ConvertAnonymousUserRequestOneOf1AppleUserFromJSONTyped(json, ignoreDiscriminator) {
2145
+ if (json == null) {
2146
+ return json;
2147
+ }
2148
+ return {
2149
+ "name": json["name"] == null ? void 0 : ConvertAnonymousUserRequestOneOf1AppleUserNameFromJSON(json["name"])
2150
+ };
2151
+ }
2152
+ function ConvertAnonymousUserRequestOneOf1AppleUserToJSON(json) {
2153
+ return ConvertAnonymousUserRequestOneOf1AppleUserToJSONTyped(json, false);
2154
+ }
2155
+ function ConvertAnonymousUserRequestOneOf1AppleUserToJSONTyped(value, ignoreDiscriminator = false) {
2156
+ if (value == null) {
2157
+ return value;
2158
+ }
2159
+ return {
2160
+ "name": ConvertAnonymousUserRequestOneOf1AppleUserNameToJSON(value["name"])
2161
+ };
2162
+ }
2163
+
2164
+ // src/src/models/ConvertAnonymousUserRequestOneOf1.ts
2165
+ var ConvertAnonymousUserRequestOneOf1MethodEnum = {
2166
+ OAUTH: "oauth"
2167
+ };
2168
+ function instanceOfConvertAnonymousUserRequestOneOf1(value) {
2169
+ if (!("method" in value) || value["method"] === void 0) return false;
2170
+ if (!("code" in value) || value["code"] === void 0) return false;
2171
+ if (!("state" in value) || value["state"] === void 0) return false;
2172
+ return true;
2173
+ }
2174
+ function ConvertAnonymousUserRequestOneOf1FromJSON(json) {
2175
+ return ConvertAnonymousUserRequestOneOf1FromJSONTyped(json, false);
2176
+ }
2177
+ function ConvertAnonymousUserRequestOneOf1FromJSONTyped(json, ignoreDiscriminator) {
2178
+ if (json == null) {
2179
+ return json;
2180
+ }
2181
+ return {
2182
+ "method": json["method"],
2183
+ "code": json["code"],
2184
+ "state": json["state"],
2185
+ "appleUser": json["apple_user"] == null ? void 0 : ConvertAnonymousUserRequestOneOf1AppleUserFromJSON(json["apple_user"])
2186
+ };
2187
+ }
2188
+ function ConvertAnonymousUserRequestOneOf1ToJSON(json) {
2189
+ return ConvertAnonymousUserRequestOneOf1ToJSONTyped(json, false);
2190
+ }
2191
+ function ConvertAnonymousUserRequestOneOf1ToJSONTyped(value, ignoreDiscriminator = false) {
2192
+ if (value == null) {
2193
+ return value;
2194
+ }
2195
+ return {
2196
+ "method": value["method"],
2197
+ "code": value["code"],
2198
+ "state": value["state"],
2199
+ "apple_user": ConvertAnonymousUserRequestOneOf1AppleUserToJSON(value["appleUser"])
2200
+ };
2201
+ }
2202
+
2203
+ // src/src/models/ConvertAnonymousUserRequest.ts
2204
+ function ConvertAnonymousUserRequestFromJSON(json) {
2205
+ return ConvertAnonymousUserRequestFromJSONTyped(json, false);
2206
+ }
2207
+ function ConvertAnonymousUserRequestFromJSONTyped(json, ignoreDiscriminator) {
2208
+ if (json == null) {
2209
+ return json;
2210
+ }
2211
+ if (instanceOfConvertAnonymousUserRequestOneOf(json)) {
2212
+ return ConvertAnonymousUserRequestOneOfFromJSONTyped(json, true);
2213
+ }
2214
+ if (instanceOfConvertAnonymousUserRequestOneOf1(json)) {
2215
+ return ConvertAnonymousUserRequestOneOf1FromJSONTyped(json, true);
2216
+ }
2217
+ return {};
2218
+ }
2219
+ function ConvertAnonymousUserRequestToJSON(json) {
2220
+ return ConvertAnonymousUserRequestToJSONTyped(json, false);
2221
+ }
2222
+ function ConvertAnonymousUserRequestToJSONTyped(value, ignoreDiscriminator = false) {
2223
+ if (value == null) {
2224
+ return value;
2225
+ }
2226
+ if (instanceOfConvertAnonymousUserRequestOneOf(value)) {
2227
+ return ConvertAnonymousUserRequestOneOfToJSON(value);
2228
+ }
2229
+ if (instanceOfConvertAnonymousUserRequestOneOf1(value)) {
2230
+ return ConvertAnonymousUserRequestOneOf1ToJSON(value);
2231
+ }
2232
+ return {};
2233
+ }
2234
+
2063
2235
  // src/src/models/CreateCategoryRequest.ts
2064
2236
  function instanceOfCreateCategoryRequest(value) {
2065
2237
  if (!("name" in value) || value["name"] === void 0) return false;
@@ -8704,6 +8876,38 @@ function SetPreferencesRequestToJSONTyped(value, ignoreDiscriminator = false) {
8704
8876
  };
8705
8877
  }
8706
8878
 
8879
+ // src/src/models/SignInAnonymouslyRequest.ts
8880
+ function instanceOfSignInAnonymouslyRequest(value) {
8881
+ if (!("deviceId" in value) || value["deviceId"] === void 0) return false;
8882
+ return true;
8883
+ }
8884
+ function SignInAnonymouslyRequestFromJSON(json) {
8885
+ return SignInAnonymouslyRequestFromJSONTyped(json, false);
8886
+ }
8887
+ function SignInAnonymouslyRequestFromJSONTyped(json, ignoreDiscriminator) {
8888
+ if (json == null) {
8889
+ return json;
8890
+ }
8891
+ return {
8892
+ "deviceId": json["device_id"],
8893
+ "name": json["name"] == null ? void 0 : json["name"],
8894
+ "metadata": json["metadata"] == null ? void 0 : json["metadata"]
8895
+ };
8896
+ }
8897
+ function SignInAnonymouslyRequestToJSON(json) {
8898
+ return SignInAnonymouslyRequestToJSONTyped(json, false);
8899
+ }
8900
+ function SignInAnonymouslyRequestToJSONTyped(value, ignoreDiscriminator = false) {
8901
+ if (value == null) {
8902
+ return value;
8903
+ }
8904
+ return {
8905
+ "device_id": value["deviceId"],
8906
+ "name": value["name"],
8907
+ "metadata": value["metadata"]
8908
+ };
8909
+ }
8910
+
8707
8911
  // src/src/models/SlackMessage.ts
8708
8912
  function instanceOfSlackMessage(value) {
8709
8913
  return true;
@@ -14085,6 +14289,37 @@ var AuthPhoneApi = class extends BaseAPI {
14085
14289
 
14086
14290
  // src/src/apis/AuthRegistrationApi.ts
14087
14291
  var AuthRegistrationApi = class extends BaseAPI {
14292
+ /**
14293
+ * Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
14294
+ * Convert anonymous account to a full account
14295
+ */
14296
+ async convertAnonymousUserRaw(requestParameters, initOverrides) {
14297
+ if (requestParameters["convertAnonymousUserRequest"] == null) {
14298
+ throw new RequiredError(
14299
+ "convertAnonymousUserRequest",
14300
+ 'Required parameter "convertAnonymousUserRequest" was null or undefined when calling convertAnonymousUser().'
14301
+ );
14302
+ }
14303
+ const queryParameters = {};
14304
+ const headerParameters = {};
14305
+ headerParameters["Content-Type"] = "application/json";
14306
+ const response = await this.request({
14307
+ path: `/auth/users/convert`,
14308
+ method: "POST",
14309
+ headers: headerParameters,
14310
+ query: queryParameters,
14311
+ body: ConvertAnonymousUserRequestToJSON(requestParameters["convertAnonymousUserRequest"])
14312
+ }, initOverrides);
14313
+ return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
14314
+ }
14315
+ /**
14316
+ * Upgrade the calling anonymous user to a full email+password account in place. The end_user.id is preserved, so customer-domain tables with foreign keys to end_users.id need no migration on conversion. All prior sessions for the user (including the anonymous token used to make this call) are revoked. A fresh token pair is returned in the response body. The conversion is the moment the user becomes billable -- MAU is tracked from this point forward.
14317
+ * Convert anonymous account to a full account
14318
+ */
14319
+ async convertAnonymousUser(convertAnonymousUserRequest, initOverrides) {
14320
+ const response = await this.convertAnonymousUserRaw({ convertAnonymousUserRequest }, initOverrides);
14321
+ return await response.value();
14322
+ }
14088
14323
  /**
14089
14324
  * Register a new end user with email and password.
14090
14325
  * Register a new end user
@@ -14122,6 +14357,40 @@ var AuthRegistrationApi = class extends BaseAPI {
14122
14357
  const response = await this.registerEndUserRaw({ registerRequest }, initOverrides);
14123
14358
  return await response.value();
14124
14359
  }
14360
+ /**
14361
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
14362
+ * Sign in anonymously
14363
+ */
14364
+ async signInAnonymouslyRaw(requestParameters, initOverrides) {
14365
+ if (requestParameters["signInAnonymouslyRequest"] == null) {
14366
+ throw new RequiredError(
14367
+ "signInAnonymouslyRequest",
14368
+ 'Required parameter "signInAnonymouslyRequest" was null or undefined when calling signInAnonymously().'
14369
+ );
14370
+ }
14371
+ const queryParameters = {};
14372
+ const headerParameters = {};
14373
+ headerParameters["Content-Type"] = "application/json";
14374
+ if (this.configuration && this.configuration.apiKey) {
14375
+ headerParameters["X-Application-Key"] = await this.configuration.apiKey("X-Application-Key");
14376
+ }
14377
+ const response = await this.request({
14378
+ path: `/auth/users/anonymous`,
14379
+ method: "POST",
14380
+ headers: headerParameters,
14381
+ query: queryParameters,
14382
+ body: SignInAnonymouslyRequestToJSON(requestParameters["signInAnonymouslyRequest"])
14383
+ }, initOverrides);
14384
+ return new JSONApiResponse(response, (jsonValue) => AuthResultResponseFromJSON(jsonValue));
14385
+ }
14386
+ /**
14387
+ * Issue an end-user identity to a device without email, password, OAuth, or any other credential. Idempotent per (application, environment, device_id): repeated calls with the same device_id return the same user but a fresh token pair. Prior sessions for the user remain valid until natural expiry. Anonymous users do not count toward MAU quota until their first authenticated request after sign-in (excluding /v1/auth/refresh). Convert an anonymous user to a full account via POST /v1/auth/users/convert.
14388
+ * Sign in anonymously
14389
+ */
14390
+ async signInAnonymously(signInAnonymouslyRequest, initOverrides) {
14391
+ const response = await this.signInAnonymouslyRaw({ signInAnonymouslyRequest }, initOverrides);
14392
+ return await response.value();
14393
+ }
14125
14394
  };
14126
14395
 
14127
14396
  // src/src/apis/AuthSessionsApi.ts
@@ -20198,6 +20467,28 @@ export {
20198
20467
  ConsentWithdrawResponseFromJSONTyped,
20199
20468
  ConsentWithdrawResponseToJSON,
20200
20469
  ConsentWithdrawResponseToJSONTyped,
20470
+ ConvertAnonymousUserRequestFromJSON,
20471
+ ConvertAnonymousUserRequestFromJSONTyped,
20472
+ ConvertAnonymousUserRequestOneOf1AppleUserFromJSON,
20473
+ ConvertAnonymousUserRequestOneOf1AppleUserFromJSONTyped,
20474
+ ConvertAnonymousUserRequestOneOf1AppleUserNameFromJSON,
20475
+ ConvertAnonymousUserRequestOneOf1AppleUserNameFromJSONTyped,
20476
+ ConvertAnonymousUserRequestOneOf1AppleUserNameToJSON,
20477
+ ConvertAnonymousUserRequestOneOf1AppleUserNameToJSONTyped,
20478
+ ConvertAnonymousUserRequestOneOf1AppleUserToJSON,
20479
+ ConvertAnonymousUserRequestOneOf1AppleUserToJSONTyped,
20480
+ ConvertAnonymousUserRequestOneOf1FromJSON,
20481
+ ConvertAnonymousUserRequestOneOf1FromJSONTyped,
20482
+ ConvertAnonymousUserRequestOneOf1MethodEnum,
20483
+ ConvertAnonymousUserRequestOneOf1ToJSON,
20484
+ ConvertAnonymousUserRequestOneOf1ToJSONTyped,
20485
+ ConvertAnonymousUserRequestOneOfFromJSON,
20486
+ ConvertAnonymousUserRequestOneOfFromJSONTyped,
20487
+ ConvertAnonymousUserRequestOneOfMethodEnum,
20488
+ ConvertAnonymousUserRequestOneOfToJSON,
20489
+ ConvertAnonymousUserRequestOneOfToJSONTyped,
20490
+ ConvertAnonymousUserRequestToJSON,
20491
+ ConvertAnonymousUserRequestToJSONTyped,
20201
20492
  CreateCategoryRequestFromJSON,
20202
20493
  CreateCategoryRequestFromJSONTyped,
20203
20494
  CreateCategoryRequestToJSON,
@@ -20986,6 +21277,10 @@ export {
20986
21277
  SetPreferencesRequestPreferencesInnerToJSONTyped,
20987
21278
  SetPreferencesRequestToJSON,
20988
21279
  SetPreferencesRequestToJSONTyped,
21280
+ SignInAnonymouslyRequestFromJSON,
21281
+ SignInAnonymouslyRequestFromJSONTyped,
21282
+ SignInAnonymouslyRequestToJSON,
21283
+ SignInAnonymouslyRequestToJSONTyped,
20989
21284
  SlackApi,
20990
21285
  SlackMessageFromJSON,
20991
21286
  SlackMessageFromJSONTyped,
@@ -21632,6 +21927,10 @@ export {
21632
21927
  instanceOfConsentStatus,
21633
21928
  instanceOfConsentStatusResponse,
21634
21929
  instanceOfConsentWithdrawResponse,
21930
+ instanceOfConvertAnonymousUserRequestOneOf,
21931
+ instanceOfConvertAnonymousUserRequestOneOf1,
21932
+ instanceOfConvertAnonymousUserRequestOneOf1AppleUser,
21933
+ instanceOfConvertAnonymousUserRequestOneOf1AppleUserName,
21635
21934
  instanceOfCreateCategoryRequest,
21636
21935
  instanceOfCreateSubscriberRequest,
21637
21936
  instanceOfCreateTemplateRequest,
@@ -21819,6 +22118,7 @@ export {
21819
22118
  instanceOfSessionListResponseDataSessionInfo,
21820
22119
  instanceOfSetPreferencesRequest,
21821
22120
  instanceOfSetPreferencesRequestPreferencesInner,
22121
+ instanceOfSignInAnonymouslyRequest,
21822
22122
  instanceOfSlackMessage,
21823
22123
  instanceOfSlackMessageListResponse,
21824
22124
  instanceOfSlackMessageListResponseMeta,