@base44-preview/cli 0.0.32-pr.258.b5ecff3 → 0.0.32-pr.259.1042e3a
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/LICENSE +21 -0
- package/dist/cli/index.js +293 -5
- package/dist/cli/index.js.map +14 -5
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 base44
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cli/index.js
CHANGED
|
@@ -185505,6 +185505,118 @@ async function pushEntities(entities) {
|
|
|
185505
185505
|
}
|
|
185506
185506
|
return syncEntities(entities);
|
|
185507
185507
|
}
|
|
185508
|
+
// src/core/resources/entity/records-schema.ts
|
|
185509
|
+
var EntityRecordSchema = exports_external.object({
|
|
185510
|
+
id: exports_external.string(),
|
|
185511
|
+
created_date: exports_external.string(),
|
|
185512
|
+
updated_date: exports_external.string(),
|
|
185513
|
+
created_by: exports_external.string().optional()
|
|
185514
|
+
}).passthrough();
|
|
185515
|
+
var DeleteRecordResponseSchema = exports_external.object({
|
|
185516
|
+
success: exports_external.boolean()
|
|
185517
|
+
});
|
|
185518
|
+
|
|
185519
|
+
// src/core/resources/entity/records-api.ts
|
|
185520
|
+
async function listRecords(entityName, options = {}) {
|
|
185521
|
+
const appClient = getAppClient();
|
|
185522
|
+
const searchParams = new URLSearchParams;
|
|
185523
|
+
if (options.filter) {
|
|
185524
|
+
searchParams.set("q", options.filter);
|
|
185525
|
+
}
|
|
185526
|
+
if (options.sort) {
|
|
185527
|
+
searchParams.set("sort", options.sort);
|
|
185528
|
+
}
|
|
185529
|
+
if (options.limit !== undefined) {
|
|
185530
|
+
searchParams.set("limit", String(options.limit));
|
|
185531
|
+
}
|
|
185532
|
+
if (options.skip !== undefined) {
|
|
185533
|
+
searchParams.set("skip", String(options.skip));
|
|
185534
|
+
}
|
|
185535
|
+
if (options.fields) {
|
|
185536
|
+
searchParams.set("fields", options.fields);
|
|
185537
|
+
}
|
|
185538
|
+
let response;
|
|
185539
|
+
try {
|
|
185540
|
+
response = await appClient.get(`admin/entities/${entityName}`, {
|
|
185541
|
+
searchParams
|
|
185542
|
+
});
|
|
185543
|
+
} catch (error48) {
|
|
185544
|
+
throw await ApiError.fromHttpError(error48, "listing records");
|
|
185545
|
+
}
|
|
185546
|
+
const json2 = await response.json();
|
|
185547
|
+
const records = Array.isArray(json2) ? json2 : [];
|
|
185548
|
+
return records.map((record2) => {
|
|
185549
|
+
const result = EntityRecordSchema.safeParse(record2);
|
|
185550
|
+
if (!result.success) {
|
|
185551
|
+
throw new SchemaValidationError("Invalid record in response", result.error);
|
|
185552
|
+
}
|
|
185553
|
+
return result.data;
|
|
185554
|
+
});
|
|
185555
|
+
}
|
|
185556
|
+
async function getRecord(entityName, recordId) {
|
|
185557
|
+
const appClient = getAppClient();
|
|
185558
|
+
let response;
|
|
185559
|
+
try {
|
|
185560
|
+
response = await appClient.get(`admin/entities/${entityName}/${recordId}`);
|
|
185561
|
+
} catch (error48) {
|
|
185562
|
+
throw await ApiError.fromHttpError(error48, "getting record");
|
|
185563
|
+
}
|
|
185564
|
+
const json2 = await response.json();
|
|
185565
|
+
const result = EntityRecordSchema.safeParse(json2);
|
|
185566
|
+
if (!result.success) {
|
|
185567
|
+
throw new SchemaValidationError("Invalid record response", result.error);
|
|
185568
|
+
}
|
|
185569
|
+
return result.data;
|
|
185570
|
+
}
|
|
185571
|
+
async function createRecord(entityName, data) {
|
|
185572
|
+
const appClient = getAppClient();
|
|
185573
|
+
let response;
|
|
185574
|
+
try {
|
|
185575
|
+
response = await appClient.post(`admin/entities/${entityName}`, {
|
|
185576
|
+
json: data
|
|
185577
|
+
});
|
|
185578
|
+
} catch (error48) {
|
|
185579
|
+
throw await ApiError.fromHttpError(error48, "creating record");
|
|
185580
|
+
}
|
|
185581
|
+
const json2 = await response.json();
|
|
185582
|
+
const result = EntityRecordSchema.safeParse(json2);
|
|
185583
|
+
if (!result.success) {
|
|
185584
|
+
throw new SchemaValidationError("Invalid record in create response", result.error);
|
|
185585
|
+
}
|
|
185586
|
+
return result.data;
|
|
185587
|
+
}
|
|
185588
|
+
async function updateRecord(entityName, recordId, data) {
|
|
185589
|
+
const appClient = getAppClient();
|
|
185590
|
+
let response;
|
|
185591
|
+
try {
|
|
185592
|
+
response = await appClient.put(`admin/entities/${entityName}/${recordId}`, {
|
|
185593
|
+
json: data
|
|
185594
|
+
});
|
|
185595
|
+
} catch (error48) {
|
|
185596
|
+
throw await ApiError.fromHttpError(error48, "updating record");
|
|
185597
|
+
}
|
|
185598
|
+
const json2 = await response.json();
|
|
185599
|
+
const result = EntityRecordSchema.safeParse(json2);
|
|
185600
|
+
if (!result.success) {
|
|
185601
|
+
throw new SchemaValidationError("Invalid record in update response", result.error);
|
|
185602
|
+
}
|
|
185603
|
+
return result.data;
|
|
185604
|
+
}
|
|
185605
|
+
async function deleteRecord(entityName, recordId) {
|
|
185606
|
+
const appClient = getAppClient();
|
|
185607
|
+
let response;
|
|
185608
|
+
try {
|
|
185609
|
+
response = await appClient.delete(`admin/entities/${entityName}/${recordId}`);
|
|
185610
|
+
} catch (error48) {
|
|
185611
|
+
throw await ApiError.fromHttpError(error48, "deleting record");
|
|
185612
|
+
}
|
|
185613
|
+
const json2 = await response.json();
|
|
185614
|
+
const result = DeleteRecordResponseSchema.safeParse(json2);
|
|
185615
|
+
if (!result.success) {
|
|
185616
|
+
throw new SchemaValidationError("Invalid delete response", result.error);
|
|
185617
|
+
}
|
|
185618
|
+
return result.data;
|
|
185619
|
+
}
|
|
185508
185620
|
// src/core/resources/entity/resource.ts
|
|
185509
185621
|
var entityResource = {
|
|
185510
185622
|
readAll: readAllEntities,
|
|
@@ -193466,7 +193578,7 @@ var package_default = {
|
|
|
193466
193578
|
"command-line"
|
|
193467
193579
|
],
|
|
193468
193580
|
author: "",
|
|
193469
|
-
license: "
|
|
193581
|
+
license: "MIT",
|
|
193470
193582
|
repository: {
|
|
193471
193583
|
type: "git",
|
|
193472
193584
|
url: "https://github.com/base44/cli"
|
|
@@ -194574,9 +194686,185 @@ async function pushEntitiesAction() {
|
|
|
194574
194686
|
return { outroMessage: "Entities pushed to Base44" };
|
|
194575
194687
|
}
|
|
194576
194688
|
function getEntitiesPushCommand(context) {
|
|
194577
|
-
return new Command("
|
|
194689
|
+
return new Command("push").description("Push local entity schemas to Base44").action(async () => {
|
|
194578
194690
|
await runCommand(pushEntitiesAction, { requireAuth: true }, context);
|
|
194579
|
-
})
|
|
194691
|
+
});
|
|
194692
|
+
}
|
|
194693
|
+
|
|
194694
|
+
// src/cli/commands/entities/records/create.ts
|
|
194695
|
+
var import_json52 = __toESM(require_lib(), 1);
|
|
194696
|
+
async function parseRecordData(options) {
|
|
194697
|
+
if (options.data) {
|
|
194698
|
+
try {
|
|
194699
|
+
return import_json52.default.parse(options.data);
|
|
194700
|
+
} catch {
|
|
194701
|
+
throw new InvalidInputError("Invalid JSON in --data flag. Provide valid JSON.", {
|
|
194702
|
+
hints: [
|
|
194703
|
+
{
|
|
194704
|
+
message: `Example: --data '{"name": "John", "email": "john@example.com"}'`
|
|
194705
|
+
}
|
|
194706
|
+
]
|
|
194707
|
+
});
|
|
194708
|
+
}
|
|
194709
|
+
}
|
|
194710
|
+
if (options.file) {
|
|
194711
|
+
const content = await readTextFile(options.file);
|
|
194712
|
+
try {
|
|
194713
|
+
return import_json52.default.parse(content);
|
|
194714
|
+
} catch {
|
|
194715
|
+
throw new InvalidInputError(`Invalid JSON in file ${options.file}. Provide a valid JSON/JSONC file.`);
|
|
194716
|
+
}
|
|
194717
|
+
}
|
|
194718
|
+
throw new InvalidInputError("Provide record data with --data or --file flag", {
|
|
194719
|
+
hints: [
|
|
194720
|
+
{
|
|
194721
|
+
message: `Example: --data '{"name": "John"}' or --file record.json`
|
|
194722
|
+
}
|
|
194723
|
+
]
|
|
194724
|
+
});
|
|
194725
|
+
}
|
|
194726
|
+
async function createRecordAction(entityName, options) {
|
|
194727
|
+
const data = await parseRecordData(options);
|
|
194728
|
+
const record2 = await runTask(`Creating ${entityName} record...`, async () => {
|
|
194729
|
+
return await createRecord(entityName, data);
|
|
194730
|
+
}, {
|
|
194731
|
+
successMessage: `Created ${entityName} record`,
|
|
194732
|
+
errorMessage: `Failed to create ${entityName} record`
|
|
194733
|
+
});
|
|
194734
|
+
M2.success(`Record created with ID: ${record2.id}`);
|
|
194735
|
+
console.log(JSON.stringify(record2, null, 2));
|
|
194736
|
+
return {};
|
|
194737
|
+
}
|
|
194738
|
+
function getRecordsCreateCommand(context) {
|
|
194739
|
+
return new Command("create").description("Create a new entity record").argument("<entity-name>", "Name of the entity (e.g. Users, Products)").option("-d, --data <json>", "JSON object with record data").option("--file <path>", "Read record data from a JSON/JSONC file").action(async (entityName, options) => {
|
|
194740
|
+
await runCommand(() => createRecordAction(entityName, options), { requireAuth: true }, context);
|
|
194741
|
+
});
|
|
194742
|
+
}
|
|
194743
|
+
|
|
194744
|
+
// src/cli/commands/entities/records/delete.ts
|
|
194745
|
+
async function deleteRecordAction(entityName, recordId, options) {
|
|
194746
|
+
if (!options.yes) {
|
|
194747
|
+
const confirmed = await ye({
|
|
194748
|
+
message: `Delete ${entityName} record ${recordId}?`
|
|
194749
|
+
});
|
|
194750
|
+
if (confirmed !== true) {
|
|
194751
|
+
throw new CLIExitError(0);
|
|
194752
|
+
}
|
|
194753
|
+
}
|
|
194754
|
+
await runTask(`Deleting ${entityName} record...`, async () => {
|
|
194755
|
+
return await deleteRecord(entityName, recordId);
|
|
194756
|
+
}, {
|
|
194757
|
+
successMessage: `Deleted ${entityName} record`,
|
|
194758
|
+
errorMessage: `Failed to delete ${entityName} record`
|
|
194759
|
+
});
|
|
194760
|
+
M2.success(`Record ${recordId} deleted`);
|
|
194761
|
+
return {};
|
|
194762
|
+
}
|
|
194763
|
+
function getRecordsDeleteCommand(context) {
|
|
194764
|
+
return new Command("delete").description("Delete an entity record").argument("<entity-name>", "Name of the entity (e.g. Users, Products)").argument("<record-id>", "ID of the record to delete").option("-y, --yes", "Skip confirmation prompt").action(async (entityName, recordId, options) => {
|
|
194765
|
+
await runCommand(() => deleteRecordAction(entityName, recordId, options), { requireAuth: true }, context);
|
|
194766
|
+
});
|
|
194767
|
+
}
|
|
194768
|
+
|
|
194769
|
+
// src/cli/commands/entities/records/get.ts
|
|
194770
|
+
async function getRecordAction(entityName, recordId) {
|
|
194771
|
+
const record2 = await runTask(`Fetching ${entityName} record...`, async () => {
|
|
194772
|
+
return await getRecord(entityName, recordId);
|
|
194773
|
+
}, {
|
|
194774
|
+
successMessage: `Fetched ${entityName} record`,
|
|
194775
|
+
errorMessage: `Failed to fetch ${entityName} record`
|
|
194776
|
+
});
|
|
194777
|
+
console.log(JSON.stringify(record2, null, 2));
|
|
194778
|
+
return {};
|
|
194779
|
+
}
|
|
194780
|
+
function getRecordsGetCommand(context) {
|
|
194781
|
+
return new Command("get").description("Get a single entity record by ID").argument("<entity-name>", "Name of the entity (e.g. Users, Products)").argument("<record-id>", "ID of the record").action(async (entityName, recordId) => {
|
|
194782
|
+
await runCommand(() => getRecordAction(entityName, recordId), { requireAuth: true }, context);
|
|
194783
|
+
});
|
|
194784
|
+
}
|
|
194785
|
+
|
|
194786
|
+
// src/cli/commands/entities/records/list.ts
|
|
194787
|
+
async function listRecordsAction(entityName, options) {
|
|
194788
|
+
const records = await runTask(`Fetching ${entityName} records...`, async () => {
|
|
194789
|
+
return await listRecords(entityName, {
|
|
194790
|
+
filter: options.filter,
|
|
194791
|
+
sort: options.sort,
|
|
194792
|
+
limit: options.limit ? Number(options.limit) : 50,
|
|
194793
|
+
skip: options.skip ? Number(options.skip) : undefined,
|
|
194794
|
+
fields: options.fields
|
|
194795
|
+
});
|
|
194796
|
+
}, {
|
|
194797
|
+
successMessage: `Fetched ${entityName} records`,
|
|
194798
|
+
errorMessage: `Failed to fetch ${entityName} records`
|
|
194799
|
+
});
|
|
194800
|
+
M2.info(`Found ${records.length} record(s)`);
|
|
194801
|
+
console.log(JSON.stringify(records, null, 2));
|
|
194802
|
+
return {};
|
|
194803
|
+
}
|
|
194804
|
+
function getRecordsListCommand(context) {
|
|
194805
|
+
return new Command("list").description("List entity records").argument("<entity-name>", "Name of the entity (e.g. Users, Products)").option("-f, --filter <json>", "JSON query filter").option("-s, --sort <field>", "Sort field (prefix with - for descending)").option("-l, --limit <n>", "Max records to return", "50").option("--skip <n>", "Number of records to skip").option("--fields <fields>", "Comma-separated fields to return").action(async (entityName, options) => {
|
|
194806
|
+
await runCommand(() => listRecordsAction(entityName, options), { requireAuth: true }, context);
|
|
194807
|
+
});
|
|
194808
|
+
}
|
|
194809
|
+
|
|
194810
|
+
// src/cli/commands/entities/records/update.ts
|
|
194811
|
+
var import_json53 = __toESM(require_lib(), 1);
|
|
194812
|
+
async function parseUpdateData(options) {
|
|
194813
|
+
if (options.data) {
|
|
194814
|
+
try {
|
|
194815
|
+
return import_json53.default.parse(options.data);
|
|
194816
|
+
} catch {
|
|
194817
|
+
throw new InvalidInputError("Invalid JSON in --data flag. Provide valid JSON.", {
|
|
194818
|
+
hints: [
|
|
194819
|
+
{
|
|
194820
|
+
message: `Example: --data '{"status": "active"}'`
|
|
194821
|
+
}
|
|
194822
|
+
]
|
|
194823
|
+
});
|
|
194824
|
+
}
|
|
194825
|
+
}
|
|
194826
|
+
if (options.file) {
|
|
194827
|
+
const content = await readTextFile(options.file);
|
|
194828
|
+
try {
|
|
194829
|
+
return import_json53.default.parse(content);
|
|
194830
|
+
} catch {
|
|
194831
|
+
throw new InvalidInputError(`Invalid JSON in file ${options.file}. Provide a valid JSON/JSONC file.`);
|
|
194832
|
+
}
|
|
194833
|
+
}
|
|
194834
|
+
throw new InvalidInputError("Provide update data with --data or --file flag", {
|
|
194835
|
+
hints: [
|
|
194836
|
+
{
|
|
194837
|
+
message: `Example: --data '{"status": "active"}' or --file update.json`
|
|
194838
|
+
}
|
|
194839
|
+
]
|
|
194840
|
+
});
|
|
194841
|
+
}
|
|
194842
|
+
async function updateRecordAction(entityName, recordId, options) {
|
|
194843
|
+
const data = await parseUpdateData(options);
|
|
194844
|
+
const record2 = await runTask(`Updating ${entityName} record...`, async () => {
|
|
194845
|
+
return await updateRecord(entityName, recordId, data);
|
|
194846
|
+
}, {
|
|
194847
|
+
successMessage: `Updated ${entityName} record`,
|
|
194848
|
+
errorMessage: `Failed to update ${entityName} record`
|
|
194849
|
+
});
|
|
194850
|
+
M2.success(`Record ${recordId} updated`);
|
|
194851
|
+
console.log(JSON.stringify(record2, null, 2));
|
|
194852
|
+
return {};
|
|
194853
|
+
}
|
|
194854
|
+
function getRecordsUpdateCommand(context) {
|
|
194855
|
+
return new Command("update").description("Update an entity record").argument("<entity-name>", "Name of the entity (e.g. Users, Products)").argument("<record-id>", "ID of the record to update").option("-d, --data <json>", "JSON object with fields to update").option("--file <path>", "Read update data from a JSON/JSONC file").action(async (entityName, recordId, options) => {
|
|
194856
|
+
await runCommand(() => updateRecordAction(entityName, recordId, options), { requireAuth: true }, context);
|
|
194857
|
+
});
|
|
194858
|
+
}
|
|
194859
|
+
|
|
194860
|
+
// src/cli/commands/entities/records/index.ts
|
|
194861
|
+
function getRecordsCommand(context) {
|
|
194862
|
+
return new Command("records").description("CRUD operations on entity records").addCommand(getRecordsListCommand(context)).addCommand(getRecordsGetCommand(context)).addCommand(getRecordsCreateCommand(context)).addCommand(getRecordsUpdateCommand(context)).addCommand(getRecordsDeleteCommand(context));
|
|
194863
|
+
}
|
|
194864
|
+
|
|
194865
|
+
// src/cli/commands/entities/index.ts
|
|
194866
|
+
function getEntitiesCommand(context) {
|
|
194867
|
+
return new Command("entities").description("Manage project entities").addCommand(getEntitiesPushCommand(context)).addCommand(getRecordsCommand(context));
|
|
194580
194868
|
}
|
|
194581
194869
|
|
|
194582
194870
|
// src/cli/commands/functions/deploy.ts
|
|
@@ -195484,7 +195772,7 @@ function createProgram(context) {
|
|
|
195484
195772
|
program2.addCommand(getDeployCommand(context));
|
|
195485
195773
|
program2.addCommand(getLinkCommand(context));
|
|
195486
195774
|
program2.addCommand(getEjectCommand(context));
|
|
195487
|
-
program2.addCommand(
|
|
195775
|
+
program2.addCommand(getEntitiesCommand(context));
|
|
195488
195776
|
program2.addCommand(getAgentsCommand(context));
|
|
195489
195777
|
program2.addCommand(getConnectorsCommand(context));
|
|
195490
195778
|
program2.addCommand(getFunctionsDeployCommand(context));
|
|
@@ -199758,4 +200046,4 @@ export {
|
|
|
199758
200046
|
CLIExitError
|
|
199759
200047
|
};
|
|
199760
200048
|
|
|
199761
|
-
//# debugId=
|
|
200049
|
+
//# debugId=7988BF189BA90B3464756E2164756E21
|