@final-commerce/command-frame 0.1.27 → 0.1.29

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.
@@ -1,5 +1,7 @@
1
- export const mockGenerateAPIKey = async () => {
2
- console.log("[Mock] generateAPIKey called");
1
+ export const mockGenerateAPIKey = async (params) => {
2
+ const now = new Date();
3
+ const name = params.name || `command-frame-${now.toISOString().slice(0, 16).replace('T', '-')}`;
4
+ console.log("[Mock] generateAPIKey called for:", name);
3
5
  return {
4
6
  apiKey: "mock-api-key-" + Math.random().toString(36).substring(7)
5
7
  };
@@ -1,5 +1,7 @@
1
1
  export interface GenerateAPIKeyParams {
2
2
  companyId: string;
3
+ name?: string;
4
+ permissions?: string[];
3
5
  }
4
6
  export interface GenerateAPIKeyResponse {
5
7
  apiKey: string;
@@ -4,9 +4,15 @@ export interface GetCustomTableDataResponse<T = any> {
4
4
  timestamp: string;
5
5
  }
6
6
  export interface GetCustomTableDataParams {
7
- tableName: string;
7
+ /** Table name (kebab-case). Required if tableId is not provided. */
8
+ tableName?: string;
9
+ /** Table ID. Required if tableName is not provided. */
10
+ tableId?: string;
11
+ /** Optional query filter */
8
12
  query?: any;
13
+ /** Pagination offset */
9
14
  offset?: number;
15
+ /** Pagination limit */
10
16
  limit?: number;
11
17
  }
12
18
  export type GetCustomTableData = <T = any>(params?: GetCustomTableDataParams) => Promise<GetCustomTableDataResponse<T>>;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Supported attribute/field types for custom table fields.
3
+ * These types define what kind of data can be stored in a custom table field.
4
+ */
5
+ export declare enum AttributeType {
6
+ /** Plain text string */
7
+ STRING = "string",
8
+ /** Numeric value (integer or decimal) */
9
+ NUMBER = "number",
10
+ /** Boolean true/false */
11
+ BOOLEAN = "boolean",
12
+ /** Date/datetime value */
13
+ DATE = "date",
14
+ /** JSON-encoded string for complex objects */
15
+ JSON_STRING = "json-string"
16
+ }
17
+ export type AttributeTypeValue = `${AttributeType}`;
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Supported attribute/field types for custom table fields.
3
+ * These types define what kind of data can be stored in a custom table field.
4
+ */
5
+ export var AttributeType;
6
+ (function (AttributeType) {
7
+ /** Plain text string */
8
+ AttributeType["STRING"] = "string";
9
+ /** Numeric value (integer or decimal) */
10
+ AttributeType["NUMBER"] = "number";
11
+ /** Boolean true/false */
12
+ AttributeType["BOOLEAN"] = "boolean";
13
+ /** Date/datetime value */
14
+ AttributeType["DATE"] = "date";
15
+ /** JSON-encoded string for complex objects */
16
+ AttributeType["JSON_STRING"] = "json-string";
17
+ })(AttributeType || (AttributeType = {}));
package/dist/index.d.ts CHANGED
@@ -135,6 +135,8 @@ export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPaylo
135
135
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
136
136
  export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload } from "./pubsub/topics/custom-tables/types";
137
137
  export type { PrintStartedPayload, PrintCompletedPayload, PrintErrorPayload, PrintStartedEvent, PrintCompletedEvent, PrintErrorEvent, PrintEventType, PrintEventPayload } from "./pubsub/topics/print/types";
138
+ export { AttributeType } from "./common-types/attribute-type";
139
+ export type { AttributeTypeValue } from "./common-types/attribute-type";
138
140
  export type { GetCustomTables, GetCustomTablesResponse } from "./actions/get-custom-tables/types";
139
141
  export type { GetCustomTableFields, GetCustomTableFieldsParams, GetCustomTableFieldsResponse } from "./actions/get-custom-table-fields/types";
140
142
  export type { GetCustomTableData, GetCustomTableDataParams, GetCustomTableDataResponse } from "./actions/get-custom-table-data/types";
package/dist/index.js CHANGED
@@ -157,3 +157,5 @@ export { cartTopic } from "./pubsub/topics/cart";
157
157
  export { paymentsTopic } from "./pubsub/topics/payments";
158
158
  export { customTablesTopic } from "./pubsub/topics/custom-tables";
159
159
  export { printTopic } from "./pubsub/topics/print";
160
+ // Export Custom Tables Types
161
+ export { AttributeType } from "./common-types/attribute-type";
@@ -1,5 +1,14 @@
1
1
  import { mockGetContextManage } from "../../actions/get-context/mock";
2
2
  import { mockGenerateAPIKey } from "../../actions/generate-api-key/mock";
3
+ // Custom Tables Mocks
4
+ import { mockGetCustomTables } from "../../actions/get-custom-tables/mock";
5
+ import { mockGetCustomTableData } from "../../actions/get-custom-table-data/mock";
6
+ import { mockUpsertCustomTableData } from "../../actions/upsert-custom-table-data/mock";
7
+ import { mockDeleteCustomTableData } from "../../actions/delete-custom-table-data/mock";
8
+ // Custom Extensions Mocks
9
+ import { mockGetCustomExtensions } from "../../actions/get-custom-extensions/mock";
10
+ import { mockGetCurrentCompanyCustomExtensions } from "../../actions/get-current-company-custom-extensions/mock";
11
+ import { mockGetCustomExtensionCustomTables } from "../../actions/get-custom-extension-custom-tables/mock";
3
12
  // Manage-specific mock for getFinalContext
4
13
  const mockGetFinalContextManage = async () => {
5
14
  console.log("[Mock] getFinalContext called (Manage)");
@@ -10,5 +19,14 @@ const mockGetFinalContextManage = async () => {
10
19
  export const MANAGE_MOCKS = {
11
20
  getContext: mockGetContextManage,
12
21
  getFinalContext: mockGetFinalContextManage,
13
- generateAPIKey: mockGenerateAPIKey
22
+ generateAPIKey: mockGenerateAPIKey,
23
+ // Custom Tables Actions
24
+ getCustomTables: mockGetCustomTables,
25
+ getCustomTableData: mockGetCustomTableData,
26
+ upsertCustomTableData: mockUpsertCustomTableData,
27
+ deleteCustomTableData: mockDeleteCustomTableData,
28
+ // Custom Extensions Actions
29
+ getCustomExtensions: mockGetCustomExtensions,
30
+ getCurrentCompanyCustomExtensions: mockGetCurrentCompanyCustomExtensions,
31
+ getCustomExtensionCustomTables: mockGetCustomExtensionCustomTables
14
32
  };
@@ -1,6 +1,13 @@
1
- import type { GetContext, GetFinalContext, GenerateAPIKey } from "../../index";
1
+ import type { GetContext, GetFinalContext, GenerateAPIKey, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables } from "../../index";
2
2
  export interface ManageProviderActions {
3
3
  getContext: GetContext;
4
4
  getFinalContext: GetFinalContext;
5
5
  generateAPIKey: GenerateAPIKey;
6
+ getCustomTables: GetCustomTables;
7
+ getCustomTableData: GetCustomTableData;
8
+ upsertCustomTableData: UpsertCustomTableData;
9
+ deleteCustomTableData: DeleteCustomTableData;
10
+ getCustomExtensions: GetCustomExtensions;
11
+ getCurrentCompanyCustomExtensions: GetCurrentCompanyCustomExtensions;
12
+ getCustomExtensionCustomTables: GetCustomExtensionCustomTables;
6
13
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",