@final-commerce/command-frame 0.1.28 → 0.1.30

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
  };
@@ -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,6 @@
1
+ /**
2
+ * Get secret value action
3
+ * Calls the getSecretVal action on the parent window
4
+ */
5
+ import type { GetSecretVal } from "./types";
6
+ export declare const getSecretVal: GetSecretVal;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get secret value action
3
+ * Calls the getSecretVal action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getSecretVal = async (params) => {
7
+ return await commandFrameClient.call("getSecretVal", params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetSecretVal } from "./types";
2
+ export declare const mockGetSecretVal: GetSecretVal;
@@ -0,0 +1,7 @@
1
+ export const mockGetSecretVal = async (params) => {
2
+ console.log("[Mock] getSecretVal called", params);
3
+ return {
4
+ key: params.key,
5
+ value: `mock-value-for-${params.key}`
6
+ };
7
+ };
@@ -0,0 +1,9 @@
1
+ export interface GetSecretValParams {
2
+ key: string;
3
+ extensionId?: string;
4
+ }
5
+ export interface GetSecretValResponse {
6
+ key: string;
7
+ value: string;
8
+ }
9
+ export type GetSecretVal = (params: GetSecretValParams) => Promise<GetSecretValResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get secrets keys action
3
+ * Calls the getSecretsKeys action on the parent window
4
+ */
5
+ import type { GetSecretsKeys } from "./types";
6
+ export declare const getSecretsKeys: GetSecretsKeys;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Get secrets keys action
3
+ * Calls the getSecretsKeys action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const getSecretsKeys = async (params) => {
7
+ return await commandFrameClient.call("getSecretsKeys", params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import { GetSecretsKeys } from "./types";
2
+ export declare const mockGetSecretsKeys: GetSecretsKeys;
@@ -0,0 +1,6 @@
1
+ export const mockGetSecretsKeys = async () => {
2
+ console.log("[Mock] getSecretsKeys called");
3
+ return {
4
+ keys: ["api-key", "api-secret", "webhook-url"]
5
+ };
6
+ };
@@ -0,0 +1,7 @@
1
+ export interface GetSecretsKeysParams {
2
+ extensionId?: string;
3
+ }
4
+ export interface GetSecretsKeysResponse {
5
+ keys: string[];
6
+ }
7
+ export type GetSecretsKeys = (params?: GetSecretsKeysParams) => Promise<GetSecretsKeysResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Set secret value action
3
+ * Calls the setSecretVal action on the parent window
4
+ */
5
+ import type { SetSecretVal } from "./types";
6
+ export declare const setSecretVal: SetSecretVal;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Set secret value action
3
+ * Calls the setSecretVal action on the parent window
4
+ */
5
+ import { commandFrameClient } from "../../client";
6
+ export const setSecretVal = async (params) => {
7
+ return await commandFrameClient.call("setSecretVal", params);
8
+ };
@@ -0,0 +1,2 @@
1
+ import { SetSecretVal } from "./types";
2
+ export declare const mockSetSecretVal: SetSecretVal;
@@ -0,0 +1,6 @@
1
+ export const mockSetSecretVal = async (params) => {
2
+ console.log("[Mock] setSecretVal called", params);
3
+ return {
4
+ success: true
5
+ };
6
+ };
@@ -0,0 +1,9 @@
1
+ export interface SetSecretValParams {
2
+ key: string;
3
+ value: string;
4
+ extensionId?: string;
5
+ }
6
+ export interface SetSecretValResponse {
7
+ success: boolean;
8
+ }
9
+ export type SetSecretVal = (params: SetSecretValParams) => Promise<SetSecretValResponse>;
@@ -0,0 +1 @@
1
+ export {};
@@ -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
@@ -58,6 +58,9 @@ export declare const command: {
58
58
  readonly getCustomExtensions: import("./actions/get-custom-extensions/types").GetCustomExtensions;
59
59
  readonly getCurrentCompanyCustomExtensions: import("./actions/get-current-company-custom-extensions/types").GetCurrentCompanyCustomExtensions;
60
60
  readonly getCustomExtensionCustomTables: import("./actions/get-custom-extension-custom-tables/types").GetCustomExtensionCustomTables;
61
+ readonly getSecretsKeys: import("./actions/get-secrets-keys/types").GetSecretsKeys;
62
+ readonly getSecretVal: import("./actions/get-secret-val/types").GetSecretVal;
63
+ readonly setSecretVal: import("./actions/set-secret-val/types").SetSecretVal;
61
64
  };
62
65
  export type { ExampleFunction, ExampleFunctionParams, ExampleFunctionResponse } from "./actions/example-function/types";
63
66
  export type { GenerateAPIKey, GenerateAPIKeyParams, GenerateAPIKeyResponse } from "./actions/generate-api-key/types";
@@ -135,6 +138,8 @@ export type { CartCreatedPayload, CartCustomerAssignedPayload, ProductAddedPaylo
135
138
  export type { PaymentDonePayload, PaymentErrPayload, PaymentDoneEvent, PaymentErrEvent, PaymentsEventType, PaymentsEventPayload } from "./pubsub/topics/payments/types";
136
139
  export type { RowCreatedPayload, RowUpdatedPayload, RowDeletedPayload, RowCreatedEvent, RowUpdatedEvent, RowDeletedEvent, CustomTablesEventType, CustomTablesEventPayload } from "./pubsub/topics/custom-tables/types";
137
140
  export type { PrintStartedPayload, PrintCompletedPayload, PrintErrorPayload, PrintStartedEvent, PrintCompletedEvent, PrintErrorEvent, PrintEventType, PrintEventPayload } from "./pubsub/topics/print/types";
141
+ export { AttributeType } from "./common-types/attribute-type";
142
+ export type { AttributeTypeValue } from "./common-types/attribute-type";
138
143
  export type { GetCustomTables, GetCustomTablesResponse } from "./actions/get-custom-tables/types";
139
144
  export type { GetCustomTableFields, GetCustomTableFieldsParams, GetCustomTableFieldsResponse } from "./actions/get-custom-table-fields/types";
140
145
  export type { GetCustomTableData, GetCustomTableDataParams, GetCustomTableDataResponse } from "./actions/get-custom-table-data/types";
@@ -143,3 +148,6 @@ export type { DeleteCustomTableData, DeleteCustomTableDataParams, DeleteCustomTa
143
148
  export type { GetCustomExtensions, GetCustomExtensionsResponse } from "./actions/get-custom-extensions/types";
144
149
  export type { GetCustomExtensionCustomTables, GetCustomExtensionCustomTablesParams, GetCustomExtensionCustomTablesResponse } from "./actions/get-custom-extension-custom-tables/types";
145
150
  export type { GetCurrentCompanyCustomExtensions, GetCurrentCompanyCustomExtensionsParams, GetCurrentCompanyCustomExtensionsResponse } from "./actions/get-current-company-custom-extensions/types";
151
+ export type { GetSecretsKeys, GetSecretsKeysParams, GetSecretsKeysResponse } from "./actions/get-secrets-keys/types";
152
+ export type { GetSecretVal, GetSecretValParams, GetSecretValResponse } from "./actions/get-secret-val/types";
153
+ export type { SetSecretVal, SetSecretValParams, SetSecretValResponse } from "./actions/set-secret-val/types";
package/dist/index.js CHANGED
@@ -65,6 +65,9 @@ import { deleteCustomTableData } from "./actions/delete-custom-table-data/action
65
65
  import { getCustomExtensions } from "./actions/get-custom-extensions/action";
66
66
  import { getCurrentCompanyCustomExtensions } from "./actions/get-current-company-custom-extensions/action";
67
67
  import { getCustomExtensionCustomTables } from "./actions/get-custom-extension-custom-tables/action";
68
+ import { getSecretsKeys } from "./actions/get-secrets-keys/action";
69
+ import { getSecretVal } from "./actions/get-secret-val/action";
70
+ import { setSecretVal } from "./actions/set-secret-val/action";
68
71
  import { generateAPIKey } from "./actions/generate-api-key/action";
69
72
  // Export actions as command object
70
73
  export const command = {
@@ -134,7 +137,11 @@ export const command = {
134
137
  // Custom Extensions Actions
135
138
  getCustomExtensions,
136
139
  getCurrentCompanyCustomExtensions,
137
- getCustomExtensionCustomTables
140
+ getCustomExtensionCustomTables,
141
+ // Secret Storage Actions
142
+ getSecretsKeys,
143
+ getSecretVal,
144
+ setSecretVal,
138
145
  };
139
146
  // Export Common Types
140
147
  export * from "./CommonTypes";
@@ -157,3 +164,5 @@ export { cartTopic } from "./pubsub/topics/cart";
157
164
  export { paymentsTopic } from "./pubsub/topics/payments";
158
165
  export { customTablesTopic } from "./pubsub/topics/custom-tables";
159
166
  export { printTopic } from "./pubsub/topics/print";
167
+ // Export Custom Tables Types
168
+ export { AttributeType } from "./common-types/attribute-type";
@@ -1,5 +1,17 @@
1
1
  import { mockGetContextManage } from "../../actions/get-context/mock";
2
2
  import { mockGenerateAPIKey } from "../../actions/generate-api-key/mock";
3
+ import { mockGetSecretsKeys } from "../../actions/get-secrets-keys/mock";
4
+ import { mockGetSecretVal } from "../../actions/get-secret-val/mock";
5
+ import { mockSetSecretVal } from "../../actions/set-secret-val/mock";
6
+ // Custom Tables Mocks
7
+ import { mockGetCustomTables } from "../../actions/get-custom-tables/mock";
8
+ import { mockGetCustomTableData } from "../../actions/get-custom-table-data/mock";
9
+ import { mockUpsertCustomTableData } from "../../actions/upsert-custom-table-data/mock";
10
+ import { mockDeleteCustomTableData } from "../../actions/delete-custom-table-data/mock";
11
+ // Custom Extensions Mocks
12
+ import { mockGetCustomExtensions } from "../../actions/get-custom-extensions/mock";
13
+ import { mockGetCurrentCompanyCustomExtensions } from "../../actions/get-current-company-custom-extensions/mock";
14
+ import { mockGetCustomExtensionCustomTables } from "../../actions/get-custom-extension-custom-tables/mock";
3
15
  // Manage-specific mock for getFinalContext
4
16
  const mockGetFinalContextManage = async () => {
5
17
  console.log("[Mock] getFinalContext called (Manage)");
@@ -10,5 +22,17 @@ const mockGetFinalContextManage = async () => {
10
22
  export const MANAGE_MOCKS = {
11
23
  getContext: mockGetContextManage,
12
24
  getFinalContext: mockGetFinalContextManage,
13
- generateAPIKey: mockGenerateAPIKey
25
+ getSecretsKeys: mockGetSecretsKeys,
26
+ getSecretVal: mockGetSecretVal,
27
+ setSecretVal: mockSetSecretVal,
28
+ generateAPIKey: mockGenerateAPIKey,
29
+ // Custom Tables Actions
30
+ getCustomTables: mockGetCustomTables,
31
+ getCustomTableData: mockGetCustomTableData,
32
+ upsertCustomTableData: mockUpsertCustomTableData,
33
+ deleteCustomTableData: mockDeleteCustomTableData,
34
+ // Custom Extensions Actions
35
+ getCustomExtensions: mockGetCustomExtensions,
36
+ getCurrentCompanyCustomExtensions: mockGetCurrentCompanyCustomExtensions,
37
+ getCustomExtensionCustomTables: mockGetCustomExtensionCustomTables
14
38
  };
@@ -1,6 +1,16 @@
1
- import type { GetContext, GetFinalContext, GenerateAPIKey } from "../../index";
1
+ import type { GetContext, GetFinalContext, GetSecretsKeys, GetSecretVal, SetSecretVal, GenerateAPIKey, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables } from "../../index";
2
2
  export interface ManageProviderActions {
3
3
  getContext: GetContext;
4
4
  getFinalContext: GetFinalContext;
5
+ getSecretsKeys: GetSecretsKeys;
6
+ getSecretVal: GetSecretVal;
7
+ setSecretVal: SetSecretVal;
5
8
  generateAPIKey: GenerateAPIKey;
9
+ getCustomTables: GetCustomTables;
10
+ getCustomTableData: GetCustomTableData;
11
+ upsertCustomTableData: UpsertCustomTableData;
12
+ deleteCustomTableData: DeleteCustomTableData;
13
+ getCustomExtensions: GetCustomExtensions;
14
+ getCurrentCompanyCustomExtensions: GetCurrentCompanyCustomExtensions;
15
+ getCustomExtensionCustomTables: GetCustomExtensionCustomTables;
6
16
  }
@@ -56,6 +56,9 @@ import { mockDeleteCustomTableData } from "../../actions/delete-custom-table-dat
56
56
  import { mockGetCustomExtensions } from "../../actions/get-custom-extensions/mock";
57
57
  import { mockGetCurrentCompanyCustomExtensions } from "../../actions/get-current-company-custom-extensions/mock";
58
58
  import { mockGetCustomExtensionCustomTables } from "../../actions/get-custom-extension-custom-tables/mock";
59
+ import { mockGetSecretsKeys } from "../../actions/get-secrets-keys/mock";
60
+ import { mockGetSecretVal } from "../../actions/get-secret-val/mock";
61
+ import { mockSetSecretVal } from "../../actions/set-secret-val/mock";
59
62
  export const RENDER_MOCKS = {
60
63
  addCartDiscount: mockAddCartDiscount,
61
64
  addCartFee: mockAddCartFee,
@@ -115,4 +118,7 @@ export const RENDER_MOCKS = {
115
118
  getCustomExtensions: mockGetCustomExtensions,
116
119
  getCurrentCompanyCustomExtensions: mockGetCurrentCompanyCustomExtensions,
117
120
  getCustomExtensionCustomTables: mockGetCustomExtensionCustomTables,
121
+ getSecretsKeys: mockGetSecretsKeys,
122
+ getSecretVal: mockGetSecretVal,
123
+ setSecretVal: mockSetSecretVal,
118
124
  };
@@ -1,4 +1,4 @@
1
- import type { ExampleFunction, GetProducts, AddCustomSale, GetCustomers, AssignCustomer, AddCustomer, GetCategories, GetOrders, GetRefunds, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, TapToPayPayment, TerminalPayment, VendaraPayment, AddCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields } from "../../index";
1
+ import type { ExampleFunction, GetProducts, AddCustomSale, GetCustomers, AssignCustomer, AddCustomer, GetCategories, GetOrders, GetRefunds, AddProductDiscount, AddProductToCart, RemoveProductFromCart, UpdateCartItemQuantity, AddCartDiscount, GetContext, GetFinalContext, AddProductNote, AddProductFee, AdjustInventory, AddOrderNote, AddCartFee, ClearCart, ParkOrder, ResumeParkedOrder, DeleteParkedOrder, InitiateRefund, CashPayment, TapToPayPayment, TerminalPayment, VendaraPayment, AddCustomerNote, RemoveCustomerFromCart, GoToStationHome, OpenCashDrawer, ShowNotification, ShowConfirmation, AuthenticateUser, PartialPayment, SwitchUser, TriggerWebhook, TriggerZapierWebhook, SetRefundStockAction, SelectAllRefundItems, ResetRefundDetails, CalculateRefundTotal, GetRemainingRefundableQuantities, ProcessPartialRefund, GetCurrentCart, Print, SetActiveOrder, GetCustomTables, GetCustomTableData, UpsertCustomTableData, DeleteCustomTableData, GetCustomExtensions, GetCurrentCompanyCustomExtensions, GetCustomExtensionCustomTables, GetCustomTableFields, GetSecretsKeys, GetSecretVal, SetSecretVal } from "../../index";
2
2
  export interface RenderProviderActions {
3
3
  exampleFunction: ExampleFunction;
4
4
  getProducts: GetProducts;
@@ -58,4 +58,7 @@ export interface RenderProviderActions {
58
58
  getCurrentCompanyCustomExtensions: GetCurrentCompanyCustomExtensions;
59
59
  getCustomExtensionCustomTables: GetCustomExtensionCustomTables;
60
60
  getCustomTableFields: GetCustomTableFields;
61
+ getSecretsKeys: GetSecretsKeys;
62
+ getSecretVal: GetSecretVal;
63
+ setSecretVal: SetSecretVal;
61
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@final-commerce/command-frame",
3
- "version": "0.1.28",
3
+ "version": "0.1.30",
4
4
  "description": "Commands Frame library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",