@segment/action-destinations 3.116.1-staging.64 → 3.117.0

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.
Files changed (114) hide show
  1. package/dist/destinations/actable-predictive/generated-types.d.ts +4 -0
  2. package/dist/destinations/{actions-bingads → actable-predictive}/generated-types.js +0 -0
  3. package/dist/destinations/actable-predictive/generated-types.js.map +1 -0
  4. package/dist/destinations/{actions-bingads → actable-predictive}/index.d.ts +2 -0
  5. package/dist/destinations/actable-predictive/index.js +57 -0
  6. package/dist/destinations/actable-predictive/index.js.map +1 -0
  7. package/dist/destinations/actable-predictive/sendCustomEvent/generated-types.d.ts +8 -0
  8. package/dist/destinations/{actions-bingads/offlineConversions → actable-predictive/sendCustomEvent}/generated-types.js +0 -0
  9. package/dist/destinations/actable-predictive/sendCustomEvent/generated-types.js.map +1 -0
  10. package/dist/destinations/{actions-bingads/offlineConversions → actable-predictive/sendCustomEvent}/index.d.ts +0 -0
  11. package/dist/destinations/actable-predictive/sendCustomEvent/index.js +62 -0
  12. package/dist/destinations/actable-predictive/sendCustomEvent/index.js.map +1 -0
  13. package/dist/destinations/actable-predictive/sendEmailEvent/generated-types.d.ts +9 -0
  14. package/dist/destinations/{google-sheets-partner → actable-predictive/sendEmailEvent}/generated-types.js +0 -0
  15. package/dist/destinations/actable-predictive/sendEmailEvent/generated-types.js.map +1 -0
  16. package/dist/destinations/actable-predictive/sendEmailEvent/index.d.ts +5 -0
  17. package/dist/destinations/actable-predictive/sendEmailEvent/index.js +85 -0
  18. package/dist/destinations/actable-predictive/sendEmailEvent/index.js.map +1 -0
  19. package/dist/destinations/actable-predictive/sendTransactionEvent/generated-types.d.ts +11 -0
  20. package/dist/destinations/{google-sheets-partner/postSheet → actable-predictive/sendTransactionEvent}/generated-types.js +0 -0
  21. package/dist/destinations/actable-predictive/sendTransactionEvent/generated-types.js.map +1 -0
  22. package/dist/destinations/{google-sheets-partner/postSheet → actable-predictive/sendTransactionEvent}/index.d.ts +0 -0
  23. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js +113 -0
  24. package/dist/destinations/actable-predictive/sendTransactionEvent/index.js.map +1 -0
  25. package/dist/destinations/actable-predictive/sendWebEvent/generated-types.d.ts +9 -0
  26. package/dist/destinations/actable-predictive/sendWebEvent/generated-types.js +3 -0
  27. package/dist/destinations/actable-predictive/sendWebEvent/generated-types.js.map +1 -0
  28. package/dist/destinations/actable-predictive/sendWebEvent/index.d.ts +5 -0
  29. package/dist/destinations/actable-predictive/sendWebEvent/index.js +84 -0
  30. package/dist/destinations/actable-predictive/sendWebEvent/index.js.map +1 -0
  31. package/dist/destinations/amplitude/logPurchase/index.js +2 -6
  32. package/dist/destinations/amplitude/logPurchase/index.js.map +1 -1
  33. package/dist/destinations/clevertap/userDelete/index.js +1 -1
  34. package/dist/destinations/clevertap/userDelete/index.js.map +1 -1
  35. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js +1 -1
  36. package/dist/destinations/hubspot/sendCustomBehavioralEvent/index.js.map +1 -1
  37. package/dist/destinations/hubspot/upsertContact/index.js +1 -1
  38. package/dist/destinations/hubspot/upsertContact/index.js.map +1 -1
  39. package/dist/destinations/index.js +1 -3
  40. package/dist/destinations/index.js.map +1 -1
  41. package/dist/destinations/mixpanel/mixpanel-properties.js +24 -0
  42. package/dist/destinations/mixpanel/mixpanel-properties.js.map +1 -1
  43. package/dist/destinations/mixpanel/mixpanel-types.d.ts +1 -1
  44. package/dist/destinations/mixpanel/trackEvent/functions.js +9 -3
  45. package/dist/destinations/mixpanel/trackEvent/functions.js.map +1 -1
  46. package/dist/destinations/mixpanel/trackEvent/generated-types.d.ts +4 -1
  47. package/dist/destinations/mixpanel/trackEvent/index.js +2 -75
  48. package/dist/destinations/mixpanel/trackEvent/index.js.map +1 -1
  49. package/dist/destinations/mixpanel/trackPurchase/generated-types.d.ts +5 -0
  50. package/dist/destinations/mixpanel/trackPurchase/index.js +1 -1
  51. package/dist/destinations/mixpanel/trackPurchase/index.js.map +1 -1
  52. package/dist/destinations/moengage/index.js +4 -0
  53. package/dist/destinations/moengage/index.js.map +1 -1
  54. package/dist/destinations/moengage/regional-endpoints.d.ts +1 -0
  55. package/dist/destinations/moengage/regional-endpoints.js +2 -1
  56. package/dist/destinations/moengage/regional-endpoints.js.map +1 -1
  57. package/dist/destinations/salesforce/account/generated-types.d.ts +0 -1
  58. package/dist/destinations/salesforce/account/index.js +0 -1
  59. package/dist/destinations/salesforce/account/index.js.map +1 -1
  60. package/dist/destinations/salesforce/cases/generated-types.d.ts +0 -1
  61. package/dist/destinations/salesforce/cases/index.js +0 -1
  62. package/dist/destinations/salesforce/cases/index.js.map +1 -1
  63. package/dist/destinations/salesforce/contact/generated-types.d.ts +0 -1
  64. package/dist/destinations/salesforce/contact/index.js +0 -1
  65. package/dist/destinations/salesforce/contact/index.js.map +1 -1
  66. package/dist/destinations/salesforce/customObject/generated-types.d.ts +0 -1
  67. package/dist/destinations/salesforce/customObject/index.js +0 -1
  68. package/dist/destinations/salesforce/customObject/index.js.map +1 -1
  69. package/dist/destinations/salesforce/lead/generated-types.d.ts +0 -1
  70. package/dist/destinations/salesforce/lead/index.js +0 -1
  71. package/dist/destinations/salesforce/lead/index.js.map +1 -1
  72. package/dist/destinations/salesforce/opportunity/generated-types.d.ts +0 -1
  73. package/dist/destinations/salesforce/opportunity/index.js +0 -1
  74. package/dist/destinations/salesforce/opportunity/index.js.map +1 -1
  75. package/dist/destinations/salesforce/sf-operations.js +6 -6
  76. package/dist/destinations/salesforce/sf-operations.js.map +1 -1
  77. package/dist/destinations/salesforce/sf-properties.d.ts +0 -2
  78. package/dist/destinations/salesforce/sf-properties.js +1 -11
  79. package/dist/destinations/salesforce/sf-properties.js.map +1 -1
  80. package/dist/destinations/segment/segment-properties.js +9 -9
  81. package/dist/destinations/segment/segment-properties.js.map +1 -1
  82. package/package.json +4 -4
  83. package/dist/destinations/actions-bingads/functions.d.ts +0 -0
  84. package/dist/destinations/actions-bingads/functions.js +0 -2
  85. package/dist/destinations/actions-bingads/functions.js.map +0 -1
  86. package/dist/destinations/actions-bingads/generated-types.d.ts +0 -10
  87. package/dist/destinations/actions-bingads/generated-types.js.map +0 -1
  88. package/dist/destinations/actions-bingads/index.js +0 -77
  89. package/dist/destinations/actions-bingads/index.js.map +0 -1
  90. package/dist/destinations/actions-bingads/offlineConversions/formatter.d.ts +0 -8
  91. package/dist/destinations/actions-bingads/offlineConversions/formatter.js +0 -33
  92. package/dist/destinations/actions-bingads/offlineConversions/formatter.js.map +0 -1
  93. package/dist/destinations/actions-bingads/offlineConversions/generated-types.d.ts +0 -7
  94. package/dist/destinations/actions-bingads/offlineConversions/generated-types.js.map +0 -1
  95. package/dist/destinations/actions-bingads/offlineConversions/index.js +0 -131
  96. package/dist/destinations/actions-bingads/offlineConversions/index.js.map +0 -1
  97. package/dist/destinations/google-sheets-partner/constants.d.ts +0 -3
  98. package/dist/destinations/google-sheets-partner/constants.js +0 -7
  99. package/dist/destinations/google-sheets-partner/constants.js.map +0 -1
  100. package/dist/destinations/google-sheets-partner/generated-types.d.ts +0 -2
  101. package/dist/destinations/google-sheets-partner/generated-types.js.map +0 -1
  102. package/dist/destinations/google-sheets-partner/googleapis/index.d.ts +0 -17
  103. package/dist/destinations/google-sheets-partner/googleapis/index.js +0 -34
  104. package/dist/destinations/google-sheets-partner/googleapis/index.js.map +0 -1
  105. package/dist/destinations/google-sheets-partner/index.d.ts +0 -4
  106. package/dist/destinations/google-sheets-partner/index.js +0 -39
  107. package/dist/destinations/google-sheets-partner/index.js.map +0 -1
  108. package/dist/destinations/google-sheets-partner/postSheet/generated-types.d.ts +0 -11
  109. package/dist/destinations/google-sheets-partner/postSheet/generated-types.js.map +0 -1
  110. package/dist/destinations/google-sheets-partner/postSheet/index.js +0 -79
  111. package/dist/destinations/google-sheets-partner/postSheet/index.js.map +0 -1
  112. package/dist/destinations/google-sheets-partner/postSheet/operations.d.ts +0 -10
  113. package/dist/destinations/google-sheets-partner/postSheet/operations.js +0 -96
  114. package/dist/destinations/google-sheets-partner/postSheet/operations.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/actions-bingads/offlineConversions/index.ts"],"names":[],"mappings":";;AAIA,2CAA4C;AAE5C,IAAI,mBAAmB,GAAG,UAAU,CAAA;AAEpC,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,qBAAqB;IAC5B,WAAW,EAAE,MAAM;IACnB,MAAM,EAAE;QACN,sBAAsB,EAAE;YACtB,KAAK,EAAE,0BAA0B;YACjC,WAAW,EAAE,0BAA0B;YACvC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,iCAAiC;aAC3C;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,6BAA6B;aACvC;SACF;QACD,cAAc,EAAE;YACd,KAAK,EAAE,iBAAiB;YACxB,WAAW,EAAE,iBAAiB;YAC9B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,6BAA6B;aACvC;SACF;QACD,eAAe,EAAE;YACf,KAAK,EAAE,kBAAkB;YACzB,WAAW,EAAE,kBAAkB;YAC/B,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,8BAA8B;aACxC;SACF;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,oBAAoB;YAC3B,WAAW,EAAE,oBAAoB;YACjC,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACP,OAAO,EAAE,oBAAoB;aAC9B;SACF;KAkDF;IACD,OAAO,EAAE,KAAK,EAAE,OAA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,CAAC,QAAQ,CAAC,mBAAmB;YACjC,sBAAsB;YACtB,4BAA4B;YAC5B,IAAI,CAAC,QAAQ,CAAC,WAAW;YACzB,eAAe;YACf,gCAAgC;YAChC,IAAI,CAAC,QAAQ,CAAC,eAAe;YAC7B,mBAAmB;YACnB,aAAa;YACb,UAAU;YACV,+FAA+F;YAC/F,6FAA6F;YAC7F,kBAAkB;YAClB,2BAA2B;YAC3B,gCAAgC;YAChC,cAAc;YACd,mBAAmB;YACnB,kBAAkB;YAClB,cAAc;YACd,mBAAmB;YACnB,iCAAiC;YACjC,eAAe;YACf,oBAAoB;YACpB,kCAAkC;YAClC,KAAK;YACL,8DAA8D;YAC9D,yDAAyD,CAAA;QAE3D,IAAI;YACF,MAAM,QAAQ,GAA8B,MAAM,OAAO,CAAC,QAAQ,EAAE;gBAClE,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE;oBACP,UAAU,EAAE,yBAAyB;oBACrC,cAAc,EAAE,wBAAwB;iBACzC;gBACD,IAAI,EAAE,EAAE;gBACR,QAAQ,EAAE,QAAQ;aACnB,CAAC,CAAA;YACF,OAAO,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAA;YAC9D,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;SACtB;QAAC,OAAO,KAAK,EAAE;YAEd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;SAC3B;IACH,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,3 +0,0 @@
1
- export declare const CONSTANTS: {
2
- MAX_CELLS: number;
3
- };
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONSTANTS = void 0;
4
- exports.CONSTANTS = {
5
- MAX_CELLS: 300000
6
- };
7
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/destinations/google-sheets-partner/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,SAAS,GAAG;IAIvB,SAAS,EAAE,MAAM;CAClB,CAAA"}
@@ -1,2 +0,0 @@
1
- export interface Settings {
2
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../src/destinations/google-sheets-partner/generated-types.ts"],"names":[],"mappings":""}
@@ -1,17 +0,0 @@
1
- import { ModifiedResponse, RequestClient } from '@segment/actions-core';
2
- import type { MappingSettings } from '../postSheet/operations';
3
- export declare type GetResponse = {
4
- range: string;
5
- majorDimension: string;
6
- values: string[][];
7
- };
8
- export declare class GoogleSheets {
9
- request: RequestClient;
10
- constructor(request: RequestClient);
11
- get: (mappingSettings: MappingSettings, range: string) => Promise<ModifiedResponse<GetResponse>>;
12
- batchUpdate: (mappingSettings: MappingSettings, batchPayload: {
13
- range: string;
14
- values: string[][];
15
- }[]) => Promise<ModifiedResponse<unknown>>;
16
- append: (mappingSettings: MappingSettings, range: string, values: string[][]) => Promise<ModifiedResponse<unknown>>;
17
- }
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GoogleSheets = void 0;
4
- const API_VERSION = 'v4';
5
- class GoogleSheets {
6
- constructor(request) {
7
- this.get = async (mappingSettings, range) => {
8
- return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values/${mappingSettings.spreadsheetName}!${range}`, {
9
- method: 'get',
10
- skipResponseCloning: true
11
- });
12
- };
13
- this.batchUpdate = async (mappingSettings, batchPayload) => {
14
- return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values:batchUpdate`, {
15
- method: 'post',
16
- json: {
17
- valueInputOption: mappingSettings.dataFormat,
18
- data: batchPayload
19
- }
20
- });
21
- };
22
- this.append = async (mappingSettings, range, values) => {
23
- return this.request(`https://sheets.googleapis.com/${API_VERSION}/spreadsheets/${mappingSettings.spreadsheetId}/values/${mappingSettings.spreadsheetName}!${range}:append?valueInputOption=${mappingSettings.dataFormat}&insertDataOption=INSERT_ROWS`, {
24
- method: 'post',
25
- json: {
26
- values: values
27
- }
28
- });
29
- };
30
- this.request = request;
31
- }
32
- }
33
- exports.GoogleSheets = GoogleSheets;
34
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/googleapis/index.ts"],"names":[],"mappings":";;;AAGA,MAAM,WAAW,GAAG,IAAI,CAAA;AAOxB,MAAa,YAAY;IAGvB,YAAY,OAAsB;QAIlC,QAAG,GAAG,KAAK,EAAE,eAAgC,EAAE,KAAa,EAA0C,EAAE;YACtG,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,WAAW,iBAAiB,eAAe,CAAC,aAAa,WAAW,eAAe,CAAC,eAAe,IAAI,KAAK,EAAE,EAC/I;gBACE,MAAM,EAAE,KAAK;gBACb,mBAAmB,EAAE,IAAI;aAC1B,CACF,CAAA;QACH,CAAC,CAAA;QAED,gBAAW,GAAG,KAAK,EAAE,eAAgC,EAAE,YAAqD,EAAE,EAAE;YAC9G,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,WAAW,iBAAiB,eAAe,CAAC,aAAa,qBAAqB,EAC/G;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,gBAAgB,EAAE,eAAe,CAAC,UAAU;oBAC5C,IAAI,EAAE,YAAY;iBACnB;aACF,CACF,CAAA;QACH,CAAC,CAAA;QAeD,WAAM,GAAG,KAAK,EAAE,eAAgC,EAAE,KAAa,EAAE,MAAkB,EAAE,EAAE;YACrF,OAAO,IAAI,CAAC,OAAO,CACjB,iCAAiC,WAAW,iBAAiB,eAAe,CAAC,aAAa,WAAW,eAAe,CAAC,eAAe,IAAI,KAAK,4BAA4B,eAAe,CAAC,UAAU,+BAA+B,EAClO;gBACE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE;oBACJ,MAAM,EAAE,MAAM;iBACf;aACF,CACF,CAAA;QACH,CAAC,CAAA;QAjDC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;CAiDF;AAtDD,oCAsDC"}
@@ -1,4 +0,0 @@
1
- import type { DestinationDefinition } from '@segment/actions-core';
2
- import type { Settings } from './generated-types';
3
- declare const destination: DestinationDefinition<Settings>;
4
- export default destination;
@@ -1,39 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const postSheet_1 = __importDefault(require("./postSheet"));
7
- const destination = {
8
- name: 'Google Sheets (Partner Test)',
9
- slug: 'actions-google-sheets-partner',
10
- mode: 'cloud',
11
- authentication: {
12
- scheme: 'oauth-managed',
13
- fields: {},
14
- refreshAccessToken: async (request, { auth }) => {
15
- const res = await request(auth.refreshTokenUrl, {
16
- method: 'POST',
17
- body: new URLSearchParams({
18
- refresh_token: auth.refreshToken,
19
- client_id: auth.clientId,
20
- client_secret: auth.clientSecret,
21
- grant_type: 'refresh_token'
22
- })
23
- });
24
- return { accessToken: res.data.access_token };
25
- }
26
- },
27
- extendRequest({ auth }) {
28
- return {
29
- headers: {
30
- authorization: `Bearer ${auth?.accessToken}`
31
- }
32
- };
33
- },
34
- actions: {
35
- postSheet: postSheet_1.default
36
- }
37
- };
38
- exports.default = destination;
39
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/destinations/google-sheets-partner/index.ts"],"names":[],"mappings":";;;;;AAGA,4DAAmC;AAQnC,MAAM,WAAW,GAAoC;IACnD,IAAI,EAAE,8BAA8B;IACpC,IAAI,EAAE,+BAA+B;IACrC,IAAI,EAAE,OAAO;IAEb,cAAc,EAAE;QACd,MAAM,EAAE,eAAe;QACvB,MAAM,EAAE,EAAE;QAMV,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE;YAC9C,MAAM,GAAG,GAAG,MAAM,OAAO,CAAuB,IAAI,CAAC,eAAe,EAAE;gBACpE,MAAM,EAAE,MAAM;gBACd,IAAI,EAAE,IAAI,eAAe,CAAC;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,SAAS,EAAE,IAAI,CAAC,QAAQ;oBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;oBAChC,UAAU,EAAE,eAAe;iBAC5B,CAAC;aACH,CAAC,CAAA;YAEF,OAAO,EAAE,WAAW,EAAE,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAA;QAC/C,CAAC;KACF;IACD,aAAa,CAAC,EAAE,IAAI,EAAE;QACpB,OAAO;YACL,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,IAAI,EAAE,WAAW,EAAE;aAC7C;SACF,CAAA;IACH,CAAC;IAQD,OAAO,EAAE;QACP,SAAS,EAAT,mBAAS;KACV;CACF,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,11 +0,0 @@
1
- export interface Payload {
2
- record_identifier: string;
3
- operation_type: string;
4
- spreadsheet_id: string;
5
- spreadsheet_name: string;
6
- data_format: string;
7
- fields: {
8
- [k: string]: unknown;
9
- };
10
- enable_batching?: boolean;
11
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"generated-types.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/postSheet/generated-types.ts"],"names":[],"mappings":""}
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const operations_1 = require("./operations");
4
- const action = {
5
- title: 'Post Sheet',
6
- description: 'Write values to a Google Sheets spreadsheet.',
7
- defaultSubscription: 'event = "updated" or event = "new"',
8
- fields: {
9
- record_identifier: {
10
- label: 'Record Identifier',
11
- description: 'Property which uniquely identifies each row in the spreadsheet.',
12
- type: 'string',
13
- required: true,
14
- default: { '@path': '$.__segment_id' }
15
- },
16
- operation_type: {
17
- label: 'Operation Type',
18
- description: "Describes the nature of the operation being performed. Only supported values are 'new' and 'updated'.",
19
- type: 'hidden',
20
- required: true,
21
- default: { '@path': '$.event' }
22
- },
23
- spreadsheet_id: {
24
- label: 'Spreadsheet ID',
25
- description: 'The identifier of the spreadsheet. You can find this value in the URL of the spreadsheet. e.g. https://docs.google.com/spreadsheets/d/{SPREADSHEET_ID}/edit',
26
- type: 'string',
27
- required: true,
28
- default: ''
29
- },
30
- spreadsheet_name: {
31
- label: 'Spreadsheet Name',
32
- description: 'The name of the spreadsheet. You can find this value on the tab at the bottom of the spreadsheet. Please provide a valid name of a sheet that already exists.',
33
- type: 'string',
34
- required: true,
35
- default: 'Sheet1'
36
- },
37
- data_format: {
38
- label: 'Data Format',
39
- description: 'The way Google will interpret values. If you select raw, values will not be parsed and will be stored as-is. If you select user entered, values will be parsed as if you typed them into the UI. Numbers will stay as numbers, but strings may be converted to numbers, dates, etc. following the same rules that are applied when entering text into a cell via the Google Sheets UI.',
40
- type: 'string',
41
- required: true,
42
- default: 'RAW',
43
- choices: [
44
- { label: 'Raw', value: 'RAW' },
45
- { label: 'User Entered', value: 'USER_ENTERED' }
46
- ]
47
- },
48
- fields: {
49
- label: 'Fields',
50
- description: `
51
- The fields to write to the spreadsheet.
52
-
53
- On the left-hand side, input the name of the field as it will appear in the Google Sheet.
54
-
55
- On the right-hand side, select the field from your data model that maps to the given field in your sheet.
56
-
57
- ---
58
-
59
- `,
60
- type: 'object',
61
- required: true,
62
- defaultObjectUI: 'keyvalue:only'
63
- },
64
- enable_batching: {
65
- type: 'boolean',
66
- label: 'Batch Data to Google Sheets',
67
- description: 'Set as true to ensure Segment sends data to Google Sheets in batches. Please do not set to false.',
68
- default: true
69
- }
70
- },
71
- perform: (request, { payload }) => {
72
- return operations_1.processData(request, [payload]);
73
- },
74
- performBatch: (request, { payload }) => {
75
- return operations_1.processData(request, payload);
76
- }
77
- };
78
- exports.default = action;
79
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/postSheet/index.ts"],"names":[],"mappings":";;AAIA,6CAA0C;AAE1C,MAAM,MAAM,GAAwC;IAClD,KAAK,EAAE,YAAY;IACnB,WAAW,EAAE,8CAA8C;IAC3D,mBAAmB,EAAE,oCAAoC;IAEzD,MAAM,EAAE;QACN,iBAAiB,EAAE;YACjB,KAAK,EAAE,mBAAmB;YAC1B,WAAW,EAAE,iEAAiE;YAC9E,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,gBAAgB,EAAE;SACvC;QACD,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EACT,uGAAuG;YACzG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE;SAChC;QACD,cAAc,EAAE;YACd,KAAK,EAAE,gBAAgB;YACvB,WAAW,EACT,6JAA6J;YAC/J,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,EAAE;SACZ;QACD,gBAAgB,EAAE;YAChB,KAAK,EAAE,kBAAkB;YACzB,WAAW,EACT,+JAA+J;YACjK,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,QAAQ;SAClB;QACD,WAAW,EAAE;YACX,KAAK,EAAE,aAAa;YACpB,WAAW,EACT,wXAAwX;YAC1X,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE,KAAK;YACd,OAAO,EAAE;gBACP,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE;gBAC9B,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE;aACjD;SACF;QACD,MAAM,EAAE;YACN,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE;;;;;;;;;GAShB;YACG,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,IAAI;YACd,eAAe,EAAE,eAAe;SACjC;QACD,eAAe,EAAE;YACf,IAAI,EAAE,SAAS;YACf,KAAK,EAAE,6BAA6B;YACpC,WAAW,EAAE,mGAAmG;YAChH,OAAO,EAAE,IAAI;SACd;KACF;IACD,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QAChC,OAAO,wBAAW,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAA;IACxC,CAAC;IACD,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;QACrC,OAAO,wBAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACtC,CAAC;CACF,CAAA;AAED,kBAAe,MAAM,CAAA"}
@@ -1,10 +0,0 @@
1
- import type { Payload } from './generated-types';
2
- import { RequestClient } from '@segment/actions-core';
3
- export declare type MappingSettings = {
4
- spreadsheetId: string;
5
- spreadsheetName: string;
6
- dataFormat: string;
7
- columns: string[];
8
- };
9
- declare function processData(request: RequestClient, events: Payload[]): Promise<(import("@segment/actions-core").ModifiedResponse<unknown> | undefined)[]>;
10
- export { processData };
@@ -1,96 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.processData = void 0;
7
- const actions_core_1 = require("@segment/actions-core");
8
- const index_1 = require("../googleapis/index");
9
- const constants_1 = require("../constants");
10
- const a1_notation_1 = __importDefault(require("@segment/a1-notation"));
11
- const DATA_ROW_OFFSET = 2;
12
- const generateColumnValuesFromFields = (identifier, fields, columns) => {
13
- const retVal = columns.map((col) => fields[col] ?? '');
14
- retVal.unshift(identifier);
15
- return retVal;
16
- };
17
- function processGetSpreadsheetResponse(response, events, mappingSettings) {
18
- const numColumns = mappingSettings.columns.length;
19
- const numRows = response.values?.length;
20
- if (numRows * numColumns > constants_1.CONSTANTS.MAX_CELLS) {
21
- throw new actions_core_1.IntegrationError('Sheet has reached maximum limit', 'INVALID_REQUEST_DATA', 400);
22
- }
23
- const updateBatch = [];
24
- const appendBatch = [];
25
- const eventMap = new Map(events.map((e) => [e.record_identifier, e]));
26
- if (response.values && response.values.length > 0) {
27
- for (let i = 0; i < response.values.length; i++) {
28
- const targetIdentifier = response.values[i][0];
29
- if (eventMap.has(targetIdentifier)) {
30
- const targetEvent = eventMap.get(targetIdentifier);
31
- if (targetEvent.operation_type != 'deleted') {
32
- updateBatch.push({
33
- identifier: targetIdentifier,
34
- event: targetEvent.fields,
35
- index: i
36
- });
37
- }
38
- eventMap.delete(targetIdentifier);
39
- }
40
- }
41
- }
42
- eventMap.forEach((value, key) => {
43
- if (value.operation_type != 'deleted') {
44
- appendBatch.push({
45
- identifier: key,
46
- event: value.fields
47
- });
48
- }
49
- });
50
- return { appendBatch, updateBatch };
51
- }
52
- async function processUpdateBatch(mappingSettings, updateBatch, gs) {
53
- const getRange = (targetIndex, columnCount) => {
54
- const targetRange = new a1_notation_1.default(1, targetIndex);
55
- targetRange.addX(columnCount);
56
- return targetRange.toString();
57
- };
58
- const batchPayload = updateBatch.map(({ identifier, event, index }) => {
59
- const values = generateColumnValuesFromFields(identifier, event, mappingSettings.columns);
60
- return {
61
- range: `${mappingSettings.spreadsheetName}!${getRange(index + DATA_ROW_OFFSET, values.length)}`,
62
- values: [values]
63
- };
64
- });
65
- const headerRowRange = new a1_notation_1.default(1, 1, 1, mappingSettings.columns.length + 1);
66
- batchPayload.push({
67
- range: `${mappingSettings.spreadsheetName}!${headerRowRange.toString()}`,
68
- values: [['id', ...mappingSettings.columns]]
69
- });
70
- return gs.batchUpdate(mappingSettings, batchPayload);
71
- }
72
- async function processAppendBatch(mappingSettings, appendBatch, gs) {
73
- if (appendBatch.length <= 0) {
74
- return;
75
- }
76
- const values = appendBatch.map(({ identifier, event }) => generateColumnValuesFromFields(identifier, event, mappingSettings.columns));
77
- return gs.append(mappingSettings, `A${DATA_ROW_OFFSET}`, values);
78
- }
79
- async function processData(request, events) {
80
- const mappingSettings = {
81
- spreadsheetId: events[0].spreadsheet_id,
82
- spreadsheetName: events[0].spreadsheet_name,
83
- dataFormat: events[0].data_format,
84
- columns: Object.getOwnPropertyNames(events[0].fields)
85
- };
86
- const gs = new index_1.GoogleSheets(request);
87
- const response = await gs.get(mappingSettings, `A${DATA_ROW_OFFSET}:A`);
88
- const { appendBatch, updateBatch } = processGetSpreadsheetResponse(response.data, events, mappingSettings);
89
- const promises = [
90
- processUpdateBatch(mappingSettings, updateBatch, gs),
91
- processAppendBatch(mappingSettings, appendBatch, gs)
92
- ];
93
- return await Promise.all(promises);
94
- }
95
- exports.processData = processData;
96
- //# sourceMappingURL=operations.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../../src/destinations/google-sheets-partner/postSheet/operations.ts"],"names":[],"mappings":";;;;;;AACA,wDAAuE;AACvE,+CAA+D;AAC/D,4CAAwC;AAExC,uEAAqC;AA4BrC,MAAM,eAAe,GAAG,CAAC,CAAA;AAwBzB,MAAM,8BAA8B,GAAG,CAAC,UAAkB,EAAE,MAAc,EAAE,OAAiB,EAAE,EAAE;IAC/F,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAA;IACtD,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAC1B,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAQD,SAAS,6BAA6B,CAAC,QAAqB,EAAE,MAAiB,EAAE,eAAgC;IAC/G,MAAM,UAAU,GAAG,eAAe,CAAC,OAAO,CAAC,MAAM,CAAA;IACjD,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,EAA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