Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"change-case": "^5.4.4"
},
"devDependencies": {
"@oclif/plugin-command-snapshot": "^5.3.30",
"@oclif/plugin-command-snapshot": "^5.3.31",
"@salesforce/cli-plugins-testkit": "^5.3.62",
"@salesforce/dev-scripts": "^11.0.4",
"@salesforce/plugin-command-reference": "^3.1.119",
Expand Down
24 changes: 24 additions & 0 deletions schemas/org-create-shape.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/ShapeCreateResult",
"definitions": {
"ShapeCreateResult": {
"type": "object",
"properties": {
"shapeId": {
"type": "string"
},
"success": {
"type": "boolean"
},
"errors": {
"type": "array",
"minItems": 0,
"maxItems": 0
}
},
"required": ["shapeId", "success", "errors"],
"additionalProperties": false
}
}
}
43 changes: 43 additions & 0 deletions schemas/org-create-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/OrgSnapshot",
"definitions": {
"OrgSnapshot": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Status": {
"type": "string"
},
"CreatedDate": {
"type": "string"
},
"LastModifiedDate": {
"type": "string"
},
"ExpirationDate": {
"type": "string"
},
"Error": {
"type": "string"
},
"SourceOrg": {
"type": "string"
},
"SnapshotName": {
"type": "string"
},
"Description": {
"type": "string"
},
"Content": {
"type": "string"
}
},
"required": ["CreatedDate", "Description", "Id", "LastModifiedDate", "SnapshotName", "SourceOrg", "Status"]
}
}
}
48 changes: 48 additions & 0 deletions schemas/org-delete-shape.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/OrgShapeDeleteResult",
"definitions": {
"OrgShapeDeleteResult": {
"anyOf": [
{
"type": "object",
"additionalProperties": false,
"properties": {
"shapeIds": {
"type": "array",
"items": {
"type": "string"
}
},
"failures": {
"type": "array",
"items": {
"$ref": "#/definitions/FailureMsg"
}
},
"orgId": {
"type": "string"
}
},
"required": ["failures", "orgId", "shapeIds"]
},
{
"not": {}
}
]
},
"FailureMsg": {
"type": "object",
"properties": {
"shapeId": {
"type": "string"
},
"message": {
"type": "string"
}
},
"required": ["shapeId", "message"],
"additionalProperties": false
}
}
}
79 changes: 79 additions & 0 deletions schemas/org-delete-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/OptionalSaveResult",
"definitions": {
"OptionalSaveResult": {
"anyOf": [
{
"$ref": "#/definitions/SaveResult"
},
{
"not": {}
}
]
},
"SaveResult": {
"anyOf": [
{
"type": "object",
"properties": {
"success": {
"type": "boolean",
"const": true
},
"id": {
"type": "string"
},
"errors": {
"type": "array",
"items": {
"not": {}
}
}
},
"required": ["success", "id", "errors"],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"success": {
"type": "boolean",
"const": false
},
"id": {
"not": {}
},
"errors": {
"type": "array",
"items": {
"$ref": "#/definitions/SaveError"
}
}
},
"required": ["success", "errors"],
"additionalProperties": false
}
]
},
"SaveError": {
"type": "object",
"properties": {
"errorCode": {
"type": "string"
},
"message": {
"type": "string"
},
"fields": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["errorCode", "message"],
"additionalProperties": false
}
}
}
43 changes: 43 additions & 0 deletions schemas/org-get-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/OrgSnapshot",
"definitions": {
"OrgSnapshot": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Status": {
"type": "string"
},
"CreatedDate": {
"type": "string"
},
"LastModifiedDate": {
"type": "string"
},
"ExpirationDate": {
"type": "string"
},
"Error": {
"type": "string"
},
"SourceOrg": {
"type": "string"
},
"SnapshotName": {
"type": "string"
},
"Description": {
"type": "string"
},
"Content": {
"type": "string"
}
},
"required": ["CreatedDate", "Description", "Id", "LastModifiedDate", "SnapshotName", "SourceOrg", "Status"]
}
}
}
40 changes: 40 additions & 0 deletions schemas/org-list-shape.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/OrgShapeListResults",
"definitions": {
"OrgShapeListResults": {
"type": "array",
"items": {
"$ref": "#/definitions/OrgShapeListResult"
}
},
"OrgShapeListResult": {
"type": "object",
"properties": {
"orgId": {
"type": "string"
},
"username": {
"type": "string"
},
"alias": {
"type": "string"
},
"shapeId": {
"type": "string"
},
"status": {
"type": "string"
},
"createdBy": {
"type": "string"
},
"createdDate": {
"type": "string"
}
},
"required": ["orgId", "username", "shapeId", "status", "createdBy", "createdDate"],
"additionalProperties": false
}
}
}
49 changes: 49 additions & 0 deletions schemas/org-list-snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/OrgSnapshots",
"definitions": {
"OrgSnapshots": {
"type": "array",
"items": {
"$ref": "#/definitions/OrgSnapshot"
}
},
"OrgSnapshot": {
"type": "object",
"additionalProperties": false,
"properties": {
"Id": {
"type": "string"
},
"Status": {
"type": "string"
},
"CreatedDate": {
"type": "string"
},
"LastModifiedDate": {
"type": "string"
},
"ExpirationDate": {
"type": "string"
},
"Error": {
"type": "string"
},
"SourceOrg": {
"type": "string"
},
"SnapshotName": {
"type": "string"
},
"Description": {
"type": "string"
},
"Content": {
"type": "string"
}
},
"required": ["CreatedDate", "Description", "Id", "LastModifiedDate", "SnapshotName", "SourceOrg", "Status"]
}
}
}
12 changes: 7 additions & 5 deletions src/commands/org/delete/shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ import utils, { DeleteAllResult } from '../../../shared/deleteUtils.js';
Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
const messages = Messages.loadMessages('@salesforce/plugin-signups', 'shape.delete');

export type OrgShapeDeleteResult = {
orgId: string;
} & DeleteAllResult;
export type OrgShapeDeleteResult =
| ({
orgId: string;
} & DeleteAllResult)
| undefined;

export class OrgShapeDeleteCommand extends SfCommand<OrgShapeDeleteResult | undefined> {
export class OrgShapeDeleteCommand extends SfCommand<OrgShapeDeleteResult> {
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');
Expand All @@ -51,7 +53,7 @@ export class OrgShapeDeleteCommand extends SfCommand<OrgShapeDeleteResult | unde
}),
};

public async run(): Promise<OrgShapeDeleteResult | undefined> {
public async run(): Promise<OrgShapeDeleteResult> {
const { flags } = await this.parse(OrgShapeDeleteCommand);
const username = flags['target-org'].getUsername();
if (!username) throw new SfError('No username found for target-org');
Expand Down
6 changes: 4 additions & 2 deletions src/commands/org/delete/snapshot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ const messages = Messages.loadMessages('@salesforce/plugin-signups', 'snapshot.d
// jsforce can return SaveError[] or never[]
const isSaveError = (error: SaveError): error is SaveError => error.message !== undefined;

export class SnapshotDelete extends SfCommand<SaveResult | undefined> {
export type OptionalSaveResult = SaveResult | undefined;

export class SnapshotDelete extends SfCommand<OptionalSaveResult> {
public static readonly summary = messages.getMessage('summary');
public static readonly description = messages.getMessage('description');
public static readonly examples = messages.getMessages('examples');
Expand All @@ -55,7 +57,7 @@ export class SnapshotDelete extends SfCommand<SaveResult | undefined> {
}),
};

public async run(): Promise<SaveResult | undefined> {
public async run(): Promise<OptionalSaveResult> {
const { flags } = await this.parse(SnapshotDelete);
if (!flags['no-prompt'] && !(await this.confirm({ message: messages.getMessage('prompt.confirm') }))) {
return;
Expand Down
Loading
Loading