sfc-utils 1.3.63 → 1.3.64

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 (2) hide show
  1. package/copy/c2p_sheet.js +14 -13
  2. package/package.json +1 -1
package/copy/c2p_sheet.js CHANGED
@@ -38,7 +38,6 @@ let googleAuth = (configData) => {
38
38
  };
39
39
 
40
40
  let createSheet = (auth, fallback, configData) => {
41
- console.log(configData, "config data from create sheet");
42
41
  return new Promise((resolveAll, rejectAll) => {
43
42
  let gmail;
44
43
  if (!fallback) {
@@ -62,16 +61,21 @@ let createSheet = (auth, fallback, configData) => {
62
61
  }
63
62
 
64
63
  const drive = google.drive({ version: "v3", auth });
65
- const body = { title: "New C2P sheet" };
66
64
  const templateId = "1DUvYnFdxtBv1AXcDI9X00s_opUSu4uHJmd5LNemCN9E";
65
+ const body = { title: "New C2P sheet", name: configData.PROJECT.SLUG };
66
+ if (configData.PROJECT.MARKET_KEY === "SFC"){
67
+ // If this is SFC, make sure it's created in the shared folder
68
+ body.parents = ['1_jnRs3xOYDxm27y7TZB9gkudzTRmcd7x'];
69
+ }
70
+ const createOptions = {
71
+ fileId: templateId, // Base template
72
+ resource: body,
73
+ supportsAllDrives: true,
74
+ //'copyCollaborators': true // This doesn't work unfortunately
75
+ };
67
76
  drive.files.copy(
68
- {
69
- fileId: templateId, // Base template
70
- resource: body,
71
- //'copyCollaborators': true // This doesn't work unfortunately
72
- },
77
+ createOptions,
73
78
  (err, resp) => {
74
- console.log("SHEET RESP", resp);
75
79
  // Make edits to the sheet to match the repo details
76
80
  let resources = {
77
81
  auth: auth,
@@ -127,20 +131,17 @@ let createSheet = (auth, fallback, configData) => {
127
131
  );
128
132
  resolveAll();
129
133
  } else {
130
- // Transfer ownership to the user
131
134
  const permission = {
132
135
  type: "user",
133
- role: "owner",
134
- emailAddress: gmail
136
+ role: "writer",
137
+ emailAddress: gmail,
135
138
  };
136
139
  drive.permissions.create(
137
140
  {
138
141
  resource: permission,
139
142
  fileId: resp.data.id, // Modify the created file
140
- transferOwnership: true
141
143
  },
142
144
  (permErr, permResp) => {
143
- //console.log("permResp", permResp, permErr)
144
145
  if (permErr) {
145
146
  console.log("An error prevented the sharing of this sheet!");
146
147
  rejectAll();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sfc-utils",
3
- "version": "1.3.63",
3
+ "version": "1.3.64",
4
4
  "author": "ewagstaff <evanjwagstaff@gmail.com>",
5
5
  "dependencies": {
6
6
  "archieml": "^0.4.2",