@layr-labs/ecloud-sdk 0.1.0 → 0.1.1-dev
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/VERSION +2 -2
- package/dist/billing.cjs +20 -1
- package/dist/billing.cjs.map +1 -1
- package/dist/billing.d.cts +2 -1
- package/dist/billing.d.ts +2 -1
- package/dist/billing.js +2 -2
- package/dist/chunk-2R7M3OXI.js +434 -0
- package/dist/chunk-2R7M3OXI.js.map +1 -0
- package/dist/{chunk-NO27MWK4.js → chunk-AXSYVG7H.js} +3 -3
- package/dist/{chunk-NO27MWK4.js.map → chunk-AXSYVG7H.js.map} +1 -1
- package/dist/{chunk-ACQAXLSF.js → chunk-X4Y6OOUS.js} +2 -2
- package/dist/compute.cjs +2 -2
- package/dist/compute.cjs.map +1 -1
- package/dist/compute.js +2 -2
- package/dist/index.cjs +97 -95
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -243
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4ITAKIMY.js +0 -180
- package/dist/chunk-4ITAKIMY.js.map +0 -1
- /package/dist/{chunk-ACQAXLSF.js.map → chunk-X4Y6OOUS.js.map} +0 -0
package/dist/compute.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -206,7 +206,7 @@ function getBillingEnvironmentConfig(build) {
|
|
|
206
206
|
return config;
|
|
207
207
|
}
|
|
208
208
|
function getBuildType() {
|
|
209
|
-
const buildTimeType = true ? "
|
|
209
|
+
const buildTimeType = true ? "dev"?.toLowerCase() : void 0;
|
|
210
210
|
const runtimeType = process.env.BUILD_TYPE?.toLowerCase();
|
|
211
211
|
const buildType = buildTimeType || runtimeType;
|
|
212
212
|
if (buildType === "dev") {
|
|
@@ -2525,7 +2525,7 @@ var CanViewAppLogsPermission = "0x2fd3f2fe";
|
|
|
2525
2525
|
var CanViewSensitiveAppInfoPermission = "0x0e67b22f";
|
|
2526
2526
|
var CanUpdateAppProfilePermission = "0x036fef61";
|
|
2527
2527
|
function getDefaultClientId() {
|
|
2528
|
-
const version = true ? "0.1.
|
|
2528
|
+
const version = true ? "0.1.1-dev" : "0.0.0";
|
|
2529
2529
|
return `ecloud-sdk/v${version}`;
|
|
2530
2530
|
}
|
|
2531
2531
|
var UserApiClient = class {
|
|
@@ -7026,99 +7026,6 @@ Please check:
|
|
|
7026
7026
|
}
|
|
7027
7027
|
};
|
|
7028
7028
|
|
|
7029
|
-
// src/client/modules/billing/index.ts
|
|
7030
|
-
function createBillingModule(config) {
|
|
7031
|
-
const { verbose = false, skipTelemetry = false } = config;
|
|
7032
|
-
const privateKey = addHexPrefix(config.privateKey);
|
|
7033
|
-
const logger = getLogger(verbose);
|
|
7034
|
-
const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
|
|
7035
|
-
const billingApi = new BillingApiClient(billingEnvConfig, privateKey);
|
|
7036
|
-
return {
|
|
7037
|
-
async subscribe(opts) {
|
|
7038
|
-
return withSDKTelemetry(
|
|
7039
|
-
{
|
|
7040
|
-
functionName: "subscribe",
|
|
7041
|
-
skipTelemetry,
|
|
7042
|
-
// Skip if called from CLI
|
|
7043
|
-
properties: { productId: opts?.productId || "compute" }
|
|
7044
|
-
},
|
|
7045
|
-
async () => {
|
|
7046
|
-
const productId = opts?.productId || "compute";
|
|
7047
|
-
logger.debug(`Checking existing subscription for ${productId}...`);
|
|
7048
|
-
const currentStatus = await billingApi.getSubscription(productId);
|
|
7049
|
-
if (isSubscriptionActive(currentStatus.subscriptionStatus)) {
|
|
7050
|
-
logger.debug(`Subscription already active: ${currentStatus.subscriptionStatus}`);
|
|
7051
|
-
return {
|
|
7052
|
-
type: "already_active",
|
|
7053
|
-
status: currentStatus.subscriptionStatus
|
|
7054
|
-
};
|
|
7055
|
-
}
|
|
7056
|
-
if (currentStatus.subscriptionStatus === "past_due" || currentStatus.subscriptionStatus === "unpaid") {
|
|
7057
|
-
logger.debug(`Subscription has payment issue: ${currentStatus.subscriptionStatus}`);
|
|
7058
|
-
return {
|
|
7059
|
-
type: "payment_issue",
|
|
7060
|
-
status: currentStatus.subscriptionStatus,
|
|
7061
|
-
portalUrl: currentStatus.portalUrl
|
|
7062
|
-
};
|
|
7063
|
-
}
|
|
7064
|
-
logger.debug(`Creating subscription for ${productId}...`);
|
|
7065
|
-
const result = await billingApi.createSubscription(productId);
|
|
7066
|
-
logger.debug(`Checkout URL: ${result.checkoutUrl}`);
|
|
7067
|
-
return {
|
|
7068
|
-
type: "checkout_created",
|
|
7069
|
-
checkoutUrl: result.checkoutUrl
|
|
7070
|
-
};
|
|
7071
|
-
}
|
|
7072
|
-
);
|
|
7073
|
-
},
|
|
7074
|
-
async getStatus(opts) {
|
|
7075
|
-
return withSDKTelemetry(
|
|
7076
|
-
{
|
|
7077
|
-
functionName: "getStatus",
|
|
7078
|
-
skipTelemetry,
|
|
7079
|
-
// Skip if called from CLI
|
|
7080
|
-
properties: { productId: opts?.productId || "compute" }
|
|
7081
|
-
},
|
|
7082
|
-
async () => {
|
|
7083
|
-
const productId = opts?.productId || "compute";
|
|
7084
|
-
logger.debug(`Fetching subscription status for ${productId}...`);
|
|
7085
|
-
const result = await billingApi.getSubscription(productId);
|
|
7086
|
-
logger.debug(`Subscription status: ${result.subscriptionStatus}`);
|
|
7087
|
-
return result;
|
|
7088
|
-
}
|
|
7089
|
-
);
|
|
7090
|
-
},
|
|
7091
|
-
async cancel(opts) {
|
|
7092
|
-
return withSDKTelemetry(
|
|
7093
|
-
{
|
|
7094
|
-
functionName: "cancel",
|
|
7095
|
-
skipTelemetry,
|
|
7096
|
-
// Skip if called from CLI
|
|
7097
|
-
properties: { productId: opts?.productId || "compute" }
|
|
7098
|
-
},
|
|
7099
|
-
async () => {
|
|
7100
|
-
const productId = opts?.productId || "compute";
|
|
7101
|
-
logger.debug(`Checking subscription status for ${productId}...`);
|
|
7102
|
-
const currentStatus = await billingApi.getSubscription(productId);
|
|
7103
|
-
if (!isSubscriptionActive(currentStatus.subscriptionStatus)) {
|
|
7104
|
-
logger.debug(`No active subscription to cancel: ${currentStatus.subscriptionStatus}`);
|
|
7105
|
-
return {
|
|
7106
|
-
type: "no_active_subscription",
|
|
7107
|
-
status: currentStatus.subscriptionStatus
|
|
7108
|
-
};
|
|
7109
|
-
}
|
|
7110
|
-
logger.debug(`Canceling subscription for ${productId}...`);
|
|
7111
|
-
await billingApi.cancelSubscription(productId);
|
|
7112
|
-
logger.debug(`Subscription canceled successfully`);
|
|
7113
|
-
return {
|
|
7114
|
-
type: "canceled"
|
|
7115
|
-
};
|
|
7116
|
-
}
|
|
7117
|
-
);
|
|
7118
|
-
}
|
|
7119
|
-
};
|
|
7120
|
-
}
|
|
7121
|
-
|
|
7122
7029
|
// src/client/common/auth/keyring.ts
|
|
7123
7030
|
var import_keyring = require("@napi-rs/keyring");
|
|
7124
7031
|
var import_accounts6 = require("viem/accounts");
|
|
@@ -7358,6 +7265,101 @@ function generateNewPrivateKey() {
|
|
|
7358
7265
|
};
|
|
7359
7266
|
}
|
|
7360
7267
|
|
|
7268
|
+
// src/client/modules/billing/index.ts
|
|
7269
|
+
function createBillingModule(config) {
|
|
7270
|
+
const { verbose = false, skipTelemetry = false } = config;
|
|
7271
|
+
const privateKey = addHexPrefix(config.privateKey);
|
|
7272
|
+
const address = getAddressFromPrivateKey(privateKey);
|
|
7273
|
+
const logger = getLogger(verbose);
|
|
7274
|
+
const billingEnvConfig = getBillingEnvironmentConfig(getBuildType());
|
|
7275
|
+
const billingApi = new BillingApiClient(billingEnvConfig, privateKey);
|
|
7276
|
+
return {
|
|
7277
|
+
address,
|
|
7278
|
+
async subscribe(opts) {
|
|
7279
|
+
return withSDKTelemetry(
|
|
7280
|
+
{
|
|
7281
|
+
functionName: "subscribe",
|
|
7282
|
+
skipTelemetry,
|
|
7283
|
+
// Skip if called from CLI
|
|
7284
|
+
properties: { productId: opts?.productId || "compute" }
|
|
7285
|
+
},
|
|
7286
|
+
async () => {
|
|
7287
|
+
const productId = opts?.productId || "compute";
|
|
7288
|
+
logger.debug(`Checking existing subscription for ${productId}...`);
|
|
7289
|
+
const currentStatus = await billingApi.getSubscription(productId);
|
|
7290
|
+
if (isSubscriptionActive(currentStatus.subscriptionStatus)) {
|
|
7291
|
+
logger.debug(`Subscription already active: ${currentStatus.subscriptionStatus}`);
|
|
7292
|
+
return {
|
|
7293
|
+
type: "already_active",
|
|
7294
|
+
status: currentStatus.subscriptionStatus
|
|
7295
|
+
};
|
|
7296
|
+
}
|
|
7297
|
+
if (currentStatus.subscriptionStatus === "past_due" || currentStatus.subscriptionStatus === "unpaid") {
|
|
7298
|
+
logger.debug(`Subscription has payment issue: ${currentStatus.subscriptionStatus}`);
|
|
7299
|
+
return {
|
|
7300
|
+
type: "payment_issue",
|
|
7301
|
+
status: currentStatus.subscriptionStatus,
|
|
7302
|
+
portalUrl: currentStatus.portalUrl
|
|
7303
|
+
};
|
|
7304
|
+
}
|
|
7305
|
+
logger.debug(`Creating subscription for ${productId}...`);
|
|
7306
|
+
const result = await billingApi.createSubscription(productId);
|
|
7307
|
+
logger.debug(`Checkout URL: ${result.checkoutUrl}`);
|
|
7308
|
+
return {
|
|
7309
|
+
type: "checkout_created",
|
|
7310
|
+
checkoutUrl: result.checkoutUrl
|
|
7311
|
+
};
|
|
7312
|
+
}
|
|
7313
|
+
);
|
|
7314
|
+
},
|
|
7315
|
+
async getStatus(opts) {
|
|
7316
|
+
return withSDKTelemetry(
|
|
7317
|
+
{
|
|
7318
|
+
functionName: "getStatus",
|
|
7319
|
+
skipTelemetry,
|
|
7320
|
+
// Skip if called from CLI
|
|
7321
|
+
properties: { productId: opts?.productId || "compute" }
|
|
7322
|
+
},
|
|
7323
|
+
async () => {
|
|
7324
|
+
const productId = opts?.productId || "compute";
|
|
7325
|
+
logger.debug(`Fetching subscription status for ${productId}...`);
|
|
7326
|
+
const result = await billingApi.getSubscription(productId);
|
|
7327
|
+
logger.debug(`Subscription status: ${result.subscriptionStatus}`);
|
|
7328
|
+
return result;
|
|
7329
|
+
}
|
|
7330
|
+
);
|
|
7331
|
+
},
|
|
7332
|
+
async cancel(opts) {
|
|
7333
|
+
return withSDKTelemetry(
|
|
7334
|
+
{
|
|
7335
|
+
functionName: "cancel",
|
|
7336
|
+
skipTelemetry,
|
|
7337
|
+
// Skip if called from CLI
|
|
7338
|
+
properties: { productId: opts?.productId || "compute" }
|
|
7339
|
+
},
|
|
7340
|
+
async () => {
|
|
7341
|
+
const productId = opts?.productId || "compute";
|
|
7342
|
+
logger.debug(`Checking subscription status for ${productId}...`);
|
|
7343
|
+
const currentStatus = await billingApi.getSubscription(productId);
|
|
7344
|
+
if (!isSubscriptionActive(currentStatus.subscriptionStatus)) {
|
|
7345
|
+
logger.debug(`No active subscription to cancel: ${currentStatus.subscriptionStatus}`);
|
|
7346
|
+
return {
|
|
7347
|
+
type: "no_active_subscription",
|
|
7348
|
+
status: currentStatus.subscriptionStatus
|
|
7349
|
+
};
|
|
7350
|
+
}
|
|
7351
|
+
logger.debug(`Canceling subscription for ${productId}...`);
|
|
7352
|
+
await billingApi.cancelSubscription(productId);
|
|
7353
|
+
logger.debug(`Subscription canceled successfully`);
|
|
7354
|
+
return {
|
|
7355
|
+
type: "canceled"
|
|
7356
|
+
};
|
|
7357
|
+
}
|
|
7358
|
+
);
|
|
7359
|
+
}
|
|
7360
|
+
};
|
|
7361
|
+
}
|
|
7362
|
+
|
|
7361
7363
|
// src/client/common/utils/instance.ts
|
|
7362
7364
|
async function getCurrentInstanceType(preflightCtx, appID, logger, clientId) {
|
|
7363
7365
|
try {
|